Panic has seemingly engulfed the entire globe over the past few weeks due to the fast-spreading COVID-19 outbreak. The pandemic is causing the world's economy to grind to a halt, which has hammered demand for energy. It's not yet clear how deeply the economy will slump nor how long it will last.

It's truly a challenging time for anyone with money invested in the stock market. However, this isn't the first unexpected shock to upend the market. We've recovered from previous crashes and will eventually pull out of this one. That's why I've been putting some of my portfolio's cash position to work buying stocks.

I've purchased shares of more than a dozen companies that I either already owned or were on my watch list. This list includes some energy stocks, which have been hammered by the market sell-off. Three of those energy buys were Brookfield Infrastructure Partners (BIP -1.62%)Enbridge (ENB -0.32%), and NextEra Energy (NEE -0.94%). Here's why.

Oil pumps, a natural gas well, and solar panels with the sun setting in the background.

Image source: Getty Images.

A recession-resistant business that turns challenges into opportunities

Brookfield Infrastructure has lost about 40% of its value from its peak earlier this year due to the COVID-19 market meltdown. While the economic fallout will have some impact on its business, mainly at its ports and toll roads, it's relatively recession-resistant. Its utilities and natural gas pipelines, for example, tend to generate stable cash flow in good times and bad due to regulated rate structures and long-term contracts. In Brookfield's view, only about 5% of its cash flow has any sensitivity to a recession.

Meanwhile, Brookfield has the balance-sheet strength to not only survive a downturn, but also take advantage of opportunities that arise when market conditions deteriorate. It ended last year with a strong investment-grade credit rating and $1.9 billion of liquidity -- cash and borrowing capacity -- giving it the flexibility to make acquisitions if the right ones come along.

Brookfield has a history of making deals during tough market conditions, including buying a gas pipeline in Brazil during its economic and political crisis of 2016. That combination of strength during a downturn and additional upside potential from its deal-making prowess is why I pounced on the opportunity to bulk up on my Brookfield Infrastructure position.

A low-risk oil company

Crude oil prices have cratered due to the dual shocks to supply and demand from the COVID-19 outbreak and the breakup of OPEC's market-support deal with Russia. That's causing most oil companies in North America to slash their spending, which will have some impact on pipeline volumes.

However, the oil market meltdown shouldn't have too much effect on the earnings of Canadian pipeline giant Enbridge. That's because 98% of its cash flow comes from stable sources like fee-based contracts and other agreements where it gets paid even if customers don't use their contracted capacity. Meanwhile, about 95% of its shippers have investment-grade credit ratings, which is a sign of financial strength.

Enbridge, likewise, has investment-grade credit, which it backs with a leverage ratio at the low-end of its target range. On top of that, the company has a conservative dividend payout ratio for the pipeline sector. Because of all that, Enbridge has the financial strength to weather this storm, which is why I took advantage of the roughly 35% slide in its stock price to scoop up more shares.

A renewable-powered future

NextEra Energy, meanwhile, is one of the largest electric utilities in the country. It's also the world leader in producing power from the wind and sun. Those operations generate stable cash flow in good times and bad, thanks to regulated rates and fee-based contracts.

NextEra further complements its steady utility and renewable energy businesses with a top-tier financial profile. Not only does it have one of the highest credit ratings among large electric utilities, but also one of the most conservative dividend payout ratios in the sector. That strong financial profile gives NextEra the flexibility to continue expanding its operations and dividend.

In the company's view, it can grow its earnings by 6%-8% per year through 2022 while increasing its payout by at least 10% annually during that time frame. That's why I couldn't resist buying more shares of this renewable energy giant following the roughly 30% slide in its stock price.

Rock-solid energy stocks

Brookfield Infrastructure, Enbridge, and NextEra Energy all operate businesses that generate stable cash flow in good times and bad. Each company also has a conservative financial profile, which provides each one with lots of cushion during tough times.

Because of that, these companies entered this downturn from positions of strength, which suggests they can survive through the turmoil and continue prospering when conditions improve. That's why I happily added to each one during the recent market meltdown.