The S&P 500 index ended 2023 with a monster rally. It soared 16% between late October and the end of December, coming within inches of a new all-time high. But the index opened 2024 with a little volatility and has given back a fraction of those gains.

One Wall Street analyst, Fundstrat's Tom Lee, thinks the broader market could see a 7% drop in the short term before heading higher later this year. That might be an opportunity for investors to buy stocks at a discount, but it's also a good idea to trim any holdings that may not perform during a future rally.

With that in mind, here's why Oracle (ORCL 2.02%) stock is a buy, whereas Peloton Interactive (PTON 4.29%) may be worth avoiding.

A computer programmer working at a desk in an apartment.

Image source: Getty Images.

The stock to buy: Oracle

Artificial intelligence (AI) was the dominant stock market theme in 2023. Oracle isn't typically considered a top AI company like Nvidia or Microsoft, but investors might be overlooking an incredible opportunity. Oracle was founded in 1977 and has developed everything from database management software to a comprehensive portfolio of cloud computing services. Now, the company is focused squarely on AI.

Oracle operates 66 data centers worldwide, which it's currently upgrading to deliver the necessary computing power to handle AI workloads for its business customers. On top of that, it's building 100 more AI-focused data centers right now because it simply can't keep up with demand. Most of that infrastructure will be fitted with the latest semiconductors from Nvidia, which are designed specifically to train, develop, and deploy AI applications.

The average business simply can't afford to build its own AI infrastructure, given a single Nvidia H100 GPU chip costs $40,000 -- and some workloads require thousands of them. Companies like Oracle build data centers at scale and generate revenue by renting computing power to developers all over the world. Oracle Chairman Larry Ellison says his company has developed the most advanced Nvidia graphics processing unit (GPU) clusters in the industry, which can train AI models at twice the speed and for half the cost of other cloud providers.

That's why Oracle Cloud Infrastructure (OCI) is attracting some of the brightest AI start-ups, including Mosaic ML, Adept AI, and even Elon Musk's xAI. In the recent fiscal 2024 second quarter (ended Nov. 30), Ellison said Oracle simply couldn't provide Musk with as many GPU clusters as he wanted, a consequence of such enormous demand and short supply. Oracle could experience substantial revenue growth as its new data centers gradually come online.

During Q3, OCI accounted for just 12% of Oracle's $12.9 billion in total revenue. However, the segment grew by a whopping 52% year over year, and Ellison said growth will likely remain at that level for years to come. At that pace, it won't take long for OCI to become a dominant part of Oracle's revenue base and drive the entire company forward.

Oracle stock is trading at 14% below its all-time high, and based on the company's $3.62 in trailing-12-month earnings per share, its current price-to-earnings (P/E) ratio is 29.9. That's a slight discount to the 30.1 P/E of the Nasdaq-100 technology index, but it's a sizable 21% discount to the 37.7 P/E of fellow AI cloud giant Microsoft.

By all accounts, Oracle stock looks like a great buy right now. But any weakness from here will only make the opportunity even more attractive.

The stock to sell: Peloton Interactive

Peloton stock was a pandemic darling, but it has collapsed by 96% from the all-time high it set in 2020. The company produces at-home exercise equipment featuring a digital screen that allows users to stream music, entertainment, and even virtual fitness classes. Naturally, Peloton's exercise bike and treadmill were a hit during COVID-19 lockdowns because gyms were closed, but demand has sharply reversed ever since.

Peloton's annual revenue peaked at $4 billion in fiscal 2021 (ended June 30, 2021). It fell to $3.5 billion in fiscal 2022 (ended June 30, 2022) and again to $2.8 billion in fiscal 2023 (ended June 30, 2023). When a company's revenue falls so quickly -- and unexpectedly -- it's hard to adjust its cost structure to a suitable level. It's a slow process that involves laying off employees, producing fewer products, investing less in research and development, optimizing marketing spending, and more.

Peloton hired a new CEO, Barry McCarthy, at the beginning of 2022 for that purpose. He quickly slashed the company's workforce by more than half, offshored manufacturing to save money, and introduced new sales strategies. Unfortunately, Peloton continues to lose substantial amounts of money, including $1.2 billion in fiscal 2023. The fiscal 2024 first quarter (ended Sept. 30, 2023) showed that losses are slowing, but the company was still in the red to the tune of $159 million.

After stripping out one-off and non-cash expenses, like restructuring charges and stock-based compensation, Peloton's adjusted earnings before interest, taxes, depreciation, and amortization (EBITDA) was positive by $9.1 million during Q1. Still, money is flowing out the door, and the company has only $748 million in cash on hand, with an outstanding debt of $691 million.

Peloton will likely need a cash infusion in the future, which could lead to heavy dilution for investors, given its stock price is so beaten down.

The company is working hard to turn things around. It recently announced a slew of brand partnerships with leading sports franchises, universities, and even activewear giant Lululemon to help drive more sales. Plus, Peloton now offers its equipment on a subscription basis, meaning customers don't have to fork out thousands of dollars up front. That's a smart move, especially in this tough economic climate.

Despite those positive developments, Wall Street analysts predict Peloton's revenue will shrink yet again in fiscal 2024, albeit by a modest 2%. Without revenue growth, the company will have to slash costs even further to avoid losing significant amounts of money at the bottom line. That means it will be investing less in growth initiatives like marketing and product development, which could drive a further reduction in revenue going forward.

Simply put, Peloton is stuck in a very difficult downward spiral, and it's difficult to predict whether the company can survive without a fresh cash injection. Given the uncertainty, I think investors are better off steering clear of the stock completely.