fix(trend): reconcile state from actual fills
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user