# 行情数据

> 查询品种、K 线和分时数据，不改变图表。

Source: https://kcq.nebutra.com/zh/docs/agent/tools/market-data


<Callout>
  由固定提交的图表源码生成（

  [`1aa5e22`](https://github.com/TsekaLuk/KLineChartQuant/blob/1aa5e22c61313a34d08878ad895e604e0d4a85e9/packages/core/src/foundation/agent/chartToolRegistry.ts)

  ）。工具说明保留模型实际收到的英文原文，不做翻译。
</Callout>

instruments_query_name [#instruments_query_name]

<ToolMeta label="Query instrument name" safety="read-only" safetyLabel="只读" mode="可并行" origin="图表内核" source="https://github.com/TsekaLuk/KLineChartQuant/blob/1aa5e22c61313a34d08878ad895e604e0d4a85e9/packages/core/src/features/agent/impl/chartAgentController.ts#L655" sourceLabel="源码" />

Look up security names by an exact symbol through the active market-data sources. Optionally restrict the lookup to sourceIds. Returns a Markdown table of every exact match with all instrument fields; never infer a name from a partial match. When the table contains more than one row, do not pick a candidate yourself: call ask\_user with one option per row, where value is that row's id, label is its name, and description lists its source, exchange, and assetClass; wait for the user to choose before continuing.

**参数**

| 字段                     | 类型                     | 必填 | 约束                             | 说明 |
| ---------------------- | ---------------------- | -- | ------------------------------ | -- |
| <code>symbol</code>    | <code>string</code>    | 是  | min length <code>1</code>      |    |
| <code>sourceIds</code> | <code>string\[]</code> | —  | item min length <code>1</code> |    |

**最小输入** · 仅含必填字段，占位值由 schema 推导。

```json
{
  "symbol": "<symbol>"
}
```

<ToolSchema name="instruments_query_name" label="JSON Schema" />

market_bars_query [#market_bars_query]

<ToolMeta label="Query market bars" safety="read-only" safetyLabel="只读" mode="可并行" origin="图表内核" source="https://github.com/TsekaLuk/KLineChartQuant/blob/1aa5e22c61313a34d08878ad895e604e0d4a85e9/packages/core/src/features/agent/impl/chartAgentController.ts#L704" sourceLabel="源码" />

Fetch the latest page of market bars for any symbol without changing the chart. limit must be an integer from 1 to 798. Pagination and retries are handled by the cache.

**参数**

| 字段                          | 类型                   | 必填 | 约束                                                                                                                       | 说明 |
| --------------------------- | -------------------- | -- | ------------------------------------------------------------------------------------------------------------------------ | -- |
| <code>symbol</code>         | <code>string</code>  | 是  | min length <code>1</code>                                                                                                |    |
| <code>period</code>         | <code>enum</code>    | 是  | one of <code>"1min", "5min", "15min", "30min", "60min", "4h", "daily", "weekly", "monthly", "quarterly", "yearly"</code> |    |
| <code>adjustment</code>     | <code>enum</code>    | 是  | one of <code>"qfq", "hfq", "splits", "none"</code>                                                                       |    |
| <code>barAggregation</code> | <code>enum</code>    | 是  | one of <code>"original", "aligned", "europe-traditional"</code>                                                          |    |
| <code>limit</code>          | <code>integer</code> | 是  | ≥ <code>1</code>; ≤ <code>798</code>                                                                                     |    |
| <code>sourceId</code>       | <code>string</code>  | —  | min length <code>1</code>                                                                                                |    |
| <code>exchange</code>       | <code>string</code>  | —  | min length <code>1</code>                                                                                                |    |
| <code>assetClass</code>     | <code>enum</code>    | —  | one of <code>"stock", "index", "fund", "etf", "future", "option", "forex", "crypto"</code>                               |    |

**最小输入** · 仅含必填字段，占位值由 schema 推导。

```json
{
  "symbol": "<symbol>",
  "period": "1min",
  "adjustment": "qfq",
  "barAggregation": "original",
  "limit": 1
}
```

<ToolSchema name="market_bars_query" label="JSON Schema" />

market_timeshare_query [#market_timeshare_query]

<ToolMeta label="Query market time share" safety="read-only" safetyLabel="只读" mode="可并行" origin="图表内核" source="https://github.com/TsekaLuk/KLineChartQuant/blob/1aa5e22c61313a34d08878ad895e604e0d4a85e9/packages/core/src/features/agent/impl/chartAgentController.ts#L718" sourceLabel="源码" />

Fetch one trading day of intraday time-share data for any symbol without changing the chart.

**参数**

| 字段                       | 类型                  | 必填 | 约束                                                                                         | 说明 |
| ------------------------ | ------------------- | -- | ------------------------------------------------------------------------------------------ | -- |
| <code>symbol</code>      | <code>string</code> | 是  | min length <code>1</code>                                                                  |    |
| <code>tradingDate</code> | <code>string</code> | 是  | pattern <code>^\d\{4}-\d\{2}-\d\{2}$</code>                                                |    |
| <code>sourceId</code>    | <code>string</code> | —  | min length <code>1</code>                                                                  |    |
| <code>exchange</code>    | <code>string</code> | —  | min length <code>1</code>                                                                  |    |
| <code>assetClass</code>  | <code>enum</code>   | —  | one of <code>"stock", "index", "fund", "etf", "future", "option", "forex", "crypto"</code> |    |

**最小输入** · 仅含必填字段，占位值由 schema 推导。

```json
{
  "symbol": "<symbol>",
  "tradingDate": "YYYY-MM-DD"
}
```

<ToolSchema name="market_timeshare_query" label="JSON Schema" />

market_timeshare_range_query [#market_timeshare_range_query]

<ToolMeta label="Query market time-share range" safety="read-only" safetyLabel="只读" mode="可并行" origin="图表内核" source="https://github.com/TsekaLuk/KLineChartQuant/blob/1aa5e22c61313a34d08878ad895e604e0d4a85e9/packages/core/src/features/agent/impl/chartAgentController.ts#L748" sourceLabel="源码" />

Fetch multiple trading days of intraday time-share data for any symbol without changing the chart.

**参数**

| 字段                          | 类型                   | 必填 | 约束                                                                                         | 说明 |
| --------------------------- | -------------------- | -- | ------------------------------------------------------------------------------------------ | -- |
| <code>symbol</code>         | <code>string</code>  | 是  | min length <code>1</code>                                                                  |    |
| <code>endTradingDate</code> | <code>string</code>  | 是  | pattern <code>^\d\{4}-\d\{2}-\d\{2}$</code>                                                |    |
| <code>days</code>           | <code>integer</code> | 是  | ≥ <code>1</code>                                                                           |    |
| <code>sourceId</code>       | <code>string</code>  | —  | min length <code>1</code>                                                                  |    |
| <code>exchange</code>       | <code>string</code>  | —  | min length <code>1</code>                                                                  |    |
| <code>assetClass</code>     | <code>enum</code>    | —  | one of <code>"stock", "index", "fund", "etf", "future", "option", "forex", "crypto"</code> |    |

**最小输入** · 仅含必填字段，占位值由 schema 推导。

```json
{
  "symbol": "<symbol>",
  "endTradingDate": "YYYY-MM-DD",
  "days": 1
}
```

<ToolSchema name="market_timeshare_range_query" label="JSON Schema" />
