# 按代币地址获取代币价格

**API:** Data API

**Endpoint:** `GET /v1/beta/coingecko/simple/token_price/{id}`

**Tags:** CoinGecko

以链上合约地址而非 CoinGecko id 为键进行价格查询。`id` 是资产平台，`contract_addresses` 是逗号分隔的代币地址列表，`vs_currencies` 是计价货币。返回以小写合约地址为键的映射，其字段名由计价货币构成——`usd`，并在设置对应的 `include_market_cap`、`include_24hr_vol`、`include_24hr_change` 和 `include_last_updated_at` 标志后，额外得到 `usd_market_cap`、`usd_24h_vol`、`usd_24h_change` 和 `last_updated_at`。当你持有地址而没有 id 时使用。代币的完整概况请使用 `get_coingecko_token_data`；如果已有 CoinGecko id，请使用 `get_coingecko_simple_price`。

### 计费参考

- 计量方式：套餐资源单位。
- 参考请求估算：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: "ethereum" | 资产平台 ID。 *参见 [`/asset_platforms`](/reference/asset-platforms-list) |
| `contract_addresses` | query | yes | string, default: "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599" | 代币合约地址；查询多个代币时以逗号分隔 |
| `include_24hr_change` | query | no | boolean | 包含 24 小时涨跌幅。 默认值：false |
| `include_24hr_vol` | query | no | boolean | 包含 24 小时交易量。 默认值：false |
| `include_last_updated_at` | query | no | boolean | 包含最后更新价格时间（UNIX 时间戳）。 默认值：false |
| `include_market_cap` | query | no | boolean | 包含市值。 默认值：false |
| `precision` | query | no | string, enum: "full", "0", "1", "2", "3", "4", … | 货币价格值的小数位数 |
| `vs_currencies` | 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_SimplePrice` (`#/components/schemas/Response860C3Ae68Ea5_SimplePrice`)

Example:

```json
{
  "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599": {
    "usd": 76721,
    "usd_market_cap": 9008047197.715635,
    "usd_24h_vol": 181232010.10689816,
    "usd_24h_change": -1.6069562341774564,
    "last_updated_at": 1779094527
  }
}
```

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

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

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

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

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

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

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

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

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

**application/json**

Schema:

```json
{}
```

## Schema definitions

### Response860C3Ae68Ea5_SimplePrice

`#/components/schemas/Response860C3Ae68Ea5_SimplePrice`

```json
{
  "type": "object",
  "additionalProperties": {
    "type": "object",
    "properties": {
      "usd": {
        "type": "number",
        "description": "目标货币下的价格"
      },
      "usd_market_cap": {
        "type": "number",
        "description": "目标货币下的市值"
      },
      "usd_24h_vol": {
        "type": "number",
        "description": "目标货币下的 24 小时交易量"
      },
      "usd_24h_change": {
        "type": "number",
        "description": "目标货币下的 24 小时价格涨跌幅"
      },
      "last_updated_at": {
        "type": "number",
        "description": "最后更新时间戳（UNIX 秒）"
      }
    }
  }
}
```
