It's no secret that the stock market is in a slump. The Nasdaq Composite index has fallen nearly 30% since the start of 2022. This drop is the steepest that this index has seen in more than a decade, so it's safe to say that the pain investors are feeling right now is uncommon.

However, investing right now can be a great decision because there are so many stocks trading at appealing prices. While not all companies will reach their all-time highs again, The Trade Desk (TTD 4.15%) and Confluent (CFLT 4.31%) could recover and potentially surpass their previous highs over the coming years. 

1. The Trade Desk

Shares of The Trade Desk -- one of the leading buy-side advertising technology (adtech) platforms -- are down about 58% from their all-time highs. This downward lurch can largely be attributed to fears about a coming recession. When businesses cut spending, advertising can be one of the first things to go. Considering The Trade Desk helps advertisers find open ad inventory, the company would be impacted directly by a decline in advertising. 

However, The Trade Desk is nicely positioned to fare well compared to rivals. Yes, the company would get impacted, but its balance sheet and profitability are strong enough to withstand a short-term hit to demand. It has $1.1 billion in cash and investments on the balance sheet, with no long-term debt. The Trade Desk has also generated over $100 million in net income and $394 million in free cash flow over the trailing 12 months. 

Shares are trading at their lowest valuation since early 2020 at around 18 times sales. In other words, you're getting shares at the same valuation as when the company had only $161 million in revenue, whereas it now has $315 million. 

Some projections put the amount spent on global digital advertising in 2024 at $627 billion, and if you want to benefit from this massive space, you might want to buy the best of the best. This is not the first time the U.S. has had recession fears, nor will it be the last. The best companies will likely survive these short-term headwinds while the low-quality ones might not, allowing the best in breed to recover stronger than before. As one of the top dogs, The Trade Desk is likely to survive.

That is why I am optimistic about the Trade Desk for the long haul -- and why you should be too.

2. Confluent

Shares of Confluent have fallen more than 77% from their all-time highs, but this has less to do with macroeconomic concerns and more to do with its highly valued IPO in 2021. Now that tech stocks have fallen out of favor, Confluent has dropped low enough to where shares look appealing. Shares trade at 12 times sales, 70% below the valuation it came public at, yet the company continues to execute fundamentally. 

Confluent helps businesses analyze data in real time, which has previously been hard to do at scale and in the cloud. Confluent is built on a popular open-source project called Apache Kafka, which is used by 80% of the Fortune 100. This open-source project allows businesses to analyze data as soon as they receive it instead of days after.

But Kafka has two main problems. One, it is difficult to scale across an entire enterprise, and two, it is primarily based on-premises rather than in the cloud. Confluent addresses both of these issues: it's a managed service that helps to scale Kafka more easily, unlocking the value of real-time data analysis across organizations. And, it's cloud-based.

The founders of Confluent were the original developers of Kafka, meaning that nobody knows the open-source project better than them. One of the risks of running a business relying on open-source projects is that a competitor could make a similar product, but Confluent's management team gives it a tough-to-replicate edge and undisputed leadership in the space.

As a result, the company has seen rapid adoption. Q1 revenue jumped 64% year over year to $126 million, and customers are planning on using its services more heavily in the future: Remaining performance obligations skyrocketed 96% year over year to $551 million in Q1.

Confluent's primary concern is its cash flow. The company's free cash flow burn surpassed $58 million in Q1 2022. This is especially concerning given the interest rate hikes, which make it more expensive for businesses to borrow money. With a cash burn like this, most companies would likely be forced to borrow cash, but Confluent has an airtight balance sheet with almost $2 billion in cash and securities.

While it will be critical to see this cash flow eventually swing toward positive territory over the coming years, Confluent's balance sheet can sustain its cash burn for a long time. Considering the adoption it is seeing in a market expected to be worth $91 billion by 2024, Confluent looks attractive right now.