DocsQuick Start
Back to Documentation

Quick Start Guide

Start testing with real Hyperliquid mainnet data in 5 minutes.

Why PaperExchange instead of testnet?

Hyperliquid's testnet uses fake data - prices, order books, and market conditions don't match mainnet. PaperExchange connects to real mainnet data so your strategy testing reflects actual market behavior.

1

Create an Account

Sign up for PaperExchange to get your 3-day free trial. No credit card required. Payment required after trial to continue.

2

Generate an API Key

Go to your dashboard and create an API key. Give it a descriptive name like "Trading Bot" or "Strategy Test".

Your API key will look like:

pe_AbCdEfGhIjKlMnOpQrStUvWxYz123456

Important:

Copy your API key immediately after creation. You won't be able to see it again!

3

Make Your First Request

Test your API key by fetching market prices:

Using cURL:

curl -X POST https://api.paperx.co/v1/exchanges/hyperliquid/info \
  -H "Content-Type: application/json" \
  -H "X-API-Key: pe_your_api_key" \
  -d '{"type": "allMids"}'

Using Python:

import requests

API_KEY = "pe_your_api_key"
BASE_URL = "https://api.paperx.co"

# Get all mid prices
response = requests.post(
    f"{BASE_URL}/v1/exchanges/hyperliquid/info",
    headers={"X-API-Key": API_KEY},
    json={"type": "allMids"}
)

prices = response.json()
print("BTC: $" + prices['BTC'])
print("ETH: $" + prices['ETH'])

Using JavaScript:

const API_KEY = "pe_your_api_key";
const BASE_URL = "https://api.paperx.co";

// Get all mid prices
const response = await fetch(`${BASE_URL}/v1/exchanges/hyperliquid/info`, {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "X-API-Key": API_KEY,
  },
  body: JSON.stringify({ type: "allMids" }),
});

const prices = await response.json();
console.log(`BTC: $${prices.BTC}`);
4

Place Your First Trade

Now let's place a paper trade. This example buys 0.01 BTC:

import requests

API_KEY = "pe_your_api_key"
BASE_URL = "https://api.paperx.co"

# Place a limit buy order for BTC
response = requests.post(
    f"{BASE_URL}/v1/exchanges/hyperliquid/exchange",
    headers={"X-API-Key": API_KEY},
    json={
        "action": {
            "type": "order",
            "orders": [{
                "a": 0,           # Asset index (0 = BTC)
                "b": True,        # Buy
                "p": "85000",     # Limit price
                "s": "0.01",      # Size
                "r": False,       # Not reduce-only
                "t": {"limit": {"tif": "Gtc"}}  # Good till cancel
            }]
        }
    }
)

result = response.json()
print(result)

# Check if filled
if "filled" in str(result):
    print("Order filled!")
elif "resting" in str(result):
    print("Order resting on book")
5

Check Your Position

After your trade fills, check your account state:

# Get account state
response = requests.post(
    f"{BASE_URL}/v1/exchanges/hyperliquid/info",
    headers={"X-API-Key": API_KEY},
    json={"type": "clearinghouseState"}
)

state = response.json()
print("Account Value: $" + state['marginSummary']['accountValue'])
print("Withdrawable: $" + state['withdrawable'])

# Print positions
for pos in state.get('assetPositions', []):
    p = pos['position']
    print(p['coin'] + ": " + p['szi'] + " @ " + p['entryPx'])