Putting money into the market when it's down so much this year can be a mentally challenging endeavor. It seems like stocks can only go down right now, especially in the tech industry.

However, that isn't the case. While there are always down years, the U.S. stock market has returned an average of 9% annually over the past 150 years.

Fortune favors the optimist, and buying stocks while they are down 40%, 50%, or more can prove to be incredible opportunities. Here's why PubMatic (PUBM 0.84%) and MercadoLibre (MELI 1.22%) look too cheap to pass up right now.

1. PubMatic

Shares of this digital advertising technology (adtech) company are down 58% year to date, bringing the company's valuation down to a bargain price of just 18.3 times earnings. For context, that's lower than most adtech stocks, including The Trade Desk and Magnite, and the broader S&P 500 average too.

So why is PubMatic trading this cheap? The simple answer is it has been hobbled by a looming recession and high inflation. As businesses feel the pressure of these macroeconomic headwinds, they start to cut back their budgets, and one of the most common places to do so is ad spending. PubMatic facilitates ad spending, helping publishers fill open ad inventory, so if ad budgets are shrinking, the company is affected.

This is expected to have a notable impact on the business: While third-quarter revenue continued to grow steadily at 11% year over year, management anticipates revenue for the current period to increase just 1% year over year to $76.5 million.

That said, despite the company's weak guidance, PubMatic is still gaining market share in the adtech industry. At the end of 2021, the company had a roughly 3% to 4% share of the industry, but PubMatic's guidance for full-year revenue growth of about 14% outpaces the industry overall.

If PubMatic can continue to gain share over the long term, this could still be a wildly successful investment because of how enormous the digital advertising space is. By 2024, Pubmatic forecasts global digital ad spending will reach $627 billion -- far higher than the $439 billion spent in 2021.

The market has low expectations for the stock based on its performance this year, but the long-term opportunity still looks immense. Investors can buy shares of PubMatic for the long haul at an attractive valuation right now.

2. MercadoLibre

MercadoLibre's current valuation is head scratching. The Latin American e-commerce and fintech company trades at 4.5 times sales. Since the company went public in 2007, shares have only traded at a lower multiple twice: earlier this year and in 2009. 

Unlike PubMatic, there isn't as clear a reason why shares are this cheap. The company's financial performance has continued to chug along -- even while other e-commerce stocks have seen demand slip. In the third quarter, MercadoLibre reported stable demand for its services, posting 61% year-over-year revenue growth to $2.7 billion.

There are even inklings of incredible performance for the final months of 2022. The company had its best Black Friday ever this year, posting a 19% increase in sales compared to the year-ago period.

What's even more impressive is MercadoLibre's Black Friday success vastly outpaced the broader region. Revenue from Brazilian e-commerce companies slumped 23% on Black Friday, according to NielsenIQ|Ebit. This shows how dominant MercadoLibre is in Latin American e-commerce, and considering how much it outpaces its rivals, it will be challenging for peers to catch up.

MercadoLibre's e-commerce business alone is a reason to buy the stock, but the company has other incredible business lines. Mercado Pago, the company's fintech arm, has continued to thrive, posting 115% year-over-year revenue expansion last quarter to $1.2 billion. Pago was just half the size of the company's e-commerce segment one year ago, but now, they are almost the same size in terms of revenue.

E-commerce stocks might be down, but MercadoLibre is defying this trend, and it doesn't look like the company will be slowing anytime soon. The market might begin to realize how healthy this business is in 2023, so consider buying shares of this leading name in e-commerce while the valuation is still detached from the business's quality.