
Optimize
- 1.7k installs
- 179 repo stars
- Updated July 12, 2026
- marketcalls/vectorbt-backtesting-skills
VectorBT optimization scaffolder for Indian equities.
About
The optimize skill scaffolds VectorBT parameter optimization scripts for Indian market strategies. It parses strategy, symbol, exchange, and interval arguments, creates backtesting directories, and writes optimize.py files loading data via OpenAlgo client.history() or DuckDB. Scripts use TA-Lib indicators, OpenAlgo ta signals, ta.exrem() with fillna(False), loop-based combo testing with tqdm, and Indian delivery fees fees=0.00111 plus fixed_fees=20. Each combo records total_return, sharpe_ratio, max_drawdown, and trade_count, prints top ten by return and Sharpe, saves CSV, renders Plotly dark heatmaps, fetches NIFTY benchmark, and explains results in plain language for traders tuning ema-crossover, rsi, donchian, or supertrend strategies. Loop-based VectorBT optimization with tqdm. OpenAlgo history() or DuckDB data load. TA-Lib plus OpenAlgo ta with exrem cleaning. Tracks return, Sharpe, drawdown, trade_count. Plotly heatmaps and NIFTY benchmark table. VectorBT optimization scaffolder for Indian equities. User asks to optimize VectorBT strategy parameters.
- Loop-based VectorBT optimization with tqdm.
- OpenAlgo history() or DuckDB data load.
- TA-Lib plus OpenAlgo ta with exrem cleaning.
- Tracks return, Sharpe, drawdown, trade_count.
- Plotly heatmaps and NIFTY benchmark table.
Optimize by the numbers
- 1,708 all-time installs (skills.sh)
- +71 installs in the week ending Jul 28, 2026 (Skillselion tracking)
- Ranked #79 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)
optimize capabilities & compatibility
- Capabilities
- grid search · heatmaps
- Use cases
- trading · data analysis
npx skills add https://github.com/marketcalls/vectorbt-backtesting-skills --skill optimizeAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 1.7k |
|---|---|
| repo stars | ★ 179 |
| Security audit | 3 / 3 scanners passed |
| Last updated | July 12, 2026 |
| Repository | marketcalls/vectorbt-backtesting-skills ↗ |
How do I grid-search strategy parameters?
Generate VectorBT parameter optimization scripts that grid-search strategy params with Sharpe, drawdown metrics, and Plotly heatmaps.
Who is it for?
Quant developers tuning VectorBT on NSE.
Skip if: Live order execution.
When should I use this skill?
User asks to optimize VectorBT strategy parameters.
What you get
Optimization script with CSV and heatmaps.
- optimization Python scripts
- parameter heatmap visualizations
Files
Create a parameter optimization script for a VectorBT strategy.
Arguments
Parse $ARGUMENTS as: strategy symbol exchange interval
$0= strategy name (e.g., ema-crossover, rsi, donchian). Default: ema-crossover$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 to optimize.
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}_optimize.py 4. The script must:
- Load
.envfrom project root usingfind_dotenv()and fetch data via OpenAlgoclient.history() - If user provides a DuckDB path, load data directly via
duckdb.connect(path, read_only=True). See vectorbt-expertrules/duckdb-data.md. - If
openalgo.tais not importable (standalone DuckDB), use inlineexrem()fallback. - Use TA-Lib for ALL indicators (never VectorBT built-in)
- Use OpenAlgo ta for specialty indicators (Supertrend, Donchian, etc.)
- Use
ta.exrem()to clean signals (always.fillna(False)before exrem) - Define sensible parameter ranges for the chosen strategy
- Use loop-based optimization to collect multiple metrics per combo
- Track: total_return, sharpe_ratio, max_drawdown, trade_count for each combination
- Use
tqdmfor progress bars - Indian delivery fees:
fees=0.00111, fixed_fees=20for delivery equity - Find best parameters by total return AND by Sharpe ratio
- Print top 10 results for both criteria
- Generate Plotly heatmap of total return across parameter grid (
template="plotly_dark") - Generate Plotly heatmap of Sharpe ratio across parameter grid
- Fetch NIFTY benchmark and compare best parameters vs benchmark
- Print Strategy vs Benchmark comparison table
- Explain results in plain language for normal traders
- Save results to CSV
4. Never use icons/emojis in code or logger output 5. For futures symbols, use lot-size-aware sizing:
- NIFTY:
min_size=65, size_granularity=65 - BANKNIFTY:
min_size=30, size_granularity=30
Default Parameter Ranges
| Strategy | Parameter 1 | Parameter 2 |
|---|---|---|
| ema-crossover | fast EMA: 5-50 | slow EMA: 10-60 |
| rsi | window: 5-30 | oversold: 20-40 |
| donchian | period: 5-50 | - |
| supertrend | period: 5-30 | multiplier: 1.0-5.0 |
Example Usage
/optimize ema-crossover RELIANCE NSE D /optimize rsi SBIN
Related skills
FAQ
What metrics per combo?
total_return, sharpe_ratio, max_drawdown, trade_count.
Data source?
OpenAlgo client.history() or DuckDB path.
Delivery fees?
fees=0.00111 and fixed_fees=20.
Is Optimize safe to install?
skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.