Skip to main content

open_time_from_close

Function open_time_from_close 

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

Inverse of close_time_from_open: recover a candle’s open instant from its exclusive close_time boundary (open == close − interval).

Used by range-bounded historical fetches to widen the venue request window: the candle whose close_time == start has open == start − interval, so a fetch that wants close_time ∈ [start, end] must ask the venue for opens down to start − interval (then trim the result by close_time). See Candle::close_time.

§Returns

None on underflow (the computed open falls below the representable DateTime<Utc> range).

For the range-widening use-case this None is not an error: it means the candle whose close_time == start would have an unrepresentable open (start − interval below DateTime<Utc> minimum) and therefore cannot exist. Callers should fall back to the original lower bound — the un-widened fetch already yields the complete, correct result set, so this is the right outcome rather than a silent failure. (Contrast close_time_from_open, whose None does signal data loss for a real candle and must be surfaced as an error.)