Dukascopy
 
 
Wiki JStore Search Login

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
 Post subject: How to wait for fully filled orders Post rating: 0   New post 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


 
 Post subject: Re: How to wait for fully filled orders Post rating: 0   New post Posted: Thu 10 Mar, 2016, 13:29 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
When an order is fully filled onMessage will receive a message with IMessage.getReason() equal to ORDER_FULLY_FILLED
https://www.dukascopy.com/wiki/#Order_state


 
 Post subject: Re: How to wait for fully filled orders Post rating: 0   New post 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.


 
 Post subject: Re: How to wait for fully filled orders Post rating: 0   New post Posted: Tue 15 Mar, 2016, 13:49 
User avatar

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.


 

Jump to:  

cron
  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com