pair-trading

Generate long/short signals from Z-score thresholds of two correlated asset price ratios.

Updated Apr 19, 2026
One-click install
npx skills add https://github.com/ajithkumar31082004-bit/Vibe-Trading --skill pair-trading-ajithkumar31082004-bit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pair-trading
Source: https://github.com/ajithkumar31082004-bit/Vibe-Trading/tree/main/Vibe-Trading-main/agent/src/skills/pair-trading
Command: npx skills add https://github.com/ajithkumar31082004-bit/Vibe-Trading --skill pair-trading-ajithkumar31082004-bit

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Pair trading automates the process of exploiting mean-reversion opportunities between two correlated assets by deriving robust signals from their price ratio Z-score.

Core Features & Use Cases

  • Two-instrument hedging: Identify two related assets and apply a balanced long/short approach.
  • Signal generation via Z-score: Compute the ratio, rolling mean, and rolling std to derive entry and exit signals.
  • Use Case: Pair two related stocks or crypto assets and implement a neutral hedge with equal capital allocation to each leg.

Quick Start

Load two correlated instruments and run the engine to generate long/short signals based on the Z-score of their price ratio.

Frequently Asked Questions about pair-trading

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

FAQPage Schema
How do I generate mean-reversion signals for a pair of correlated assets?

Mean-reversion signals are generated by computing the Z-score of the price ratio between two correlated assets, triggering long or short positions when entry and exit thresholds are met. The engine requires aligned timestamps and a lookback window to calculate rolling mean and standard deviation.

What is pair trading and how does a Z-score approach work for two instruments?

Pair trading is a strategy that exploits mean-reversion opportunities between two correlated assets. The Z-score approach calculates the standard deviations of their price ratio from the rolling mean, generating long or short signals to execute a balanced hedge with equal capital allocation.

Can I use this pair trading engine for any two assets like stocks or crypto?

Yes, the engine applies to any two instruments with aligned price histories, including related stocks or crypto assets. It requires exactly two instruments to generate long and short signals for a neutral hedge with equal-weight allocation to each leg.

What data do I need to run a two-asset hedging strategy with Z-score thresholds?

You need exactly two instruments with aligned timestamps, a lookback window, and entry or exit Z-score parameters. If the data is insufficient to calculate the rolling statistics, the engine defaults to flat signals to prevent trading.

Why does my pair trading strategy output flat signals instead of long or short?

Flat signals occur when data is insufficient to calculate the rolling mean and standard deviation for the price ratio Z-score. This happens if the aligned timestamp history is shorter than the required lookback window or if entry and exit parameters are not properly defined.

What is the best way to set up a neutral hedge with equal capital allocation?

To set up a neutral hedge, load two correlated instruments and run the engine to generate signals based on the Z-score of their price ratio. The system applies equal-weight allocation to each leg, maintaining a balanced long and short approach.