# Market data

> Query instruments, bars and time-share data without changing the chart.

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


<Callout>
  Generated from the pinned chart source (

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

  ). Descriptions are the exact text the model receives.
</Callout>

instruments_query_name [#instruments_query_name]

<ToolMeta label="Query instrument name" safety="read-only" safetyLabel="Read-only" mode="Runs in parallel" origin="Chart core" source="https://github.com/TsekaLuk/KLineChartQuant/blob/1aa5e22c61313a34d08878ad895e604e0d4a85e9/packages/core/src/features/agent/impl/chartAgentController.ts#L655" sourceLabel="Source" />

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.

**Parameters**

| Name                   | Type                   | Required | Constraints                    | Description |
| ---------------------- | ---------------------- | -------- | ------------------------------ | ----------- |
| <code>symbol</code>    | <code>string</code>    | Yes      | min length <code>1</code>      |             |
| <code>sourceIds</code> | <code>string\[]</code> | —        | item min length <code>1</code> |             |

**Minimal input** · Required fields only; placeholders are derived from the 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="Read-only" mode="Runs in parallel" origin="Chart core" source="https://github.com/TsekaLuk/KLineChartQuant/blob/1aa5e22c61313a34d08878ad895e604e0d4a85e9/packages/core/src/features/agent/impl/chartAgentController.ts#L704" sourceLabel="Source" />

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.

**Parameters**

| Name                        | Type                 | Required | Constraints                                                                                                              | Description |
| --------------------------- | -------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------ | ----------- |
| <code>symbol</code>         | <code>string</code>  | Yes      | min length <code>1</code>                                                                                                |             |
| <code>period</code>         | <code>enum</code>    | Yes      | one of <code>"1min", "5min", "15min", "30min", "60min", "4h", "daily", "weekly", "monthly", "quarterly", "yearly"</code> |             |
| <code>adjustment</code>     | <code>enum</code>    | Yes      | one of <code>"qfq", "hfq", "splits", "none"</code>                                                                       |             |
| <code>barAggregation</code> | <code>enum</code>    | Yes      | one of <code>"original", "aligned", "europe-traditional"</code>                                                          |             |
| <code>limit</code>          | <code>integer</code> | Yes      | ≥ <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>                               |             |

**Minimal input** · Required fields only; placeholders are derived from the 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="Read-only" mode="Runs in parallel" origin="Chart core" source="https://github.com/TsekaLuk/KLineChartQuant/blob/1aa5e22c61313a34d08878ad895e604e0d4a85e9/packages/core/src/features/agent/impl/chartAgentController.ts#L718" sourceLabel="Source" />

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

**Parameters**

| Name                     | Type                | Required | Constraints                                                                                | Description |
| ------------------------ | ------------------- | -------- | ------------------------------------------------------------------------------------------ | ----------- |
| <code>symbol</code>      | <code>string</code> | Yes      | min length <code>1</code>                                                                  |             |
| <code>tradingDate</code> | <code>string</code> | Yes      | 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> |             |

**Minimal input** · Required fields only; placeholders are derived from the 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="Read-only" mode="Runs in parallel" origin="Chart core" source="https://github.com/TsekaLuk/KLineChartQuant/blob/1aa5e22c61313a34d08878ad895e604e0d4a85e9/packages/core/src/features/agent/impl/chartAgentController.ts#L748" sourceLabel="Source" />

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

**Parameters**

| Name                        | Type                 | Required | Constraints                                                                                | Description |
| --------------------------- | -------------------- | -------- | ------------------------------------------------------------------------------------------ | ----------- |
| <code>symbol</code>         | <code>string</code>  | Yes      | min length <code>1</code>                                                                  |             |
| <code>endTradingDate</code> | <code>string</code>  | Yes      | pattern <code>^\d\{4}-\d\{2}-\d\{2}$</code>                                                |             |
| <code>days</code>           | <code>integer</code> | Yes      | ≥ <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> |             |

**Minimal input** · Required fields only; placeholders are derived from the schema.

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

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