Metrics
This page displays the JSON representation of the "Metrics" object and a class diagram, providing a visual representation of its structure.
An Metric
is a somewhat special object, because it can be connected to different types of objects, like Assets
, Reward Options
and Validators
.
The Metric
object is used to store data independent of the object it is connected to.
It stores all numeric data with a timestamp that can be queried either as the current one or in a time series.
You can query the different properties of the Assets object, including connected Reward Options
, Metrics
, Tags
and base data like the Symbol
, Slug
and more.
The information presented on this page will give you a comprehensive understanding of the Assets object and its properties.
Please be aware that there can be 100s of unique metrics per asset, provider, validator or rewardOption. As such, the API filters out by default all metrics deemed to be of little value to most users.
If you see a need to query all metrics, please specify showAll:true
when querying metrics.
Credits are paid for each field that is returned. By specifying showAll:true
you run the risk of consuming too many credits.
Please handle with care.
- Class Diagram
- JSON
- Arguments
{
"Metric": {
"id": "ID!",
"asset": "Asset",
"provider": "Provider",
"rewardOption": "RewardOption",
"validator": "Validator",
"label": "String",
"metricKey": "String",
"tooltip": "String",
"unit": "String",
"precision": "Int",
"defaultValue": "Float!",
"editableMin": "Float",
"editableMax": "Float",
"editableInterval": "Float",
"variation": "JSON",
"changePercentages": "JSON",
"changeAbsolutes": "JSON",
"rewardOptionKeys": "JSON",
"isEditable": "Boolean",
"createdAt": "Date",
"standard": "Boolean",
"approvedLatest": "Boolean",
"approvedHistorical": "Boolean"
}
}
When using the interval
argument and no data is available for a specific interval entry, the API will backfill the data with the last available data point.
To opt-out of this behavior, set backfillInterval
to false
, which will return null
values instead in the missing entry.
Sample queries
Global Marketcap
To get the global marketcap, you can use the following query.
Please note that the asset
, provider
, rewardOption
and validator
filters are set to null
to get the global metric.
To get historical data, you can use the createdAt
filter:
See the Historical Data page for more information.
{
metrics(
where: {
asset: null
provider: null
rewardOption: null
validator: null
metricKeys: ["marketcap"]
}
limit: 1
) {
defaultValue
changeAbsolutes
changePercentages
createdAt
}
}
Historical Reward Option Metrics
The Metrics
object can also be queried for a specific Reward Option
, Asset
, Provider
or Validator
, by using the corresponding filters
This example will return the historical data of the reward rate of Ethereum for the types solo-staking
and pos
:
{
rewardOptions(
where: {
inputAsset: { symbols: ["ETH"] }
typeKeys: ["solo-staking", "pos"]
}
limit: 10
) {
metrics(
where: { metricKeys: ["reward_rate"], createdAt_lt: "2023-01-30" }
limit: 10
) {
metricKey
defaultValue
changePercentages
createdAt
}
}
}