vectorbt-backtest
Skill3 starsChanged 32 days agoMITView on GitHub
Create a complete VectorBT backtest script for the user. Parse $ARGUMENTS as: strategy symbol exchange interval If no arguments, ask the user which strategy they want.
- Reads credentials
In this repository33 other files it gives its agents.
- llms.txtllms.txt
- alpha-zooSkill
- breadth-chart-analystSkill
- canslim-screenerSkill
- factor-mining-pandaaiSkill
- backtesting-bias-avoidanceSkill
- backtest-reviewSkill
- data-quality-auditSkill
- paper-reproSkill
- pine-backtesterSkill
- stats-test-pickerSkill
- vectorbt-optimizeSkill
- akquantSkill
- ashare-pre-st-filterSkill
- cninfo-disclosureSkill
- ctp-apiSkill
- ptrade-strategy-writingSkill
- quant-buddySkill
- ssquant-futuresSkill
- tdxquantSkill
- tqsdk-tradingSkill
- wencai-screenerSkill
- defillama-dataSkill
- defillama-flowsSkill
- defillama-yieldsSkill
- perp-funding-basisSkill
- pine-debuggerSkill
- pine-developerSkill
- edgar-financialsSkill
- llmquant-equitiesSkill
- llmquant-macroSkill
- llmquant-riskSkill
- openquant-tradingSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. About 0 are common, 6 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Create a complete VectorBT backtest script for the user.
- Distinctive: line 25
If no arguments, ask the user which strategy they want.
- Distinctive: line 29
Read the vectorbt-expert skill rules for reference patterns
- Very specific: line 30
Create backtesting/{strategy_name}/ directory if it doesn't exist (on-demand)
- Very specific: line 31
Create a .py file in backtesting/{strategy_name}/ named {symbol}_{strategy}_backtest.py
- Very specific: line 32
Use the matching template from rules/assets/{strategy}/backtest.py as the starting point
- Very specific: line 36
If user provides a DuckDB path, load data directly via duckdb.connect(path, read_only=True) instead of OpenAlgo API.
- Very specific: line 37
If openalgo.ta is not importable (standalone DuckDB), use inline exrem() fallback.
- Very specific: line 40
Use ta.exrem() to clean duplicate signals (always .fillna(False) before exrem)
- Very specific: line 41
Run vbt.Portfolio.from_signals() with min_size=1, size_granularity=1
- Distinctive: line 50
Never use icons/emojis in code or logger output
- Very specific: line 54
Use fees=0.00018, fixed_fees=20 for F&O futures
- Very specific: line 73
Default: NIFTY 50 via OpenAlgo (symbol="NIFTY", exchange="NSE_INDEX")
- Distinctive: line 74
If user specifies a different benchmark, use that instead
- Distinctive: line 76
Always compare: Total Return, Sharpe, Sortino, Max Drawdown
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
<!--
Imported from: https://github.com/marketcalls/vectorbt-backtesting-skills
Source Path: .claude/skills/backtest/SKILL.md
Curated for awesome-quant-skills
-->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.
Arguments
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: D
If no arguments, ask the user which strategy they want.
Instructions
- Read the vectorbt-expert skill rules for reference patterns
- Create
backtesting/{strategy_name}/directory if it doesn't exist (on-demand) - Create a
.pyfile inbacktesting/{strategy_name}/named{symbol}_{strategy}_backtest.py - Use the matching template from
rules/assets/{strategy}/backtest.pyas the starting point - The script must:
- Load
.envfrom the project root usingfind_dotenv()(walks up from script dir automatically) - Fetch data via
client.history()from OpenAlgo - If user provides a DuckDB path, load data directly via
duckdb.connect(path, read_only=True)instead of OpenAlgo API. Auto-detect format: Historify (market_datatable, epoch timestamps) vs custom (ohlcvtable, date+time). See vectorbt-expertrules/duckdb-data.md. - If
openalgo.tais not importable (standalone DuckDB), use inlineexrem()fallback. - Use OpenAlgo ta for ALL indicators by default (EMA, SMA, RSI, MACD, BBands, ATR, ADX, STDDEV, MOM, and 90+ more) -
from openalgo import ta - Only use TA-Lib if the user explicitly says "talib"/"TA-Lib" in their request; specialty indicators (Supertrend, Donchian, Ichimoku, HMA, KAMA, ALMA, ZLEMA, VWMA) always come from OpenAlgo ta regardless, since TA-Lib has no equivalent
- Use
ta.exrem()to clean duplicate signals (always.fillna(False)before exrem) - Run
vbt.Portfolio.from_signals()withmin_size=1, size_granularity=1 - Indian delivery fees:
fees=0.00111, fixed_fees=20for delivery equity - Fetch NIFTY benchmark via OpenAlgo (
symbol="NIFTY", exchange="NSE_INDEX") - Print full
pf.stats() - Print Strategy vs Benchmark comparison table (Total Return, Sharpe, Sortino, Max DD, Win Rate, Trades, Profit Factor)
- Explain the backtest report in plain language for normal traders
- Generate the OpenStatz interactive dashboard tearsheet via
ostz.dashboard(...)ifopenstatzis available - a self-contained offline HTML file, no server needed (always use OpenStatz, never QuantStats; never the legacyostz.reports.htmlstatic report). Setstrategy_returns.name(e.g."EMA 20/50 Crossover - SBIN") andbenchmark.namebefore callingdashboard()- that name, not thetitle=argument, is what the tearsheet shows as the strategy header/column/legend (see the openstatz-tearsheet rule) - Plot equity curve + drawdown using Plotly (
template="plotly_dark") - Export trades to CSV
- Load
- Never use icons/emojis in code or logger output
- For futures symbols (NIFTY, BANKNIFTY), use lot-size-aware sizing:
- NIFTY:
min_size=65, size_granularity=65(effective 31 Dec 2025) - BANKNIFTY:
min_size=30, size_granularity=30 - Use
fees=0.00018, fixed_fees=20for F&O futures
- NIFTY:
Available Strategies
| 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 |
Benchmark Rules
- Default: NIFTY 50 via OpenAlgo (
symbol="NIFTY", exchange="NSE_INDEX") - If user specifies a different benchmark, use that instead
- For yfinance: use
^NSEIfor India,^GSPC(S&P 500) for US markets - Always compare: Total Return, Sharpe, Sortino, Max Drawdown
Example Usage
/backtest ema-crossover RELIANCE NSE D
/backtest rsi SBIN
/backtest supertrend NIFTY NFO 5m
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

