API Support Forum
OEC API > API Support > OnCommandUpdated is called twice when you modify LIMIT order
Author Topic: OnCommandUpdated is called twice when you modify LIMIT order
(3 messages, Page 1 of 1)
Moderators: VPfau
AAnatoly
Posts: 22
Joined: Jul 01, 2010


Posted: Aug 30, 2010 @ 11:16 AM             Msg. 1 of 3
Hi.

Here is following issue.

OnCommandUpdated is called twice when you modify LIMIT order.

First time it is called with old price and this is not good.
The issue is reproducible with Advandced Demo application.

Here are logs:



17:42:30.093 : Command #201212319 Modify for Order #201212316 (Buy 1 ZCU0 LMT 4.2700) updated



Note, LIMIT order price now 4.2700.
Now I send modify order command: Buy 1 ZCU0 LMT 4.2575

And instead of one callback OnCommandUpdated I get OnCommandUpdated called twice:

17:42:34.249 : Command #201212320 Modify for Order #201212316 (Buy 1 ZCU0 LMT 4.2700) updated
17:42:34.281 : Command #201212320 Modify for Order #201212316 (Buy 1 ZCU0 LMT 4.2575) updated


Note. First time OnCommandUpdated is called with previously price 4.2700 of Limit Order and seconds time the same second 17:42:34 it
Is called with new correct price 4.2575.

Both callbacks are with the same CommandID 201212320.

How we can avoid this callback. We need to find a way to ignore it, otherwise we have problem in our application

Regards,
Anatoly


Anatoly Gutnick
Edited by AAnatoly on Aug 30, 2010 at 11:17:38
VictorV
Posts: 746
Joined: May 08, 2007


Posted: Aug 30, 2010 @ 11:29 AM             Msg. 2 of 3
Hi.

Could you please check what command statuses (Command.State) in both callbacks?

Victor Vins
Software Developer
AAnatoly
Posts: 22
Joined: Jul 01, 2010


Posted: Aug 31, 2010 @ 02:29 AM             Msg. 3 of 3
In first callback Command.State is Sent,
in seconds callback it is Executed.

OnCommandUpdatedEvent Command:[#201212365 Modify] Order::ID :[201212364] Order[Buy 1 ESU0 LMT 1038.00] Command->State: [Sent]

OnCommandUpdatedEvent Command:[#201212365 Modify] Order::ID :[201212364] Order[Buy 1 ESU0 LMT 1038.25] Command->State: [Executed]

Seems this answer my question.
We can use this Command.State in application logic.


Additional question regarding Command->State:[Failed]
If if change lots number to something big like 10000 i get Command->State Failed.

But how i can know what is reason this command failed?

I see now Command->ResultComments.



Thanks.
Anatoly




Anatoly Gutnick
Edited by AAnatoly on Aug 31, 2010 at 02:30:24
Edited by AAnatoly on Aug 31, 2010 at 02:51:09
Edited by AAnatoly on Aug 31, 2010 at 05:02:31