According to analysts, the counteroffensive by the Ukrainians is sending the stock market higher on the belief that the war could be over sooner than previously thought.

Some on Wall Street pointed out last week that a rally in the stock market was related to the attacks in the southern and eastern parts of the country.

Russia's defensive lines in eastern Ukraine collapsed over the weekend as troops fled in disarray and panic. Since launching its offensive, the government in Kyiv has taken back about 9000 square kilometers from Russia.

The US stock market gained for the first time in three weeks on Friday, snapping a three week losing streak.

Advances by the Ukrainians in the war are helping the upbeat mood. Suddenly investors are opening their eyes to the possibility of a quicker end to the war.

The latest advances by the Ukrainians may mean some sort of settlement going forward, according to Jeremy Siegel of the Wharton Business School.

Hani Redha, PineBridge Investments multi-asset portfolio manager, said the latest news out of Ukraine is creating some hope for the market that there might be a resolution and some relief on the intensity of the energy shock.

The war in Ukraine could provide some stability to the energy market, which has been volatile since the beginning of the year.

There are calls for market interventions and energy rationing over the winter as a result of the long-term cut off of gas flows to Europe.

In the earlier months of the war, Russia was unable to hold on to the gains it had made in Ukraine and was forced to move deeper into the country. There was a chance of talks between Russia and Ukraine in Turkey, which did not happen.