币本位期权开仓/翻倍提醒/翻倍平仓/目标平仓/手动平仓微信推送:按ETH/BTC计价并补齐全平必发

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-20 18:02:12 +08:00
parent 9bb05113f3
commit 8b5080bdda
6 changed files with 256 additions and 19 deletions
+10 -3
View File
@@ -30,16 +30,23 @@ def build_profit_alert_message(
upl: float,
upl_ratio: float | None,
bid: float | None,
premium_ccy: str | None = None,
) -> str:
from lib.options.options_notify_lib import resolve_options_premium_ccy
ccy = resolve_options_premium_ccy(inst_id=inst_id, premium_ccy=premium_ccy)
d = 6 if ccy in ("ETH", "BTC") else 4
pct = f"{upl_ratio * 100:.1f}%" if upl_ratio is not None else ""
bid_txt = f"{bid:.4f}" if bid is not None else ""
bid_txt = f"{bid:.{d}f}" if bid is not None else ""
mode = "币本位" if ccy != "USDC" else "USDC"
return "\n".join(
[
"【OKX期权·翻倍提醒】",
f"账户:{account_label}",
f"本位:{mode}",
f"合约:{inst_id}",
f"已付权利金:{premium_paid:.4f} USDC",
f"未实现盈亏:{upl:+.4f} USDC({pct})",
f"已付权利金:{premium_paid:.{d}f} {ccy}",
f"未实现盈亏:{upl:+.{d}f} {ccy}({pct})",
f"当前买一:{bid_txt}(可考虑限价平仓锁利)",
]
)