fix state.py

This commit is contained in:
2026-09-05 15:56:39 +08:00
parent ba1bd93afa
commit 1fc3e119d3
4 changed files with 78 additions and 119 deletions

View File

@@ -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("订单提交失败")