fix(trend): reconcile state from actual fills

This commit is contained in:
2026-09-05 00:29:50 +08:00
parent 6c2eca8fdc
commit a53fc738cf
5 changed files with 76 additions and 37 deletions

View File

@@ -77,7 +77,7 @@ def open_signal(run:Runtime, ticks, open_signals) -> None:
def do_open(run: Runtime, code: str, volume: int, signal_key: str, price: float) -> None:
"""生成本地订单号并按最新价提交开仓委托。"""
order_id = run.orders.new_order_id("base")
order_id = run.orders.new_order_id()
request = PlaceOrderRequest(
run.client,
OP_BUY,
@@ -92,8 +92,6 @@ def do_open(run: Runtime, code: str, volume: int, signal_key: str, price: float)
run.state.set(StateItem(
code=code,
base_order_id=order_id,
base_qty=volume,
base_cost=round(price, 2),
base_status=STATUS_ING,
))
run.state.save()