Skip to content

fix(nasdaq): keep a split whose ratio has no "a : b" form - #7760

Merged
dlee-bq merged 4 commits into
openbq-org:developfrom
artcashin:fix/nasdaq-splits-unparseable-ratio
Nov 28, 2026
Merged

dlee-bq merged 4 commits into
openbq-org:developfrom
artcashin:fix/nasdaq-splits-unparseable-ratio

Conversation

@artcashin

@artcashin artcashin commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Problem

equity.calendar.splits (provider nasdaq) fails for any window that includes a percentage stock dividend. Nasdaq lists those in the splits calendar with a ratio like 5%, which has no a : b form. _split_ratio correctly returns (None, None), but the standard CalendarSplitsData requires numerator and denominator. So the row fails validation, and the whole request fails with it.

Change

NasdaqCalendarSplitsData declares numerator and denominator as float | None. A row whose ratio doesn't parse is kept: it has null numerator and denominator, and its published ratio in ratio_display. Parsed ratios are unchanged.

split_ratio for such a row no longer falls back to to_number(ratio), which read 5% as 5.0 (a 5-for-1 split). A percentage stock dividend is 1 + pct, so 5% gives 1.05. Any other ratio with no a : b form has a null split_ratio.

Tests

New tests/test_models_calendars.py::TestCalendarSplits::test_keeps_a_row_whose_ratio_has_no_two_parts. It passes 1 : 10, 1-for-10, 5% and 3, and expects four rows: the first with 1.0 / 10.0, the others with nulls and their published ratio. It also asserts split_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_core still requires both fields, so this only covers the Nasdaq provider.

🤖 Generated with Claude Code

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 dlee-bq left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, @artcashin. I've highlighted a couple of items in the changed files. Please take a look.

deeleeramone and others added 2 commits October 31, 2026 14:13
… 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>
@artcashin

Copy link
Copy Markdown
Contributor Author

Thanks, @dlee-bq, and apologies for the month this sat. Both points are fixed in b701659.

  • split_ratio. The to_number(ratio) fallback is gone. A percentage stock dividend is 1 + pct, so 5% gives 1.05. Any other ratio with no a : b form (1-for-10, a bare 3) has a null split_ratio instead of a guess. a : b ratios are unchanged.
  • Test. It now asserts split_ratio for all four rows: 0.1, null, 1.05, null. Against the old code it fails with 5.0 != 1.05.

The Nasdaq suite passes, 530 tests (Python 3.12). One thing for you to decide: a 5% row keeps null numerator and denominator, and only split_ratio carries the 1.05. If you would rather have 21 and 20 there, I'll add it.

@dlee-bq dlee-bq left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your help!

@dlee-bq
dlee-bq added this pull request to the merge queue Nov 28, 2026
Merged via the queue into openbq-org:develop with commit e4ca9ed Nov 28, 2026
13 of 22 checks passed
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.

3 participants