Housing Becomes Hottest Trade of 2012

Sam Hodgson | Bloomberg | Getty Images

While the risks can be large, sometimes the biggest paydays on Wall Street come from making a contrarian bet on the most hated sector on the planet. This was never truer than during 2012.

The housing sector, which brought the financial system to its knees in 2008 and continued to be an albatross around the middle class for the next three years, was the hottest trade this year as consumer confidence improved and as the Federal Reserve kept interest rates low. The central bank even went so far as to purchase mortgage-backed securities.

The iShares U.S. Home Construction ETF (ITB) surged more than 75 percent in 2012 as shares of homebuilders such as Pulte Homes and Lennar doubled or nearly doubled and construction-related stocks like Home Depot jumped. More complicated mortgage-backed securities were among the biggest winners for hedge funds brave enough to buy them.

"They took the painful writedowns and survived the hit," said Barry Ritholtz, CEO of Fusion IQ and author of The Big Picture blog. "And have you priced a mortgage lately? It's 3.25 percent for a 30-year fixed."

True to its function as a discounting mechanism, these stocks starting moving higher early on in the year in anticipation of a relatively sizeable increase in home prices.

It got there when prices climbed at a 4.3 percent annual rate in October, according to the latest seasonally-adjusted S&P/Case-Shiller 20-City Composite Index. That was higher than many economists predicted, but no surprise for buyers of these stocks.

"Since the businesses that were able to survive the home construction nuclear winter became so lean, they were highly leveraged to a pickup in business," said Mitchell Goldberg, president of ClientFirst Strategy. "The homebuilding sector was one of those stories that you knew it would turn around eventually, but it took a heck of a long time."

To be sure, the Home Construction ETF is down more than 60 percent from its high back in 2006. And during those days, home prices were posting double-digit annual gains on a monthly basis, according to S&P/Case-Shiller.

(Read More: Robert Shiller: Don't Await Housing Boom)

Many investors think the easy money has been made in this trade and there will be tough sledding ahead again for the sector as unemployment stays elevated and foreclosures pressure prices.

"A lot of people seem to think that if the market turns around, that means more of the same," said Professor Robert Shiller, Yale economist and co-creator of those very indexes, in an interview with CNBC this month. "We might see home prices go up a little bit above inflation, but it is not likely that we'll see a real boom."

So what's the most hated sector going into 2013? Going by ETF performance, it's natural gas with the U.S. Natural Gas Fund (UNG) down 27 percent in 2012. Feeling lucky?

For the best market insight, catch "Fast Money"' each night at 5 p.m. ET, and the "Halftime Report" each afternoon at 12 noon ET on CNBC. Follow @CNBCMelloy on Twitter.