Redstone query
Redstone query is an extra interface exported by the Redstone API. It uses a human readable syntax to facilitate query creation.
Fluent interface for redstone
Redstone API supports a fluent interface to simplify the syntax.
Importing
To use the fluent interface you should first import the redstone-api in a standard way
Usage
All redstone queries consist of 4 parts:
Query initialisation (
redstone.query()
)What to fetch (
symbol,
symbols
orallSymbols
)For which date/dates (
latest
,atDate
,forLastHours
,hoursAgo
,fromDate
,toDate
)Query execution (
exec
)
Examples
Get the latest price for a single token
Get the historical price for a single token
💡 Note: The argument passed to atDate
must be convertable to date. 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 the last X hours
Get the historical price for X hours ago
Get the historical price for the last X days
Get the historical prices in a time range
Get the latest prices for several tokens
Get the historical prices for several tokens
Get prices for all available tokens
Last updated