Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

Strategy Module not receiving Partial Fill Messages
 Post subject: Strategy Module not receiving Partial Fill Messages Post rating: 0   New post Posted: Fri 12 Oct, 2012, 20:31 
User avatar

User rating: 98
Joined: Mon 23 Jul, 2012, 02:02
Posts: 656
Location: United States, Durham, NC
JForex platform 2.18.18 with API ver. 2.7.2.1

I believe there is a bug with incomplete messaging to a Strategy Module when Multiple Partial Fills occur, primarily with PLACE_OFFER and PLACE_BID order types. These are the most likely to exhibit Partial Fill scenarios. This may be true for all Partial Fill scenarios, I don't know, because they are unlikely to occur with conditional Limit orders, for example.

The FIRST partial fill message is received with IMessage.Type.ORDER_FILL_OK. Subsequent Partial Fill messages with IMessage.Type.ORDER_FILL_OK are NOT delivered. The attached image of the log shows that 3 Messages should have been delivered, and then also a Cancellation notification should have been received. The FIRST message representing the first partial fill was received, but no others were received.

The code below looks for ORDER_FILL_OK, but it Logs all messages which begin with ORDER... and it can be seen from the image that ORDER_CHANGED_OK appears multiple times.

So, I conclude that in Partial Fill scenarios, there is an issue in the API, where not all Partial Fill messages are sent as they should be, and also Cancellation notification should also have been received, since a Remainder was <1000 and that Cancel notification should have been sent to the Strategy module.


      String typeStr = message.getType().toString();
      if ( !message.getType().equals(IMessage.Type.ORDER_FILL_OK)) {
          if (typeStr.startsWith("ORDER")) {
             console.getOut().println("Rejected ORDER msg: "+message.getType());
          }
         return;
      }


I was alerted to this problem initially because my onMessage handler adds a Take Profit ONLY when the order is Completely Filled. Now, I realize that this raises at least 2 or maybe several issues in Partial Fill scenarios:

1) Messages which should be delivered are not delivered (except the first one).
2) If the Cancellation notification is not delivered, then my onMessage handler will not know when to add the Take Profit. It's design is to add the Take Profit either when Completely Filled, OR when the order is Partially filled, but will fill no further.

Please look into these issues. I hope I've given enough information to help you track down the areas where these possible issues exist.

Thanks very much !!


Attachments:
StrategyModuleNotReceivingMessages.png [302.56 KiB]
Downloaded 382 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: Strategy Module not receiving Partial Fill Messages Post rating: 0   New post Posted: Mon 15 Oct, 2012, 11:49 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Please check with the latest JForex SDK.


 
 Post subject: Re: Strategy Module not receiving Partial Fill Messages Post rating: 0   New post Posted: Mon 15 Oct, 2012, 16:09 
User avatar

User rating: 98
Joined: Mon 23 Jul, 2012, 02:02
Posts: 656
Location: United States, Durham, NC
I'm not accustomed to using the standalone, but will see what I can test, if you think it's fixed in the latest API ? Are you saying you have fixed some issues related to partial fill messaging?


 
 Post subject: Re: Strategy Module not receiving Partial Fill Messages Post rating: 0   New post Posted: Tue 16 Oct, 2012, 16:02 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
hyperscalper wrote:
1) Messages which should be delivered are not delivered (except the first one).
All the messages that you refer to have been delivered according to the diagram, see (click on it to enlarge):
https://www.dukascopy.com/wiki/#Order_state/Conditional_order_states_diagram
hyperscalper wrote:
2) If the Cancellation notification is not delivered, then my onMessage handler will not know when to add the Take Profit. It's design is to add the Take Profit either when Completely Filled, OR when the order is Partially filled, but will fill no further.
The successful unfilled amount cancellation causes the arrival of IMessage.Type.ORDER_CHANGED_OK. This is also according to the same diagram.

Also consider doing the non-order-fill message retrieval the following way:
if(message.getOrder() != null && message.getType() != IMessage.Type.ORDER_FILL_OK){
     console.getOut().println(message);
}


 

Jump to:  

  © 1998-2025 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