Build autonomous algorithmic trading bots with access to 275 perpetual futures markets. REST API, Python SDK, and native LangChain tools — no KYC, under 50ms latency, up to 50x leverage. Earn 20% of every trading fee generated by bots you refer.
The Purple Flea Trading API is designed for developers building algorithmic trading systems, autonomous AI agents, and quantitative strategies on crypto perpetual futures. If you are writing Python scripts that need to execute trades programmatically, orchestrating an LLM-powered agent that reacts to market data, or running a quant fund that requires reliable, low-latency order execution — this API is built for you.
Unlike brokerage APIs that require weeks of KYC review and restrict programmatic access, Purple Flea gives your bot an API key and a funded non-custodial wallet within minutes. There is no human in the loop. Your agent registers itself, receives credentials, and can place its first trade in a single session.
Perpetual futures are the preferred instrument for algo trading bots for several concrete reasons:
Scripts and services executing rule-based strategies: EMA crossovers, RSI mean reversion, breakout systems. Full REST API with WebSocket feeds.
LLM-powered agents that reason about market conditions and decide when to enter or exit positions. Native LangChain and CrewAI tool wrappers included.
Factor models, statistical arbitrage, cross-market correlations. Access to 275 markets means opportunities across the full crypto universe.
From zero to a live perpetual position in under five minutes.
Sign up at wallet.purpleflea.com or call POST /agent/register. You receive an API key and a BIP-39 mnemonic for your HD wallet immediately. No KYC, no waiting period.
Deposit USDC to your agent's Ethereum or Arbitrum address. The balance is automatically available as margin for perpetual trading. Minimum deposit: $10 USDC.
Call the orders endpoint with your market, size, direction, and leverage. Your position is live within milliseconds.
Every trading strategy needs reliable market data. Purple Flea exposes two complementary data channels: a WebSocket feed for real-time streaming price updates and a REST endpoint for point-in-time snapshots. Use WebSocket when your bot needs to react to tick data; use REST for strategy initialization, backtesting reference data, or lower-frequency polling.
Market, Limit, Stop-Limit, and Take-Profit orders are all supported via the same REST endpoint.
A self-contained Python class that fetches market data from the Purple Flea Trading API, computes signals, manages open positions, and enforces risk rules on every cycle.
Three complete strategy templates to fork and customize for your own bot.
Buy when the 9-period EMA crosses above the 21-period EMA; sell when it crosses below. A classic momentum strategy that works well on volatile assets with trending behavior.
When price touches the lower Bollinger Band with the bands narrowing (squeeze), enter a long expecting reversion to the mean. Exit at the middle band or upper band.
When funding rates are highly positive (longs pay shorts), hold a short perp position hedged with an equal spot long. Collect the funding payment with no directional risk.
Instead of hard-coded signal rules, pass a structured snapshot of market data — price, funding rate, open interest, recent volatility — to a large language model and ask it to reason about the best position. The LLM acts as your quant analyst: it weighs multiple factors simultaneously and returns a structured JSON decision your bot executes immediately.
The pattern works with any model that supports JSON mode or tool use. The example below uses Claude via the Anthropic SDK and shows exactly how to format the market prompt and parse the response.
A strategy that looks compelling in theory can lose money in practice. Backtesting replays your strategy logic against historical candle data, so you can measure win rate, maximum drawdown, Sharpe ratio, and total return before a single dollar is at risk. The example below fetches historical candles from the Purple Flea REST API and simulates the EMA-crossover strategy with realistic transaction costs.
No trading bot is complete without a risk management layer. Even a strategy with a positive expected value will destroy capital if position sizing is wrong or if a single catastrophic trade is allowed to run unchecked. The Purple Flea Trading API gives you the raw building blocks; here is how to wrap them safely.
The three non-negotiable rules for any production trading bot:
If you are building an LLM-powered agent rather than a pure algorithmic bot, the Purple Flea LangChain package wraps every trading endpoint as a native BaseTool. Your agent can reason about market conditions in natural language and execute real trades — no glue code required.
A trading bot that crashes silently loses money. pm2 is the standard process manager for long-running Node.js and Python services: it restarts your bot automatically on crash, persists it across reboots, and streams logs you can inspect at any time. The three-step setup below gets a Purple Flea bot running in a managed process in under two minutes.
Purple Flea runs one of the most generous referral programs in crypto infrastructure. When you register an agent and that agent places trades, you earn 20% of every trading fee those trades generate — forever. There is no cap, no expiry, and no minimum payout threshold.
If you are building a platform, a framework, or a tool that other developers use to interact with Purple Flea, your referral code is embedded at the API key level. Every downstream agent that uses your SDK or platform automatically credits your referral account.
Hyperliquid charges ~0.035% per trade. At $1M monthly volume, that is $350 in fees — you earn $70/month from a single active bot.
Commissions are permanent and uncapped. A bot you refer today will earn commissions for its entire lifetime on the platform.
Trading commissions stack with wallet swap commissions (10%), casino commissions (10%), and domain registration (15%).
Free to start. No KYC. 275 markets. 20% referral commission on every fee your bots generate.