strategy-backtest
Runs SMA crossover backtests on historical OHLCV/candlestick data, calculating total return, Sharpe ratio, max drawdown, win rate, and trade log.
Skill by leionion
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/leionion-strategy-backtest
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: spreadsheets, data, finance
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
- Runs as
- Python package
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/strategy-backtest
What's inside
- Skill name
strategy-backtest- Description
- Runs SMA crossover backtests on historical OHLCV/candlestick data, calculating total return, Sharpe ratio, max drawdown, win rate, and trade log. Supports CSV files and JSON input with automatic AKShare/hhxg column normalization. Use when the user asks to backtest a trading strategy, evaluate strategy performance on historical price data, run quantitative analysis, or mentions OHLCV, candlestick data, or equity curves.
- License
- Apache-2.0
- Instructions
- 71 lines in SKILL.md · view on GitHub
Before installing
- Ships executable scripts
Agent Skills spec issues
- name: "strategy-backtest" does not match folder "strategy_backtest"
Files (4)
- SKILL.md
- _meta.json
- sample_ohlcv.csv
- strategy_backtest.py
SKILL.md (first lines)
# strategy-backtest — Quantitative Strategy Backtesting
Runs strategy backtests on historical OHLCV data and returns performance metrics as JSON. Supports SMA crossover strategy with configurable fast/slow periods.
## Usage
```bash
# Demo mode — uses built-in sample_ohlcv.csv
python3 strategy_backtest.py
# Backtest with custom CSV data
python3 strategy_backtest.py --data path/to/ohlcv.csv
# Backtest with JSON string input
python3 strategy_backtest.py --data '[{"open":10,"high":11,"low":9,"close":10.5,"volume":100}]'
# Custom SMA periods
python3 strategy_backtest.py --data prices.csv --fast 10 --slow 30
# Human-readable output
python3 strategy_backtest.py --data prices.csv --output print
```
## Parameters
| Flag | Default | Description |
|------|---------|-------------|
| `--data` | `sample_ohlcv.csv` | CSV path or JSON string (OHLCV) |
| `--strategy` | `sma_crossover` | Strategy type |
| `--fast` | `5` | Fast SMA period |
| `--slow` | `20` | Slow SMA period |
| `--output` | `json` | Output format (`json` or `print`) |
Supports column names in English (`open/high/low/close/volume`) or Chinese AKShare format (`开盘/收盘/最高/最低/成交量/日期`).
## Example output
```json
{
"total_return": 0.0523,
"sharpe_ratio": 1.2345,
"max_drawdown": -0.0812,
"win_rate": 0.6,
"trade_count": 10,
"trades": [
{"date": "2024-01-15", "action": "buy", "price": 150.25},
{"date": "2024-02-01", "action": "sell", "price": 158.50, "pnl": 0.0549}
]
}
```
## Error handling
- **Missing pandas**: prints `{"error": "pandas required: pip install pandas"}`
- **Missing columns**: reports which OHLCV columns are absent
- **Insufficient data**: returns error if fewer rows than the slow SMA window
- **Unknown strategy**: reports the unrecognized strategy name
## Programmatic API
```python
from strategy_backtest import run_backtest
metrics = run_backtest("prices.csv", strategy="sma_crossover", fast=5, slow=20)
```
## Related skills
- **hhxg-top-hhxg-python**: fetch A-share OHLCV data → feed into this skill
- **session-memory**: store backtest metrics for later comparisonFrom leionion/ClawForge, Apache-2.0.
More from leionion/ClawForge
- 0.513score
mac-brightness
leionion
Adjusts Mac screen brightness by setting a specific level (0–1), increasing, or decreasing display brightness via the brightness CLI tool.
SkillDFreshness: D★ 89Claude Code +9 - 0.513score
mac-volume
leionion
Gets or sets the macOS system output volume (0–100) using osascript.
SkillDFreshness: D★ 89Claude Code +9 - 0.513score
mac-dark-mode
leionion
Toggles macOS dark mode on, off, or auto-toggle by reading and writing the AppleInterfaceStyle user default.
SkillDFreshness: D★ 89Claude Code +9 - 0.513score
mac-mail
leionion
Opens the macOS Mail application (Mail.app) using the open command.
SkillDFreshness: D★ 89Claude Code +9 - 0.513score
mac-terminal
leionion
Opens macOS Terminal.app and executes a shell command in a new or existing window, with optional automatic sudo password entry via System Events.
SkillDFreshness: D★ 89Claude Code +9 - 0.513score
mac-activate
leionion
Brings a specified macOS application to the foreground using osascript, making its window visible and focused.
SkillDFreshness: D★ 89Claude Code +9 - 0.513score
mac-clipboard
leionion
Reads the current Mac clipboard (pasteboard) contents to stdout or writes new text to the clipboard using pbcopy/pbpaste.
SkillDFreshness: D★ 89Claude Code +9 - 0.510score
metaskillbase
leionion
Decompose human demands into atomic meta skills using OpenClaw Skill Forge Cutter.
SkillDFreshness: D★ 89Claude Code +9 - 0.509score
memory-backup
leionion
Creates scheduled tar.gz backups of agent memory or chat history, lists existing backup snapshots, and restores from a previous backup point with automatic…
SkillDFreshness: D★ 89Claude Code +9 - 0.509score
mac-finder
leionion
Opens macOS Finder at a specified directory path, with tilde expansion and common-directory shortcuts.
SkillDFreshness: D★ 89Claude Code +9
Signals
- Stars
- 89
- Forks
- 21
- Open issues
- 0
- Last commit (this folder)
- Apr 15, 2026 (6 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- Apache-2.0
- Repository
- github.com/leionion/ClawForge
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from leionion
- 0.513score
mac-brightness
leionion
Adjusts Mac screen brightness by setting a specific level (0–1), increasing, or decreasing display brightness via the brightness CLI tool.
SkillDFreshness: D★ 89Claude Code +9 - 0.513score
mac-volume
leionion
Gets or sets the macOS system output volume (0–100) using osascript.
SkillDFreshness: D★ 89Claude Code +9 - 0.513score
mac-dark-mode
leionion
Toggles macOS dark mode on, off, or auto-toggle by reading and writing the AppleInterfaceStyle user default.
SkillDFreshness: D★ 89Claude Code +9 - 0.513score
mac-mail
leionion
Opens the macOS Mail application (Mail.app) using the open command.
SkillDFreshness: D★ 89Claude Code +9 - 0.513score
mac-terminal
leionion
Opens macOS Terminal.app and executes a shell command in a new or existing window, with optional automatic sudo password entry via System Events.
SkillDFreshness: D★ 89Claude Code +9 - 0.513score
mac-activate
leionion
Brings a specified macOS application to the foreground using osascript, making its window visible and focused.
SkillDFreshness: D★ 89Claude Code +9
Cite this page
strategy-backtest skill. Agent Mart. https://agentmart.dev/skills/leionion-strategy-backtest (last updated 2026-10-24)