Kappa Ratio
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.
Kappa Ratio in Python
get_kappa_ratio is part of the Performance module of the open-source Finance Toolkit. Install it with:
pip install financetoolkit -U
Then call get_kappa_ratio as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(["AAPL", "TSLA"], api_key="FINANCIAL_MODELING_PREP_KEY")
toolkit.performance.get_kappa_ratio()
Which returns:
| Date | AAPL | TSLA |
|---|---|---|
| 2021 | 0.1414 | 0.1382 |
| 2022 | -0.052 | -0.0816 |
| 2023 | 0.1284 | 0.1026 |
| 2024 | 0.0767 | 0.0749 |
| 2025 | 0.0186 | 0.0275 |
| 2026 | 0.0441 | -0.0538 |
Parameters
get_kappa_ratio accepts the following parameters:
- period (str, optional): The period to use for the calculation. Defaults to “quarterly” if the Toolkit is initialized with quarterly=True, otherwise “yearly”.
- order (int, optional): The order of the lower partial moment used in the denominator. Defaults to 3.
- rounding (int, optional): The number of decimals to round the results to. Defaults to 4.
- growth (bool, optional): Whether to calculate the growth of the ratios. Defaults to False.
- lag (int | str, optional): The lag to use for the growth calculation. Defaults to 1.
- standardize (bool, optional): Whether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False.