LONDON  - The recent rise and then fall in U.S. oil prices has been driven primarily by changes in crude inventories around the NYMEX delivery point at Cushing, but changes in gasoline stocks have added to the volatility.

U.S. gasoline stocks have tightened slightly in recent weeks, but only after a huge accumulation since the middle of the third quarter in response to earlier shortages and exceptionally high refining margins.

Inventories had fallen almost exactly in line with the prior ten-year seasonal average by November 10 from a surplus of 7 million barrels (+3% or +0.93 standard deviations) two weeks previously.

But the surplus itself was a reaction to an unusually large deficit of 13 million barrels (-5% or -1.36 standard deviations) in the middle of July.

Fears of a shortage sent refining margins for making gasoline soaring to an average of $37 per barrel in July, among the highest for a decade.

By the end of July, hedge fund managers had amassed a bullish long position of 78 million barrels in gasoline futures and options (83rd percentile for all weeks since 2013) bettering prices would increase further.

The resulting position-building helped drive futures prices even higher in the short term, widened margins and even more and pulled up crude prices in their wake.

Chartbook: U.S. gasoline stocks and prices

In response, refiners have maximised crude processing and adjusted downstream units to increase the yield of gasoline at the expense of diesel and other middle distillates.

By September and October, gasoline stocks were increasing rather than falling as is normal at this point in the year.

With the threat of a shortage receding, fund managers had slashed their position to just 26 million barrels (18th percentile) by Oct. 17.

Fund managers sold gasoline in 9 of 11 weeks between Aug. 1 and Oct. 17, according to records filed with the U.S. Commodity Futures Trading Commission.

The rate of selling was the fastest since May 2020 (during the first wave of the coronavirus pandemic) and before that 2017 and 2014.

Liquidation now added to volatility in reverse, accelerating and amplifying downward pressure on prices and margins.

Gasoline margins fell by three-fourths to an average of less than $10 per barrel in October, among the lowest for a decade.

With margins much lower, refiners have had an incentive to pull back on crude intake and switch output back towards diesel.

In the meantime, the lower intake added to crude inventories and accelerated the pullback in crude prices and calendar spreads.

John Kemp is a Reuters market analyst. The views expressed are his own. Follow his commentary on X, formerly Twitter: (Editing by David Evans)