From 42f2dad52ac252e5134b3dd050de0330dbefd1fd Mon Sep 17 00:00:00 2001 From: dekun Date: Fri, 26 Jun 2026 03:32:30 +0800 Subject: [PATCH] Remove contract profile from navigation and retire its routes. Co-authored-by: Cursor --- README.md | 1 - app.py | 31 ++----------------------------- docs/FEATURES.md | 10 ---------- docs/FEES.md | 1 - nav_settings.py | 2 -- templates/base.html | 1 - 6 files changed, 2 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index bb126bf..ed8421b 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,6 @@ | **交易记录与复盘** | `/records` | 资金曲线、CTP 成交同步、复盘上传 | | **统计分析** | `/stats` | 汇总指标 + 多维度分项统计 | | **手续费配置** | `/fees` | CTP / 本地费率(可开关) | -| **品种简介** | `/contract` | 合约规格查询(可开关) | | **系统设置** | `/settings` | 交易模式、CTP、计仓、微信、主题 | 登录后默认进入 **下单监控**;刷新当前页不会跳转,仅访问根路径 `/` 或新登录时进入默认页。 diff --git a/app.py b/app.py index b9e5719..1a810ee 100644 --- a/app.py +++ b/app.py @@ -45,7 +45,6 @@ from fee_specs import ( purge_non_ctp_fee_rates, ) from nav_settings import NAV_TOGGLES, get_nav_items, nav_enabled, save_nav_items -from contract_profile import get_contract_profile from stats_engine import STATS_VIEWS, load_stats_cache, refresh_stats_cache from kline_store import ensure_kline_tables from kline_stream import kline_hub, sse_format @@ -1601,40 +1600,14 @@ def api_market_quote(): @app.route("/contract") @login_required -@require_nav("contract") def contract_profile_page(): - symbol = request.args.get("symbol", "").strip() - profile = None - error = None - if symbol: - try: - profile = get_contract_profile(symbol) - if not profile: - error = "未查询到该合约简介,请检查合约代码" - except Exception as exc: - app.logger.warning("contract profile failed: %s", exc) - error = f"查询失败:{exc}" - return render_template( - "contract.html", - symbol=symbol, - profile=profile, - error=error, - ) + return redirect(url_for("positions")) @app.route("/api/contract_profile") @login_required def api_contract_profile(): - symbol = request.args.get("symbol", "").strip() - if not symbol: - return jsonify({"error": "请提供合约代码"}), 400 - try: - profile = get_contract_profile(symbol) - except Exception as exc: - return jsonify({"error": str(exc)}), 500 - if not profile: - return jsonify({"error": "未查询到合约简介"}), 404 - return jsonify(profile) + return jsonify({"error": "品种简介功能已移除"}), 404 @app.route("/fees", methods=["GET", "POST"]) diff --git a/docs/FEATURES.md b/docs/FEATURES.md index dfddff3..7d6f2b2 100644 --- a/docs/FEATURES.md +++ b/docs/FEATURES.md @@ -27,7 +27,6 @@ | 交易记录与复盘 | `/records` | 否 | | 统计分析 | `/stats` | 否 | | 手续费配置 | `/fees` | 是 | -| 品种简介 | `/contract` | 是 | | 系统设置 | `/settings` | 否 | 关闭项在 **系统设置 → 导航显示** 配置;直接访问 URL 会提示并跳回下单监控。 @@ -164,15 +163,6 @@ --- -## 品种简介 - -**路径**:`/contract` - -- 查询合约规格(东方财富 + 新浪补充) -- API:`GET /api/contract_profile?symbol=...` - ---- - ## 系统设置 **路径**:`/settings` diff --git a/docs/FEES.md b/docs/FEES.md index 5eebe6c..197abfa 100644 --- a/docs/FEES.md +++ b/docs/FEES.md @@ -29,7 +29,6 @@ | key | 菜单 | |-----|------| | `fees` | 手续费配置 | -| `contract` | 品种简介 | | `plans` | 开单计划 | | `market` | 行情 K 线 | | `strategy` | 策略交易 | diff --git a/nav_settings.py b/nav_settings.py index 1b98b9f..4a9411f 100644 --- a/nav_settings.py +++ b/nav_settings.py @@ -12,14 +12,12 @@ from typing import Callable # 可在系统设置中开关的导航项 NAV_TOGGLES: dict[str, str] = { "fees": "手续费配置", - "contract": "品种简介", "plans": "开单计划", "market": "行情K线", "strategy": "策略交易", } DEFAULT_NAV: dict[str, bool] = {k: True for k in NAV_TOGGLES} -DEFAULT_NAV["contract"] = False def get_nav_items(get_setting: Callable[[str, str], str]) -> dict[str, bool]: diff --git a/templates/base.html b/templates/base.html index b71360a..c7d70c6 100644 --- a/templates/base.html +++ b/templates/base.html @@ -532,7 +532,6 @@ 交易记录与复盘 统计分析 {% if nav_items.fees %}手续费配置{% endif %} - {% if nav_items.contract %}品种简介{% endif %} 系统设置