fix state.py
This commit is contained in:
@@ -8,6 +8,7 @@ from libs import calc_buy_volume
|
||||
from sdk import OP_BUY
|
||||
from .runtime import Runtime
|
||||
from .order import PlaceOrderRequest
|
||||
from .state import PendingOrder
|
||||
import logging as log
|
||||
|
||||
|
||||
@@ -88,6 +89,8 @@ 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("已有待确认买单")
|
||||
if not run.orders.place(run.client,request):
|
||||
raise RuntimeError("订单提交失败")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user