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.

Failed to merge positions: existing order in EXECUTING status
 Post subject: Failed to merge positions: existing order in EXECUTING status Post rating: 0   New post Posted: Thu 22 Nov, 2012, 20:30 

User rating: 0
Joined: Thu 15 Sep, 2011, 07:48
Posts: 4
Location: United States,
One more question, as it may also be related, why would I routinely get the message:

"Failed to merge positions: existing order in EXECUTING status"

when the only time I try and merge orders is AFTER the order is DONE executing (as notified in the onMessage loop):

The logic that causes the error is is essentially as follows:

for (IOrder : engine.getOrders()) {

  if (mergeSymbol(order) && (order.getFillTime() != 0) && (Double.compare(order.getRequestedAmount(),order.getAmount()) == 0)) MergeOrders.add(order);

}

try
  if (MergeOrders.size() >= 2) engine.mergeOrders(myLabel,MergeOrders);
catch (JFException e) { console.getOut().println(e.toString()); }


It would also be nice / cleaner if there were an order status such as FULLYFILLED.


 
 Post subject: Failed to merge positions: existing order in EXECUTING status Post rating: 0   New post Posted: Fri 23 Nov, 2012, 08:40 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
tymorapro wrote:
One more question, as it may also be related, why would I routinely get the message:

"Failed to merge positions: existing order in EXECUTING status"
See: viewtopic.php?f=65&t=35524&p=45875

tymorapro wrote:
It would also be nice / cleaner if there were an order status such as FULLYFILLED.

See:
https://www.dukascopy.com/client/javadoc/com/dukascopy/api/IMessage.Reason.html#ORDER_FULLY_FILLED
Find it also in the diagram:
https://www.dukascopy.com/wiki/#Order_state/Market_order_states_diagram


 
 Post subject: Re: Failed to merge positions: existing order in EXECUTING status Post rating: 0   New post Posted: Mon 26 Nov, 2012, 19:39 

User rating: 0
Joined: Thu 15 Sep, 2011, 07:48
Posts: 4
Location: United States,
That's my point, though. The orders ARE already fully-filled.
And while there are things such as FULLY FILLED messages, messages can be missed especially
on disconnects, so it would also make sense if we could ask JForex for it's current order status.

As such, I've also determined that the reason for my double-fills is that if you try and MODIFY the
PRICE of an order while Dukascopy is in the process of FILLING the same order (assuming both orders
are at a price that can be immediately filled), you will likely get a double-fill. Here is my trade log that
shows this precisely:

order sent to JForex -> JForexID:44487973 date:20121125 time:201029 SELL 3000 #EURUSD 1.2963 typ:LMT myID:DM86/1
order MODIFIED via setOpenPrice() -> JForexID:44487973 date:20121125 time:201029 SELL 3000 #EURUSD 1.2964 typ:LMT myID:DM86/1

TWO EXECUTIONS for 3000 each, same JForexID, different JForex EXECUTION ID:
EXE| execID:171227082 JForexID:44487973 date:20121125 time:201030 SELL 3000 #EURUSD 1.29646 myID: DM86/1 msg:ORDER FILLED, SOLD 3000 #EURUSD AT 1.29646

EXE| execID:171227085 JForexID:44487973 date:20121125 time:201030 SELL 3000 #EURUSD 1.29646 myID: DM86/1 msg:ORDER FILLED, SOLD 3000 #EURUSD AT 1.29646

EXE|171227085|44487973|20121125|201030|S|3|#EURUSD|1.29646|SWFX|DM86/1|ORDER FILLED, SOLD 3 #EURUSD AT 1.29646|

As such, my immediate solution is to completely cancel an order and send a new one instead of attempting to MODIFY an active JForex order. So far, the problem hasn't come up again since I made that change.

I would appreciate any updates Dukascopy can offer as to having this bug / glitch corrected.

Thank you again for your assistance with this.


 
 Post subject: Re: Failed to merge positions: existing order in EXECUTING status Post rating: 0   New post Posted: Tue 27 Nov, 2012, 09:12 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
tymorapro wrote:
That's my point, though. The orders ARE already fully-filled.
And while there are things such as FULLY FILLED messages, messages can be missed especially
on disconnects, so it would also make sense if we could ask JForex for it's current order status.
Alternative is to check if order requested amount equals the fill amount, i.e.:
Double.compare(IOrder.getRequestedAmount(),IOrder.getAmount())==0
Thus there is no extra IOrder.Status necessary.
tymorapro wrote:
As such, I've also determined that the reason for my double-fills is that if you try and MODIFY the
PRICE of an order while Dukascopy is in the process of FILLING the same order (assuming both orders
are at a price that can be immediately filled), you will likely get a double-fill. Here is my trade log that
shows this precisely:

order sent to JForex -> JForexID:44487973 date:20121125 time:201029 SELL 3000 #EURUSD 1.2963 typ:LMT myID:DM86/1
order MODIFIED via setOpenPrice() -> JForexID:44487973 date:20121125 time:201029 SELL 3000 #EURUSD 1.2964 typ:LMT myID:DM86/1

TWO EXECUTIONS for 3000 each, same JForexID, different JForex EXECUTION ID:
EXE| execID:171227082 JForexID:44487973 date:20121125 time:201030 SELL 3000 #EURUSD 1.29646 myID: DM86/1 msg:ORDER FILLED, SOLD 3000 #EURUSD AT 1.29646

EXE| execID:171227085 JForexID:44487973 date:20121125 time:201030 SELL 3000 #EURUSD 1.29646 myID: DM86/1 msg:ORDER FILLED, SOLD 3000 #EURUSD AT 1.29646

EXE|171227085|44487973|20121125|201030|S|3|#EURUSD|1.29646|SWFX|DM86/1|ORDER FILLED, SOLD 3 #EURUSD AT 1.29646|

As such, my immediate solution is to completely cancel an order and send a new one instead of attempting to MODIFY an active JForex order. So far, the problem hasn't come up again since I made that change.

I would appreciate any updates Dukascopy can offer as to having this bug / glitch corrected.

Thank you again for your assistance with this.
The issue has been registered and will be investigated as soon as available. Please refer to viewtopic.php?t=48368


 

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