API Support Forum
OEC API > API Support > Order Modify Failed, though commands shows a ready state for update
Author Topic: Order Modify Failed, though commands shows a ready state for update
(5 messages, Page 1 of 1)
Moderators: VPfau
CWeber984
Posts: 226
Joined: Apr 24, 2012


Posted: Oct 20, 2015 @ 07:43 PM             Msg. 1 of 5
I sometimes see this issue occur:

1) An attached stop order price has recently been modified.
2) This previous price modification succeeded, and the order's Commands show Modified.
3) Yet, the next attempt to modify the price fails saying that the last modification was in execution.

Its my understanding that when the last command shows Modified, then the Modification attempt has completed successfully and the order can again be modified.

A revealing fact is that I've only seen this occur when the Modified line in the Commands list is less than a 100th of a second previous to the next Modification attempt. Its almost like Modified gets added to the Commands list before a state variable is updated, a state variable that causes the next mod attempt to be refused.

Here's a link to a pic of the order's command history. You will see the issue towards the ends of the history. You'll probably want to download the pic and expand it a bit to see the Commands log clearly.
http://i58.tinypic.com/104fg42.jpg

Please advise as to how to avoid such Modification Failed errors, given that the order shows that it was in a good state for another modification.

Thanks,
Edited by CWeber984 on Oct 20, 2015 at 19:52:51
JSmith5611
Posts: 187
Joined:


Posted: Oct 23, 2015 @ 02:26 PM             Msg. 2 of 5
We are working on this.

Jason Smith
JSmith5611
Posts: 187
Joined:


Posted: Oct 26, 2015 @ 01:42 PM             Msg. 3 of 5
Looking through logs, I am seeing your last modify coming in before the previous modify is finished.

Are you checking the State of the last command for the Order before sending the next one?

The pop-up message history could be off due to differences in time between your system and ours. For instance the time stamp in that log for modify #163941692 is at 16.939 seconds... we received it at 16.933 seconds.

Jason Smith
CWeber984
Posts: 226
Joined: Apr 24, 2012


Posted: Oct 26, 2015 @ 08:04 PM             Msg. 4 of 5
Hi JSmith,

Thanks for researching the problem. I sent a PM to clarify these q's.

CHW
CWeber984
Posts: 226
Joined: Apr 24, 2012


Posted: Oct 28, 2015 @ 06:14 PM             Msg. 5 of 5
Here's the resolution to this forum post. It was really helpful to us and we appreciate Gains support and the time the dev took to research our issue and explain it.

Posted On: Yesterday @ 08:58 AM
Subject: Re: Topic: Order Modify Failed, though commands shows a ready state for update

Message:

The order command history just translates to local time based on time zone, and orders the message by time stamps.

The messages are appearing out of order because the timestamps that you or the API generate are slightly off compared to the ones that our servers are generating.

Each command has two timestamps.
'Timestamp' is generated when the command is created. A modify command will be created on your system, so the timestamp will be your time.
'ResultTimestamp' is the timestamp when the command is marked as executed on the servers, and is the time of the servers.

The message order history just goes by these timestamps. When you see a line that says "... modify to Sell.. etc" that timestamp was generated by your system. The "Modified" lines have timestamps created by the servers... The history just sorts by these timestamps.

In this case your system's clock is at least 6ms faster than our servers' clocks. This is evidenced by the server logs seeing your modify #163941692 come in 9:39:16.933, while the timestamp on the command, generated by your system, is 9:39:16.939.

The previous modify was completed from our server's perspective
at 9:39:16.937, after your message was received by us, but before your timestamp said you sent it.

Jason Smith

CHW