Skip to main content

encode_deltas

Function encode_deltas 

Source
pub fn encode_deltas(data: &[OrderBookDelta]) -> Result<RecordBatch, ArrowError>
Expand description

Encodes order book deltas as a display-friendly Arrow [RecordBatch].

Prices and sizes render as Float64, action and side render as Utf8 via their Display implementations, and order_id becomes Utf8 so numerically large IDs survive display in dashboards. Mixed-instrument batches are supported. Precision is lost on the conversion to f64; use crate::arrow::book_deltas_to_arrow_record_batch_bytes for catalog storage.

Returns an empty [RecordBatch] with the correct schema when data is empty.

ยงErrors

Returns an [ArrowError] if the Arrow RecordBatch cannot be constructed.