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

    Function primeNumberBands

    • Prime Number Bands — the prime numbers immediately bracketing each bar:

      ${prefix}Upper = the smallest prime ≥ high
      ${prefix}Lower = the largest prime ≤ low

      Appends two columns and no centre — there is no "average prime" to draw, and the bar itself is the middle. Reads high and low, each named by an option defaulting to its DEFAULT_OHLCV name.

      It is a step function of the price level, not a statistic: the bands hold flat while price moves inside a prime gap and jump when it crosses one, so the chart is a staircase that tightens where primes are dense and widens where they are sparse. Nothing about the series' history enters it — two instruments trading at the same price have identical bands.

      The corpus lists it (assessment §6.2) and it is perfectly deterministic, which is why it ships; whether the arithmetic of the integers says anything about a market is the reader's business, and this docstring is not going to pretend otherwise. No TA-Lib function and no vendor agreement to match: the definition above (bands that contain the bar) is the one the corpus names, and the oracle is a pure-Python replication over a sieve.

      • No warm-up. Each bar's bands come from its own two prices, so row 0 is defined. Length-preserving.
      • A price below 2 has no bands and both columns read undefined there. Two is the smallest prime; below it there is nothing to bracket with. That is the whole domain rule, and it is the kernel's — see kernels/prime.ts. Above Number.MAX_SAFE_INTEGER likewise: past 2⁵³ a double no longer names consecutive integers.
      • Non-integer prices are the normal case and nothing rounds them: the upper band searches up from ceil(high), the lower down from floor(low).
      • Neither scale- nor shift-equivariant, and that is not a defect. Doubling every price does not double the bands (the primes near 2p are not twice the primes near p), and adding a constant does not translate them. This is the only study in the package with no homogeneity property at all, and the property tests assert the absence — that scaling and shifting both genuinely move the reading off the transformed one — rather than skipping the check.
      • The bands always contain the bar when low ≤ high, by construction, and the upper band is the lower whenever both exist. Redirecting high/low at crossed columns can invert them; nothing reorders.
      • A gap in either input costs that column on that bar only.
      • Cost grows with the price LEVEL, not the series length — the one operator here that does, and steeply. Measured at 1M bars: 78 ms at ordinary equity prices, 6.5 s at ~1e7, and per bar 7.7 ms at ~1e12 and 290 ms at ~1e15 (see the kernel's table; ~1e9 is the practical ceiling). Know that number before running this over a high-priced instrument at scale; the kernel's cost note explains why there is no sieve and what would change that.

      Type Parameters

      • S extends SeriesSchema
      • const Prefix extends string = "pnb"

      Parameters

      Returns TimeSeries<
          readonly [
              S[0],
              ValueColumnsForSchema<
                  readonly [
                      S[0],
                      ValueColumnsForSchema<S>,
                      OptionalNumberColumn<`${Prefix}Upper`>,
                  ],
              >,
              OptionalNumberColumn<`${Prefix}Lower`>,
          ],
      >