API Reference

Santiment team

2019-09-20

Available Queries

The getMetric Query

The getMetric API gives a unified API for many different metrics across the whole universe of supported assets. The query allows to get metadata about a given metric and asset, as well as fetch the values of the metric in a unified way.

Note:

The metrics are updated 4 times a day at 6 hour intervals. We are working on reducing this interval.

Supported assets:

Bitcoin Ethereum ERC-20 Ripple EOS EOS tokens Binance Chain

Available projects per metric

The getMetric API supports a large list of assets identified by their slug. For a given metrics you can fetch the list of available slugs with this query:

{
  getMetric(metric: "mvrv_usd"){
    metadata{
      availableSlugs
    }
  }
}

Run in explorer

There are 2 fields that can be queried on getMetric and each of them has additional subfields: metadata and timeseriesData

timeseriesData

To fetch the values for a given metric, slug and time interval you can use the timeseriesData subquery of the getMetric API.

Parameters:

Parameter Description
slug The slug of the project
from From which date to return the values in ISO 8601 format
to Till which date to return the values in ISO 8601 format
interval The intervals that should be returned. Default is 1d, which is daily
aggregation The aggregation to be used when fetching data for longer intervals. Optional

The aggregation parameter is optional and if not provided - every metric has a default one that fits best. You can see the default aggregation function using the metadata query.

Example:

{
  getMetric(metric: "transaction_volume") {
    timeseriesData(
      slug: "santiment"
      from: "2019-01-01T00:00:00Z"
      to: "2019-09-01T00:00:00Z"
      interval: "7d"
      aggregation: SUM) {
        datetime
        value
    }
  }
}

Run in explorer

If you change the aggregation parameter to AVG it will return the average transaction volume over each 7 day interval. You can see how this API can be quite powerful and flexible.

Available metrics per project

The set of available metrics is not the same for each asset. We are trying to have all metrics for all assets, but this is not always possible. In order to find which are the available metrics for a given asset you can use the projectBySlug query, like this:

{
  projectBySlug(slug: "santiment") {
    availableMetrics
  }
}

Run in explorer

availableSince

To fetch the date from which a given metric is available for a project:

{
  getMetric(metric: "transaction_volume") {
    availableSince(slug: "santiment")
  }
}

A metric is usually available for a given asset since the creation of the contract/blockchain.

Exception to this statement is when pricing data is needed in order to calculate the metric, but we are missing pricing data. For example, Bitcoin is working since the beginning of 2009, but because there were no exchanges and markets for over an year, the pricing data starts from July 2010. This means that MVRV, which requires market capitalization, is also available since July 2010.

Run in explorer

metadata

Each metric has metadata describing:

Minimal Resolution

Different queries are available with different granularities. The minimal interval you can get data for can be fetched by executing:

{
  getMetric(metric: "mvrv_usd"){
    metadata{
      minInterval
    }
  }
}

Run in explorer

Aggregation

When an interval bigger than minInterval is provided for a given metric more than 1 data point values will be aggregated into a single data point.

The aggregations types are:

The following query fetches the default aggregation:

{
  getMetric(metric: "daily_active_addresses") {
    metadata {
      defaultAggregation
    }
  }
}

Run in explorer

To get the full metadata of a metric do the following:

{
  getMetric(metric: "circulation_1d") {
    metadata {
      availableSlugs
      minInterval
      defaultAggregation
    }
  }
}

Run in explorer