For much of the past two years, the bulls have been firmly in control on Wall Street. The mature stock-powered Dow Jones Industrial Average, benchmark S&P 500 (^GSPC -1.11%), and innovation-driven Nasdaq Composite (^IXIC -1.49%) have all rallied to multiple record-closing highs this summer.

But as the first three trading sessions of August reminded us, stocks rarely, if ever, move up in a straight line.

Although growth stocks have undeniably led this rally, it was the Nasdaq Composite that really took it on the chin to begin this month. Over a three-session stretch, the index shed just shy of 1,400 points, or about 8% of its value. As of the closing bell on Aug. 5, the Nasdaq sat 13% below its all-time high.

A stopwatch whose second hand has stopped above the phrase, Time to Buy.

Image source: Getty Images.

Typically, stock market corrections provide an opportunity for long-term investors to open positions or increase their stakes in amazing businesses at a discounted price. But with stocks being historically pricey, investors (myself included) have been more selective with their purchases.

With history not on Wall Street's side, from a valuation standpoint, there's only one stock I took to the opportunity to add to during the recent Nasdaq sell-off.

Caveat emptor, investors

Before digging into the juicy details that made me add to one of my core holdings during the Nasdaq sell-off, I believe it's important to address the reasons for being so selective about stock purchases at the moment.

During bull markets, it's not uncommon for investors to pay a premium for growth stocks. In fact, the democratization of information over the last three decades (thanks, internet!), coupled with historically low interest rates for much of the last 15 years, has increased the willingness of retail investors to take risks. This includes purchasing stocks with outsize price-to-earnings (P/E) ratios.

Sometimes, well-above-average P/E ratios can be justified. For instance, companies with well-defined competitive advantages and/or sustainable moats typically command valuation premiums to the peers in their industry.

But when examining the broader market as a whole, extended valuations are rarely, if ever, a good thing.

S&P 500 Shiller CAPE Ratio Chart

S&P 500 Shiller CAPE Ratio data by YCharts.

The S&P 500's Shiller price-to-earnings ratio offers the best example of what happens when stock market valuations deviate too far from historic norms. The Shiller P/E is also commonly known as the cyclically adjusted price-to-earnings ratio (CAPE ratio).

Unlike the traditional P/E ratio, which accounts for trailing-12-month earnings and can be disrupted by one-off events (e.g., COVID-19 lockdowns), the Shiller P/E is based on inflation-adjusted earnings over the prior 10 years, which helps to smooth out corporate profit "hiccups."

When back-tested to January 1871, the average P/E multiple for the S&P 500's Shiller P/E is 17.14. On Aug. 19, the Shiller P/E closed above 36, and didn't dip much below 33 during even the worst of the sell-off to begin this month.

Including the present, there have only been six occasions over the last 153 years where the Shiller P/E surpassed 30 during a bull market rally. Following the previous five instances, the Dow, S&P 500, and/or Nasdaq Composite eventually shed anywhere from 20% to 89% of their value.

In other words, the Shiller P/E is warning investors that stocks are historically pricey -- and I tend to be a student of history rhyming on Wall Street.

Businesspeople using tablets and a whiteboard in a conference room.

Image source: Getty Images.

This high-growth, cash-rich, small-cap stock has been my only buy during the Nasdaq sell-off

Even with the Nasdaq pulling back by a double-digit percentage in less than a month, I haven't been champing at the bit to put my cash to work -- with one exception.

Rather than add to any of my "Magnificent Seven" holdings, the only stock that caught my eye during the Nasdaq sell-off is under-the-radar small-cap adtech company PubMatic (PUBM -2.14%).

Although negative market sentiment weighed on PubMatic's shares during the first few trading sessions of August, it was the company's second-quarter operating results -- and more specifically its full-year guidance -- that sent shares careening lower.

PubMatic CFO Steve Pantelick highlighted that one of his company's largest demand-side providers (DSPs) in the programmatic ad space changed its bidding process during the second quarter. This change will result in slightly less revenue recognition throughout the remainder of the year. As a result, PubMatic's full-year sales outlook now calls for $288 million to $292 million in revenue, down from a prior median forecast of $300 million ($296 million to $304 million).

This roughly 3% reduction in sales at the midpoint erased more than 30% of PubMatic's market value. More importantly, it provided a price dislocation that was too tempting for me to ignore.

The most important thing to note about PubMatic's revenue "miss" is that this won't be an ongoing issue, nor was it unexpected. In an interview with Schwab Network following the company's second-quarter results, PubMatic CEO Rajeev Goel pointed out that this large DSP was the last major DSP to make this bidding conversion. Beyond this one customer, the vast majority of PubMatic's sales channels enjoyed double-digit growth.

With this headwind that dragged the company's shares down 30%-plus addressed, let's dig into the many reasons sell-side provider (SSP) PubMatic makes for a genius buy.

Let's count the many ways PubMatic makes for a no-brainer buy

For starters, it finds itself at the center of the fastest-growing niche within the ad industry: digital advertising. Businesses are steadily shifting their ad dollars away from traditional print and billboards and toward digital channels, which include mobile, video, and connected TV. PubMatic is ideally positioned to help publishers sell and optimize their digital display space.

PubMatic also has macro headwinds in its sails. Although recessions are a normal and inevitable aspect of the economic cycle, history shows us that this cycle isn't linear. Whereas three-quarters of all U.S. recessions since the end of World War II were resolved in less than a year, the overwhelming majority of economic expansions have stuck around for multiple years. Being patient tends to be a recipe for success with ad-driven businesses.

On a more company-specific basis, PubMatic's biggest advantage just might be the fact that its management team didn't take the easy road and chose to build out its cloud-based programmatic ad platform. Not having to rely on a third party for this platform will allow the company's operating margin to scale at a superior rate, compared to other SSPs.

PUBM Cash from Operations (Annual) Chart

PUBM Cash from Operations (Annual) data by YCharts.

Furthermore, PubMatic is working on its 10th consecutive year of generating positive operating cash flow and is sitting on a mountain of capital. It ended June with $165.6 million in cash, cash equivalents, and marketable securities, with no debt. Not only does this cash provide plenty of financial flexibility regardless of what's happening with the U.S. economy and on Wall Street, but it's also allowed the company to repurchase $100 million worth of its common stock, through July 31. Buying back stock tends to have a positive impact on earnings per share, which can make a company more attractive to fundamentally focused investors.

The final piece of the puzzle with PubMatic is its valuation. While the P/E ratio works great for mature businesses, cash flow is the better valuation metric when analyzing fast-growing companies that are aggressively reinvesting in their platforms.

As of the closing bell on Aug. 19, shares of PubMatic were valued at 8.3 times Wall Street's consensus cash flow estimate for 2025. This represents a 38% discount from the forward cash-flow multiple investors were paying at the end of 2023.

What's more, PubMatic's cash, cash equivalents, and marketable securities account for 24.3% of its market cap. If we back this capital out of the equation, PubMatic's operations are valued at closer to 6.3 times forward-year cash flow with a sustained double-digit sales and earnings growth rate. It's a jaw-droppingly cheap stock that I gladly added to during the Nasdaq sell-off.