一键导入
backtest
Quick backtest a strategy on a symbol. Creates a complete .py script with data fetch, signals, backtest, stats, and plots.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Quick backtest a strategy on a symbol. Creates a complete .py script with data fetch, signals, backtest, stats, and plots.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
VectorBT backtesting expert. Use when user asks to backtest strategies, create entry/exit signals, analyze portfolio performance, optimize parameters, fetch historical data, use VectorBT/vectorbt, compare strategies, position sizing, equity curves, drawdown charts, or trade analysis. Also triggers for openalgo.ta helpers (exrem, crossover, crossunder, flip, donchian, supertrend).
Optimize strategy parameters using VectorBT. Tests parameter combinations and generates heatmaps.
Quickly fetch data and print key backtest stats for a symbol with a default EMA crossover strategy. No file creation needed - runs inline in a notebook cell or prints to console.
Set up the Python backtesting environment. Detects OS, creates virtual environment, installs dependencies (openalgo, ta-lib, vectorbt, plotly), and creates the backtesting folder structure.
Compare multiple strategies or directions (long vs short vs both) on the same symbol. Generates side-by-side stats table.
| name | backtest |
| description | Quick backtest a strategy on a symbol. Creates a complete .py script with data fetch, signals, backtest, stats, and plots. |
| argument-hint | [strategy] [symbol] [exchange] [interval] |
| allowed-tools | Read, Write, Edit, Bash, Glob, Grep |
Create a complete VectorBT backtest script for the user.
Parse $ARGUMENTS as: strategy symbol exchange interval
$0 = strategy name (e.g., ema-crossover, rsi, donchian, supertrend, macd, sda2, momentum)$1 = symbol (e.g., SBIN, RELIANCE, NIFTY). Default: SBIN$2 = exchange (e.g., NSE, NFO). Default: NSE$3 = interval (e.g., D, 1h, 5m). Default: DIf no arguments, ask the user which strategy they want.
backtesting/{strategy_name}/ directory if it doesn't exist (on-demand).py file in backtesting/{strategy_name}/ named {symbol}_{strategy}_backtest.pyrules/assets/{strategy}/backtest.py as the starting point.env from the project root using find_dotenv() (walks up from script dir automatically)client.history() from OpenAlgoduckdb.connect(path, read_only=True) instead of OpenAlgo API. Auto-detect format: Historify (market_data table, epoch timestamps) vs custom (ohlcv table, date+time). See vectorbt-expert rules/duckdb-data.md.openalgo.ta is not importable (standalone DuckDB), use inline exrem() fallback.from openalgo import tata.exrem() to clean duplicate signals (always .fillna(False) before exrem)vbt.Portfolio.from_signals() with min_size=1, size_granularity=1fees=0.00111, fixed_fees=20 for delivery equitysymbol="NIFTY", exchange="NSE_INDEX")pf.stats()ostz.dashboard(...) if openstatz is available - a self-contained offline HTML file, no server needed (always use OpenStatz, never QuantStats; never the legacy ostz.reports.html static report). Set strategy_returns.name (e.g. "EMA 20/50 Crossover - SBIN") and benchmark.name before calling dashboard() - that name, not the title= argument, is what the tearsheet shows as the strategy header/column/legend (see the openstatz-tearsheet rule)template="plotly_dark")min_size=65, size_granularity=65 (effective 31 Dec 2025)min_size=30, size_granularity=30fees=0.00018, fixed_fees=20 for F&O futures| Strategy | Keyword | Template |
|---|---|---|
| EMA Crossover | ema-crossover | assets/ema_crossover/backtest.py |
| RSI | rsi | assets/rsi/backtest.py |
| Donchian Channel | donchian | assets/donchian/backtest.py |
| Supertrend | supertrend | assets/supertrend/backtest.py |
| MACD Breakout | macd | assets/macd/backtest.py |
| SDA2 | sda2 | assets/sda2/backtest.py |
| Momentum | momentum | assets/momentum/backtest.py |
| Dual Momentum | dual-momentum | assets/dual_momentum/backtest.py |
| Buy & Hold | buy-hold | assets/buy_hold/backtest.py |
| RSI Accumulation | rsi-accumulation | assets/rsi_accumulation/backtest.py |
symbol="NIFTY", exchange="NSE_INDEX")^NSEI for India, ^GSPC (S&P 500) for US markets/backtest ema-crossover RELIANCE NSE D
/backtest rsi SBIN
/backtest supertrend NIFTY NFO 5m