The two coin formats
Outcome coin (@{outcomeId})
The @-prefixed coin names an outcome as a whole. The SDK builds it with outcomeCoin() and parses it with parseOutcomeCoin(). You do not use it for order placement or price lookups: allMids keys HIP-4 prices by side coin (#5160), and an @ key in allMids (such as @107) is a regular spot pair.
Side coin (#{outcomeId}{sideIndex})
The #-prefixed coin is the tradeable instrument for a specific side of an outcome. You pass it to order placement and order book queries, and it keys prices in allMids and appears in fill records. The outcome ID and side index are concatenated with no separator: #5160 means outcome 516, side 0.
Spot balances use a third prefix. Hyperliquid’s spotClearinghouseState reports an outcome side balance as +5160, so position outcome values use that form. parseSideCoin() accepts both # and +.
The
marketId field is always the outcome ID as a plain string - for example,
"516". It is not a coin string. The outcome field is the side coin like
"#5160".Asset IDs
Hyperliquid’s order wire format uses numeric asset IDs, not coin strings. The SDK computes these for you, but it’s useful to understand the formulas. HIP-4 outcome sides:Coin helper functions
Import the coin helpers from@outcome.xyz/hip4:
sideCoin(outcomeId, sideIndex)
Builds a side coin string from an outcome ID and side index.
sideAssetId(outcomeId, sideIndex)
Computes the numeric asset ID for use in order wire format.
parseSideCoin(coin)
Parses a side coin string back into its component parts.
outcomeCoin(outcomeId)
Builds the outcome-level coin string. Use side coins, not this value, for prices and orders.
Side index conventions
sideIndex is always 0 or 1. By convention:
- Side 0 is the first side - typically “Yes”, or the first named alternative (e.g. “Hypurr”)
- Side 1 is the second side - typically “No”, or the second named alternative (e.g. “Usain Bolt”)
sideSpecs in the outcome metadata and are resolved by the SDK automatically. You can read them from the typed market object: