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 !!