Skip to content

Keep option strike selection within the chosen expiration - #7808

Open
idpfaff wants to merge 3 commits into
openbq-org:developfrom
idpfaff:hotfix/options-expiration-strikes
Open

idpfaff wants to merge 3 commits into
openbq-org:developfrom
idpfaff:hotfix/options-expiration-strikes

Conversation

@idpfaff

@idpfaff idpfaff commented Oct 30, 2026

Copy link
Copy Markdown

Description

The strike helper filters the chain to the requested expiration, then overwrites that selection with strikes from every expiration. That can make strangle() pick the wrong contracts and report the wrong cost.

This uses the filtered chain's strikes and keeps them sorted. In the regression fixture, a January strangle was picking the $100 call instead of the $110 call, giving a cost of $5.20 instead of $2.20 per share.

No new dependencies.

How has this been tested?

Seven new regression cases cover date and DTE selection, different strike grids, unfiltered lookups, and long and short strangles. Six fail before the fix. All 115 options tests pass after it.

From openbb_platform/core:

pytest tests/provider/utils/test_options_chains_strike_selection.py tests/provider/utils/test_options_chains_properties.py tests/provider/standard_models/test_options_chains.py -q
ruff check .
ruff format --check openbb_core/provider/utils/options_chains_properties.py tests/provider/utils/test_options_chains_strike_selection.py
ty check openbb_core/provider/utils/options_chains_properties.py

Full core formatting and type checks have the same failures on unchanged develop: one formatting issue in the docstring-generator tests, two type errors in method_definition.py, and a tomli import warning. The changed files pass.

Checklist

  • Reviewed the code and test results.
  • Added regression tests and clarified the helper's docstring.
  • Used a hotfix/ branch targeting develop.
  • Followed the contribution guidelines.

@CLAassistant

CLAassistant commented Oct 30, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@idpfaff

idpfaff commented Oct 30, 2026

Copy link
Copy Markdown
Author

I already signed the CLA. Got a message asking me to sign. This update fixes an error that can cost an inexperienced trader serious money.

@idpfaff

idpfaff commented Nov 6, 2026 •

Copy link
Copy Markdown
Author

Synced with develop at 571099c. All 115 options tests passed, including the expiration-selection regressions. Could a maintainer approve the fork workflows and review the fix? I would like to get this options issue fixed.

This branch has not been deployed

No deployments
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