Change Metrics
- Definition
- Units
- Examples
- API examples
- Get timeseries data of a change metric
- Get aggregated value for multiple assets metric](#get-timeseries-data-of-a-change-metric)
- Get aggregated value for multiple assets
Definition
The metrics with the suffix _change_<interval>
indicate the percent value
change at the given time compared to interval
time ago. This allows the
percent changes to be fetched historically and to be plotted on charts.
Change metrics' names are formed from the original metric name and a change suffix. Available change intervals and their suffixes are:
_change_1h
- 1 hour. Available only for USD price_change_1d
- 1 day_change_7d
- 7 days_change_30d
- 30 days
Note: Change metrics are also available for some of the Timebound Metrics. In such cases, both suffixes are appended, and their order is important. In all cases, the order is timebound suffix, followed by change suffix.
Units
The metric units are numbers where 0
corresponds to 0% change, 1
corresponds
to 100% change. Negative values indicate decrease. These values cannot be
aggregated using SUM
. The default aggregation is LAST
.
Examples
price_usd_change_1d
This metric represents the 24h price percent change.
circulation_180d_change_1d
This metric represents the 24h percent change of the circulation_180d
timebound metric
API examples
Get timeseries data of a change metric
1 2 3 4 5 6 7 8 9 10 11 12 13
{ getMetric(metric: "price_usd_change_1d") { timeseriesData( slug: "bitcoin" from: "utc_now-7d" to: "utc_now" interval: "1d" ) { datetime value } } }
Get aggregated value for multiple assets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
# The default aggregation is LAST. The last known value, but
# no older than 6 hours, is returned for every asset
allProjects(page: 1, pageSize: 20){
slug
priceChange24h: aggregatedTimeseriesData(
metric: "price_usd_change_1d"
from: "utc_now-6h"
to: "utc_now")
tradingVolumeChange24h: aggregatedTimeseriesData(
metric: "volume_usd_change_1d"
from: "utc_now-6h"
to: "utc_now")
}
}