backtest_grid_search
Search across a grid of strategy parameters to identify the combination yielding the highest Sharpe ratio for a given stock and strategy.
Instructions
對單一策略做參數網格搜尋 — 在指定參數範圍內跑完所有組合,找出夏普比率最高的參數配置。適合「我想知道 RSI 策略用哪組參數最穩」這類問題。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| stockId | Yes | 股票代號 | |
| market | No | 市場 TW 或 US,預設 TW | |
| strategy | Yes | 策略名稱:rsi_oversold / ma_crossover / breakout / mean_reversion | |
| days | No | 回測天數(預設 252) | |
| paramGrid | Yes | 參數網格,key 為參數名、value 為候選值陣列。例如 {"period":[10,14,20],"threshold":[25,30,35]} |