# Pairs Trading Strategy Engine AI Agent Connect

> A deterministic statistical arbitrage engine for identifying mean-reverting asset pairs.

## Overview
- **Category:** finance
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_fR7Wf0hWapXR13V1VXTEZOFEzjbZp3DEKpJbfA80/ai-agent-connect
- **Tags:** arbitrage, pairs-trading, statistical-arbitrage, quantitative, finance

## Description

This MCP server provides a deterministic statistical arbitrage engine designed to identify and trade mean-reverting relationships between two assets. By calculating the log-spread and monitoring the z-score, the engine identifies when a pair has deviated from its equilibrium. Use `analyze_pair_relationship` to validate cointegration and half-life, `generate_trading_signals` to simulate historical entries and exits, or `calculate_spread_metrics` for real-time volatility snapshots. It is built for high-precision quantitative trading workflows.

## Tools

### analyze_pair_relationship
Validate if two assets are suitable for pairs trading based on statistical stability

### calculate_spread_metrics
Provide a snapshot of the current state of the spread and its recent volatility

### generate_trading_signals
Simulate the trading strategy over historical data to identify entry and exit points

## Prompt Examples

**Prompt:** 
```
Check if these two assets are cointegrated: Asset A [10, 11, 10, 12] and Asset B [20, 22, 20, 24].
```

**Response:** 
```
The relationship is valid with a p-value of 0.03 and a half-life of 12 days, making it suitable for trading.
```

**Prompt:** 
```
Generate trading signals for these price series with a 60-day lookback.
```

**Response:** 
```
The strategy identified a Short Spread entry at timestamp 2023-01-15 with an entry price of 105.2 for Asset A.
```

**Prompt:** 
```
What is the current z-score for the spread between Asset A and Asset B?
```

**Response:** 
```
The current z-score is 2.15, indicating a significant deviation from the mean.
```

## Frequently Asked Questions

**How do I know if a pair is suitable for trading?**
You can use the `analyze_pair_relationship` tool. It checks for cointegration via the ADF test and ensures the spread half-life is under 30 days.

**What triggers a trading signal?**
Signals are triggered by z-score thresholds. A Short Spread occurs when the z-score exceeds 2.0, and a Long Spread occurs when it falls below -2.0.

**How are stop-losses handled?**
A stop-loss is automatically triggered if the z-score reaches 3.0 or if the total position value drops by 5%.
