pair-trading

Compute price ratio Z-scores to generate long/short pair trading signals.

6.1k|1.2k|Updated Jun 9, 2022
One-click install
npx skills add https://github.com/charliedream1/ai_quant_trade --skill pair-trading-charliedream1
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: pair-trading
Source: https://github.com/charliedream1/ai_quant_trade/tree/main/a_%E5%85%A8%E7%BD%91%E4%BC%98%E7%A7%80%E8%B5%84%E6%BA%90/10_%E5%A4%A7%E6%A8%A1%E5%9E%8B/07_skill%E5%8C%85/vibe_trading_skills/pair-trading
Command: npx skills add https://github.com/charliedream1/ai_quant_trade --skill pair-trading-charliedream1

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Pair trading helps traders exploit mean-reversion in the price relationship between two correlated instruments by automatically generating long/short signals.

Core Features & Use Cases

  • Compute the price ratio of two instruments and its rolling Z-score to identify entry and exit points.
  • Generate paired signals that long one leg and short the other with a clear direction convention.
  • Use with equities, futures, or crypto pairs where the two assets exhibit strong historical correlation.

Quick Start

Give two correlated instruments and a data feed; the engine computes the ratio, Z-score, and trading signals to implement the pair-trading strategy.

Frequently Asked Questions about pair-trading

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate pair trading signals for two correlated assets?▼

To generate pair trading signals, you provide two correlated instrument codes and aligned OHLCV data. The engine computes the price ratio and rolling Z-score to output mean-reversion trading signals in the [-0.5, 0.5] range.

What is a Z-score in mean-reversion pair trading?▼

In mean-reversion pair trading, a Z-score measures how far the price ratio of two instruments deviates from its historical mean. Extreme Z-scores signal entry points to long one leg and short the other, expecting the spread to revert.

Can I use this pair trading engine for crypto and equities?▼

Yes, you can use this pair trading engine for crypto and equities. It requires exactly two instrument codes with aligned OHLCV data, applying the mean-reversion strategy across any asset class with strong historical correlation.

How do I calculate long and short signals using a price ratio?▼

You calculate long and short signals by computing the rolling Z-score of the price ratio between two instruments. The engine outputs per-instrument signals from -0.5 to 0.5, where 0 means flat, indicating when to enter paired positions.

What data do I need to run a mean-reversion strategy on two assets?▼

You need exactly two instrument codes and aligned OHLCV data to run this mean-reversion strategy. The engine also requires a rolling lookback window parameter to compute the price ratio and its Z-score for signal generation.