Expand description
Binance SBE market data stream decoders (schema 1:0).
These decoders are hand-written for the 4 market data stream message types:
TradesStreamEvent- Real-time trade dataBestBidAskStreamEvent- Best bid/ask (BBO) updatesDepthSnapshotStreamEvent- Order book snapshots (top N levels)DepthDiffStreamEvent- Incremental order book updates
All decoders return Result<T, StreamDecodeError> to safely handle malformed
or truncated network data without panicking.
Modules§
- template_
id - Message template IDs for stream events.
Structs§
- Best
BidAsk Stream Event - Best bid/ask stream event.
- Depth
Diff Stream Event - Depth diff stream event (incremental order book updates).
- Depth
Snapshot Stream Event - Depth snapshot stream event (top N levels of order book).
- Group
Size16 Encoding - Group size 16 encoding (4 bytes: u16 block_length + u16 num_in_group).
- Group
Size Encoding - Group size encoding (6 bytes: u16 block_length + u32 num_in_group).
- Message
Header - SBE message header (8 bytes).
- Price
Level - Price/quantity level in order book.
- Trade
- Individual trade within a trades stream event.
- Trades
Stream Event - Trades stream event (may contain multiple trades).
Enums§
- Stream
Decode Error - Stream decode error.
Constants§
- MAX_
GROUP_ SIZE - Maximum allowed group size to prevent OOM from malicious payloads. Binance depth streams typically have at most 5000 levels.
- STREAM_
SCHEMA_ ID - Stream schema ID.
- STREAM_
SCHEMA_ VERSION - Stream schema version.
Functions§
- decode_
var_ string8 - Decode a varString8 (1-byte length prefix + UTF-8 data).
- mantissa_
to_ f64 - Convert mantissa and exponent to f64.