Some of the major indexes might be near all-time highs, but many highly valued and high-growth stocks have fallen substantially over the past six months. With the majority of these stocks, nothing is wrong with them, and that leaves an optimal opportunity to buy some beaten-down companies that the market might currently be wrong to discount. 

Confluent (CFLT 4.31%) and The Trade Desk (TTD 4.15%) have both fallen 18% and 12% off their 52-week highs, respectively. Despite these drops, these two stocks are among my favorites to buy and hold for 2022 and beyond.

Excited couple cheering together.

Image source: Getty Images

Confluent: Analyzing real-time data

Confluent's managed service is helping businesses access, analyze, and act on their data in real-time. Apache Kafka -- a free, open-source project -- allows businesses to analyze their data in motion, almost as if they were looking at their data as it flows by. The problem with Kafka is that it is complicated and difficult to manage, which many businesses don't have time for. Kafka is used by 70% of the Fortune 500, and many of them are now using Confluent to manage their Kafka service for them.

Confluent has a best-in-class product. Its solution is cloud native, allowing customers to bring Kafka into the cloud, but it is also available to companies that have on-premise operations. Lastly, the company allows businesses to expand their operations on Confluent with additional abilities that can optimize and scale their businesses even more.

Another important factor is the company's leadership. The three co-founders of Confluent were also the three original developers of Kafka before they made it free and open source. When a customer is deciding between two managed Kafka services, who would choose a different product when you could have the developers of Kafka running your stream?

Because of these two competitive advantages, the company has seen rapid success. Confluent has grown its revenue sequentially every single quarter since Q1 2019, and it has now reached a quarterly revenue of $102 million. The company is also trying to go global. Confluent recently partnered with Alibaba (BABA 2.59%) Cloud to bring its services to mainland China. 

Confluent is losing a lot of money -- it lost over $95 million in Q3 -- but that is because it is spending rapidly to try to capitalize on its fast-growing market. The company has just $338 in trailing-12-month revenue, yet its opportunity currently is worth $50 billion. Additionally, this market is expected to expand to $91 billion by 2024, leaving plenty of room for this company to rapidly expand not only domestically, but around the world. 

With two hard-to-replicate competitive advantages and a massive opportunity ahead of it, I understand why the company is spending money now to try to acquire customers today. As time goes on, those customers will get increasing amounts of data and spend more on this need-to-have service. The company trades at a high valuation of 46 times sales, but this company could skyrocket over the next few years, and I am willing to pay up now to soar with it

The Trade Desk: A leader with major network effects

The Trade Desk is another company I find appealing, especially when this ad-tech leader is well off its all-time high. The company provides a platform where advertisers can automatically bid on advertising space. The Trade Desk uses lots of data and artificial intelligence to suggest and recommend the best places to publish their ads to make the most of their ad budgets. 

The Trade Desk receives a plethora of information that is used to make these accurate suggestions. The company obtains data from every single transaction made on its platform, along with its industry-leading cookieless alternative called UID2, to analyze viewership and ad engagement. The company then applies this data to advertisers and their target audiences to make recommendations on where they should place their ads. 

The company is already the market leader with over $4.2 billion spent on its platform in 2020, making it the primary place that advertisers go. With this system, as the company makes more transactions on its platform and UID2 becomes more commonplace, its AI will get more data and become more accurate, which makes its service more valuable and appealing to prospective customers. This network effect will only make its AI more accurate -- making it harder for a competitor to disrupt this dominance. 

The Trade Desk's competitive leadership has led to major success. Despite being $45 billion in size, it still grew its top line 39% year over year in its most recent quarter, and its bottom line reached $59 million -- increasing 44% year over year. UID2 has the potential to become the industry standard as cookies decline, which would give The Trade Desk an unbelievable amount of data. This data could strengthen its leadership position, resulting in continued success for the next decade. Because of this promising dynamic, I think the company is worth buying at a discount today.