Skip to main content

close_time_from_open

Function close_time_from_open 

Source
pub fn close_time_from_open(
    open: DateTime<Utc>,
    step: IntervalStep,
) -> Option<DateTime<Utc>>
Expand description

Compute a candle’s exclusive close_time boundary from its open instant.

This is the single shared boundary helper that every range-computing Candle producer routes through (Massive REST, Hyperliquid, IBKR), so the close_time == open + interval contract is computed in exactly one place. The Massive WS path is the lone exception: it trusts the venue-supplied boundary directly (see WsAggregateMsg::into_candle for the rationale).

§Returns

None on overflow — when the computed boundary falls outside the representable DateTime<Utc> range. Callers must surface this as their producer error type (an observable failure), never a silent fallback to a plausible-but-wrong timestamp such as UNIX_EPOCH.