How the Treynor ratio landed me a $100 million trading book

March 18, 2023
Facebook logo.
Twitter logo.
LinkedIn logo.
Get this code in Google Colab

How the Treynor ratio landed me a $100 million trading book

In 2014, the tension was high as the trading bench manager called for an all-hands meeting.

Everyone knew something was off.

Only a week prior, regulators had conducted a surprise raid on the London office, with only an hour's notice, searching for evidence of rogue trading.

As I sat in our Chicago office, I couldn't help but wonder if it was happening to us too.

But as the details emerged, we all breathed a collective sigh of relief.

It wasn't a raid—it was something entirely unexpected.

It turned out that our traders were making too much money. Yes, you read that right—too much money.

"Uhh, duh!"

We all knew our traders made a lot of money, but it was one of those unspoken truths that we never really talked about.

Until now.

What happened next would change the course of my career forever:

I was tasked with managing a $100 million book of credit.

And it all started with a simple ratio.

Use Python to calculate a stock’s beta against its benchmark. Then use it to compute the Treynor ratio.

Traders get paid for making money, but high-risk trades can lead to big losses.

The Treynor ratio measures the reward-to-volatility ratio and helps traders understand how much reward they get for each unit of risk.

When used with other risk metrics like the Sharpe ratio, the Treynor ratio helps measure your risk-adjusted returns.

Unlike the Sharpe ratio, the Treynor ratio uses beta against a benchmark to measure risk. In a previous newsletter, you learned how beta is used by quant traders. Beta is a considered systematic risk that cannot be diversified away. Treynor measures the return investors receive for every unit of risk that cannot be diversified away.

Imports and set up

For today’s newsletter, all you need is data. Import the OpenBB SDK to get it.

1from openbb_terminal.sdk import openbbNow grab the data and compute the returns.

1Now grab the data and compute the returns.
2
3data = openbb.stocks.load(
4    "JPM, SPY",
5    start_date="2014-01-01",
6    end_date="2022-12-31"
7)
8
9asset = data["Adj Close"].JPM
10benchmark = data["Adj Close"].SPY
11
12asset_returns = asset.pct_change().dropna()
13benchmark_returns = benchmark.pct_change().dropna()

This code pulls 8 years of stock price history, extracts the price data, and computes the daily returns. I use SPY as the benchmark, but you can use any benchmark you want.

Compute the Treynor ratio

Start by computing beta.

1bm_cov = benchmark_returns.rolling(
2    window=30
3).cov(asset_returns)
4
5bm_var = benchmark_returns.rolling(
6    window=30
7).var()
8
9beta = bm_cov / bm_var

The beta coefficient is the covariance between the returns of the benchmark and the asset divided by the variance of the benchmark. Using pandas makes it easy to compute it.

And finally, compute the Treynor ratio.

1treynor = (
2    asset_returns - benchmark_returns
3) / beta
4
5treynor.plot()

The Treynor ratio is the active return (portfolio returns minus the benchmark return) divided by the beta.

It measures how much return you earn over the benchmark for every unit of risk you take on.

PQN #036: How the Treynor ratio landed me a $100 million trading book

A higher Treynor ratio is better which means the investment is earning a high return compared to the systematic risk it’s taking on.

Back to the story…

A team of analysts had been crunching numbers trying to get a better understanding of the traders' performance.

They realized a particular trader's Treynor ratio had consistently been through the roof.

This led to more digging, and soon they realized that most of the traders had high Treynor ratios.

They dug deeper and discovered that the traders were taking on high-risk trades. Soon, traders were paid based on their risk-adjusted returns, not just their returns.

This was a game-changer for the traders, and their performance only continued to improve. As they grew more confident, they began taking on even more high-risk counterparties, which paid off in spades.

But there was another surprise in store for them.

About nine months later, the credit exposure they had been taking on was traded as credit valuation adjustment (CVAs).

I landed the book of $100 million in CVA and the traders were paid not only on their risk-adjusted returns but their credit-adjusted returns as well.

And it all started with the Treynor ratio.

Man with glasses and a wristwatch, wearing a white shirt, looking thoughtfully at a laptop with a data screen in the background.