How to use CCXT with Hyperliquid (Python)

Updated Nov 17, 2026 · 6 min read

Install ccxt, call ccxt.hyperliquid() and read Hyperliquid markets with no key. To trade, pass your main address and an API wallet key. Symbols and gotchas, tested with ccxt 4.5.93 on Nov 17, 2026.

How do you use CCXT with Hyperliquid in Python? Run pip install ccxt, create ccxt.hyperliquid() and call the usual unified methods: load_markets, fetch_ohlcv, fetch_funding_rate and fetch_order_book work with no key. To trade, pass your main account address as walletAddress and an API wallet’s private key as privateKey. Everything below ran with ccxt 4.5.93 on Python 3.12 on Nov 17, 2026.

Key takeaways

  • Perps are named like BTC/USDC:USDC; HIP-3 perps like XYZ-TSLA/USDC:USDC.
  • Market orders need a price: CCXT sends an IOC limit 5% through it.
  • Orders under $10 are rejected, and REST calls share 1,200 weight a minute per IP.
  • CCXT 4.5.93 defaults to builderFee: True at 0.01%; set it to False if you don’t want it.

Set up CCXT for Hyperliquid

CCXT is an MIT-licensed library with more than 100 exchanges in Python, JavaScript/TypeScript, PHP, C#, Go and other languages. Its README lists Hyperliquid as a CCXT Certified DEX with CCXT Pro (WebSocket) support. ccxt 4.5.93 requires Python 3.10 or newer: create a virtual environment and run pip install ccxt. To trade, authorize an API wallet from your main account (API wallets) and start on testnet with ex.set_sandbox_mode(True).

Read Hyperliquid market data (no key)

This script loads markets, prints the BTC perp’s limits, pulls three hourly candles, current funding, the ETH order book and the open positions of one of the accounts behind the Hyperliquidity Provider (HLP) vault (vaults and HLP).

python
# Read-only CCXT calls against Hyperliquid mainnet. No keys, no orders.
from datetime import datetime, timezone
import ccxt

# Public endpoints need no wallet or key. Load main perps, spot and only the xyz HIP-3 dex:
# every extra HIP-3 dex is one more weight-20 request against the 1,200-per-minute IP budget.
ex = ccxt.hyperliquid({
    "options": {"fetchMarkets": {"types": ["swap", "spot", "hip3"], "hip3": {"dexes": ["xyz"]}}},
})
print("ccxt", ccxt.__version__, "| pulled", datetime.now(timezone.utc).strftime("%Y-%m-%d %H:%M UTC"))

markets = ex.load_markets()
perps = [m for m in markets.values() if m["swap"]]
spot = [m for m in markets.values() if m["spot"]]
hip3 = [m for m in perps if m["info"].get("hip3")]
xyz = [m for m in hip3 if m["symbol"].startswith("XYZ-")]
print("markets:", len(markets), "| perps:", len(perps), "| of which HIP-3:", len(hip3),
      "| xyz:", len(xyz), "| spot:", len(spot))

btc = markets["BTC/USDC:USDC"]
print("BTC perp:", btc["symbol"], "| id", btc["id"], "| max leverage", btc["limits"]["leverage"]["max"],
      "| min cost", btc["limits"]["cost"]["min"], "| amount step", btc["precision"]["amount"])
print("xyz examples:", [m["symbol"] for m in xyz[:4]])

candles = ex.fetch_ohlcv("BTC/USDC:USDC", "1h", limit=3)
for ts, o, h, l, c, v in candles:
    print("1h", datetime.fromtimestamp(ts / 1000, timezone.utc).strftime("%H:%M"), "close", c)

fr = ex.fetch_funding_rate("BTC/USDC:USDC")
print("BTC funding (hourly):", fr["fundingRate"], "| interval", fr.get("interval"))
rates = ex.fetch_funding_rates(["ETH/USDC:USDC", "SOL/USDC:USDC"])
for sym, r in rates.items():
    print(" ", sym, "funding", r["fundingRate"])

book = ex.fetch_order_book("ETH/USDC:USDC", limit=5)
print("ETH best bid", book["bids"][0][0], "| best ask", book["asks"][0][0])

# Positions of any public address, here one of the HLP vault's child accounts
hlp_child = "0x010461c14e146ac35fe42271bdc1134ee31c703a"
pos = ex.fetch_positions(params={"user": hlp_child})
print("HLP child open positions:", len(pos))
for p in pos[:3]:
    print(" ", p["symbol"], p["side"], "| notional", round(p["notional"] or 0), "| leverage", p["leverage"])
CallWhat came back
load_markets (perps, spot, xyz only)729 markets: 380 perps (235 main, 145 xyz) and 349 spot
BTC/USDC:USDC limitsMax leverage 40x, minimum cost $10, size step 0.00001 BTC
fetch_funding_rate BTC0.00125% per hour (interval 1h)
fetch_positions (HLP account)177 open positions
Output of the script above at 17:51 UTC on Nov 17, 2026, ccxt 4.5.93. Market data only; not a forecast or a trade signal.

How CCXT names Hyperliquid markets

MarketCCXT symbolCCXT idHyperliquid name
Main perpBTC/USDC:USDC0BTC
xyz HIP-3 perpXYZ-TSLA/USDC:USDC110001xyz:TSLA
Spot (canonical)PURR/USDCPURR/USDCPURR/USDC
Spot (indexed)HYPE/USDC@107@107
Read from ccxt 4.5.93 market objects at 19:22 UTC on Nov 17, 2026. Use the CCXT symbol in method calls; the id is what goes on the wire.

By default CCXT loads spot, main perps and up to 10 HIP-3 dexes. To load only the dexes you trade, set options.fetchMarkets.hip3.dexes, as the script does. More in what is HIP-3.

Hyperliquid gotchas in CCXT

  • Main address, not the API wallet’s. Hyperliquid’s docs say API wallets only sign; querying the API wallet’s own address returns an empty result.
  • Market orders are IOC limits. Hyperliquid’s order action takes a limit (Gtc, Ioc or Alo) or a trigger. CCXT raises an error on a market order without a price, then applies defaultSlippage (5%) and sends IOC; postOnly becomes Alo.
  • Limits. Orders below $10 are rejected. Most info calls weigh 20 of the 1,200-a-minute IP budget, and each HIP-3 dex adds requests to load_markets.
  • Builder fee and referrer. When credentials are set, CCXT 4.5.93 approves its builder address for up to 0.01%, attaches it to orders at 0.01% (1 basis point) and sends the referral code CCXT1. With builderFee: False the builder is approved and attached at 0%.
  • Nonces are per signer. Hyperliquid recommends one API wallet per trading process.

Place a limit order (dry-run guard)

The script reads the testnet book, prices a post-only buy 5% under the mid and sizes it at about $12. With DRY_RUN=1, the default, it prints the order and stops. See Hyperliquid order types.

python
# Post-only limit buy on Hyperliquid TESTNET with CCXT, guarded by DRY_RUN.
# walletAddress = your MAIN account address; privateKey = the key of an API wallet that signs for it.
import os
import ccxt

DRY_RUN = os.getenv("DRY_RUN", "1") == "1"   # set DRY_RUN=0 to actually send

ex = ccxt.hyperliquid({
    "walletAddress": os.getenv("HL_MAIN_ADDRESS", ""),   # main account, NOT the API wallet address
    "privateKey": os.getenv("HL_API_WALLET_KEY", ""),    # API wallet private key
    "options": {
        "builderFee": False,                              # see "Builder fee" below
        "fetchMarkets": {"types": ["swap"]},              # main perps only
    },
})
ex.set_sandbox_mode(True)                                 # testnet: api.hyperliquid-testnet.xyz

symbol = "ETH/USDC:USDC"
ex.load_markets()
book = ex.fetch_order_book(symbol, limit=5)
mid = (book["bids"][0][0] + book["asks"][0][0]) / 2

price = float(ex.price_to_precision(symbol, mid * 0.95))     # 5% under mid, rests on the book
notional = 12                                                # exchange minimum is $10
amount = float(ex.amount_to_precision(symbol, notional / price))
params = {"postOnly": True}                                  # ALO: maker or cancel

print(f"testnet mid {mid:.2f} -> limit buy {amount} ETH @ {price} (~${amount * price:.2f}) {params}")
if DRY_RUN:
    print("DRY_RUN: order not sent")
else:
    order = ex.create_order(symbol, "limit", "buy", amount, price, params)
    print("sent:", order["id"], order["status"])

Not executed for this guide

Or run the rule on Senpi

CCXT runs wherever your Python runs, so the server, keys and restarts are yours. On Senpi, a strategy you confirm runs as code on Senpi’s runtime, and by default no AI model makes live trading decisions. Each strategy trades from its own strategy wallet; the agent holds no key and cannot withdraw.

Strategies built from a rule or a template carry the Dynamic Stop-Loss (DSL), a stop that ratchets up as the trade gains, from the first fill. Senpi doesn’t run backtests; Simulations, paper trading with simulated money, are coming.

Does CCXT support Hyperliquid?

Yes. ccxt 4.5.93 (Nov 17, 2026) supports Hyperliquid spot, perps and HIP-3 perps, and its README lists it as CCXT Certified with WebSocket support.

What is the CCXT symbol for Hyperliquid BTC perps?

BTC/USDC:USDC. HIP-3 markets add the dex prefix, for example XYZ-TSLA/USDC:USDC for xyz:TSLA.

Which private key does CCXT need for Hyperliquid?

An API wallet’s private key as privateKey, with your main account address as walletAddress.

Why does CCXT say market orders require a price on Hyperliquid?

Hyperliquid’s order API has no market type. CCXT sends an IOC limit at your price plus or minus the slippage setting, 5% by default.

Sources: ccxt 4.5.93 on PyPI and its python/ccxt/hyperliquid.py source (tag v4.5.93), the CCXT README on GitHub; Hyperliquid docs (rate limits, nonces and API wallets, exchange endpoint, builder codes); the public Hyperliquid info API. All checked and run Nov 17, 2026.

This is educational material, not financial advice. Leveraged perps can lose money quickly.

Skip the server

Describe the rule and Senpi runs it on its runtime, with a stop from the first fill.

Try Senpi free
Share

Related articles