Recessions create a tough environment to trade stocks in. Very few stocks do well when the economy is spluttering, so the best option for an investor generally is to find someplace to hide their investment funds while waiting for things to get better.

This often means finding the least lousy stock. The consumer staples sector is a popular place to find stock investment shelter, as people will always buy things like food, toiletries, or laundry detergent regardless of the state of the economy. That said, when the economy slows, stock market multiples can contract, so even defensive stocks can be somewhat vulnerable.

But if you are worried about a recession hitting your stock portfolio, there are options to consider. While many stocks in the broader market are still down for the year, two of these stocks have risen in value year-to-date, and one is down only marginally. All three are worth consideration.

picture of a grocery aisle

Image source: Getty Images.

1. Procter & Gamble: Venerable brands hold up over time

Procter & Gamble (PG 0.08%) is the classic defensive stock. P&G is one of the largest consumer products companies in the world with some enviable brands including Crest, Head and Shoulders, Tide, and Gillette. Consumers tend to be loyal to their brands, even in tough times. The company has a market cap of $288 billion and a dividend yield of 2.8%.

P&G has been a bit of a turnaround story over the past couple of years as it sheds non-core brands. The stock isn't necessarily cheap, trading at 23 times estimated 2020 earnings, but that isn't what a recession-focused investor is buying it for. Year-to-date, the stock is trading down about 6.6% versus 9.3% on the S&P 500.

2. Digital Realty Trust: Data consumption grows, even in a recession

Digital Realty Trust (DLR -2.76%) is a data real estate investment trust (REIT), which is benefiting from the increased move toward remote working. The company provides co-location and interconnection services and owns 225 data centers.

While data REITs aren't associated with the traditional consumer defensive stocks, data REITs fit the profile. Regardless of the state of the economy, streaming video, cloud storage, and e-commerce will increasingly require the services of data REITs. Unlike the typical mature defensive company which grows at roughly the same rate as the GDP, these companies operate in a space more akin to a growth stock. Digital Realty trades at 19.7 times 2019 funds from operations and has a 3.4% dividend yield. Year-to-date, the stock is trading up about 11%.

3. J.M. Smucker: Comfort food for the portfolio

J.M. Smucker (SJM 0.54%) is another consumer company with a stable of well-known brands, including the company's namesake jams and jellies, Folgers coffee, and Meow Mix cat food.

Even in a recession, buy coffee and pet food, but the COVID-19 crisis is also pushing more people to eat at home rather than going out. The increased stress also leads to more interest in eating comfort foods. This means more PB&J sandwiches for lunch, Magic Shell ice cream toppings for dessert, and more Dunkin Donuts coffee and Hungry Jack biscuits for breakfast. J.M. Smucker stock trades at 13.5 times the fiscal year 2020 earnings estimate and has a 3% dividend yield. Year-to-date, the stock is trading up about 9.5%.

This recession might end sooner than people think

If you are worried that the recession is going to be worse than advertised, then these stocks are good bets. That said, while the current recession is one of the worst ever in terms of a drop in GDP or spike in jobless claims, keep one important consideration in mind: most recessions begin because economies build up imbalances that weaken the economic base. These can be speculative bubbles, inventory buildup, bad investments, or even just inflation that the Fed has to combat.

During recessions, these underlying economic problems get addressed. This time around, there was no economic rot that caused a downturn. It was engineered by the government. Keep in mind most economic models rely at least partially on historical observation. The recession and recovery could be shorter than the models are predicting. The time to rotate out of defensive stocks and into early-stage cyclicals (like homebuilders) could be sooner than people are thinking. Defensives might be good at the moment, but you should be building your recovery stock shopping list now.