The boom time for the Toronto Stock Exchange over the past few months is over, and the TSX battled another poor day on Wednesday due to slumping oil and commodity prices. Reuters announced that the TSX fell in morning trade as oil went back below $50 a barrel. While certain commodities such as lithium are booming, commodities are struggling on a global scale thanks to infighting between the OPEC countries as well as general economic malaise.

This is not good news for two particular commodities companies. Oil producer Baytex Energy Corp. (TSX:BTE)(NYSE:BTE) and gold miner IAMGOLD Corp. (TSX:IMG)(NYSE:IAG) have seen their stock values slump since the TSX reached its peak last week.

But one of these companies is in better health than the other. Higher gold prices are more likely than higher oil prices in the short term, and IAMGOLD has performed better than Baytex over the past year and doesn’t suffer from a serious debt problem. While IAMGOLD could be a perfectly good buy as investors aim to acquire assets during a slump, investors should stay away from Baytex.

The oil problem

A little over two years ago, Baytex was worth more than $48 per share as it celebrated high prices and profits. Today, its value is little more than $5 as the company has been hit hard by the corresponding fall.

The fact that Baytex is even around at all is a testimony to its toughness. While hundreds of other oil companies folded as prices fell, Baytex managed to survive and enter new deals, such as a multi-year natural gas agreement with power producer Kineticor signed in July. But the company has a gargantuan net debt of $1.9 billion as of Q2 2016 that was largely created by a deal where Baytex spent $2.9 billion to acquire assets in the famous Eagle Ford oilfield.

It is true that much of this debt won’t be serviced until 2021, so Baytex has time to wait for higher oil prices. And over the long term, oil prices should rise as new shale developments become harder to find; prices are expected to reach $55 per barrel by 2019. Higher oil prices would enable Baytex to service its debt and regain its footing.

But because of its massive debt load, Baytex needs a higher oil price compared to competitors such as Encana Corp. to commit to the same actions. And while it can afford to wait to service its debt to some extent, Baytex’s production has been falling. Its high debt load will make it more difficult for it to find new opportunities to expand production and cause it to fall behind.

The benefits of IAMGOLD

Any sound investor should tell you that investing in gold is problematic, and Warren Buffett likes to say that people speculate, not invest, in gold. But a gold company is a different kettle of fish, and there are reasons to be optimistic about IAMGOLD’s performance in the short to medium term.

While IAMGOLD has some debt problems, the company has worked its hardest to fix them. The company issued over 38 million common shares this year to help pay down its debts, and it is working on slashing costs, which have been a major concern as it looks to upgrade its mines in Suriname and Burkina Faso.

In addition, IAMGOLD is working on developing a new mine in Ontario, which could hold over 8.3 million ounces of gold. It has received approval from Canada’s environmental minister.

The result of these improvements is that IAMGOLD beat expectations in its last quarter with $0.01 in earnings per share compared to the expectations of -$0.02. While speculating on gold is always a chancy affair, continued uncertainty in the world economy should mean that gold will continue to retain its value for the foreseeable future.

Given IAMGOLD’s new projects as well as the gold price, it should beat the current expectations of $0.01 in earnings per share in its December quarterly report.

Gold, not oil

If you are willing to sit on a stock for two to three years while betting that Baytex can hold off and then beat its competitors when oil prices rise again, then Baytex may be the stock for you. But that is a long time and a pretty chancy bet.

Over the short to medium term at least, IAMGOLD will be the better investment. The price of gold shouldn’t slump anytime soon, and IAMGOLD has major developing projects and better financial numbers. Still, investors should take care to remain cautious as the TSX slumps and the general commodity downturn continues. There is nothing wrong with waiting for economic conditions to improve.

For only the fifth time in over 14 years, Motley Fool co-founder David Gardner just issued a Buy Recommendation on this recent Canadian IPO. Stock Advisor Canada's Chief Investment Adviser, Iain Butler, also recommended this company back in March - and it's already up a whopping 57%! Lucky for you, you can still find out the name of this breakthrough stock before it's too late. Simply click here to learn how you can unlock the full details behind this new recommendation and join Stock Advisor Canada today.

NEW! This Stock Could Be Like Buying Amazon In 1997

For only the 5th time in over 14 years, Motley Fool co-founder David Gardner just issued a Buy Recommendation on this recent Canadian IPO.

Stock Advisor Canada’s Chief Investment Adviser, Iain Butler, also recommended this company back in March – and it’s already up a whopping 57%!

Enter your email address below to claim your copy of this brand new report, “Breakthrough IPO Receives Rare Endorsement.”

Fool contributor Richard Ashton has no position in any stocks mentioned.