# 3 ways to clearly measure your investment skill

In today’s newsletter, we’ll explore three ways to use batting average—a statistical method used by professional investors to measure investment skill.

Whether you’re a professional or not, understanding how to calculate and interpret your batting average can provide valuable insight into your investment performance.

Let’s get started!

## 3 ways to clearly measure your investment skill

The batting average measures investment skill—how often an investment manager beats a specific index, like the S&P 500 or Nasdaq.

This index is used as a benchmark that helps evaluate the manager’s performance. A higher batting average means the manager often meets or surpasses the benchmark.

This is a sign of investment skill. It means the manager is consistently able to outperform their benchmark.

You can use the batting average to measure your own investment performance against a chosen benchmark. Doing this will help determine if you’re better of just investing in the underlying index.

You can use batting average to gauge your investment skill like the professionals with Python.

Here’s how.

## Imports and set up

First, import the tools we’ll need including NumPy, pandas, and the OpenBB SDK.

```import numpy as np
import pandas as pd
from openbb_terminal.sdk import openbb
```

```prices = openbb.economy.index([
"META",
"AAPL",
"AMZN",
"NFLX",
"GOOG",
"QQQ"
])

returns = prices.pct_change().dropna()
bench_returns = returns.pop("QQQ")
port_returns = (returns * 0.2).sum(axis=1)
```

We’ll assume an equal-weighted, non-rebalancing portfolio of the FAANG stocks. We include QQQ in the download, then pop it off to compute the benchmark returns.

## Compute the batting average

Create a function that computes the batting average. We’ll walk through the code next.

```def batting_average(port_returns, bench_returns):
results = dict(
{
"batting average": np.nan,
"up market": np.nan,
"down market": np.nan,
}
)
active_returns = port_returns - bench_returns
ba = active_returns > 0
up = active_returns[bench_returns >= 0.0] > 0
down = active_returns[bench_returns < 0.0] > 0

if len(ba) > 0:
results["batting average"] = ba.mean()
if len(up) > 0:
results["up market"] = up.mean()
if len(down) > 0:
results["down market"] = down.mean()

return pd.Series(results, index=results.keys())
```

The first step is to create a dictionary with three keys: batting average, up market, and down market. We set these to np.nan as a default.

Next, we compute the active returns which are the returns earned above the benchmark.

From there, we create three variables that use boolean indexing to identify when the active returns are positive. The result of each of these is a pandas Series with the boolean True when the active return is positive, and False when it’s not.

We repeat the process for when the benchmark has positive returns and again for when it has negative returns.

Taking the mean of each of these Series gives us the average number of times the portfolio beat the benchmark.

## Interpret the results

In this example, the batting average is 50.5%. When the benchmark is up, the batting average raises to 56% and when it’s down it falls to 43.7%.

This means the portfolio just meets the minimum threshold of a successful strategy.

Investment managers are paid to outperform the benchmark. The batting average is a great way to determine if their strategy is worth the expense.

For individual investors, active portfolio management comes with risk and opportunity cost. If you were trading this portfolio, you might consider investing in the benchmark instead.

## Next steps

This example uses an equal-weighted, non-rebalancing portfolio of the FAANG stocks.

As a next step, generate a return series for your own investment strategy. Then compare it to a benchmark that best represents the stocks inside.