# Forward Split Adjustment

> carry later observations onto an earlier share basis

`D02-F01-A02` · Corporate Actions and Security Master Data → Adjustment Factors · archetype `record-transform` · difficulty 2/5 · verification **verified**

Full page: https://docs.thefintechbuilder.com/corporate-actions-and-security-master-data/adjustment-factors/forward-split-adjustment/
Agent skill: `npx skills add IslamBaraka90/Fintech-Algorithms-Library` — https://docs.thefintechbuilder.com/guides/agent-skill/

## Install and import

```bash
npm install fintech-algorithms
```

```ts
import { calculate } from "fintech-algorithms/corporate-actions-and-security-master-data/adjustment-factors/forward-split-adjustment";
```

## Signature

```ts
calculate(data)
```

Restates a series onto a chosen basis date rather than onto the latest one, so a figure quoted in a historical report can still be reproduced after subsequent splits.

## Parameters

| Name | Type | Required | Notes |
| --- | --- | --- | --- |
| `data` | `{ targetBasisAt: string; knowledgeAt: string; roundDecimalPlaces?: number; observations: Observation[]; eventRevisions: EventRevision[] }` | yes | `targetBasisAt` is the basis to express results on, and `knowledgeAt` bounds which event revisions may be used. `eventRevisions` carries the revision history rather than a single event, so a corrected ratio does not retroactively rewrite what was knowable earlier. |

## Returns

`{ basis, selectedRevisions, observations, warnings }`

Adjusted observations, which revision of each event was selected, and warnings for anything that could not be applied — surfaced rather than dropped.

## Errors

- When targetBasisAt or knowledgeAt is not a valid timestamp — throws

## Complexity

Time `O(n + e)`, space `O(n)`.

## Worked example

This is the worked example published in the article, replayed by the test suite on every run. The output cannot drift.

### Input

`data`:

```json
{
  "targetBasisAt": "2020-08-30T23:59:59Z",
  "knowledgeAt": "2020-09-02T00:00:00Z",
  "roundDecimalPlaces": 6,
  "observations": [
    {
      "timestamp": "2020-08-28T20:00:00Z",
      "price": 120,
      "volume": 1000,
      "sharesOutstanding": 1000000
    },
    {
      "timestamp": "2020-08-31T00:00:00Z",
      "price": 30,
      "volume": 4000,
      "sharesOutstanding": 4000000
    },
    {
      "timestamp": "2020-09-01T00:00:00Z",
      "price": 31,
      "volume": 3600,
      "sharesOutstanding": 4000000
    }
  ],
  "eventRevisions": [
    {
      "eventId": "SYNTH-SPLIT-2020",
      "revisionId": "SYNTH-SPLIT-2020-R1",
      "supersedesRevisionId": null,
      "publishedAt": "2020-07-30T20:30:00Z",
      "effectiveAt": "2020-08-31T00:00:00Z",
      "newShares": 4,
      "oldShares": 1,
      "status": "active",
      "sourceId": "synthetic-fixture"
    }
  ]
}
```

### Call

```ts
calculate(data)
```

### Returns

object with 4 fields: basis, selectedRevisions, observations, warnings

```json
{
  "basis": {
    "targetBasisAt": "2020-08-30T23:59:59Z",
    "knowledgeAt": "2020-09-02T00:00:00Z",
    "ratioConvention": "new_shares_per_old_share",
    "boundaryRule": "targetBasisAt < effectiveAt <= observation.timestamp",
    "priceDirection": "multiply_post_boundary_values_to_earlier_basis",
    "quantityDirection": "divide_post_boundary_share_quantities_to_earlier_basis",
    "roundDecimalPlaces": 6
  },
  "selectedRevisions": [
    {
      "eventId": "SYNTH-SPLIT-2020",
      "revisionId": "SYNTH-SPLIT-2020-R1",
      "supersedesRevisionId": null,
      "publishedAt": "2020-07-30T20:30:00Z",
      "effectiveAt": "2020-08-31T00:00:00Z",
      "newShares": 4,
      "oldShares": 1,
      "status": "active",
      "sourceId": "synthetic-fixture"
    }
  ],
  "observations": [
    {
      "timestamp": "2020-08-28T20:00:00Z",
      "rawPrice": 120,
      "adjustedPrice": 120,
      "rawVolume": 1000,
      "adjustedVolume": 1000,
      "rawSharesOutstanding": 1000000,
      "adjustedSharesOutstanding": 1000000,
      "cumulativePriceFactor": 1,
      "cumulativeQuantityFactor": 1,
      "appliedEventIds": []
    },
    {
      "timestamp": "2020-08-31T00:00:00Z",
      "rawPrice": 30,
      "adjustedPrice": 120,
      "rawVolume": 4000,
      "adjustedVolume": 1000,
      "rawSharesOutstanding": 4000000,
      "adjustedSharesOutstanding": 1000000,
      "cumulativePriceFactor": 4,
      "cumulativeQuantityFactor": 0.25,
      "appliedEventIds": ["SYNTH-SPLIT-2020"]
    },
    {
      "timestamp": "2020-09-01T00:00:00Z",
      "rawPrice": 31,
      "adjustedPrice": 124,
      "rawVolume": 3600,
      "adjustedVolume": 900,
      "rawSharesOutstanding": 4000000,
      "adjustedSharesOutstanding": 1000000,
      "cumulativePriceFactor": 4,
      "cumulativeQuantityFactor": 0.25,
      "appliedEventIds": ["SYNTH-SPLIT-2020"]
    }
  ],
  "warnings": ["rounded outputs may not reverse exactly"]
}
```

## Verification and provenance

Tier: **verified** (via input-expected).

The worked example below is the figure published in this algorithm's article, replayed and asserted by the test suite on every build. The arithmetic cannot drift without the build failing.

Both tiers guarantee the signature. Full explanation: https://docs.thefintechbuilder.com/guides/verification/

Generated from the docs.json payload shipped inside fintech-algorithms@0.13.1.
The signature and parameter list are checked against the compiled implementation at build time,
so a description that contradicts the code fails the build rather than reaching this file.

## Links

- Article (how it works, step by step): https://thefintechbuilder.com/corporate-actions-and-security-master-data/adjustment-factors/forward-split-adjustment/
- Implementation source: https://github.com/IslamBaraka90/Fintech-Algorithms-Library/blob/main/src/corporate-actions-and-security-master-data/adjustment-factors/forward-split-adjustment/impl.ts
- Standalone repository: https://github.com/IslamBaraka90/Fintech-Forward-Split-Adjustment-Corporate-Actions-algorithm
- Package on npm: https://www.npmjs.com/package/fintech-algorithms
- Domain index for agents: https://docs.thefintechbuilder.com/corporate-actions-and-security-master-data/llms.txt
