# Black-Litterman

`D14-F03-A01` · Portfolio Construction → Bayesian and Robust Allocation · archetype `record-transform` · difficulty 4/5 · verification **contract**

Full page: https://docs.thefintechbuilder.com/portfolio-construction/bayesian-and-robust-allocation/black-litterman/
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 { blackLittermanAllocate } from "fintech-algorithms/portfolio-construction/bayesian-and-robust-allocation/black-litterman";
```

## Signature

```ts
blackLittermanAllocate(input)
```

Combines market-implied equilibrium returns with stated views and their confidence, producing the posterior expected returns an optimizer then uses.

## Parameters

| Name | Type | Required | Notes |
| --- | --- | --- | --- |
| `input` | `BlackLittermanInput` | yes |  |

## Worked example

Captured by running this function on the input its own test provides. Real output of real code — but not asserted against a published figure.

### Input

`input`:

```json
{
  "marketWeights": [0.5, 0.5],
  "covariance": [
    [0.04, 0],
    [0, 0.01]
  ],
  "riskAversion": 2,
  "tau": 0.5,
  "viewMatrix": [
    [1, -1]
  ],
  "viewReturns": [0.04],
  "viewErrorCovariance": [
    [0.0025]
  ],
  "riskPenalty": 1
}
```

### Call

```ts
blackLittermanAllocate(input)
```

### Returns

object with 9 fields: priorReturns, posteriorReturns, weights, priorView, posteriorView, viewSurprise, variance, objective, …

```json
{
  "priorReturns": [0.04, 0.01],
  "posteriorReturns": [0.04727272727272727, 0.008181818181818182],
  "weights": [0.5909090909090909, 0.4090909090909091],
  "priorView": [0.03],
  "posteriorView": [0.03909090909090909],
  "viewSurprise": [0.010000000000000002],
  "variance": 0.015640495867768597,
  "objective": 0.015640495867768597,
  "status": "optimal"
}
```

## Verification and provenance

Tier: **contract**.

The module loads, the entry point is callable and its declared signature matches the compiled code. The example below is real captured output, but no independently published figure asserts the numbers.

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.2.
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/portfolio-construction/bayesian-and-robust-allocation/black-litterman/
- Implementation source: https://github.com/IslamBaraka90/Fintech-Algorithms-Library/blob/main/src/portfolio-construction/bayesian-and-robust-allocation/black-litterman/impl.ts
- Package on npm: https://www.npmjs.com/package/fintech-algorithms
- Domain index for agents: https://docs.thefintechbuilder.com/portfolio-construction/llms.txt
