This commit is contained in:
2026-09-05 13:53:26 +08:00
parent 63ffc1329b
commit 58e1e3e291
7 changed files with 343 additions and 317 deletions

View File

@@ -10,7 +10,6 @@ from sdk import OP_BUY, OP_SELL, PositionItem, Tick
from .order import PlaceOrderRequest
from .runtime import Runtime
from .state import STATUS_ING
import logging as log
LOSS_TIERS = (-30.0, -50.0)
@@ -181,14 +180,11 @@ def handle_loss(
volume=volume,
order_id=order_id,
strategy_name=runtime.account_cfg.strategy,
kind="add",
)
if not runtime.orders.place(request):
return TradeDecision(False, "补仓委托失败")
state.added_status = STATUS_ING
state.added_order_id = order_id
runtime.state.set(state)
runtime.state.save()
reserved = amount if runtime.state.busy(position.stock_code) else 0.0
return TradeDecision(False, "补仓委托失败或待确认", reserved)
runtime.add_watch.forget(position.stock_code)
return TradeDecision(True, f"买入 {volume} 股,订单={order_id}", amount)