pair-trading

Installation
SKILL.md

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)

Implementation Notes

Installs
2
GitHub Stars
31.1K
First Seen
Jul 14, 2026
pair-trading — hkuds/vibe-trading