Skip to main content

parse_bar

Function parse_bar 

Source
pub fn parse_bar(
    ohlcv: &Ohlcv,
    instrument: &InstrumentAny,
    ts_init: UnixNanos,
) -> Result<Bar>
Expand description

Converts a completed OHLCV period into an external last-price bar closing at time_period_end.

Rounds volume to the instrument’s size precision when the adjustment is at most both 1e-15 times the reported volume and 1e-6 times one unit at that precision.

§Errors

Returns an error if the period is unsupported, a price is finer than the instrument precision, volume needs rounding beyond the noise tolerance, the prices are inconsistent, or a timestamp is invalid.