# 幣種歷史圖表

**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`。

### 定價參考

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