Show strategy rules in fold; larger nav; notify only when cannot open.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -93,6 +93,8 @@ class StrategyEngine:
|
||||
max_atm_off = self.ledger.get_setting_float(
|
||||
"max_atm_open_offset", s.max_atm_open_offset
|
||||
)
|
||||
perp_qty = self.ledger.get_setting_float("perp_qty_eth", s.perp_qty_eth)
|
||||
opt_qty = self.ledger.get_setting_float("option_qty_eth", s.option_qty_eth)
|
||||
rest_until = row["rest_until_ms"]
|
||||
rest_left = 0
|
||||
if rest_until:
|
||||
@@ -128,6 +130,8 @@ class StrategyEngine:
|
||||
"premium_exit_multiple": prem_mult,
|
||||
"exit_target_usdt": exit_amt,
|
||||
"leverage": leverage,
|
||||
"perp_qty_eth": perp_qty,
|
||||
"option_qty_eth": opt_qty,
|
||||
"min_option_hours": min_hours,
|
||||
"min_option_leverage": min_opt_lev,
|
||||
"atm_open_offset_enabled": atm_off_on,
|
||||
|
||||
@@ -171,13 +171,16 @@ def assess_open_capacity(db: Database | None = None) -> dict[str, Any]:
|
||||
|
||||
|
||||
def maybe_notify_funds_short(cap: dict[str, Any] | None = None) -> None:
|
||||
"""交易账户资金不足时企业微信推送:不足期间只推一次。"""
|
||||
"""仅在「不能开」时推送一次;能开绝不通知。"""
|
||||
global _notified_while_short
|
||||
cap = cap or assess_open_capacity()
|
||||
short = cap.get("perp_can_open") is False or cap.get("option_can_open") is False
|
||||
if not short:
|
||||
# 能开 / 未知:不通知;资金恢复则重置,便于下次不足再提醒一次
|
||||
if cap.get("funds_ok") is True:
|
||||
_notified_while_short = False
|
||||
return
|
||||
cannot = cap.get("perp_can_open") is False or cap.get("option_can_open") is False
|
||||
if not cannot:
|
||||
return
|
||||
if _notified_while_short:
|
||||
return
|
||||
_notified_while_short = True
|
||||
|
||||
Reference in New Issue
Block a user