# optimize

Generates Python parameter grid search scripts for VectorBT strategies, plots Plotly heatmaps, and benchmarks returns against NIFTY.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 2300 installs · ★ 211
- Author: marketcalls
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/marketcalls/vectorbt-backtesting-skills/tree/HEAD/.claude/skills/optimize/SKILL.md
- Updated: 2026-07-12
- HTML: https://affpapa.org/en/nevibecode/skills/optimize

## What it does

The skill creates an optimization script named `{symbol}_{strategy}_optimize.py` inside `backtesting/{strategy_name}/`. The generated code retrieves market data using OpenAlgo API or an optional read-only DuckDB database. By default, it computes technical indicators using `openalgo.ta` and cleans entry signals with `ta.exrem()`, avoiding VectorBT built-in indicators unless TA-Lib is explicitly requested.

Optimization runs in a `tqdm` loop across strategy parameter grids. It tracks total return, Sharpe ratio, max drawdown, and trade count for each run. Alongside printing top-10 parameter sets, the script outputs two dark Plotly heatmaps, saves raw results to CSV, and generates a comparison table against the NIFTY index.

Because the generated code embeds Indian market delivery fees (`fees=0.00111, fixed_fees=20`) and specific lot sizes for NIFTY and BANKNIFTY futures, running backtests for other exchanges requires manually editing commission logic and lot configurations.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add marketcalls/vectorbt-backtesting-skills --skill optimize -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/optimize/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/optimize/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add marketcalls/vectorbt-backtesting-skills --skill optimize -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/optimize/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add marketcalls/vectorbt-backtesting-skills --skill optimize -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/optimize/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install marketcalls/vectorbt-backtesting-skills optimize
```

2. **Manually: put the files in place**
- File: `.github/skills/optimize/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add marketcalls/vectorbt-backtesting-skills --skill optimize -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/marketcalls/vectorbt-backtesting-skills --path .claude/skills/optimize
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/optimize/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add marketcalls/vectorbt-backtesting-skills --skill optimize -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/marketcalls/vectorbt-backtesting-skills/tree/HEAD/.claude/skills/optimize/SKILL.md

## When to use it
- run parameter grid searches for VectorBT trading strategies
- generate Plotly heatmaps for total return and Sharpe ratio
- calculate trade performance with Indian equity delivery fees
- compare custom strategy metrics against the NIFTY benchmark

## Example prompts
- /optimize ema-crossover RELIANCE NSE D
- /optimize rsi SBIN
- /optimize supertrend NIFTY NFO 5m

## Similar
- [vectorbt](https://affpapa.org/en/nevibecode/skills/vectorbt.md) — skill · 492 installs
- [strategy-framework](https://affpapa.org/en/nevibecode/skills/strategy-framework.md) — skill · 500 installs
- [live-feed](https://affpapa.org/en/nevibecode/skills/live-feed.md) — skill · 550 installs
- [stockbee-20pct-study](https://affpapa.org/en/nevibecode/skills/stockbee-20pct-study.md) — skill · 2600 installs
- [quant-analyst](https://affpapa.org/en/nevibecode/agents/quant-analyst.md) — subagent · 1366 installs
- [custom-indicator](https://affpapa.org/en/nevibecode/skills/custom-indicator.md) — skill · 563 installs

## Other versions with the same name
- [optimize · aladicf](https://affpapa.org/en/nevibecode/skills/aladicf-optimize.md) — 536 installs

From the same set: [marketcalls/vectorbt-backtesting-skills](https://affpapa.org/en/nevibecode/by/marketcalls/vectorbt-backtesting-skills.md) — 6 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
