Cardinality-Constrained Portfolio
Install and import#
npm install fintech-algorithmsimport { optimizeCardinalityConstrained } from "fintech-algorithms/portfolio-construction/practical-constraints/cardinality-constrained-portfolio";Signature#
optimizeCardinalityConstrained(mu, covariance, lambdaRisk, current, K, options)Parameters#
| Name | Type | Notes |
|---|---|---|
mu | unknown | |
covariance | unknown | |
lambdaRisk | unknown | |
current | unknown | |
K | unknown | |
options | { lower?: unknown; upper?: unknown; maxSupports?: 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#
[0.12, 0.1, 0.09, 0.08][
[0.3, 0, 0, 0],
[0, 0.02, 0, 0],
[0, 0, 0.01, 0]
]Showing 3 of 4 elements.
1[0.25, 0.25, 0.25, 0.25]2{
"lower": [0, 0, 0, 0],
"upper": [1, 1, 1, 1]
}Call#
optimizeCardinalityConstrained(mu, covariance, lambdaRisk, current, K, options)Returns#
object with 12 fields: status, weights, selected, trade, objective, bestBound, relativeGap, enumeratedSupports, …
{
"status": "optimal",
"weights": [0, 0.5000000000000003, 0.49999999999999967, 0],
"selected": [0, 1, 1, 0],
"trade": [-0.25, 0.25000000000000033, 0.24999999999999967, -0.25],
"objective": 0.0875,
"bestBound": 0.0875,
"relativeGap": 0,
"enumeratedSupports": 10,
"totalSupports": 10,
"realizedSupport": 2,
"tradeSupport": 4,
"certificate": {
"kind": "exhaustive-support-enumeration",
"complete": true,
"continuousKkt": true,
"globalOptimality": "all supports and continuous KKT active sets were checked"
}
}Diagrams#
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#
- MOSEK Portfolio Optimization Cookbook, §6.4 and §6.5 — MOSEK ApS.
- Moehle, Kochenderfer, Boyd, and Ang, “Tax-aware portfolio optimization” — Nicholas Moehle, Mykel J. Kochenderfer, Stephen Boyd, and Andrew Ang.
- Google discovery status