Calculate the Rachev Ratio (R-Ratio) of an investment portfolio or asset’s returns.

The Rachev ratio compares the “quality” of the best outcomes to the “quality” of the worst outcomes by taking the ratio of the right-tail Expected Shortfall (the average of the best alpha fraction of returns) to the left-tail Expected Shortfall (the average magnitude of the worst alpha fraction of returns). A ratio above 1 indicates that the average size of extreme gains outweighs the average size of extreme losses.

The formula is as follows:

\[\text{Rachev Ratio} = \operatorname{ES\_right}(\alpha) / \operatorname{ES\_left}(\alpha)\]

Also known as: R-Ratio.

Rachev Ratio in Python

get_rachev_ratio is part of the Performance module of the open-source Finance Toolkit. Install it with:

pip install financetoolkit -U

Then call get_rachev_ratio as shown below.

from financetoolkit import Toolkit

toolkit = Toolkit(["AAPL", "TSLA"], api_key="FINANCIAL_MODELING_PREP_KEY")

toolkit.performance.get_rachev_ratio()

Which returns:

Date AAPL TSLA
2022 1.0788 0.9467
2023 1.0726 1.1169
2024 1.1443 1.3081
2025 1.0729 1.0925
2026 0.8627 0.8404

Parameters

get_rachev_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”.
  • within_period (bool, optional): Whether to calculate the Rachev Ratio within the specified period or for the entire period. Thus whether to look at the return distribution within a specific year (if period = ‘yearly’) or look at the entirety of all years. Defaults to True.
  • alpha (float, optional): The confidence level used for both tails (e.g. 0.05 for the best/worst 5% of outcomes). Defaults to 0.05.
  • 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.
Share