The crack spread: an oil refining margin
A refinery buys crude oil and sells fuel. The gap between the two is its margin. I tested a simple rule on that gap to find out whether the edge is real after costs.
- What I did
- I sell the crack when it is far above its recent average and buy it when it is far below. I ran this on 20 years of daily oil and fuel prices. On each day I used only what was known that day, and I paid trading costs.
- Why it matters to a trader
- Energy desks and commodity funds trade this margin. It is a bet on refining, not on the direction of oil. If the margin really does come back to normal, it is a way to earn from a gap while staying mostly out of the oil price.
- What I found
- A small edge. The Sharpe ratio (average profit divided by how much it jumps around, scaled to a year) is 0.43 after costs for the simple rule, and 87% of trades win. But the worst trade lost 11 times the average trade. From 2022 to 2026, the rule with a stop had a Sharpe ratio of -0.13.
- What I could not show
- That anyone could really have traded it. I use spot prices from the US government, not the prices of the futures you would trade. I did not model margin or the cost of moving between contracts.
The trade in plain words
A refinery buys crude oil and sells fuel. The crack spread is its margin: the price of the fuel minus the price of the crude. In the 3-2-1 version, 3 barrels of crude turn into 2 barrels of gasoline and 1 barrel of heating oil. Fuel is quoted per gallon and a barrel is 42 gallons, so the spread is (2 × gasoline + 1 × heating oil) × 42 / 3 minus crude, in dollars per barrel.
The story: when the margin is very high, refiners make more fuel and the margin falls. When it is very low they cut back and it rises. That is a reason to test the trade. It is not proof that it works.
To trade it you sell the crack: buy 3 crude oil contracts, sell 2 gasoline and 1 heating oil. I call this set a package. One package covers 3,000 barrels and earns $3,000 for every $1 the spread moves.
The rule is the same as for the butterfly. Look at the last 250 trading days. Measure how many standard deviations today’s spread is from that average: this is the z-score. Enter above 1.5 or below -1.5, and leave inside 0.5. Optionally, add a stop at 2 standard deviations against the trade. It is explained once on the relative value page.
Try the rule on the crack
Loading the data
Was it the same in every period?
| Period | Days | Sharpe | Profit |
|---|
What the results say
A Sharpe ratio 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.
| Simple rule | With a stop | |
|---|---|---|
| Sharpe ratio, after costs | 0.43 | 0.30 |
| 95% range for the Sharpe | 0.09 to 0.76 | -0.05 to 0.65 |
| Trades | 60 | 71 |
| Winning trades | 87% | 76% |
| Average trade, per barrel | $2.94 | $1.29 |
| Worst trade, per barrel | -$32.5 | -$16.7 |
| Worst trade on one package | -$97,566 | -$50,064 |
| Years with a profit | 14 of 21 | 14 of 21 |
Three things stand out. First, the edge is small, and with a stop the margin of error includes zero. It may be nothing. Second, the stop lowers the profit, but it cuts the worst trade in half. Third, most trades win and a few big losers eat the gains. That is the usual 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.
In which situations could it make sense?
Each point is marked Tested when I measured it in this data, or Idea when it is how the market works in theory and I did not test it. Every slice of data is small, so read the numbers lightly. The Sharpe ratios and the losing years below are for the version with the stop.
When it could make sense
- Idea After a short shock, such as a refinery outage, a hurricane on the US Gulf Coast or a cold snap. Margins jump for a few weeks, then the plants restart and the margin falls back.
- Idea When margins are very high. High margins make refiners run harder and restart idle plants, which adds fuel and pushes margins down.
- Tested In the fourth quarter. The rule had a Sharpe of 0.87 in October to December and -0.17 in July to September.
- Tested When the crack is calm. The Sharpe was 0.71 when the spread had been moving little, against 0.05 when it had been jumping around.
When it can hurt
- Tested In some years. The rule lost money in 2011, 2013, 2020, 2023, 2026. The worst year was 2026 (-$29.2 a barrel), and from 2022 to 2026 the Sharpe ratio was -0.13. I did not test the cause. My guess is that a lasting shock, such as the war in Ukraine, keeps the margin away from normal.
- Tested Extreme losses. The worst trade lost $16.7 a barrel with the stop and $32.5 without it, against an average trade of $1.29 with the stop. On one package that is $50,064 to $97,566.
- Idea Around the September change from summer to winter gasoline. The front-month gasoline contract switches grade and the spread can jump by several dollars overnight. This is a futures effect and does not show in the spot prices used here.
What does the rule say today? When this page was built, the crack was at $73.1 a barrel (z-score 1.84) and the rule held a trade that was down $13.5 a barrel. The crack spread ticket applies the rule to the latest data and shows these situations next to the signal.
How much should you trust it?
The settings were not picked for being the best. Here is the Sharpe ratio of the simple rule for other windows and thresholds. Across the 12 settings it goes from 0.26 to 0.66.
| Window \ entry | 1.0 | 1.5 | 2.0 |
|---|---|---|---|
| 60 days | 0.64 | 0.66 | 0.56 |
| 120 days | 0.63 | 0.61 | 0.53 |
| 250 days | 0.44 | 0.43 | 0.31 |
| 500 days | 0.34 | 0.36 | 0.26 |
Costs matter less than you might think. With a cost of $0, $0.05, $0.10 and $0.25 a barrel each time you trade, the Sharpe ratio (with stop) is 0.35, 0.33, 0.30, 0.23. The rule trades rarely, so the cost per trade is small next to the average move.
Two days were removed. On 20 April 2020 the price of WTI crude went below zero, to -$37. A crack built on that day prints about $66, when it is usually between $9 and $36, and it distorts every statistic. I drop any day when crude was below $5, that day or the day before. That removes 20 and 21 April 2020. Nothing else was removed.
What I did not do. I did not test on futures prices. The prices come from the US Energy Information Administration and are spot prices for WTI crude, New York Harbor gasoline and New York Harbor diesel. A real trade uses futures, with a bid-offer spread, margin, and a change of contract every month. I did not model any of that.
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 figure outside the interactive test comes from one run of
examples/make_results.py. The last oil price used for the
text is from 22 September 2026. See also the
butterfly page.