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.

ParameterTypeDescriptionExample
periodstrThe frequency of the returns (daily, weekly, monthly, quarterly or yearly). Defaults to “daily”."weekly"
include_benchmarkboolWhether to include the benchmark as an asset. Defaults to False.True
roundingint | NoneThe number of decimals to round the results to. Defaults to None, which uses the Toolkit’s rounding.2
Share