Novice Navigator
Building a Specialised Agent for Pair Trading

Sep 1, 2025
/
(That does your risk assessment and empowers you with tooling to become more profitable)
1. Why Pair Trading?
Most traders in crypto focus on a single question: “Will this token go up or down?”
Pair trading flips the script. Instead of betting on absolute price, you trade relationships.
There are multiple approaches to pair trading:
Fundamental – e.g. long HYPE / short DYDX
Technical – e.g. based on charts like ETH/BTC
Narrative & Mindshare – e.g. long PUMP / short SOL
A fourth, well-established technique is to take a statistical approach. Here, traders examine variables between two assets such as:
their correlation,
the current price difference (spread), and
how today’s spread compares to its historical average (mean).
The “arbitrage” arises because spreads between related assets tend to mean-revert when they deviate too far. For example, if BTC keeps falling whilst SOL keeps rising, the BTC/SOL spread collapses. A trader applying statistical arbitrage might go long BTC and short SOL, anticipating that the spread will snap back toward its mean.

This method - known as Statistical Arbitrage, is a cornerstone of traditional finance. And because crypto markets are still relatively inefficient, the opportunities to profit from it can be even greater.
To see how this works in practice, it helps to break down the building blocks of statistical arbitrage.
2. Statistical Arbitrage 101
Statistical arbitrage, or stat-arb, is about turning the relationship between two assets into a tradeable signal.
Key Concepts
Correlation – measures how closely two assets move together. A high correlation suggests a relationship worth monitoring.
Beta (β) – shows how much one asset typically moves compared to the other. If SOL tends to move 1.3% when BTC moves 1%, then the hedge ratio is 1.3.
Spread – the difference between BTC and SOL after adjusting for beta. This is the trader’s signal:
𝑆𝑝𝑟𝑒𝑎𝑑ₜ = 𝑃ᴮᵀᶜ,ₜ − β · 𝑃ˢᴼᴸ,ₜ
Z-score – a way to measure how far today’s spread is from its historical average (mean, denoted as μ). Generally speaking you want to long the pair when Z-Score is <-2 and vice versa.
𝑧ₜ = (𝑆𝑝𝑟𝑒𝑎𝑑ₜ − μ) / σ
Example: BTC vs SOL
Suppose BTC and SOL usually move in sync. If BTC falls sharply while SOL rallies, the BTC/SOL spread shrinks. If the spread is now two standard deviations (σ) below its mean (Z-score <-2), a stat-arb trader might:
Go long BTC and short SOL (beta-weighted),
Hold the position until the spread normalises,
Exit with profit once mean reversion plays out.
This approach reframes trading: the bet is not on whether BTC will rise or SOL will fall, but on the spread between them returning to equilibrium. Here is the same diagram, with the Z-Score being <-2σ clearly labelled as an entry signal.

The challenge is not understanding these concepts, but finding opportunities across dozens of assets in real time.
3. Finding Opportunities
So far we have looked at statistical arbitrage in theory. In practice, traders needed tools to surface opportunities, and one of the main options was Crypto Wizards.

Crypto Wizards provided dashboards full of ratios, correlations, and spread charts. On paper this looked powerful, but many traders found it confusing to navigate. The issue was not the math but the usability. Traders did not want another complex dashboard. They wanted simple, tradeable insights: "Here is a pair diverging. Here is when to take the trade."
This is where Agent Pear comes in.
We have rebuilt the full statistical library on our own backend, covering correlation, beta, spreads, and z-scores. The system now updates in real time. Instead of static charts, traders are alerted the moment mean reversion opportunities arise, for example when the z-score compresses.
The result is actionable, trade-ready signals rather than raw analytics. Agent Pear closes the gap between statistical arbitrage theory and real-world execution in fast-moving crypto markets.
This shift from analytics to execution is what Agent Pear is designed to solve.
4. Our approach to rebuilding Crypto Wizards
When we looked at the original CryptoWizards platform, we saw a lot to admire. It gave traders statistical-arbitrage tools, educational material, and curated backtests - all focused on a limited set of crypto pairs. That was a strong foundation, but we wanted to take things further and build our own library.
Our goal with Agent Pear was to recreate that core experience of pair discovery, statistical insights, and monitoring, and then extend it in three ways:
Execution built-in – not just analysis, but the ability to act directly on signals.
Full-universe coverage – not limited to a subset, but spanning all tradable pairs across supported platforms.
AI-driven context – instead of leaving you to decipher charts, we add narrative explanations that make the opportunities clear.
Database & Time-Series Foundation
A reliable stat-arb agent is only as good as its data. We rebuilt the database from scratch utilising both hourly and daily time series data from the relevant exchanges where our execution/hedging takes place (e.g. Hourly time series data comes directly from HyperCore itself).
Hourly OHLC data: Fine-grained enough to spot intraday divergences, volatility bursts, and short-term reversions.
Daily OHLC data: Smooths out noise, perfect for identifying structural shifts, long-term correlations, and regime changes.
Each record is indexed with a composite key (time, asset1_id, asset2_id) for efficient retrieval and backtests.
Pair Statistics
For every tracked pair, we calculate and store a full set of metrics at both the 1h and 1d level:
Correlation — how closely two assets move together
β (hedge ratio) — the relative move of one asset versus the other
Spread snapshot — the difference between the beta-adjusted prices
Z-score — how far today’s spread is from its long-term mean
Cointegration check - confirms a long-term, mean-reverting relationship exists between the two asset prices.
Half-life — how quickly the spread tends to revert
Sharpe ratio (daily) - to filter for robust strategies
This gives traders a quantifiable, real-time picture of relationships across the market, across 2 different timeframes.
Importantly, we didn’t just port off-the-shelf quant libraries. Crypto markets behave differently - noisier, more volatile, with structural quirks. So we rebuilt every calculator from scratch. A full breakdown of each calculation is in the Appendix.
Volatility-Aware Signalling
Not all divergences are equal. A spread breaking down during extreme volatility is very different from one in a quiet market. To account for this, we:
Compute pair-level volatility in both short (1h) and long (1d) windows
Classify regime states (calm vs. volatile) to help you adjust your risk
From Data to Decisions: Signals & Execution
With these building blocks in place, we can surface two levels of actionable insights:
Viable signals → opportunities that pass our statistical and backtest filters, showing where pairs are diverging enough to watch.
Live trades → when conditions align (e.g. spread < −2σ with strong historical mean reversion), Agent Pear triggers alerts and can be integrated directly with execution on venues like Hyperliquid.
By rebuilding the data layer, extending coverage to the full universe, and adding AI-powered narrative context, we’ve created an agent that doesn’t just crunch numbers - it tells you the story behind the trade and equips you to act.
5. Agent Pear Architecture

Behind the scenes, Agent Pear runs on a production-grade pipeline. Think of it as an orchestra: every component has a role, and the orchestrator makes sure they play in sync.
Orchestration & Configuration
Orchestration Service → the conductor. On a fixed schedule (hourly and daily), it lines up each task in the right order:
Fetch fresh data
Store it safely
Run analytics
This sequencing prevents race conditions and ensures data integrity.
Configuration Service → the stage manager. It provides credentials, database connections, and settings to all modules, so nothing is hardcoded. That makes the system flexible, secure, and portable across environments.
The Automated Data Pipeline
The pipeline transforms raw market data into actionable intelligence through four layers:
Ingestion Layer
Connects directly to exchanges (e.g. Hyperliquid).
Pulls in two streams: raw time-series price data + metadata about assets/pairs.
Storage Layer
Everything is written into a central database.
A unified data-access gateway means every service reads/writes in a consistent, secure way.
Analytical Layer
The orchestrator triggers our custom calculators (correlation, cointegration, z-scores, volatility).
This is where raw data becomes trade-ready insights.
Results Persistence
All outputs are written back into dedicated stats tables for fast retrieval.

API & Interaction Layer
Once signals are generated, traders and systems need to access them.
API Layer → the front door. Handles requests from trading interfaces or external agents, pulls data from the database, and returns it cleanly.
Security & Signals → every request is validated with API keys. The same interface also exposes the final signal outputs — turning complex analytics into clear, actionable trade signals.
Takeaway: The architecture ensures reliability, security, and real-time performance - so you can focus on trading, not on infrastructure.
6. Signal Generation Architecture: A Dual-Phase Approach
Once we’ve built the data layer and calculators, the real challenge is turning raw numbers into signals you can actually trade on.
Agent Pear’s signal engine works in two phases:
Batch Discovery → find and rank potential opportunities.
Continuous Monitoring → activate, track, and manage trades in real time.

———————————————————————————————————————————————————————-
Phase 1: Batch Discovery
Think of this as the “scouting phase.” The system scans the entire market and builds a watchlist of high-potential pairs.
Sourcing & Filtering
Pulls in all pairs with fresh, high-quality stats.
Applies quality gates (data sufficiency, stability, no duplicates).
Enrichment & Ranking
Adds extra context like lead-lag analysis and quick spread backtests.
Ranks pairs by strength of mean-reversion signal.
Segregation
Only a few high-conviction signals are activated immediately.
The rest are stored in a watchlist to wait for better entry conditions.
———————————————————————————————————————————————————————-
Phase 2: Continuous Monitoring
This is the always-on engine that watches both the watchlist and live trades.
Activating Opportunities
Continuously recalculates spreads and z-scores in real time.
If a pair crosses a threshold and the market regime looks favorable, it’s promoted to an active trade.
The trade is logged in the ledger and a notification goes out instantly.
Managing Active Trades
Once live, each trade is managed with strict rules:✅ Profit-Taking → exit when spread reverts to mean.
❌ Dynamic Stop-Loss → exit if spread keeps moving against you.
⏳ Time Expiry → close if it drags on past its expected half-life.
———————————————————————————————————————————————————————-
Qualitative Enrichment: The AI Narrative Layer
Numbers alone don’t tell the full story. That’s where the AI Narrative Engine comes in.
For every signal, Pear adds a short qualitative remark:
“BTC/SOL diverged unusually far, with strong historical mean-reversion. Expected window: ~8h.”
This bridges the gap between quant output and trader intuition - so instead of staring at a z-score chart, you get a clear story you can act on.
Agent Pear Status
All of the above is now live and Agent Pear will be rolled out in Stages.
Phase 1: For any pair, we now show some key statistics, on demand, for users of Pear Protocol. For example, a user wanting to enter a long LINK / short XRP can see the correlation and real time Z-Score. The extension of this will be to use the beta and volatility calculations to suggest different weightings for the long and short leg respectively.

Phase 2: In this phase we will roll out the signals on a dedicated token-gated page, with holders of staked PEAR (stPEAR) being able to see live trade signals, and importantly with alerts when to enter and close them.


Phase 3: The agent then becomes conversational, so users can speak to it in natural language and get real time thoughts on their pair trades. E.g. one prompt might be:
“What do you think about a long ETH / short SOL pair trade right now?”
Agent Pear would then give a detailed breakdown based not just on statistics, but also live data from various APIs on net funding rates, open interest, liquidation data, upcoming token unlocks and more

Phase 4: The Agent becomes fully autonomous and can enter, monitor and close pair trades. The monetisation for this then becomes Vault architecture, where users deposit their stablecoins like USDC, and the Agent executes trades based on pre-established risk management parameters. Thus, Pear goes from being a full stack pair trading platform to morphing into an AI-powered Asset Management business.

Appendix
Here’s how each component works:
Spread Calculator
Regress one asset against another to find hedge ratio (β).
Dual-beta design:
Structural beta (long history) → defines the baseline relationship.
Dynamic beta (short window tied to half-life) → adapts to current market conditions.
Integrity checks (R², standard error) keep it statistically valid.
Correlation Calculator
Quick screen using Pearson correlation on log returns.
Safeguards for sample size + stability → avoids false positives in volatile coins.
Cointegration Calculator
ADF test on residuals to check stationarity.
Instead of generic tables, we generated our own Monte Carlo thresholds tuned for crypto.
Conviction score blends: ADF distance, regression fit (R²), half-life, and Hurst exponent.
Half-Life Calculator
Fits AR(1) model to the spread.
Tells us the expected “action window” for a trade.
Z-Score Calculator
Two layers:
Structural z-score → long-term view.
Execution z-score → rolling window for real-time signals.
Hurst Exponent Calculator
Classifies behaviour:
H < 0.5 = mean-reverting.
H ≈ 0.5 = random walk.
H > 0.5 = trending.
Optional DFA path for messy series.
Regime Detection
Uses z-score + volatility ratios to classify states like Strong Reversion, Peak Divergence, or Idle.
Adds “narrative context” for risk gating.
Volatility Calculators
Daily → Yang-Zhang (handles overnight gaps).
Hourly → Parkinson (best for intraday ranges).
Spread → close-to-close.
Backtester
Lightweight mean-reversion sim.
Outputs: win rate, Sharpe, max drawdown.
Purpose: quickly sanity-check signals, not model full execution.