Skip to main content

parse_candle_record

Function parse_candle_record 

Source
pub fn parse_candle_record(
    record: &DerivePublicCandle,
    bar_type: BarType,
    price_precision: u8,
    size_precision: u8,
    ts_init: UnixNanos,
) -> Result<Bar>
Expand description

Parses a public/get_tradingview_chart_data record into a Nautilus [Bar].

Pass price and size precision from the instrument definition rather than inferring them from the wire values. The Derive timestamp_bucket is the bucket start in UNIX seconds; the returned bar’s ts_event marks that start (not the close).

§Errors

Returns an error when price, size, or timestamp conversion fails.