Broker-agnostic market-data source. The chart depends only on this. subscribeBars is optional: a history-only feed (e.g. OpenAlgoDataFeed) omits it, while a live feed (OpenAlgoLiveDataFeed, or your own) implements it.

Implements

Constructors

Properties

getBarsPage?: (req: BarsPageRequest) => Promise<BarsPage>
source: DataFeed

The wrapped feed, for callers that need something this wrapper does not forward.

subscribeBars?: (
    req: BarsRequest,
    onBar: (bar: Bar, meta?: LiveBarMeta) => void,
    ...rest: unknown[],
) => UnsubscribeFn
subscribeDepth?: (
    req: BarsRequest,
    onDepth: (depth: MarketDepth) => void,
    ...rest: unknown[],
) => UnsubscribeFn

opts.depthLevel requests a book depth (broker-dependent: 5/20/30/50). Named on the interface so a caller holding a DataFeed can ask for one; an implementation is free to ignore it and send the broker's default.

Methods

  • Drop one series, or (with no argument) everything this cache knows of. "Knows of" is literal with an injected persistent store: recency and size are tracked in memory, so keys written by an earlier session are dropped when they are next read and found expired, not by clear(). A store that outlives the process is responsible for its own overall quota.

    Parameters

    • Optionalreq: Pick<BarsRequest, "symbol" | "exchange" | "interval">

    Returns Promise<void>