Skip to content

charton API


charton API / @chart-on/core / index / DataSourceRouter

Interface: DataSourceRouter ​

Defined in: packages/core/src/data/router.ts:36

A data source over several feeds, plus the exchange filter for a symbol search dialog.

Extends ​

Properties ​

searchFilters ​

readonly searchFilters: object

Defined in: packages/core/src/data/router.ts:43

One exchange filter option per route, its name as value and label, in route order.

exchanges ​

exchanges: object[]

Methods ​

adjustments()? ​

optional adjustments(symbol, request): Promise<Adjustment[]>

Defined in: packages/core/src/data/types.ts:251

Splits, dividends and other corporate actions taking effect in request's range, so the chart can back-adjust older bars (see the adjustment chart option). Asked for after each batch of bars, over that batch's span. Bars must come unadjusted when this is present. Without it the bars are shown as sent. A noun, like the other lookups.

Parameters ​

symbol ​

SymbolInfo

request ​

RangeRequest

Returns ​

Promise<Adjustment[]>

Inherited from ​

DataSource.adjustments


history() ​

history(symbol, interval, request): Promise<BarsResult>

Defined in: packages/core/src/data/types.ts:216

Bars for request, ascending by time.

Parameters ​

symbol ​

SymbolInfo

interval ​

Interval

request ​

BarsRequest

Returns ​

Promise<BarsResult>

Inherited from ​

DataSource.history


markers()? ​

optional markers(symbol, interval, request): Promise<SourceMarker[]>

Defined in: packages/core/src/data/types.ts:260

Markers (see SourceMarker) at times in request's range, for bars and the time axis alike. Asked for around the visible range as the view moves, afresh after every symbol or interval change and after a reset (onReset) of the shown bars; never while the marks and timeMarks options are both off. Invalid markers are dropped. Named for what draws them, annotation markers.

Parameters ​

symbol ​

SymbolInfo

interval ​

Interval

request ​

RangeRequest

Returns ​

Promise<SourceMarker[]>

Inherited from ​

DataSource.markers


now()? ​

optional now(): Promise<number>

Defined in: packages/core/src/data/types.ts:243

The source's current time, unix seconds.

Returns ​

Promise<number>

Inherited from ​

DataSource.now


onReset()? ​

optional onReset(listener): () => void

Defined in: packages/core/src/data/types.ts:231

Report bars that changed after they were sent; the chart refetches them through history. A subscription on the source, not an argument of stream, so that sources without a stream (REST, polling, static) can report corrections too, everything that reads the source's bars (the main series, other symbols' bars in indicators) refetches through one path, and it works like onStatus. Returns an unsubscribe function.

Parameters ​

listener ​

(reset) => void

Returns ​

() => void

Inherited from ​

DataSource.onReset


onStatus()? ​

optional onStatus(listener): () => void

Defined in: packages/core/src/data/types.ts:236

Report connection changes. After reconnecting then connected, the chart refetches the bars missed meanwhile. Returns an unsubscribe function.

Parameters ​

listener ​

(status) => void

Returns ​

() => void

Inherited from ​

DataSource.onStatus


quotes()? ​

optional quotes(symbol, onQuote): () => void

Defined in: packages/core/src/data/types.ts:241

Stream the best bid and ask for the bid and ask reference lines. Each quote replaces the previous one. Returns an unsubscribe function.

Parameters ​

symbol ​

SymbolInfo

onQuote ​

(quote) => void

Returns ​

() => void

Inherited from ​

DataSource.quotes


search(query, request?): Promise<SymbolInfo[]>

Defined in: packages/core/src/data/router.ts:41

Searches every route, or only one: the route whose prefix starts the query ('FEED-A:abc'), or the route named by request.exchange.

Parameters ​

query ​

string

request? ​
exchange? ​

string

Returns ​

Promise<SymbolInfo[]>

Overrides ​

DataSource.search


stream()? ​

optional stream(symbol, interval, onBar): () => void

Defined in: packages/core/src/data/types.ts:222

Stream live bars. A bar with the current last time replaces it, a newer one appends, older ones are ignored. Bars sent earlier that changed are reported through onReset, not here. Returns an unsubscribe function.

Parameters ​

symbol ​

SymbolInfo

interval ​

Interval

onBar ​

(bar) => void

Returns ​

() => void

Inherited from ​

DataSource.stream


symbol() ​

symbol(symbol): Promise<SymbolInfo>

Defined in: packages/core/src/data/types.ts:212

The symbol's description; throw (or reject) when the source does not know it.

Parameters ​

symbol ​

string

Returns ​

Promise<SymbolInfo>

Inherited from ​

DataSource.symbol