BlogDeveloper

How to Build a Trading Terminal on Hyperliquid

Build a Hyperliquid trading terminal: charts, order book, trades and order entry, plus 1-second candles and older chart history. Tested on both APIs.

HydromancerTeam
How to Build a Trading Terminal on Hyperliquid

A trading terminal is the screen active traders live in: several charts, the order book, the tape of trades, positions, and an order ticket with hotkeys.

On Hyperliquid you don't need your own exchange behind it. Orders go into Hyperliquid's shared order books, so a terminal can focus on being faster and nicer to use than Hyperliquid's own app.

Why build it on Hyperliquid

• Active traders want more than the default app. Several charts side by side, hotkeys, their own layout. They trade often, so they notice every click.
• Same order books, same depth. Every order your terminal sends lands in the same books as Hyperliquid's own app, at the same prices. You don't run an exchange or need anyone's permission.
• It's fast. Hyperliquid's docs give a median 0.2 seconds from sending an order to seeing it on-chain, for software running close to Hyperliquid's servers; a user's browser further away sees more delay.
• Traders pay for it. In Flowscan's ranking on 2 October 2026, Insilico (multi-chart layouts and programmable hotkeys) had earned $4.10M in builder fees on $41.41B of routed trading, and Axiom $2.44M (top builders by revenue).

Each panel of a terminal needs something different from the API. The chart is where the two APIs differ most, so that's what we built and timed on both, on 31 October 2026. Code blocks are for developers; everyone else can read past them. Flowscan's terminal (flowscan.xyz) runs on the same Hydromancer data this guide uses, though it shows markets rather than placing orders. The snippets are prototypes that prove each step works, not an app to copy as is; the request bodies and URLs are exact.

Panel Hyperliquid's free API What Hydromancer adds
Live chartcandle stream, 1m and up1s, 15s and 30s candles
Chart historyAbout the 5,000 most recent candles per intervalOlder 1m candles
Order bookl2Book and bbo streamsOrder-by-order (L4) book
Trades tapetrades streamLast 24 hours by time, for backfill
Orders and positionsUser streams, /exchangeMany users in one stream

The chart

Most of a terminal's chart work runs fine on the official API. The candle subscription streams live candles, and candleSnapshot loads history. Two things are harder: how far back the history goes, and charts shorter than a minute.

History a trading terminal opens with: asked for 7 days of BTC 1-minute candles, Hyperliquid's API returned the last 3.5 days (5,000 candles) and Hydromancer's API all 7 days. For the trades tape, Hyperliquid's recentTrades returns the last 10 trades and Hydromancer returns the last 24 hours.

A week of 1-minute candles comes back half full

Hyperliquid API

One request:

code
import time, requests

now, day = int(time.time() * 1000), 86400000
req = {"coin": "BTC", "interval": "1m",
       "startTime": now - 7 * day, "endTime": now}
c = requests.post("https://api.hyperliquid.xyz/info",
                  json={"type": "candleSnapshot", "req": req}).json()
print(len(c), "candles, covering",
      round((now - c[0]["t"]) / day, 1), "of 7 days")
code
5015 candles, covering 3.5 of 7 days

Hyperliquid keeps about the 5,000 most recent candles per interval, so a 1-minute chart stops about three and a half days back, and paging doesn't help. To go further back on Hyperliquid alone, rebuild the bars yourself from its S3 fill archive (node_fills_by_block); the archive has no candle files.

Hydromancer API

candleSnapshot returns up to 5,000 candles per page and keeps going back, so the prototype pages until it reaches now:

code
import os, time, requests

H = {"Authorization": "Bearer " + os.environ["HYDROMANCER_API_KEY"]}
now, day = int(time.time() * 1000), 86400000
candles, start = [], now - 7 * day
while start < now:
    req = {"coin": "BTC", "interval": "1m",
           "startTime": start, "endTime": now}
    page = requests.post("https://api.hydromancer.xyz/info", headers=H,
                         json={"type": "candleSnapshot", "req": req}).json()
    candles += page
    start = page[-1]["t"] + 60000 if len(page) == 5000 else now
print(len(candles), "candles, covering",
      round((now - candles[0]["t"]) / day, 1), "of 7 days")
code
10076 candles, covering 7.0 of 7 days
Side by side
Hyperliquid API Hydromancer API
What you get3.5 of 7 daysAll 7 days
Time0.3 s0.9 s
Rate-limit cost103 weight of 1,200/min per IP60 points of 20,000/min (Growth plan)

Hyperliquid answered faster, because it returned half the chart. Hydromancer took three pages to return the whole week.

1-second candles: a 422 on Hyperliquid, 598 rows on Hydromancer

Hyperliquid API

candleSnapshot rejects "interval": "1s" with a 422 error, but you can build the candles yourself: the trades stream sends every trade, so a terminal can group them into one-second bars as they arrive (pip install websockets):

code
import json, time
from websockets.sync.client import connect

bars, start = {}, time.time()
with connect("wss://api.hyperliquid.xyz/ws") as ws:
    ws.send(json.dumps({"method": "subscribe", "subscription":
                        {"type": "trades", "coin": "BTC"}}))
    while time.time() < start + 60:
        m = json.loads(ws.recv())
        for t in m["data"] if m["channel"] == "trades" else []:
            px, sec = float(t["px"]), t["time"] // 1000
            if sec >= start:                  # skip trades sent on subscribe
                o, h, l, c = bars.get(sec, (px, px, px, px))
                bars[sec] = (o, max(h, px), min(l, px), px)
print(len(bars), "one-second candles in 60 seconds; last:", bars[max(bars)])
code
32 one-second candles in 60 seconds; last: (77562.0, 77562.0, 77562.0, 77562.0)

It works, but only from the moment you connect: there's no history, so a trader opening the chart sees an empty screen that fills one second at a time. And a second with no trades comes with no bar (in one minute of BTC, only 32 seconds had a trade), so your chart fills it with the previous close.

Hydromancer API

1-second, 15-second and 30-second candles are a normal candleSnapshot interval, with history:

code
import os, time, requests

KEY = os.environ["HYDROMANCER_API_KEY"]
now = int(time.time() * 1000)
req = {"coin": "BTC", "interval": "1s",
       "startTime": now - 600000, "endTime": now}
c = requests.post("https://api.hydromancer.xyz/info",
                  json={"type": "candleSnapshot", "req": req},
                  headers={"Authorization": "Bearer " + KEY}).json()
print(len(c), "one-second candles; last close", c[-1]["c"])
code
598 one-second candles; last close 77550.00
Side by side
Hyperliquid API Hydromancer API
What you getBars from the moment you connect, none for quiet seconds10 minutes of history, a bar for every second
Time61 s (listens live by design)0.2 s
Rate-limit costnone (live stream)20 points of 20,000/min (Growth plan)

Ten minutes is up to 600 candles; Hydromancer returns a candle for quiet seconds too, with zero trades. For scalpers, that's the difference between a chart that matches the tape and one that hides a whole minute in one bar. For backtesting, Reservoir, Hydromancer's free archive, keeps daily 1-second candle files back to August 2025 (you pay only AWS download charges).

The order book and the tape

Hyperliquid API

l2Book (20 levels a side) and bbo cover a standard price ladder, and the trades stream fills the tape while the terminal is open. Two gaps: a user who opens the terminal mid-session gets only the last 10 trades from recentTrades, and the ladder shows size per price, not individual orders.

Hydromancer API

The L4 book shows each resting order and who placed it, so a terminal can flag one large order instead of a thick price level. tradesByTime fills the tape with the last 24 hours when the screen opens. Send {"type": "tradesByTime", "coin": "BTC", "startTime": <ms>}, then page by sending the reply's cursor in place of startTime while hasMore is true, 2,000 trades at a time.

The L4 reply is binary: a short header, then each market as compressed MessagePack, so it needs pip install msgpack zstandard. Here is BTC's book and its largest resting order:

code
import os, struct, msgpack, requests, zstandard

H = {"Authorization": "Bearer " + os.environ["HYDROMANCER_API_KEY"]}
body = requests.post("https://api.hydromancer.xyz/info", headers=H,
                     json={"type": "l4Book", "coins": ["BTC"]}).content
# header: market count (4 bytes), block height (8), time (8); then
# each market as [length (4 bytes)][zstd-compressed msgpack]
(length,) = struct.unpack_from("<I", body, 20)
blob = body[24:24 + length]
dz = zstandard.ZstdDecompressor()
raw = dz.decompress(blob, max_output_size=length * 20)
coin, bids, asks = msgpack.unpackb(raw)
big = max(bids + asks, key=lambda o: float(o[2]))  # o = [user, px, sz, oid]
print(coin, len(bids), "bids,", len(asks), "asks; largest:", big)
code
BTC 41256 bids, 21230 asks; largest:
['0xf5a5…1286', '75519', '307.71544', 593104552255]

Each order is [user, price, size, order id]. The book refreshes every second, and the endpoint allows 20 requests per 5 minutes, so load it when the screen opens rather than in a loop.

The L4 book, tradesByTime and sub-minute candles are Hydromancer endpoints, not part of Hyperliquid's own API. Orders still go to Hyperliquid.

Side by side

Hyperliquid API Hydromancer API
Price ladder (20 levels)Yes, liveYes
Every single order, with its ownerOnly with your own nodeYes (L4 book)
Tape when the terminal opensLast 10 tradesLast 24 hours, 2,000 per page
Live tapeYesYes

The order flow dashboard guide tests the tape backfill and covers the order-by-order book in depth; the heatmap guide draws resting liquidity over time.

Orders, positions and hotkeys

Order entry always goes to Hyperliquid's /exchange, signed by an API wallet the user approves. The ticket can offer every order type Hyperliquid runs natively: market, limit, stop and take-profit (market or limit), scale orders across a range, TWAP, and the options post-only, IOC and reduce-only (order types). Leverage is set per market with updateLeverage before the order. Hotkeys are your own code; the useful API detail is that a bulk order or bulk cancel goes in one signed request, so "cancel all" is one call. Each order still counts toward the account's request budget.

Put your builder code on the order ticket and on every hotkey, so each trade a user fires off pays your terminal a small fee.

Swing traders or scalpers?

Build for 1-minute charts and up and Hyperliquid's free API is the whole stack: candles, a 20-level book, the live tape, order entry. Scalpers ask for the rest: second-by-second candles, a week or more of 1-minute history, and a tape that's already full when they open the screen.

FAQ

Does Hyperliquid have 1-second candles?

Not as a request: candleSnapshot with "interval": "1s" returns a 422 error. You can build them live from the trades stream, without history. Hydromancer serves 1s, 15s and 30s candles with history, and Reservoir has daily 1-second candle files.

How far back do Hyperliquid's candles go?

Hyperliquid keeps about the 5,000 most recent candles per interval: about three and a half days of 1-minute candles, about seven months of hourly ones. In our test, a week of 1-minute candles came back half full.

Can a trading terminal earn money on Hyperliquid?

Yes, through builder codes on the orders it sends. Insilico and Axiom both rank in the top 12 builders by revenue.

• BBO vs L2Book vs L4Book: Hyperliquid orderbook types
• How to build a Hyperliquid orderbook heatmap
• Hyperliquid data feeds: every real-time stream
• Hyperliquid tick size and lot size

Sources

- Hyperliquid docs: Info endpoint, Subscriptions, Builder codes
- Hydromancer docs: Trading frontend guide, candleSnapshot

Continue