fix bug
This commit is contained in:
@@ -108,7 +108,7 @@ class State:
|
||||
StateItem(
|
||||
code=position.stock_code,
|
||||
base_qty=position.volume,
|
||||
base_cost=position.open_price,
|
||||
base_cost=round(position.open_price, 2),
|
||||
base_status=STATUS_OK,
|
||||
)
|
||||
)
|
||||
@@ -165,6 +165,12 @@ class State:
|
||||
# reconciliation must therefore happen before stale state is removed.
|
||||
for code in list(self.codes):
|
||||
if code not in position_codes:
|
||||
item = self.get(code)
|
||||
if any(
|
||||
order_id and order_id in orders_by_local_id
|
||||
for order_id in (item.base_order_id, item.added_order_id)
|
||||
):
|
||||
continue
|
||||
if self.delete(code):
|
||||
log.info("[状态] 已移除持仓状态,代码=%s", code)
|
||||
self.save()
|
||||
|
||||
Reference in New Issue
Block a user