fix bug
This commit is contained in:
@@ -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("订单提交失败")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user