From 6f4be02a903d255299dd09564c0d294ba03e10b1 Mon Sep 17 00:00:00 2001 From: hmo Date: Thu, 30 Jul 2026 10:05:16 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20API+UI=E8=BF=915=E5=B9=B4=E5=8C=BA?= =?UTF-8?q?=E9=97=B4=E5=88=87=E6=8D=A2(=E8=A1=A5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server.py | 5 +++-- static/index.html | 8 +++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/server.py b/server.py index b9addd63..54e9bc6b 100644 --- a/server.py +++ b/server.py @@ -535,10 +535,11 @@ def get_tracking(): @app.route("/api/research/strategies") def api_research_strategies(): - """策略版本列表(含回测结果摘要)""" + """策略版本列表(含回测结果摘要,支持 period_tag 区间过滤)""" try: from strategy_lab import list_strategies - return jsonify({'strategies': list_strategies()}) + pt = request.args.get('period_tag') + return jsonify({'strategies': list_strategies(period_tag=pt)}) except Exception as e: return jsonify({'error': str(e)}), 500 diff --git a/static/index.html b/static/index.html index 66427c73..7ee52d96 100644 --- a/static/index.html +++ b/static/index.html @@ -1931,9 +1931,9 @@ function renderResearch() { if (!el) return; el.innerHTML = '
' + '

📋 策略研究 — 版本迭代对比

' + - '' + '' + - '' + + '' + '' + '每版策略基于上一版归因分析迭代 · 点击行展开明细
' + @@ -1945,7 +1945,9 @@ function renderResearch() { async function loadStrategyList() { const listEl = document.getElementById('strategyList'); try { - const resp = await fetch('/api/research/strategies'); + const ptMap = {'1m':'1m','6m':'6m','1y':'1y','2y':'2y','5y':'5y'}; + const pt = ptMap[document.getElementById('btPeriod')?.value || '2y'] || '2y'; + const resp = await fetch('/api/research/strategies?period_tag=' + pt); const data = await resp.json(); if (data.error) { listEl.innerHTML = '
' + data.error + '
'; return; } const mkt = document.getElementById('btMarket')?.value || 'all';