feat libs,sdk,trend
This commit is contained in:
@@ -70,29 +70,29 @@ class OrderBook:
|
||||
|
||||
for item in orders:
|
||||
# 不处理状态不对的
|
||||
if item.status not in TRACKED_STATUSES:
|
||||
if str(item.order_status) not in TRACKED_STATUSES:
|
||||
continue
|
||||
if item.status in BUSY_STATUSES:
|
||||
busy_keys.add(self._busy_key(item.side, item.code))
|
||||
if str(item.order_status) in BUSY_STATUSES:
|
||||
busy_keys.add(self._busy_key(item.side, item.stock_code))
|
||||
# 清理过期的
|
||||
if (
|
||||
item.created_at is not None
|
||||
and item.local_order_id.startswith(f"{self.order_prefix}-")
|
||||
and item.status in CANCELABLE_STATUSES
|
||||
and str(item.order_status) in CANCELABLE_STATUSES
|
||||
and current - item.created_at > self.cancel_timeout_sec
|
||||
):
|
||||
try:
|
||||
client.cancel_by_id(item.id)
|
||||
client.cancel_by_id(item.order_sys_id)
|
||||
canceled += 1
|
||||
logging.info(
|
||||
"[Order] 超时撤单,代码=%s,方向=%s,柜台订单=%s",
|
||||
item.code,
|
||||
item.stock_code,
|
||||
item.side,
|
||||
item.id,
|
||||
item.order_sys_id,
|
||||
)
|
||||
except Exception:
|
||||
logging.exception(
|
||||
"[Order] 撤单失败,保留在途状态,订单=%s", item.id
|
||||
"[Order] 撤单失败,保留在途状态,订单=%s", item.order_sys_id
|
||||
)
|
||||
|
||||
# 缓存本次有效订单
|
||||
|
||||
Reference in New Issue
Block a user