The stock market has taken investors on quite a roller-coaster ride in 2020. After reaching all-time highs in February, the S&P 500 and Dow Jones Industrial Average plunged by as much as 40% as the COVID-19 pandemic intensified. Since then, the major indexes have rebounded significantly -- as of June 1, the S&P 500 is down just 6% for the year.

Having said that, the pandemic has affected different areas of the stock market in very different ways. For example, the tech-heavy Nasdaq Composite is actually up by more than 6% in 2020, while the Financial Select Sector SPDR ETF (XLF -0.02%) is down by 23%. Many stocks -- especially those that can thrive in a socially distant world -- are significantly higher in 2020, while many that rely on people getting out in groups, like theaters and hotels, have lost more than half of their value.

Because of this, my portfolio has been shaken up quite a bit lately. As an investor who is quite focused on banking and real estate, it shouldn't be surprising that my portfolio took a big hit in March when the market crashed. However, some of my stock positions have performed quite well, and I've also put quite a bit of money to work over the past few months.

Man looking at several monitors with financial charts.

Image source: Getty Images.

My 5 largest stock positions

With that in mind, here's a look at my largest stock positions now, how each has done during the pandemic, and whether I've been buying more shares.

1. Apple

Tech giant Apple (AAPL 1.27%) has been one of my top stock holdings for years, and it has been my No. 1 holding for the past year or so thanks to strong performance.

Apple has performed quite well throughout the pandemic and is up 9% for the year. As of June 1, it is just below its all-time high. While the company certainly hasn't been completely immune to the coronavirus outbreak, its service revenue continues to climb at an impressive rate, its wearables business is growing rapidly, and the company is unlikely to lose much sales of its core iPhone, iPad, and Mac products from a long-term perspective.

2. Digital Realty Trust

Digital Realty Trust (DLR 1.50%), a data center real estate investment trust (or REIT), has climbed into my "top holdings" list simply because of strong performance. With a gain of more than 20% for the year, Digital Realty has been the best-performing stock in my portfolio in 2020.

The main reason is that Digital Realty is well-positioned to thrive in a post-COVID world. Simply put, as more people work from home and more streaming content is viewed as people stay in, there is a growing need for safe and reliable homes for servers and networking equipment. The gradual rollout of 5G technology over the next few years should help keep demand growing as well. In a nutshell, owning and operating data centers (especially at scale) is a good business to be in right now.

3. Markel

Insurance company Markel (MKL -1.17%) is actually one of my portfolio's underperformers, down by 21% in 2020. As an insurer with lots of specialty insurance and reinsurance business, there's quite a bit of uncertainty when it comes to Markel's potential losses. Furthermore, Markel also owns a portfolio of common stocks (many of which are lower) and also invests directly in businesses through its Markel Ventures subsidiary.

However, Markel remains a well-capitalized company with excellent management, and it should be just fine when the dust settles. With the stock down sharply since the pandemic began, I decided to more than double the size of my Markel investment, and it is now my third-largest stock position.

4. AT&T

In recent years, I've referred to AT&T (T 1.88%) as a value investor's dream. With a massive 6.7% dividend yield, a decades-long track record of annual dividend increases, and at a valuation of less than 10 times forward earnings, AT&T has been a staple of my portfolio for a few years now.

To be fair, there are some reasons for the market's pessimism on AT&T. The company has a massive debt load, and it's pretty clear at this point that AT&T dramatically overpaid for DIRECTV. However, the company still has its rock-solid wireless business, which should benefit from the rollout of 5G, and also has the competitive advantage of the ability to cross-sell and bundle services and products to a greater extent than any other wireless carrier.

5. Realty Income

Last but certainly not least, Realty Income (O 0.52%) has been one of my largest stock holdings for some time. One of the first stocks I ever bought, Realty Income is a real estate investment trust that owns primarily single-tenant retail.

Now, this may sound like a terrible business to be in right now, but don't be so quick to judge. Realty Income's business is doing quite well. The majority of its tenants are in businesses that have been considered essential, and the company collected 83% of its expected rent in April, which is far better than most retail peers. With shares down 23% year to date, I haven't yet bought more shares of Realty Income, but it's definitely near the top of my watch list.