fix bug
This commit is contained in:
@@ -54,9 +54,10 @@ def StartZT() -> None:
|
||||
# 收盘前最后一次只读对账,不发新单;未完成买回继续持久保存。
|
||||
try:
|
||||
portfolio = client.portfolio()
|
||||
deals = client.deals()
|
||||
state.reconcile(
|
||||
list(portfolio.positions.values()),
|
||||
portfolio.orders,
|
||||
deals,
|
||||
now.date().isoformat(),
|
||||
)
|
||||
except Exception:
|
||||
@@ -84,10 +85,11 @@ def RunOnce(run: Runtime, state: TState) -> None:
|
||||
|
||||
# 1. 一次获取资产、持仓和订单,并清理过期订单。
|
||||
portfolio = run.client.portfolio()
|
||||
deals = run.client.deals()
|
||||
positions = list(portfolio.positions.values())
|
||||
run.orders.refresh(run.client, portfolio.orders)
|
||||
# 对账使用完整原始订单列表,不能丢弃撤单和废单的部分成交。
|
||||
state.reconcile(positions, portfolio.orders, today)
|
||||
# 状态只按真实成交记账,不使用委托状态推算数量和成本。
|
||||
state.reconcile(positions, deals, today)
|
||||
|
||||
# 2. 获取本策略的信号开仓数据;信号失败不阻断已有做 T 买回。
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user