Individual skill
pair-trading
Pair trading strategy. Trades mean reversion using the spread/ratio Z-score of two correlated instruments. Requires at least two instruments.
agent/src/skills/pair-trading/SKILL.md
Source commit a79afbdb048f873433fdb651a667e43dd0bb735d
What was checked
- Matches the observed repository HEAD
- Yes
- Scanner rules are current
- Yes
- Repository scan complete
- No
- Skill scan complete
- No
- Observed behavior
- Network or broad shell
- Last checked
- Nov 9, 2026
These are observations at the recorded commit, not a guarantee of safety. Review the source before running it.
Install this skill
Choose an agent in your Stack or copy a command below. Commands fetch the pinned commit and copy only this skill directory. Existing destinations are refused. Copying a command does not install anything.
An install command is unavailable: current rules, complete repository and skill scans, an eligible behavior level and a permitted license are required.
Repository context
- Repository stars (not skill ratings)
- 37,985
- Repository last updated
- Nov 9, 2026
- License
- MIT
Observed agent integration: No specific integration evidence. Standard SKILL.md installation does not imply verified compatibility.
- backtesting Repository topic
- multi-agent Repository topic
- quantitative-finance Repository topic
- trading Repository topic
- ai-agent Repository topic
- algorithmic-trading Repository topic
- fintech Repository topic
- llm Repository topic
- mcp Repository topic
- python Repository topic
- engineering Derived category
Files and excerpt
File metadata and permitted, redacted excerpts come from the recorded scan. Source links are pinned to that commit.
Browse files
SKILL.mdcore · 2,607 bytesSKILL.mdcore · 2,607 bytesexample_signal_engine.pyruns · 4,851 bytes
Read excerpt
# Pair Trading Strategy
## Purpose
Select two highly correlated instruments (such as stocks from the same industry or BTC/ETH), monitor how far their price ratio (or spread) deviates from the mean, and trade against extreme deviations while waiting for mean reversion.
## Signal Logic
1. **Compute the price ratio**: `ratio = close_A / close_B`
2. **Rolling mean and standard deviation**: `mean = ratio.rolling(lookback).mean()`, `std = ratio.rolling(lookback).std()`
3. **Z-score**: `z = (ratio - mean) / std`
4. **Signal generation**:
- Z < -entry_z → long A, short B (ratio is too low, expected to revert)
- Z > +entry_z → short A, long B (ratio is too high, expected to revert)
- |Z| < exit_z → close the position (reverted back near the mean)