vectorbt-optimize
Skill3 starsChanged 32 days agoMITView on GitHub
Create a parameter optimization script for a VectorBT strategy. Parse $ARGUMENTS as: strategy symbol exchange interval If no arguments, ask the user which strategy to optimize. /optimize ema-crossover RELIANCE NSE D /optimize rsi SBIN
- 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-backtestSkill
- 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
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 5 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Create a parameter optimization script for a VectorBT strategy.
- Distinctive: line 25
If no arguments, ask the user which strategy to optimize.
- 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}_optimize.py
- Very specific: line 34
If user provides a DuckDB path, load data directly via duckdb.connect(path, read_only=True).
- Very specific: line 35
If openalgo.ta is not importable (standalone DuckDB), use inline exrem() fallback.
- Very specific: line 38
Use ta.exrem() to clean signals (always .fillna(False) before exrem)
- Distinctive: line 40
Use loop-based optimization to collect multiple metrics per combo
- Very specific: line 42
Use tqdm for progress bars
- Distinctive: line 52
Never use icons/emojis in code or logger output
≈ “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/optimize/SKILL.md
Curated for awesome-quant-skills
-->name: optimize description: Optimize strategy parameters using VectorBT. Tests parameter combinations and generates heatmaps. argument-hint: "[strategy] [symbol] [exchange] [interval]" allowed-tools: Read, Write, Edit, Bash, Glob, Grep
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
- 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}_optimize.py - 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 OpenAlgo ta for ALL indicators by default (never VectorBT built-in). Only switch to TA-Lib if the user explicitly says "talib"/"TA-Lib"
- Always use OpenAlgo ta for specialty indicators (Supertrend, Donchian, etc.) - no TA-Lib equivalent exists
- 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
- Load
- Never use icons/emojis in code or logger output
- For futures symbols, use lot-size-aware sizing:
- NIFTY:
min_size=65, size_granularity=65 - BANKNIFTY:
min_size=30, size_granularity=30
- NIFTY:
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
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.

