unable to modify order
See original GitHub issuei am using below to create a order first and then i have changed the limit price triggered the order , it places a new order instead of modifying the order. is there a way to mention orderId in subsequent order modification requests?
places an order with limit price 60
from ib_insync import *
contract = Contract(secType='OPT', localSymbol='NIFTY2290817700CE', exchange='NSE', currency='INR')
order = LimitOrder( 'BUY', 50.0 , 60)
x = IB()
x.connect('127.0.0.1', 7496, clientId=1)
print(x.placeOrder(contract=contract, order=order))
Now i have triggered the same with new limit price -70
from ib_insync import *
contract = Contract(secType='OPT', localSymbol='NIFTY2290817700CE', exchange='NSE', currency='INR')
order = LimitOrder( 'BUY', 50.0 , 70)
x = IB()
x.connect('127.0.0.1', 7496, clientId=1)
print(x.placeOrder( contract=contract, order=order))
it placed a new order on the same security with new limit price instead of modifying the existing one.
Kindly help.
Issue Analytics
- State:
- Created a year ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Unable to modify order with IB - Forum
I am encountering an error while modifying live orders with interactive brokers. When I run the strategy in a backtest, or live in...
Read more >modify order failed [Invalid S/L or T/P] - Short Selling
But I got following errors when a Buy or Sell order is filled: Here one can see a sell-order is filled. But by...
Read more >Solved: Unable to edit order with local delivery
I am unable to edit orders for local delivery. I want to edit the order but it is telling me I can't edit...
Read more >Unable to change order status - Is this a bug or working as ...
Common Questions · 1) Nowhere it is documented that you cannot change order status(from "Completed" to "Awaiting Fulfilment") for orders having digital products....
Read more >Why am I getting an error saying 'Order cannot be modified ...
This error generally occurs when you try to modify an order that is either already executed or cancelled.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes that is classic IB. Any field that IB complains about can be set to it’s default value, like
It is so weird that they fill order fields that they themselves then reject.
It is also possible to create a new order in the same way the original order was created and then setting the existing
orderId
.Just realized another example why duplicating orders helps more than changing openTrades() directly: when modifying orders after hours, we submit the new order, but IBKR sets the updated order state to “(PreSubmitted, Modify),” so don’t know if the change is actually accepted until IBKR’s market submission time happens (could even be days later if a modification is submitted after-hours Friday for a Monday open).
If we modify an order attached to a live open trade directly with assignment, the local state gets temporarily updated (or until we restart and it reloads live data again) then we have a false view of current limit order / quantity versus what IBKR still holds in the trading system until it submits the next update.
Though, this also means an order’s updated limit price can’t be viewed until the market opens so we have no record of what the updated order will be when submitted again (so if we have limit order at $3, and we updated it to $2 after hours, the
openTrades()
order will never show the modified $2 price until the order is re-submitted at market open… we either have to just remember or record it in another database locally as some “pending modification queue price updates”).