fix(gate_bot): write strategy snapshots when trend plans end
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -4774,11 +4774,15 @@ def _trend_finalize_plan(conn, row, result_label, exit_price, closed_at=None):
|
|||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
try:
|
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(
|
closed = conn.execute(
|
||||||
"SELECT * FROM trend_pullback_plans WHERE id=?", (plan_id,)
|
"SELECT * FROM trend_pullback_plans WHERE id=?", (plan_id,)
|
||||||
).fetchone()
|
).fetchone()
|
||||||
if closed and cfg:
|
if closed:
|
||||||
from strategy_snapshot_lib import save_trend_plan_snapshot
|
from strategy_snapshot_lib import save_trend_plan_snapshot
|
||||||
|
|
||||||
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_register import install_strategy_trading
|
||||||
|
from strategy_trend_register import build_trend_config
|
||||||
|
|
||||||
install_strategy_trading(
|
install_strategy_trading(
|
||||||
app,
|
app,
|
||||||
@@ -8216,6 +8221,7 @@ install_strategy_trading(
|
|||||||
app_module=sys.modules[__name__],
|
app_module=sys.modules[__name__],
|
||||||
trend_enabled=True,
|
trend_enabled=True,
|
||||||
)
|
)
|
||||||
|
app.extensions["strategy_trend_cfg"] = build_trend_config(sys.modules[__name__])
|
||||||
|
|
||||||
_purge_key_monitors_if_full_margin()
|
_purge_key_monitors_if_full_margin()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user