Inverse Volatility
Calculate inverse volatility weights: each asset’s weight is proportional to one over its volatility, w_i = (1/σ_i) / Σ(1/σ_j). It is the simplest risk-based allocation and equals risk parity when all correlations are the same.
Also known as: naive risk parity, volatility weighting.
Inverse Volatility in Python or via the MCP
Install the Finance Toolkit with:
pip install financetoolkit -U
Then call get_inverse_volatility_weights as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(
["AAPL", "MSFT", "JNJ", "XOM"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2021-01-01",
end_date="2025-12-31",
)
toolkit.portfolio.get_inverse_volatility_weights()
Or, after setting up the Finance Toolkit MCP, ask:
What are the inverse-volatility weights of Apple, Microsoft, Johnson & Johnson and ExxonMobil, based on 2021 to 2025?
Which returns:
| Weight | Expected Return | Volatility | Sharpe Ratio | Risk Contribution | |
|---|---|---|---|---|---|
| AAPL | 0.2092 | 0.1933 | 0.2786 | 0.5727 | 0.3023 |
| MSFT | 0.2267 | 0.2017 | 0.2572 | 0.6532 | 0.2743 |
| JNJ | 0.3484 | 0.0984 | 0.1673 | 0.3867 | 0.2083 |
| XOM | 0.2157 | 0.291 | 0.2702 | 0.9522 | 0.2152 |
| Portfolio | 1 | 0.1832 | 0.1491 | 1.0028 | 1 |
Parameters
get_inverse_volatility_weights accepts the following parameters.
| Parameter | Type | Description | Example |
|---|---|---|---|
period | str | The frequency of the returns (daily, weekly, monthly, quarterly or yearly). Defaults to “daily”. | "weekly" |
covariance | str | The estimator of the covariance matrix: “sample” (ddof=1), “ledoit_wolf” (towards the scaled identity, Ledoit and Wolf, 2004), “ledoit_wolf_constant_correlation” (towards the average correlation, Ledoit and Wolf, 2004), “ledoit_wolf_single_factor” (towards the covariance that the benchmark as a single factor implies, Ledoit and Wolf, 2003), “oas” (Chen et al., 2010), “semicovariance” (the co-movement below a zero return, Estrada, 2007), “exponential” (recent periods weigh most, RiskMetrics) or “denoised” (the eigenvalues of the correlation matrix that random returns could produce averaged, Laloux et al., 2000). The shrinkage and denoised estimators stabilize the weights when there are many assets compared to the number of periods. Defaults to “sample”. | "sample" |
covariance_span | int | The span in periods of the “exponential” covariance; the weight of a period halves after about span / 2.9 periods. Defaults to 180. | 180 |
include_benchmark | bool | Whether to include the benchmark as an asset. Defaults to False. | True |
rounding | int | None | The number of decimals to round the results to. Defaults to None, which uses the Toolkit’s rounding. | 2 |