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

    Interface DiscontinuityProvider

    The disjoint time-axis primitive: a d3fc-style discontinuity provider.

    A DiscontinuityProvider describes an axis whose domain is epoch-milliseconds but from which certain ranges — closed-market time — have been excised. It is the structural surface a @pond-ts/charts trading-time scale consumes to map value → pixel while collapsing the gaps, and the same surface the calendar engine (later in this package) produces from a session schedule. Charts depends on the shape, never on this package (see the trading-calendar RFC).

    The five methods mirror d3fc's discontinuity-scale provider so the semantics are the well-trodden ones:

    interface DiscontinuityProvider {
        boundaries?(from: number, to: number): number[];
        clampDown(value: number): number;
        clampUp(value: number): number;
        copy(): DiscontinuityProvider;
        distance(from: number, to: number): number;
        offset(value: number, amount: number): number;
    }
    Index

    Methods

    • The domain positions of collapsed gaps strictly inside (from, to) — each is the far edge of a removed gap (a session/day open, a post-break re-open), i.e. where two non-adjacent times become adjacent on the axis. A chart draws a session divider at each. Optional — a provider that can't enumerate its gaps omits it, and the axis just collapses silently. Ascending; excludes any boundary at the very domain start (no gap precedes it).

      Parameters

      • from: number
      • to: number

      Returns number[]

    • If value lies inside a removed gap, snap it down to the previous live instant; a value already live is returned unchanged. Out-of-domain behavior is implementation-defined (see clampUp).

      Parameters

      • value: number

      Returns number

    • If value lies inside a removed gap, snap it up to the next live instant; a value already live is returned unchanged. Behavior for a value outside the provider's whole domain is implementation-defined — identityDiscontinuity leaves it; a bounded provider (segmentDiscontinuity) may snap to its first live edge.

      Parameters

      • value: number

      Returns number

    • Live (non-gap) domain distance from from to to. Signed: negative when to < from. Gap time between the two is not counted.

      Parameters

      • from: number
      • to: number

      Returns number

    • Advance value by amount live-milliseconds, skipping gaps. Inverse of distance.

      Parameters

      • value: number
      • amount: number

      Returns number