Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
marketcalls avatar

Backtest

  • 2.5k installs
  • 179 repo stars
  • Updated July 12, 2026
  • marketcalls/vectorbt-backtesting-skills

backtest is a VectorBT skill that generates full backtest scripts with data fetch, signals, stats, plots, and benchmark comparison.

About

The backtest skill creates complete VectorBT backtest scripts from strategy keywords, symbols, exchanges, and intervals passed as arguments. It reads vectorbt-expert rules, creates backtesting/{strategy}/ directories on demand, and starts from rules/assets templates for ema-crossover, rsi, donchian, supertrend, macd, sda2, momentum, dual-momentum, buy-hold, and rsi-accumulation strategies. Scripts load .env via find_dotenv, fetch data through OpenAlgo client.history, or read DuckDB paths with Historify versus custom table detection per duckdb-data.md. Indicators use TA-Lib for standard metrics and OpenAlgo ta for specialty ones, always cleaning signals with ta.exrem and fillna(False). Portfolio runs use from_signals with min_size and size_granularity, Indian delivery fees 0.00111 plus fixed_fees 20, and NIFTY benchmark via NSE_INDEX by default. Output prints pf.stats, a strategy versus benchmark table, plain-language report, optional QuantStats HTML, Plotly equity and drawdown charts, and CSV trade export without emojis in code or logs. Futures symbols apply lot-size-aware sizing for NIFTY and BANKNIFTY.

  • Parses strategy, symbol, exchange, and interval from command arguments.
  • Uses TA-Lib indicators and OpenAlgo ta specialty indicators with exrem.
  • Fetches data via OpenAlgo or optional DuckDB read_only paths.
  • Compares strategy stats against NIFTY or user-specified benchmarks.
  • Applies Indian delivery and F&O fee and lot-size conventions.

Backtest by the numbers

  • 2,522 all-time installs (skills.sh)
  • +100 installs in the week ending Jul 28, 2026 (Skillselion tracking)
  • Ranked #52 of 1,136 Finance & Trading skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
At a glance

backtest capabilities & compatibility

Capabilities
template driven strategy script generation · openalgo and duckdb data source handling · ta lib and specialty indicator integration · benchmark comparison and quantstats tearsheet ou · plotly equity curve and trade csv export
Use cases
trading · data analysis
From the docs

What backtest says it does

Create a complete VectorBT backtest script for the user.
SKILL.md
Never use icons/emojis in code or logger output
SKILL.md
npx skills add https://github.com/marketcalls/vectorbt-backtesting-skills --skill backtest

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs2.5k
repo stars179
Security audit3 / 3 scanners passed
Last updatedJuly 12, 2026
Repositorymarketcalls/vectorbt-backtesting-skills

How do I quickly backtest a named strategy on a symbol with VectorBT and OpenAlgo data?

Generate a complete VectorBT backtest Python script for a named strategy, symbol, exchange, and interval with stats and benchmark comparison.

Who is it for?

Traders generating VectorBT backtests for NSE symbols with OpenAlgo or DuckDB data.

Skip if: Skip for live trading execution or non-VectorBT research workflows.

When should I use this skill?

User runs /backtest with strategy keyword, symbol, exchange, or interval arguments.

What you get

A runnable .py script with stats, benchmark table, optional QuantStats HTML, Plotly charts, and trades CSV.

  • complete .py backtest script
  • performance stats and plots

By the numbers

  • Supports 7 named trading strategies including ema-crossover, rsi, donchian, supertrend, macd, sda2, and momentum

Files

SKILL.mdMarkdownGitHub ↗

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

1. Read the vectorbt-expert skill rules for reference patterns 2. Create backtesting/{strategy_name}/ directory if it doesn't exist (on-demand) 3. Create a .py file in backtesting/{strategy_name}/ named {symbol}_{strategy}_backtest.py 4. Use the matching template from rules/assets/{strategy}/backtest.py as the starting point 5. The script must:

  • Load .env from the project root using find_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_data table, epoch timestamps) vs custom (ohlcv table, date+time). See vectorbt-expert rules/duckdb-data.md.
  • If openalgo.ta is not importable (standalone DuckDB), use inline exrem() fallback.
  • Use TA-Lib for ALL indicators (EMA, SMA, RSI, MACD, BBands, ATR, ADX, STDDEV, MOM)
  • Use OpenAlgo ta for specialty indicators (Supertrend, Donchian, Ichimoku, HMA, KAMA, ALMA)
  • Use ta.exrem() to clean duplicate signals (always .fillna(False) before exrem)
  • Run vbt.Portfolio.from_signals() with min_size=1, size_granularity=1
  • Indian delivery fees: fees=0.00111, fixed_fees=20 for 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 QuantStats HTML tearsheet if quantstats is available
  • Plot equity curve + drawdown using Plotly (template="plotly_dark")
  • Export trades to CSV

5. Never use icons/emojis in code or logger output 6. 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=20 for F&O futures

Available Strategies

StrategyKeywordTemplate
EMA Crossoverema-crossoverassets/ema_crossover/backtest.py
RSIrsiassets/rsi/backtest.py
Donchian Channeldonchianassets/donchian/backtest.py
Supertrendsupertrendassets/supertrend/backtest.py
MACD Breakoutmacdassets/macd/backtest.py
SDA2sda2assets/sda2/backtest.py
Momentummomentumassets/momentum/backtest.py
Dual Momentumdual-momentumassets/dual_momentum/backtest.py
Buy & Holdbuy-holdassets/buy_hold/backtest.py
RSI Accumulationrsi-accumulationassets/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 ^NSEI for 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

Related skills

FAQ

What is the default benchmark?

NIFTY 50 via OpenAlgo symbol NIFTY on exchange NSE_INDEX unless the user specifies another benchmark.

Can I use local DuckDB instead of OpenAlgo?

Yes. Provide a DuckDB path and the script auto-detects Historify market_data versus custom ohlcv schemas.

Which strategies are supported?

Templates include ema-crossover, rsi, donchian, supertrend, macd, sda2, momentum, dual-momentum, buy-hold, and rsi-accumulation.

Is Backtest safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.