Closed psdon closed 4 months ago
I'm trying to figure out how to execute a blocking method such as reqOpenOrders() inside the event handler.
Snippet:
self.broker.ib.reqTickByTickData(self.contract, "BidAsk") self.broker.ib.pendingTickersEvent += self.on_event def on_event(self, event): .... self.get_orders(self.symbol) def get_orders(self, symbol: ib_async.Contract): orders = [] for order in self.ib.reqOpenOrders(): if order.contract == symbol: orders.append(order) return orders
error message:
this event loop is already running
EDIT: Turns out I'm executing reqOpenOrders() too many times and I'm hitting the API rate limit. Thus, I'm closing this thread.
I'm trying to figure out how to execute a blocking method such as reqOpenOrders() inside the event handler.
Snippet:
error message:
EDIT: Turns out I'm executing reqOpenOrders() too many times and I'm hitting the API rate limit. Thus, I'm closing this thread.