I am trying to modify an existing order in my tws with ib_insync.
My code looks like this:
for pos in ib.openOrders():
if pos.orderId == l_TakeProfitOrder['orderId']:
takeProfitOrder = pos
if pos.orderId == l_StoppLossOrder['orderId']:
stoppLossOrder = pos
print(TakeProfitOrder)
print(takeProfitOrder)
quantity = takeProfitOrder.totalQuantity
takeProfitOrder.auxPrice = round_nearest(takeProfitOrder.auxPrice + 0.2, 0.1)
print(takeProfitOrder)
ib.placeOrder(contract, takeProfitOrder)
And the output is the following:
StopOrder(orderId=7694, clientId=5, permId=871591821, action='SELL', totalQuantity=10.0, lmtPrice=0.0, auxPrice=-1.6, ocaGroup='0_DTE_BPS_2023.06.09 21:20', ocaType=1)
StopOrder(orderId=7694, clientId=5, permId=871591821, action='SELL', totalQuantity=10.0, lmtPrice=0.0, auxPrice=-1.6, ocaGroup='0_DTE_BPS_2023.06.09 21:20', ocaType=1)
StopOrder(orderId=7694, clientId=5, permId=871591821, action='SELL', totalQuantity=10.0, lmtPrice=0.0, auxPrice=-1.4, ocaGroup='0_DTE_BPS_2023.06.09 21:20', ocaType=1)
And then I get the erorr message:
Error 105, reqId 7694: Order being modified does not match original order.
So even though, I am loading an existing order and only modifying the auxPrice I get the error that both orders do not match.
I would really appreciate some help here :) Thanks in advance!
I am trying to modify an order with ib_insync but I get an error message