Documentation
Documentation / @elitechart/core / appendRangeBars
function appendRangeBars(
state,
raw,
opts): {
newBars: readonly Bar[];
state: RangeBarsInternalState;
};
Defined in: series/range-bars.ts:124
Append zero or more range bars for one source bar. Pure /
deterministic. Multiple bars can emit when the source bar's
(high - low) covers more than rangeSize.
Parameters
state
| RangeBarsInternalState
| undefined
raw
Bar
opts
RangeBarsOptions & {
fixedDtFallback?: number;
}
Returns
{
newBars: readonly Bar[];
state: RangeBarsInternalState;
}
newBars
readonly newBars: readonly Bar[];
state
readonly state: RangeBarsInternalState;
Example
let state: RangeBarsInternalState | undefined;
for (const b of liveBars) {
const r = appendRangeBars(state, b, { rangeSize: 50 });
state = r.state;
}