Which event happens 1st - PositionUpdate vs OrderExecuted/Updated

Custom indicators, trading strategies, data export and recording and more...
blk
Posts: 44
Joined: Fri Nov 01, 2019 8:59 pm
Has thanked: 7 times

Which event happens 1st - PositionUpdate vs OrderExecuted/Updated

Post by blk » Thu May 13, 2021 1:08 am

Hi,

Lets say we have an addon subscribed to orderListener and positionListener... Is there any guarantee on which event happens/arrives first to an API subscribed addon when you are filled?

Does the position update is sent first to the addon or the order executed/filled ? Or Bookmap just sends all events and the order of events is not guaranteed 

Thanks,

Andry API support
Posts: 548
Joined: Mon Jul 09, 2018 11:18 am
Has thanked: 25 times
Been thanked: 85 times

Re: Which event happens 1st - PositionUpdate vs OrderExecuted/Updated

Post by Andry API support » Thu May 13, 2021 7:24 am

order executed/filled is likely to come first but the order of events is not guaranteed. The order depends on a L0 adapter implementation which in its turn depends on an exchange's API.

blk
Posts: 44
Joined: Fri Nov 01, 2019 8:59 pm
Has thanked: 7 times

Re: Which event happens 1st - PositionUpdate vs OrderExecuted/Updated

Post by blk » Thu May 13, 2021 12:32 pm

Got it, thanks for your reply. Is there a way we can expand the Rithmic or CQG L0 adapter to add new features such as server side volume stops?

 

fenepet965
Posts: 24
Joined: Wed May 26, 2021 12:13 pm
Has thanked: 2 times

Re: Which event happens 1st - PositionUpdate vs OrderExecuted/Updated

Post by fenepet965 » Wed May 26, 2021 12:15 pm

Hi Andrey,

This is an interesting topic. Do you recommend any approach to process these events if they are out-of-order?

Andry API support
Posts: 548
Joined: Mon Jul 09, 2018 11:18 am
Has thanked: 25 times
Been thanked: 85 times

Re: Which event happens 1st - PositionUpdate vs OrderExecuted/Updated

Post by Andry API support » Thu May 27, 2021 4:21 pm

Do you recommend any approach to process these events if they are out-of-order
if your module mechanics strongly depends on the order of events a possible way would be calculating position in your module based on order updates (like adapters or Bookmap do when an exchange does not provide position info). In this case you may use position info from Bookmap only to make sure your calculation is correct in the long run. Your calculated position and position info from Bookmap may differ but only during a short interval (fraction of a second usually) - due to unpredicted events ordering.

Post Reply