@pond-ts/financial API Reference
    Preparing search index...

    Function segmentDiscontinuity

    • A provider whose live (non-excised) domain is an explicit, sorted, non-overlapping list of [start, end) segments — everything between the segments is a removed gap. This is the general engine behind a trading calendar's axis: the segments are the tradeable spans (sessions minus intraday breaks, or bars), so closed time between sessions and inside a lunch break both collapse to nothing while time stays proportional within each span.

      The spacing option (default 'proportional') chooses whether distance is live-ms or one-unit-per-segment ('uniform' — see SegmentDiscontinuityOptions); it does not change which time is live, only how live distance is measured.

      All arithmetic is O(log n) via bisection over precomputed cumulative distance at each segment boundary — cheap enough to call per-tick / per-pixel.

      clampUp / clampDown snap a value that is not in a live span to the nearest live edge in that direction: clampUp to the next span's start (or the very first start, if before everything), clampDown to the previous span's end (or the very last end, if past everything). A value already inside a live span is returned unchanged; the direction with no target (up past the last span, down before the first) also returns the value unchanged.

      Parameters

      • input: readonly LiveSegment[]
      • options: SegmentDiscontinuityOptions = {}

      Returns DiscontinuityProvider