fix(gate_bot): write strategy snapshots when trend plans end

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-07 16:48:28 +08:00
parent f51d1c413a
commit f976697203
+8 -2
View File
@@ -4774,11 +4774,15 @@ def _trend_finalize_plan(conn, row, result_label, exit_price, closed_at=None):
except Exception:
pass
try:
cfg = app.extensions.get("strategy_trend_cfg") or {}
from strategy_trend_register import build_trend_config
cfg = app.extensions.get("strategy_trend_cfg") or build_trend_config(
sys.modules[__name__]
)
closed = conn.execute(
"SELECT * FROM trend_pullback_plans WHERE id=?", (plan_id,)
).fetchone()
if closed and cfg:
if closed:
from strategy_snapshot_lib import save_trend_plan_snapshot
save_trend_plan_snapshot(
@@ -8209,6 +8213,7 @@ def strategy_roll_page():
from strategy_register import install_strategy_trading
from strategy_trend_register import build_trend_config
install_strategy_trading(
app,
@@ -8216,6 +8221,7 @@ install_strategy_trading(
app_module=sys.modules[__name__],
trend_enabled=True,
)
app.extensions["strategy_trend_cfg"] = build_trend_config(sys.modules[__name__])
_purge_key_monitors_if_full_margin()