Filing-Revision Versioning
Install and import#
npm install fintech-algorithmsimport { calculate } from "fintech-algorithms/corporate-actions-and-security-master-data/point-in-time-universe/filing-revision-versioning";Signature#
calculate(data)Selects the version of a financial filing that was current at a knowledge time. Companies restate; using the final restated figure in a backtest means trading on numbers nobody had.
Parameters#
| Name | Type | Notes |
|---|---|---|
data | { entityId: string; reportPeriod: string; formFamily: string; asOf: string; records: FilingRecord[] } | records is the full filing and amendment history for the period. asOf is the knowledge time — the amendment that superseded a figure last week was not available a month ago. |
Returns#
{ entityId, reportPeriod, asOf, selectionBasis, accessionNo, form, amendmentNumber, acceptedAt, … }
The selected filing with its accession number and acceptance time, and the basis on which it was chosen.
Errors#
- When no filing exists for the period at asOf — reported on the result rather than thrown
Complexity: time O(records),
space O(1).
Worked example#
verified This is the worked example published in the article, replayed by the test suite on every run. The output cannot drift.
Input#
{
"entityId": "CIK0000033619",
"reportPeriod": "2017-09-29",
"formFamily": "10-K",
"asOf": "2018-02-01T00:00:00Z",
"records": [
{
"entityId": "CIK0000033619",
"reportPeriod": "2017-09-29",
"form": "10-K",
"accessionNo": "0001564590-17-024189",
"amendmentNumber": 0,
"acceptedAt": "2017-11-21T16:32:41Z",
"ingestedAt": "2017-11-21T16:40:00Z",
"amendmentScope": ["Original annual filing"],
"facts": {
"basicEpsUsdPerShare": 3.94,
"netEarningsUsdMillions": 117.387
}
},
{
"entityId": "CIK0000033619",
"reportPeriod": "2017-09-29",
"form": "10-K/A",
"accessionNo": "0001564590-18-007244",
"amendmentNumber": 1,
"acceptedAt": "2018-03-30T14:43:54Z",
"ingestedAt": "2018-03-30T15:00:00Z",
"amendmentScope": ["Item 6", "Item 7", "Item 8", "Item 9A", "Item 15"],
"facts": {
"basicEpsUsdPerShare": 3.75,
"netEarningsUsdMillions": 111.554
}
}
]
}Call#
calculate(data)Returns#
object with 13 fields: entityId, reportPeriod, asOf, selectionBasis, accessionNo, form, amendmentNumber, acceptedAt, …
{
"entityId": "CIK0000033619",
"reportPeriod": "2017-09-29",
"asOf": "2018-02-01T00:00:00Z",
"selectionBasis": "latest accepted filing among locally ingested versions",
"accessionNo": "0001564590-17-024189",
"form": "10-K",
"amendmentNumber": 0,
"acceptedAt": "2017-11-21T16:32:41Z",
"ingestedAt": "2017-11-21T16:40:00Z",
"amendmentScope": ["Original annual filing"],
"facts": {
"basicEpsUsdPerShare": 3.94,
"netEarningsUsdMillions": 117.387
},
"eligibleAccessions": ["0001564590-17-024189"],
"excludedNotYetIngested": ["0001564590-18-007244"]
}Diagrams#
Calculation flow#
Causal filing-version query
flowchart LR
A["Immutable filing versions"] --> B["Validate identity and timestamps"]
B --> C{"ingestedAt <= asOf?"}
C -->|No| D["Exclude and report"]
C -->|Yes| E["Order by acceptedAt, amendment, accession"]
E --> F["Return selected version and audit trace"]
Filing-version lifecycle
stateDiagram-v2
[*] --> Submitted
Submitted --> Accepted: EDGAR accepts
Accepted --> Ingested: local system acquires
Ingested --> Validated: parser and checks complete
Validated --> Eligible: cutoff reaches policy timestamp
Accepted --> Excluded: cutoff before local ingestion
Eligible --> Superseded: later eligible amendment
Superseded --> [*]
How it works#
This page states the contract — how to call it correctly. The article explains the concept: why it works, and where it breaks.
References#
- Esterline fiscal-2017 original Form 10-K filing index
- Esterline fiscal-2017 Form 10-K/A filing index
- Esterline fiscal-2017 Form 10-K/A
- SEC Webmaster Frequently Asked Questions
- Accessing EDGAR Data
- EDGAR glossary