Skip to main content

encode_positions

Function encode_positions 

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

Encodes positions as a display-friendly Arrow [RecordBatch].

Emits Utf8 columns for identifiers and enums, Float64 columns for quantities and PnL amounts, Timestamp(Nanosecond) columns for all time fields, and Boolean columns for is_inverse and is_currency_pair. The trade_ids and commissions columns carry deterministic JSON payloads (sorted by trade id and currency respectively) so that repeated encodings of the same position produce identical bytes.

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

ยงErrors

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