新增品种简介查询页,支持东方财富/新浪合约规格展示
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -28,6 +28,7 @@ from fee_specs import (
|
||||
upsert_fee_rate,
|
||||
)
|
||||
from fee_sync import sync_fees_from_akshare
|
||||
from contract_profile import get_contract_profile
|
||||
from kline_chart import generate_review_kline_chart
|
||||
from market import get_price as market_get_price, set_ths_refresh_token, get_quote_source_label
|
||||
|
||||
@@ -1291,6 +1292,43 @@ def stats():
|
||||
)
|
||||
|
||||
|
||||
@app.route("/contract")
|
||||
@login_required
|
||||
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,
|
||||
)
|
||||
|
||||
|
||||
@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)
|
||||
|
||||
|
||||
@app.route("/fees", methods=["GET", "POST"])
|
||||
@login_required
|
||||
def fees():
|
||||
|
||||
Reference in New Issue
Block a user