Links
📈

Get project's historical metrics

TL;DR

You can fetch project's historical metrics with this endpoint. You can use the following examples in cURL and Python to get started within seconds. The query fetches Aave's historical Fee data, aggregated on chain-level.
cURL
Python
1
# Set your API Key here.
2
API_TOKEN="d3adb33f-c123-45b6-7890-c0ff33"
3
curl \
4
-H "content-type: application/json" \
5
-H "authorization: Bearer $API_TOKEN" \
6
"https://api.tokenterminal.com/v2/projects/aave/metrics?metrics=fees&aggregate_by=chain"
1
import requests
2
# Set your API Key here.
3
API_TOKEN="d3adb33f-c123-45b6-7890-c0ff33"
4
params = {"metrics": "fees", "aggregate_by": "chain"}
5
headers = {"Authorization": f"Bearer {API_TOKEN}"}
6
r = requests.get("https://api.tokenterminal.com/v2/projects/aave/metrics", params=params, headers=headers)
7
r.json()

Deep dive

This endpoint gives access to project's historical metrics. The aggregation-level can be controlled dynamically with query parameters.
GET v2/projects/:project_id/metrics
The slug on the Project dashboard should be used as the Path parameter. Alternatively you can use the Get projects endpoint to get the project_id.

Retrieve project metrics

In this section we will deep dive further to how the endpoint can be used. In essence, query parameters can be used in an SQL-like fashion to slice, aggregate and filter response data.
If you are interested in accessing the data with SQL, our upcoming enterprise offering might be interesting to you. On top of our fundamentals data, the enterprise offering gives you also access to block, log and transaction-level data on 10+ blockchains.
Contact us at [email protected] if this spikes your interest! We will add you to the waitlist for early beta.

Parameters

metrics: comma-separated list of strings: metrics you are interested in, e.g. fees, revenue, gmv.
aggregate_by: comma-separated list of strings: aggregation-level you are interested in, e.g. chain, version, business_line.
interval: string: interval in which you want to query the data. Current options: 1d or 1m.
start: string: ISO 8601 formatted string, e.g. 2022-01-01. Define when you want the data to start.
end: string: ISO 8601 formatted string, e.g. 2022-10-01. Define when you want the data to end.
order_direction: string: choose the sorting direction. Options: asc or desc.

Response

Depending on which query parameters are being used, certain fields can be aggregated. To make which parts of the response object are always present and and which are optional, we will further note them the following way:
  • always: this data point will always be in the response object.
  • aggregate: this data point will be in the response object if it has been chosen as an aggregation field.
  • metric: this data point will be in the response object if it has been chosen as a metric field. At least 1 metric field has to be chosen at any given time.

Attributes

timestamp (always): timestamp: conforming to the yyyy-mm-dd'T'hh:mm:ss'Z' format.
project_name (always): string: human-readable version of project's name.
business_line (aggregate): string: subdivision of project's product, e.g. lending or flash loans.
business_model (aggregate): string: the model how a certain metric is accruing value, e.g. interest or transaction-based.
chain (aggregate): string: the network where the metric is accruing value, e.g. Ethereum or Polygon.
version (aggregate): string: the version of the business, e.g. Uniswap V2 or V3.
metric_name (metric): float: the metric accruing value, e.g. Fees, Revenue, Token incentives. Each metric is represented as its own field.
The following response is an example response with Aave's fee data on chain granularity. The fields can be categorized the following way:
  • always: timestamp, project_name
  • aggregate: chain
  • metric: fees
{
"data": [
{
"chain": "arbitrum",
"fees": 704.6724324275447,
"project_name": "Aave",
"timestamp": "2022-10-11T00:00:00.000Z"
},
{
"chain": "avalanche",
"fees": 49149.80115901981,
"project_name": "Aave",
"timestamp": "2022-10-11T00:00:00.000Z"
},
{
"chain": "ethereum",
"fees": 68218.88761831833,
"project_name": "Aave",
"timestamp": "2022-10-11T00:00:00.000Z"
},
{
"chain": "polygon",
"fees": 2048.10850928927,
"project_name": "Aave",
"timestamp": "2022-10-11T00:00:00.000Z"
},
]
}