# 代币历史图表

**API:** Data API

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

**Tags:** CoinGecko

单个代币在由 `days` 设定的回溯窗口内的历史序列，返回三个并行数组：`prices`、`market_caps` 和 `total_volumes`。每个条目是由时间戳和值组成的两元素对，时间戳以毫秒为单位。粒度会自动跟随 `days`，也可用 `interval`（`daily` 或 `hourly`）强制指定。用于绘制截至当前的趋势图。需要明确的起止时间时，请使用 `get_coingecko_coins_id_market_chart_range`；K 线图请使用 `get_coingecko_coins_id_ohlc`；某个特定历史日期请使用 `get_coingecko_coins_id_history`。

### 计费参考

- 计量方式：套餐资源单位。
- 参考请求估算：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 |
| --- | --- | --- | --- | --- |
| `id` | path | yes | string, default: "bitcoin" | 代币 ID。 *参见 [`/coins/list`](/reference/coins-list)。 |
| `days` | query | yes | string, default: "1" | 截至若干天前的数据。 天数可使用任意整数或 `max`。 |
| `interval` | query | no | string, enum: "1m", "5m", "hourly", "daily" | 数据间隔，留空则自动选择粒度。 |
| `precision` | query | no | string, enum: "full", "0", "1", "2", "3", "4", … | 货币价格值的小数位数。 |
| `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": [
    [
      1779027899041,
      77953.82550382407
    ],
    [
      1779028199661,
      78052.87543398788
    ]
  ],
  "market_caps": [
    [
      1779027899041,
      1560631481361.8042
    ],
    [
      1779028199661,
      1562027330524.267
    ]
  ],
  "total_volumes": [
    [
      1779027899041,
      18688431751.857048
    ],
    [
      1779028199661,
      18974828816.446976
    ]
  ]
}
```

### 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"
        }
      }
    }
  }
}
```
