Skip to content

Fix stale date - #89

Merged
lsbardel merged 2 commits into
mainfrom
ls-options
Aug 1, 2026
Merged

Fix stale date#89
lsbardel merged 2 commits into
mainfrom
ls-options

Conversation

@lsbardel

@lsbardel lsbardel commented Aug 1, 2026

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings August 1, 2026 14:19
@codecov-commenter

codecov-commenter commented Aug 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.88%. Comparing base (5e16f37) to head (b7e2d7c).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #89      +/-   ##
==========================================
+ Coverage   88.75%   88.88%   +0.12%     
==========================================
  Files          84       85       +1     
  Lines        5142     5381     +239     
==========================================
+ Hits         4564     4783     +219     
- Misses        578      598      +20     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses stale “as of” dates when building volatility surfaces from Yahoo option chains by deriving the reference date from Yahoo’s regularMarketTime when available. It also expands/clarifies put-call parity documentation and standardizes how doc tooling scripts are invoked (via uv run python ...), adding a new utility to record trimmed live-market fixtures.

Changes:

  • Use Yahoo’s regularMarketTime as the default ref_date when not explicitly provided, reducing stale curve calibration.
  • Expand and cross-link put-call parity, forward, and discount-factor explanations across API docstrings and tutorials/glossary.
  • Replace older executable-script invocations with Python entrypoints under dev/tools/, and add a make fixtures target plus debug config.

Reviewed changes

Copilot reviewed 12 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
quantflow/options/surface.py Docstring update for spot calibration from short-dated put-call parity.
quantflow/options/parity.py Docstring improvements and LaTeX equation formatting for discount fitting.
quantflow/data/yahoo.py Derive default yield-curve reference date from regularMarketTime.
Makefile Use dev/tools/* Python scripts for docs tasks; add fixtures target.
docs/tutorials/volatility_surface.md Adds clearer narrative for implied forwards and discount calibration from parity.
docs/glossary.md Improves cross-references (e.g., time-to-maturity links) and parity exposition.
dev/tools/record_fixtures.py New CLI tool to record trimmed live-market fixtures (e.g., Yahoo SPX chain).
dev/tools/build_examples.py New helper entrypoint to run example scripts and fail CI on errors.
dev/tools/bib2md.py Update usage/docs path handling for the relocated script.
dev/quantflow.dockerfile Update docs build instructions to the new build-examples command.
.vscode/launch.json Add a debug configuration for recording fixtures.
.github/workflows/examples.yml Update CI to run the new build-examples entrypoint.
.github/copilot-instructions.md Update contributor instructions for rebuilding doc examples.

Comment on lines 1443 to +1444
For short-dated options where discount factors are approximately 1,
put-call parity simplifies to C - P = S - K, so S = C - P + K.
put-call parity simplifies to `C - P = S - K`, so `S = C - P + K`.
Comment thread docs/glossary.md Outdated
Copilot AI review requested due to automatic review settings August 1, 2026 14:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 14 changed files in this pull request and generated no new comments.

Suppressed comments (3)

quantflow/options/surface.py:1447

  • The docstring uses Markdown inline code for equations, which won't render as math in the docs. If you want the parity formula to appear as an equation, switch the docstring to a raw string and use a LaTeX equation block (this also avoids Python interpreting sequences like \b in \begin).
        """Calibrate the spot price from short-dated put-call parity.

        For short-dated options where discount factors are approximately 1,
        put-call parity simplifies to `C - P = S - K`, so `S = C - P + K`.

        This method computes the median implied spot across all put-call pairs
        with time to maturity at or below `max_ttm` and updates the spot price.

quantflow/data/yahoo.py:145

  • loader_from_chain() now supports deriving ref_date from quote.regularMarketTime, but save_fixture() currently strips regularMarketTime from the saved payload. Fixtures produced via save_fixture() will therefore still load with a "now" ref date, which undermines the stale-date fix. Consider including regularMarketTime in quote_keys and updating the corresponding round-trip test expectation.
        symbol = chain.get("underlyingSymbol", "")
        quote = chain.get("quote") or {}
        if ref_date is None and (market_time := quote.get("regularMarketTime")):
            ref_date = datetime.fromtimestamp(market_time, tz=timezone.utc)
        ref = ref_date or utcnow()
        loader = VolSurfaceLoader(

quantflow/data/yahoo.py:144

  • The new behavior of using quote.regularMarketTime as the yield-curve reference date when ref_date is omitted is not covered by the existing Yahoo loader tests. Please add a test that constructs a minimal chain with regularMarketTime and asserts the resulting loader/surface ref_date matches that timestamp (UTC).
        quote = chain.get("quote") or {}
        if ref_date is None and (market_time := quote.get("regularMarketTime")):
            ref_date = datetime.fromtimestamp(market_time, tz=timezone.utc)
        ref = ref_date or utcnow()

@lsbardel
lsbardel merged commit 89d57b4 into main Aug 1, 2026
8 checks passed
@lsbardel
lsbardel deleted the ls-options branch August 1, 2026 14:43
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