/** * Totals and counts over a lookback, and the three functions that deliberately * ignore absent bars. * * `sum` propagates absence, as every lookback function does. `sumSkip`, * `avgSkip` and `countPresent` do not, and they say so in their names because * a function that quietly ignored a gap would report a total over a lookback it * never had. */ import type { Flag, Flags, Series, StateRecord, Tail, Value } from '../values/index.js'; /** `sum(src, len)`: the total over the lookback, from bar `len - 1`. */ export declare function sumStep(state: StateRecord, key: string, value: Value, len: number | null): Value; /** `sum(src, len)` as a tail. */ export declare function sumTail(len: number): Tail; /** `sum(src, len)` over a whole series. */ export declare function sum(src: Series, len: number): Value[]; /** * `cum(src)`: the running total from the first bar, from bar 0. * * An absent bar produces an absent bar out and leaves the total where it was. * The alternatives are both wrong: treating absence as zero would report a * total over bars that had no value, and propagating it into the total would * end the series permanently at the first gap. */ export declare function cumStep(state: StateRecord, key: string, value: Value): Value; /** `cum(src)` as a tail. */ export declare function cumTail(): Tail; /** `cum(src)` over a whole series. */ export declare function cum(src: Series): Value[]; /** * `count(cond, len)`: how many of the last `len` bars the condition held on, * from bar `len - 1`. * * An absent condition is a condition that did not hold, matching the rule that * absence is false at a branch (`language.md` section 6). Propagating it * instead would make a count over a condition built from an average absent for * a second warmup on top of the average's own. */ export declare function countStep(state: StateRecord, key: string, cond: Flag, len: number | null): Value; /** `count(cond, len)` as a tail. */ export declare function countTail(len: number): Tail; /** `count(cond, len)` over a whole series. */ export declare function count(cond: Flags, len: number): Value[]; /** `sumSkip(src, len)`: the total over the lookback, ignoring absent bars. */ export declare function sumSkipStep(state: StateRecord, key: string, value: Value, len: number | null): Value; /** `sumSkip(src, len)` as a tail. */ export declare function sumSkipTail(len: number): Tail; /** `sumSkip(src, len)` over a whole series. */ export declare function sumSkip(src: Series, len: number): Value[]; /** `countPresent(src, len)`: how many bars of the lookback had a value. */ export declare function countPresentStep(state: StateRecord, key: string, value: Value, len: number | null): Value; /** `countPresent(src, len)` as a tail. */ export declare function countPresentTail(len: number): Tail; /** `countPresent(src, len)` over a whole series. */ export declare function countPresent(src: Series, len: number): Value[]; /** * `avgSkip(src, len)`: the mean over the lookback, ignoring absent bars. * * A lookback with nothing present in it is absent, not zero: there is no mean of * no values, and a division by zero is absence by the rule of `stdlib.md` * section 2.4. */ export declare function avgSkipStep(state: StateRecord, key: string, value: Value, len: number | null): Value; /** `avgSkip(src, len)` as a tail. */ export declare function avgSkipTail(len: number): Tail; /** `avgSkip(src, len)` over a whole series. */ export declare function avgSkip(src: Series, len: number): Value[]; //# sourceMappingURL=totals.d.ts.map