Entry
- Phase 1 (identification): test pair candidates for cointegration (Engle-Granger, Johansen test)
- Compute spread = log(A) - β × log(B), normalized as a z-score
- Entry: spread z-score > +2 → short A, long B (equal dollar weights)
- Entry: spread z-score < -2 → long A, short B
Exit
- Z-score crosses back through 0 (or 0.2) → exit
- Time stop: hold at most 60 days (guards against regime breaks)
- Stop-loss: z-score > ±3.5 → the pair has decointegrated, realize the loss
| Name | Typ. value | Description |
|---|---|---|
| entry_z | 2.0 | Opening threshold |
| exit_z | 0.0 to 0.2 | Closing threshold |
| stop_z | 3.5 | Stop on regime break |
| lookback | 60-120 days | Window for β and spread stats |
Pros
- Market-neutral — performance independent of BTC direction
- Well-documented academic evidence since 2006
- Lower volatility than directional strategies
- Diversifies well across many pairs
Cons
- Pair selection is everything — bad pairs ruin it all
- Cointegration can break suddenly (regime change, news event)
- Execution-sensitive: slippage on two assets × entry+exit
- Crowded on US equities since 2010 — margins have eroded
Core idea
Two stocks or coins that are fundamentally similar (e.g. BTC and ETH, or Coca-Cola and Pepsi) mostly move in parallel — but not exactly. Short-term divergences are normal and mean-reverting: when BTC runs much stronger than ETH, arbitrageurs typically bring ETH back up in relative terms.
The statistical test for this is cointegration (not simply correlation!). Two time series are cointegrated if a linear combination of them behaves stationary — i.e. has a stable mean it keeps returning to.
The math
- Pick two candidates A, B
- Estimate β via OLS:
log(A) = α + β × log(B) + ε - Test whether ε is stationary (Augmented Dickey-Fuller or Engle-Granger)
- If yes → the pair is tradable
- Live: compute
spread_t = log(A_t) - β × log(B_t), z-standardize over a rolling window
Trade rules
z > +2.0: Short A, Long B (A is expensive relative to B)
z < -2.0: Long A, Short B (A is cheap relative to B)
|z| < 0.2: close position
|z| > 3.5: stop — pair has decointegrated
Enter in equal dollar amounts so the portfolio stays market-neutral.
Evidence
Original Gatev study (1962-2002 on US stocks): a simple pairs-trading strategy earned ~12% per year with low market correlation.
Modern crypto applications (2024 research): cointegrated altcoin pairs (ETC/FIL, LINK/MATIC) delivered ~16% CAGR at ~1.0 Sharpe, profit factor ~3.7. Currently works better in crypto than in equities because it is less crowded.
Risks
- Cointegration break: if a coin fundamentally diverges from its pair partner (delisting, hack, protocol change), the assumption breaks. Hence the hard stop at z > 3.5.
- Correlation spikes in crises: all cryptos fall at once — pair trades can still work, but slippage becomes extreme.
- Execution: executing both legs simultaneously is essential — Hyperliquid has good order-book depth, but the time windows are small.
Relevance for Botty
High, but architecturally demanding. Botty's current 'one wallet per strategy' architecture would need to be adapted for pair trading — a pair trade requires coordinated execution of two position legs. Candidate pairs on Hyperliquid:
- BTC/ETH: very stably cointegrated, low margins (crowded)
- ETH/SOL: medium, higher margins
- Layer-1 basket pairs: SOL/AVAX, BNB/TRX, etc.
Would be an entirely new module, but with real alpha potential.