Skip to content

Documentation / @finchart/core / index / fixedBars

Function: fixedBars() ​

fixedBars(options): BarStart

Defined in: packages/core/src/time/fixed-bars.ts:25

Bars of a fixed width, aligned to the epoch — the minute, hour and four-hour bars of a market that never closes.

The width is a whole number of milliseconds, and at most a day. The lower bound is arithmetic: below a millisecond the division runs to infinity and the answer stands ahead of its own instant. The upper one is a decision, not a necessity — a two-day epoch grid keeps all three laws perfectly well, but the epoch is the wrong thing to align it to, since an epoch-aligned week begins on a Thursday. A grid wider than a day is a few lines of the consumer's own BarStart, written against whatever it should actually align to.

A calendar day is not this function's answer even where it happens to be 86,400,000 ms wide: the day a clock moves is shorter or longer than the others, and an epoch-aligned grid would cut it in the wrong place. Ask sessionStart for a day.

Parameters ​

options ​

interval ​

number

Returns ​

BarStart