run_backtest
Backtest SMA crossover, RSI, MACD crossover, or Bollinger Band breakout strategies on bitbank cryptocurrency pairs. Returns profit/loss, win rate, max drawdown, Sharpe ratio, and optional SVG chart.
Instructions
[Backtest / Strategy Test / SMA Cross / RSI / MACD] 汎用バックテスト(backtest / strategy test / simulation / performance)。データ取得〜計算〜チャート描画を一括実行。
戦略: sma_cross / rsi / macd_cross / bb_breakout。 期間: 1M / 3M / 6M / 1Y / 2Y / 3Y、または start_date+end_date (YYYY-MM-DD) で任意レンジ指定可。 時間軸: 1D / 4H / 1H。 SVG チャート付きで損益・勝率・最大DD・Sharpe Ratio 等を返却。 content テキスト末尾に equity_curve / drawdown_curve の JSON を含む (chartDetail=default は最大 200 点の均等サンプル、full は全点)。独自実装不要。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pair | No | Trading pair (e.g., btc_jpy) | btc_jpy |
| fee_bp | No | One-way fee in basis points. When omitted, resolved dynamically from the current /spot/pairs taker rate (falls back to nominal 12 bp if unavailable). Explicit values are always respected. | |
| period | No | Backtest period: 1M, 3M, 6M, 1Y, 2Y, or 3Y. Ignored when start_date and end_date are both provided. | 3M |
| savePng | No | Save chart as PNG file to outputDir (default: false). For inline display in chat UI, leave false and use includeSvg or prepare_chart_data instead. | |
| end_date | No | Backtest end date (ISO 8601: YYYY-MM-DD). Takes precedence over period when both start_date and end_date are provided. | |
| strategy | Yes | Strategy configuration | |
| execution | No | Execution timing (fixed: t+1_open) | t+1_open |
| outputDir | No | Output directory for chart files | /mnt/user-data/outputs |
| timeframe | No | Candle timeframe: 1D (daily), 4H (4-hour), 1H (hourly) | 1D |
| includeSvg | No | Include SVG string in response (default: false, for token saving) | |
| start_date | No | Backtest start date (ISO 8601: YYYY-MM-DD). Takes precedence over period when both start_date and end_date are provided. | |
| chartDetail | No | Chart detail level: default (equity+DD only) or full (price+indicator+equity+DD+position). Use full ONLY when user explicitly requests price chart or indicator visualization. | default |