Relative value
Two spread trades, tested with costs
A spread trade bets on the gap between two prices, not on where the market is going. I took two classic spreads, wrote one simple rule, and tried to find out whether the edge is real. Each spread has its own page.
The two studies
Study 1
The crack spread
The margin of an oil refinery: fuel prices minus the price of crude. Twenty years of daily prices, three markets, one margin.
Sharpe 0.43 · 87% of trades win
Read the crack spread studyStudy 2
The 2s5s10s butterfly
The middle of the US Treasury curve against its two ends. Thirty-six years of daily yields.
Sharpe 0.33 · 81% of trades win
Read the butterfly studyEach spread also has a ticket that applies the rule to the latest data: what to buy and sell, how much, and where to stop. The position sizing page then asks how big you can trade a small edge like this.
- What I did
- I built one rule that sells a spread when it is far above its recent average and buys it when it is far below. I ran it on 36 years of Treasury yields and 20 years of oil prices. On every day I used only what was known that day, and I paid trading costs.
- Why it matters to a trader
- Relative value desks earn money when a gap closes. The hard part is knowing whether a gap is a chance to trade or a new normal. A test with costs over many years is the first thing a portfolio manager asks for.
- What I found
- A small edge, not a big one. Most trades win, but a few big losers eat the gains: the worst trade is 8 to 11 times the average one. With a stop, the margin of error includes zero for both spreads, so the edge may be nothing.
- What I could not show
- That anyone could really have traded this. I use free data, not the prices of the futures or bonds you would actually trade, and I did not model margin or how easy it is to get in and out.
The rule
The same rule is used for both spreads. Take the last 250 trading days, about one year. Measure how many standard deviations today’s spread is from that year’s average. This is the z-score. A standard deviation is the usual size of a gap from the average.
- If the z-score is above 1.5, sell the spread. If it is below -1.5, buy it.
- Leave the trade when the z-score is back inside 0.5.
- Optionally, add a stop: give up if the spread moves 2 standard deviations against you, measured on the day you entered. After a stop, wait until the z-score is back inside 1.5.
I chose these settings before looking at results. Each study shows what happens with other settings, so you can see that these were not picked for being the best.
Costs. Every time the position changes I charge half a basis point on the butterfly and $0.10 a barrel on the crack. A basis point is 0.01 percentage point. Each study shows how the result changes with other costs.
The two results side by side
The Sharpe ratio is average daily profit divided by how much the profit jumps around, scaled to a year. Above 1 is good. Around 0.3 to 0.5 is small. The 95% range is a bootstrap range: a margin of error worked out by reshuffling blocks of days in the data.
| Butterfly | Crack | |
|---|---|---|
| Period tested | 1990 to 2026 | 2006 to 2026 |
| Sharpe ratio, simple rule | 0.33 | 0.43 |
| 95% range for that Sharpe ratio | 0.04 to 0.61 | 0.09 to 0.76 |
| Sharpe ratio, with a 2 standard deviation stop | 0.27 | 0.30 |
| 95% range with the stop | -0.02 to 0.56 | -0.05 to 0.65 |
| Trades (simple rule) | 89 | 60 |
| Winning trades | 81% | 87% |
| Average trade | 4.8 bp | $2.9 /bbl |
| Worst trade | -39 bp | -$32.5 /bbl |
| Worst trade with the stop | -33 bp | -$16.7 /bbl |
| Years with a profit | 24 of 37 | 14 of 21 |
Three things stand out. First, the edge is small, and with a stop the margin of error includes zero for both trades. Second, the stop lowers the profit. It cuts the worst crack trade from -$32.5 to -$16.7 a barrel, but the worst loss is still many times the average win. Third, most trades win, and a few big losers eat the gains. That is the normal shape of a mean-reversion trade (a bet that a gap will close), and it is why the size of the position matters more than the signal.
How the tests are done
Only past data. The average and the standard deviation on day t use only days up to t. A position opened on day t earns from day t+1. A test in the repository changes the last 100 days of data and checks that no earlier result moves.
Two days were removed. On 20 April 2020 the price of WTI crude went below zero and distorted the crack. I drop any day when crude was below $5, that day or the day before. That removes 20 and 21 April 2020, and nothing else. The numbers are on the crack spread page.
Same code, two languages. The rule was written in Python, in the research repository, with 40 tests. The site runs it in JavaScript so it is instant on a phone. A check runs both on the same data and fails if any result differs.
Fresh data. Treasury yields come from FRED and oil prices from the US Energy Information Administration. A job on the server refreshes both every morning. The EIA publishes in weekly batches, so oil prices are usually about a week old.
What this is not
This is research. Nothing here has been traded, and nothing here is advice. The rule earned a small amount in the past. That is not a promise about the future.
Source and tests at
github.com/Nicolas8330/relative-value-strategies.
Every fixed figure on these pages comes from one run of
examples/make_results.py.