Powered by Hyperliquid L1

The most liquid DEX.
Now accessible to every AI agent.

Purple Flea wraps Hyperliquid's on-chain central limit order book into a clean REST API. Your agent gets access to 275+ perpetual markets — crypto, stocks, commodities, forex — with zero gas fees, sub-second execution, and up to 50x leverage. No wallet management. No private key handling. Just trade.


275+
Perpetual markets
0
Gas fees per trade
50x
Max leverage
<1s
Order execution

CEX-level depth.
Fully on-chain.

Hyperliquid is a decentralized exchange that runs a real central limit order book directly on its own high-performance L1 blockchain. Unlike AMM-based DEXs, every order, fill, and cancellation is matched on-chain with sub-second finality — giving it the depth and latency characteristics of a centralized exchange without any custodian.

📖

On-chain order book

A real CLOB running on Hyperliquid's own L1. Every order is matched on-chain — not via AMM curves or off-chain relayers. Fully verifiable, fully transparent.

💧

Institutional depth

As the highest-volume perpetual DEX by open interest, Hyperliquid maintains tight spreads across BTC, ETH, SOL, and dozens of other major markets.

Sub-second finality

Orders execute and settle in under one second. No waiting for Ethereum block confirmations. No mempool competition. No gas auctions.

No KYC required

Hyperliquid requires no identity verification. Deposit USDC and trade immediately — no onboarding queue, no document upload, no approval wait.


Hyperliquid made
agent-native.

Accessing Hyperliquid directly requires managing Ethereum-compatible wallets, signing EIP-712 typed data, handling USDC bridging, and building your own auth layer. Purple Flea handles all of that so your agent can focus on strategy, not plumbing.

🔐

Simplified authentication

A single API key replaces private key management, wallet signing, and EIP-712 typed data. Your agent authenticates with a bearer token on every request — no cryptographic key material stored in agent memory.

🔄

No wallet management

Purple Flea handles USDC deposits, margin allocation, and withdrawal routing. Your agent never needs to hold or sign with a private key. All position operations are handled via REST with JSON bodies.

🌟

Agent-native API design

Every endpoint returns structured JSON with consistent error formats. Rate limits are generous for programmatic access. Responses include all fields an agent needs to make the next decision without additional lookups.

💰

Built-in referral program

Every API key participates in Purple Flea's referral program automatically. You earn 20% of trading fees generated by agents you refer — forever, with no cap and no minimum payout threshold above $1 USDC.


Crypto, stocks, commodities,
and forex — all as perps.

Hyperliquid lists perpetual contracts across asset classes far beyond crypto. Your agent can run a momentum strategy on NVDA, harvest funding on BTC-PERP, hedge forex exposure on EUR-USD, and go long gold — all through the same API, the same auth token, the same position management endpoints.

Crypto Perpetuals
BTC-PERP ETH-PERP SOL-PERP BNB-PERP AVAX-PERP DOGE-PERP LINK-PERP ARB-PERP OP-PERP INJ-PERP + 265 more
Stock Perpetuals
TSLA-PERP NVDA-PERP AAPL-PERP META-PERP MSFT-PERP GOOG-PERP AMZN-PERP
Commodity Perpetuals
GOLD-PERP OIL-PERP SILVER-PERP
Forex Perpetuals
EUR-USD GBP-USD USD-JPY

Built for the speed
your agent demands.

Every design decision in the Purple Flea Hyperliquid API is optimized for programmatic, high-frequency access. Here is what makes it the right choice for autonomous agents.

📌

Zero gas fees

Hyperliquid's L1 processes orders without EVM gas costs. Your agent can submit hundreds of orders per hour without gas cost unpredictability eating into returns. The only fee is the exchange taker/maker fee on fills.

Sub-second execution

From API call to confirmed fill in under one second on average. No mempool waiting, no confirmation blocks. Your agent gets the fill price it expects when acting on a signal, not the price three blocks later.

📈

Up to 50x leverage

Major markets support leverage from 1x to 50x. Specify leverage per-order alongside margin mode (isolated or cross). Your agent controls exact risk exposure on every position it opens.

👓

Funding rate visibility

Every market response includes the current 8-hour funding rate and the timestamp of the next funding settlement. Your agent can factor funding into entry/exit decisions and run delta-neutral strategies systematically.

🕐

24/7 operation

Perpetual markets on Hyperliquid never close. Crypto perps trade continuously. Stock and forex perps have their own schedules reflected in funding rate behavior — your agent can operate around the clock.

🛡

Limit and stop orders

Beyond market orders, your agent can place limit orders at specific prices and stop-loss orders that trigger on mark price. Full order lifecycle management via the /v1/orders endpoint.


Seven endpoints.
Complete trading control.

All Hyperliquid API endpoints are served from trading.purpleflea.com. Every request requires a bearer token in the Authorization header. All request and response bodies are JSON.

GET /v1/markets
Full market list with live funding rates. Returns all 275+ perpetual markets with current mark price, index price, 8-hour funding rate, next funding timestamp, 24h volume, and open interest. Supports ?category=crypto|stocks|commodities|forex filter.
GET /v1/markets/{id}/orderbook
Current bid/ask depth for a specific market. Returns up to 20 levels on each side of the order book with price and size. Use the ?depth=5 query param to limit levels returned. Useful for agents calculating expected slippage before entering a position.
POST /v1/positions
Open a new perpetual position. Required fields: market, side (long|short), size, leverage (1–50), order_type (market|limit). Optional: limit_price, margin_mode (isolated|cross). Returns fill price, position ID, and liquidation price on success.
GET /v1/positions
List all open positions. Returns each open position with entry price, mark price, unrealized PnL, liquidation price, leverage, margin mode, and ADL queue rank. Your agent should poll this endpoint to monitor position health and decide when to adjust or close.
POST /v1/positions/{id}/close
Close a specific open position. Submits a market close order for the full position size. Returns realized PnL, close price, and fee paid. Optional size field allows partial close — useful for scaling out of a position incrementally.
POST /v1/orders
Place limit or stop orders. Create limit orders at a specific price, stop-market orders that trigger on mark price breach, or take-profit orders. Supports reduce_only flag to ensure the order can only reduce an existing position. Returns order ID for tracking.
GET /v1/funding-history/{market}
Historical 8-hour funding rates. Returns up to 90 days of funding rate history for the specified market. Supports ?from and ?to Unix timestamp filters. Essential for agents running funding rate arbitrage or building predictive funding models.

Working code for two
common agent strategies.

Both examples use only the standard library and requests. Drop them into any agent, swap in your API key, and run.

momentum_trader.py — Buy when 15m momentum is positive, sell when it reverses
import requests, time, statistics BASE = "https://trading.purpleflea.com" HEADERS = {"Authorization": "Bearer pf_sk_..."} MARKET = "BTC-PERP" WINDOW = 20 # price samples for momentum window LEV = 5 # 5x leverage SIZE = "0.01" # BTC notional per position prices = [] open_pos_id = None open_side = None def get_mark_price(): r = requests.get(f"{BASE}/v1/markets/{MARKET}/orderbook", headers=HEADERS) data = r.json() # mid price from top of book best_bid = float(data["bids"][0]["price"]) best_ask = float(data["asks"][0]["price"]) return (best_bid + best_ask) / 2 def open_position(side): resp = requests.post(f"{BASE}/v1/positions", headers=HEADERS, json={ "market": MARKET, "side": side, "size": SIZE, "leverage": LEV, "order_type": "market", "margin_mode": "isolated", }).json() print(f"Opened {side} at {resp['fill_price']} | liq: {resp['liquidation_price']}") return resp["position_id"] def close_position(pos_id): resp = requests.post(f"{BASE}/v1/positions/{pos_id}/close", headers=HEADERS).json() print(f"Closed position | realized PnL: {resp['realized_pnl']} USDC") # Main loop — sample price every 45 seconds while True: price = get_mark_price() prices.append(price) if len(prices) > WINDOW: prices.pop(0) if len(prices) == WINDOW: mid = WINDOW // 2 momentum = sum(prices[mid:]) - sum(prices[:mid]) target = "long" if momentum > 0 else "short" if open_side and open_side != target: close_position(open_pos_id) open_pos_id = open_side = None if not open_side: open_pos_id = open_position(target) open_side = target time.sleep(45)
funding_harvester.py — Collect positive funding by holding short positions
import requests BASE = "https://trading.purpleflea.com" HEADERS = {"Authorization": "Bearer pf_sk_..."} MIN_RATE = 0.0005 # Only enter if 8h funding rate > 0.05% (annualises to >22%) # 1. Scan all markets for high positive funding rates markets = requests.get(f"{BASE}/v1/markets", headers=HEADERS).json() opportunities = [ m for m in markets if float(m["funding_rate"]) > MIN_RATE ] opportunities.sort(key=lambda m: float(m["funding_rate"]), reverse=True) print(f"Found {len(opportunities)} high-funding markets") for m in opportunities[:5]: print(f" {m['market']:15s} funding={float(m['funding_rate'])*100:.4f}% OI={m['open_interest']}") # 2. Open short position on the highest-funding market if opportunities: best = opportunities[0] pos = requests.post(f"{BASE}/v1/positions", headers=HEADERS, json={ "market": best["market"], "side": "short", # short = receive funding when rate is positive "size": "100", # $100 notional "leverage": 1, # 1x — no directional risk amplification "order_type": "market", "margin_mode": "isolated", }).json() expected_8h = float(best["funding_rate"]) * 100 print(f"\nOpened short {best['market']} | fill: {pos['fill_price']}") print(f"Expected funding income: {expected_8h:.4f} USDC per 8h settlement") # 3. Check historical funding to validate mean persistence history = requests.get( f"{BASE}/v1/funding-history/{best['market']}", params={"from": 1700000000}, headers=HEADERS ).json() avg_rate = sum(float(h["rate"]) for h in history) / len(history) print(f"Historical avg 8h rate: {avg_rate*100:.4f}%")

Purple Flea vs direct
Hyperliquid API.

You can access Hyperliquid directly — it has a public API. Here is why most agent developers choose to go through Purple Flea instead.

Feature Direct Hyperliquid Purple Flea (HL API)
Authentication EIP-712 wallet signing per request Bearer token — one header
Private key handling Required — must be stored in agent Not required — Purple Flea handles it
USDC deposit setup Manual bridge from Arbitrum Handled automatically
REST API Custom JSON-RPC protocol Standard REST + JSON
Error messages Raw exchange error codes Human-readable with suggested fixes
Referral income 20% of fees — forever
Agent onboarding time Hours (wallet setup, signing logic) Minutes (API key + first request)
Gas fees None (Hyperliquid L1) None (Hyperliquid L1)
Markets available 275+ 275+
Execution speed Sub-second Sub-second

Earn 20% of every
trading fee. Forever.

Hyperliquid charges a taker fee on every filled order. Purple Flea earns a portion of that fee and passes 20% of it directly back to you — the developer or platform that referred the agent. There is no cap, no expiry, and no minimum trade count.

20%

Perpetual referral commission on Hyperliquid trading fees

Every order your referred agent fills generates a taker fee. Purple Flea tracks that fee per API key and credits 20% of its revenue share to your referral balance in real time. Balances above $1 USDC are withdrawable at any time. There is no expiry — if an agent you referred is still active two years from now, you are still earning. Build a busy agent and the passive income compounds fast.

How to refer: Share your Purple Flea referral link. When another developer or agent framework registers using your link, every agent they create is automatically attributed to you. Referral attribution is permanent — it does not change if the referred developer changes their plan or API key.


The complete agent
financial stack.

Give your agent access to
275+ perpetual markets.

Free to start. No KYC. 0 gas fees. 20% referral commission on every trade.