Rachev Ratio
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 or via the MCP
Install the Finance Toolkit with:
pip install financetoolkit -U
Then call get_rachev_ratio as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(
["TSLA", "AMD", "PLTR"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2021-01-01",
end_date="2025-12-31",
)
toolkit.performance.get_rachev_ratio()
Or, after setting up the Finance Toolkit MCP, ask:
What was the Rachev ratio of Tesla, AMD and Palantir in each year from 2021 to 2025?
Which returns:
| TSLA | AMD | PLTR | |
|---|---|---|---|
| 2021 | 1.2069 | 1.1556 | 1.2789 |
| 2022 | 0.9469 | 0.9396 | 0.9301 |
| 2023 | 1.1169 | 1.3483 | 1.6236 |
| 2024 | 1.3081 | 0.8908 | 2.0305 |
| 2025 | 1.0925 | 1.4024 | 1.0683 |
Parameters
get_rachev_ratio accepts the following parameters.
| Parameter | Type | Description | Example |
|---|---|---|---|
period | str | The period to use for the calculation. Defaults to “quarterly” if the Toolkit is initialised with quarterly=True, otherwise “yearly”. | "quarterly" |
within_period | bool | 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. | False |
alpha | float | The confidence level used for both tails (e.g. 0.05 for the best/worst 5% of outcomes). Defaults to 0.05. | 0.01 |
rounding | int | None | The number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise). | 2 |
growth | bool | Whether to calculate the growth of the ratios. Defaults to False. | True |
lag | int | list[int] | The lag to use for the growth calculation. Defaults to 1. | 4 |
standardize | bool | Whether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False. | True |