It’s understandable if investors are becoming queasy while tracking the ups and downs of commodity-related corporate bonds.

There were losses last year. Huge losses, comparable to those experienced during the 2008 financial crisis. And now there are gains. Huge gains.

How big? Dollar-denominated bonds of metals, mining and steel companies have surged 11.2 percent just since the end of January, with debt of Vale Overseas gaining 20.6 percent and notes of Glencore returning 18.5 percent, Bank of America Merrill Lynch index data show.

Glencore's Gyrations

Glencore's debt has been bouncing up and down in the face of volatile commodity prices

Source: Finra's Trace, Bloomberg

And that was just leading up to Monday’s unprecedented rally in iron ore, which soared about 19 percent by one measure on China’s steadfast commitment to support the nation’s growth.

Looking at this roller coaster, it’s easy to think that bonds are similar to stocks, subject to the emotional whims of investors who feel sanguine about a company one day and terrible about it the next.

But bonds are supposed to be more basic, more clear cut. The whole point is that borrowers are contractually required to pay back their debts or else face significant consequences. This is math. It isn’t voodoo. Just looking at recent volatility, it can be hard to remember that.

Zooming out, it becomes clearer how the market became fragile enough to allow such unpredictable moves. Investors spent years plowing billions of dollars into corporate bonds, relying on broad indexes to guide their investments. Those indexes happened to be growing more quickly in commodity-related sectors.

For example, bonds of energy companies accounted for 10.3 percent of the broader U.S. high-yield index in March 2008 before growing to more than 14 percent last June, Bank of America Merrill Lynch index data show. The proportion of the U.S. high-yield bond market tied to metals and mining companies rose to 3.7 percent in March 2015 from just 2.7 percent six years earlier.

Junky Energy

Energy debt accounted for about 15 percent of the U.S. junk-bond index at its peak

Source: The BofA Merrill Lynch US High Yield Energy Index

Credit investors piled in without much analysis of what they were getting into. After all, many junk-bond mutual funds and exchange-traded funds track indexes that weight companies by how much debt they have outstanding. So investors largely just bought what everyone else was buying as they sought bigger returns when there was a dearth of them. And they did it more frequently.

An increased focus on daily trading in indexed funds has "turned investing into gambling," Gershon Distenfeld, director of high yield at AllianceBernstein, said in an interview last week. "That’s not what investing is supposed to be."

For now, the riskier corporate-bond market is increasingly looking like a casino. Investors are placing big wagers on commodity-related debt without much expertise in predicting the direction of oil and metals prices. Their fortunes might as well be riding on the next card or spin of the wheel.

Eventually, credit markets should return to a methodical analysis of specific companies, a place where price moves make sense and rely on deep research. For now, investors are winning or losing big in the space of months, sometimes on just sheer luck.

This column does not necessarily reflect the opinion of Bloomberg LP and its owners.