Dukascopy
 
 
Wiki JStore Search Login

IOrder.getState() seems to have returned OPEN for a FILLED order
 Post subject: IOrder.getState() seems to have returned OPEN for a FILLED order Post rating: 0   New post Posted: Wed 20 Feb, 2013, 18:26 
User avatar

User rating: 6
Joined: Thu 19 May, 2011, 11:14
Posts: 235
Location: South Africa,
On a LIVE account, I have received the message...
ORDER_CLOSE_REJECTED message wrote:
ORDER_ALREADY_FILLED-Order can't be processed: order in FILLED state... [truncated for brevity]

...even while message.getOrder().getState() returns OPEN.

It can be demonstrated from the code and log below that
  1. order.getState()==OPEN (line 12)
  2. message.getOrder()==order (line 3, because the exception was not thrown)
  3. message.getType()==ORDER_CLOSE_REJECTED (line 18)
  4. message.getContent()=="ORDER_ALREADY_FILLED-Order can't be processed: order in FILLED state... (line 22)
Or am I missing something?

The contiguous code snippet...
    void message(IMessage message) throws UnexpectedMessageException {
        Debug.assertFalse(isSimulating());
        if (message.getOrder() != order) {
            throw new UnexpectedMessageException("This message is not intended for my order.");
        }
        String myComment = null;
        String messageContent = message.getContent();
        if (messageContent != null && messageContent.contains("Invalid price format - please use increments of 0.1 pip.")) {
            myComment = "targetEntry=" + getTargetEntry() + ", targetSl=" + getTargetSl() + ", targetTp=" + getTargetTp();
        }
        if (messageContent != null && messageContent.contains("ORDER_ALREADY_FILLED")) {
            myComment = "getState()==" + order.getState() + ", getFillTime()==" + order.getFillTime();
        }
        if (log != null) {
            logWriteTag("MSG");
            log.print(Conversions.gmtDateStr(message.getCreationTime()));
            log.print(',');
            log.print(message.getType());
            log.print(',');
            log.print(order.getId());
            log.print(',');
            log.println(message.getContent());
            if (myComment != null) {
                logWriteTag("CMT");
                log.print(',');
                log.print(',');
                log.print(',');
                log.println(myComment);
            }
        }
// more code followed this snippet

...generated this contiguous log snippet...
the log wrote:
MSG,+,2013.02.20 16:05:00.721,ORDER_CLOSE_REJECTED,18898680,ORDER_ALREADY_FILLED-Order can't be processed: order in FILLED state, order #78576575 ENTRY SELL 0.003 mil. EUR/USD @ LIMIT 1.33598 IF BID <= 1.33628
CMT,+,,,,getState()==OPENED, getFillTime()==0


At the same time, this was found in the Java console:
Java console wrote:
20.02.2013 18:04:20.085 SEVERE connection.a ] Feedback received catched and throwed: null
20.02.2013 18:04:20.085 SEVERE a.c ] Runnable execution error
java.lang.NullPointerException
at com.dukascopy.charts.data.a.e.d(Unknown Source)
at com.dukascopy.dds2.greed.connection.a.j(Unknown Source)
at com.dukascopy.dds2.greed.connection.a.a(Unknown Source)
at com.dukascopy.transport.client.a.d.execute(Unknown Source)
at com.dukascopy.transport.client.a.c.run(Unknown Source)
at com.dukascopy.transport.client.j.run(Unknown Source)


This message was received (and the log snippet generated) repeatedly (perhaps 50 times, until I noticed it and stopped the strategy) because my strategy repeatedly tried to close the order.


 
 Post subject: Re: IOrder.getState() seems to have returned OPEN for a FILLED order Post rating: 0   New post Posted: Mon 25 Feb, 2013, 09:40 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
This is due to connection problems - you can neither close nor fill your orders while disconnected from the trading servers.


 
 Post subject: Re: IOrder.getState() seems to have returned OPEN for a FILLED order Post rating: 0   New post Posted: Wed 27 Feb, 2013, 10:33 
User avatar

User rating: 6
Joined: Thu 19 May, 2011, 11:14
Posts: 235
Location: South Africa,
Clearly I was not disconnected because the ORDER_ALREADY_FILLED messages from the trading servers were reaching me.

(If, on the other hand, those messages are generated in the local API, then the local API is contradicting itself because getState()==OPENED.)


 

Jump to:  

cron
  © 1998-2024 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com