Order of events?

Created at 29 Aug 2015, 00:01
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
moneybiz's avatar

moneybiz

Joined 06.12.2011

Order of events?
29 Aug 2015, 00:01


Is there any order of events like "OnTick" and "Positions.Closed"?

Which fires first, guaranteed?


@moneybiz
Replies

Spotware
01 Sep 2015, 02:02

Dear Trader,

Please have a look at the Position events section of our API Programmers Guides and at OnBar vs OnTick section of our cAlgo support site.


@Spotware

moneybiz
01 Sep 2015, 03:20

RE:

Spotware said:

Dear Trader,

Please have a look at the Position events section of our API Programmers Guides and at OnBar vs OnTick section of our cAlgo support site.

Thank you bu I don't ask for the usage of the events.

I'm asking whether they are fired async or sync. It seems to me that the position data comes together packed with tick data and first OnTick() event is fired then Position.Closed event (if there is one in the received packet from the server).

If they are independent of each other and there is no ordering guaranteed I will implement a locking mechanism, that's why I'm asking this question.

I want to know whether they are independent of each other or you're putting them in any order to prevent users to dive into async coding? 


@moneybiz

Spotware
03 Sep 2015, 03:50

Dear Trader,

Positions.Closed and OnTick event are independent.

They can come in any order.


@Spotware