Historically speaking, the six-month period between May and October each year tends to deliver weaker stock market returns than the period from November to April. That's where the adage "sell in May and go away" comes from.

According to the Corporate Finance Institute, the benchmark S&P 500 index has gained an average of just 2% each year in the May-to-October period dating back to 1945. By comparison, the index has jumped an average of 6.7% between November and April.

But not all years are created equal. The S&P 500 has already gained 2.7% since May 1 this year, and the Nasdaq-100 technology index soared a whopping 9.8%. The economic challenges that plagued the stock market in 2022 seem to be resolving, with inflation continuing to return to normal levels and interest rates expected to level off later this summer and maybe even fall a bit before the end of the year. 

As a result, there's a good chance the May-to-October period in 2023 could be far better than average. For investors still sitting on the sidelines, here are two stocks to buy in June to take advantage of the current situation. 

A person looking at server hardware while holding a laptop computer.

Image source: Getty Images.

1. Lemonade: Artificial intelligence is nothing new to this company

Artificial intelligence (AI) might have caught the attention of the corporate world in 2023, but insurance company Lemonade (LMND -0.46%) has been developing AI technology for years. In fact, it's embedded in almost every part of its business. Its online chatbots interact with customers to write quotes and pay claims, and it even spots risks and opportunities across the company's renters, homeowners, life, pet, and car insurance product portfolio. 

With a market valuation of just $1.2 billion, Lemonade is very much a start-up in the insurance space, but its recent financial results for the first quarter of 2023 highlight its rapid progress in the industry dominated by traditional, entrenched operators. The company had 1.85 million customers at the end of the quarter, and it was earning an average of $352 in annual premiums from each of them, bringing its total in-force premium to $653 million. All three of those figures were all-time highs.

As a result, the company's revenue soared 115% year over year to $95 million in the quarter. But it could get even better because its AI models continue to improve: Lemonade's Lifetime Value 6 (LTV6) model is capable of predicting which customers are likely to switch insurers or buy multiple products, and it also identifies underperforming and overperforming geographic markets, which allows Lemonade to quickly pivot its marketing strategies to maximize revenue.

LTV6 was released in 2022, and the company has already moved onto a more advanced LTV7 AI model, which will be superseded by LTV8 this quarter. 

Lemonade's stock price is up 32% so far this year, but it's still down 88% from its all-time high after a brutal 2021 and 2022 where the company lost money hand over fist and generated lumpy growth. Lemonade's business has incredible momentum now and it's one of just a few AI plays actually monetizing the technology successfully. As a result, this start-up presents a very attractive risk-reward opportunity at the current price.

2. Datadog: Cloud adoption is growing, and monitoring tools are in high demand

Datadog (DDOG 0.50%) had a stellar 2022. Despite broad economic weakness and a plunging stock market, the company continued to crush its revenue guidance in each quarter and raised its forecasts multiple times. It carried that momentum into the first quarter of 2023, and given the nature of its industry, it's probable that will continue.

Datadog has developed a cloud monitoring platform designed for modern, complex organizations that rely heavily on their online operations. It serves retailers, game developers, entertainment providers, and even financial institutions, helping them stay on top of their cloud infrastructure to identify important issues that sometimes get overlooked.

A retailer, for example, might struggle to measure customer satisfaction in its online store. What if there's a website glitch that only impacts a handful of customers in one location? It could take forever to recognize these issues manually, meanwhile, those sales are going to a competitor instead. Datadog constantly scans the cloud network to identify those issues, alerting the business before they impact the customer experience. 

As of Q1, Datadog served 25,500 businesses, including 2,910 that are spending at least $100,000 per year on its platform. The company generated $481.7 million in revenue for the period, up 33% year over year and also above its guidance. The strong result prompted management to increase its full-year revenue forecast to $2.1 billion (from $2.09 billion previously). 

According to Grand View Research, the value of the cloud industry will more than double between now and 2030 to $1.5 trillion. As more businesses adopt the technology, the demand for Datadog's platform is likely to grow in lockstep. Datadog stock jumped 37% in 2023, but it's still down 48% from its all-time high, and that suggests an opportunity for investors.