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

Distributionally Robust Portfolio

Install and import#

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

Signature#

distributionallyRobustPortfolio(mean, covariance, lossThreshold, returnFloor, tolerance, maxIterations)

Minimizes the worst-case probability of a loss across every distribution sharing a given mean and covariance, subject to a return floor.

Parameters#

NameTypeNotes
meanlength `n` vectordecimal return/period
covariance`n x n` matrixreturn²/period
lossThresholdnumber
returnFloornumber
toleranceunknown
maxIterationsunknown

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#

mean
[0.06, 0.03]
covariance
[
  [0.04, 0],
  [0, 0.01]
]
lossThreshold
0.02
returnFloor
0.04

Call#

distributionallyRobustPortfolio(mean, covariance, lossThreshold, returnFloor, tolerance, maxIterations)

Returns#

object with 11 fields: weights, expectedReturn, variance, riskScore, lossThreshold, returnFloor, outerIterations, status, …

{
  "weights": [0.3333333333333334, 0.6666666666666665],
  "expectedReturn": 0.039999999999999994,
  "variance": 0.00888888888888889,
  "riskScore": 1.5713484026367726,
  "lossThreshold": 0.02,
  "returnFloor": 0.04,
  "outerIterations": 45,
  "status": "optimal",
  "searchBracket": [0.04, 0.04000000000788109],
  "returnResidual": 6.938893903907228e-18,
  "interpretation": "riskScore ranks worst-case loss probability only under the cited radial-class theorem; it is not itself an unconditional…"
}

Diagrams#

Distributionally Robust Portfolio — article hero

Calculation flow#

Diagram
flowchart TB
    N0[Declare radial class] --> N1
    N1[Check return floor] --> N2
    N2[Solve fixed returns] --> N3
    N3[Search ratio score] --> N4
    N4[Check bracket and weights]

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#

  • Distributionally Robust Portfolio Optimization — I. E. Bardakci and C. M. Lagoa.
  • Distributionally Robust Optimization Under Moment Uncertainty — Erick Delage and Yinyu Ye.
  • Data-driven DRO using the Wasserstein metric — Peyman Mohajerin Esfahani and Daniel Kuhn.
  • Equation review note

The rest of the Bayesian and Robust Allocation family#