pub fn parse_chart_msg(
chart_msg: &DeribitChartMsg,
bar_type: BarType,
price_precision: u8,
size_precision: u8,
use_cost_for_volume: bool,
timestamp_on_close: bool,
ts_init: UnixNanos,
) -> Result<Bar>Expand description
Parses a Deribit chart message from a WebSocket subscription into a [Bar].
Converts a single OHLCV data point from the chart.trades.{instrument}.{resolution} channel
into a Nautilus Bar object.
When use_cost_for_volume is true, Bar.volume is populated from chart_msg.cost (USD) to
match instruments whose trade amount is in USD (inverse perpetuals / inverse futures).
Otherwise chart_msg.volume (base currency) is used. Callers derive this from the instrument
via crate::common::parse::use_cost_for_bar_volume.
ยงErrors
Returns an error if:
- Price or volume values are invalid
- Bar construction fails validation