Repository navigation
SEC fundamentals: a date-only filing date is public when the day ends in New York, not at its midnight - #1209
arhancanli wants to merge 1 commit into
Conversation
… 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.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📜 Recent review details
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to The reviewed filing-date behavior is ready to merge after normal checks. No concrete blocking issue was established. Pre-merge checks |
|
Problem
The SEC point-in-time gate treats a date-only filing date as public from that day's midnight.
companyfactsrows carry onlyfiled(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
SECFundamentalsondev(730d560). Microsoft's FY2026 10-K, accession 0001193125-26-323660, has filing date 2026-07-29 and was accepted at 16:08:01 ET: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_ofin 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 ofas_of?" checks:companyfactsfacts (statements, compact and raw facts);filingDatefallback inget_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_atand the returnedfiledvalues 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
companyfactsdoesn't carry.One caution if that is ever added:
acceptanceDateTimein 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 -qdev(730d560) with the two new tests: 2 failed, 17 passed. The failures are the new tests.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 -qNew tests (fixtures with Microsoft's real values):
get_company_facts;No real-model evals or external-service tests were run for this change. The reproduction above used live SEC data.
Compatibility
Affected:
SECFundamentalspoint-in-time results (statements, company facts, filings fallback) and the agent tools built on them.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