HIP-4 API: read and trade Hyperliquid outcome markets
Three public POST requests to https://api.hyperliquid.xyz/info return every live HIP-4 market: outcomeMeta lists them, outcomeTemplates holds their wording and spotMetaAndAssetCtxs carries prices and volume.
Reads go to POST https://api.hyperliquid.xyz/info with Content-Type: application/json, with no key. Signed writes go to /exchange. The requests are documented on Hyperliquid's info endpoint page. Responses below are trimmed examples from markets that have since settled.
List every market
{"type": "outcomeMeta"}
{
"outcomes": [
{
"outcome": 27037,
"name": "template:sportsContestWinner",
"description": "competition:NBA|participantA:Detroit Pistons|participantB:Washington Wizards|resolutionDeadline:20261117-0000|scheduledStart:20261110-0000|shortNameA:DET|shortNameB:WAS|...",
"sideSpecs": [{"name": "template:{shortNameA}"}, {"name": "template:{shortNameB}"}],
"quoteToken": "USDC",
"venue": "out",
"deployerFeeScale": "1.0"
},
{
"outcome": 30011,
"name": "Recurring",
"description": "class:priceBinary|underlying:BTC|expiry:20261110-0600|targetPrice:74456|period:1d",
"sideSpecs": [{"name": "Yes"}, {"name": "No"}],
"quoteToken": "USDC"
}
],
"questions": [
{"question": 620, "name": "template:sportsContestResult", "fallbackOutcome": 29101, "namedOutcomes": [29102, 29103, 29104], "settledNamedOutcomes": []}
],
"deployers": [{"deployer": "0x0c46...819e", "venue": "out", "subDeployers": ["..."]}]
}
Not every record is a market you can trade:
- Question fallbacks. Every question gets an extra outcome with description
other, namedtemplate fallback, orRecurring Fallbackon Hyperliquid's own question. Leave them out of market counts. A question with N named outcomes uses N + 1 records. - Records with no
venue. These are Hyperliquid's own daily markets, not another deployer. - Questions. A question groups outcomes where exactly one settles Yes. Group outcomes under their question before you count markets.
To follow new and settled markets without polling, subscribe to {"type": "outcomeMetaUpdates"}, which sends outcomeCreated and outcomeSettled events, per the WebSocket subscriptions page.
Turn a record into readable text
Template markets keep their wording in {"type": "outcomeTemplates"}.
{
"id": "sportsContestWinner",
"role": {"standaloneOutcome": {"sideNames": ["{shortNameA}", "{shortNameB}"]}},
"name": "{competition} {stage}: {participantA} v {participantB}",
"keywords": [["competition", "string"], ["participantA", "string"], ["scheduledStart", "dateTime"], "..."]
}
- Strip
template:from the outcome'snameto get the template ID. - Split
descriptionon|, then split each pair on the first colon only. Inperp:xyz:SPCX, the value isxyz:SPCX. - For an outcome inside a question, start from the question's fields and add the child's. Child 29104's own description is only
participant:Iceland. - Fill the template, side names included.
Outcome 27037 becomes "NBA Regular Season: Detroit Pistons v Washington Wizards", with sides DET and WAS. Daily markets such as 30011 use no template. Read their class (priceBinary or priceBucket) with the rules on the contract specifications page.
On sports markets, scheduledStart is the game time and resolutionDeadline can be a week later. Don't show the deadline as the start.
Coin and asset IDs
Each side of an outcome has one number, encoding = 10 × outcome + side, with side 0 or 1, per the asset IDs page. It appears in three forms.
| Use | Format | Outcome 27037, side 0 | Side 1 |
|---|---|---|---|
| Coin in info requests and trades | #<encoding> |
#270370 |
#270371 |
| Token in balances | +<encoding> |
+270370 |
+270371 |
| Asset in signed orders | 100000000 + encoding |
100270370 |
100270371 |
Prices and volume
{"type": "spotMetaAndAssetCtxs"}
The response is spot metadata, then a list of contexts. Outcome sides sit among ordinary spot pairs, so find them by coin, never by position.
{"coin": "#270370", "midPx": "0.81568", "markPx": "0.81593", "prevDayPx": "0.82174",
"dayNtlVlm": "264301.70", "dayBaseVlm": "324832.0", "circulatingSupply": "34679.0"}
midPx is the raw midpoint of the book, not a chance. On a thin book it misleads: stub orders near 0.01 and 0.99 put it at 0.50. hip4.io's chance is the newer of the last trade and the midpoint of a book at most 0.10 wide, kept inside the best bid and ask, and shown as missing when the book can't back it. {"type": "allMids"} is cheaper, weight 2 against 20 per the rate limits page, but it fills empty books with a fallback such as 0.5, so it can't tell you a price is real.
Order book, trades and candles
The spot requests work with the # coin. Markets expire, so take a current coin from outcomeMeta.
{"type": "l2Book", "coin": "#<encoding>"}
The first list is bids, the second asks. Yes and No share one merged book, so buying Yes at p is the same order as selling No at 1 − p, and the other side's book mirrors this one.
{"type": "recentTrades", "coin": "#<encoding>"}returns only the last 10 trades.{"type": "candleSnapshot", "req": {"coin": "#<encoding>", "interval": "1d", "startTime": <ms>, "endTime": <ms>}}returns candles. Candlevis contracts, not dollars.
The public info API has no market-wide trade history beyond those 10 trades. Hydromancer runs an archive of every HIP-4 fill and order book. Running a node is the other way.
How a market settled
{"type": "settledOutcome", "outcome": 29900}
{
"spec": {"outcome": 29900, "name": "template:binaryPrice", "venue": "out", "deployerFeeScale": "1.0", "...": "..."},
"settleFraction": "1.0",
"details": "template"
}
settleFraction is what one Yes paid, from 0 to 1. No paid the rest. Hyperliquid's daily markets put the settlement price in details, such as "price:86.5664". Deployer markets may return only "template". Hyperliquid's 14 August 2026 announcement says settlement details are pruned from the chain's state, so store them yourself if you need them later. outcomeMeta drops settled markets.
Traps in the data
- Every trade appears twice. Each fill shows up on both sides, with the same hash, time and size, swapped users, prices that add up to 1, and different
tidvalues. Deduplicating bytidkeeps both. Hash, time, size and the swapped pair identify a mirrored pair, but they are not a documented unique key. - Adding both sides' volume gives contracts, not dollars.
dayNtlVlmon DET plus WAS equalsdayBaseVlm, the contract count, because the two prices add up to 1. One side alone is not reliable cash volume either, since a fill can be a trade or a newly minted Yes and No pair. How we count volume has the details. totalSupplyis not open interest. It reads the same huge number on every outcome side, close to 2^64 ÷ 100,000.circulatingSupplymatches on both sides of a standalone market but differs on most question outcomes, because negate turns No on one outcome into Yes on the others.- Fallbacks and daily markets in counts. Filter
template fallbackandRecurring Fallback, and don't label venue-less records with a deployer.
Place an order, split, merge or negate
Writes go to POST https://api.hyperliquid.xyz/exchange as signed actions, per the exchange endpoint page. Hyperliquid's official SDKs handle signing.
Orders use the normal order action with a set to the outcome asset, 100000000 + encoding. b is buy, p price and s size. For a limit order, t is {"limit": {"tif": "Gtc"}}, with tif one of Gtc, Ioc or Alo. An optional builder object names an app's address and its fee f in tenths of a basis point, so f: 100 is 0.1%. Fees are on the fees page.
Outcome operations use the userOutcome action:
| Operation | Payload | What it does |
|---|---|---|
splitOutcome |
{"outcome": Number, "amount": String} |
X USDC becomes X Yes and X No |
mergeOutcome |
{"outcome": Number, "amount": String or null} |
X Yes and X No become X USDC. null merges the most you can |
mergeQuestion |
{"question": Number, "amount": String or null} |
X Yes of every outcome in a question becomes X USDC |
negateOutcome |
{"question": Number, "outcome": Number, "amount": String} |
X No on one outcome becomes X Yes on every other outcome in the question |
Holders of No on different outcomes of one question can use negate and merge to get USDC back before the question settles, per the HIP-4 page. Contracts on HyperEVM can send the same four operations through CoreWriter action 17, per the HyperCore interaction page. Listing and settling markets use outcomeDeploy actions, covered on deployers.
Terms used on this page
| Term | Meaning |
|---|---|
| Merged book | One order book for both sides of an outcome. Buying Yes at p equals selling No at 1 − p |
settleFraction |
What one Yes pays at settlement, from 0 to 1. No pays 1 − settleFraction |
| Other fallback | The extra outcome every template question gets, described as other |
| Negate | Turns No on one outcome into Yes on every other outcome of the same question |
deployerFeeScale |
A market's fee multiplier from 0 to 10. Traders pay the base fee times scale + max(scale, 1) |
| Encoding | 10 × outcome + side, the number behind every coin, token and asset ID |
Other teams publish APIs on top of HIP-4. One is Totalis's Combo API for multi-leg positions, described on combos.