Agent skill

Backtesting Trading Strategies

by jeremylongshore in jeremylongshore/tons-of-skills-marketplace

Backtest crypto and traditional trading strategies against historical data.

MITAuto-check passedBusiness, Finance & HR

Install Backtesting Trading Strategies

skills CLI
$ npx skills add jeremylongshore/tons-of-skills-marketplace --skill backtesting-trading-strategies -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jeremylongshore/tons-of-skills-marketplace backtesting-trading-strategies --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/.curated/backtesting-trading-strategies .claude/skills/backtesting-trading-strategies && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
backtesting-trading-strategies
GitHub stars
2.8k
Used in
1 other repo
Token cost
~1.6k tokens
SKILL.md length
335 words
Files
15 (incl. scripts, references)
Skills in repo
3,342
Repo updated
First seen
Licence
MIT

At a glance

Backtest crypto and traditional trading strategies against historical data.

  • Works in 4 steps: Fetch historical data (cached to… → Run a backtest with default or custom… → Analyze results saved to… → …
  • User wants to test a trading strategy
  • SKILL.md covers Overview, Prerequisites, Instructions and Output, plus 6 more sections
  • Runs Python scripts from its folder; calls python and pip

What it does

Backtesting Trading Strategies is an agent skill from jeremylongshore/tons-of-skills-marketplace. Backtest crypto and traditional trading strategies against historical data. Calculates performance metrics (Sharpe, Sortino, max drawdown), generates equity curves, and optimizes strategy parameters. Use when user wants to test a trading strategy, validate signals, or compare approaches. Trigger with phrases like "backtest strategy", "test trading strategy", "historical performance", "simulate trades", "optimize parameters", or "validate signals".

Its SKILL.md is about 1.6k tokens, which your agent loads only when the skill is triggered. The skill folder holds 19 other files, including scripts and reference files (for example `commands/backtest-strategy.md`, `commands/compare-strategies.md` and `commands/optimize-parameters.md`). Compatibility notes: Designed for Claude Code

It sits in Business, Finance & HR, covering Trading and backtesting. The repository describes itself as: Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com. The licence is MIT.

When your agent uses it

  • User wants to test a trading strategy
  • Validate signals
  • Compare approaches
  • With phrases like backtest strategy

Example prompts

  • “backtest strategy”
  • “test trading strategy”
  • “historical performance”
  • “/backtesting-trading-strategies”

Requirements

  • Python 3
  • Compatibility (from SKILL.md): Designed for Claude Code
  • Pre-approved tools (allowed-tools): Read, Write, Edit, Grep, Glob, Bash(python:*)

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. Fetch historical data (cached to ${CLAUDE_SKILL_DIR}/data/ for reuse)
  2. Run a backtest with default or custom parameters
  3. Analyze results saved to ${CLAUDE_SKILL_DIR}/reports/ -- includes *_summary.txt (performance metrics), *_trades.csv (trade log)…
  4. Optimize parameters via grid search to find the best combination

What it can do on your machine

Read from SKILL.md and the folder at commit cfae287. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit
    • Grep
    • Glob
    • Bash(python:*)

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 5 files in scripts/ (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • python
    • pip

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • github.com
    • ta-lib.org

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Designed for Claude Code

    From compatibility in the SKILL.md frontmatter.

Context cost

Backtesting Trading Strategies loads about 1.6k tokens when it runs, and up to ~5.1k if it reads all its reference files. Until then it costs about 121 tokens; SKILL.md has 335 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~121
When it runs · the whole SKILL.md, loaded when a task matches
~1.6k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~5.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from jeremylongshore/tons-of-skills-marketplace at commit cfae287, republished under its MIT licence (© jeremylongshore). 335 words, ~1,617 tokens.

Download SKILL.mdSave it as .claude/skills/backtesting-trading-strategies/SKILL.md (or your agent's skills folder). This skill also uses 14 other files; get the full folder from GitHub.
name
backtesting-trading-strategies
description
Backtest crypto and traditional trading strategies against historical data. Calculates performance metrics (Sharpe, Sortino, max drawdown), generates equity curves, and optimizes strategy parameters. Use when user wants to test a trading strategy, validate signals, or compare approaches. Trigger with phrases like "backtest strategy", "test trading strategy", "historical performance", "simulate trades", "optimize parameters", or "validate signals".
allowed-tools
Read, Write, Edit, Grep, Glob, Bash(python:*)
compatibility
Designed for Claude Code
version
1.28.0
author
Jeremy Longshore <jeremy@intentsolutions.io>
license
MIT
tags
crypto, testing, performance

Backtesting Trading Strategies

Overview

Validate trading strategies against historical data before risking real capital. This skill provides a complete backtesting framework with 8 built-in strategies, comprehensive performance metrics, and parameter optimization.

Key Features:

  • 8 pre-built trading strategies (SMA, EMA, RSI, MACD, Bollinger, Breakout, Mean Reversion, Momentum)
  • Full performance metrics (Sharpe, Sortino, Calmar, VaR, max drawdown)
  • Parameter grid search optimization
  • Equity curve visualization
  • Trade-by-trade analysis

Prerequisites

Install required dependencies:

bash
set -euo pipefail
pip install pandas numpy yfinance matplotlib

Optional for advanced features:

bash
set -euo pipefail
pip install ta-lib scipy scikit-learn

Instructions

  1. Fetch historical data (cached to ${CLAUDE_SKILL_DIR}/data/ for reuse):

    bash
    python ${CLAUDE_SKILL_DIR}/scripts/fetch_data.py --symbol BTC-USD --period 2y --interval 1d
  2. Run a backtest with default or custom parameters:

    bash
    python ${CLAUDE_SKILL_DIR}/scripts/backtest.py --strategy sma_crossover --symbol BTC-USD --period 1y
    python ${CLAUDE_SKILL_DIR}/scripts/backtest.py \
      --strategy rsi_reversal \
      --symbol ETH-USD \
      --period 1y \
      --capital 10000 \  # 10000: 10 seconds in ms
      --params '{"period": 14, "overbought": 70, "oversold": 30}'
  3. Analyze results saved to ${CLAUDE_SKILL_DIR}/reports/ -- includes *_summary.txt (performance metrics), *_trades.csv (trade log), *_equity.csv (equity curve data), and *_chart.png (visual equity curve).

  4. Optimize parameters via grid search to find the best combination:

    bash
    python ${CLAUDE_SKILL_DIR}/scripts/optimize.py \
      --strategy sma_crossover \
      --symbol BTC-USD \
      --period 1y \
      --param-grid '{"fast_period": [10, 20, 30], "slow_period": [50, 100, 200]}'  # HTTP 200 OK

Output

Performance Metrics
MetricDescription
Total ReturnOverall percentage gain/loss
CAGRCompound annual growth rate
Sharpe RatioRisk-adjusted return (target: >1.5)
Sortino RatioDownside risk-adjusted return
Calmar RatioReturn divided by max drawdown
Risk Metrics
MetricDescription
Max DrawdownLargest peak-to-trough decline
VaR (95%)Value at Risk at 95% confidence
CVaR (95%)Expected loss beyond VaR
VolatilityAnnualized standard deviation
Show full SKILL.md (151 more words)Show less
Trade Statistics
MetricDescription
Total TradesNumber of round-trip trades
Win RatePercentage of profitable trades
Profit FactorGross profit divided by gross loss
ExpectancyExpected value per trade
Example Output
================================================================================
                    BACKTEST RESULTS: SMA CROSSOVER
                    BTC-USD | [start_date] to [end_date]
================================================================================
 PERFORMANCE                          | RISK
 Total Return:        +47.32%         | Max Drawdown:      -18.45%
 CAGR:                +47.32%         | VaR (95%):         -2.34%
 Sharpe Ratio:        1.87            | Volatility:        42.1%
 Sortino Ratio:       2.41            | Ulcer Index:       8.2
--------------------------------------------------------------------------------
 TRADE STATISTICS
 Total Trades:        24              | Profit Factor:     2.34
 Win Rate:            58.3%           | Expectancy:        $197.17
 Avg Win:             $892.45         | Max Consec. Losses: 3
================================================================================

Supported Strategies

StrategyDescriptionKey Parameters
sma_crossoverSimple moving average crossoverfast_period, slow_period
ema_crossoverExponential MA crossoverfast_period, slow_period
rsi_reversalRSI overbought/oversoldperiod, overbought, oversold
macdMACD signal line crossoverfast, slow, signal
bollinger_bandsMean reversion on bandsperiod, std_dev
breakoutPrice breakout from rangelookback, threshold
mean_reversionReturn to moving averageperiod, z_threshold
momentumRate of change momentumperiod, threshold

Configuration

Create ${CLAUDE_SKILL_DIR}/config/settings.yaml:

yaml
data:
  provider: yfinance
  cache_dir: ./data

backtest:
  default_capital: 10000  # 10000: 10 seconds in ms
  commission: 0.001     # 0.1% per trade
  slippage: 0.0005      # 0.05% slippage

risk:
  max_position_size: 0.95
  stop_loss: null       # Optional fixed stop loss
  take_profit: null     # Optional fixed take profit

Error Handling

See ${CLAUDE_SKILL_DIR}/references/errors.md for common issues and solutions.

Examples

See ${CLAUDE_SKILL_DIR}/references/examples.md for detailed usage examples including:

  • Multi-asset comparison
  • Walk-forward analysis
  • Parameter optimization workflows

Files

FilePurpose
scripts/backtest.pyMain backtesting engine
scripts/fetch_data.pyHistorical data fetcher
scripts/strategies.pyStrategy definitions
scripts/metrics.pyPerformance calculations
scripts/optimize.pyParameter optimization

Resources

© jeremylongshore, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 14 other files (scripts, references) in skills/.curated/backtesting-trading-strategies of jeremylongshore/tons-of-skills-marketplace.

  • SKILL.md
  • commands/backtest-strategy.md
  • commands/compare-strategies.md
  • commands/optimize-parameters.md
  • commands/walk-forward.md
  • config/settings.yaml
  • references/errors.md
  • references/examples.md
  • references/implementation.md
  • scripts/backtest.py
  • scripts/fetch_data.py
  • scripts/metrics.py
  • scripts/optimize.py
  • scripts/strategies.py
  • tests/test_strategies.py

Open the folder on GitHubat commit cfae287

Used in 1 other repository

We found 3 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in jeremylongshore/tons-of-skills-marketplace, which our catalogue first saw on October 8, 2026.

Compare with similar skills

Backtesting Trading Strategies next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Backtesting Trading Strategies compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Backtesting Trading Strategies this skilljeremylongshore/tons-of-skills-marketplace2.8k1 repos~1.6kAutomated safety check: PassMIT
Tushare Datazillionare/zillionare3222 repos~2.3kAutomated safety check: PassNone
Tradingview MCPatilaahmettaner/tradingview-mcp5k—~1.3kAutomated safety check: PassMIT
Digital Oraclekomako-workshop/digital-oracle878—~5.9kAutomated safety check: PassMIT
Polyclawchainstacklabs/polyclaw3591 repos~2kAutomated safety check: PassApache-2.0
Markdownfacioquo/stock-indicators-dotnet1.2k—~812Automated safety check: PassApache-2.0

Similar skills

  • Tushare Data

    zillionare/zillionare

    面向中文自然语言的 Tushare 数据研究技能。用于把“看看这只股票最近怎么样”“帮我查财报趋势”“最近哪个板块最强”“北向资金在买什么”“给我导出一份行情数据”这类请求,转成可执行的数据获取、清洗、对比、筛选、导出与简要分析流程。适用于 A 股、指数、ETF/基金、财务、估值、资金流、公告新闻、板块概念与宏观数据等研究场景。

    322 GitHub starsUsed in 2 repos~2.3k tokens
    Business, Finance & HRAuto-check passed
  • Tradingview MCP

    atilaahmettaner/tradingview-mcp

    AI Trading Intelligence — live prices, 30+ technical indicators, backtesting (6 strategies), walk-forward overfitting detection, trade logs, equity curves, licensed news sentiment (Marketaux), and…

    5k GitHub stars~1.3k tokensUpdated yesterday
    Business, Finance & HRAuto-check passed
  • Digital Oracle

    komako-workshop/digital-oracle

    Answer prediction questions using market trading data, not opinions.

    878 GitHub stars~5.9k tokensUpdated 2 mo ago
    Business, Finance & HRAuto-check passed
  • Polyclaw

    chainstacklabs/polyclaw

    Trade on Polymarket via split + CLOB execution. An agent skill from chainstacklabs/polyclaw.

    359 GitHub starsUsed in 1 repo~2k tokens
    Business, Finance & HRAuto-check passed
  • Markdown

    facioquo/stock-indicators-dotnet

    Format and lint Markdown in this repository against GitHub Flavored Markdown and its markdownlint-cli2 configuration — headers, lists, code fences, callouts (VitePress containers on docs-site pages…

    1.2k GitHub stars~812 tokensUpdated yesterday
    Business, Finance & HRAuto-check passed
  • Openmobius Skill

    MobiusQuant/OpenMobius-skill

    Provides multi-school trading Q&A, chart/OHLCV analysis, annotation, and fresh-market workflows covering ICT/SMC, ChanLun, Wyckoff, Price Action, Order Flow, VSA, and Elliott Wave.

    697 GitHub stars~7.2k tokensUpdated 1 mo ago
    Business, Finance & HRAuto-check passed

More from jeremylongshore/tons-of-skills-marketplace

All 3,342 skills in this repo
  • Performing Security Code Review

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to conduct a security-focused code review using the security-agent plugin.

    2.8k GitHub starsUsed in 2 repos~1.3k tokens
    Auto-check: notes
  • Adapting Transfer Learning Models

    jeremylongshore/tons-of-skills-marketplace

    Build this skill automates the adaptation of pre-trained machine learning models using transfer learning techniques.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Agent Context Loader

    jeremylongshore/tons-of-skills-marketplace

    Execute proactive auto-loading: automatically detects and loads agents.md files.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Aggregating Performance Metrics

    jeremylongshore/tons-of-skills-marketplace

    Aggregate and centralize performance metrics from applications, systems, databases, caches, and services.

    2.8k GitHub stars~1.2k tokensUpdated today
    Auto-check passed
  • Analyzing Capacity Planning

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to analyze capacity requirements and plan for future growth.

    2.8k GitHub stars~947 tokensUpdated today
    Auto-check passed
  • Analyzing Database Indexes

    jeremylongshore/tons-of-skills-marketplace

    Process use when you need to work with database indexing. An agent skill from jeremylongshore/tons-of-skills-marketplace.

    2.8k GitHub stars~2k tokensUpdated today
    Auto-check passed

Questions about Backtesting Trading Strategies

What does Backtesting Trading Strategies do?

Backtest crypto and traditional trading strategies against historical data. Backtesting Trading Strategies is an agent skill from jeremylongshore/tons-of-skills-marketplace. Backtest crypto and traditional trading strategies against historical data.

When should I use Backtesting Trading Strategies?

Backtesting Trading Strategies fits situations like: user wants to test a trading strategy; validate signals; compare approaches; with phrases like backtest strategy.

How do I install Backtesting Trading Strategies in Claude Code?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill backtesting-trading-strategies -a claude-code`. Or copy the skill folder (skills/.curated/backtesting-trading-strategies in jeremylongshore/tons-of-skills-marketplace) into .claude/skills/backtesting-trading-strategies in your project. Claude Code loads it when a task matches its description.

How do I install Backtesting Trading Strategies in Codex?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill backtesting-trading-strategies -a codex`. Or copy the skill folder (skills/.curated/backtesting-trading-strategies in jeremylongshore/tons-of-skills-marketplace) into .agents/skills/backtesting-trading-strategies in your project. Codex loads it when a task matches its description.

Can I use Backtesting Trading Strategies in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill backtesting-trading-strategies -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/backtesting-trading-strategies, .gemini/skills/backtesting-trading-strategies, .github/skills/backtesting-trading-strategies and .opencode/skills/backtesting-trading-strategies in your project.

What does Backtesting Trading Strategies need to run?

Going by SKILL.md and its folder, Backtesting Trading Strategies needs Python for the scripts in its folder and the command-line tools its instructions call (python and pip). Our summary lists: Python 3. Its frontmatter pre-approves these tools: Read, Write, Edit, Grep, Glob, Bash(python:*). Compatibility (from SKILL.md): Designed for Claude Code.

Does Backtesting Trading Strategies access the network?

SKILL.md names 2 domains. As links in the text: github.com and ta-lib.org. This is read from the text; nothing was executed.

Is Backtesting Trading Strategies safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Backtesting Trading Strategies use?

Backtesting Trading Strategies is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Backtesting Trading Strategies use?

About 1.6k tokens (SKILL.md is roughly 6.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.5k tokens, read only when the agent opens those files.

What are the alternatives to Backtesting Trading Strategies?

Skills that share tags, products or a category with Backtesting Trading Strategies: Tushare Data (zillionare/zillionare, 322 stars), Tradingview MCP (atilaahmettaner/tradingview-mcp, 5k stars), Digital Oracle (komako-workshop/digital-oracle, 878 stars) and Polyclaw (chainstacklabs/polyclaw, 359 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Backtesting Trading Strategies?

jeremylongshore (a GitHub user) maintains it in jeremylongshore/tons-of-skills-marketplace, which has 2,827 GitHub stars. The repository holds 3,342 skills in this directory. The repository was last updated on October 10, 2026.

Source: jeremylongshore/tons-of-skills-marketplace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.