Expand description
Parsing utilities that convert OKX payloads into Nautilus domain models.
Functions§
- bar_
spec_ as_ okx_ channel - Converts a Nautilus bar specification into the matching OKX candle channel.
- bar_
spec_ as_ okx_ mark_ price_ channel - Converts Nautilus bar specification to OKX mark price channel.
- bar_
spec_ as_ okx_ timeframe - Converts Nautilus bar specification to OKX timeframe string.
- deserialize_
empty_ string_ as_ none - Deserializes an empty string into
None. - deserialize_
empty_ ustr_ as_ none - Deserializes an empty [
Ustr] intoNone. - deserialize_
optional_ string_ to_ u64 - Deserializes an optional numeric string into
Option<u64>. - deserialize_
string_ to_ u64 - Deserializes a numeric string into a
u64. - deserialize_
target_ currency_ as_ none - Deserializes a string into
Option<OKXTargetCurrency>, treating empty strings asNone. - deserialize_
vip_ level - Deserializes an OKX VIP level string into
OKXVipLevel. - okx_
bar_ type_ from_ timeframe - Constructs a properly formatted BarType from OKX instrument ID and timeframe string. This ensures the BarType uses canonical Nautilus format instead of raw OKX strings.
- okx_
channel_ to_ bar_ spec - Converts OKX WebSocket channel to bar specification if it’s a candle channel.
- okx_
instrument_ type - Returns the
OKXInstrumentTypethat corresponds to the supplied [InstrumentAny]. - okx_
instrument_ type_ from_ symbol - Parses
OKXInstrumentTypefrom an instrument symbol. - okx_
timeframe_ as_ bar_ spec - Converts OKX timeframe string to Nautilus bar specification.
- parse_
account_ state - Errors
- parse_
aggressor_ side - Parses OKX side to Nautilus aggressor side.
- parse_
candlestick - Parses an OKX historical candlestick record into a Nautilus [
Bar]. - parse_
client_ order_ id - Parses a Nautilus client order ID from the given OKX
clOrdIdvalue. - parse_
execution_ type - Parses OKX execution type to Nautilus liquidity side.
- parse_
fee - Converts a textual fee amount into a [
Money] value. - parse_
fee_ currency - Parses OKX fee currency code, handling empty strings.
- parse_
fill_ report - Parses an OKX transaction detail into a Nautilus
FillReport. - parse_
funding_ rate_ msg - Parses an
OKXFundingRateMsginto a [FundingRateUpdate]. - parse_
futures_ instrument - Parses an OKX futures instrument definition into a Nautilus crypto future.
- parse_
index_ price_ update - Parses an OKX index ticker record into a Nautilus [
IndexPriceUpdate]. - parse_
instrument_ any - Parses an OKX instrument definition into a Nautilus instrument.
- parse_
instrument_ id - Parses a Nautilus instrument ID from the given OKX
symbolvalue. - parse_
mark_ price_ update - Parses an OKX mark price record into a Nautilus [
MarkPriceUpdate]. - parse_
message_ vec - Parses vector messages from OKX WebSocket data.
- parse_
millisecond_ timestamp - Converts a millisecond-based timestamp (as returned by OKX) into
[
UnixNanos]. - parse_
option_ instrument - Parses an OKX option instrument definition into a Nautilus option contract.
- parse_
order_ status_ report - Parses an OKX order history record into a Nautilus [
OrderStatusReport]. - parse_
position_ side - Parses quantity to Nautilus position side.
- parse_
position_ status_ report - Parses an OKX position into a Nautilus [
PositionStatusReport]. - parse_
price - Converts a textual price to a [
Price] using the given precision. - parse_
quantity - Converts a textual quantity to a [
Quantity]. - parse_
rfc3339_ timestamp - Parses an RFC 3339 timestamp string into [
UnixNanos]. - parse_
spot_ instrument - Parses an OKX spot instrument definition into a Nautilus currency pair.
- parse_
swap_ instrument - Parses an OKX swap instrument definition into a Nautilus crypto perpetual.
- parse_
trade_ tick - Parses an OKX trade record into a Nautilus [
TradeTick].