Tesla Inc. (NASDAQ:TSLA) stock ended Tuesday's trading up about 4% to $262.33, extending its gains for the tenth day in a row.

The positive moves mean Tesla has erased all of its losses year-to-date, with the stock up about 5% year-to-date. The stock has also risen about 75% since hitting a 52-week low in April.

Analysts credited the company's second-quarter vehicle production and delivery numbers, which beat Wall Street expectations, along with momentum surrounding Tesla's artificial intelligence business.

Tesla is scheduled to report its next quarterly results on July 23 after the market closes. Tesla is set to develop affordable electric cars, which investors see as another key driver of growth.

Beyond earnings and deliveries, investors will also be looking at another growth opportunity for the company: robot taxis. The company is set to unveil its long-awaited Robotaxi on August 8.

Tesla shares fell in the first half of the year after the company reported disappointing deliveries. A 9% year-over-year decline in vehicle deliveries in the first quarter sent shares lower as investors questioned the electric carmaker’s lofty valuation and continued demand in the United States.

Shortly after the failed delivery, the company laid off more than 10% of its staff. At the time, analysts viewed the layoffs as a negative sign of things to come.

Overseas competition from Chinese EV makers including Lucid (NASDAQ:LCID), Li Auto (LI), Nio (NIO (NYSE:NIO)), and XPeng (XPEV) has also been a major drag, fueling a price war that has forced Tesla to cut prices aggressively in order to compete.

As a result, hedge funds ramped up their bets on Tesla (TSLA) shares falling before the electric car maker revealed positive delivery and production data that sent the stock price soaring, leaving bears with huge losses.

What do analysts expect?

On the other hand, Tesla is likely to see an improvement in its profit margins, helped by lower production and raw material costs, according to Seth Goldstein of Morningstar, one of the top three analysts covering the stock in the Bloomberg rating that tracks price recommendations.

The company is likely to return to earnings growth next year, he said in a note to clients, adding that how Tesla handles the market’s intense focus on affordable electric vehicles will be key.

ProTips data indicates that the company has more cash than debt on its balance sheet, which is an indicator of the company's financial stability.