# Fundamental-Weighted Index

`D03-F03-A01` · Index and Benchmark Engineering → Alternative Weighting · archetype `record-transform` · difficulty 3/5 · verification **verified**

Full page: https://docs.thefintechbuilder.com/index-and-benchmark-engineering/alternative-weighting/fundamental-weighted-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/alternative-weighting/fundamental-weighted-index";
```

## Signature

```ts
calculate(data)
```

Weight by accounting size — sales, book value, cash flow, dividends — instead of market price. The argument is that price-based weighting mechanically overweights whatever is currently expensive.

## Parameters

| Name | Type | Required | Notes |
| --- | --- | --- | --- |
| `data` | `{ records: Record[]; multipliers: Record<string, number> }` | yes | `records` carry the fundamental metrics per constituent; `multipliers` set how each metric contributes to the composite score. |

## Returns

`{ ids, scores, weights }`

The composite score per constituent and the weights derived from it.

## Errors

- When a multiplier references a metric absent from the records — throws

## Complexity

Time `O(n × metrics)`, 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
{
  "records": [
    {
      "id": "A",
      "sales": 120,
      "cashFlow": 18,
      "bookValue": 70,
      "dividends": 4
    },
    {
      "id": "B",
      "sales": 90,
      "cashFlow": 15,
      "bookValue": 55,
      "dividends": 3
    },
    {
      "id": "C",
      "sales": 60,
      "cashFlow": 8,
      "bookValue": 45,
      "dividends": 2
    }
  ],
  "multipliers": {
    "sales": 1,
    "cashFlow": 4,
    "bookValue": 2,
    "dividends": 10
  }
}
```

### Call

```ts
calculate(data)
```

### Returns

object with 3 fields: ids, scores, weights

```json
{
  "ids": ["A", "B", "C", "D"],
  "scores": [372, 290, 202, 128],
  "weights": [0.375, 0.292339, 0.203629, 0.129032]
}
```

## 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/alternative-weighting/fundamental-weighted-index/
- Implementation source: https://github.com/IslamBaraka90/Fintech-Algorithms-Library/blob/main/src/index-and-benchmark-engineering/alternative-weighting/fundamental-weighted-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
