Module parse

Module parse 

Source
Expand description

Conversion helpers that translate Bybit API schemas into Nautilus instruments.

Functions§

bar_spec_to_bybit_interval
Converts a Nautilus bar aggregation and step to a Bybit kline interval.
deserialize_decimal_or_zero
Deserializes a Decimal from a string field that might be empty. Handles Bybit’s edge case where empty string “” becomes Decimal::ZERO.
deserialize_optional_decimal
Deserializes an optional Decimal from a string field. Returns None if the string is empty or “0”, otherwise parses to Decimal.
deserialize_optional_decimal_or_zero
Deserializes a Decimal from an optional string field, defaulting to zero. Handles Bybit’s edge cases: None, empty string “”, or “0” all become Decimal::ZERO.
deserialize_string_to_u8
Deserializes a u8 from a string field.
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.
make_bybit_symbol
Constructs a full Bybit symbol from a raw symbol and product type.
parse_account_state
Parses a Bybit wallet balance into a Nautilus account state.
parse_fill_report
Parses a Bybit execution into a Nautilus FillReport.
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 option instrument.
parse_order_status_report
Parses a Bybit order into a Nautilus OrderStatusReport.
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.