Backward Split Adjustment
Install and import#
npm install fintech-algorithmsimport { calculate } from "fintech-algorithms/corporate-actions-and-security-master-data/adjustment-factors/backward-split-adjustment";Signature#
calculate(input)Restates prices before a split onto the post-split basis so the series is continuous across the event. Without it a 2-for-1 split reads as a 50% crash, and every indicator and return computed over it is wrong.
Parameters#
| Name | Type | Notes |
|---|---|---|
input | { prices: number[]; volumes: number[]; eventIndex: number; postSplitSharesPerPreSplitShare: number } | prices and volumes are the raw series; eventIndex is the first observation trading on the new basis. postSplitSharesPerPreSplitShare states the ratio in the only direction that is unambiguous — 2 means each old share became two, so pre-event prices are divided by 2 and volumes multiplied by it. |
Returns#
{ adjustedPrices, adjustedVolumes, eventIndex, ratioConvention }
The adjusted series plus the ratio convention that was applied, echoed back — because the single most common error in this calculation is inverting the ratio, and a result that states its own convention can be checked.
Errors#
- When the ratio is not positive — throws
- When eventIndex falls outside the series — throws
Complexity: time O(n),
space O(n).
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#
{
"prices": [120, 123, 60, 62],
"volumes": [1000, 1200, 2400, 2000],
"eventIndex": 2,
"postSplitSharesPerPreSplitShare": 2
}Call#
calculate(input)Returns#
object with 4 fields: adjustedPrices, adjustedVolumes, eventIndex, ratioConvention
{
"adjustedPrices": [60, 61.5, 60, 62],
"adjustedVolumes": [2000, 2400, 2400, 2000],
"eventIndex": 2,
"ratioConvention": "post_split_shares_per_pre_split_share"
}Diagrams#
Calculation flow#
Backward Split Adjustment calculation flow
flowchart LR
A["Raw series and sourced event"] --> B["Validate identity, dates, and units"]
B --> C["Normalize ratio as post shares per pre share"]
C --> D{"Observation before eventIndex?"}
D -->|Yes| E["Price ÷ r; share quantity × r"]
D -->|No| F["Keep observation unchanged"]
E --> G["Derived series with audit metadata"]
F --> G
B -->|Invalid or ambiguous| H["Reject with diagnostic"]
Backward Split Adjustment evidence lifecycle
stateDiagram-v2
[*] --> RawPreserved
RawPreserved --> EventValidated
EventValidated --> RatioNormalized
EventValidated --> Rejected: invalid or ambiguous evidence
RatioNormalized --> Eligible: available for declared as-of view
RatioNormalized --> NotYetAvailable: unavailable at decision time
Eligible --> Applied: transform pre-boundary observations
Applied --> Audited
NotYetAvailable --> Audited
Rejected --> Audited
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#
- Apple Reports Third Quarter Results — Apple Inc.
- Apple Form 8-K, accession 0001193125-20-213158 — Apple Inc.; filed with the U.S. Securities and Exchange Commission
- Apple 2020 Form 10-K — Apple Inc.; filed with the U.S. Securities and Exchange Commission
- CRSP US Stock Data Descriptions Guide — Center for Research in Security Prices, surfaced through WRDS