Assets
What is this endpoint for?
This endpoint receives information on the trades involving a particular asset. Information includes volumes, trade counts, liquidity, and supply. All information is broken down by exchange. Trade data is aggregated across all instruments that include the specified token as a base or quote asset, whereas liquidity data is aggregated for the base asset only.
Endpoint
https://us.market-api.kaiko.io/v2/data/analytics.v2/asset_metrics
Parameters
Fields
For any field in the "token information" category, we only cover ERC-20 tokens. Only 50 tokens have been backfilled, but we can add more on demand.
Request examples
curl --compressed -H 'Accept: application/json' -H 'X-Api-Key: <client-api-key>' \
'https://us.market-api.kaiko.io/v2/data/analytics.v2/asset_metrics?interval=1d&asset=agix&start_time=2023-01-25T00:00:00.000Z&end_time=2023-01-26T00:00:00.000Z&page_size=100&sources=true'
import http.client
import json
# Enter your Kaiko API Key
api_key = "KAIKO_API_KEY"
api_host = "us.market-api.kaiko.io"
api_base_endpoint = "/v2/data/analytics.v2/asset_metrics"
# Start of mandatory parameter configuration
mandatory_params = {
"asset": "agix",
"start_time": "2024-08-27T13:13:53.441Z",
"end_time" : "2024-09-27T13:27:53.441Z",
"interval" : "1d",
}
# End of mandatory parameter configuration
# Start of optional parameter configuration
optional_params = {
"sources": "false",
}
# End of optional parameter configuration
conn = http.client.HTTPSConnection(api_host)
headers = {
"X-Api-Key": api_key,
"Accept": "application/json"
}
all_params = {**mandatory_params, **optional_params}
url_params = []
for param, value in all_params.items():
url_params.append(f"{param}={value}")
url_params = '&'.join(url_params)
endpoint_with_params = f"{api_base_endpoint}?{url_params}"
# Pagination for next pages
all_data = []
next_url = endpoint_with_params
while next_url:
conn.request("GET", next_url, headers=headers)
response = conn.getresponse()
data = json.loads(response.read().decode("utf-8"))
all_data.extend(data.get("data", []))
print(f"Fetched {len(data.get('data', []))} datapoints. Total: {len(all_data)}")
next_url = data.get("next_url", "").replace("https://us.market-api.kaiko.io", "")
if not next_url:
break
conn.close()
print(f" datapoints fetched: {(all_data)}")
Response example
{
"data": [
{
"timestamp": "2023-01-25T00:00:00.000Z",
"price": 0.1699233217119519,
"total_volume_usd": 30508181.43789653,
"total_volume_asset": 179540872.49784896,
"total_trade_count": 159684,
"off_chain_liquidity_data": {
"total_off_chain_volume_usd": 30038710.382665947,
"total_off_chain_volume_asset": 176778031.87949985,
"total_off_chain_trade_count": 159115,
"trade_data": [
{
"exchange": "binc",
"volume_usd": 27539301.29722444,
"volume_asset": 162068991,
"trade_count": 125188
},
/* ... */
],
"buy_market_depths": [
{
"exchange": "binc",
"volume_assets": {
/* ... */
},
"volume_usds": {
/* ... */
}
},
/* ... */
],
"sell_market_depths": [
{
"exchange": "binc",
"volume_assets": {
/* ... */
},
"volume_usds": {
/* ... */
}
},
/* ... */
],
"total_buy_market_depth": {
"volume_assets": {
/* ... */
},
"volume_usds": {
/* ... */
}
},
"total_sell_market_depth": {
"volume_assets": {
/* ... */
},
"volume_usds": {
/* ... */
}
}
},
"on_chain_liquidity_data": {
"total_on_chain_volume_usd": 2762840.6183491,
"total_on_chain_volume_asset": 2762840.6183491,
"total_on_chain_trade_count": 569,
"trades_data": [
{
"exchange": "usp2",
"volume_usd": 327680.4492221988,
"volume_asset": 1928401.8575017697,
"trade_count": 448
},
/* ... */
],
"token_information": [
{
"blockchain": "ethereum",
"token_address": "0x5B7533812759B45C2B44C19e320ba2cD2681b542",
"nb_of_holders": 38231,
"main_holders": [
{
"address": "0xf977814e90da44bfa03b6295a0616a897441acec",
"amount": 250774980,
"percentage": 22.61839
},
{
"address": "0x13e1367a455c45aa736d7ff2c5656ba2bd05ad46",
"amount": 112149660,
"percentage": 10.11522
},
/* ... */
],
"total_supply": 1108721700
}
]
}
}
]
}
Last updated