Connected-TV platform company Roku (ROKU 0.15%) and lending technology company Upstart Holdings (UPST 0.79%) are two top stocks on sale. I don't mean that their stocks are merely down, although it is true: Both of these stocks have fallen more than 70% from their respective all-time highs. But a lot of other stocks have too. However, many of the others aren't "top" stocks, and they're still not cheap by any means.

On the contrary, stocks are generally expensive right now. Take, for example, the valuation of the S&P 500. According to Yardeni Research, the price-to-earnings (P/E) ratio for this index is around 22, compared to its historical average of less than 16. And looking at the forward P/E ratio is even more alarming. The forward P/E is around 19, down from around 21 at the start of year. But keep in mind that when it hit a forward P/E of 21, this was the most expensive valuation it had reached since the dot.com bubble of 2001.

One person shows another person something on a computer.

Image source: Getty Images.

Is the stock market in so-called bubble territory? The data we've seen suggests valuations are rich and typical of those preceding a crash. To boot, inflation is now at 40-year highs, quickly draining away expendable cash from consumers. This means we're also staring down the possibility of an economic recession.

My point with all of this is that even though almost all stocks are off their highs, many still trade at expensive valuations and are, therefore, very likely to fall further if a recession causes the stock market to crash. This underscores why investors need to selectively buy quality companies trading at bargain valuations. And that's why I'm proposing Roku and Upstart here.

Roku could be the top beneficiary of a massive global trend

Roku allows people to stream TV content from the internet with its plug-in devices and with its operating system installed natively on select smart TVs. In recent years, people have switched from traditional TV to connected TV in droves. Because of this migration, the company ended 2021 with 60.1 million active accounts, which it claims is more than all U.S. cable companies combined.

In short, Roku has grabbed a sizable slice of valuable consumer attention -- 73.2 billion hours of video content were streamed on Roku in 2021. However, even though this is where consumers are engaging, just a sliver of advertising budgets is currently dedicated to this medium. 

According to an April report from the Interactive Advertising Bureau, less than $40 billion was spent advertising on digital video in 2021. And according to Nielsen estimates in Roku's letter to shareholders, just 18% of U.S. TV ad budgets was dedicated to streaming in 2021. However, because 60 million consumers have already made the switch to Roku, it's inevitable that significantly more ad dollars will follow. Investors just need to be patient.

Roku's installed and engaged user base is extremely important. But let's not overlook the company's improving technological capabilities. Recently, Roku began testing dynamic linear ad insertion. This technology allows for targeted advertising on live TV streaming -- different viewers of the same live content will be shown different and more relevant ads. These ever-improving capabilities make Roku a great place to dedicate advertising budgets and partly explains why, in 2021, Roku retained 95% of advertisers who spent at least $1 million in 2020. They're getting bang for their buck.

Here's the best part for investors: Even though the opportunity is still strong for Roku, it's trading at its lowest price-to-sales (P/S) valuation since the end of 2018, as the chart shows.

Chart showing drop in Roku's PS ratio since 2021.

ROKU PS Ratio data by YCharts

In my opinion, a P/S of six is a more than fair price to pay for a company with prospects like Roku.

Upstart has barely scratched the surface of its opportunity

Upstart hasn't been a public company as long as Roku. It had its initial public offering (IPO) in December 2020, so take commentary on its historical valuation with a grain of salt. But as of this writing, the P/S valuation for Upstart stock is under 10, which is the cheapest it's ever been.

Chart showing drop in Upstart's PS ratio since 2021.

UPST PS Ratio data by YCharts

Whatever the reason for Upstart's cheaper valuation, it has nothing to do with its business. So far, Upstart's financial results as a public company have been quite promising.

Upstart offers software to banks looking to vet potential borrowers beyond the traditional credit score. As Upstart's software evaluates loan repayments over time, it improves the lending algorithm it's using. Banks could do this alone, in theory. In practice, Upstart partners with multiple financial institutions (42 at the end of 2021) and, therefore, its dataset is broader and better than what any single bank could produce on its own -- a competitive advantage.

Upstart has been signing new partners left and right, and this has led to rapid revenue growth. In 2021, the company generated $849 million in revenue, up 264% year over year. And it did so profitably, earning $135 million in net income. This earning power wasn't a flash in the pan, either -- Upstart has been profitable or close to it from the beginning. In fact, according to CEO Dave Girouard, it generated more cash in 2021 than it burned in all of its previous years combined.

Most of Upstart's loan volume comes from personal loans. But its auto loan business is quickly scaling and management has its sights set on the mortgage industry -- two categories far larger than personal loans. It's true that the company is "only" guiding for 65% year-over-year revenue growth in 2022. However, auto lending and mortgages mean Upstart is barely scratching the surface of its long-term opportunity right now.

With stocks generally at high valuations, you want to avoid buying something that's still overpriced. But don't stay on the sidelines entirely -- as a long-term investor, you want your money in the market as much as possible. Therefore, look for companies that are executing and where shares offer investors good value. Having read this far, I hope you'll agree that Roku and Upstart fit this description.