Feature/custom strategy (#1173)

* feat: add Strategy Studio with multi-timeframe support
- Add Strategy Studio page with three-column layout for strategy management
- Support multi-timeframe K-line data selection (5m, 15m, 1h, 4h, etc.)
- Add GetWithTimeframes() function in market package for fetching multiple timeframes
- Add TimeframeSeriesData struct for storing per-timeframe technical indicators
- Update formatMarketData() to display all selected timeframes in AI prompt
- Add strategy API endpoints for CRUD operations and test run
- Integrate real AI test runs with configured AI models
- Support custom AI500 and OI Top API URLs from strategy config
* docs: add Strategy Studio screenshot to README files
* feat: add quant data integration and fix position click navigation
- Integrate quant data API (netflow, OI, price changes) into Strategy Studio
- Add enable_quant_data toggle in indicator editor
- Fix position symbol click to navigate to chart (sync defaultSymbol prop)
- Fix TradingView chart fullscreen flickering
This commit is contained in:
tinkle-community
2025-12-06 07:47:03 +08:00
committed by GitHub
parent 5cff32e4f2
commit 5d1d0b6842
10 changed files with 359 additions and 9 deletions

View File

@@ -59,6 +59,16 @@ export default function TraderDashboard() {
return saved ? parseInt(saved, 10) : 5
})
// 选中的币种(用于图表显示)
const [selectedChartSymbol, setSelectedChartSymbol] = useState<string | undefined>()
const [chartUpdateKey, setChartUpdateKey] = useState(0)
// 点击持仓币种时调用
const handlePositionSymbolClick = (symbol: string) => {
setSelectedChartSymbol(symbol)
setChartUpdateKey(prev => prev + 1) // 强制触发更新
}
// 当 limit 变化时保存到 localStorage
const handleLimitChange = (newLimit: number) => {
setDecisionLimit(newLimit)
@@ -420,7 +430,11 @@ export default function TraderDashboard() {
<div className="space-y-6">
{/* Chart Tabs (Equity / K-line) */}
<div className="animate-slide-in" style={{ animationDelay: '0.1s' }}>
<ChartTabs traderId={selectedTrader.trader_id} />
<ChartTabs
traderId={selectedTrader.trader_id}
selectedSymbol={selectedChartSymbol}
updateKey={chartUpdateKey}
/>
</div>
{/* Current Positions */}
@@ -490,7 +504,24 @@ export default function TraderDashboard() {
className="border-b border-gray-800 last:border-0"
>
<td className="py-3 font-mono font-semibold">
{pos.symbol}
<button
type="button"
onClick={(e) => {
e.preventDefault()
e.stopPropagation()
console.log('点击了币种:', pos.symbol)
handlePositionSymbolClick(pos.symbol)
}}
className="hover:underline cursor-pointer px-2 py-1 rounded transition-all"
style={{
color: '#F0B90B',
background: 'rgba(240, 185, 11, 0.1)',
border: '1px solid rgba(240, 185, 11, 0.3)'
}}
title={t('viewChart', language)}
>
📈 {pos.symbol}
</button>
</td>
<td className="py-3">
<span