|
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.
IEngine.getOrders refresh rate |
[arnab]
|
Post subject: IEngine.getOrders refresh rate |
Post rating: 0
|
Posted: Fri 15 Oct, 2010, 02:11
|
|
User rating: 0
Joined: Tue 25 May, 2010, 04:21 Posts: 21
|
Hi,
I am trying to write code which would look for any new order that is being placed in an account (either by some other strategy code or manually) and then post it in database as soon as a new order comes up or any update has been made to existing opened orders. I know that I can check current open orders by calling context.getEngine().getOrders() in OnTick() method. However, onTick() is depandent on whether there is any tick coming for the subscribed instrument or not. This process is delaying to capture any changes that could have been made in any open orders. I want to start a separate thread that monitors opened trades.
Is it possible to start a separate Timer from onStart() and then use context.getEngine().getOrders() to track the orders? Will the call of getOrders() from a separate thread reflect currents changes in the orders?
You can assume that Timer will be scheduleAtFixedRate of 100 milliseconds.
Thanks Arnab
|
|
|
|
 |
API Support
|
Post subject: Re: IEngine.getOrders refresh rate |
Post rating: 0
|
Posted: Fri 15 Oct, 2010, 09:26
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
Any changes to the orders will come with a message in onMessage method. You can use it to track changes to the orders. Orders can't be accessed from the other threads because of the synchronization issues. If you want to access orders from the other thread (timer thread) you must use IContext.executeTask method to call the task in the strategy thread.
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|