补齐币本位期权开平仓微信推送:单位用ETH/BTC,手动/目标/翻倍平仓与翻倍提醒均必达。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-20 17:57:58 +08:00
parent a7d0c2f875
commit 440778e9e6
6 changed files with 122 additions and 44 deletions
+22 -19
View File
@@ -1281,6 +1281,7 @@ def register_options_routes(app: Flask, cfg: dict[str, Any]) -> None:
open_quote=fill_px,
target_index=target_index,
signal_note=signal_note,
premium_ccy=sizing.get("premium_ccy") or "USDC",
)
finally:
conn_n.close()
@@ -1639,28 +1640,30 @@ def register_options_routes(app: Flask, cfg: dict[str, Any]) -> None:
invalidate_option_positions_cache()
_sync_options_trades(cfg, force=True)
if result.get("fully_closed"):
try:
from lib.options.options_target_lib import cancel_target_monitor
from lib.options.options_notify_lib import notify_options_close
try:
from lib.options.options_target_lib import cancel_target_monitor
from lib.options.options_notify_lib import notify_options_close
conn2 = cfg["get_db"]()
try:
conn2 = cfg["get_db"]()
try:
if result.get("fully_closed"):
cancel_target_monitor(conn2, inst_id=inst_id)
conn2.commit()
notify_options_close(
cfg,
conn2,
inst_id=inst_id,
reason="手动平仓",
sheets=result.get("submitted_sheets"),
premium_received=result.get("premium_received"),
close_quote=result.get("locked_bid_px") or result.get("bid"),
)
finally:
conn2.close()
except Exception:
pass
reason = "手动平仓" if result.get("fully_closed") else "手动平仓(部分)"
notify_options_close(
cfg,
conn2,
inst_id=inst_id,
reason=reason,
sheets=result.get("submitted_sheets"),
premium_received=result.get("premium_received"),
close_quote=result.get("locked_bid_px") or result.get("bid"),
)
finally:
conn2.close()
except Exception:
pass
if result.get("fully_closed"):
try:
from lib.options.options_coin_open_lib import maybe_sell_spot_after_close