optz print.
This commit is contained in:
@@ -88,16 +88,17 @@ def manage_positions(
|
||||
strTag = "↑"
|
||||
elif pnl_rate< LOSS_TIERS[0]:
|
||||
strTag = "↓"
|
||||
|
||||
log.info(
|
||||
"[Position %s ] %s %s,盈亏=%.2f%%,止盈=%s,补仓=%s",
|
||||
strTag,
|
||||
code,
|
||||
position.stock_name,
|
||||
pnl_rate,
|
||||
profit_action,
|
||||
loss_add_action,
|
||||
)
|
||||
|
||||
if strTag != "-":
|
||||
log.info(
|
||||
"[Position %s ] %s %s,盈亏=%.2f%%,止盈=%s,补仓=%s",
|
||||
strTag,
|
||||
code,
|
||||
position.stock_name,
|
||||
pnl_rate,
|
||||
profit_action,
|
||||
loss_add_action,
|
||||
)
|
||||
except Exception:
|
||||
log.exception(
|
||||
"[Position] 持仓处理异常,代码=%s,继续处理后续持仓",
|
||||
@@ -121,15 +122,15 @@ def handle_profit(
|
||||
if observation.state == GridState.ARMED:
|
||||
return TradeDecision(
|
||||
False,
|
||||
f"首次达到 {pnl_rate:.2f}%,峰值网格={observation.current_grid}",
|
||||
f"首次, PNL:{pnl_rate:.2f}%,网格={observation.current_grid}",
|
||||
)
|
||||
if observation.state == GridState.RAISED:
|
||||
return TradeDecision(
|
||||
False,
|
||||
f"上涨至 {pnl_rate:.2f}%,峰值网格={observation.current_grid}",
|
||||
f"突破, PNL:{pnl_rate:.2f}%,网格={observation.current_grid}",
|
||||
)
|
||||
if observation.state == GridState.STEADY:
|
||||
return TradeDecision(False)
|
||||
return TradeDecision(False,f"持平, PNL:{pnl_rate:.2f}%,网格={observation.current_grid}",)
|
||||
if runtime.orders.busy(position.stock_code, "SELL"):
|
||||
return TradeDecision(False, "卖出委托处理中")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user