# 代币 OHLC

**API:** Data API

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

**Tags:** CoinGecko

单个代币的 K 线数据，为裸行数组，每行按位置排列：时间戳（毫秒），然后是开盘、最高、最低和收盘。响应中没有字段名，也没有成交量。K 线宽度由必填参数 `days` 推导。用于 K 线或技术分析。需要价格线及市值和成交量时，请改用 `get_coingecko_coins_id_market_chart`。

### 计费参考

- 计量方式：套餐资源单位。
- 参考请求估算：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, enum: "1", "7", "14", "30", "90", "180", …, default: "1" | 截至若干天前的数据。 |
| `interval` | query | no | string, enum: "daily", "hourly" | 数据间隔，留空则自动选择粒度。 |
| `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 — 代币 OHLC 图表数据

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

**application/json**

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

Example:

```json
[
  [
    1779199200000,
    76769,
    76889,
    76744,
    76818
  ],
  [
    1779201000000,
    76712,
    76712,
    76321,
    76422
  ]
]
```

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

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

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

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

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

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

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

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

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

**application/json**

Schema:

```json
{}
```

## Schema definitions

### Response860C3Ae68Ea5_CoinsOHLC

`#/components/schemas/Response860C3Ae68Ea5_CoinsOHLC`

```json
{
  "type": "array",
  "description": "OHLC 数据点，形式为 [timestamp, open, high, low, close] 数组",
  "items": {
    "type": "array",
    "items": {
      "type": "number"
    }
  }
}
```
