Calculate the Kappa Ratio of an investment portfolio or asset’s returns.

The Kappa Ratio is a generalization of the Sortino Ratio that penalizes downside risk using a higher-order lower partial moment. The Sortino Ratio is the special case of the Kappa Ratio with order=2.

Note that this already subtracts the Risk Free Rate.

The formula is as follows:

\[\text{Daily Excess Return} = \text{Daily Return} - \text{Daily Risk Free Rate},\;\; \text{with Daily Risk Free Rate} = (1 + \text{Annual Risk Free Rate}) ^{1 / 252} - 1\] \[\text{Lower Partial Moment} (\text{LPM}) = \operatorname{MEAN}(\max(- \text{Daily Excess Return},\; 0) ^{\text{Order}}),\;\; \text{averaged over all days in the period (days with a non-negative excess return count as 0)}\] \[\text{Kappa Ratio} = \operatorname{MEAN}(\text{Daily Excess Return}) / \text{LPM} ^{1 / \text{Order}},\;\; \text{per period and not annualized},\;\; \text{with Order defaulting to 3}\]

Kappa Ratio in Python or via the MCP

Install the Finance Toolkit with:

pip install financetoolkit -U

Then call get_kappa_ratio as shown below.

from financetoolkit import Toolkit

toolkit = Toolkit(
    ["LLY", "MRK", "ABBV"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2021-01-01",
    end_date="2025-12-31",
)

toolkit.performance.get_kappa_ratio()

Or, after setting up the Finance Toolkit MCP, ask:

What was the Kappa 3 ratio of Eli Lilly, Merck and AbbVie, measured on daily returns, in each year from 2021 to 2025?

Which returns:

Date LLY MRK ABBV
2021 0.1248 0.0091 0.0811
2022 0.0844 0.1426 0.0552
2023 0.1351 -0.004 -0.0059
2024 0.0652 -0.0191 0.0298
2025 0.0513 0.0193 0.064

Parameters

get_kappa_ratio accepts the following parameters.

ParameterTypeDescriptionExample
periodstrThe period to use for the calculation. Defaults to “quarterly” if the Toolkit is initialised with quarterly=True, otherwise “yearly”."quarterly"
orderintThe order of the lower partial moment used in the denominator. Defaults to 3.2
roundingint | NoneThe number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise).2
growthboolWhether to calculate the growth of the ratios. Defaults to False.True
lagint | list[int]The lag to use for the growth calculation. Defaults to 1.4
standardizeboolWhether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False.True
Share