Skip to main content

parse_perp_instruments

Function parse_perp_instruments 

Source
pub fn parse_perp_instruments(
    meta: &PerpMeta,
    asset_index_base: u32,
) -> Result<Vec<HyperliquidInstrumentDef>, String>
Expand description

Parse perpetual instrument definitions from Hyperliquid meta response.

Hyperliquid perps follow specific rules:

  • Quote is always USD (USDC settled)
  • Price decimals = max(0, 6 - sz_decimals) per venue docs
  • Active = !is_delisted

asset_index_base controls the starting offset for asset IDs:

  • Standard perps (dex 0): base = 0
  • HIP-3 dexes: base = 100_000 + dex_index * 10_000

Delisted instruments are included but marked as inactive to support parsing historical data for instruments that may still have trading history.