# Currency-Hedged Index

`D03-F04-A07` · Index and Benchmark Engineering → Return Variants · archetype `record-transform` · difficulty 4/5 · verification **verified**

Full page: https://docs.thefintechbuilder.com/index-and-benchmark-engineering/return-variants/currency-hedged-index/
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/index-and-benchmark-engineering/return-variants/currency-hedged-index";
```

## Signature

```ts
calculate(data)
```

Neutralises currency exposure with rolling forwards. Hedged and converted variants of the same index can diverge by double digits over a year — they are different products, not a formatting choice.

## Parameters

| Name | Type | Required | Notes |
| --- | --- | --- | --- |
| `data` | `{ baseCurrencyReturns: number[]; forwardOffsets: number[]; hedgeRatio: number; baseLevel: number }` | yes | `forwardOffsets` carry the forward points, which is where the interest-rate differential enters — a hedge is not free. `hedgeRatio` allows partial hedging. `baseLevel` is the index value at the start of the series; it scales the level but never the returns. |

## Returns

`{ hedgedReturns, levels, endingLevel, hedgeRatio }`

Hedged returns and levels, with the ratio applied.

## Errors

- When hedgeRatio falls outside 0…1 — throws

## Complexity

Time `O(n)`, 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
{
  "baseCurrencyReturns": [0.01202, -0.003004, 0.002982, 0.006008, -0.003997],
  "forwardOffsets": [-0.0018, -0.0009, 0.0027, -0.0036, 0.0009],
  "hedgeRatio": 1,
  "baseLevel": 1000
}
```

### Call

```ts
calculate(data)
```

### Returns

object with 4 fields: hedgedReturns, levels, endingLevel, hedgeRatio

```json
{
  "hedgedReturns": [0.01022, -0.003904, 0.005682, 0.002408, -0.003097],
  "levels": [1000, 1010.22, 1006.276101, 1011.993762, 1014.430643, 1011.288951],
  "endingLevel": 1011.288951,
  "hedgeRatio": 1
}
```

## 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/index-and-benchmark-engineering/return-variants/currency-hedged-index/
- Implementation source: https://github.com/IslamBaraka90/Fintech-Algorithms-Library/blob/main/src/index-and-benchmark-engineering/return-variants/currency-hedged-index/impl.ts
- Package on npm: https://www.npmjs.com/package/fintech-algorithms
- Domain index for agents: https://docs.thefintechbuilder.com/index-and-benchmark-engineering/llms.txt
