This commit is contained in:
2026-09-05 20:39:58 +08:00
parent 1fc3e119d3
commit af55324e2a
4 changed files with 110 additions and 80 deletions

View File

@@ -80,7 +80,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()
order_id = run.orders.new_order_id("BUY")
request = PlaceOrderRequest(
OP_BUY,
code,
@@ -89,8 +89,9 @@ def do_open(run: Runtime, code: str, volume: int, signal_key: str, price: float)
signal_key,
kind="base",
)
if not run.state.new_order(PendingOrder(order_id, code, "base", volume)):
raise RuntimeError("已有待确认买单")
#run.state.new_order(PendingOrder(order_id, code, "base", volume))
if not run.orders.place(run.client,request):
raise RuntimeError("订单提交失败")