# 幣種 OHLC

**API:** Data API

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

**Tags:** CoinGecko

單一幣種的 K 線資料，以純陣列的列傳回，每列依位置排列：時間戳（毫秒），接著是開盤、最高、最低與收盤。回應中沒有欄位名稱，也沒有成交量。K 線寬度由必填的 `days` 推導。適用於 K 線或技術分析。若需要價格線連同市值與成交量，請改用 `get_coingecko_coins_id_market_chart`。

### 定價參考

- 計量方式：方案資源單位。
- 參考請求預估：USD 0.008。
- 單位成本基礎：USD 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"
    }
  }
}
```
