Skip to main content

Module parse

Module parse 

Source
Expand description

Conversion functions that translate Bybit API schemas into Nautilus instruments.

Modules§

bool_or_int
Serde helper that accepts readOnly as either a bool or 0/1 integer.
masked_secret
Serde helper that treats the masked secret literal ("******") and empty strings as None, preserving real values as Some.
on_off_bool
Serde helper for Bybit ON/OFF string fields that represent booleans.
opt_bool_as_int
Round-trips Option<bool> as 0/1 integers for Bybit request bodies that advertise readOnly as an integer on the wire.

Structs§

BybitTpSlParams
Parsed and validated Bybit TP/SL parameters from a SubmitOrder.params map.

Functions§

bar_spec_to_bybit_interval
Converts a Nautilus bar aggregation and step to a Bybit kline interval.
bybit_interval_to_bar_spec
Converts a Bybit kline interval string to a Nautilus bar aggregation and step.
deserialize_decimal_or_zero
Deserializes a Decimal from a string field that might be empty.
deserialize_optional_decimal_or_zero
Deserializes a Decimal from an optional string field, defaulting to zero.
deserialize_optional_decimal_str
Deserializes an optional Decimal from a string field.
deserialize_string_to_u8
Deserializes a u8 from a string field.
extract_base_coin
Extracts the base coin from a Bybit option symbol.
extract_raw_symbol
Extracts the raw symbol from a Bybit symbol by removing the product type suffix.
get_currency
Returns a currency from the internal map or creates a new crypto currency.
get_price_str
Extracts a string value from params, accepting both string and numeric JSON values.
make_bybit_symbol
Constructs a full Bybit symbol from a raw symbol and product type.
make_venue_position_id
Constructs a venue position ID from an instrument and Bybit position index.
map_time_in_force
Maps Nautilus time-in-force to Bybit’s TIF.
nanos_to_millis
Converts an optional UnixNanos timestamp to optional milliseconds.
parse_account_state
Parses a Bybit wallet balance into a Nautilus account state.
parse_book_level
parse_bybit_order_type
Resolves a Nautilus [OrderType] from Bybit order classification fields.
parse_bybit_tp_sl_params
Parses Bybit TP/SL parameters from an optional params map.
parse_fill_report
Parses a Bybit execution into a Nautilus FillReport.
parse_funding_rate
Parses a REST funding payload into a [FundingRateUpdate].
parse_inverse_instrument
Parses an inverse contract definition into a Nautilus instrument.
parse_kline_bar
Parses a kline entry into a [Bar].
parse_linear_instrument
Parses a linear contract definition (perpetual or dated future) into a Nautilus instrument.
parse_option_instrument
Parses a Bybit option contract definition into a Nautilus [CryptoOption].
parse_order_status_report
Parses a Bybit order into a Nautilus OrderStatusReport.
parse_orderbook
Parses an order book response into [OrderBookDeltas].
parse_position_status_report
Parses a Bybit position into a Nautilus PositionStatusReport.
parse_spot_instrument
Parses a spot instrument definition returned by Bybit into a Nautilus currency pair.
parse_trade_tick
Parses a REST trade payload into a [TradeTick].
spot_leverage
Returns the isLeverage parameter (spot-only).
spot_market_unit
Returns the marketUnit parameter for spot market orders.
trigger_direction
Returns the trigger direction for stop and MIT orders.