> For the complete documentation index, see [llms.txt](https://developer.barchart.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.barchart.com/market-replay-docs/api-query-types/tick-queries.md).

# Tick queries

Query tick-level trades and quotes with precise time filters and optional session controls.

Use tick queries to retrieve raw trade and quote events for a symbol. Each query covers up to 24 hours of market activity. Submit one API request per commodity and maturity for each 24-hour period.

For tick data by day and exchange, request access to [Market Replay SFTP/S3 file services](https://www.barchart.com/solutions/contact).

Use this endpoint for trades and combined tick queries:

```
https://historical.aws.barchart.com/historical/queryticks.ashx
```

Use this endpoint only for bid-ask quote queries:

```
https://historical-quotes.aws.barchart.com/historical/queryticks.ashx
```

Quote requests must include `type=Q`. Do not use the quotes endpoint for trade or combined tick queries.

{% hint style="info" %}
Each tick query is limited to a single day. Query multiple days one day at a time.
{% endhint %}

{% hint style="warning" %}
Tick queries can return the previous 30 days by default. Barchart's Institutional Support can configure API access to return up to 365 days of tick history. For deeper historical time series, use Market Replay Enterprise SFTP/S3 bulk flat files.
{% endhint %}

## What a tick query returns

A tick query returns all tick records for a symbol within a requested time range.

You can control:

* the symbol
* the start and end time
* the sort order
* the maximum number of records
* the session or sale conditions included

If both `start` and `end` are present, the result includes ticks from `start` and excludes ticks at `end`.

## Time rules

* Equities use Eastern Time
* Everything else uses Central Time
* `start` is inclusive
* `end` is exclusive
* Input format is `yyyymmdd[hhmm[ss]]`

Examples:

```
20090203
200902030900
20090203090000
```

## Parameters

Required:

* `username`
* `password`
* `symbol`

Optional:

* `start`
* `end`
* `maxrecords`
* `order`
* `sessionfilter`
* `type`
* `sale4Condition=true`
* `participantID=true`
* `exchId=true`
* `fractionalqty=true`

### Parameter details

#### `symbol`

Set `symbol` to the instrument you want.

This endpoint supports the `*` notation for futures, such as `RS*1`.

When you use the `*` notation, a `SYMBOL` field containing the active contract is prepended to each returned record.

#### `maxrecords`

Use `maxrecords` to cap the result size.

If the requested range contains more rows than `maxrecords`, rows are trimmed based on `order`:

* `order=asc` trims from the chronological end
* `order=desc` trims from the chronological beginning

{% hint style="warning" %}
Tick timestamps are returned to the millisecond, but query times are only specified to the second. If multiple ticks occur in the same second, all ticks in that second are returned even if the result exceeds `maxrecords`.
{% endhint %}

#### `order`

Use one of these values:

* `asc`
* `desc`

If omitted, result order is not guaranteed.

#### `sessionfilter`

`sessionfilter` changes which session codes or sale conditions are included.

Default behavior:

* NYSE and AMEX use `@EFKX56V9`
* NASDAQ uses `@ABDEFKOSXY156`
* Other markets return all session codes except settle `*`

You can override the default in four ways:

* `EFK` — include only those codes
* `!EFK` — exclude those codes
* `%2BT` — include defaults plus the specified codes
* `-EF` — use defaults except the specified codes

{% hint style="info" %}
Escape `+` as `%2B` when your client does not do it automatically.
{% endhint %}

#### `type`

Use `type` to choose the event stream. Bid-ask quote data requires `type=Q`.

* `type=T` for trades
* `type=Q` for quotes
* `type=B` for both

Use the quotes endpoint only with `type=Q`. Use the standard endpoint for `type=T` and `type=B`.

The response layout changes with the selected type. Do not parse quote rows as trade rows.

#### `fractionalqty`

Set `fractionalqty=true` to include fractional-share quantity in tick output.

The fractional quantity appears as the far-right column in each returned row.

The `SIZE` field remains rounded. Quantities below `0.5` round down to `0`. Quantities above `0.5` round to `1`.

## Default behaviors

### When both `start` and `end` are set

All ticks in the range are returned, as long as the range stays within one day.

### When only `end` is set

* with `maxrecords`, returns up to that many records back to the beginning of the end day
* without `maxrecords`, returns all records back to the beginning of the end day

### When only `start` is set

* with `maxrecords`, returns up to that many records through the end of the start day
* without `maxrecords`, returns all records through the end of the start day

### When neither is set

* `start` defaults to the beginning of the current day
* `end` defaults to the beginning of the next day

If `maxrecords` is also set, the query behaves as if both default values were explicitly provided.

## Response format

Default tick output is comma-delimited text, one record per line:

```
YYYY-MM-DD HH:MM:SS.FFF,TRADING_DAY,SESSION_CODE,PRICE,SIZE
```

Example:

```
2009-02-03 13:30:00.000,10,G,823.5,1
2009-02-03 13:30:00.125,10,G,823.75,7
```

The session code is the futures session code or equity sale condition.

### Trade output

Trade queries can include optional exchange, participant, and extended sale condition fields.

Format:

```
YYYY-MM-DD HH:MM:SS.FFF,TRADING_DAY,EXCHANGE_ID(optional),SESSION_CODE,SALE_4BYTE_CONDITION(optional),PRICE,SIZE,PARTICIPANT_ID(optional)
```

Example:

```
2020-12-01 11:56:33.122,1,Q,I,@  I,123.1432,3,D
2020-12-01 11:56:32.734,1,Q,I,@  I,123.145,4,D
```

### Quote output

Quote queries return best bid and best offer data.

Format:

```
YYYY-MM-DD HH:MM:SS.FFF,TRADING_DAY,EXCHANGE_ID(optional),QUOTE_CONDITION,BID_PRICE,BID_SIZE,BID_PARTICIPANT_ID(optional),OFFER_PRICE,OFFER_SIZE,OFFER_PARTICIPANT_ID(optional)
```

Example:

```
2020-12-01 12:53:55.791,1,Q,R,122.83,100,Q,122.84,1000,N
2020-12-01 12:53:55.730,1,Q,R,122.83,100,Q,122.84,900,N
```

## Examples

All Apple ticks between `9:00` and `12:00` on February 3, 2009:

```
https://historical.aws.barchart.com/historical/queryticks.ashx?username=username&password=password&symbol=AAPL&start=20090203090000&end=20090203120000
```

Last `1000` Apple ticks for the current day in descending order:

```
https://historical.aws.barchart.com/historical/queryticks.ashx?username=username&password=password&symbol=AAPL&maxrecords=1000&order=desc
```

First `1000` Apple ticks for February 3, 2009 in ascending order:

```
https://historical.aws.barchart.com/historical/queryticks.ashx?username=username&password=password&symbol=AAPL&start=20090203&maxrecords=1000&order=asc
```

Trade example:

```
https://historical.aws.barchart.com/historical/queryticks.ashx?username=username&password=password&type=T&symbol=AAPL&order=desc&sessionfilter=!!&maxrecords=10&sale4Condition=true&participantID=true&exchId=true
```

Trade example with fractional shares:

```
https://historical.aws.barchart.com/historical/queryticks.ashx?username=username&password=password&type=T&symbol=AAPL&start=20260223&end=20260224&fractionalqty=true
```

Quote example:

```
https://historical-quotes.aws.barchart.com/historical/queryticks.ashx?username=username&password=password&type=Q&symbol=AAPL&start=20201201120000&end=20201201130000&order=asc
```

## Related

* [Minute queries](/market-replay-docs/api-query-types/minute-queries.md)
* [End-of-day queries](/market-replay-docs/api-query-types/end-of-day-queries.md)
* [Events and date range queries](/market-replay-docs/api-query-types/events-queries.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developer.barchart.com/market-replay-docs/api-query-types/tick-queries.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
