Add StatType/TradingEvent enums, InstrumentClass.INDEX, and record flag constants (CME 2026-07) - #45
Conversation
…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
There was a problem hiding this comment.
💡 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".
| VENUE_SPECIFIC_VOLUME_1 = 10001 | ||
| VENUE_SPECIFIC_PRICE_1 = 10002 |
There was a problem hiding this comment.
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
f74d7cc to
20c8bbc
Compare
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>
20c8bbc to
40f2c60
Compare
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 standaloneF_LASTMBO 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:StatTypeenum (UInt16, full dbn 0.69 list) incl.UPPER_PRICE_LIMIT = 17/LOWER_PRICE_LIMIT = 18, plussafe_stat_type.StatMsg.stat_typestays a rawUInt16— no breaking change.TradingEventenum incl.IMPLIED_MATCHING_ON = 3/IMPLIED_MATCHING_OFF = 4, plussafe_trading_event.InstrumentClass.INDEX = 'I'— in the DBN spec but missing here; index definitions previously decoded asOTHERwith a warning.F_LAST,F_TOB,F_SNAPSHOT,F_MBP,F_BAD_TS_RECV,F_MAYBE_BAD_BOOK,F_PUBLISHER_SPECIFICand ahas_flaghelper.api/enums.md) andCHANGELOG.md([Unreleased], no version bump).Tests
New
test/test_cme_2026_07.jlround-trips every shape from the blog post through the real encoder/decoder: one definition record per strategy leg, the standaloneF_LASTMBO record, price-limit statistics, implied-matching status events, and FX-spot / index definitions.(Run on Julia 1.12.6; the default
juliaon my machine is a 1.13 rc whose Pkg stdlib does not precompile.)🤖 Generated with Claude Code
https://claude.ai/code/session_01YBr6EZa1vHrJmPBoecSjRa