> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mobula.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Historical Market Data (Legacy)

> Retrieve historical price and volume data for an asset, with customizable time granularity for precise market analysis.

<Warning>
  **Legacy Endpoint**

  This endpoint is deprecated. Please use the new [/api/2/asset/price-history](/rest-api-reference/endpoint/asset-price-history) endpoint instead, which provides the same functionality with a cleaner camelCase response format.
</Warning>

<Tip> Timestamps are in MS, it's JS timestamps. </Tip>

### Query Details

Input in “asset” the name of the asset you want to query, or the contract address while adding the blockchain as a second parameter. The market data asset query pattern is explained [in great details here](/rest-api-reference/docs/market-asset-query), with blockchain format, etc.

| Parameter    | Type   | Description                                                                                    |
| ------------ | ------ | ---------------------------------------------------------------------------------------------- |
| `asset`      | string | Asset name or contract address. If an address is provided, you must also provide `blockchain`. |
| `blockchain` | string | Blockchain identifier (e.g., `"ethereum"`, `"base"`). Required when `asset` is an address.     |
| `symbol`     | string | Token ticker symbol (e.g., `"ETH"`). Optional alternative to `asset`.                          |
| `id`         | number | Mobula’s internal asset ID (numeric identifier).                                               |
| `period`     | string | Candle resolution. Supported: `5m`, `15m`, `1h`, `6h`, `1d`. Defaults to auto-granularity.     |
| `from`       | number | Start timestamp (ms). Defaults to `0` (epoch).                                                 |
| `to`         | number | End timestamp (ms). Defaults to current time.                                                  |

### Data details

Price data is computed using Octopus, Mobula's market data engine. You can have a high-level overview of how it's computing DeFi prices [here](https://mirror.xyz/0x6483Ca5ac1EbC6eB08d36979d217db2572CbAad2/Lw8NSSjqR4JSzthKZQCfHLwD3NPGsuaAfHGMY1zi-WI).
Data granularity is designed as follows:

* 5 minutes for the last 7 days
* 6 hours for the last 30 days
* 1 day for the remaining of history

### Granularity settings

You can set the granularity of the data by adding the `period` parameter.

* `5m` for 5 minutes
* `15m` for 15 minutes
* `1h` for 1 hour
* `6h` for 6 hours
* `1d` for 1 day

### Usage Example:

* Query by Asset and Time Range

```bash theme={null}
curl -X GET "https://api.mobula.io/api/1/market/history?from=1754337900000&to=1754721284970&asset=0x0000000000c5dc95539589fbd24be07c6c14eca4"
```

* Query by Asset and Period

```bash theme={null}
curl -X GET "https://api.mobula.io/api/1/market/history?to=1754721284970&period=1h&asset=0xc4ce8e63921b8b6cbdb8fcb6bd64cc701fb926f2&blockchain=ethereum"
```


## OpenAPI

````yaml get /1/market/history
openapi: 3.0.0
info:
  version: 1.0.0
  title: Mobula API
  description: >-
    Documentation of the Mobula API


    **Demo API**: The default server (demo-api.mobula.io) is a demo API with
    rate limits.

    For production use, please use api.mobula.io with an API key from
    https://admin.mobula.io
servers:
  - url: https://demo-api.mobula.io/api/
    description: Demo API (rate limited, for testing only)
  - url: https://api.mobula.io/api/
    description: Production API (requires API key)
security: []
tags:
  - name: V2 - Token
    description: Token details, price, security, ATH, and holder data
  - name: V2 - Market Data
    description: Market details, OHLCV history, and lighthouse metrics
  - name: V2 - Trades
    description: Token trades, enriched trades, and trade filters
  - name: V2 - Wallet
    description: Wallet positions, activity, trades, analysis, and labels
  - name: V2 - Assets
    description: Cross-chain asset details and price history
  - name: V2 - Swap
    description: Swap quoting and execution
  - name: V2 - Perps
    description: Perpetual futures quoting, execution, and positions
  - name: V2 - Bridge
    description: Cross-chain bridge quoting and intent status (Alpha Preview)
  - name: V2 - DeFi
    description: Bonding pools and pulse data
  - name: V2 - Search
    description: Universal fast search
  - name: V2 - Blockchains
    description: System metadata and chain listings
  - name: V1 - Market Data
    description: Market prices, history, sparklines, pairs, and multi-data
  - name: V1 - Wallet
    description: Wallet portfolio, transactions, history, and NFTs
  - name: V1 - Token
    description: First buyers
  - name: V1 - Trades
    description: Market trades by pair
  - name: V1 - Metadata
    description: Token metadata, categories, trendings, and news
  - name: V1 - Assets
    description: List all assets
  - name: V1 - Search
    description: Search for assets, tokens, and pairs
  - name: V1 - DeFi
    description: Bonding pool pulse data
  - name: V1 - Blockchains
    description: Blockchain listings, pairs, and stats
  - name: V1 - Webhooks
    description: Webhook management
  - name: V1 - Feed
    description: Custom feed creation
paths:
  /1/market/history:
    get:
      tags:
        - V1 - Market Data
      summary: Get market history
      parameters:
        - schema:
            type: string
          required: false
          name: blockchain
          in: query
        - schema:
            type: string
          required: false
          name: asset
          in: query
        - schema:
            type: string
          required: false
          name: symbol
          in: query
        - schema:
            type: string
          required: false
          name: period
          in: query
        - schema:
            type: number
            nullable: true
          required: false
          name: id
          in: query
        - schema:
            type: number
            nullable: true
            default: 0
          required: false
          name: from
          in: query
        - schema:
            type: number
            nullable: true
            default: 1781209620101
          required: false
          name: to
          in: query
      responses:
        '200':
          description: Market history response
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      price_history:
                        type: array
                        items:
                          type: array
                          items:
                            type: number
                            nullable: true
                      volume_history:
                        type: array
                        items:
                          type: array
                          items:
                            type: number
                            nullable: true
                      market_cap_history:
                        type: array
                        items:
                          type: array
                          items:
                            type: number
                            nullable: true
                      market_cap_diluted_history:
                        type: array
                        items:
                          type: array
                          items:
                            type: number
                            nullable: true
                      name:
                        type: string
                      symbol:
                        type: string
                      blockchain:
                        type: string
                      address:
                        type: string
                    required:
                      - price_history
                required:
                  - data

````