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.
- Open
Order - One order from the
openOrdersinfo endpoint, as the venue actually returns it. - User
Fill - Parse a decimal string from SDK response, logging warnings on failure.
One fill from the
userFillsinfo endpoint, as the venue actually returns it.
Functions§
- cid_
to_ cloid - The cloid to place an order under
cidwith, orNoneifcidcannot be one. - cloid_
to_ cid - The client id an order placed with
cloidwas placed under: the inverse ofcid_to_cloid. - 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>. - open_
orders - Fetch every open order for
address, parsed intoOpenOrderrather than the SDK’s lossy type, which drops thecloid. - parse_
decimal - 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”).
- user_
fills - Fetch
userFillsforaddress, parsing it intoUserFillrather than the SDK’s lossy type.