# 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

{% code overflow="wrap" %}

```http
https://us.market-api.kaiko.io/v2/data/analytics.v2/asset_metrics
```

{% endcode %}

### Parameters

<table><thead><tr><th>Parameter</th><th width="104">Required</th><th width="318">Description</th><th>Example</th></tr></thead><tbody><tr><td><code>asset</code></td><td>Yes</td><td>The desired asset <code>code</code>.<br><br>See <a data-mention href="/pages/5iH1qlIc7aNEOOci4yMw">/pages/5iH1qlIc7aNEOOci4yMw</a></td><td><code>agix</code></td></tr><tr><td><code>start_time</code></td><td>Yes</td><td>Starting time in ISO 8601 (inclusive).</td><td><code>2023-01-25T00:00:00.000Z</code></td></tr><tr><td><code>end_time</code></td><td>Yes</td><td>Ending time in ISO 8601 (exclusive).</td><td><code>2023-01-26T00:00:00.000Z</code></td></tr><tr><td><code>interval</code></td><td>Yes</td><td>The interval parameter is suffixed with <code>h</code> or <code>d</code> to specify hours or days, respectively.<br><br>Any arbitrary value between one second and one day can be used, as long as it sums up to a maximum of 1 day. The suffixes are <code>h</code> (hour) and <code>d</code> (day).<br><br> Default: <code>1h</code>.</td><td><code>1h</code></td></tr><tr><td><code>sources</code></td><td>No</td><td>boolean. If true, returns trading information and market depths detailed by exchanges as well as main holders. <br><br>Default: <code>false</code></td><td></td></tr><tr><td><code>page_size</code></td><td>No</td><td><p>See <a data-mention href="/pages/mP3amLsYqKTsrRBoblxX">/pages/mP3amLsYqKTsrRBoblxX</a><br><br>Minimum: <code>1</code><br>Maximum: <code>100</code></p><p>Default: <code>10</code></p></td><td><code>100</code></td></tr></tbody></table>

### Fields

{% hint style="warning" %}
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.
{% endhint %}

<table><thead><tr><th width="137">Field</th><th width="115">Category</th><th width="228">Description</th><th>Example</th></tr></thead><tbody><tr><td><code>timestamp</code></td><td>Trading activity</td><td>Timestamp at which the interval begins.</td><td><code>2023-01-25T00:00:00.000Z</code></td></tr><tr><td><code>price</code></td><td>Trading activity</td><td>Average price in usd. null when no trades are reported.</td><td><code>0.1699233217119519</code></td></tr><tr><td><code>total_volume_usd</code></td><td>Trading activity</td><td>Total volume in usd traded in the interval. <br><br><code>0</code> when no trades are reported.</td><td><code>30508181.43789653</code></td></tr><tr><td><code>total_volume_asset</code></td><td>Trading activity</td><td>Total volume in number of assets traded in the interval. <br><br><code>0</code> when no trades are reported.</td><td><code>179540872.49784896</code></td></tr><tr><td><code>total_trade_count</code></td><td>Trading activity</td><td>The total amount of trades reported during the interval.<br><br><code>0</code> when no trades are reported.</td><td><code>159684</code></td></tr><tr><td><code>total_off_chain_volume_usd</code></td><td>Trading activity</td><td>Total off-chain volume in usd traded in the interval. <br><br><code>0</code> when no trades are reported.</td><td><code>30038710.382665947</code></td></tr><tr><td><code>total_off_chain_volume_asset</code></td><td>Trading activity</td><td>Total off-chain volume in number of assets traded in the interval. <br><br><code>0</code> when no trades are reported.</td><td><code>176778031.87949985</code></td></tr><tr><td><code>total_off_chain_trade_count</code></td><td>Trading activity</td><td>The total amount of trades reported off-chain during the interval.<br><br><code>0</code> when no trades are reported.</td><td><code>159115</code></td></tr><tr><td><code>trades_data</code></td><td>Trading activity</td><td>List of volume in usd, volume in number of assets and total amount of trades by centralized exchange.</td><td><code>[{"exchange": "binc",</code><br><code>"volume_usd": 27539301.29722444,</code><br><code>"volume_asset": 162068991,</code><br><code>"trade_count": 125188}, ...]</code></td></tr><tr><td><code>total_on_chain_volume_usd</code></td><td>Trading activity</td><td>Total on-chain volume in usd traded in the interval. 0 when no trades are reported.</td><td><code>1036710779.1918713</code></td></tr><tr><td><code>total_on_chain_volume_asset</code></td><td>Trading activity</td><td>Total on-chain volume in number of assets traded in the interval. <br><br><code>0</code> when no trades are reported.</td><td><code>1036710779.1918713</code></td></tr><tr><td><code>total_on_chain_trade_count</code></td><td>Trading activity</td><td>The total amount of trades reported on-chain during the interval. <br><br><code>0</code> when no trades are reported.</td><td><code>20513</code></td></tr><tr><td><code>trades_data</code></td><td>Trading activity</td><td>List of volume in usd, volume in number of assets and total amount of trades by decentralized exchange.</td><td><code>[{'exchange': 'blc2',</code><br><code>'volume_usd': 673716.6525764248,</code><br><code>'volume_asset': 674153.2032810001,</code><br><code>'trade_count': 129}, ...]</code></td></tr><tr><td><code>market_depth</code></td><td>Liquidity information</td><td>Dictionary from 0.1% to 10% market depth. Base asset aggregation only.</td><td></td></tr><tr><td><code>blockchain</code></td><td>Token information</td><td>Blockchain name.</td><td><code>ethereum</code></td></tr><tr><td><code>token_address</code></td><td>Token information</td><td>Token address.</td><td><code>0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48</code></td></tr><tr><td><code>number_of_holders</code></td><td>Token information</td><td>Total amount of holders.</td><td><code>1622286</code></td></tr><tr><td><code>main_holders</code></td><td>Token information</td><td>List of addesses holding at least 1% of the total supply and the amounts of tokens.</td><td><code>[{'address': '0x0a59649758aa4d66e25f08dd01271e891fe52199',</code><br><code>'amount': 3262712000,</code><br><code>'percentage': 7.91745}, ...]</code></td></tr><tr><td><code>total_supply</code></td><td>Token information</td><td>Blockchain total supply.</td><td><code>0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48</code></td></tr></tbody></table>

### Request examples

{% tabs %}
{% tab title="cURL" %}
{% code overflow="wrap" %}

```url
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'
```

{% endcode %}
{% endtab %}

{% tab title="Python" %}
{% code overflow="wrap" %}

```python
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)}")
```

{% endcode %}
{% endtab %}

{% tab title="BigQuery" %}
Information from this endpoint can be accessed through Google BigQuery. \
\
To get started, read our [guide](broken://spaces/zwO3AMVXsp37KK2FngVc/pages/LFIZ1UwRtOxTg308jneZ).
{% endtab %}
{% endtabs %}

### Response example

{% code overflow="wrap" %}

```json
{
    "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
                    }
                ]
            }
        }
    ]
}

```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.kaiko.com/rest-api/monitoring-solutions/kaiko-market-explorer/assets.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
