Forever is a long time, so before committing to buy stock in a company that you plan to hold onto for that long, you should have a lot of confidence in the company's long-term revenue prospects. I'm going to talk about two of my favorite stocks here, companies that are so strong they've managed to post share price gains in 2020 even as the overall market tumbled.

1. Amazon

Consumers have been flocking to online retailers for food and other essentials since the coronavirus outbreak deepened and state and local officials ordered people to stay home as much as possible. E-commerce giant Amazon (AMZN -0.36%) saw such a surge in demand that last month it announced it intended to hire 100,000 new full-time and part-time employees to work in its U.S. fulfillment centers and delivery operations. This week, Amazon said those roles have been filled, and now the company plans on creating an additional 75,000 jobs as demand remains high. Amazon also said it would invest more than $500 million in pay increases rather than the $350 million announced earlier. Of course, this tells us Amazon is probably making it through the current crisis just fine. But why am I optimistic about its future? Because I like Amazon's position in the online grocery market, and I feel good about the growth prospects for Amazon Web Services (AWS) -- two very different businesses that should keep its revenue climbing.

A hand holds a cell phone with "grocery online" written on the screen. Shelves of apples are seen in the background.

Image source: Getty Images.

For clues about the future, we can look at the company's last earnings report. In the fourth quarter, grocery delivery orders through Amazon Fresh and Whole Foods Market more than doubled compared to the same period a year ago. According to eMarketer, grocery is the fastest-growing e-commerce product category in the U.S., and its analysts forecast that it will reach $38 billion in annual sales by 2023, up from almost $20 billion last year.

As for AWS, its operating income accounted for 67% of the entire company's $3.9 billion in operating income for the quarter. And the great news here is that AWS's net sales climbed 34% in the quarter.

Though Amazon's stock price hasn't fallen to bargain levels -- indeed, it's up significantly year to date -- it actually is a decent deal considering the growth it's set to generate in the years to come. The company, which has increased annual net income every year since 2015, has traded in the range of about 80 to 88 times earnings over the past two years. While Amazon's price to earnings ratio has increased to 100 over the past few days, that's still down from levels of 250 times earnings and higher back in 2018. And today, Amazon is trading at about 18 times book value, after trading at more than 20 for a great part of the past four years.   

As of Wednesday afternoon, Amazon's stock price was up by 25% year to date. Wall Street analysts are forecasting an additional 4.4% upside for the year. Considering the demand Amazon has seen in recent weeks and the performance the stock has delivered so far, that forecast seems modest.  

2. Vertex Pharmaceuticals

The near-term story for Vertex Pharmaceuticals (VRTX -2.02%) is about treating cystic fibrosis. The company is a market leader in that indication, and Morningstar predicts its cystic fibrosis program may contribute more than $10 billion to revenue in 2028. Vertex has revenue gains for the past five years, with sales led by its older cystic fibrosis medications, but its newest approved treatment -- Trikafta -- is expected to become the growth driver this year.

Looking farther ahead, Vertex's story, depending on drug approvals, is set to expand. The biopharmaceutical is testing treatments for blood disorders such as sickle cell disease and beta-thalassemia. In the pain-relief indication, the company has achieved proof of concept and is now trying to find the right molecule to advance through clinical trials from a chemistry perspective. Its researchers are looking for one that could be taken once or twice a day, for example. Pain relief is an interesting area due to the market size and the limited options beyond older treatments like aspirin and acetaminophen or the more dangerous opioids. The global pain management market will reach $52 billion by 2022 from $36 billion in 2017, according to BCC Research.

In blood disorders, Vertex reported positive safety and efficacy data from the first two patients treated with its gene-editing therapy in Phase 1/2 studies. Vertex and its partner, CRISPR Therapeutics (CRSP -2.40%), collect cells from the patient's blood, edit them, then infuse them back to the patient. The current (limited) data from those early trials suggest the companies may be able to cure sickle cell disease and beta-thalassemia from a functional perspective.

Vertex shares are trading near their all-time high, up almost 20% this year, but they remain inexpensive in relation to book value. For the past year, they've traded in the range of about 10 times book value, compared with more than 20 in the previous four years.

Though they are far from dirt cheap, Amazon and Vertex are reasonably priced considering their growth prospects and their current revenues. Investments in them at these levels should pay off in the long term.