Profit from price differences across 275+ markets. Instantly.
Purple Flea gives your agent the trading infrastructure, wallet layer, and cross-chain tools
to execute arbitrage strategies at machine speed with sub-50ms latency.
Arbitrage is the practice of exploiting price differences for the same asset across different markets. In traditional finance, these gaps close in microseconds because institutional desks have co-located servers at exchanges. In DeFi, the landscape is more fragmented — dozens of DEXes, perpetual exchanges, and chains each quote slightly different prices for the same token. Those gaps are profit opportunities.
The mechanics are simple: if ETH-PERP is trading at $3,520 on Hyperliquid and spot ETH is available for $3,500 on Uniswap, you can buy spot, short the perp, and lock in a $20 margin — risk-free, assuming execution is fast enough. If BTC costs $0.02 more on Arbitrum than on Polygon, bridge and sell. If the funding rate on a perp is +0.1% per 8 hours, going delta-neutral earns that rate as pure yield.
Purple Flea gives your AI agent all three layers it needs to execute these strategies: a Trading API for Hyperliquid perp positions, a Wallet API for spot token swaps, and a Cross-Chain Swap API for bridging assets between networks. Your agent can scan, evaluate, and execute an arbitrage opportunity entirely via REST calls — no blockchain SDK integration required.
Three complementary APIs that together cover every arbitrage strategy in DeFi.
| Endpoint | What it does | Used for |
|---|---|---|
| POST/v1/trading/order | Open and close perpetual futures positions on Hyperliquid across 275+ markets | Short perp leg of basis trade; directional funding arb |
| POST/v1/wallet/swap | Spot token swap via Wagyu aggregator (routes through best DEX on any chain) | Long spot leg of basis trade; DEX price arbitrage |
| POST/v1/cross-chain/swap | Swap tokens across chains in a single call (bridges + swaps automatically) | Cross-chain price arbitrage; asset rebalancing |
| GET/v1/market/orderbook/{symbol} | Fetch real-time orderbook depth for any Hyperliquid perp market | Identify bid/ask spread; size positions correctly |
| GET/v1/funding-history/{symbol} | Historical funding rate data per 8-hour epoch for any perp market | Backtest funding strategies; identify high-rate markets |
| GET/v1/trading/positions | List all open perpetual positions with current PnL and liquidation price | Monitor exposure; trigger stop-loss rebalances |
Four proven strategies your agent can implement using Purple Flea's APIs. Each targets a different type of market inefficiency.
When a perpetual futures contract trades at a premium to spot price, you can capture the gap by buying spot and simultaneously shorting the perp. The positions are delta-neutral — you profit as the premium converges, plus you earn positive funding if the perp is in contango.
Execution: Use /v1/wallet/swap to buy spot tokens, then /v1/trading/order to short the same asset on Hyperliquid. Close both legs when the basis tightens.
The same perpetual contract can trade at different prices on different venues. If BTC-PERP is $50 cheaper on one exchange than Hyperliquid, buy the cheaper leg and short the more expensive one. Lock in the spread as both prices converge under market pressure.
Execution: Monitor Hyperliquid prices via /v1/market/orderbook/{symbol} and compare against external price feeds. When the spread exceeds your threshold plus fees, open both legs simultaneously.
Perpetual contracts pay or receive a funding rate every 8 hours to keep the perp price anchored to spot. When funding is highly positive (longs pay shorts), go short on the perp and long on spot to create a delta-neutral position that earns the funding payment.
Execution: Use /v1/funding-history/{symbol} to identify markets with consistently high positive funding. Open a delta-neutral position and hold through the funding epoch. Unwind when funding normalizes.
The same token can trade at different prices on different chains due to bridge latency, liquidity fragmentation, and different DEX depths. If USDC/ETH is 0.3% cheaper on Polygon than on Arbitrum, bridge ETH to Polygon, buy, bridge back, and sell.
Execution: Compare spot prices across chains using /v1/market/price?chain=polygon vs chain=arbitrum. When net of bridge fees a gap exists, execute via /v1/cross-chain/swap.
A complete Python agent that scans price relationships across three assets and executes when a profitable cycle is detected.
In arbitrage, latency is alpha. The faster your agent receives market data and submits orders, the narrower the spreads it can exploit — and the less likely another bot beats it to the same opportunity. Purple Flea's infrastructure is co-located with Hyperliquid's order matching engine to minimize round-trip time.
Our P50 API latency for order submission is under 50ms from any major cloud region. P95 remains below 120ms. For context, Hyperliquid's matching engine processes orders in under 1ms — the bottleneck for most agents is the API call, not the exchange itself.
For latency-sensitive strategies, deploy your agent in AWS us-east-1 or GCP us-east4 — the same regions where Purple Flea's API infrastructure is hosted. This shaves another 5–15ms off typical round-trips versus running from other geographies.
Measured from AWS us-east-1. Order submission endpoint. 30-day rolling average.
Arbitrage is not risk-free. Slippage, latency, and correlation risk can turn profitable-looking opportunities into losses. Purple Flea provides the primitives to manage these risks programmatically.
Set a maximum capital allocation per arbitrage cycle. Never put more than a fixed percentage of the wallet into a single arb to limit downside on bad executions.
Limit how many simultaneous arbitrage positions your agent holds. High concurrency magnifies both profit and loss — cap it at a level that keeps total exposure bounded.
Poll /v1/trading/positions for unrealized PnL. If any position hits your stop-loss threshold, close it immediately via /v1/trading/order with reduce_only: true.
Before running a funding rate strategy live, validate it against historical data.
Purple Flea's /v1/funding-history/{symbol} endpoint returns
per-epoch (8-hour) funding rates for any Hyperliquid perpetual market, going
back to the market's inception.
Pull the full rate history, filter for periods where funding was consistently positive and above your minimum threshold, and simulate the PnL of a long-spot short-perp delta-neutral position through those periods. Subtract estimated slippage (0.05% per entry/exit) and borrow costs to get realistic net returns.
Markets to examine first: ETH, BTC, SOL, and DOGE have the longest histories and most stable patterns. Smaller-cap perps occasionally show extreme funding spikes (5%+ per 8 hours) but carry higher liquidation risk from volatility.
When your agent registers other arbitrage bots through its referral link, it earns 20% of all trading fees those agents generate — forever. An active arbitrage bot can execute hundreds of trades per day. If you refer ten such agents, you are earning a significant passive revenue stream with zero additional work from your agent.
Referral earnings are accrued in USDC and paid on-chain to your agent's wallet.
Use /v1/referral/earnings to check the current balance and
/v1/referral/withdraw to sweep earnings into your trading
wallet. Your agent can then redeploy those earnings as additional capital
in arbitrage strategies — a fully compounding autonomous flywheel.
275+ markets. Sub-50ms latency. Full arbitrage toolkit. Free to start — no KYC.