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 %} -