Beispiel #1
0
 def on_order(self, order: OrderData):
     """"""
     if order.vt_symbol == self.active_vt_symbol:
         if not order.is_active():
             self.active_vt_orderid = ""
     elif order.vt_symbol == self.passive_vt_symbol:
         if not order.is_active():
             self.passive_vt_orderid = ""
     self.put_variables_event()
Beispiel #2
0
    def on_order(self, order: OrderData):
        """"""
        self.traded = order.traded
        self.order_status = order.status

        if not order.is_active():
            self.stop()
        self.put_variables_event()
Beispiel #3
0
    def update_order(self, order: OrderData):
        """
        Callback when order status is updated.
        """
        if not order.is_active() and order.vt_orderid in self.vt_orderids:
            self.vt_orderids.remove(order.vt_orderid)

        self.on_order(order)
Beispiel #4
0
    def update_order(self, order: OrderData) -> None:
        """
        Callback of new order data update.
        """
        self.orders[order.vt_orderid] = order

        if not order.is_active() and order.vt_orderid in self.active_orderids:
            self.active_orderids.remove(order.vt_orderid)
Beispiel #5
0
    def on_order(self, order: OrderData):
        """"""
        msg = f"委托号:{order.vt_orderid},委托状态:{order.status.value}"
        self.write_log(msg)

        if not order.is_active():
            self.vt_orderid = ""
            self.put_variables_event()
Beispiel #6
0
    def update_order(self, order: OrderData):
        """"""
        if self.active:
            if order.is_active():
                self.active_orders[order.vt_orderid] = order
            elif order.vt_orderid in self.active_orders:
                self.active_orders.pop(order.vt_orderid)

            self.on_order(order)
Beispiel #7
0
    def on_order(self, order: OrderData):
        """
        Callback of new order data update.
        """
        vt_orderid = order.vt_orderid

        if not order.is_active():
            if vt_orderid in self.active_orderids:
                self.active_orderids.remove(vt_orderid)

            if vt_orderid in self.cancel_orderids:
                self.cancel_orderids.remove(vt_orderid)
Beispiel #8
0
 def on_order(self, order: OrderData):
     """"""
     if not order.is_active():
         self.vt_orderid = ""
         self.put_variables_event()