Skip to content

charton API


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

Interface: OhlcvExchange ​

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

The exchange object the adapter calls: the market data methods that unified exchange libraries share. Any object with these members works; the adapter imports no library.

Properties ​

has? ​

optional has?: Readonly<Record<string, unknown>>

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

Capability flags; watchOHLCV: false means the exchange has no stream, so it is polled.


name? ​

optional name?: string

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

Display name, used as SymbolInfo.exchange.


timeframes? ​

optional timeframes?: Readonly<Record<string, unknown>> | readonly string[]

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

Supported timeframes, as an array or as the keys of an object ('1m', '1h', '1d', '1w', '1M'...). Without it every interval is passed through.

Methods ​

fetchOHLCV() ​

fetchOHLCV(symbol, timeframe, since?, limit?): Promise<readonly OhlcvRow[]>

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

Up to limit rows from since (ms, inclusive) on, oldest first; the newest rows without since.

Parameters ​

symbol ​

string

timeframe ​

string

since? ​

number

limit? ​

number

Returns ​

Promise<readonly OhlcvRow[]>


loadMarkets() ​

loadMarkets(): Promise<Readonly<Record<string, OhlcvMarket | undefined>> | readonly (OhlcvMarket | undefined)[]>

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

Markets by symbol, or as a list. Called once; a failure is retried on the next lookup. Empty entries are skipped: libraries type their market map as possibly holding undefined.

Returns ​

Promise<Readonly<Record<string, OhlcvMarket | undefined>> | readonly (OhlcvMarket | undefined)[]>


unWatchOHLCV()? ​

optional unWatchOHLCV(symbol, timeframe): Promise<unknown>

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

Ends the stream watchOHLCV started.

Parameters ​

symbol ​

string

timeframe ​

string

Returns ​

Promise<unknown>


watchOHLCV()? ​

optional watchOHLCV(symbol, timeframe): Promise<readonly OhlcvRow[]>

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

Resolves with the latest rows each time the forming bar changes.

Parameters ​

symbol ​

string

timeframe ​

string

Returns ​

Promise<readonly OhlcvRow[]>