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
readonlysearchFilters: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()?
optionaladjustments(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
request
Returns
Promise<Adjustment[]>
Inherited from
history()
history(
symbol,interval,request):Promise<BarsResult>
Defined in: packages/core/src/data/types.ts:216
Bars for request, ascending by time.
Parameters
symbol
interval
request
Returns
Promise<BarsResult>
Inherited from
markers()?
optionalmarkers(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
interval
request
Returns
Promise<SourceMarker[]>
Inherited from
now()?
optionalnow():Promise<number>
Defined in: packages/core/src/data/types.ts:243
The source's current time, unix seconds.
Returns
Promise<number>
Inherited from
onReset()?
optionalonReset(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
onStatus()?
optionalonStatus(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
quotes()?
optionalquotes(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
onQuote
(quote) => void
Returns
() => void
Inherited from
search()
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
stream()?
optionalstream(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
interval
onBar
(bar) => void
Returns
() => void
Inherited from
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>