Expand description
Shared parsing helpers that transform BitMEX payloads into Nautilus types.
Functionsยง
- clean_
reason - Strip NautilusTrader identifier from BitMEX rejection/cancellation reasons.
- convert_
contract_ quantity - Converts an optional contract-count field (e.g.
lotSize
,maxOrderQty
) into a Nautilus quantity using the previously derived contract size. - derive_
contract_ decimal_ and_ increment - Converts the BitMEX
underlyingToPositionMultiplier
into a normalized contract size and size increment for Nautilus instruments. - map_
bitmex_ currency - Maps BitMEX currency codes to standard Nautilus currency codes.
- normalize_
trade_ bin_ prices - Normalizes the OHLC values reported by BitMEX trade bins to ensure
high >= max(open, close)
andlow <= min(open, close)
. - normalize_
trade_ bin_ volume - Normalizes the volume reported by BitMEX trade bins, defaulting to zero when the exchange returns negative or missing values.
- parse_
account_ state - Parses a BitMEX margin message into a Nautilus account state.
- parse_
aggressor_ side - Maps an optional BitMEX side to the corresponding Nautilus aggressor side.
- parse_
contracts_ quantity - Converts a BitMEX contracts value into a Nautilus quantity using instrument precision.
- parse_
fractional_ quantity - Converts a fractional size into a quantity honoring the instrument precision.
- parse_
instrument_ id - Parses a Nautilus instrument ID from the given BitMEX
symbol
value. - parse_
liquidity_ side - Maps BitMEX liquidity indicators onto Nautilus liquidity sides.
- parse_
optional_ datetime_ to_ unix_ nanos - Parses the given datetime (UTC) into a
UnixNanos
timestamp. Ifvalue
isNone
, then defaults to the UNIX epoch (0 nanoseconds). - parse_
position_ side - Derives a Nautilus position side from the BitMEX
currentQty
value. - parse_
signed_ contracts_ quantity - Converts a signed BitMEX contracts value into a Nautilus quantity using instrument precision.
- quantity_
to_ u32 - Safely converts a
Quantity
into the integer units expected by the BitMEX REST API.