Expand description
Shared utilities for Hyperliquid execution clients (perps and spot).
Contains parsing helpers and stream wrappers used by both
HyperliquidClient (perps) and HyperliquidSpotClient.
Error mapping is in the error module.
Structs§
- Cancel
OnDrop Stream - Stream wrapper that cancels background tasks when dropped.
Functions§
- cid_
to_ cloid - Convert a ClientOrderId to SDK cloid format (UUID) if valid.
- instrument_
to_ perp_ coin - Extract coin name from perp instrument (e.g., “BTC-USD-PERP” -> “BTC”).
- instrument_
to_ spot_ coin - Extract coin pair from spot instrument (e.g., “PURR-USDC-SPOT” -> “PURR/USDC”).
- is_
spot_ coin - Check if a Hyperliquid coin name is a spot pair (contains ‘/’).
- map_tif
- Map rustrade TimeInForce to Hyperliquid TIF string.
- millis_
to_ datetime - Convert milliseconds timestamp to
DateTime<Utc>. - parse_
decimal - Parse a decimal string from SDK response, logging warnings on failure.
- parse_
side - Parse SDK side string to rustrade Side.
- perp_
coin_ to_ instrument - Build perp instrument name from Hyperliquid coin name (e.g., “BTC” -> “BTC-USD-PERP”).
- round_
to_ 5_ sig_ figs - Round a price to 5 significant figures (Hyperliquid requirement).
- spot_
coin_ to_ instrument - Build spot instrument name from Hyperliquid coin pair (e.g., “PURR/USDC” -> “PURR-USDC-SPOT”).