Skip to content

charton API


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

Function: createDataSourceRouter() ​

createDataSourceRouter(routes, options?): DataSourceRouter

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

One data source over several feeds, chosen by a prefix on the chart's symbols: with routes { 'FEED-A': { source: a }, 'FEED-B': { source: b } } the symbol 'FEED-A:BTC/USD' is 'BTC/USD' on a. Symbols split at the first separator only, so feed symbols may contain it. Resolved and searched symbols come back prefixed, with exchange set to the route's name; a gets its own symbol info back in history and the other calls.

Search queries every route and merges the results in route order; a failed route is reported to onError and left out, and the search rejects only when every route failed. Each route's connection status is passed on while the route has live bars open, or while no route has; its resets carry the routed symbol. Quotes, adjustments, markers and server time go to the routed source when it supports them; the router has each optional method that at least one route has.

Parameters ​

routes ​

Readonly<Record<string, DataSourceRoute>>

options? ​

DataSourceRouterOptions = {}

Returns ​

DataSourceRouter