Skip to content

charton API


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

Function: createOhlcvDataSource() ​

createOhlcvDataSource(exchange, options?): DataSource

Defined in: packages/core/src/data/ohlcv.ts:99

A data source over an exchange object from a unified exchange library (see OhlcvExchange). History is paged forward from a computed start time, at most maxBarsPerRequest rows per request; symbols come from the exchange's markets, with the intervals its timeframes list; live bars come from the stream when the exchange has one, otherwise from polling the newest rows.

Parameters ​

exchange ​

OhlcvExchange

options? ​

OhlcvDataSourceOptions = {}

Returns ​

DataSource

Example ​

ts
// `exchange` is an instance from the exchange library the app installs.
chart.setDataSource(createOhlcvDataSource(exchange, { maxBarsPerRequest: 1000 }));
await chart.setSymbol('BTC/USD', '1h');