With the Nasdaq Composite index up 32% in 2023 (as of Aug. 9), it's clear that investors are starting to feel optimistic again. That's especially true following the double-digit loss posted last year. 

But some stocks, like Tesla (TSLA -14.11%), have trounced the overall market. Shares of the electric vehicle (EV) maker are up a whopping 100% this year. And its market cap is close to $800 billion. 

With the stock up so much in 2023, should investors buy, sell, or hold Tesla right now? Let's take a closer look at this top automotive stock. 

A leader in the EV market 

Tesla beat Wall Street estimates for the three-month period that ended June 30. Revenue totaled $24.9 billion, with diluted earnings per share coming in at $0.91 (on an adjusted basis). But shares have been under pressure, down 15% since that second-quarter earnings announcement. 

Investors have been concerned this year about the management team's ongoing pricing cuts, which have eaten away at margins. Tesla's gross margin and operating margin last quarter of 18.2% and 9.6%, respectively, were down considerably from the year-ago period. However, it's encouraging that the business still generates better profit metrics than legacy automakers like Ford Motor Company and General Motors. 

"The short-term variances in gross margin and profitability really are minor relative to the long-term picture," founder and CEO Elon Musk said on the Q2 2023 earnings call. "Autonomy will make all of these numbers look silly." Shareholders can either believe what he says or take it with a grain of salt. 

But despite the hit to margins, Tesla's growth is still impressive. Automotive revenue, which excludes sales of energy storage products and other services, was up 46% year over year and up 533% versus just five years ago. The business produced 1.7 million cars in the last 12 months, a figure that Musk hopes to get to 20 million annually by 2030. 

As the undisputed pioneer and leader of the EV market, the company has built up a phenomenal brand that resonates with consumers across the world. And the premium image of Tesla, bolstered by its popular cars with elegantly designed interiors and exteriors, is a key competitive advantage that can benefit it for a long time. 

Investors have to think things through 

Buying or holding on to Tesla right now, even though its shares have soared, likely wouldn't be too difficult of a decision to make. This is already one of the most valuable and beloved businesses in the world, with a founder and CEO who has a huge fan base. And it's hard to bet against Musk in any capacity, especially as he continues to move the world forward in impactful ways. 

Investors who have long been shareholders might believe that Tesla still has a long runway for growth in front of it, thus maintaining a portfolio position. Perhaps fully self-driving vehicle capabilities will get here sooner rather than later. And this completely changes the financial profile of the business, resulting in outsize scale and profits. Moreover, stockholders could be bullish on Tesla's energy ambitions as well, which also present huge end markets. 

However, after the stock's monumental rise in 2023, plus its 2,270% gain over the past decade, I can see why investors might also be inclined to sell their Tesla holdings and book a profit if they've been sitting on unrealized gains. Although the company looks to be on a path of consistent profitability going forward, the stock isn't cheap, trading at a trailing price-to-earnings (P/E) ratio of 70, much higher than the P/E of 30 to start the year. Sellers could redirect that capital to other attractive opportunities. 

Investors have to decide for themselves, based on their own circumstances and outlook, what to do with Tesla shares right now.