Commodity investors aren’t letting the shock of Brexit spoil their best three months since 2010.

While the UK’s vote to leave the European Union has whipsawed markets, raw materials have still outperformed stocks, bonds and the dollar in the second quarter with a return of 13%. The Bloomberg Commodity Index entered a bull market this month as oil advanced above $50 a barrel and prices of everything from soybean meal to zinc rallied. The index is still down about 50% from the high reached in 2011.

“Investors are now shrugging off the impact of Brexit as the market has already priced it in,” Will Yun, a commodities analyst at Hyundai Futures Corporation, said by phone from Seoul. “With the oversupply largely shrinking, the market is on the path of re-balancing as the worst seems to be over for now and we’ve hit the bottom.”

Commodity prices have rebounded on speculation that supply disruptions and production cuts are whittling away the surpluses that caused the biggest price collapse in a generation, while global demand shows signs of improvement. Citigroup Inc. said last month that commodities had turned a corner, increasing its forecasts for metals to grains amid an oil-led recovery.

Oil Recovery

Brent crude has recovered all its losses after falling the most since February in the two days following last week’s Brexit vote. Shrinking US stockpiles and supply disruptions from Canada to Nigeria have added to speculation that the market is on a slow-but-steady path higher. Futures for August settlement traded at $50.01 a barrel on the ICE Futures Europe exchange at 12:43pm in London on Thursday, up 27% in the quarter.

Three of the top five performers on the Bloomberg Commodity Index this quarter are agricultural commodities, led by soybean meal, which has returned 47% over the period as extreme weather threatens crops in Latin America. Investors are flocking to agricultural commodities at the fastest pace since the 2012 drought, Goldman Sachs Group said this week.

Natural gas, the strongest energy commodity on the Bloomberg Index, has returned 28% this quarter after prices fell in March to the lowest level since 1999. Shrinking shale production and above-average temperatures from the La Nina weather effect  have caused companies to inject 27% less gas into storage over the quarter than the average from 2011 to 2015.

While commodities markets are showing signs of improvement, a significant move higher will take longer as imbalances are worked out, according to Yun.

“The overall market will only see a meaningful price recovery next year following a gradual increase in the latter half of 2016,” he said.