|
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.
How to wait for fully filled orders |
magsB
|
Post subject: How to wait for fully filled orders |
Post rating: 0
|
Posted: Thu 10 Mar, 2016, 10:57
|
|
User rating: 0
Joined: Mon 29 Feb, 2016, 10:52 Posts: 2 Location: Canada, Toronto
|
IOrder.waitForUpdate() waits for state change, however, there's no unique state for fully filled orders (partially/fully filled orders share State.FILLED according to order state diagram) To wait for full fill, I have to stay in a loop with timeout, waiting for order amount == requested amount. I'm wondering if there's a more efficient way to do this synchronously (i.e., without async notification from strategy's onMessage())
Thanks
|
|
|
|
 |
API Support
|
Post subject: Re: How to wait for fully filled orders |
Post rating: 0
|
Posted: Thu 10 Mar, 2016, 13:29
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
|
|
|
 |
magsB
|
Post subject: Re: How to wait for fully filled orders |
Post rating: 0
|
Posted: Thu 10 Mar, 2016, 14:23
|
|
User rating: 0
Joined: Mon 29 Feb, 2016, 10:52 Posts: 2 Location: Canada, Toronto
|
Thanks for the reply. As stated in the original question, I want to block after submitting the order until the order is fully filled. I don't see how can this be done using onMessage() notification unless you mean I have to create and event, block on it, then set it from onMessage() when ORDER_FULLY_FILLED is received (I assume for this, onMessage() and onTick() run in two separate threads?) Please clarify.
|
|
|
|
 |
API Support
|
Post subject: Re: How to wait for fully filled orders |
Post rating: 0
|
Posted: Tue 15 Mar, 2016, 13:49
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
All IStrategy methods are executed in a thread safe way. onMessage will not execute before current onTick has finished.
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|