Skip to content

Add StatType/TradingEvent enums, InstrumentClass.INDEX, and record flag constants (CME 2026-07) - #45

Merged
tbeason merged 4 commits into
mainfrom
feat/cme-2026-07-enums-and-flags
Sep 17, 2026
Merged

tbeason merged 4 commits into
mainfrom
feat/cme-2026-07-enums-and-flags

Conversation

@tbeason

@tbeason tbeason commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Summary

Brings the package in line with Databento's CME normalization changes (2026-07) and the current dbn 0.69 enum spec.

Most of the CME change already worked: the v3 leg fields on InstrumentDefMsg, Action.NONE = 'N', InstrumentClass.FX_SPOT = 'X', and the standalone F_LAST MBO record (action='N', flags=128, price=UNDEF_PRICE, size=0) all decoded, exported and printed correctly. What was missing were the interpretation helpers and one enum member:

  • StatType enum (UInt16, full dbn 0.69 list) incl. UPPER_PRICE_LIMIT = 17 / LOWER_PRICE_LIMIT = 18, plus safe_stat_type. StatMsg.stat_type stays a raw UInt16 — no breaking change.
  • TradingEvent enum incl. IMPLIED_MATCHING_ON = 3 / IMPLIED_MATCHING_OFF = 4, plus safe_trading_event.
  • InstrumentClass.INDEX = 'I' — in the DBN spec but missing here; index definitions previously decoded as OTHER with a warning.
  • Record flag constants F_LAST, F_TOB, F_SNAPSHOT, F_MBP, F_BAD_TS_RECV, F_MAYBE_BAD_BOOK, F_PUBLISHER_SPECIFIC and a has_flag helper.
  • Docs (api/enums.md) and CHANGELOG.md ([Unreleased], no version bump).

Tests

New test/test_cme_2026_07.jl round-trips every shape from the blog post through the real encoder/decoder: one definition record per strategy leg, the standalone F_LAST MBO record, price-limit statistics, implied-matching status events, and FX-spot / index definitions.

julia +release --project=. -e 'using Pkg; Pkg.test()'
DBN.jl Tests  | 3875   3875  52.3s

(Run on Julia 1.12.6; the default julia on my machine is a 1.13 rc whose Pkg stdlib does not precompile.)

🤖 Generated with Claude Code

https://claude.ai/code/session_01YBr6EZa1vHrJmPBoecSjRa

…ag constants

Aligns with Databento's CME normalization changes (2026-07) and the dbn 0.69 spec:
- StatType enum (UInt16) incl. UPPER_PRICE_LIMIT=17 / LOWER_PRICE_LIMIT=18, safe_stat_type
- TradingEvent enum incl. IMPLIED_MATCHING_ON=3 / IMPLIED_MATCHING_OFF=4, safe_trading_event
- InstrumentClass.INDEX ('I'), previously decoded as OTHER
- F_LAST/F_TOB/F_SNAPSHOT/F_MBP/F_BAD_TS_RECV/F_MAYBE_BAD_BOOK/F_PUBLISHER_SPECIFIC + has_flag
- Round-trip tests for per-leg definitions, standalone F_LAST MBO records, price-limit stats, implied-matching status, FX-spot/index classes

Record struct fields are unchanged (stat_type/trading_event remain raw UInt16).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YBr6EZa1vHrJmPBoecSjRa

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0bfb00ec23

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/types.jl Outdated
Comment on lines +747 to +748
VENUE_SPECIFIC_VOLUME_1 = 10001
VENUE_SPECIFIC_PRICE_1 = 10002

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use the DBN wire codes for venue-specific statistics

DBN 0.69 assigns venue-specific price to code 10000 and venue-specific quantity to 10001; code 10002 is not the venue-specific price code. With this table, safe_stat_type(10000) incorrectly returns UNKNOWN, while a record carrying 10002 is falsely classified as a price statistic, so these members and the corresponding test should be aligned with the wire specification.

Useful? React with 👍 / 👎.

…ntests.jl

These three files are CRLF in main; the previous commit accidentally rewrote them as LF, turning the PR diff into a whole-file change. Content is unchanged.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YBr6EZa1vHrJmPBoecSjRa
tbeason and others added 2 commits September 17, 2026 09:40
Resolves both conflicts by keeping both sides:
- test/runtests.jl: the CME 2026-07 include alongside main's two new
  regression includes (MBO wire layout, StatMsg quantity sentinel).
- CHANGELOG.md: the Unreleased "Added" block is promoted to
  [0.1.7] - 2026-09-17 and sits above the released [0.1.6] section.

Project.toml bumped 0.1.6 -> 0.1.7 (additive: new StatType/TradingEvent
enums, InstrumentClass.INDEX, record flag constants + has_flag).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
v0.1.4 (2026-06-22) and v0.1.5 (2026-06-24) were both tagged and
registered while their entries still sat under `## [Unreleased]`, so
neither ever got a version heading. Commit 7c10ea9 then retitled that
whole accumulated block `## [0.1.6] - 2026-06-24` and bumped to 0.1.6 --
but that 0.1.6 was never registered. When #49 later renumbered the
September release from 0.1.7 back down to 0.1.6, it renamed only the new
section, leaving two `## [0.1.6]` headings and no 0.1.4/0.1.5 at all.

Split the June block back along the real tag boundaries, determined by
diffing CHANGELOG.md as it stood at each tag:

- `[0.1.5] - 2026-06-24` -- DuckDB Parquet migration, ZSTD default, and
  the OHLCV/STATUS/IMBALANCE/DEFINITION, empty-record-set and
  create_metadata_from_dataframe fixes.
- `[0.1.4] - 2026-06-22` -- symbol resolution helpers, plus the
  MBP-1/MBP-10 FieldError, read_stat_msg sizing, stat_to_dataframe,
  symbol-mapping-interval and invalid-enum-byte fixes (#32-#35, #40).

The replay feature moves up into `[0.1.6] - 2026-09-10`: it was written
in June but first reached the registry in that release.

Also adds the missing [0.1.7]/[0.1.5]/[0.1.4] compare links. No entry
text was changed -- only the headings it sits under.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@tbeason
tbeason force-pushed the feat/cme-2026-07-enums-and-flags branch from 20c8bbc to 40f2c60 Compare September 17, 2026 14:42
@tbeason
tbeason merged commit f99162b into main Sep 17, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant