strategy-backtest

strategy-backtest is a skill for Claude Code, Codex from leionion/ClawForge. It costs 92 tokens per session (708 once invoked), scanned A, original, Apache-2.0.

A trading-strategy tester that uses past price and trading-volume data to simulate a simple moving-average crossover strategy.

In plain words
What is it for?
Use it to test CSV or JSON price data, compare different fast and slow moving-average periods, and review returns, risk, drawdowns, win rate, and the trade log.
Why use it?
It turns historical market data into consistent performance figures, so you can assess a strategy without calculating each trade by hand.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to test CSV or JSON price data, compare different fast and slow moving-average periods, and review returns, risk, drawdowns, win rate, and the trade log.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/leionion/clawforge/strategy_backtest
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add leionion/ClawForge --skill strategy_backtest
Clone the repo
git clone --depth 1 https://github.com/leionion/ClawForge

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for strategy-backtest

README.md
[![agentmods](https://agentmods.dev/badge/skills/leionion/clawforge/strategy_backtest/github.svg)](https://agentmods.dev/skills/leionion/clawforge/strategy_backtest)
Your own site
<a href="https://agentmods.dev/skills/leionion/clawforge/strategy_backtest"><img src="https://agentmods.dev/badge/skills/leionion/clawforge/strategy_backtest/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for strategy-backtest

Your own site · 80×15
<a href="https://agentmods.dev/skills/leionion/clawforge/strategy_backtest"><img src="https://agentmods.dev/badge/skills/leionion/clawforge/strategy_backtest.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 92 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 708 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00092 $0.00708
Opus 5.5 $0.00037 $0.00283
Sonnet 5.5 $0.00018 $0.00142
Haiku 4.5 $0.00009 $0.00071

Measured 3mo ago against content hash a0b51d994d81, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

strategy-backtest scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.

The scan reads SKILL.md. This mod also ships 1 executable file (strategy_backtest.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/04-Process/strategy_backtest/SKILL.md · 75 lines

How it starts

The opening of the file, as written. The whole thing — 75 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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

# 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

{
  "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

from strategy_backtest import run_backtest
metrics = run_backtest("prices.csv", strategy="sma_crossover", fast=5, slow=20)
  • hhxg-top-hhxg-python: fetch A-share OHLCV data → feed into this skill
  • session-memory: store backtest metrics for later comparison

Read the full file on GitHub · 75 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3mo ago First seen · 75 lines · 92 tokens per session scan A a0b51d994d81

Subscribe to this mod's changes

strategy-backtest is a skill published in the GitHub repository leionion/ClawForge (88 stars, last pushed 7mo ago), licensed Apache-2.0. It adds 92 tokens to every session and 708 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

strategy-backtest compared with skills from other repositories

strategy-backtest next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
strategy-backtestleionion/ClawForgeSkill887mo agoApache-2.0A92Claude Code, Codex
senpi-portfolioSenpi-ai/senpi-skillsSkill146todayMITA385Claude Code, Codex
senpi-strategy-opsSenpi-ai/senpi-skillsSkill146todayMITA708Claude Code, Codex
senpi-strategy-discoverSenpi-ai/senpi-skillsSkill146todayMITA235Claude Code, Codex
senpi-trader-researchSenpi-ai/senpi-skillsSkill146todayMITA256Claude Code, Codex
senpi-market-pulseSenpi-ai/senpi-skillsSkill146todayMITA139Claude Code, Codex
senpi-smart-moneySenpi-ai/senpi-skillsSkill146todayMITA157Claude Code, Codex