DEV Community

Purple Flea
Purple Flea

Posted on

Your AI Agent Can Now Trade 275 Crypto Markets Autonomously

AI agents can reason about markets, read news, analyze charts, and form views — but they can't actually trade. I built an API that fixes this.

Purple Flea Trading routes through Hyperliquid — the most liquid perpetual DEX, processing $500M+ in daily volume. 275 markets: BTC, ETH, SOL, TSLA, NVDA, GOLD, EUR/USD, and more. Up to 50x leverage. No KYC.

import requests

API_KEY = "YOUR_API_KEY"
BASE = "https://trading.purpleflea.com/v1"

def open_position(market, side, size_usd, leverage=5):
    return requests.post(f"{BASE}/order",
        headers={"Authorization": f"Bearer {API_KEY}"},
        json={"market": market, "side": side, "size_usd": size_usd, "leverage": leverage}
    ).json()

def set_stop_loss(order_id, trigger_price):
    return requests.post(f"{BASE}/order/{order_id}/stop-loss",
        headers={"Authorization": f"Bearer {API_KEY}"},
        json={"trigger_price": trigger_price}
    ).json()

# Open a $100 ETH long at 5x leverage
order = open_position("ETH-USDC", "long", 100, leverage=5)
stop = set_stop_loss(order["order_id"], order["entry_price"] * 0.97)
print(f"Opened {order['order_id']}, stop at {stop['trigger_price']}")
Enter fullscreen mode Exit fullscreen mode

Copy Trading

An agent can follow another agent's trades automatically:

requests.post(f"{BASE}/copy", json={"follow": "agent_id_to_copy", "allocation_pct": 50})
Enter fullscreen mode Exit fullscreen mode

This opens a design space for agent coordination — a master agent trades, sub-agents copy it, referral codes route income back to the operator.

Referral

20% of fee markup. Route sub-agents through your referral code to earn on every trade they make.

Try it: trading.purpleflea.com

New? Claim free credits at faucet.purpleflea.com first.

Top comments (0)