Skip to main content

map_rest_candles

Function map_rest_candles 

pub fn map_rest_candles(
    resp: &CandlesResponse,
    tf: Timeframe,
    now: Instant,
) -> Vec<Candle>
Expand description

Maps the candles of POST /candles-chart to domain candles of the timeframe tf that was asked.

The API gives one time per bar. It is used for both open_ts and close_ts. Whether that time is the open or the close of the bar is not verified against the live API, so do not rely on the difference between the two fields.