pub fn parse_bars(
chart_data: &DeribitTradingViewChartData,
bar_type: BarType,
price_precision: u8,
size_precision: u8,
use_cost_for_volume: bool,
ts_init: UnixNanos,
) -> Result<Vec<Bar>>Expand description
Parses Deribit TradingView chart data into Nautilus [Bar]s.
Converts OHLCV arrays from the public/get_tradingview_chart_data endpoint
into a vector of [Bar] objects.
When use_cost_for_volume is true, Bar.volume is populated from chart_data.cost (USD)
instead of chart_data.volume (base currency) — see use_cost_for_bar_volume.
§Errors
Returns an error if:
- The status is not “ok”
- Array lengths are inconsistent
- No data points are present