def on_order_all_traded(self, order: OrderData):
    '\n        订单全部成交\n        :param order:\n        :return:\n        '
    self.write_log(u'报单更新 => 委托单全部完成:{}'.format(order.__dict__))
    active_order = self.active_orders[order.vt_orderid]
    grid = active_order.get('grid', None)
    if (grid is not None):
        if (order.vt_orderid in grid.order_ids):
            grid.order_ids.remove(order.vt_orderid)
        if (len(grid.order_ids) == 0):
            grid.order_status = False
            grid.traded_volume = 0
            if (active_order['offset'] != Offset.OPEN):
                grid.open_status = False
                grid.close_status = True
                grid.open_time = None
                self.write_log((f'{grid.direction.value}单已平仓完毕,order_price:{order.price}' + f',volume:{order.volume}'))
                self.write_log(f'移除网格:{grid.to_json()}')
                self.gt.remove_grids_by_ids(direction=grid.direction, ids=[grid.id])
            else:
                grid.open_status = True
                grid.open_time = self.cur_datetime
                self.write_log((f'{grid.direction.value}单已开仓完毕,order_price:{order.price}' + f',volume:{order.volume}'))
        else:
            old_traded_volume = grid.traded_volume
            grid.traded_volume += order.volume
            self.write_log((f'{grid.direction.value}单部分{order.offset}仓，' + f'网格volume:{grid.volume}, traded_volume:{old_traded_volume}=>{grid.traded_volume}'))
            self.write_log(f'剩余委托单号:{grid.order_ids}')
        self.gt.save()
    else:
        self.write_error(f'on_trade找不到对应grid')
    self.active_orders.pop(order.vt_orderid, None)
订单全部成交
:param order:
:return:
def on_order_all_traded(self, order: OrderData):
    '\n        订单全部成交\n        :param order:\n        :return:\n        '
    self.write_log(u'报单更新 => 委托单全部完成:{}'.format(order.__dict__))
    active_order = self.active_orders[order.vt_orderid]
    grid = active_order.get('grid', None)
    if (grid is not None):
        if (order.vt_orderid in grid.order_ids):
            grid.order_ids.remove(order.vt_orderid)
        if (len(grid.order_ids) == 0):
            grid.order_status = False
            grid.traded_volume = 0
            if (active_order['offset'] != Offset.OPEN):
                grid.open_status = False
                grid.close_status = True
                grid.open_time = None
                self.write_log((f'{grid.direction.value}单已平仓完毕,order_price:{order.price}' + f',volume:{order.volume}'))
                self.write_log(f'移除网格:{grid.to_json()}')
                self.gt.remove_grids_by_ids(direction=grid.direction, ids=[grid.id])
            else:
                grid.open_status = True
                grid.open_time = self.cur_datetime
                self.write_log((f'{grid.direction.value}单已开仓完毕,order_price:{order.price}' + f',volume:{order.volume}'))
        else:
            old_traded_volume = grid.traded_volume
            grid.traded_volume += order.volume
            self.write_log((f'{grid.direction.value}单部分{order.offset}仓，' + f'网格volume:{grid.volume}, traded_volume:{old_traded_volume}=>{grid.traded_volume}'))
            self.write_log(f'剩余委托单号:{grid.order_ids}')
        self.gt.save()
    else:
        self.write_error(f'on_trade找不到对应grid')
    self.active_orders.pop(order.vt_orderid, None)