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 and settlement are the dex’s collateral token, so notional, PnL and fees are in the currency the account holds (USDC on the standard dex). The venue labels prices as USD.
- 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.