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).
IntervalStep::Fixedadds achrono::Duration.IntervalStep::Monthsuses calendar-correct month arithmetic (checked_add_months), so a Jan monthly bar yieldsFeb 1 00:00 UTCand a leap-year Feb monthly bar yieldsMar 1 00:00 UTC.
§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.