Skip to content

Pair Trading Strategy

Builds a mean-reversion pair trading signal from two correlated instruments using a price-ratio Z-score.

Stars
37,433
Licence
MIT
Files
2 files

What it does

This skill teaches an AI agent how to design and generate trading signals for a 'pair trade': it picks two closely related assets (such as two stocks in the same industry or BTC and ETH), tracks how far their price ratio drifts from its recent average, and produces buy/sell signals that bet on the ratio returning to normal. The agent can use it to draft or backtest a strategy, and it includes a short Python signal engine as a reference implementation. It is a trading-strategy recipe, not a guarantee of profit.

Great for

  • Quantitative traders or students exploring mean-reversion strategies
  • Developers building backtests in the Vibe-Trading framework who need a pair-trading example
  • Analysts who want a clear explanation of how Z-score based pair signals are computed

Skip it if

  • Anyone expecting a turnkey profitable trading bot: the logic is simple, uses fixed parameters and equal-weight sizing, and can lose money when correlations break down
  • Live trading with real capital without independent validation, since the skill contains no risk controls, slippage modelling or stop-losses

Try asking

  • “Create a pair trading signal for 601318.SH and 601628.SH with a 60-day lookback”
  • “Backtest a BTC-USDT / ETH-USDT pair trade for 2024 using a Z-score entry of 2.0”
  • “Explain how the entry and exit Z-score thresholds affect pair trading signals”
  • “Write a pandas function that aligns two price series and outputs long/short signals”
Step-by-step guide: how to use Pair Trading StrategyInstall, first run, examples, tips and FAQs

Install in 3 steps

  1. 1

    Download the skill

    The ZIP contains the 2 original files, the MIT licence and an attribution note.

    pair-trading.zip
  2. 2

    Add it to your agent

    Claude Code (all projects)

    mkdir -p ~/.claude/skills && unzip pair-trading.zip -d ~/.claude/skills/

    Claude Code / Agent SDK (this project only)

    mkdir -p .claude/skills && unzip pair-trading.zip -d .claude/skills/

    Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.

  3. 3

    Ask for the task

    No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.

Get better results

  • Pick two instruments that are genuinely correlated and check that the relationship has held over time before trusting the signal
  • Always backtest with realistic commission and slippage, and validate out-of-sample before risking capital
  • Note that the skill's Python engine is a reference example that the agent may run, so review the code before executing it in your environment

What's inside

  • example_signal_engine.py
  • SKILL.md

Redistributed unmodified from HKUDS/Vibe-Trading under the MIT licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.