# How to use capture ratios to improve investment performance

In today’s newsletter, we’ll cover the up-market capture ratio, a framework for evaluating investment performance in rising markets.

Even though the ratio is used by professional money managers, you can use it to better gauge your own investment performance.

Let’s dive in!

## How to use capture ratios to improve investment performance

The up-market capture ratio is a way to evaluate how well an investment performs when the market is rising. It compares the performance against a benchmark during bull markets.

The ratio is calculated by dividing the investment’s returns by the returns of the benchmark during a bull market.

The higher the up-market capture ratio, the better the performance during positive market conditions.

If you’re a systematic trader, you can use the ratio to determine if your strategy performs well during bull markets or whether it may be better suited to other market regimes.

Here’s how you can use it like the professionals with Python.

## Imports and set up

Start with the imports and prepare the data. All we need today is the OpenBB SDK for market data.

```from openbb_terminal.sdk import openbb

prices = openbb.economy.index(
["AAPL", "WMT", "SPY"],
start_date="2020-01-01"
)

returns = prices.pct_change().dropna()

data = returns.assign(
port=returns[["AAPL", "WMT"]].sum(axis=1)
)[["SPY", "port"]]
```

After we import the OpenBB SDK and download data, we compute the daily returns and build the simple equally weighted portfolio. Using the pandas assign method, you can easily add a new column to your DataFrame. In this case, we add a column with the sum of AAPL and WMT returns and name it port.

## Compute the upside capture ratio

There are two steps to computing the ratio. In the first step, we build a function to compute the annual return.

```def annual_return(returns):
num_years = len(returns) / 252
return (returns + 1).prod() ** (1 / num_years) - 1
```

The code divides the number of returns by 252 to get the number of years. The function then computes the cumulative product of the daily returns to get the cumulative return, raises it to the power of the inverse of the number of years, and subtracts 1 to provide the annualized return.

In the second we build a function to compute the upside capture.

```def upside_capture(port_returns, bench_returns):

return (
annual_return(port_returns)
/ annual_return(bench_returns)
)
```

The ratio is calculated by dividing the investment’s returns by the returns of the benchmark during a rising market. The first step is to find where the benchmark is rising which is done by masking the returns when they are not positive.

Then to compute the up-market capture ratio, divide the annual returns of the positive portfolio returns by the annual return of the positive benchmark returns.

A positive up-market capture ratio indicates this portfolio outperforms the benchmark during bull markets.

## Next Steps

There are two steps you can take.

First, adjust the simple two-stock portfolio to reflect your own. You can increase complexity by including a periodic rebalance.

Second, compute the cousin of the up-market capture ratio: The down-market capture ratio. You can do this by changing one part of the code.