getHistoricalPrice
getHistoricalPrice method is used to fetch historical prices data. It can fetch prices in a time range for a single token or a historical price for single or several tokens
Get a single historical price for a single token
▸ getHistoricalPrice(symbol
: string, opts
: GetHistoricalPriceOptions): Promise<PriceData>
Returns the historical price for a single token
remarks
Full list of supported tokens is available at https://github.com/limestone-finance/limestone-api/blob/main/ALL_SUPPORTED_TOKENS.md
Parameters:
Name | Type | Description |
| string | Token symbol (string) |
| GetHistoricalPriceOptions | Optional params (object) opts.date: Date for the historical price opts.provider: provider name (string) * opts.verifySignature: enable signature verification (boolean) |
Returns: Promise<PriceData>
The historical price for token
Defined in: limestone-api.ts:116
Get historical price in a time range for a single token
▸ getHistoricalPrice(symbol
: string, opts
: GetHistoricalPriceForIntervalOptions): Promise<PriceData[]>
Returns the historical prices for a token in a time range with the specified interval
remarks
This method can be used to display charts with historical prices. Full list of supported tokens is available at https://github.com/limestone-finance/limestone-api/blob/main/ALL_SUPPORTED_TOKENS.md
Parameters:
Name | Type | Description |
| string | Token symbol |
| GetHistoricalPriceForIntervalOptions | Options object. It must contain startDate, endDate, and interval properties. opts.startDate: Start time for the time range (date | timestamp | string) opts.endDate: End time for the time range (date | timestamp | string) opts.interval: Interval in milliseconds (number) opts.provider: provider name (string) * opts.verifySignature: enable signature verification (boolean) |
Returns: Promise<PriceData[]>
The historical prices for the symbol with the passed interval
Defined in: limestone-api.ts:138
Get a single historical price for several tokens
▸ getHistoricalPrice(symbols
: string[], opts
: GetHistoricalPriceOptions): Promise<{ [token: string]: PriceData; }>
Returns the historical prices for several tokens
Parameters:
Name | Type | Description |
| string[] | Array of token symbols |
| GetHistoricalPriceOptions | Options object. It must contain the date property. opts.date: Date for the historical price (date | timestamp | string) opts.provider: provider name (string) * opts.verifySignature: enable signature verification (boolean) |
Returns: Promise<{ [token: string]: PriceData; }>
The historical prices for several tokens
Defined in: limestone-api.ts:153
Examples
Get the historical price for a single token
To get the historical price use the getHistoricalPrice
method.
The date
argument must be convertable to Date type. You may pass date (e.g. new Date(2021-04-01)
), timestamp (e.g. 1617709771289
), or just string (e.g. 2021-04-01
or 2021-04-01T12:30:58
)
Get the historical price for several tokens
To fetch the historical price for several tokens pass an array of symbols to getHistoricalPrice
method.
Get the historical prices in a time range
To fetch the historical prices in a time range specify token symbol as the first argument of the getHistoricalPrice
method, and startDate
, endDate
and interval
as fields of the second argument.
Currently Limestone API supports fetching historical prices in a time range only for a single token
The startDate
and endDate
arguments must be convertable to Date type.
Last updated