Expand description
Conversion functions that translate Bybit API schemas into Nautilus instruments.
Modules§
- bool_
or_ int - Serde helper that accepts
readOnlyas either a bool or0/1integer. - masked_
secret - Serde helper that treats the masked secret literal (
"******") and empty strings asNone, preserving real values asSome. - on_
off_ bool - Serde helper for Bybit
ON/OFFstring fields that represent booleans. - opt_
bool_ as_ int - Round-trips
Option<bool>as0/1integers for Bybit request bodies that advertisereadOnlyas an integer on the wire.
Structs§
- Bybit
TpSl Params - Parsed and validated Bybit TP/SL parameters from a
SubmitOrder.paramsmap.
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
Decimalfrom a string field that might be empty. - deserialize_
optional_ decimal_ or_ zero - Deserializes a
Decimalfrom an optional string field, defaulting to zero. - deserialize_
optional_ decimal_ str - Deserializes an optional
Decimalfrom a string field. - deserialize_
string_ to_ u8 - Deserializes a
u8from 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
UnixNanostimestamp 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
isLeverageparameter (spot-only). - spot_
market_ unit - Returns the
marketUnitparameter for spot market orders. - trigger_
direction - Returns the trigger direction for stop and MIT orders.