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.

Open the appView as Markdown

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

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
KindMeaning
addorder joined a book
modifyorder quantity, price or priority changed
deleteorder cancelled or an unknown order delete arrived
fillresting order traded
tradetrade summary entry (price, size, aggressor, order count)
levelMBP price level changed
impliedimplied price level changed
remainderunexplained size from before the capture changed
resetbook emptied by channel reset, book reset entry or snapshot
snapshotsnapshot applied to a book or ignored because the book was complete
definitioninstrument definition arrived
volumeelectronic volume message (`MDIncrementalRefreshVolume37`)
statisticsdaily or session statistics, or limits and banding (`MDIncrementalRefreshDailyStatistics49`, `MDIncrementalRefreshLimitsBanding50`, `MDIncrementalRefreshSessionStatistics51`)
statussecurity status message (`SecurityStatus30`, `SecurityStatusWorkup60`)
gappackets missing from both feeds A and B
otherany 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
ColumnHolds
messagemessage number (as Go to takes)
packetpacket number
sending_timepacket SendingTime (UTC nanoseconds)
transact_timemessage TransactTime, when present
channelchannel number
feedA, B or unknown
templateSBE template id
security_idSecurityID
symbolsymbol, null before the instrument definition arrives
kindevent kind from the table above
sidebid or ask
pricewire price (DECIMAL(18, 9))
price_ticksprice 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_priceprice scaled by DisplayFactor as a DOUBLE, null before the instrument definition arrives
qtyorder, fill, trade or level quantity; missing packet count for gap
order_idOrderID
aggressorbuy, sell or none (for trade and fill)
levelMBP or implied price level (1 is best)
orderslevel 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).

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.

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, replay CME order books and order books by price and by order.

Sources

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