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

The Upside Capture Ratio measures how well an investment portfolio or asset performs relative to a benchmark during periods in which the benchmark’s return is positive. A ratio above 1 (or 100%) indicates the asset captured more of the benchmark’s gains than the benchmark itself.

The formula is as follows:

\[\text{Upside Capture Ratio} = \text{Average Return in Up Periods} / \text{Average Benchmark Return in Up Periods}\]

Upside Capture Ratio in Python

Install the Finance Toolkit with:

pip install financetoolkit -U

Then call get_upside_capture_ratio as shown below.

from financetoolkit import Toolkit

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

toolkit.performance.get_upside_capture_ratio()

Which returns:

Date AAPL TSLA
2021 1.3754 2.1079
2022 1.3044 1.7261
2023 1.1783 2.3099
2024 1.1158 2.5976
2025 1.0162 2.2065
2026 0.766 1.593

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”.
  • 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