When you buy an ear of corn or a bag of wheat flour at a supermarket, you probably don't pay much attention to where they were grown or milled. That's because both corn and flour are commodities.

Commodity goods are raw materials. They're interchangeable and can be bought and sold in bulk. Often these raw materials are the building blocks of manufactured products.

Types of commodities

Investors break down commodities into two categories: hard and soft. Hard commodities require mining or drilling to find. Soft commodities are grown or ranched. There are four main types of commodities.

1. Agricultural products: Soft commodities. They include crops like coffee, corn, wheat, soybeans, cotton, and lumber.

2. Livestock and meat: Soft commodities. They include live cattle, beef, pork bellies, and milk.

3. Energy products: Hard commodities. They include crude oil, natural gas unleaded gasoline, propane, ethanol, and coal.

4. Metals: Hard commodities. They include precious metals, like gold and silver, and industrial metals, like copper, aluminum, and palladium.

Pile of grain next to several bags of grain.

Image source: Getty Images.

What is commodities trading?

Commodities trading is the buying and selling of these raw materials. Sometimes it involves the physical trading of goods. But more often it happens through futures contracts, where you agree to buy or sell a commodity for a certain price at a specified date.

With futures contracts, commodities traders bet on how the commodity's price will move. When you think the price will go up, you'd buy futures, or go long. When you think the price will drop, you'd sell futures, or go short. While futures contracts can be used to speculate about price changes, often they're used by producers or major industrial consumers as a hedge against price increases or decreases, as we'll discuss shortly.

Futures contracts are typically traded on commodity exchanges. The two largest exchanges in the U.S. are the Chicago Mercantile Exchange and the New York Mercantile Exchange.

Commodities vs. the stock market

Commodity prices often fluctuate wildly because of changes in supply and demand. For example, when there's a big harvest of a certain crop, the price usually goes down. When there's a drought, prices often rise because of fears that the supply will drop. Similarly, during cold weather, demand for natural gas for heating purposes rises, causing prices to spike, too. But a warm spell during winter can depress prices.

Still, some commodities are relatively stable, such as gold, which also serves as a reserve asset for central banks. But in general, commodities are significantly more volatile than stocks or bonds. 

Some investors seek out commodities for diversification. Commodities usually have a negative correlation (their prices move in different directions) or a low correlation (their prices don't move in tandem with each other) with equities. For example, oil and stocks tend to have a negative correlation. That means rising oil prices have traditionally been linked to a weaker stock market, and the stock market is often stronger when oil prices are low.

For that reason, commodities are a popular stock market hedge. Many investors flock to gold during a bear market, for example. Commodities are also a common inflation hedge. High inflation often causes commodity prices to soar, whereas stocks and bonds perform better when inflation is lower.

Gold ingots stacked on top of one another.

Image source: Getty Images.

How to invest in commodities

Commodity trading isn't the only means of investing in commodities. You can also invest in stocks of companies that produce commodities. Or you could invest in exchange-traded funds (ETFs) or mutual funds that track the commodity. Here are four basic ways to invest in commodities.

1. Invest directly in the commodity

If you want to invest by physically buying a commodity, one advantage is that you don't have to go through a third party. Typically you can do a simple internet search to find a dealer to sell you a particular good, and when you no longer want it, that dealer will often buy it back. But you have to figure out delivery and storage logistics.

If you're buying gold, this may be relatively simple. You can easily find a coin dealer online who can sell you a bar or coin. You can safely store it and later sell it as you wish. 

But it gets a lot harder when you're trying to figure out delivery and storage of cattle, crude oil, or bushels of corn. For that reason, investing in most physical commodities typically takes too much effort for individual investors.

2. Invest in futures contracts

You can trade futures contracts as long as you have a brokerage account that allows for it. But futures contracts are largely designed for major companies involved in commodities, rather than individuals.

For instance, say you're a corn farmer. You want to be sure that you'll be able to get at least the prevailing market price for your crop. So you sell a futures contract, agreeing to sell 5,000 bushels of corn at $4 each in 90 days. You win if prices drop because you've locked in $4 a bushel, but you miss out on profits if prices rise to $5.

On the other side, say you're a food processing company that needs corn to produce cornmeal for food retailers. You don't want to risk higher prices if there's a smaller crop. So you buy that futures contract for 5,000 bushels of corn at $4 each. If prices fall, you lose because you pay more than the prevailing market price. But if they skyrocket, you're still paying only $4 a bushel.

As an investor, you can also speculate on corn prices. For example, let's say you buy that same futures contract. You have no intention of actually buying 5,000 bushels of corn in 90 days, but you're betting that corn prices will rise and you'll be able to sell it for more money. Or you can take a short position if you believe prices will fall.

One big risk of trading commodities is that the margin requirements are significantly lower than for stocks. When you trade on margin, you're trading borrowed money, which can amplify your losses. Given how volatile commodity prices can be, it's essential to have enough resources on hand to cover any margin call, which is when your broker requires you to deposit more money.

3. Invest in commodity stocks

Another way to invest in commodities is to buy shares of the companies that produce them. For example, you could buy mining stocks, oil stocks, or agriculture stocks

A commodity-producing company won't necessarily rise or fall in line with the commodity it produces. Sure, an oil production company will benefit when crude oil prices rise and suffer when they fall. But far more important is how much oil it has in its reserves and whether it has lucrative supply contracts with high-demand purchasers. 

4. Invest in commodity ETFs and mutual funds

Commodity ETFs and mutual funds offer commodity exposure for those who don't want to buy the commodity directly. Commodity funds may invest in physical materials, commodity stocks, futures contracts, or a combination. However, commodity funds may not move in sync with the price of the underlying good, which can come as a surprise to new investors.

Should you trade commodities?

Commodity trading is a high-risk, high-reward endeavor. It can be an effective way to hedge your portfolio against a bear market or inflation. But you should consider it only if you have a strong understanding of the supply-and-demand dynamics of the commodity market. That includes knowledge of historical price trends and what's happening in real time. If you're getting started, you can reduce your risk by limiting your use of margin.

Much of commodity trading amounts to speculation, not investing. Unpredictable factors like the weather, disease, and natural disasters can have huge impacts on commodity prices in the short term. If you're looking to invest in a commodity for the long term, commodity stocks, mutual funds, and ETFs are a better option for most individuals.