# 按合约获取代币市场图表范围

**API:** Data API

**Endpoint:** `GET /v1/beta/coingecko/coins/{id}/contract/{contract_address}/market_chart/range`

**Tags:** CoinGecko

按合约地址识别的代币在两个明确时间点之间的历史序列。`id` 是资产平台，`contract_address` 是代币；`from` 和 `to` 是 Unix 时间戳（秒），而响应中的时间戳为毫秒。返回 `prices`、`market_caps` 和 `total_volumes`，均为时间戳与值成对的数据。当你持有地址和固定窗口时使用。回溯窗口请使用 `get_coingecko_token_market_chart`；如果持有 CoinGecko id 而非地址，请使用 `get_coingecko_coins_id_market_chart_range`。

### 计费参考

- 计量方式：套餐资源单位。
- 参考请求估算：0.008 美元。
- 单位成本基准：0.0 美元。
- 资源单位：`provider_credit`。
- 成本基准不构成最终客户价格，即使为零也不例外。

仅供参考的元数据，不是账户报价、保证价格或消费上限。资源额度不同于 Felo 额度。最终扣费以 Felo 计费记录为准。

## Base URL

- `https://openapi.felo.ai`

## Authentication

- `FeloBearerAuth` (http bearer, bearer format Felo API Key)
- `FeloApiKey` (apiKey in header `X-API-Key`)

## Parameters

| Name | In | Required | Type | Description |
| --- | --- | --- | --- | --- |
| `contract_address` | path | yes | string, default: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" | 代币的合约地址。 |
| `id` | path | yes | string, default: "ethereum" | 资产平台 ID。 *参见 [`/asset_platforms`](/reference/asset-platforms-list)。 |
| `from` | query | yes | string, default: "2025-12-22" | 起始日期，采用 ISO 日期字符串（`YYYY-MM-DD` 或 `YYYY-MM-DDTHH:MM`）或 UNIX 时间戳。 **为获得最佳兼容性，请使用 ISO 日期字符串。** |
| `interval` | query | no | string, enum: "1m", "5m", "hourly", "daily" | 数据间隔，留空则自动选择粒度。 |
| `precision` | query | no | string, enum: "full", "0", "1", "2", "3", "4", … | 货币价格值的小数位数。 |
| `to` | query | yes | string, default: "2025-12-31" | 结束日期，采用 ISO 日期字符串（`YYYY-MM-DD` 或 `YYYY-MM-DDTHH:MM`）或 UNIX 时间戳。 **为获得最佳兼容性，请使用 ISO 日期字符串。** |
| `vs_currency` | query | yes | string, default: "usd" | 市场数据的计价货币。 *参见 [`/simple/supported_vs_currencies`](/reference/simple-supported-currencies)。 |

## Responses

### 200 — 按代币地址获取时间范围内的代币历史图表数据

Headers:
- `X-Request-Id` (string) — 联系 Felo 支持时需提供的请求标识符。

**application/json**

Schema: `Response860C3Ae68Ea5_CoinsMarketChart` (`#/components/schemas/Response860C3Ae68Ea5_CoinsMarketChart`)

Example:

```json
{
  "prices": [
    [
      1735689600000,
      1.000540738607754
    ],
    [
      1735776000000,
      0.9995995563541714
    ]
  ],
  "market_caps": [
    [
      1735689600000,
      43945617394.42927
    ],
    [
      1735776000000,
      43740787028.36501
    ]
  ],
  "total_volumes": [
    [
      1735689600000,
      6544488766.849924
    ],
    [
      1735776000000,
      5447401746.320422
    ]
  ]
}
```

### 400 — 无法处理该请求。请检查请求参数。

### 401 — 需要有效的 Felo API 密钥。

### 402 — 由于未满足计费要求，请求无法继续。

### 403 — 该账户无权执行此操作。

### 429 — 已达到请求或支出限额。

### 502 — 服务无法完成该请求。

### 503 — API 或计费服务暂时不可用。

### 504 — 服务在处理请求时超时。

### default — 错误响应；上游透传响应可能采用提供方格式

**application/json**

Schema:

```json
{}
```

## Schema definitions

### Response860C3Ae68Ea5_CoinsMarketChart

`#/components/schemas/Response860C3Ae68Ea5_CoinsMarketChart`

```json
{
  "type": "object",
  "required": [
    "prices",
    "market_caps",
    "total_volumes"
  ],
  "properties": {
    "prices": {
      "type": "array",
      "description": "价格数据点，形式为 [timestamp, price] 数据对",
      "items": {
        "type": "array",
        "items": {
          "type": "number"
        }
      }
    },
    "market_caps": {
      "type": "array",
      "description": "市值数据点，形式为 [timestamp, market_cap] 数据对",
      "items": {
        "type": "array",
        "items": {
          "type": "number"
        }
      }
    },
    "total_volumes": {
      "type": "array",
      "description": "总交易量数据点，形式为 [timestamp, volume] 数据对",
      "items": {
        "type": "array",
        "items": {
          "type": "number"
        }
      }
    }
  }
}
```
