Purple Flea Trading
OfficialAgent Trading
Trade 275+ perpetual futures markets from your AI agent. Stocks, commodities, crypto, forex, and indices — real execution on Hyperliquid with up to 50x leverage.
Quick Start
Register, check a price, and open a position:
# 1. Register (provide your Hyperliquid wallet + signing key)
curl -s -X POST https://trading.purpleflea.com/v1/auth/register \
-H "Content-Type: application/json" \
-d '{
"hl_wallet_address": "0xYourHyperliquidWallet",
"hl_signing_key": "0xYourSigningKey"
}' | jq
# 2. Check TSLA price
curl -s https://trading.purpleflea.com/v1/markets/TSLA/price \
-H "Authorization: Bearer YOUR_API_KEY" | jq
# 3. Go long $1,000 TSLA with 5x leverage
curl -s -X POST https://trading.purpleflea.com/v1/trade/open \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"coin": "TSLA", "side": "long", "size_usd": 1000, "leverage": 5}' | jqPrerequisites: Create a Hyperliquid account at app.hyperliquid.xyz/join/PF, deposit USDC, and create an API Agent Wallet in settings.
Related MCP server: AgentBroker MCP Server
Markets
275+ perpetual futures across 5 categories. All markets trade 24/7 with on-chain settlement.
Stocks (29 equities via HIP-3)
TSLA, NVDA, GOOGL, AAPL, AMZN, META, MSFT, NFLX, AMD, PLTR, COIN, MSTR, HOOD, INTC, MU, ORCL, COST, LLY, TSM, RIVN, BABA, GME, and more.
Trade stocks as perpetual futures — no market hours, no settlement delays, up to 5x leverage.
Commodities (9 markets)
GOLD, SILVER, COPPER, PLATINUM, PALLADIUM, URANIUM, ALUMINIUM, CL (crude oil), NATGAS
Indices (7 markets)
SPX (S&P 500), JP225 (Nikkei), KR200, DXY (Dollar Index), XYZ100, USAR, URNM
Forex (2 markets)
EUR, JPY — up to 50x leverage
Crypto (229 perpetuals)
BTC, ETH, SOL, XRP, DOGE, AVAX, LINK, and 222 more on Hyperliquid's main DEX with up to 50x leverage and institutional-grade liquidity.
API Reference
Base URL: https://trading.purpleflea.com/v1
Auth: Authorization: Bearer sk_trade_... (all endpoints except register)
Auth & Account
Method | Endpoint | Description |
|
| Create account. Params: |
|
| Account details, tier, volume, P&L, referral code |
Markets
Method | Endpoint | Description |
|
| All 275+ markets with categories and fee tiers |
|
| All 29 equity perpetuals with prices |
|
| All 9 commodity markets |
|
| All 47 real-world assets (stocks + commodities + indices + forex) |
|
| Detailed market info — max leverage, category, fees, trade examples |
|
| Live price for any market |
Trading
Method | Endpoint | Description |
|
| Open a position. Params: |
|
| Close a position. Params: |
|
| Open positions with live unrealized P&L (fetched from Hyperliquid) |
|
| Trade history with prices, fees, realized P&L. |
Referrals
Method | Endpoint | Description |
|
| Your referral code and commission rate |
|
| Total referrals, fees generated, earnings |
Fee Structure
All tiers pay the Hyperliquid base fee (3.5 bps). Purple Flea's markup sits on top:
Tier | Our Markup | Total Fee | Max Leverage | Max Position | Qualification |
Free | +2 bps | 5.5 bps (0.055%) | 10x | $10,000 | Default |
Pro | +1 bp | 4.5 bps (0.045%) | 25x | $100,000 | $50k+ monthly volume |
Whale | 0 bps | 3.5 bps (0.035%) | 50x | $1,000,000 | $500k+ monthly volume |
Example on a $1,000 trade:
Tier | Hyperliquid Fee | Purple Flea Markup | Total |
Free | $0.35 | $0.20 | $0.55 |
Pro | $0.35 | $0.10 | $0.45 |
Whale | $0.35 | $0 | $0.35 |
Referral System
Earn 20% of Purple Flea's fee markup on every trade made by agents you refer.
# 1. Get your referral code
curl -s https://trading.purpleflea.com/v1/referral/code \
-H "Authorization: Bearer YOUR_API_KEY" | jq '.referral_code'
# → "ref_1a2b3c4d"
# 2. Referred agent signs up with your code
curl -s -X POST https://trading.purpleflea.com/v1/auth/register \
-H "Content-Type: application/json" \
-d '{
"hl_wallet_address": "0xTheirWallet",
"hl_signing_key": "0xTheirKey",
"referral_code": "ref_1a2b3c4d"
}' | jq
# 3. They trade, you earn. Check your stats:
curl -s https://trading.purpleflea.com/v1/referral/stats \
-H "Authorization: Bearer YOUR_API_KEY" | jqExample: A referred Free-tier agent trades $10,000 in volume. Purple Flea markup = $2.00. You earn 20% = $0.40. Commissions accumulate automatically.
Hyperliquid Integration
Agent Trading executes real trades on Hyperliquid — a fully on-chain perpetual futures DEX with institutional-grade liquidity.
How it works:
You provide your Hyperliquid wallet address and API signing key at registration
Your signing key is encrypted with AES-256-GCM at rest — decrypted in-memory only when signing orders
When you open a position, Agent Trading signs a market order with your key and submits it to Hyperliquid's exchange API
Orders execute on Hyperliquid's order book with 0.5% slippage protection
Positions are held on your Hyperliquid account — you can view them in the Hyperliquid UI too
Closing a position submits a reduce-only order to Hyperliquid
Two DEXes, one API:
Main DEX: 229 crypto perpetuals (BTC, ETH, SOL, etc.)
XYZ DEX (HIP-3): 47 real-world assets (TSLA, GOLD, SPX, EUR, etc.) — trade traditional assets 24/7 as perpetual futures
Purple Flea's builder fee is attached to each order. This is how the fee markup is collected — transparently on-chain.
MCP Server
Use Agent Trading directly from Claude Desktop, Claude Code, or any MCP-compatible agent.
Claude Desktop
Add to ~/.config/Claude/claude_desktop_config.json (Linux) or ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):
{
"mcpServers": {
"trading": {
"command": "npx",
"args": ["-y", "@purpleflea/trading-mcp"],
"env": {
"TRADING_API_KEY": "sk_trade_your_key_here"
}
}
}
}Then talk to Claude naturally:
You: "What's the price of TSLA?"
You: "Go long $500 on GOLD with 10x leverage"
You: "Show my open positions"
You: "Close position pos_a1b2c3d4"Available MCP Tools
Tool | Description |
| Browse all 275+ markets by category |
| Live price for any market |
| Detailed market info — leverage, fees, examples |
| Open a leveraged long/short position |
| Close a position and realize P&L |
| View open positions with live unrealized P&L |
| Trade history with prices, fees, P&L |
| Account details, tier, volume, referral code |
| Create a new trading account |
Self-Hosting
git clone https://github.com/purple-flea/agent-trading.git
cd agent-trading
npm install
npm run dev
# API available at http://localhost:3003Commands
Command | Description |
| Start dev server with hot reload |
| Compile TypeScript |
| Run compiled server |
| Run MCP server in dev mode |
Environment Variables
Variable | Default | Description |
|
| REST API port |
| — | Required for production. Secret for AES-256-GCM encryption of signing keys |
|
| Base URL (for MCP server) |
| — | API key (for MCP server) |
Tech Stack
Runtime: Node.js + TypeScript
Framework: Hono
Database: SQLite + Drizzle ORM
Execution: Hyperliquid DEX (main) + XYZ Protocol (HIP-3 RWAs)
Protocol: MCP over stdio
Research
This project is referenced in:
"Purple Flea: A Multi-Agent Financial Infrastructure Protocol for Autonomous AI Systems"
Part of the Purple Flea Ecosystem
Purple Flea builds infrastructure for AI agents:
Agent Trading — 275+ perpetual futures markets via Hyperliquid (you are here)
Agent Casino — Provably fair gambling, 0.5% house edge
Crypto Data — 10,000+ cryptocurrency prices and market data
Finance Data — Stocks, forex, commodities, economic indicators
Referral Tracker — Cross-platform referral management
All services support crypto deposits on any chain. Swaps powered by Wagyu.xyz.
License
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityCmaintenanceEnables AI assistants to perform cryptocurrency trading analysis and execution with 38+ tools including real-time market data, technical indicators, risk management, and support for both paper trading and live execution on Hyperliquid.Last updated6MIT
- Flicense-qualityDmaintenanceAI-native cryptocurrency exchange built for autonomous agents. Register, deposit USDC, select a strategy, and trade 8 crypto pairs (BTC, ETH, SOL + more) programmatically — no KYC required. Includes sandbox with 10,000 virtual USDC for testing.Last updated
- AlicenseAqualityCmaintenanceReal-time crypto intelligence for AI agents. Technical analysis, liquidation heatmaps, sentiment, and funding rates for 50+ Hyperliquid perpetuals via x402 micropayments.Last updated151MIT

Eterna MCPofficial
Alicense-qualityAmaintenancePremium low cost execution layer for AI trading agents, with access to perpetual futures trading across 500+ pairs and $10B+ in aggregated liquidity.Last updated8MIT
Related MCP Connectors
Polymarket + Hyperliquid + macro for AI agents. 38 tools, signal backtest, SSE streaming. Free tier.
Crypto perps data for AI agents: funding rates, open interest, liquidations, order book, CVD.
No-KYC managed MCP for AI agents: sandboxed TypeScript trading SDK, isolated sub-accounts, futures.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/purple-flea/agent-trading'
If you have feedback or need assistance with the MCP directory API, please join our Discord server