# Find trades, resets and gaps in a CME capture

> Filter a CME MDP 3.0 capture's events by instrument, kind, side, price and size, step between matches, and export events to Parquet for SQL queries.

Page: https://structure.fi/tools/market-data-visualizer/guides/find-events-in-a-cme-capture/

Open in the Market Data Visualizer: https://structure.fi/tools/market-data-visualizer/app/#open?article=find-events-in-a-cme-capture

Opening a capture builds an index of every event of every message. **Filter** searches that index; **Events** in the replay header's **Views** menu writes the same log to a Parquet file for SQL.

[Open sample CME order book](https://structure.fi/tools/market-data-visualizer/app/#open?sample=cme-mdp3&guide=find-events-in-a-cme-capture&section=block-1)

## 1. Write a filter

**Filter**, on its own row under the timeline, holds conditions as chips, each a field, an operator and a value, all of which must hold. **+ Filter** adds one: type `kind = trade`, or take fields, operators and values from the completions (Tab or a click takes one), and press Enter. A list in one chip matches any of its values: `symbol in ESZ6, NQZ6`. Click a chip to edit it, `×` to remove it.

- Fields: `symbol` (in any case, or a SecurityID), `kind`, `side` (`bid`, `ask`), `price` (as the book shows it), `qty`, `order`, `channel`, `aggressor` (`buy`, `sell`, `none`) and `template`.
- Operators: `=`, `!=`, `>`, `>=`, `<`, `<=` and `in`; `symbol`, `kind`, `side` and `aggressor` take `=`, `!=` and `in`.

`{ }` shows the filter as one WHERE clause, `symbol in (ESZ6, NQZ6) and kind = trade and qty > 10`, to edit with `and`, `or`, `not` and parentheses; Enter spreads it back into chips, and a clause the chips cannot show apart, such as an `or` across fields, stays one chip. A message matches when one of its events meets the whole filter. An event without the field never meets a condition on it, so `side != bid` skips trades. ⓘ lists the syntax; a filter that does not read turns red and says where.

## 2. The kinds of event

Event kinds the filter's kind takes and events.parquet records:

| Kind | Meaning |
| --- | --- |
| add | order joined a book |
| modify | order quantity, price or priority changed |
| delete | order cancelled or an unknown order delete arrived |
| fill | resting order traded |
| trade | trade summary entry (price, size, aggressor, order count) |
| level | MBP price level changed |
| implied | implied price level changed |
| remainder | unexplained size from before the capture changed |
| reset | book emptied by channel reset, book reset entry or snapshot |
| snapshot | snapshot applied to a book or ignored because the book was complete |
| definition | instrument definition arrived |
| volume | electronic volume message (`MDIncrementalRefreshVolume37`) |
| statistics | daily or session statistics, or limits and banding (`MDIncrementalRefreshDailyStatistics49`, `MDIncrementalRefreshLimitsBanding50`, `MDIncrementalRefreshSessionStatistics51`) |
| status | security status message (`SecurityStatus30`, `SecurityStatusWorkup60`) |
| gap | packets missing from both feeds A and B |
| other | any other template |

## 3. Step from match to match

Press `↓` (or Enter in an empty **+ Filter** field) for the next match and `↑` (or Shift+Enter) for the previous one. The count (`89 of 134`) shows how many matches lie at or before the replay position; `+` at the end means the index limit was reached and only messages before that point were searched.

The timeline shows the same matches. The overview strip marks them with blue ticks along its top, and so does the detail strip while it shows more messages than it has room to draw one by one. Zoomed in to one tick per message, the detail strip dims the ticks of the messages the filter does not match, so the matches stand out in their colours; the legend under it adds `dimmed: not matching the filter`. Messages past the index limit are not dimmed. Clear the filter and every tick is drawn fully again.

Each step lands at the end of the match's event, so its changes animate and its fills stay marked and listed while paused. If no book of the match's instruments is in view, the step brings one in, even for a filter of kinds alone such as `kind = trade`: an open book comes to the front of its tabs, otherwise a new one opens beside the focused book.

## 4. Write the events table

Open **Views** in the replay header and click **Events**, under **Instruments** and **Message**. The row shows the table's state after its name (`not written`, `writing N%`, `ready`, or `stale` if the capture files changed) and is checked while a view shows the table. It writes `events.parquet` into the project and opens it in the Parquet view. The file stays in the project across reloads even after capture bytes are dropped.

Columns of events.parquet:

| Column | Holds |
| --- | --- |
| message | message number (as Go to takes) |
| packet | packet number |
| sending_time | packet SendingTime (UTC nanoseconds) |
| transact_time | message TransactTime, when present |
| channel | channel number |
| feed | A, B or unknown |
| template | SBE template id |
| security_id | SecurityID |
| symbol | symbol, null before the instrument definition arrives |
| kind | event kind from the table above |
| side | bid or ask |
| price | wire price (DECIMAL(18, 9)) |
| price_ticks | price in ticks of the instrument's MinPriceIncrement, null before the instrument definition arrives or when the price is not a whole number of ticks |
| display_price | price scaled by DisplayFactor as a DOUBLE, null before the instrument definition arrives |
| qty | order, fill, trade or level quantity; missing packet count for gap |
| order_id | OrderID |
| aggressor | buy, sell or none (for trade and fill) |
| level | MBP or implied price level (1 is best) |
| orders | level order count, or orders filled by a trade |

Compare, group and subtract prices with `price_ticks` or `price`. `display_price` is a binary floating-point number that holds most decimal prices only approximately, so a condition such as `display_price = 50.0025` can match no row even where that price traded ([where floating point fails for prices](https://structure.fi/guides/prices-and-times-as-integers/#binary-floating-point-what-float-and-double-are-good-at-and-where-they-fail)).

The table's own **Filter**, on the row above it, takes the same chips and clause over these columns and shows only the rows they match: `kind = trade` and `symbol in ESZ6, NQZ6` leave those instruments' trades, counted `N of M rows`. See [inspect a Parquet file](https://structure.fi/tools/market-data-visualizer/guides/inspect-parquet-file.md).

## 5. Query it with SQL

Click **Query this file** in the Parquet view's pane bar to open SQL over the `events` view:

- Largest instruments by volume: `SELECT symbol, count(*) AS trades, sum(qty) AS contracts FROM events WHERE kind = 'trade' GROUP BY symbol ORDER BY contracts DESC`
- Ten largest trades with message numbers for **Go to**: `SELECT message, sending_time, symbol, display_price, qty, aggressor FROM events WHERE kind = 'trade' ORDER BY qty DESC LIMIT 10`
- Contracts traded at each price of one instrument: `SELECT price_ticks, sum(qty) AS contracts FROM events WHERE kind = 'trade' AND symbol = 'ESZ6' GROUP BY price_ticks ORDER BY price_ticks`
- Trades per second: `SELECT date_trunc('second', sending_time) AS second, count(*) AS trades FROM events WHERE kind = 'trade' GROUP BY second ORDER BY second`

See [query a Parquet file with SQL](https://structure.fi/tools/market-data-visualizer/guides/query-parquet-with-sql.md), [replay CME order books](https://structure.fi/tools/market-data-visualizer/guides/replay-cme-order-books.md) and [order books by price and by order](https://structure.fi/guides/order-books-by-price-and-by-order/).

## Sources

- https://cmegroupclientsite.atlassian.net/wiki/spaces/EPICSANDBOX/pages/457323107/MDP+3.0+-+Message+Specification

Reviewed by Structure on 2026-11-25. Last changed 2026-11-26.
