fintech-algorithms
Using a coding agent? Give it the skill: npx skills add IslamBaraka90/Fintech-Algorithms-Library What it does →

Black-Litterman

Install and import#

bash
npm install fintech-algorithms
ts
import { blackLittermanAllocate } from "fintech-algorithms/portfolio-construction/bayesian-and-robust-allocation/black-litterman";

Signature#

blackLittermanAllocate(input)

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

Parameters#

NameTypeNotes
inputBlackLittermanInput

Worked example#

executed 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
{
  "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#

blackLittermanAllocate(input)

Returns#

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

{
  "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"
}

Diagrams#

Black-Litterman — article hero

Calculation flow#

Diagram
flowchart TB
    N0[Validate inputs] --> N1
    N1[Derive market prior] --> N2
    N2[Compute view surprise] --> N3
    N3[Update the mean] --> N4
    N4[Allocate and check]

How it works#

This page states the contract — how to call it correctly. The article explains the concept: why it works, and where it breaks.

Read the article →

References#

  • Global Portfolio Optimization — Fischer Black and Robert Litterman.
  • Estimation error and Bayesian allocation — MOSEK ApS.

The rest of the Bayesian and Robust Allocation family#