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.
… the percentage A ratio with no "a : b" form fell through to to_number(ratio), so "5%" gave split_ratio 5.0, which reads as 5-for-1. A percentage is now 1 + pct (1.05); any other unparsed ratio has a null split_ratio. The test asserts split_ratio. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Thanks, @dlee-bq, and apologies for the month this sat. Both points are fixed in b701659.
The Nasdaq suite passes, 530 tests (Python 3.12). One thing for you to decide: a |
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.split_ratiofor such a row no longer falls back toto_number(ratio), which read5%as 5.0 (a 5-for-1 split). A percentage stock dividend is1 + pct, so5%gives 1.05. Any other ratio with noa : bform has a nullsplit_ratio.Tests
New
tests/test_models_calendars.py::TestCalendarSplits::test_keeps_a_row_whose_ratio_has_no_two_parts. It passes1 : 10,1-for-10,5%and3, and expects four rows: the first with1.0 / 10.0, the others with nulls and their published ratio. It also assertssplit_ratio: 0.1, null, 1.05, null.The test fails without the change and passes with it. The provider suite passes: 530 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