Skip to content

charton API


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

Interface: RestDataSourceOptions ​

Defined in: packages/core/src/data/adapters.ts:126

Options for the REST data source: how to build a history URL, how to map the JSON response to bars, the known symbols, and the request init and fetch to use.

Properties ​

fetch? ​

optional fetch?: {(input, init?): Promise<Response>; (input, init?): Promise<Response>; }

Defined in: packages/core/src/data/adapters.ts:135

Defaults to the global fetch.

Call Signature ​

(input, init?): Promise<Response>

MDN Reference

Parameters ​
input ​

URL | RequestInfo

init? ​

RequestInit

Returns ​

Promise<Response>

Call Signature ​

(input, init?): Promise<Response>

MDN Reference

Parameters ​
input ​

string | URL | Request

init? ​

RequestInit

Returns ​

Promise<Response>


init? ​

optional init?: RequestInit

Defined in: packages/core/src/data/adapters.ts:133


symbols? ​

optional symbols?: SymbolInfo[] | ((symbol) => Promise<SymbolInfo>)

Defined in: packages/core/src/data/adapters.ts:132

Known symbols (enables search), or a resolver; defaults to { symbol, name: symbol }.

Methods ​

map() ​

map(json, request): Bar[] | BarsResult

Defined in: packages/core/src/data/adapters.ts:130

Turn the parsed JSON response into bars. A bare array leaves atStart unknown.

Parameters ​

json ​

unknown

request ​

BarsRequest

Returns ​

Bar[] | BarsResult


url() ​

url(symbol, interval, request): string

Defined in: packages/core/src/data/adapters.ts:128

URL for a history request.

Parameters ​

symbol ​

SymbolInfo

interval ​

Interval

request ​

BarsRequest

Returns ​

string