Background
Some data endpoints have a /historical
variant. They are very similar to their regular, non-historical counterparts, and share the same fields. However, they return a range of points in time instead of the latest results for that query.
The range is specified by the from
and to
parameters. There's a slight difference on how they work depending on whether the endpoint returns offchain or onchain data.
at
parameter
at
parameterSome data endpoints have an at
parameter, specifying a point in the past to fetch data for. If the field is omitted or is null, the latest
data is returned. The valid values for at depending on whether the endpoint returns offchain or onchain data.
Offchain data endpoints
For offchain data endpoints, the at
parameter is always a ISO 8601 string.
Currently, the only offchain data endpoint is /prices.
Onchain data endpoints
For onchain data endpoints, the at
parameter can be either a ISO 8601 string - which is resolved to the nearest block number in the given blockchain - or an exact integer block number.
Historical endpoints
The same endpoints that allow an at
parameter also have an /historical
variant. They are very similar to their regular, non-historical counterparts, and share the same fields.
The range is specified by the from
and to
parameters. There's a slight difference on how they work depending on whether the endpoint returns offchain or onchain data.
Offchain data endpoints
For offchain data endpoints, the from
and to
parameters are always ISO 8601 strings.
The response has a historical
field holding the from
and to
values provided. Inside items
there's a list of objects holding a timestamp and the actual item at that point in time.
Currently, the only offchain data endpoint is /prices/historical.
Onchain/blockchain data endpoints
For onchain data endpoints, the requests always refer to a blockchain block, so besides timestamps, we can also use block numbers the points in time we want to query at. Thus, the from and to parameters can be either ISO 8601 strings or integer block numbers. Both are internally resolved to a list of block numbers.
The response has a historical field holding from and to. They're both blockstamps, objects holding a blockchain, a block number and the block's timestamp. Inside items there's a list of objects holding a blockstamp and the actual item at that point in time.
Currently all historical endpoints except /prices/historical
are onchain.
Data Granularity
Historical data is returned as a timeseries with daily granularity by default. When providing from
or to
timestamps as ISO 8601 strings, they will be rounded to midnight UTC of the nearest day.
For example, a query with from="2024-01-15T16:30:00Z"
will return data points starting from 2024-01-15T00:00:00Z
.
For higher frequency data with finer granularity (e.g. hourly or minute-level data points), please contact our sales team here.