The S&P 500 gave up most gains and Dow Industrials turned lower on Tuesday after President Donald Trump's threat to shut down the government over funding for a border wall undid the boost to markets from optimism over China-U.S. trade talks.

Trump openly fought with Senate Democratic Leader Chuck Schumer and House Democratic Leader Nancy Pelosi at an Oval Office meeting about funding for the wall, throwing into doubt whether a deal was possible ahead of a deadline later this month.

That accelerated the downward trend in equity markets after a strong start to the session on news that U.S. and Chinese officials had discussed a road map for the next stage of trade talks, which Trump called “very productive."

Traders said the market's move was another example of the recent swings. On Monday, the S&P bounced off an eight-month low to end higher, with strategists saying trading algorithms kicked in with buy signals at the lows of the day.

“We're in a period of a lot of intra-day volatility where market participants are trying to figure out where things should be properly valued and you're going to get a lot of back and forth," said Scott Brown, chief economist at Raymond James in St. Petersburg, Florida.

Brown said the outlook for next year was being clouded by “period of extraordinary uncertainty," leaving investors trying to balance stock valuations with headlines such as political news in Washington, Brexit, interest rates and trade.

“The whole idea of a risk-on is not generally going to follow through."

Adding to nerves was a report that some lawmakers in British Prime Minister Theresa May's Conservative Party believed they had sufficient numbers to mount a no-confidence vote to her leadership.

The losses were led by the S&P financial sector's, 0.87-percent drop. The sector was up earlier as were the trade-sensitive industrials.

Industrials were down 0.57 percent, also hit by a Washington Post report saying Washington will condemn China over hacking and economic espionage.

Technology stocks, which helped power the market's reversal Monday, were up 0.10 percent, having given up a large chunk of their gains.

At 1:19 p.m. ET, the Dow Jones Industrial Average was down 41.78 points, or 0.17 percent, at 24,381.48. The S&P 500  was up 2.59 points, or 0.10 percent, at 2,640.31 and the Nasdaq was up 22.15 points, or 0.32 percent, at 7,042.67.

The defensive utilities, real estate and consumer staples moved higher to lead the sectoral gainers.

Dow component Pfizer Inc fell 1.31 percent after a JP Morgan downgrade. Apple Inc, off 0.74 percent, weighed the most on the S&P and the Nasdaq.

Advancing issues outnumbered decliners by a 1.09-to-1 ratio on the NYSE. Decliners outnumbered advancers for a 1.02-to-1 ratio on the Nasdaq.

The S&P index recorded 12 new 52-week highs and 18 new lows, while the Nasdaq recorded 22 new highs and 158 new lows.

Copyright Reuters, 2018