# Cash-Dividend Total-Return Adjustment

> From Price Drop to Exact Return

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

Full page: https://docs.thefintechbuilder.com/corporate-actions-and-security-master-data/adjustment-factors/cash-dividend-total-return-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/cash-dividend-total-return-adjustment";
```

## Signature

```ts
calculate(data)
```

Builds a total-return series by reinvesting cash dividends at the ex-date. Price charts ignore dividends, so every long-horizon number taken from one understates reality — by roughly 2% a year on a broad equity index.

## Parameters

| Name | Type | Required | Notes |
| --- | --- | --- | --- |
| `data` | `{ asOf: string; returnVariant: "gross" \| "net"; priceCurrency: string; anchorBasis: string; specialDistributionPolicy: string; observations: Observation[]; eventRevisions: EventRevision[] }` | yes | `returnVariant` selects gross or net of withholding tax — the same index quotes both, and they diverge materially over a decade. `specialDistributionPolicy` decides how non-recurring distributions are treated. Point-in-time by construction: `asOf` is the knowledge time, and only revisions available at or before it are eligible. Passing the event date instead of the knowledge date is what lets a backtest use information it could not have had. |

## Returns

`{ methodology, returnVariant, anchor, adjustedPrices, cumulativeFactors, eventAdjustments, … }`

The adjusted series plus the cumulative factor chain and per-event adjustments, so any single figure can be traced back to the events that produced it.

## Errors

- When returnVariant is not recognised, or asOf is invalid — 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
{
  "asOf": "2026-01-09T23:00:00Z",
  "returnVariant": "gross",
  "priceCurrency": "USD",
  "anchorBasis": "latest_raw_close",
  "specialDistributionPolicy": "exclude",
  "observations": [
    {
      "date": "2026-01-02",
      "close": 100,
      "availableAt": "2026-01-02T21:01:00Z"
    },
    {
      "date": "2026-01-05",
      "close": 102,
      "availableAt": "2026-01-05T21:01:00Z"
    },
    {
      "date": "2026-01-06",
      "close": 99,
      "availableAt": "2026-01-06T21:01:00Z"
    }
  ],
  "eventRevisions": [
    {
      "eventId": "SYNTH-DIV-A",
      "revision": 1,
      "status": "confirmed",
      "classification": "ordinary",
      "exDate": "2026-01-06",
      "grossDividend": 2.5,
      "dividendCurrency": "USD",
      "withholdingRate": 0.15,
      "fxRateToPriceCurrency": 1,
      "fxObservedAt": null,
      "availableAt": "2026-01-05T15:00:00Z",
      "sourceId": "SYNTHETIC-ACTION-FEED"
    },
    {
      "eventId": "SYNTH-DIV-A",
      "revision": 2,
      "status": "confirmed",
      "classification": "ordinary",
      "exDate": "2026-01-06",
      "grossDividend": 3,
      "dividendCurrency": "USD",
      "withholdingRate": 0.15,
      "fxRateToPriceCurrency": 1,
      "fxObservedAt": null,
      "availableAt": "2026-01-05T18:00:00Z",
      "sourceId": "SYNTHETIC-ACTION-FEED"
    },
    {
      "eventId": "SYNTH-SPECIAL-B",
      "revision": 1,
      "status": "confirmed",
      "classification": "special",
      "exDate": "2026-01-08",
      "grossDividend": 3,
      "dividendCurrency": "USD",
      "withholdingRate": 0.15,
      "fxRateToPriceCurrency": 1,
      "fxObservedAt": null,
      "availableAt": "2026-01-07T18:00:00Z",
      "sourceId": "SYNTHETIC-ACTION-FEED"
    }
  ]
}
```

### Call

```ts
calculate(data)
```

### Returns

object with 11 fields: methodology, returnVariant, priceCurrency, asOf, anchor, adjustedPrices, cumulativeFactors, eventAdjustments, …

```json
{
  "methodology": "backward_adjusted_ex_date_close_total_return",
  "returnVariant": "gross",
  "priceCurrency": "USD",
  "asOf": "2026-01-09T23:00:00Z",
  "anchor": {
    "basis": "latest_raw_close",
    "date": "2026-01-09",
    "rawClose": 100
  },
  "adjustedPrices": [97.058823529412, 99, 99, 101, 98, 100],
  "cumulativeFactors": [0.970588235294, 0.970588235294, 1, 1, 1, 1],
  "eventAdjustments": [
    {
      "exDate": "2026-01-06",
      "exIndex": 2,
      "eventIds": ["SYNTH-DIV-A"],
      "selectedRevisions": [2],
      "sourceIds": ["SYNTHETIC-ACTION-FEED"],
      "priorClose": 102,
      "exDateClose": 99,
      "grossDividendPriceCurrency": 3,
      "effectiveDividend": 3,
      "backwardFactor": 0.970588235294,
      "factorAppliesTo": "indices < 2"
    }
  ],
  "returnLinks": [
    {
      "date": "2026-01-05",
      "priceReturn": 0.02,
      "totalReturn": 0.02,
      "effectiveDividend": 0
    },
    {
      "date": "2026-01-06",
      "priceReturn": -0.029411764706,
      "totalReturn": 0,
      "effectiveDividend": 3
    },
    {
      "date": "2026-01-07",
      "priceReturn": 0.020202020202,
      "totalReturn": 0.020202020202,
      "effectiveDividend": 0
    }
  ],
  "excludedEvents": [
    {
      "eventId": "SYNTH-CANCELLED-C",
      "selectedRevision": 2,
      "reason": "cancelled"
    },
    {
      "eventId": "SYNTH-SPECIAL-B",
      "selectedRevision": 1,
      "reason": "special_excluded_by_policy"
    }
  ],
  "rounding": {
    "internal": "unrounded IEEE-754 binary64",
    "serializedDecimalPlaces": 12,
    "factorCompounding": "multiply unrounded factors, round only serialized output"
  }
}
```

## 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/cash-dividend-total-return-adjustment/
- Implementation source: https://github.com/IslamBaraka90/Fintech-Algorithms-Library/blob/main/src/corporate-actions-and-security-master-data/adjustment-factors/cash-dividend-total-return-adjustment/impl.ts
- Standalone repository: https://github.com/IslamBaraka90/Fintech-Cash-Dividend-Total-Return-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
