I used to do cancel & replace, but lately I
have been using modify more because of the overfill problem.? I find
cancel & replace easier to program, because it handles the rare case
where the order no longer exists.
Rather than modify an order from limit to market, I suggest changing the
limit price to make the order immediately marketable.
Rather than using order status to track position, I recommend using
updatePortfolio().? It reports all changes immediately, plus
re-reports position every 2 or 3 minutes.
[rwk]
At 08:16 AM 12/1/2015, you wrote:
toggle quoted message
Show quoted text
The problem with the
cancel/resubmit approach is you create a race condition. The limit order
could have filled but you didn't get the status update yet. When you send
the market order you end up filling twice and have an unintended
position.
I use the approach of changing the limit order to a market order so that
the race condition is avoided.
On 12/1/2015 7:12 AM, rholowczak wrote:
?
You wrote:
"I then subsequently amend the [limit] order in TWS to change it to
say a market order"
I would not recommend this. instead just cancel the limit order and issue
a new market order if that is your (strategy's) intention.
Note that there are differences in the way orders are handled with
respect to edemo, paper trading and funded accounts. As far as I can tell
these are not documented well and may differ between asset
types.