fix bug
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user