From 4742a0bb9d7d093e1e028358c04155369251c96d Mon Sep 17 00:00:00 2001 From: dekun Date: Tue, 30 Jun 2026 09:51:10 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=A7=BB=E9=99=A4=E5=9B=9B?= =?UTF-8?q?=E6=89=80=E7=BB=9F=E8=AE=A1=E5=88=86=E6=9E=90=E9=A1=B5=E4=BA=A4?= =?UTF-8?q?=E6=98=93=E6=97=A5=E5=8E=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 删除日历 UI、bootstrap 与 /api/stats/calendar 注册;保留日/周/月统计表。内照明心档案日历不受影响。 Co-authored-by: Cursor --- crypto_monitor_binance/app.py | 29 ++------------------ crypto_monitor_binance/templates/index.html | 15 ---------- crypto_monitor_gate/app.py | 29 ++------------------ crypto_monitor_gate/templates/index.html | 15 ---------- crypto_monitor_gate_bot/app.py | 29 ++------------------ crypto_monitor_gate_bot/templates/index.html | 15 ---------- crypto_monitor_okx/app.py | 29 ++------------------ crypto_monitor_okx/templates/index.html | 15 ---------- embed_templates/embed_boot_scripts.html | 2 -- embed_templates/embed_page_fragment.html | 11 -------- embed_templates/embed_shell.html | 2 -- instance_embed_context_lib.py | 7 +---- static/instance_embed.js | 1 - 13 files changed, 9 insertions(+), 190 deletions(-) diff --git a/crypto_monitor_binance/app.py b/crypto_monitor_binance/app.py index 575292e..a043fc4 100644 --- a/crypto_monitor_binance/app.py +++ b/crypto_monitor_binance/app.py @@ -1857,7 +1857,7 @@ def _compute_period_metrics(trades): } -def compute_stats_bundle(conn, trading_day, now_dt=None, *, with_calendar=False): +def compute_stats_bundle(conn, trading_day, now_dt=None): """日 / 周 / 月 统计:平仓按北京时间交易日(默认 8:00 切日)计入。""" now_dt = now_dt or app_now() pnls = _load_completed_trade_pnls(conn) @@ -1888,15 +1888,6 @@ def compute_stats_bundle(conn, trading_day, now_dt=None, *, with_calendar=False) dm, wm, mm = slice_metrics("all") - initial_calendar = None - calendar_bootstrap_json = None - if with_calendar: - from trade_stats_calendar_lib import build_stats_calendar_bootstrap - - initial_calendar, calendar_bootstrap_json = build_stats_calendar_bootstrap( - pnls, now_dt, _pnl_row_matches_segment, reset_hour=TRADING_DAY_RESET_HOUR - ) - return { "trading_day": trading_day, "total_opens_all": total_opens_all, @@ -1905,8 +1896,6 @@ def compute_stats_bundle(conn, trading_day, now_dt=None, *, with_calendar=False) "month": mm, "segments": segments, "stats_reset_hour": TRADING_DAY_RESET_HOUR, - "initial_calendar": initial_calendar, - "calendar_bootstrap_json": calendar_bootstrap_json, } @@ -7044,7 +7033,7 @@ def render_main_page(page="trade", embed_mode=None): else [] ) stats_bundle = ( - compute_stats_bundle(conn, trading_day, now, with_calendar=(page == "stats")) + compute_stats_bundle(conn, trading_day, now) if plan.stats_bundle else minimal_stats_bundle(TRADING_DAY_RESET_HOUR) ) @@ -9651,20 +9640,6 @@ try: except Exception as _hub_err: print(f"[hub_bridge] binance: {_hub_err}") -try: - from hub_bridge import register_trade_stats_calendar_route - - register_trade_stats_calendar_route( - app, - login_required_fn=login_required, - load_pnls_fn=_load_completed_trade_pnls, - row_matches_segment_fn=_pnl_row_matches_segment, - reset_hour=TRADING_DAY_RESET_HOUR, - get_db_fn=get_db, - ) -except Exception as _cal_err: - print(f"[stats calendar] binance: {_cal_err}") - @app.route("/strategy") @login_required diff --git a/crypto_monitor_binance/templates/index.html b/crypto_monitor_binance/templates/index.html index 0bc5ff8..42d7e5d 100644 --- a/crypto_monitor_binance/templates/index.html +++ b/crypto_monitor_binance/templates/index.html @@ -244,7 +244,6 @@ .stats-period-block .sub{font-size:.78rem;color:#8892b0;margin-bottom:10px;line-height:1.4} - - {% if stats_bundle.calendar_bootstrap_json %} - - {% endif %} -
-
- - - -
-
-
{% for seg in stats_bundle.segments %}