HyperVaults Docs
Gate API

Assets, dexes & formatting

Asset ids, price ticks, and size decimals — get these right first

Most integration failures are formatting failures. Three rules cover almost everything. These mirror Hyperliquid's own rules — see Asset IDs and Tick and lot size for the canonical spec.

Asset ids

Every order names a numeric asset and its routing dex:

Market classassetdex
Native perpindex in the perp universe (from {"type":"meta"})0
Spot10000 + pairIndex (from {"type":"spotMeta"} universe)0
Builder perp (HIP-3)100000 + dexIndex·10000 + localIndexdexIndex

dexIndex is the position of the dex in the raw perpDexs array (element 0 is null = native). Resolve ids at runtime against the network you are trading — indices differ between mainnet and testnet (e.g. BTC is index 0 on mainnet's universe and 3 on testnet's).

The gate independently derives the dex from the asset id and checks it against the protocol's eligible set, so a mismatched dex field can't smuggle an order anywhere.

Price formatting

Prices are strings, subject to Hyperliquid's tick rules:

  • at most 5 significant figures, and
  • at most MAX_DECIMALS − szDecimals decimal places (MAX_DECIMALS = 6 for perps, 8 for spot).

Integers are always valid ("55000"). Don't strip zeros off integer prices — 55000 and 5.5e4 are not "55".

Size formatting

Sizes are strings in the base asset, rounded to the market's szDecimals (from the meta):

  • BTC (szDecimals: 5): "0.00082" ✓, "0.0008213292898" ✗ (rejected)
  • PURR (szDecimals: 0): whole coins only — "3"

Exchange minimums: $10 notional per order, $50 for a TWAP.

Two spot quirks worth knowing: spot buy fees are taken in the received token (your credited balance is slightly under the ordered size), and a szDecimals: 0 token can strand a sub-1-lot remainder that can't be sold by order.

On this page