This commit is contained in:
2026-09-03 15:27:11 +08:00
parent 9ef063f4ce
commit cf5f33ab9e
4 changed files with 67 additions and 7 deletions

View File

@@ -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()