Inspiration
Pair trading is one of the most reliable market-neutral strategies in traditional finance, but it's barely accessible in crypto. There's no easy way to go long one asset and short another in a single click across perpetual DEXs. We wanted to bring institutional-grade pair trading to DeFi with a clean, simple interface that anyone can use — no spreadsheets, no manual hedging, no hassle.
What it does
Pairity is a one-click pair trading platform for perpetual futures. You pick two correlated assets — say ETH and SOL — go long one, short the other, and profit from the spread. The app features:
- One-click pair trade execution across perpetual DEXs via Liquid aggregation
- Pair discovery engine that scans 30+ assets (crypto, commodities, stocks) and ranks them by correlation score
- Live ratio charts showing the price relationship between any two assets with OHLC candles
- Real-time order books, funding rates, and position management with TP/SL
- AI-powered correlation insights using Claude to explain why two assets move together
- Wallet auth via Privy so users can connect with a wallet or email
How we built it
- Next.js 16 with App Router for the frontend and API routes
- Zustand for state management across trading, positions, and settings
- Lightweight Charts for TradingView-style ratio charts
- Hyperliquid API for market data — candles, order books, funding rates
- Liquid API for trade execution across perpetual DEXs
- simple-statistics for computing Pearson correlation on log returns from daily candles
- Anthropic Claude SDK for generating natural-language pair explanations
- Privy for wallet authentication
- Tailwind CSS v4 for a dark-themed trading UI
Challenges we ran into
- Rate limiting on the Liquid API (2 orders/sec) meant we had to stagger the long and short legs of a pair trade with a 500ms delay, which introduces slippage risk
- Getting reliable correlation data required pulling daily candles from Hyperliquid and computing log returns — some assets had sparse data or different trading hours
- Mapping assets across different protocols was tricky since HIP-3 assets (commodities, stocks) use a different prefix format than standard crypto pairs
- Keeping the UI responsive while polling positions, order books, and charts simultaneously took careful state management
Accomplishments that we're proud of
- The entire pair trade flow works end-to-end — discover a correlated pair, click it, execute a hedged position, and manage it with TP/SL
- The correlation engine ranks 400+ possible pairs across crypto, commodities, and equities in real time
- The ratio chart visualizes the actual spread between two assets as a tradeable OHLC chart, which is something most platforms don't offer
- Clean, professional trading UI that feels like a real product, not a hackathon prototype
What we learned
- A lot about market microstructure — how order books, funding rates, and correlation actually work in practice across perp DEXs
- How to build a responsive trading interface that handles real-time data streams without choking
- The nuances of pair trading math — Pearson correlation, cointegration, rolling Z-scores, and why correlation alone isn't enough
- Working with multiple DEX APIs and understanding the fragmentation across DeFi liquidity venues
What's next for Pairity
- Wire up live AI explanations using Claude so every pair gets a dynamic insight, not just the top pairs
- Add limit order support for pair entries instead of just market orders
- Implement proper cointegration testing (Engle-Granger) alongside correlation for more robust pair selection
- Add historical backtesting so users can see how a pair trade would have performed
- Support more execution venues beyond Liquid
- Build out order history and PnL analytics for closed positions
Built With
- javascript
- liquid
- privy
- python
- typescript
Log in or sign up for Devpost to join the conversation.