修复策略交易

This commit is contained in:
dekun
2026-05-23 10:57:08 +08:00
parent 103615d7a9
commit c0f4fc5735
7 changed files with 71 additions and 26 deletions
+12
View File
@@ -12,6 +12,18 @@ from strategy_db import init_strategy_tables
from strategy_roll_lib import preview_roll
def install_strategy_trading(app: Flask, repo_root: str, app_module: Any = None, **build_kw) -> None:
"""在 app.py 末尾调用(login_required 已定义后)。build_kw 传给 build_strategy_config。"""
from strategy_config import build_strategy_config
render_trend_page = build_kw.pop("render_trend_page", None)
attach_strategy_templates(app, repo_root)
cfg = build_strategy_config(app_module, **build_kw)
if render_trend_page is not None:
cfg["render_trend_page"] = render_trend_page
register_strategy_trading(app, cfg)
def attach_strategy_templates(app: Flask, repo_root: str) -> None:
strat_dir = os.path.join(repo_root, "strategy_templates")
if not os.path.isdir(strat_dir):