vectorbt-expert▌
marketcalls/vectorbt-backtesting-skills · updated Apr 8, 2026
MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.
$23
VectorBT Backtesting Expert Skill
Environment
- Python with vectorbt, pandas, numpy, plotly
- Data sources: OpenAlgo (Indian markets), DuckDB (direct database), yfinance (US/Global), CCXT (Crypto), custom providers
- DuckDB support: supports both custom DuckDB and OpenAlgo Historify format
- API keys loaded from single root
.envviapython-dotenv+find_dotenv()— never hardcode keys - Technical indicators: TA-Lib (ALWAYS - never use VectorBT built-in indicators)
- Specialty indicators:
openalgo.tafor Supertrend, Donchian, Ichimoku, HMA, KAMA, ALMA, ZLEMA, VWMA - Signal cleaning:
openalgo.tafor exrem, crossover, crossunder, flip - Fee model: Indian market standard (STT + statutory charges + Rs 20/order)
- Benchmark: NIFTY 50 via OpenAlgo (
NSE_INDEX) by default - Charts: Plotly with
template="plotly_dark" - Environment variables loaded from single
.envat project root viafind_dotenv()(walks up from script dir) - Scripts go in
backtesting/{strategy_name}/directories (created on-demand, not pre-created) - Never use icons/emojis in code or logger output
Critical Rules
- ALWAYS use TA-Lib for ALL technical indicators (EMA, SMA, RSI, MACD, BBANDS, ATR, ADX, STDDEV, MOM). NEVER use
vbt.MA.run(),vbt.RSI.run(), or any VectorBT built-in indicator. - Use OpenAlgo ta for indicators NOT in TA-Lib: Supertrend, Donchian, Ichimoku, HMA, KAMA, ALMA, ZLEMA, VWMA.
- Use OpenAlgo ta for signal utilities:
ta.exrem(),ta.crossover(),ta.crossunder(),ta.flip(). Ifopenalgo.tais not importable (standalone DuckDB), use inlineexrem()fallback. See duckdb-data. - Always clean signals with
ta.exrem()after generating raw buy/sell signals. Always.fillna(False)before exrem. - Market-specific fees: India (indian-market-costs), US (us-market-costs), Crypto (crypto-market-costs). Auto-select based on user's market.
- Default benchmarks: India=NIFTY via OpenAlgo, US=S&P 500 (
^GSPC), Crypto=Bitcoin (BTC-USD). See data-fetching Market Selection Guide. - Always produce a Strategy vs Benchmark comparison table after every backtest.
- Always explain the backtest report in plain language so even normal traders understand risk and strength.
- Plotly candlestick charts must use
xaxis type="category"to avoid weekend gaps. - Whole shares: Always set
min_size=1, size_granularity=1for equities. - DuckDB data loading: When user provides a DuckDB path, load data directly using
duckdb.connect()withread_only=True. Auto-detect format: OpenAlgo Historify (tablemarket_data, epoch timestamps) vs custom (tableohlcv, date+time columns). See duckdb-data.
Modular Rule Files
Detailed reference for each topic is in rules/:
| Rule File | Topic |
|---|---|
| data-fetching | OpenAlgo (India), yfinance (US), CCXT (Crypto), custom providers, .env setup |
| simulation-modes | from_signals, from_orders, from_holding, direction types |
| position-sizing | Amount/Value/Percent/TargetPercent sizing |
| indicators-signals | TA-Lib indicator reference, signal generation |
| openalgo-ta-helpers | OpenAlgo ta: exrem, crossover, Supertrend, Donchian, Ichimoku, MAs |
| stop-loss-take-profit | Fixed SL, TP, trailing stop |
| parameter-optimization | Broadcasting and loop-based optimization |
| performance-analysis | Stats, metrics, benchmark comparison, CAGR |
| plotting | Candlestick (category x-axis), VectorBT plots, custom Plotly |
| indian-market-costs | Indian market fee model by segment |
| us-market-costs | US market fee model (stocks, options, futures) |
| crypto-market-costs | Crypto fee model (spot, USDT-M, COIN-M futures) |
| futures-backtesting | Lot sizes (SEBI revised Dec 2025), value sizing |
| long-short-trading | Simultaneous long/short, direction comparison |
| duckdb-data | DuckDB direct loading, Historify format, auto-detect, resampling, multi-symbol |
| csv-data-resampling | Loading CSV, resampling with Indian market alignment |
| walk-forward | Walk-forward analysis, WFE ratio |
| robustness-testing | Monte Carlo, noise test, parameter sensitivity, delay test |
| pitfalls | Common mistakes and checklist before going live |
| strategy-catalog | Strategy reference with code snippets |
| quantstats-tearsheet | QuantStats HTML reports, metrics, plots, Monte Carlo |
Strategy Templates (in rules/assets/)
Production-ready scripts with realistic fees, NIFTY benchmark, comparison table, and plain-language report:
| Template | Path | Description |
|---|---|---|
| EMA Crossover | assets/ema_crossover/backtest.py |
EMA 10/20 crossover |
| RSI | assets/rsi/backtest.py |
RSI(14) oversold/overbought |
| Donchian | assets/donchian/backtest.py |
Donchian channel breakout |
| Supertrend | assets/supertrend/backtest.py |
Supertrend with intraday sessions |
| MACD | assets/macd/backtest.py |
MACD signal-candle breakout |
| SDA2 | assets/sda2/backtest.py |
SDA2 trend following |
| Momentum | assets/momentum/backtest.py |
Double momentum (MOM + MOM-of-MOM) |
| Dual Momentum | assets/dual_momentum/backtest.py |
Quarterly ETF rotation |
| Buy & Hold | assets/buy_hold/backtest.py |
Static multi-asset allocation |
| RSI Accumulation | assets/rsi_accumulation/backtest.py |
Weekly RSI slab-wise accumulation |
| Walk-Forward | assets/walk_forward/template.py |
Walk-forward analysis template |
| Realistic Costs | assets/realistic_costs/template.py |
Transaction cost impact comparison |
Quick Template: Standard Backtest Script
import os
from datetime import datetime, timedelta
from pathlib import Path
import numpy as np
import pandas as pd
import talib as tl
import vectorbt as vbt
from dotenv import find_dotenv, load_dotenv
from openalgo import api, ta
# --- Config ---
script_dir = Path(__file__).resolve().parent
load_dotenv(find_dotenv(), override=False)
SYMBOL = "SBIN"
EXCHANGE = "NSE"
INTERVAL = "D"
INIT_CASH = 1_000_000
FEES = 0.00111 # Indian delivery equity (STT + statutory)
FIXED_FEES = 20 # Rs 20 per order
ALLOCATION = 0.75
BENCHMARK_SYMBOL = "NIFTY"
BENCHMARK_EXCHANGE = "NSE_INDEX"
# --- Fetch Data ---
client = api(
api_key=os.getenv("OPENALGO_API_KEY"),
host=os.getenv("OPENALGO_HOST", "http://127.0.0.1:5000"),
)
end_date = datetime.now().date()
start_date = end_date - timedelta(days=365 * 3)
df = client.history(
symbol=SYMBOL, exchange=EXCHANGE, interval=INTERVAL,
start_date=start_date.strftime("%Y-%m-%d"),
end_date=end_date.strftime("%Y-%m-%d"),
)
if "timestamp" in df.columns:
df["timestamp"] = pd.to_datetime(df["timestamp"])
df = df.set_index("timestamp")
else:
df.index = pd.to_datetime(df.index)
df = df.sort_index()
if df.index.tz is not None:
df.index = df.index.tz_convert(None)
close = df["close"]
# --- Strategy: EMA Crossover (TA-Lib) ---
ema_fast = pd.Series(tl.EMA(close.values, timeperiod=10), index=close.index)
ema_slow = pd.Series(tl.EMA(close.values, timeperiod=20), index=close.index)
buy_raw = (ema_fast > ema_slow) & (ema_fast.shift(1) <= ema_slow.shift(1))
sell_raw = (ema_fast < ema_slow) & (ema_fast.shift(1) >= ema_slow.shift(1))
How to use vectorbt-expert on Cursor
AI-first code editor with Composer
Prerequisites
Before installing skills in Cursor, ensure your development environment meets these requirements:
- ›Cursor installed and configured on your development machine
- ›Node.js version 16.0+ with npm package manager (verify with
node --version) - ›Active project directory or workspace where you want to add vectorbt-expert
Execute installation command
Execute the skills CLI command in your project's root directory to begin installation:
The skills CLI fetches vectorbt-expert from GitHub repository marketcalls/vectorbt-backtesting-skills and configures it for Cursor.
Select Cursor when prompted
The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:
Verify installation
Confirm successful installation by checking the skill directory location:
Reload or restart Cursor to activate vectorbt-expert. Access the skill through slash commands (e.g., /vectorbt-expert) or your agent's skill management interface.
Security & Verification Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.
List & Monetize Your Skill
Submit your Claude Code skill and start earning
Use Cases▌
Task Automation & Efficiency
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Knowledge Enhancement
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Quality Improvement
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
Implementation Guide▌
Prerequisites
- ›Claude Desktop or compatible AI client with skill support
- ›Clear understanding of task or problem to solve
- ›Willingness to iterate and refine outputs
Time Estimate
15-45 minutes depending on use case complexity
Installation Steps
- 1.Install skill using provided installation command
- 2.Test with simple use case relevant to your work
- 3.Evaluate output quality and relevance
- 4.Iterate on prompts to improve results
- 5.Integrate into regular workflow if valuable
Common Pitfalls
- ⚠Expecting perfect results without iteration
- ⚠Not providing enough context in prompts
- ⚠Using skill for tasks outside its intended scope
- ⚠Accepting outputs without review and validation
Best Practices▌
✓ Do
- +Start with clear, specific prompts
- +Provide relevant context and constraints
- +Review and refine all outputs before using
- +Iterate to improve output quality
- +Document successful prompt patterns
✗ Don't
- −Don't use without understanding skill limitations
- −Don't skip validation of outputs
- −Don't share sensitive information in prompts
- −Don't expect skill to replace human judgment
💡 Pro Tips
- ★Be specific about desired format and style
- ★Ask for multiple options to choose from
- ★Request explanations to understand reasoning
- ★Combine AI efficiency with human expertise
When to Use This▌
✓ Use When
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid When
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
Learning Path▌
- 1Familiarize yourself with skill capabilities and limitations
- 2Start with low-risk, non-critical tasks
- 3Progress to more complex and valuable use cases
- 4Build expertise through regular use and experimentation
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.5★★★★★54 reviews- ★★★★★Ishan Diallo· Dec 20, 2024
Keeps context tight: vectorbt-expert is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Amelia Gonzalez· Dec 12, 2024
vectorbt-expert is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Dhruvi Jain· Dec 8, 2024
vectorbt-expert is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Charlotte Gupta· Dec 4, 2024
Solid pick for teams standardizing on skills: vectorbt-expert is focused, and the summary matches what you get after install.
- ★★★★★Oshnikdeep· Nov 27, 2024
Keeps context tight: vectorbt-expert is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Ishan Abebe· Nov 23, 2024
Registry listing for vectorbt-expert matched our evaluation — installs cleanly and behaves as described in the markdown.
- ★★★★★Kabir Mehta· Nov 11, 2024
vectorbt-expert is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Daniel Ghosh· Nov 3, 2024
Keeps context tight: vectorbt-expert is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Naina Thomas· Oct 22, 2024
vectorbt-expert has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Ganesh Mohane· Oct 18, 2024
vectorbt-expert has been reliable in day-to-day use. Documentation quality is above average for community skills.
showing 1-10 of 54