# Historical Market Data

Fetch historical daily metrics for any ERC-20 token, including USD price, trading volume, and market capitalisation. Ideal for backtesting, trend analysis, and building time-series visualisations in dashboards or trading agents.

### **Endpoint**

<mark style="color:yellow;">**GET**</mark>  <mark style="color:orange;">`https://api.dapplooker.com/v1/crypto-market-historical`</mark>

> #### 💡 Pro **Tips**&#x20;
>
> * This endpoint supports up to **1,000 items per page**—ideal for bulk analytics or plotting historical charts efficiently. Use the query param <mark style="color:orange;">`page`</mark> and pagination attributes to navigate through results.
> * To fetch data for a **token**, pass any of these query parameters: <mark style="color:orange;">`token_address`</mark>, <mark style="color:orange;">`token_id`</mark>, or <mark style="color:orange;">`token_ticker`</mark>.
> * Use <mark style="color:orange;">`start_date`</mark> and <mark style="color:orange;">`end_date`</mark> to **narrow down results to a custom date range**, helping reduce payload size and focus on relevant timeframes.
> * Combine this endpoint with others like [Token Details](https://docs.dapplooker.com/data-apis-for-ai/api-endpoints/unified-token-intelligence-api), [Trending Tokens](https://docs.dapplooker.com/data-apis-for-ai/api-endpoints/trending-tokens), or [Technical Indicators](https://docs.dapplooker.com/data-apis-for-ai/api-endpoints/multi-interval-technical-analysis) to create rich analytics, dashboards, or market sentiment tools.
> * This endpoint is **x402 payment–enabled**, opening access for all users — simply **pay and use** without needing an API key.

### **Authentication**

This endpoint supports **two authentication methods**:

<table data-header-hidden><thead><tr><th width="254.30078125"></th><th></th></tr></thead><tbody><tr><td><strong>Method</strong></td><td><strong>Description</strong></td></tr><tr><td><strong>API Key</strong></td><td>Provide your Loky API key using the <mark style="color:orange;"><code>api_key</code></mark> parameter for authenticated access.</td></tr><tr><td><strong>x402 Payment Protocol</strong></td><td>If <mark style="color:orange;"><code>api_key</code></mark> is not provided, the request automatically uses the <a href="https://x402.gitbook.io/x402">x402 protocol</a> for on-chain payment verification.</td></tr></tbody></table>

For seamless integration, user can follow the [**x402 Quickstart Guide for Buyers**](https://x402.gitbook.io/x402/getting-started/quickstart-for-buyers).

### **Query Parameters**

<table data-header-hidden><thead><tr><th width="162.51171875"></th><th width="122.33203125"></th><th width="176.484375"></th><th></th></tr></thead><tbody><tr><td><strong>Parameter name</strong></td><td><strong>Type</strong></td><td><strong>Mandatory</strong></td><td><strong>Description</strong></td></tr><tr><td><mark style="color:orange;"><code>api_key</code></mark></td><td>string</td><td>No</td><td>Your unique Loky API key used for authentication</td></tr><tr><td><mark style="color:orange;"><code>chain</code></mark></td><td>string</td><td>Yes</td><td>The network chain to query. Supported chains: <mark style="color:orange;">base, solana</mark></td></tr><tr><td><mark style="color:orange;"><code>token_id</code></mark></td><td>string</td><td>No</td><td>Unique token Id to fetch data</td></tr><tr><td><mark style="color:orange;"><code>token_ticker</code></mark></td><td>string</td><td>No</td><td>Token ticker (symbol) to fetch data</td></tr><tr><td><mark style="color:orange;"><code>token_address</code></mark></td><td>string</td><td>No</td><td>Token contract address to fetch data</td></tr><tr><td><mark style="color:orange;"><code>page</code></mark></td><td>integer</td><td>No, Default page 1</td><td>Page number, 1000 items per page</td></tr><tr><td><mark style="color:orange;"><code>start_date</code></mark></td><td>string</td><td>No</td><td>Date from where the data is need to fetch. Use format: <mark style="color:orange;">YYYY-MM-DD</mark></td></tr><tr><td><mark style="color:orange;"><code>end_date</code></mark></td><td>string</td><td>No</td><td>Date to where the data is need to fetch. Use format: <mark style="color:orange;">YYYY-MM-DD</mark></td></tr></tbody></table>

### **Sample Request**

{% code overflow="wrap" %}

```bash
# Pagination enabled (via page parameter)
curl --location 'https://api.dapplooker.com/v1/crypto-market-historical?api_key=<API_KEY>&chain=base&token_address=0xac1bd2486aaf3b5c0fc3fd868558b082a531b2b4&page=1'

# With custom date range (start_date & end_date)
curl --location 'https://api.dapplooker.com/v1/crypto-market-historical?&api_key=<API_KEY>&chain=base&token_ticker=VIRTUAL&start_date=2025-01-01&end_date=2025-06-06'
```

{% endcode %}

### **Sample Response**

```json
{
  "success": true,
  "data": {
    "token_id": "toshi",
    "token_symbol": "toshi",
    "token_address": "0xac1bd2486aaf3b5c0fc3fd868558b082a531b2b4",
    "token_day_metrics": [
      {
        "date_time": "2025-06-03",
        "usd_price": 0.00058,
        "total_volume": 21583357,
        "market_cap": 243545744
      },
      {
        "date_time": "2025-06-02",
        "usd_price": 0.00054,
        "total_volume": 13218936,
        "market_cap": 228146173
      },
      {
        "date_time": "2025-06-01",
        "usd_price": 0.00056,
        "total_volume": 14565988,
        "market_cap": 238189967
      }
      // Upto 1000 items
    ],
    "meta": {
      "pagination": {
        "page": 1,
        "pageSize": 1000,
        "totalPages": 1,
        "totalRecords": 3
      }
    }
  }
}
```

### **Response Fields Explanation**

* <mark style="color:orange;">`token_id`</mark> *(string)*: A unique assigned identifier for the token.
* <mark style="color:orange;">`token_symbol`</mark> *(string)*: The token’s ticker symbol, typically used in trading.
* <mark style="color:orange;">`token_address`</mark> *(string)*: The on-chain address (contract address) of the token.
* <mark style="color:orange;">`token_day_metrics`</mark> *(array)*: A list of daily market stats for the token. Each object includes:
  * <mark style="color:orange;">`date_time`</mark> *(string)*: The calendar date of the record in `YYYY-MM-DD` format.
  * <mark style="color:orange;">`usd_price`</mark> *(number)*: The token’s closing price in USD on that day.
  * <mark style="color:orange;">`total_volume`</mark> *(number)*: The total trading volume in USD on that day.
  * <mark style="color:orange;">`market_cap`</mark> *(number)*: The estimated market capitalization on that day (price × circulating supply), in USD.

#### Pagination Attributes:

* <mark style="color:orange;">`page`</mark> *(integer)*: The current given page number, also being returned in the response.
* <mark style="color:orange;">`pageSize`</mark> *(integer)*: The number of max items can be included per page.
* <mark style="color:orange;">`pageCount`</mark> *(integer)*: The total number of pages available.
* <mark style="color:orange;">`total`</mark> *(integer)*: The total number of items available across all pages.
