feat: 品种下拉统一展示推荐列表,与下方品种推荐表一致。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -24,7 +24,13 @@ from werkzeug.security import check_password_hash, generate_password_hash
|
||||
|
||||
from functools import wraps
|
||||
|
||||
from symbols import search_symbols, ths_to_codes, list_main_contracts_grouped, refresh_main_index
|
||||
from symbols import (
|
||||
search_symbols,
|
||||
ths_to_codes,
|
||||
list_main_contracts_grouped,
|
||||
list_recommended_symbols_grouped,
|
||||
refresh_main_index,
|
||||
)
|
||||
from contract_specs import calc_position_metrics
|
||||
from fee_specs import (
|
||||
calc_fee_breakdown,
|
||||
@@ -742,6 +748,26 @@ def api_symbols_mains():
|
||||
return jsonify(list_main_contracts_grouped())
|
||||
|
||||
|
||||
@app.route("/api/symbols/recommended")
|
||||
@login_required
|
||||
def api_symbols_recommended():
|
||||
"""品种下拉:仅展示当前资金下推荐的品种(与下方品种推荐表一致)。"""
|
||||
from recommend_store import recommend_payload
|
||||
from trading_context import get_account_capital, get_max_margin_pct
|
||||
|
||||
conn = get_db()
|
||||
try:
|
||||
capital = get_account_capital(conn, get_setting)
|
||||
payload = recommend_payload(
|
||||
conn,
|
||||
live_capital=capital,
|
||||
max_margin_pct=get_max_margin_pct(get_setting),
|
||||
)
|
||||
return jsonify(list_recommended_symbols_grouped(payload.get("rows") or []))
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
|
||||
@app.route("/api/key_prices")
|
||||
@login_required
|
||||
def api_key_prices():
|
||||
|
||||
Reference in New Issue
Block a user