# Data feeds (/docs/pro/api/data-feeds)



This page documents the extended feed interfaces that a `DataProvider` can implement beyond OHLCV candles, including footprint slices, Level 2 market depth, trade tape streams, quotes, tick feeds and anchoring helpers, and the in-memory footprint store.

Import symbols on this page from `@luxalgo/vela-pro`. Related guides: [Data connectivity overview](/docs/pro/data/overview), [Footprint data](/docs/pro/data/feeds/footprints), [Quotes and market depth](/docs/pro/data/feeds/quotes-and-depth), [Tick charts](/docs/pro/charts/tick-charts).

Feature enabler for this area ([`enableTickCharts`](/docs/pro/api/enablers#enabletickcharts)) is documented on [Enablers and options](/docs/pro/api/enablers).

## Functions [#functions]

### `aggregateTicks` [#aggregateticks]

One-shot tick aggregation returning both the historical bars and the warm live builder.

```typescript
function aggregateTicks(
    ticks: readonly TickPrint[],
    ticksPerBar: number,
    anchor: TickAnchor,
    opts?: TickAggregateOptions,
): { bars: OHLCV[]; builder: TickBarBuilder }
```

See also: [`TickAggregateOptions`](/docs/pro/api/data-feeds#tickaggregateoptions), [`TickAnchor`](/docs/pro/api/data-feeds#tickanchor), [`TickBarBuilder`](/docs/pro/api/data-feeds#tickbarbuilder), [`TickPrint`](/docs/pro/api/data-feeds#tickprint). From `@luxalgo/vela/plugin`: `OHLCV`.

### `anchorKey` [#anchorkey]

Stable string key for an anchor (used for builder/session identity comparisons).

```typescript
function anchorKey(anchor: TickAnchor): string
```

See also: [`TickAnchor`](/docs/pro/api/data-feeds#tickanchor).

### `anchorsEqual` [#anchorsequal]

Value equality between two tick anchors.

```typescript
function anchorsEqual(a: TickAnchor, b: TickAnchor): boolean
```

See also: [`TickAnchor`](/docs/pro/api/data-feeds#tickanchor).

### `anchorShortLabel` [#anchorshortlabel]

Compact label for the topbar anchor button ("Session", "09:30", "Rolling", "Custom").

```typescript
function anchorShortLabel(anchor: TickAnchor): string
```

See also: [`TickAnchor`](/docs/pro/api/data-feeds#tickanchor).

### `bindTickStyleSwitch` [#bindtickstyleswitch]

Bind automatic `1T` → `line` style switching and restore onto one chart instance. Returns a disposer that removes all listeners.

```typescript
function bindTickStyleSwitch(chart: TickStyleChart): () => void
```

See also: [`TickStyleChart`](/docs/pro/api/data-feeds#tickstylechart).

### `blankQuote` [#blankquote]

Also exported from `@luxalgo/vela-pro-watchlist`, `@luxalgo/vela-pro/plugin`.

```typescript
function blankQuote(symbol: string): Quote
```

See also: [`Quote`](/docs/pro/api/data-feeds#quote).

### `boundaryResolverFor` [#boundaryresolverfor]

Build the boundary resolver function for any [`TickAnchor`](/docs/pro/api/data-feeds#tickanchor) and market context.

```typescript
function boundaryResolverFor(
    anchor: TickAnchor,
    opts?: { symbolInfo?: SymbolInfo; session?: string; calendarWindows?: ReadonlyArray<readonly [number, number]> },
): (timeMs: number) => number
```

See also: [`TickAnchor`](/docs/pro/api/data-feeds#tickanchor). From `@luxalgo/vela/plugin`: `SymbolInfo`.

### `createTickSeriesAdapter` [#createtickseriesadapter]

Create the tick `SeriesAdapter` backed by `opts.store`.

```typescript
function createTickSeriesAdapter(opts: TickAdapterOptions): SeriesAdapter
```

See also: [`TickAdapterOptions`](/docs/pro/api/data-feeds#tickadapteroptions). From `@luxalgo/vela/plugin`: `SeriesAdapter`.

### `defaultTickMarketKey` [#defaulttickmarketkey]

Default symbol → market key: trimmed uppercase (`'binance:BTCUSDT'` → `'BINANCE:BTCUSDT'`).

```typescript
function defaultTickMarketKey(symbol: string): string
```

### `describeMarketSession` [#describemarketsession]

Human-readable description of the market's session open (shown in the anchor dialog).

```typescript
function describeMarketSession(info: SymbolInfo | undefined, session?: string): string
```

From `@luxalgo/vela/plugin`: `SymbolInfo`.

### `fetchPublicTicks` [#fetchpublicticks]

Fetch ascending historical [`TickPrint`](/docs/pro/api/data-feeds#tickprint)s for a public crypto venue. Walks backward in bounded pages until `targetTicks` have landed (or `maxRequests` is reached).

```typescript
function fetchPublicTicks(
    providerName: string,
    ticker: string,
    targetTicks: number,
    maxRequests?: number,
): Promise<TickPrint[]>
```

Default: `maxRequests = DEFAULT_MAX_HISTORY_REQUESTS`.

See also: [`TickPrint`](/docs/pro/api/data-feeds#tickprint).

### `footprintFeedFor` [#footprintfeedfor]

The shared order-flow feed behind a chart symbol, or null when its provider serves none. The entry point for any indicator that reads footprints: everything read through it is fetched once and shared with every other consumer of that provider.

```typescript
function footprintFeedFor(
    data: FootprintFeedSurface,
    symbol: string,
): { feed: FootprintStore; ticker: string; provider: string } | null
```

See also: [`FootprintFeedSurface`](/docs/pro/api/data-feeds#footprintfeedsurface), [`FootprintStore`](/docs/pro/api/data-feeds#footprintstore-class).

### `footprintStore` [#footprintstore]

The shared store of a footprint-capable provider: one per provider instance.

```typescript
function footprintStore(feed: FootprintFeed): FootprintStore
```

See also: [`FootprintFeed`](/docs/pro/api/data-feeds#footprintfeed), [`FootprintStore`](/docs/pro/api/data-feeds#footprintstore-class).

### `formatTimeOfDay` [#formattimeofday]

Format `{ hour, minute }` as zero-padded `HH:MM`.

```typescript
function formatTimeOfDay(hour: number, minute: number): string
```

### `getTickAnchor` [#gettickanchor]

Read the active tick anchor for `symbol` (returns the default anchor when no override is set).

```typescript
function getTickAnchor(symbol: string): TickAnchor
```

See also: [`TickAnchor`](/docs/pro/api/data-feeds#tickanchor).

### `groupLevels` [#grouplevels]

Group book levels into `step`-wide buckets (bids floor, asks ceil), summing their sizes.

Also exported from `@luxalgo/vela-pro/plugin`.

```typescript
function groupLevels(levels: readonly BookLevel[], step: number, side: 'bid' | 'ask'): BookLevel[]
```

See also: [`BookLevel`](/docs/pro/api/data-feeds#booklevel).

### `hasDepthFeed` [#hasdepthfeed]

Also exported from `@luxalgo/vela-pro/plugin`.

```typescript
function hasDepthFeed(p: unknown): p is DepthFeed
```

See also: [`DepthFeed`](/docs/pro/api/data-feeds#depthfeed).

### `hasFootprints` [#hasfootprints]

Narrow a registered provider to its order-flow surface, if it has one.

```typescript
function hasFootprints(p: DataProvider | undefined): p is DataProvider & FootprintFeed
```

See also: [`FootprintFeed`](/docs/pro/api/data-feeds#footprintfeed). From `@luxalgo/vela/plugin`: `DataProvider`.

### `hasPublicTickFeed` [#haspublictickfeed]

Whether this registered provider name has a built-in public trade feed.

```typescript
function hasPublicTickFeed(providerName: string): boolean
```

### `hasTickBarFeed` [#hastickbarfeed]

Narrow a registered provider to [`TickBarFeed`](/docs/pro/api/data-feeds#tickbarfeed).

```typescript
function hasTickBarFeed(p: DataProvider | undefined): p is DataProvider & TickBarFeed
```

See also: [`TickBarFeed`](/docs/pro/api/data-feeds#tickbarfeed). From `@luxalgo/vela/plugin`: `DataProvider`.

### `hasTickFeed` [#hastickfeed]

Narrow a registered provider to [`TickFeed`](/docs/pro/api/data-feeds#tickfeed).

```typescript
function hasTickFeed(p: DataProvider | undefined): p is DataProvider & TickFeed
```

See also: [`TickFeed`](/docs/pro/api/data-feeds#tickfeed). From `@luxalgo/vela/plugin`: `DataProvider`.

### `normalizeAnchor` [#normalizeanchor]

Validate and normalize an untrusted anchor payload (persisted storage / documents).

```typescript
function normalizeAnchor(raw: unknown): TickAnchor | null
```

See also: [`TickAnchor`](/docs/pro/api/data-feeds#tickanchor).

### `onTickAnchorChange` [#ontickanchorchange]

Listen for per-market tick anchor changes. Returns an unsubscribe function.

```typescript
function onTickAnchorChange(cb: (marketKey: string, anchor: TickAnchor) => void): () => void
```

See also: [`TickAnchor`](/docs/pro/api/data-feeds#tickanchor).

### `parseSessionOpen` [#parsesessionopen]

Extract the opening `{ hour, minute }` from a Pine/Vela session string (`'0930-1600'`, `'1700-1600'`).

```typescript
function parseSessionOpen(sessionStr: string): { hour: number; minute: number } | null
```

### `parseTimeOfDay` [#parsetimeofday]

Parse `HH:MM` (or `HHMM`) into 24-hour `{ hour, minute }`, or `null` when invalid.

```typescript
function parseTimeOfDay(raw: string): { hour: number; minute: number } | null
```

### `resetTickAnchor` [#resettickanchor]

Reset `symbol` back to the default tick anchor.

```typescript
function resetTickAnchor(symbol: string): void
```

### `restoreTickReplacedStyle` [#restoretickreplacedstyle]

Put back the memory of the style `1T` replaced on `chart` (a saved state being applied). Ignored unless the chart is on `1T`, drawn as a line, and `style` is one `1T` replaces.

```typescript
function restoreTickReplacedStyle(chart: TickStyleChart, style: unknown): void
```

See also: [`TickStyleChart`](/docs/pro/api/data-feeds#tickstylechart).

### `sessionBoundaryResolver` [#sessionboundaryresolver]

Returns a boundary resolver anchored to the asset's trading session opens. Prefers provider-resolved `calendarWindows` (holidays + DST applied server-side), falling back to `SymbolInfo.session` / `session_extended` + `timezone`, and UTC 00:00 for 24×7 markets.

```typescript
function sessionBoundaryResolver(
    symbolInfo: SymbolInfo | undefined,
    session?: string,
    calendarWindows?: ReadonlyArray<readonly [number, number]>,
): (timeMs: number) => number
```

From `@luxalgo/vela/plugin`: `SymbolInfo`.

### `setTickAnchor` [#settickanchor]

Set the tick anchor for `symbol`. Any open tick chart on that market reloads automatically.

```typescript
function setTickAnchor(symbol: string, anchor: TickAnchor): void
```

See also: [`TickAnchor`](/docs/pro/api/data-feeds#tickanchor).

### `subscribePublicTicks` [#subscribepublicticks]

Subscribe to live [`TickPrint`](/docs/pro/api/data-feeds#tickprint)s from the venue's public trade stream.

```typescript
function subscribePublicTicks(
    providerName: string,
    ticker: string,
    onTicks: (ticks: readonly TickPrint[]) => void,
): () => void
```

See also: [`TickPrint`](/docs/pro/api/data-feeds#tickprint).

### `tickReplacedStyle` [#tickreplacedstyle]

The style `1T` replaced on `chart`, or `undefined` when it replaced none.

```typescript
function tickReplacedStyle(chart: object): string | undefined
```

### `timeOfDayBoundaryResolver` [#timeofdayboundaryresolver]

Returns a fast function mapping any epoch-ms timestamp to the epoch ms of the most recent daily occurrence of `hhmm` in `timezone` at or before `timeMs`. Caches resolved civil days so thousands of ticks inside a day pay an O(1) comparison.

```typescript
function timeOfDayBoundaryResolver(hhmm: string, timezone?: string): (timeMs: number) => number
```

Default: `timezone = 'Etc/UTC'`.

### `withChange` [#withchange]

Chg and Chg% from the last price and the previous close.

Also exported from `@luxalgo/vela-pro-watchlist`, `@luxalgo/vela-pro/plugin`.

```typescript
function withChange(q: Quote): Quote
```

See also: [`Quote`](/docs/pro/api/data-feeds#quote).

### `withTickFeed` [#withtickfeed]

Attach a [`TickFeed`](/docs/pro/api/data-feeds#tickfeed) onto any existing `DataProvider` instance while preserving all of its methods, prototype, and extended surfaces (such as [`FootprintFeed`](/docs/pro/api/data-feeds#footprintfeed) / [`DepthFeed`](/docs/pro/api/data-feeds#depthfeed)).

```typescript
const provider = withTickFeed(myProvider, {
    getTicks: (ticker, range) => myApi.fetchTrades(ticker, range),
    subscribeTicks: (ticker, onTicks) => myApi.streamTrades(ticker, onTicks),
});
```

```typescript
function withTickFeed<P extends DataProvider>(provider: P, feed: TickFeed): P & TickFeed
```

See also: [`TickFeed`](/docs/pro/api/data-feeds#tickfeed). From `@luxalgo/vela/plugin`: `DataProvider`.

## Classes [#classes]

### `BookState` [#bookstate]

One book kept from a snapshot and its level changes (a size of 0 removes a level): the shape most venues send.

```typescript
class BookState {
    tick: number;
    time: number;
    reset(
        bids: ReadonlyArray<readonly [number, number]>,
        asks: ReadonlyArray<readonly [number, number]>,
        tick: number,
        time?: number,
    ): void;
    update(
        bids: ReadonlyArray<readonly [number, number]>,
        asks: ReadonlyArray<readonly [number, number]>,
        time?: number,
    ): void;
    snapshot(depth?: number): BookSnapshot;
}
```

Defaults: `reset(time = Date.now())`, `update(time = Date.now())`, `snapshot(depth = 50)`.

See also: [`BookSnapshot`](/docs/pro/api/data-feeds#booksnapshot).

### `FootprintStore` class [#footprintstore-class]

```typescript
class FootprintStore implements FootprintFeed {
    constructor(source: FootprintFeed);
    footprintCaps(ticker: string): FootprintCaps;
    getFootprints(ticker: string, range: FootprintRange, sliceMs?: number): Promise<FootprintBatch>;
    subscribeFootprints(
        ticker: string,
        since: number,
        onSlices: (slices: FootprintSlice[]) => void,
    ): () => void;
    peek(
        ticker: string,
        range: { from: number; to: number; session?: string },
        sliceMs?: number,
    ): FootprintPeek;
    stats(): FootprintStoreStats;
    clear(): void;
}
```

| Member                  | Type                                                                                                         | Description                                                                                                                                                                                                                                                                                                                                    |
| ----------------------- | ------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `constructor`           | `(source: FootprintFeed)`                                                                                    |                                                                                                                                                                                                                                                                                                                                                |
| `footprintCaps()`       | `(ticker: string) => FootprintCaps`                                                                          | Fetch-planner capabilities for one ticker.                                                                                                                                                                                                                                                                                                     |
| `getFootprints()`       | `(ticker: string, range: FootprintRange, sliceMs?: number) => Promise<FootprintBatch>`                       | Pre-aggregated one-minute footprint slices for `[range.from, range.to]`. `sliceMs` is a granularity HINT (the chart's bar duration): a multi-timeframe source may serve bucket slices that divide it (fewer, bigger slices, same sums). Returns a completeness-aware batch (see [`FootprintBatch`](/docs/pro/api/chart-types#footprintbatch)). |
| `subscribeFootprints()` | `(ticker: string, since: number, onSlices: (slices: FootprintSlice[]) => void) => () => void`                | Live footprint slices from `since` onward. Deliveries are FULL-STATE snapshots per slice (the forming minute grows across deliveries): consumers replace by slice time, never accumulate. Returns an unsubscribe function.                                                                                                                     |
| `peek()`                | `(ticker: string, range: { from: number; to: number; session?: string }, sliceMs?: number) => FootprintPeek` | What the store holds for `(ticker, session, sliceMs)` inside `[from, to]`: no request.                                                                                                                                                                                                                                                         |
| `stats()`               | `() => FootprintStoreStats`                                                                                  |                                                                                                                                                                                                                                                                                                                                                |
| `clear()`               | `() => void`                                                                                                 | Forget every kept interval (live subscriptions are untouched).                                                                                                                                                                                                                                                                                 |

See also: [`FootprintBatch`](/docs/pro/api/chart-types#footprintbatch), [`FootprintCaps`](/docs/pro/api/data-feeds#footprintcaps), [`FootprintFeed`](/docs/pro/api/data-feeds#footprintfeed), [`FootprintPeek`](/docs/pro/api/data-feeds#footprintpeek), [`FootprintRange`](/docs/pro/api/data-feeds#footprintrange), [`FootprintSlice`](/docs/pro/api/chart-types#footprintslice), [`FootprintStoreStats`](/docs/pro/api/data-feeds#footprintstorestats).

### `LocalTickAnchorStorage` [#localtickanchorstorage]

```typescript
class LocalTickAnchorStorage implements TickAnchorStorage {
    constructor(key?: string);
    load(): Record<string, TickAnchor>;
    save(anchors: Readonly<Record<string, TickAnchor>>): void;
}
```

Default: `constructor(key = DEFAULT_TICK_ANCHORS_STORAGE_KEY)`.

See also: [`TickAnchor`](/docs/pro/api/data-feeds#tickanchor), [`TickAnchorStorage`](/docs/pro/api/data-feeds#tickanchorstorage).

### `ProviderQuotes` [#providerquotes]

Also exported from `@luxalgo/vela-pro-watchlist`, `@luxalgo/vela-pro/plugin`.

```typescript
class ProviderQuotes implements QuoteSource {
    constructor(data: () => DataFacade | null);
    dailyBars(symbol: string, count: number): Promise<OHLCV[]>;
    watch(symbol: string, onQuote: (q: Quote) => void): () => void;
    peek(symbol: string): Quote | null;
    dispose(): void;
}

// Unexported supporting type referenced above
type DataFacade = WidgetContext['chart']['data'];
```

| Member        | Type                                                          | Description                                                                                                                                                                                                                                     |
| ------------- | ------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `constructor` | `(data: () => DataFacade \| null)`                            | `data`: the registry to resolve symbols through (the active chart's).                                                                                                                                                                           |
| `dailyBars()` | `(symbol: string, count: number) => Promise<OHLCV[]>`         | Up to `count` daily bars of `symbol`, oldest first; the last may be today's, still forming. Rejects when no history can be had. Optional: without it, the figures read from daily history (period returns, drawdowns, correlations) stay empty. |
| `watch()`     | `(symbol: string, onQuote: (q: Quote) => void) => () => void` | Follow `symbol`'s quote; `onQuote` gets every change. Returns the unsubscribe.                                                                                                                                                                  |
| `peek()`      | `(symbol: string) => Quote \| null`                           | The latest quote held for `symbol` (null when nobody watches it).                                                                                                                                                                               |
| `dispose()`   | `() => void`                                                  |                                                                                                                                                                                                                                                 |

See also: [`Quote`](/docs/pro/api/data-feeds#quote), [`QuoteSource`](/docs/pro/api/data-feeds#quotesource). From `@luxalgo/vela/plugin`: `OHLCV`, `WidgetContext`.

### `TickAnchorStore` [#tickanchorstore]

```typescript
class TickAnchorStore {
    configure(opts: { defaultAnchor?: TickAnchor; anchors?: Readonly<Record<string, TickAnchor>>; marketKey?: (symbol: string) => string; storage?: TickAnchorStorage | false }): void;
    keyOf(symbol: string): string;
    getDefault(): TickAnchor;
    get(symbol: string): TickAnchor;
    hasOverride(symbol: string): boolean;
    set(symbol: string, anchor: TickAnchor): void;
    reset(symbol: string): void;
    snapshot(): Record<string, TickAnchor>;
    restore(raw: unknown): void;
    subscribe(listener: AnchorListener): () => void;
    clear(): void;
}

// Unexported supporting type referenced above
type AnchorListener = (marketKey: string, anchor: TickAnchor) => void;
```

| Member          | Type                                                                                                    | Description                                                                               |
| --------------- | ------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
| `configure()`   | `(opts: { defaultAnchor?: TickAnchor; anchors?: Readonly<Record<string, …` (truncated; see declaration) |                                                                                           |
| `keyOf()`       | `(symbol: string) => string`                                                                            |                                                                                           |
| `getDefault()`  | `() => TickAnchor`                                                                                      |                                                                                           |
| `get()`         | `(symbol: string) => TickAnchor`                                                                        | Effective anchor for `symbol`: explicit per-market override, else the configured default. |
| `hasOverride()` | `(symbol: string) => boolean`                                                                           | Whether `symbol` has an explicit per-market override.                                     |
| `set()`         | `(symbol: string, anchor: TickAnchor) => void`                                                          | Set (or clear back to default) the anchor for `symbol`. Notifies listeners on change.     |
| `reset()`       | `(symbol: string) => void`                                                                              | Remove `symbol`'s custom override, restoring the default anchor.                          |
| `snapshot()`    | `() => Record<string, TickAnchor>`                                                                      | Snapshot of all explicit per-market overrides (for state persistence).                    |
| `restore()`     | `(raw: unknown) => void`                                                                                | Restore persisted overrides from a workspace state document.                              |
| `subscribe()`   | `(listener: AnchorListener) => () => void`                                                              |                                                                                           |
| `clear()`       | `() => void`                                                                                            | Clear overrides (for tests).                                                              |

See also: [`TickAnchor`](/docs/pro/api/data-feeds#tickanchor), [`TickAnchorStorage`](/docs/pro/api/data-feeds#tickanchorstorage).

### `TickBarBuilder` [#tickbarbuilder]

Stateful `nT` tick-bar builder. Seed from historical ticks via `seed`, then stream live trades via `push` / `pushBatch` to receive forming-bar refinements and freshly opened bars with monotonic `seq`.

```typescript
class TickBarBuilder {
    constructor(ticksPerBar: number, anchor: TickAnchor, opts?: TickAggregateOptions);
    readonly ticksPerBar: number;
    readonly anchor: TickAnchor;
    readonly currentTickCount: number;
    clone(): TickBarBuilder;
    seed(ticks: readonly TickPrint[]): OHLCV[];
    push(tick: TickPrint): OHLCV | null;
    pushBatch(ticks: readonly TickPrint[]): OHLCV[];
}
```

| Member             | Type                                                                     | Description                                                                                                                                                                                                                                |
| ------------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `constructor`      | `(ticksPerBar: number, anchor: TickAnchor, opts?: TickAggregateOptions)` |                                                                                                                                                                                                                                            |
| `ticksPerBar`      | `number`                                                                 |                                                                                                                                                                                                                                            |
| `anchor`           | `TickAnchor`                                                             |                                                                                                                                                                                                                                            |
| `currentTickCount` | `number`                                                                 | Ticks accumulated in the current forming bar (`0` before the first tick).                                                                                                                                                                  |
| `clone()`          | `() => TickBarBuilder`                                                   | An independent builder in this one's exact state. Each live consumer of a series continues from its own copy, so two charts on one series never share a tick count or a set of seen trade ids.                                             |
| `seed()`           | `(ticks: readonly TickPrint[]) => OHLCV[]`                               | Seed the builder from historical ticks (sorted ascending) and return all built bars.                                                                                                                                                       |
| `push()`           | `(tick: TickPrint) => OHLCV \| null`                                     | Ingest one live tick and return the updated/newly-opened bar snapshot (or `null` if the tick was a duplicate id or out-of-order behind the latest bar).                                                                                    |
| `pushBatch()`      | `(ticks: readonly TickPrint[]) => OHLCV[]`                               | Ingest a batch of live ticks (e.g. one WebSocket frame). Emits every distinct bar transition in order, coalescing multiple refinements of the same forming bar so the chart only paints the latest state of each bar touched by the frame. |

See also: [`TickAggregateOptions`](/docs/pro/api/data-feeds#tickaggregateoptions), [`TickAnchor`](/docs/pro/api/data-feeds#tickanchor), [`TickPrint`](/docs/pro/api/data-feeds#tickprint). From `@luxalgo/vela/plugin`: `OHLCV`.

### `TickBarTimeline` [#tickbartimeline]

```typescript
class TickBarTimeline {
    clone(): TickBarTimeline;
    history(bars: readonly OHLCV[]): OHLCV[];
    live(bar: OHLCV): OHLCV | null;
}
```

| Member      | Type                                  | Description                                                                                                                                                          |
| ----------- | ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `clone()`   | `() => TickBarTimeline`               | An independent timeline in this one's state: each live consumer continues from its own.                                                                              |
| `history()` | `(bars: readonly OHLCV[]) => OHLCV[]` | A history answer. Every entry is a bar of its own, including entries that share a time; only an entry repeating the previous one's time AND `seq` replaces it.       |
| `live()`    | `(bar: OHLCV) => OHLCV \| null`       | A live bar. One at the newest bar's time (and `seq`, when the source sends it) updates that bar; a later one opens the next. `null` for a bar older than the newest. |

From `@luxalgo/vela/plugin`: `OHLCV`.

## Interfaces and types [#interfaces-and-types]

### `BookLevel` [#booklevel]

Also exported from `@luxalgo/vela-pro/plugin`.

```typescript
interface BookLevel {
    price: number;
    size: number;
}
```

### `BookSnapshot` [#booksnapshot]

Also exported from `@luxalgo/vela-pro/plugin`.

```typescript
interface BookSnapshot {
    bids: BookLevel[];
    asks: BookLevel[];
    tick: number;
    time: number;
}
```

| Member | Type          | Description                                      |
| ------ | ------------- | ------------------------------------------------ |
| `bids` | `BookLevel[]` | Best first: highest bid first, lowest ask first. |
| `asks` | `BookLevel[]` |                                                  |
| `tick` | `number`      | The price increment the book is read at.         |
| `time` | `number`      |                                                  |

See also: [`BookLevel`](/docs/pro/api/data-feeds#booklevel).

### `DepthFeed` [#depthfeed]

```typescript
interface DepthFeed {
    subscribeBook?(
        ticker: string,
        onBook: (book: BookSnapshot) => void,
        opts?: { depth?: number; onError?: (reason: string) => void },
    ): DepthSubscription;
    subscribeTrades?(
        ticker: string,
        onTrades: (trades: TapeTrade[], history?: boolean) => void,
        opts?: { onError?: (reason: string) => void },
    ): DepthSubscription;
}
```

| Member               | Type                                                                                                             | Description                                                                                           |
| -------------------- | ---------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| `subscribeBook?()`   | `(ticker: string, onBook: (book: BookSnapshot) => void, opts?: { depth?: number; …` (truncated; see declaration) | Follow `ticker`'s book; `onBook` gets the whole (top-`depth`) book after every change.                |
| `subscribeTrades?()` | `(ticker: string, onTrades: (trades: TapeTrade[], history?: boolean) => void, …` (truncated; see declaration)    | Follow `ticker`'s trades; `onTrades` gets new prints, newest last (`history` marks a first backfill). |

See also: [`BookSnapshot`](/docs/pro/api/data-feeds#booksnapshot), [`DepthSubscription`](/docs/pro/api/data-feeds#depthsubscription), [`TapeTrade`](/docs/pro/api/data-feeds#tapetrade).

### `DepthSubscription` [#depthsubscription]

Also exported from `@luxalgo/vela-pro/plugin`.

```typescript
interface DepthSubscription {
    close(): void;
}
```

### `FootprintCaps` [#footprintcaps]

How the engine's fetch planner should treat this feed for one ticker.

```typescript
interface FootprintCaps {
    bulkFetch: boolean;
    maxFetchSpanSec?: number;
}
```

| Member             | Type      | Description                                                                                                                                                                                         |
| ------------------ | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `bulkFetch`        | `boolean` | One request returns complete slices for a wide range at low cost (a pre-aggregated, server-cached source). The planner then keeps the whole visible range covered instead of rationing tiny chunks. |
| `maxFetchSpanSec?` | `number`  | Cap on one viewport fetch window, in SECONDS (`Infinity` = uncapped: the visible range plus its pan buffer is the only bound).                                                                      |

### `FootprintFeed` [#footprintfeed]

The order-flow surface a footprint-capable provider exposes (beyond the core's port).

```typescript
interface FootprintFeed {
    getFootprints(ticker: string, range: FootprintRange, sliceMs?: number): Promise<FootprintBatch>;
    subscribeFootprints(
        ticker: string,
        since: number,
        onSlices: (slices: FootprintSlice[]) => void,
    ): () => void;
    footprintCaps(ticker: string): FootprintCaps;
}
```

| Member                  | Type                                                                                          | Description                                                                                                                                                                                                                                                                                                                                    |
| ----------------------- | --------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `getFootprints()`       | `(ticker: string, range: FootprintRange, sliceMs?: number) => Promise<FootprintBatch>`        | Pre-aggregated one-minute footprint slices for `[range.from, range.to]`. `sliceMs` is a granularity HINT (the chart's bar duration): a multi-timeframe source may serve bucket slices that divide it (fewer, bigger slices, same sums). Returns a completeness-aware batch (see [`FootprintBatch`](/docs/pro/api/chart-types#footprintbatch)). |
| `subscribeFootprints()` | `(ticker: string, since: number, onSlices: (slices: FootprintSlice[]) => void) => () => void` | Live footprint slices from `since` onward. Deliveries are FULL-STATE snapshots per slice (the forming minute grows across deliveries): consumers replace by slice time, never accumulate. Returns an unsubscribe function.                                                                                                                     |
| `footprintCaps()`       | `(ticker: string) => FootprintCaps`                                                           | Fetch-planner capabilities for one ticker.                                                                                                                                                                                                                                                                                                     |

See also: [`FootprintBatch`](/docs/pro/api/chart-types#footprintbatch), [`FootprintCaps`](/docs/pro/api/data-feeds#footprintcaps), [`FootprintRange`](/docs/pro/api/data-feeds#footprintrange), [`FootprintSlice`](/docs/pro/api/chart-types#footprintslice).

### `FootprintFeedSurface` [#footprintfeedsurface]

What [`footprintFeedFor`](/docs/pro/api/data-feeds#footprintfeedfor) needs of a chart's data surface: structural, so any host context fits.

```typescript
interface FootprintFeedSurface {
    resolve(symbol: string): { provider: string; ticker: string } | null;
    providerInstance(name: string): DataProvider | undefined;
}
```

From `@luxalgo/vela/plugin`: `DataProvider`.

### `FootprintPeek` [#footprintpeek]

A synchronous look at what the store holds for one series.

```typescript
interface FootprintPeek {
    slices: FootprintSlice[];
    covered: Array<[number, number]>;
}
```

| Member    | Type                      | Description                                                               |
| --------- | ------------------------- | ------------------------------------------------------------------------- |
| `slices`  | `FootprintSlice[]`        | Kept slices inside the asked range, ascending.                            |
| `covered` | `Array<[number, number]>` | The `[from, to)` stretches of the range the slices are authoritative for. |

See also: [`FootprintSlice`](/docs/pro/api/chart-types#footprintslice).

### `FootprintRange` [#footprintrange]

A time range request, `[from, to]` epoch ms (either side optional).

```typescript
interface FootprintRange {
    from?: number;
    to?: number;
    session?: string;
}
```

| Member     | Type     | Description                                                                                                                                                                                                                             |
| ---------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `from?`    | `number` |                                                                                                                                                                                                                                         |
| `to?`      | `number` |                                                                                                                                                                                                                                         |
| `session?` | `string` | The chart's trading session (`'regular'` \| `'extended'`): session markets store the extended superset and filter at serve time, so an RTH consumer must say so or the server's regular default decides. Ignored by continuous markets. |

### `FootprintStoreStats` [#footprintstorestats]

What the store did since it was created (diagnostics and tests).

```typescript
interface FootprintStoreStats {
    upstreamRequests: number;
    memoryHits: number;
    sharedRequests: number;
    liveUpstreams: number;
    liveSubscribers: number;
    intervals: number;
    retainedLevels: number;
}
```

| Member             | Type     | Description                                              |
| ------------------ | -------- | -------------------------------------------------------- |
| `upstreamRequests` | `number` | Range requests sent to the underlying feed.              |
| `memoryHits`       | `number` | Answers served entirely from memory.                     |
| `sharedRequests`   | `number` | Requests that joined an identical one already in flight. |
| `liveUpstreams`    | `number` | Upstream live subscriptions currently open.              |
| `liveSubscribers`  | `number` | Live subscribers currently fed.                          |
| `intervals`        | `number` |                                                          |
| `retainedLevels`   | `number` |                                                          |

### `Quote` [#quote]

One symbol's quote.

Also exported from `@luxalgo/vela-pro-watchlist`, `@luxalgo/vela-pro/plugin`.

```typescript
interface Quote {
    symbol: string;
    last: number | null;
    prevClose: number | null;
    open: number | null;
    high: number | null;
    low: number | null;
    volume: number | null;
    change: number | null;
    changePercent: number | null;
    spark: number[];
    tick: number;
    updated: number;
    unresolved?: boolean;
}
```

| Member          | Type             | Description                                                        |
| --------------- | ---------------- | ------------------------------------------------------------------ |
| `symbol`        | `string`         |                                                                    |
| `last`          | `number \| null` |                                                                    |
| `prevClose`     | `number \| null` | The previous session's close: what Chg and Chg% are measured from. |
| `open`          | `number \| null` |                                                                    |
| `high`          | `number \| null` |                                                                    |
| `low`           | `number \| null` |                                                                    |
| `volume`        | `number \| null` |                                                                    |
| `change`        | `number \| null` |                                                                    |
| `changePercent` | `number \| null` |                                                                    |
| `spark`         | `number[]`       | Closes over the last day, oldest first.                            |
| `tick`          | `number`         | Price increment, for formatting.                                   |
| `updated`       | `number`         |                                                                    |
| `unresolved?`   | `boolean`        | No provider serves the symbol.                                     |

### `QuoteSource` [#quotesource]

Also exported from `@luxalgo/vela-pro-watchlist`, `@luxalgo/vela-pro/plugin`.

```typescript
interface QuoteSource {
    watch(symbol: string, onQuote: (q: Quote) => void): () => void;
    dailyBars?(symbol: string, count: number): Promise<readonly OHLCV[]>;
}
```

| Member         | Type                                                           | Description                                                                                                                                                                                                                                     |
| -------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `watch()`      | `(symbol: string, onQuote: (q: Quote) => void) => () => void`  | Follow `symbol`'s quote; `onQuote` gets every change. Returns the unsubscribe.                                                                                                                                                                  |
| `dailyBars?()` | `(symbol: string, count: number) => Promise<readonly OHLCV[]>` | Up to `count` daily bars of `symbol`, oldest first; the last may be today's, still forming. Rejects when no history can be had. Optional: without it, the figures read from daily history (period returns, drawdowns, correlations) stay empty. |

See also: [`Quote`](/docs/pro/api/data-feeds#quote). From `@luxalgo/vela/plugin`: `OHLCV`.

### `TapeTrade` [#tapetrade]

Also exported from `@luxalgo/vela-pro/plugin`.

```typescript
interface TapeTrade {
    id: string;
    time: number;
    price: number;
    size: number;
    side: 'buy' | 'sell';
}
```

| Member  | Type              | Description       |
| ------- | ----------------- | ----------------- |
| `id`    | `string`          |                   |
| `time`  | `number`          |                   |
| `price` | `number`          |                   |
| `size`  | `number`          |                   |
| `side`  | `'buy' \| 'sell'` | The taker's side. |

### `TickAdapterOptions` [#tickadapteroptions]

```typescript
interface TickAdapterOptions {
    store: TickAnchorStore;
    publicCryptoTrades?: boolean;
    maxHistoryRequests?: number;
}
```

See also: [`TickAnchorStore`](/docs/pro/api/data-feeds#tickanchorstore).

### `TickAggregateOptions` [#tickaggregateoptions]

```typescript
interface TickAggregateOptions {
    symbolInfo?: SymbolInfo;
    session?: string;
    calendarWindows?: ReadonlyArray<readonly [number, number]>;
}
```

From `@luxalgo/vela/plugin`: `SymbolInfo`.

### `TickAnchor` [#tickanchor]

How tick counting resets to form `nT` bars for a given market:

* `'session'`: reset at each trading session open (from `SymbolInfo.session` + `timezone` and `DataProvider.getCalendar` when available; UTC 00:00 for 24×7 markets).
* `'timeOfDay'`: reset daily at a user-chosen `HH:MM` wall-clock time in `timezone` (defaults to the market's own `SymbolInfo.timezone`, else `'Etc/UTC'`).
* `'timestamp'`: anchor tick #0 at an exact epoch-ms instant (ticks before it group backward so a bar boundary lands right on the anchor; ticks at/after count forward).
* `'rolling'`: continuous count from the first tick with no periodic resets.

```typescript
type TickAnchor =
    | { readonly mode: 'session' }
    | { readonly mode: 'timeOfDay'; readonly time: string; readonly timezone?: string }
    | { readonly mode: 'timestamp'; readonly time: number }
    | { readonly mode: 'rolling' };
```

### `TickAnchorStorage` [#tickanchorstorage]

Storage adapter for per-market tick anchor overrides.

```typescript
interface TickAnchorStorage {
    load(): Record<string, TickAnchor>;
    save(anchors: Readonly<Record<string, TickAnchor>>): void;
}
```

See also: [`TickAnchor`](/docs/pro/api/data-feeds#tickanchor).

### `TickBarFeed` [#tickbarfeed]

Optional pre-aggregated tick-bar surface on a `DataProvider`, discovered via [`hasTickBarFeed`](/docs/pro/api/data-feeds#hastickbarfeed). Use when your backend computes anchored `nT` bars server-side.

```typescript
interface TickBarFeed {
    getTickBars(
        ticker: string,
        ticksPerBar: number,
        range: BarRange,
        anchor: TickAnchor,
    ): Promise<OHLCV[]>;
    subscribeTickBars?(
        ticker: string,
        ticksPerBar: number,
        onBar: (bar: OHLCV) => void,
        opts?: { session?: string; anchor?: TickAnchor },
    ): () => void;
    supportsTicks?(ticker: string): boolean | Promise<boolean>;
}
```

See also: [`TickAnchor`](/docs/pro/api/data-feeds#tickanchor). From `@luxalgo/vela/plugin`: `BarRange`, `OHLCV`.

### `TickFeed` [#tickfeed]

Optional tick-print surface on a `DataProvider`, discovered via [`hasTickFeed`](/docs/pro/api/data-feeds#hastickfeed). Implementing this lets Vela Pro build any `nT` timeframe with full per-market anchoring and live streaming from raw ticks.

```typescript
interface TickFeed {
    getTicks(ticker: string, range: TickRange): Promise<TickPrint[]>;
    subscribeTicks?(ticker: string, onTicks: (ticks: readonly TickPrint[]) => void): () => void;
    supportsTicks?(ticker: string): boolean | Promise<boolean>;
}
```

See also: [`TickPrint`](/docs/pro/api/data-feeds#tickprint), [`TickRange`](/docs/pro/api/data-feeds#tickrange).

### `TickPrint` [#tickprint]

One individual trade / price print used to build `nT` tick bars.

```typescript
interface TickPrint {
    time: number;
    price: number;
    volume?: number;
    id?: string;
}
```

| Member    | Type     | Description                                                       |
| --------- | -------- | ----------------------------------------------------------------- |
| `time`    | `number` | Trade execution timestamp in Unix epoch milliseconds.             |
| `price`   | `number` | Execution price.                                                  |
| `volume?` | `number` | Trade size / volume (defaults to 0 when omitted).                 |
| `id?`     | `string` | Optional venue trade id for deduplicating REST/WebSocket overlap. |

### `TickRange` [#tickrange]

Query window for `TickFeed.getTicks`.

```typescript
interface TickRange {
    from?: number;
    to?: number;
    limit?: number;
    session?: string;
}
```

| Member     | Type     | Description                                                                |
| ---------- | -------- | -------------------------------------------------------------------------- |
| `from?`    | `number` |                                                                            |
| `to?`      | `number` |                                                                            |
| `limit?`   | `number` | Target maximum number of ticks to return (newest first or ending at `to`). |
| `session?` | `string` |                                                                            |

### `TickStyleChart` [#tickstylechart]

Minimal chart surface needed by [`bindTickStyleSwitch`](/docs/pro/api/data-feeds#bindtickstyleswitch) (satisfied by Vela charts and unit fakes).

```typescript
interface TickStyleChart {
    readonly market: { readonly timeframe?: string };
    readonly renderer: {
        get(feature: string): unknown;
        applyConfig(patch: unknown): void;
        onConfigChanged(cb: () => void): () => void;
    };
    on(event: 'market:changed', cb: (e: { symbol: string; timeframe: string }) => void): () => void;
}
```

## Constants [#constants]

### `DEFAULT_TICK_ANCHOR` [#default_tick_anchor]

Default anchor: start of each asset trading session.

```typescript
const DEFAULT_TICK_ANCHOR: TickAnchor;
```

See also: [`TickAnchor`](/docs/pro/api/data-feeds#tickanchor).

### `DEFAULT_TICK_ANCHORS_STORAGE_KEY` [#default_tick_anchors_storage_key]

```typescript
const DEFAULT_TICK_ANCHORS_STORAGE_KEY: 'vela-pro.tickAnchors';
```

### `DEFAULT_TICK_PRESETS` [#default_tick_presets]

```typescript
const DEFAULT_TICK_PRESETS: readonly string[];
```

### `SINGLE_TICK_REPLACED_STYLES` [#single_tick_replaced_styles]

Styles whose OHLC body/wick representation is meaningless on single-tick (`1T`) bars.

```typescript
const SINGLE_TICK_REPLACED_STYLES: ReadonlySet<string>;
```

### `TICK_PERSISTENCE_KEY` [#tick_persistence_key]

```typescript
const TICK_PERSISTENCE_KEY: 'vela-pro.tickAnchors';
```

### `TICK_SERIES_ADAPTER_ID` [#tick_series_adapter_id]

```typescript
const TICK_SERIES_ADAPTER_ID: 'vela-pro.ticks';
```

### `TICK_STYLE_PERSISTENCE_KEY` [#tick_style_persistence_key]

```typescript
const TICK_STYLE_PERSISTENCE_KEY: 'vela-pro.tickStyle';
```

### `tickAnchorStore` constant [#tickanchorstore-constant]

Shared singleton anchor store used by [`enableTickCharts`](/docs/pro/api/enablers#enabletickcharts) and runtime helpers.

```typescript
const tickAnchorStore: TickAnchorStore;
```

See also: [`TickAnchorStore`](/docs/pro/api/data-feeds#tickanchorstore).
