# marketcalls/vectorbt-backtesting-skills architecture

> Architecture diagram of the GitHub repository marketcalls/vectorbt-backtesting-skills, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/marketcalls/vectorbt-backtesting-skills
- Repository: https://github.com/marketcalls/vectorbt-backtesting-skills

## Overview

This repository is an instruction and example library for AI coding agents to create VectorBT backtests, rather than a backtesting service. The principal workflow is an agent using an invocable skill to produce a backtest from market data through strategy signals and portfolio simulation to benchmarked results and reports. Separate skills cover setup, optimization, quick statistics, and strategy comparison; the expert skill and its rules provide broader market and methodology guidance. README documents these capabilities; the sampled scripts show concrete OpenAlgo data retrieval, VectorBT simulation, benchmark analysis, plots, and exports.

Main entry points: [`backtesting/SBIN_ema_crossover_backtest.py`](https://github.com/marketcalls/vectorbt-backtesting-skills/blob/master/backtesting/SBIN_ema_crossover_backtest.py) (EMA crossover example), [`backtesting/buy_hold_75_25_backtest.py`](https://github.com/marketcalls/vectorbt-backtesting-skills/blob/master/backtesting/buy_hold_75_25_backtest.py) (Buy-and-hold example), [`backtesting/dual_momentum_backtest.py`](https://github.com/marketcalls/vectorbt-backtesting-skills/blob/master/backtesting/dual_momentum_backtest.py) (Dual momentum example), [`backtesting/niftybees_rsi_accumulation_backtest.py`](https://github.com/marketcalls/vectorbt-backtesting-skills/blob/master/backtesting/niftybees_rsi_accumulation_backtest.py) (RSI accumulation example)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_commands["Agent Skills"]
  node_setup["Setup skill<br/>[SKILL.md]"]
  node_backtest["Backtest skill<br/>[SKILL.md]"]
  node_optimize["Optimize skill<br/>[SKILL.md]"]
  node_quickstats["Quick stats skill<br/>[SKILL.md]"]
  node_compare["Strategy compare skill<br/>[SKILL.md]"]
end

subgraph group_knowledge["Backtesting Guidance"]
  node_expert["VectorBT expert skill<br/>[SKILL.md]"]
  node_rules["Market and method rules<br/>[rules]"]
end

subgraph group_examples["Backtest Examples"]
  node_strategyassets["Strategy templates<br/>[assets]"]
  node_ema["EMA crossover example"]
  node_buyhold["Buy-and-hold example"]
  node_momentum["Dual momentum example"]
  node_accumulation["RSI accumulation example"]
end

node_agent(("AI coding agent"))
node_openalgo["OpenAlgo data API"]
node_vectorbt["VectorBT simulation"]
node_results["Metrics and benchmarks"]
node_reporting["Plots and exports"]

node_agent -->|"invokes"| node_setup
node_agent -->|"invokes"| node_backtest
node_agent -->|"invokes"| node_optimize
node_agent -->|"invokes"| node_quickstats
node_agent -->|"invokes"| node_compare
node_agent -->|"consults"| node_expert
node_expert -.->|"provides guidance"| node_rules
node_expert -.->|"provides templates"| node_strategyassets
node_agent -->|"uses example"| node_ema
node_agent -->|"uses example"| node_buyhold
node_agent -->|"uses example"| node_momentum
node_agent -->|"uses example"| node_accumulation
node_ema -->|"fetches data"| node_openalgo
node_ema -->|"simulates portfolio"| node_vectorbt
node_ema -->|"computes metrics"| node_results
node_ema -->|"plots and exports"| node_reporting
node_buyhold -->|"fetches data"| node_openalgo
node_buyhold -->|"simulates portfolio"| node_vectorbt
node_buyhold -->|"compares benchmarks"| node_results
node_buyhold -->|"plots and exports"| node_reporting
node_momentum -->|"fetches data"| node_openalgo
node_momentum -->|"simulates portfolio"| node_vectorbt
node_momentum -->|"compares benchmarks"| node_results
node_momentum -->|"plots and exports"| node_reporting
node_accumulation -->|"fetches data"| node_openalgo
node_accumulation -->|"simulates portfolio"| node_vectorbt
node_accumulation -->|"compares benchmarks"| node_results
node_accumulation -->|"plots and exports"| node_reporting

click node_setup "https://github.com/marketcalls/vectorbt-backtesting-skills/blob/master/.claude/skills/setup/SKILL.md"
click node_backtest "https://github.com/marketcalls/vectorbt-backtesting-skills/blob/master/.claude/skills/backtest/SKILL.md"
click node_optimize "https://github.com/marketcalls/vectorbt-backtesting-skills/blob/master/.claude/skills/optimize/SKILL.md"
click node_quickstats "https://github.com/marketcalls/vectorbt-backtesting-skills/blob/master/.claude/skills/quick-stats/SKILL.md"
click node_compare "https://github.com/marketcalls/vectorbt-backtesting-skills/blob/master/.claude/skills/strategy-compare/SKILL.md"
click node_expert "https://github.com/marketcalls/vectorbt-backtesting-skills/blob/master/.claude/skills/vectorbt-expert/SKILL.md"
click node_rules "https://github.com/marketcalls/vectorbt-backtesting-skills/tree/master/.claude/skills/vectorbt-expert/rules"
click node_strategyassets "https://github.com/marketcalls/vectorbt-backtesting-skills/tree/master/.claude/skills/vectorbt-expert/rules/assets"
click node_ema "https://github.com/marketcalls/vectorbt-backtesting-skills/blob/master/backtesting/SBIN_ema_crossover_backtest.py"
click node_buyhold "https://github.com/marketcalls/vectorbt-backtesting-skills/blob/master/backtesting/buy_hold_75_25_backtest.py"
click node_momentum "https://github.com/marketcalls/vectorbt-backtesting-skills/blob/master/backtesting/dual_momentum_backtest.py"
click node_accumulation "https://github.com/marketcalls/vectorbt-backtesting-skills/blob/master/backtesting/niftybees_rsi_accumulation_backtest.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_setup,node_backtest,node_optimize,node_quickstats,node_compare toneBlue
class node_expert,node_rules toneAmber
class node_strategyassets,node_ema,node_buyhold,node_momentum,node_accumulation,node_openalgo toneMint
class node_agent,node_vectorbt,node_results,node_reporting toneIndigo
```

## Components

### Agent Skills

- [Setup skill](https://github.com/marketcalls/vectorbt-backtesting-skills/blob/master/.claude/skills/setup/SKILL.md): `.claude/skills/setup/SKILL.md`
- [Backtest skill](https://github.com/marketcalls/vectorbt-backtesting-skills/blob/master/.claude/skills/backtest/SKILL.md): `.claude/skills/backtest/SKILL.md`
- [Optimize skill](https://github.com/marketcalls/vectorbt-backtesting-skills/blob/master/.claude/skills/optimize/SKILL.md): `.claude/skills/optimize/SKILL.md`
- [Quick stats skill](https://github.com/marketcalls/vectorbt-backtesting-skills/blob/master/.claude/skills/quick-stats/SKILL.md): `.claude/skills/quick-stats/SKILL.md`
- [Strategy compare skill](https://github.com/marketcalls/vectorbt-backtesting-skills/blob/master/.claude/skills/strategy-compare/SKILL.md): `.claude/skills/strategy-compare/SKILL.md`

### Backtesting Guidance

- [VectorBT expert skill](https://github.com/marketcalls/vectorbt-backtesting-skills/blob/master/.claude/skills/vectorbt-expert/SKILL.md): `.claude/skills/vectorbt-expert/SKILL.md`
- [Market and method rules](https://github.com/marketcalls/vectorbt-backtesting-skills/tree/master/.claude/skills/vectorbt-expert/rules): `.claude/skills/vectorbt-expert/rules`

### Backtest Examples

- [Strategy templates](https://github.com/marketcalls/vectorbt-backtesting-skills/tree/master/.claude/skills/vectorbt-expert/rules/assets): `.claude/skills/vectorbt-expert/rules/assets`
- [EMA crossover example](https://github.com/marketcalls/vectorbt-backtesting-skills/blob/master/backtesting/SBIN_ema_crossover_backtest.py): `backtesting/SBIN_ema_crossover_backtest.py`
- [Buy-and-hold example](https://github.com/marketcalls/vectorbt-backtesting-skills/blob/master/backtesting/buy_hold_75_25_backtest.py): `backtesting/buy_hold_75_25_backtest.py`
- [Dual momentum example](https://github.com/marketcalls/vectorbt-backtesting-skills/blob/master/backtesting/dual_momentum_backtest.py): `backtesting/dual_momentum_backtest.py`
- [RSI accumulation example](https://github.com/marketcalls/vectorbt-backtesting-skills/blob/master/backtesting/niftybees_rsi_accumulation_backtest.py): `backtesting/niftybees_rsi_accumulation_backtest.py`

### Other components

- **AI coding agent**
- **OpenAlgo data API**
- **VectorBT simulation**
- **Metrics and benchmarks**
- **Plots and exports**

## Connections

- AI coding agent → Setup skill: invokes (evidence: `README.md`)
- AI coding agent → Backtest skill: invokes (evidence: `README.md`)
- AI coding agent → Optimize skill: invokes (evidence: `README.md`)
- AI coding agent → Quick stats skill: invokes (evidence: `README.md`)
- AI coding agent → Strategy compare skill: invokes (evidence: `README.md`)
- AI coding agent → VectorBT expert skill: consults (evidence: `README.md`)
- VectorBT expert skill → Market and method rules: provides guidance
- VectorBT expert skill → Strategy templates: provides templates
- AI coding agent → EMA crossover example: uses example (evidence: `README.md`)
- AI coding agent → Buy-and-hold example: uses example (evidence: `README.md`)
- AI coding agent → Dual momentum example: uses example (evidence: `README.md`)
- AI coding agent → RSI accumulation example: uses example (evidence: `README.md`)
- EMA crossover example → OpenAlgo data API: fetches data (evidence: `backtesting/SBIN_ema_crossover_backtest.py`)
- EMA crossover example → VectorBT simulation: simulates portfolio (evidence: `backtesting/SBIN_ema_crossover_backtest.py`)
- EMA crossover example → Metrics and benchmarks: computes metrics (evidence: `backtesting/SBIN_ema_crossover_backtest.py`)
- EMA crossover example → Plots and exports: plots and exports (evidence: `backtesting/SBIN_ema_crossover_backtest.py`)
- Buy-and-hold example → OpenAlgo data API: fetches data (evidence: `backtesting/buy_hold_75_25_backtest.py`)
- Buy-and-hold example → VectorBT simulation: simulates portfolio (evidence: `backtesting/buy_hold_75_25_backtest.py`)
- Buy-and-hold example → Metrics and benchmarks: compares benchmarks (evidence: `backtesting/buy_hold_75_25_backtest.py`)
- Buy-and-hold example → Plots and exports: plots and exports (evidence: `backtesting/buy_hold_75_25_backtest.py`)
- Dual momentum example → OpenAlgo data API: fetches data (evidence: `backtesting/dual_momentum_backtest.py`)
- Dual momentum example → VectorBT simulation: simulates portfolio (evidence: `backtesting/dual_momentum_backtest.py`)
- Dual momentum example → Metrics and benchmarks: compares benchmarks (evidence: `backtesting/dual_momentum_backtest.py`)
- Dual momentum example → Plots and exports: plots and exports (evidence: `backtesting/dual_momentum_backtest.py`)
- RSI accumulation example → OpenAlgo data API: fetches data (evidence: `backtesting/niftybees_rsi_accumulation_backtest.py`)
- RSI accumulation example → VectorBT simulation: simulates portfolio (evidence: `backtesting/niftybees_rsi_accumulation_backtest.py`)
- RSI accumulation example → Metrics and benchmarks: compares benchmarks (evidence: `backtesting/niftybees_rsi_accumulation_backtest.py`)
- RSI accumulation example → Plots and exports: plots and exports (evidence: `backtesting/niftybees_rsi_accumulation_backtest.py`)
