Arbitrage

Arbitrage Scanner API
for AI Agents

Arbitrage opportunities exist for milliseconds before being closed by other participants. Agents running Purple Flea's arb scanner can detect funding rate discrepancies, cross-exchange spreads, and statistical divergences โ€” and act before the window closes.

Start Scanning โ†’ API Reference

Why Arbitrage Is an Agent-Native Strategy

Speed, precision, and 24/7 availability are exactly what arbitrage requires โ€” and exactly what AI agents provide.

Human traders cannot monitor 275 perpetual markets simultaneously, compare them against spot venues in real time, and execute opposing positions within seconds. AI agents can. This is why arbitrage has shifted almost entirely to algorithmic systems โ€” and why the opportunity still exists for agents that are fast and well-connected enough.

Purple Flea's arbitrage scanner continuously monitors three classes of opportunity: funding rate arbitrage (where the cost of holding a perpetual position diverges from fair value), cross-exchange arbitrage (where the same asset trades at different prices on different venues), and statistical arbitrage (where correlated assets temporarily diverge from their historical relationship).

The scanner delivers opportunities ranked by expected edge in basis points, with full context for execution: required position sizes, estimated transaction costs, historical spread duration (how long similar opportunities have stayed open), and maximum safe position sizes given current liquidity.

What the scanner monitors
  • Funding rates across all 275 Hyperliquid perps
  • Cross-exchange spreads vs dYdX and GMX
  • Spot vs perp basis for major assets
  • Correlated pair divergences (BTC/ETH, SOL/AVAX)
  • Statistical Z-score alerts for historical pair ratios
  • Triangular arb across stablecoin pairs
  • Funding rate annualized equivalent calculations
  • Net edge after estimated trading fees

Arbitrage Types

Three distinct arbitrage strategies, each with different risk profiles and opportunity frequencies.

๐Ÿ’น
Funding Rate Arbitrage
When perpetual funding rates are significantly positive, longs pay shorts every 8 hours. An agent can go long on spot (or another venue) while simultaneously shorting the perpetual to collect this funding as near-risk-free income.
Buy BTC spot
+
Short BTC-PERP
=
Collect funding
Key Risk: Basis Risk
Spot and perp prices may diverge during the holding period. Monitor the spread continuously.
โš–๏ธ
Cross-Exchange Arbitrage
The same perpetual contract trades at slightly different prices on Hyperliquid, dYdX, and GMX. Buying on the cheaper venue while selling on the more expensive venue locks in the spread โ€” minus execution costs and capital movement time.
Long on Exchange A
+
Short on Exchange B
=
Lock spread
Key Risk: Execution Lag
Spreads close quickly. Simultaneous execution across venues is essential.
๐Ÿ“Š
Statistical Arbitrage
Correlated assets (BTC/ETH, SOL/AVAX) maintain historical price ratios. When these ratios diverge significantly (measured by Z-score), the position is mean-reverting: long the underperformer, short the outperformer.
Long SOL-PERP
+
Short AVAX-PERP
=
Await reversion
Key Risk: Correlation Breakdown
Correlations can decouple permanently. Use stop losses and monitor Z-score daily.

Python Integration

Two calls: scan for opportunities, then subscribe to live alerts for the ones you want to trade.

import purpleflea arb = purpleflea.ArbitrageClient(api_key="YOUR_KEY") # Scan for funding rate arbitrage opportunities opps = arb.scan_funding_arb(min_spread_bps=20) for opp in opps[:5]: print( f"{opp['market']}: funding={opp['funding_rate_pct']:.3f}%" f" | annual_equiv={opp['annualized_pct']:.1f}%" f" | edge=${opp['edge_per_100k']:.0f}/100k" ) # Monitor cross-exchange arb (Hyperliquid vs other venues) live = arb.monitor_spread( "BTC-PERP", venues=["hyperliquid", "dydx", "gmx"], min_spread_bps=5, webhook_url="https://mybot.io/arb-alert" ) # Statistical arb โ€” scan correlated pairs stat_opps = arb.scan_stat_arb( universe=["BTC-PERP", "ETH-PERP", "SOL-PERP"], z_score_threshold=2.0, lookback_days=30 ) for opp in stat_opps: print( f"Long {opp['long']} / Short {opp['short']}" f" | z={opp['z_score']:.2f}" )
Funding Rate Response Example
{
  "market": "ETH-PERP",
  "funding_rate_pct": 0.087,
  "annualized_pct": 95.4,
  "edge_per_100k": 87.0,
  "avg_duration_hours": 14.2,
  "liquidity_score": 0.94,
  "net_edge_after_fees": 81.3
}
Execution Integration
The arb scanner integrates directly with the Trading API. When an opportunity meets your thresholds, pass the opportunity object directly to the execution engine.
# One-line arb execution
arb.execute(opp, size_usd=10000)

Scanner Performance

Real-time
Continuous arb scanning across all venues
275
Funding rate markets monitored
5 bps
Minimum spread for cross-exchange alerts
Find Your Edge

Start Capturing Arbitrage Opportunities

The arb scanner is included with every Purple Flea API account. Pair it with the Trading API for fully automated arbitrage execution.

Get API Key โ†’