Open mauserrifle opened 2 weeks ago
I started using ib.trades()
and this way I can fetch and filter it myself using status. But when I try to modify the profit taker order using placeOrder
I get error that the parent order cannot be found. So much is going wrong and I suspect something changed in TWS. I cannot test the original library ib_insync since it doesn't work anymore (disconnect issues) with the latest TWS stable/latest. I have had no issues for 2 years with this codebase and did lots of algo testing (thousand of test trades). Now it seems so bugged. Really wondering whether more people have issues.
But ib_async only fetches 1 open order which is the stop, the profit taker is missing.
That does sound odd. Seems it should show either all or nothing, but not just half of them? Maybe double check the config option "Download open orders on connection" is enabled? Also make sure your client id is 0 if you are trying to read orders not placed from the API originally. IBKR restricts orders by client id and only id=0 (by default) can see all orders. Mixing TWS orders and API orders can cause problems sometimes.
when I try to modify the profit taker order using
placeOrder
I get error that the parent order cannot be found.
Yes, this does happen because the original order is gone, but the updated order still has parentId
populated, so when the order is re-submitted, the field doesn't work anymore. If you need to update a bracket order, manually set .parentId = 0
on the updated order. Also make sure updated orders have .transmit = True
because sometimes .transmit = False
is used when adding bracket orders before enabling them as a full OTOCO/OCA group.
Thank you so much for such extended response.
I tried ClientId 0, it didn't have affect. It's all orders managed by the API, no mix with manual.
I will do new testing when the market is open again :) Hope to get it working one way or another. I think I should be able to when openTrades() still fails but I use trades() and filtering with the parentId fix. I have transmit on True. I will check the "Download open orders on connection".
Commenting with update soon! Thanks again 🙏
"Download open orders on connection" was already on.
openTrades()
still fails to return the profit taker today but luckily I have a working bot again by using trades()
with isActive()
array filter. order.parentId = 0
fixed placing the order. Happy it works again! Still strange though.
Hi,
I have been successfully using ib_insync in the past and switched to ib_async today. I have an issue now that openTrades() does not return my profit takers anymore from an open bracket order. The profit taker is visible in TWS and it works there. But ib_async only fetches 1 open order which is the stop, the profit taker is missing.
Is there work done on this functionality? Anyone know why this happens? Maybe a TWS related issue? (I tried both stable and latest).