Remove contract profile from navigation and retire its routes.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-26 03:32:30 +08:00
parent cababd67f5
commit 42f2dad52a
6 changed files with 2 additions and 44 deletions
-1
View File
@@ -25,7 +25,6 @@
| **交易记录与复盘** | `/records` | 资金曲线、CTP 成交同步、复盘上传 |
| **统计分析** | `/stats` | 汇总指标 + 多维度分项统计 |
| **手续费配置** | `/fees` | CTP / 本地费率(可开关) |
| **品种简介** | `/contract` | 合约规格查询(可开关) |
| **系统设置** | `/settings` | 交易模式、CTP、计仓、微信、主题 |
登录后默认进入 **下单监控**;刷新当前页不会跳转,仅访问根路径 `/` 或新登录时进入默认页。
+2 -29
View File
@@ -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"])
-10
View File
@@ -27,7 +27,6 @@
| 交易记录与复盘 | `/records` | 否 |
| 统计分析 | `/stats` | 否 |
| 手续费配置 | `/fees` | 是 |
| 品种简介 | `/contract` | 是 |
| 系统设置 | `/settings` | 否 |
关闭项在 **系统设置 → 导航显示** 配置;直接访问 URL 会提示并跳回下单监控。
@@ -164,15 +163,6 @@
---
## 品种简介
**路径**`/contract`
- 查询合约规格(东方财富 + 新浪补充)
- API`GET /api/contract_profile?symbol=...`
---
## 系统设置
**路径**`/settings`
-1
View File
@@ -29,7 +29,6 @@
| key | 菜单 |
|-----|------|
| `fees` | 手续费配置 |
| `contract` | 品种简介 |
| `plans` | 开单计划 |
| `market` | 行情 K 线 |
| `strategy` | 策略交易 |
-2
View File
@@ -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]:
-1
View File
@@ -532,7 +532,6 @@
<a href="{{ url_for('records') }}" class="{% if request.endpoint in ('records', 'trades') %}active{% endif %}">交易记录与复盘</a>
<a href="{{ url_for('stats') }}" class="{% if request.endpoint == 'stats' %}active{% endif %}">统计分析</a>
{% if nav_items.fees %}<a href="{{ url_for('fees') }}" class="{% if request.endpoint == 'fees' %}active{% endif %}">手续费配置</a>{% endif %}
{% if nav_items.contract %}<a href="{{ url_for('contract_profile_page') }}" class="{% if request.endpoint == 'contract_profile_page' %}active{% endif %}">品种简介</a>{% endif %}
<a href="{{ url_for('settings') }}" class="{% if request.endpoint == 'settings' %}active{% endif %}">系统设置</a>
</nav>
</header>