Below are log entries for one such failed order. I was developing some new code, and exercising it with TWS, but code was mistakenly not providing account number, so those orders got rejected by TWS. It looks like I ran into a variation of Canceled/Rejected orders which now seems to be causing duplicate orders error. The maximum orderId of open/completed orders is used to set the reqId sequence Or is there maybe some way to force Client._reqIdSeq synchronization? Return dict( parent = parent_trade, target = target_trade, stop_loss = stop_trade) placeOrder( contract, parent) # fails there with AssertionError target_trade: Trade = ib_client. Reverse_action = 'BUY' if action = 'SELL' else 'SELL' parent = MarketOrder( get( symbol = symbol, currency = currency) Stop_loss: float, ib_client: IB) -> Dict:Ĭontract: Contract = Contracts. So maybe problem is somewhere there, the ID count resets when it shouldnt?ĭef bracket_order( symbol: str, currency: str, action: str, quantity: float, target_price: float, ![]() Return dict( parent = parent_trade, target = target_trade, stop_loss = One note is that ib_client is created once and kept spinning alongside Watchdog client (I use 3 clients live 24/7, reconnecting if necessary, Watchdog being one of them). ReverseAction = 'BUY' if action = 'SELL' else 'SELL' parent = MarketOrder( Target_price: float, stop_loss: float, ib_client: IB) -> Dict:Ĭontract = Forex( symbol = symbol, currency = currency) From ib_insync import Forex, IB, LimitOrder, MarketOrder, StopOrder, Trade def bracketOrder( symbol: str, currency: str, action: str, quantity: float,
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |