Omega Ratio
Calculate the Omega Ratio of an investment portfolio or asset’s returns.
The Omega Ratio is a risk-return measure that divides the sum of gains above a minimum acceptable return (MAR) by the sum of losses below it, capturing the full shape of the return distribution rather than only its first two moments (unlike the Sharpe Ratio).
The formula is as follows:
\[\text{Omega Ratio} = \operatorname{SUM}(\text{Gains above MAR}) / \operatorname{SUM}(\text{Losses below MAR})\]See definition: https://en.wikipedia.org/wiki/Omega_ratio
Omega Ratio in Python
Install the Finance Toolkit with:
pip install financetoolkit -U
Then call get_omega_ratio as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(["AAPL", "TSLA"], api_key="FINANCIAL_MODELING_PREP_KEY")
toolkit.performance.get_omega_ratio()
Which returns:
| AAPL | TSLA | |
|---|---|---|
| 2021 | 1.2354 | 1.1945 |
| 2022 | 0.892 | 0.8129 |
| 2023 | 1.4034 | 1.3043 |
| 2024 | 1.2462 | 1.2098 |
| 2025 | 1.0873 | 1.0871 |
| 2026 | 1.2062 | 0.9358 |
Parameters
The function 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”.
- within_period (bool, optional): Whether to calculate the Omega Ratio within the specified period or for the entire period. Thus whether to look at the Omega Ratio within a specific year (if period = ‘yearly’) or look at the entirety of all years. Defaults to True.
- rolling (int, optional): The rolling window size to use for the calculation. If set, the
Omega Ratio is calculated over a rolling window of this many periods across the full
return history instead of per
period. Defaults to None. - minimum_acceptable_return (float, optional): The minimum acceptable return (MAR) used as the threshold between gains and losses. Defaults to 0.0.
- 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.