pair-trading

Automate pair trading using Z-score of price ratio between two correlated instruments.

2|Updated May 13, 2026
One-click install
npx skills add https://github.com/thanhtai040805/AI_Invest --skill pair-trading-thanhtai040805
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pair-trading
Source: https://github.com/thanhtai040805/AI_Invest/tree/main/ai-engine/app/domain/services/quant/skills_data/pair-trading
Command: npx skills add https://github.com/thanhtai040805/AI_Invest --skill pair-trading-thanhtai040805

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pandas, numpy, and includes scripts (resource) components.

What problem does it solve?

This Skill automates the Pair Trading strategy, enabling traders to execute mean reversion trades based on the spread/ratio Z-score of two correlated instruments.

Core Features & Use Cases

  • Automated Pair Trading: Execute trades based on the deviation of the price ratio between two correlated instruments.
  • Mean Reversion: Trade against extreme deviations from the mean price ratio, waiting for the ratio to revert to the mean.
  • Use Case: For traders looking to exploit mean reversion opportunities in correlated assets, such as stocks in the same industry or cryptocurrency pairs.

Quick Start

Execute the pair-trading skill with the configuration file 'config.json' and the instruments 'VIC' and 'VHM'.

Frequently Asked Questions about pair-trading

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

FAQPage Schema
How do I automate a pair trading strategy using Z-score mean reversion?

You automate pair trading by calculating the Z-score of the price ratio between two correlated instruments to identify extreme deviations. The strategy automatically executes trades expecting the price ratio to revert to its historical mean.

What is pair trading and how does Z-score help identify mean reversion opportunities?

Pair trading is a strategy that profits from the mean reversion of the price ratio between two correlated assets. The Z-score measures how far the current ratio deviates from its historical mean, signaling when to enter or exit trades.

Can I use pandas and numpy for statistical analysis in a pair trading strategy?

Yes, this pair trading strategy requires pandas and numpy for statistical analysis and data manipulation. These libraries handle the mathematical calculations needed to compute the price ratio Z-scores and process historical market data.

Does this pair trading approach work with correlated cryptocurrency pairs?

Yes, pair trading using Z-score mean reversion applies to correlated cryptocurrency pairs and stocks in the same industry. It targets any financial markets where traders aim to profit from mean reversion in price relationships.

How do I execute a pair trading script with specific instruments like VIC and VHM?

You execute the pair trading skill by providing a configuration file named config.json and specifying the target instruments, such as VIC and VHM. The script then processes the price data to generate trading signals based on Z-score deviations.

What are the limitations of using Z-score for pair trading mean reversion?

Z-score pair trading assumes the price ratio between two instruments will always revert to the mean. If the underlying correlation breaks down permanently, the statistical spread will diverge indefinitely, causing sustained losses on the reversion trade.