Repository navigation
Accept object content in disclosure items; add option-implied statistics helpers - #6
Merged
Merged
Conversation
…ics helpers From 2026Q3 an event's bundle may carry a third item, `option-implied-stats`, whose content is an object of three option-market statistics. `DisclosureItem.content` was typed `list[str] | str`, so that one item failed validation of the whole bundle, the facts and the preview with it. Anyone who copied the model would have lost every event that carries the item. `content` is now `Any`. The model is documented as deliberately lenient so that new kinds never break parsing, and a narrow annotation on the one field whose JSON type follows `kind` contradicted that. `examples.option_stats` adds a lookup by id and kind, a reader that returns a value only when its status is "ok", and a frame. It documents what the three numbers mean and when they are missing. There is no notebook yet, and the bundled 2026Q3 sample predates the item.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
From 2026Q3 an event's bundle may carry a third item,
option-implied-stats, whose content is an object of three option-market statistics.The fix
DisclosureItem.contentwas typedlist[str] | str, so that one item failed validation of the whole bundle, the facts and the preview with it. It is nowAny, which matches the model's stated intent of never rejecting a bundle over something new.If you copied this model into your own code, make the same change.
Also added
examples.option_stats, with:option_implied_stats_from_disclosure: looks the item up by id and kind, and returnsNonewhen it is absent.statistic_value: returns a number only when that statistic's status is"ok".option_stats_frame: one row per event, with the three statistics as columns.The module documents what the three numbers mean and when they are missing.
Testing
102 tests pass, including one that reproduces the original failure and one that feeds the model content types it has never seen.