Skip to main content

encode_instruments

Function encode_instruments 

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

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

Emits a single schema built from the common [Instrument] trait surface. Utf8 columns carry identifiers and enum names, Float64 columns carry prices/quantities/fees, Timestamp(Nanosecond) columns carry activation, expiration, and bookkeeping timestamps, and Boolean columns carry is_inverse/is_quanto. Trait accessors that are not applicable to a row (e.g. strike_price on a spot pair) emit as nulls, so mixed-type batches round-trip cleanly. Variant-only metadata not reachable through the trait is intentionally omitted; see the module-level comment.

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

ยงErrors

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