Mean-CVaR Optimization
Install and import#
npm install fintech-algorithmsimport { meanCvar } from "fintech-algorithms/portfolio-construction/mean-risk-optimization/mean-cvar-optimization";Signature#
meanCvar(assetIdsInput, returnsInput, probabilitiesInput, betaInput, gammaInput, options)Optimizes a portfolio against conditional value at risk over a discrete scenario set, including the partial tail mass a discrete distribution creates at the confidence level.
Parameters#
| Name | Type | Notes |
|---|---|---|
assetIdsInput | unique non-empty strings | stable asset order |
returnsInput | finite `T×N` numbers | simple return, one horizon/base currency |
probabilitiesInput | finite length-`T` numbers | probability mass |
betaInput | finite number | confidence |
gammaInput | finite number | return/CVaR units |
options | { maxIterations?: unknown; } | optional |
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#
["A", "B"][
[0.24, 0.08],
[0.2, 0.06],
[0.16, 0.04]
]Showing 3 of 4 elements.
[0.25, 0.25, 0.25, 0.25]0.750.5Call#
meanCvar(assetIdsInput, returnsInput, probabilitiesInput, betaInput, gammaInput, options)Returns#
object with 20 fields: status, variant, method, branch, assetIds, weights, expectedReturn, cvar, …
{
"status": "optimal",
"variant": "mean-cvar-long-only",
"method": "lp-vertex-enumeration",
"branch": "positive_gamma_lp",
"assetIds": ["A", "B"],
"weights": [0, 1],
"expectedReturn": 0.039999999999999994,
"cvar": 0.019999999999999993,
"thresholdZ": -0.04,
"tailSlacks": [0, 0, 0, 0.06],
"scenarioLosses": [-0.08, -0.06, -0.04, 0.02],
"objective": 0.03,
"budgetResidual": 0,
"lowerBoundResidual": 0
}Showing 14 of 20 fields.
Other exports#
This module also exports
weightedVarCvar. Every module additionally exports run as an alias of its
primary function, and a meta object carrying its catalog id, domain, family,
shape and article URL.
Diagrams#
Calculation flow#
Diagram
flowchart TB A["Validate rows and mass"] B["Convert return to loss"] C["Build threshold LP"] D["Inspect weighted tail"] E["Audit objective and ties"] A --> B --> C --> D --> E
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.
References#
- Primary and technical sources
- Google discovery audit
- Contextual prior method
- Source roles
- 2026-09-16