Maximum Sharpe Ratio
Install and import#
npm install fintech-algorithmsimport { maximumSharpe } from "fintech-algorithms/portfolio-construction/mean-risk-optimization/maximum-sharpe-ratio";Signature#
maximumSharpe(assetIdsInput, muInput, covarianceInput, riskFreeReturnInput, options)Finds the weights that maximize the Sharpe ratio for a declared risk-free return, with the benchmark, horizon and volatility denominator stated rather than implied.
Parameters#
| Name | Type | Notes |
|---|---|---|
assetIdsInput | unique non-empty string array | identifier/order |
muInput | finite number array | simple return for one horizon |
covarianceInput | finite `N x N` number matrix | squared return |
riskFreeReturnInput | finite number | simple return for the same horizon |
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.08, 0.11][
[0.01, 0],
[0, 0.0225]
]0.02Call#
maximumSharpe(assetIdsInput, muInput, covarianceInput, riskFreeReturnInput, options)Returns#
object with 20 fields: status, variant, method, branch, assetIds, mu, riskFreeReturn, weights, …
{
"status": "optimal",
"variant": "maximum-sharpe-long-only-pd",
"method": "exhaustive-support-enumeration",
"branch": "positive_excess_support",
"assetIds": ["A", "B"],
"mu": [0.08, 0.11],
"riskFreeReturn": 0.02,
"weights": [0.6, 0.4],
"expectedReturn": 0.092,
"excessReturn": 0.072,
"variance": 0.0072000000000000015,
"volatility": 0.08485281374238571,
"sharpe": 0.8485281374238569,
"budgetResidual": 0
}Showing 14 of 20 fields.
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#
- Primary and official sources inspected
- Google discovery audit
- Related data-quality sources
- Source roles
- 2026-09-16