Repository navigation
Conversation
Nasdaq's splits calendar also lists percentage stock dividends, published with a ratio such as "5%". _split_ratio returns no numerator or denominator for those, but the standard model requires both, so one such row failed validation and the whole calendar request with it. The Nasdaq model makes numerator and denominator optional; the row keeps its published ratio_display. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dlee-bq
left a comment
There was a problem hiding this comment.
Thanks for the PR, @artcashin. I've highlighted a couple of items in the changed files. Please take a look.
| json_schema_extra={"x-widget_config": CELL_CLICK_SYMBOL}, | ||
| ) | ||
| name: str | None = Field(default=None, description="The name of the company.") | ||
| numerator: float | None = Field( |
There was a problem hiding this comment.
Rows that now pass validation fall through to the split_ratio fallback to_number(ratio), which strips the '%' and reports a 5% stock dividend as split_ratio=5.0, which reads as a 5-for-1 split under this endpoint's own convention ('1 : 10' gives 0.1).
Nasdaq row {ratio: '5%'} → numerator=None, denominator=None, split_ratio=5.0
The correct adjustment factor is 1.05. Anyone adjusting share counts or prices by split_ratio over-adjusts by roughly 5x.
|
|
||
| assert rows == [] | ||
|
|
||
| def test_keeps_a_row_whose_ratio_has_no_two_parts(self): |
There was a problem hiding this comment.
The new test never checks split_ratio, the one derived value whose behavior is changed.
The test passes while the 'CCC' / '5%' row carries split_ratio=5.0. Asserting r.split_ratio (expected None or 1.05) would have caught the bug in the first finding.
Problem
equity.calendar.splits(providernasdaq) fails for any window that includes a percentage stock dividend. Nasdaq lists those in the splits calendar with a ratio like5%, which has noa : bform._split_ratiocorrectly returns(None, None), but the standardCalendarSplitsDatarequiresnumeratoranddenominator. So the row fails validation, and the whole request fails with it.Change
NasdaqCalendarSplitsDatadeclaresnumeratoranddenominatorasfloat | None. A row whose ratio doesn't parse is kept: it has null numerator and denominator, and its published ratio inratio_display. Parsed ratios are unchanged.Tests
New
tests/test_models_calendars.py::TestCalendarSplits::test_keeps_a_row_whose_ratio_has_no_two_parts. It passes1 : 10,1-for-10and5%, and expects three rows: the first with1.0 / 10.0, the other two with nulls and their published ratio.The test fails without the change and passes with it. The provider suite passes: 531 tests (Python 3.12).
Results from a deployment
We run this as an overlay on the 2.0.0 wheel in OpenBQ's Docker image. Before the change, a sweep of every widget failed the splits calendar on a split ratio it couldn't parse. With it, the widget returned 453 rows.
Not included
The standard model in
openbb_corestill requires both fields, so this only covers the Nasdaq provider.🤖 Generated with Claude Code