# 行情接口

## 查询可交易标的

```
GET /api/v1/symbols
```

返回 `data` 数组，每项包含以下字段：

| 字段                    | 类型      | 说明                                      |
| --------------------- | ------- | --------------------------------------- |
| `symbol`              | string  | 股票 symbol，例如 `AAPL`。                    |
| `contractAddress`     | string  | 链上 token 合约地址。                          |
| `contractSymbol`      | string  | 合约 symbol。                              |
| `contractName`        | string  | 合约名称。                                   |
| `decimals`            | number  | 合约 decimals。                            |
| `onChainDecimals`     | number  | 链上 decimals。                            |
| `tradable`            | boolean | 是否可交易。                                  |
| `fractionable`        | boolean | 是否支持碎股。                                 |
| `overnightTradable`   | boolean | 是否支持 overnight session。                 |
| `fractionalEhEnabled` | boolean | 是否支持 fractional extended-hours trading。 |
| `price`               | number  | 最新价格。                                   |
| `change24H`           | number  | 24 小时价格变化。                              |
| `change24HPercent`    | number  | 24 小时价格变化百分比。                           |
| `logoUrl`             | string  | Logo 地址。                                |
| `lastUpdateTimestamp` | number  | 缓存更新时间（Unix 秒）。                         |
| `name`                | string  | 公司名称。                                   |
| `pdfUrl`              | string  | Prospectus / PDF 地址。                    |
| `volume24H`           | number  | 24 小时成交量。                               |

***

## 查询单个标的实时行情

```
GET /api/v1/prices/{symbol}
```

### 路径参数

| 参数       | 类型     | 说明                                                 |
| -------- | ------ | -------------------------------------------------- |
| `symbol` | string | 股票 symbol、token symbol 或 token 地址。服务端 trim 后转大写查询。 |

### 返回 `data` 结构

| 字段          | 类型            | 说明                                        |
| ----------- | ------------- | ----------------------------------------- |
| `basicInfo` | object        | 链无关的底层股票行情和基础信息。                          |
| `onChain`   | object / null | 当前 `chainId + productType` 下的链上 token 信息。 |

***

## 查询历史 K 线

```
GET /api/v1/prices/{symbol}/history
```

### Query 参数

| 参数           | 类型     | 必填 | 默认值   | 说明                                                 |
| ------------ | ------ | -- | ----- | -------------------------------------------------- |
| `startTime`  | number | 否  | 无     | 开始时间（Unix 秒）。                                      |
| `endTime`    | number | 是  | 无     | 结束时间（Unix 秒）。                                      |
| `interval`   | string | 是  | 无     | K 线周期。枚举：`1m`、`3m`、`5m`、`15m`、`1h`、`1d`、`1w`。      |
| `adjustment` | string | 否  | `all` | 复权方式。枚举：`raw`、`split`、`dividend`、`spin-off`、`all`。 |
| `limit`      | number | 否  | `100` | 返回条数。最大 `5000`。                                    |

### 返回数据

| 字段          | 类型     | 说明             |
| ----------- | ------ | -------------- |
| `open`      | number | 开盘价。           |
| `high`      | number | 最高价。           |
| `low`       | number | 最低价。           |
| `close`     | number | 收盘价。           |
| `volume`    | number | 成交量。           |
| `timestamp` | number | K 线时间（Unix 秒）。 |

***

## 查询底层股票行情

```
GET /api/v1/underlying/{symbol}/price
```

返回底层股票 `basicInfo` 字段：

| 字段                    | 类型      | 说明                          |
| --------------------- | ------- | --------------------------- |
| `symbol`              | string  | 股票 symbol。                  |
| `contractAddress`     | string  | 关联 token 合约地址。              |
| `contractSymbol`      | string  | 合约 symbol。                  |
| `onChainDecimals`     | number  | 链上 decimals。                |
| `name`                | string  | 公司名称。                       |
| `exchange`            | string  | 交易所。                        |
| `status`              | string  | 标的状态：`active` 或 `inactive`。 |
| `price`               | number  | 最新价格。                       |
| `change24H`           | number  | 24 小时价格变化。                  |
| `change24HPercent`    | number  | 24 小时价格变化百分比。               |
| `volume24H`           | number  | 24 小时成交量。                   |
| `tradable`            | boolean | 是否可交易。                      |
| `fractionable`        | boolean | 是否支持碎股。                     |
| `lastUpdateTimestamp` | number  | 缓存更新时间（Unix 秒）。             |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.anchored.finance/trading-api-docs-zh/api-jie-kou/market-data.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
