def on_order(self, order: OrderData) -> None: # 更新活跃报单 active_orders = [] for order in self.app.recorder.get_all_active_orders( order.local_symbol): active_orders.append(order._to_dict()) data = {"type": "active_order", "data": active_orders} self.io.emit("active_order", data) orders = [] for order in self.app.recorder.get_all_orders(): orders.append(order._to_dict()) data = {"type": "order", "data": orders} self.io.emit("order", data)
def on_order(self, order: OrderData) -> None: data = { "type": "order", "data": order._to_dict() } self.io.emit("order", data)