risk · wire operation
Portfolio optimization
Solve a portfolio: minVariance, maxSharpe (tangency), meanVariance utility, riskParity (equal risk contribution), hrp (hierarchical risk parity), or kelly. Returns the Computed envelope: value.weights + value.objective, assumptions echo the objective and budget, and diagnostics carry converged/iterations — a non-converged solve adds an optimize.not_converged warning instead of pretending.
totalfinance.risk.optimize- MCP tool name
- totalfinance_risk_optimize
- Pack / profiles
- risk / default, full, portfolio
- Default discovery
- Included in the default tool set
- Required capabilities
- None
- Effects / authorization
- none / none
- Cost / cancellation
- small / Do not assume inline interruption
- Handle-eligible inputs
- None
- Idempotency
- not-applicable
Input schema
| Field | Type | Meaning |
|---|---|---|
objectiveRequired | "minVariance" | "maxSharpe" | "meanVariance" | "riskParity" | "hrp" | "kelly" | Which portfolio to solve for |
covarianceRequired | number[][] | Asset covariance matrix (per-period, decimal² units), square |
meanOptional | number[] | Per-asset expected returns (decimals) — required for maxSharpe/meanVariance/kelly |
riskFreeRatePerPeriodOptional | number | PER-PERIOD risk-free rate (decimal; maxSharpe only) — the same period as the covariance matrix, NOT annualized. Renamed from `riskFreeRate` because every other risk-free rate in the library is annual, and the two were silently interchangeable here |
riskAversionOptional | number | λ for meanVariance (default 1) |
fractionOptional | number | Kelly fraction (default 1 = full Kelly) |
longOnlyOptional | boolean | Forbid short positions |
budgetOptional | number | Σw target (default 1 = fully invested) |
Complete JSON Schema
Loading…
Output schema
| Field | Type | Meaning |
|---|---|---|
valueRequired | object | The computed result |
assumptionsRequired | object | Every applied convention, echoed |
diagnosticsRequired | object | Engine/method/warnings (+ convergence where iterative) |
Complete JSON Schema
Loading…