Skip to content

SEC fundamentals: a date-only filing date is public when the day ends in New York, not at its midnight - #1209

Open
arhancanli wants to merge 1 commit into
Lumiwealth:devfrom
arhancanli:fix/sec-filed-date-lookahead
Open

arhancanli wants to merge 1 commit into
Lumiwealth:devfrom
arhancanli:fix/sec-filed-date-lookahead

Conversation

@arhancanli

@arhancanli arhancanli commented Oct 11, 2026 •

Copy link
Copy Markdown

Problem

The SEC point-in-time gate treats a date-only filing date as public from that day's midnight. companyfacts rows carry only filed (a date), so a backtest clock during a filing day can see numbers that EDGAR accepted after the close that day.

Reproduced against live SEC data with SECFundamentals on dev (730d560). Microsoft's FY2026 10-K, accession 0001193125-26-323660, has filing date 2026-07-29 and was accepted at 16:08:01 ET:

from datetime import datetime
from zoneinfo import ZoneInfo
from lumibot.fundamentals import SECFundamentals

sec = SECFundamentals()
st = sec.get_income_statement("MSFT", as_of=datetime(2026, 7, 29, 10, 0, tzinfo=ZoneInfo("America/New_York")))
st["values"]["revenue"]  # FY2026 revenue 331,839,000,000 from the 10-K, about six hours before it was public
st["published_at"]       # "2026-07-29T00:00:00"

Microsoft files its 10-Q and 10-K right after its results release (16:06–16:10 ET on each of its last four filings), so an intraday strategy on results day reads the quarter before it is announced. With an as_of in UTC, the exposure starts at 00:00 UTC, which is 20:00 ET the evening before.

Related: #1141 assumes facts are gated by acceptance time. This makes the date-based gate safe for that.

Change

A new _available_at() is used only in the "is it public as of as_of?" checks:

  • companyfacts facts (statements, compact and raw facts);
  • the filingDate fallback in get_submissions / get_filings / get_filing_document.

A date-only value becomes visible at the next midnight in America/New_York, when its filing day has ended. EDGAR accepts filings until 10 p.m. Eastern, so a date says only "some time that day".

Full acceptance timestamps are used as before. published_at and the returned filed values are unchanged.

Cost: a filing made before the open (Apple files its 10-Qs around 06:00 ET) is now seen the next day instead of the same morning. That is late but never early. Exact times would need each accession's acceptance time, which companyfacts doesn't carry.

One caution if that is ever added: acceptanceDateTime in the submissions JSON is currently shifted by one Eastern offset in many companies' files. Measurements: dgunning/edgartools#1501 (comment). That shift also affects the existing acceptance-time gate for filings, by 4–5 hours late, or early in files that label Eastern time as UTC. It is not changed here.

Validation

All runs on Python 3.12.

LUMIBOT_DISABLE_DOTENV=1 LUMIBOT_DISABLE_DOTENV_LOCAL=1 python -m pytest tests/test_sec_fundamentals.py -q

  • dev (730d560) with the two new tests: 2 failed, 17 passed. The failures are the new tests.
  • this branch: 19 passed.

LUMIBOT_DISABLE_DOTENV=1 LUMIBOT_DISABLE_DOTENV_LOCAL=1 python -m pytest tests/test_agent_web_tools.py tests/backtest/test_ai_committee_builtin_tools_backtest.py -q

  • 28 passed (consumers of the SEC tools).

New tests (fixtures with Microsoft's real values):

  • facts filed 2026-07-29 stay hidden at 10:00 ET, 23:59 ET and 03:00 UTC on 07-30, and are visible at 09:30 ET on 07-30;
  • the same holds for raw get_company_facts;
  • a filing with no acceptance time is hidden on its filing day and listed the next morning.

No real-model evals or external-service tests were run for this change. The reproduction above used live SEC data.

Compatibility

Affected: SECFundamentals point-in-time results (statements, company facts, filings fallback) and the agent tools built on them.

  • A clock before the end of a filing day no longer sees that day's facts.
  • Strategies that read fundamentals after the close or the next day see the same values as before.
  • No signatures change.

Documentation

  • docs/SEC_FUNDAMENTALS.md: the backtest-safety rules now state the end-of-day rule, with the Microsoft example.
  • docsrc/fundamentals.rst: the same, under "Point-In-Time Behavior".

Summary by CodeRabbit

  • Bug Fixes
    • SEC facts and filings with date-only publication dates are now treated as available after that date ends in New York, preventing them from appearing too early in historical results. Records with exact acceptance timestamps continue to use those timestamps.
  • Documentation
    • Clarified SEC filing visibility timing and added an example of a filing accepted after market close.

… in New York, not at its midnight

companyfacts rows carry only the filing date, and the point-in-time gate
parsed it as midnight, so a backtest clock at 10:00 ET saw facts from a
filing EDGAR accepted after the close that day. Microsoft's FY2026 10-K
(filed 2026-07-29, accepted 16:08:01 ET) was visible six hours early.

Date-only values (companyfacts filed, filingDate fallback) now become
visible at the next midnight in America/New_York. Full acceptance
timestamps are used as before; published_at values are unchanged.
@arhancanli
arhancanli requested a review from grzesir as a code owner October 11, 2026 12:21
@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: Lumiwealth/lumibot/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8cb8e07c-4aba-4825-9bee-c2b4d723b0f9

📥 Commits

Reviewing files that changed from the base of the PR and between 730d560 and 52871e4.


📒 Files selected for processing (4)
  • docs/SEC_FUNDAMENTALS.md
  • docsrc/fundamentals.rst
  • lumibot/fundamentals/sec.py
  • tests/test_sec_fundamentals.py

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📜 Recent review details
🧰 Additional context used
📚 Code guidelines (2)
tests/AGENTS.md — auto-discovered
docs/BACKTESTING_ARCHITECTURE.md — auto-discovered

📓 Path-based instructions (7)
Review runtime/library changes for trading safety, broker/account isolation, data correctness, secret handling, and public/private boundary violations.

⚙️ CodeRabbit configuration file

Files:

  • lumibot/fundamentals/sec.py

Sphinx documentation is public.

⚙️ CodeRabbit configuration file

Files:

  • docsrc/fundamentals.rst

Tests are public.

⚙️ CodeRabbit configuration file

Files:

  • tests/test_sec_fundamentals.py

Documentation is public.

⚙️ CodeRabbit configuration file

Files:

  • docs/SEC_FUNDAMENTALS.md

Review every pull request as if LumiBot is a public open-source trading framework.

⚙️ CodeRabbit configuration file

Files:

  • docsrc/fundamentals.rst
  • docs/SEC_FUNDAMENTALS.md
  • tests/test_sec_fundamentals.py
  • lumibot/fundamentals/sec.py

Source excerpt: Treat any test whose **earliest commit date is before 2025-06-01** as **LEGACY**.

📄 CodeRabbit inference engine (tests/AGENTS.md)

Files:

  • tests/test_sec_fundamentals.py

Source excerpt: If real data is unavailable, **return empty / skip the day / fail loud**.

📄 CodeRabbit inference engine (docs/BACKTESTING_ARCHITECTURE.md)

Files:

  • docs/SEC_FUNDAMENTALS.md

🪛 Pylint (4.0.8)
lumibot/fundamentals/sec.py

[refactor] 461-479: Too many nested blocks (6/5)

(R1702)


🔇 Additional comments (4)
lumibot/fundamentals/sec.py (1)

7-7: LGTM!

Also applies to: 11-11, 20-20, 94-108, 476-476, 502-502, 625-625, 744-744, 808-808, 918-918


tests/test_sec_fundamentals.py (1)

5-5: LGTM!

Also applies to: 735-766, 769-785


docs/SEC_FUNDAMENTALS.md (1)

31-32: LGTM!


docsrc/fundamentals.rst (1)

38-43: LGTM!



📝 Walkthrough

Walkthrough

Date-only SEC publication values are treated as available at midnight in New York on the day after their filing date. This rule applies across company-fact and filing paths. Tests and documentation cover the updated timing.

Changes

SEC date-only availability

Layer / File(s) Summary
Availability rule and affected SEC paths
lumibot/fundamentals/sec.py, tests/test_sec_fundamentals.py, docs/SEC_FUNDAMENTALS.md, docsrc/fundamentals.rst
_available_at interprets date-only values as available at midnight in New York on the following day. Company-fact and filing paths use this helper. Tests check fact and submission visibility, and the documentation describes the end-of-day filing-date rule. Full timestamps continue through the existing parsing behavior.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix


Merge Risk: ⚪ Minimal · up to 52871

The reviewed filing-date behavior is ready to merge after normal checks. No concrete blocking issue was established.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 7.14% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 2 files. (2 skipped: 2… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly summarizes the primary change: date-only SEC filing dates become public after the filing day ends in New York.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

Full details: Docstring Coverage

Explanation

Docstring coverage is 7.14% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 2 files. (2 skipped: 2 unsupported.)


  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant