Skip to content

Accept object content in disclosure items; add option-implied statistics helpers - #6

Merged
bradfordlynch merged 1 commit into
mainfrom
option-implied-stats
Sep 30, 2026
Merged

bradfordlynch merged 1 commit into
mainfrom
option-implied-stats

Conversation

@bradfordlynch

Copy link
Copy Markdown
Contributor

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.content was typed list[str] | str, so that one item failed validation of the whole bundle, the facts and the preview with it. It is now Any, 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 returns None when 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.

…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.
@bradfordlynch
bradfordlynch merged commit d7f72d6 into main Sep 30, 2026
4 checks passed
@bradfordlynch
bradfordlynch deleted the option-implied-stats branch September 30, 2026 00:24
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