Stocks ended broadly higher as investors set aside concerns, for now, about the heated trade war between the U.S. and China that roiled markets earlier in the week and more in Thursday’s Stock Market Update.

The gains Thursday erased the week’s losses for the S&P 500 index. It was the third straight gain for the market following six losses in a row.

Investors snapped up technology stocks in a signal that they are more willing to take on risk. Adobe rose 3%.

The absence of new worrisome turns in the U.S.-China trade tussle may have also helped keep investors in a buying mood Thursday.

“That’s what the market is attuned to right now, this confirmation of fears that things are going badly,” said Willie Delwiche, investment strategist at Baird. “And if you’re not getting that, then stocks can stabilize, bond yields can move up a little bit.”

Bond prices were flat after shedding an early gain. That left the yield on the 10-year Treasury at 1.71%.

Investors snapped up technology stocks in a signal that they are more willing to take on risk after several days of fleeing to safer holdings, such as bonds. Microsoft rose 2.6% and Oracle gained 2.4%.

Banks led financial stocks higher as bond yields gained ground following a sharp decline on Wednesday. The sector also got a key boost from American International Group after the insurer reported solid second quarter financial results.

Travel website company Booking Holdings rose 6.5% and lifted consumer-oriented stocks.

In another sign that investors were feeling more bullish, safe-play sectors like utilities and makers of consumer products lagged the market. Investors usually shun those sectors when they want to take on more risk.

Investors focused on a steady flow of mostly solid corporate earnings on Thursday, rewarding companies that beat Wall Street forecasts. Albemarle jumped 8.7% and Viacom rose 3.7%.

Companies within the S&P 500 index are nearly done reporting earnings for their most recent quarter and the results have been much better than investors initially predicted.

STOCK MARKET UPDATE

KEEPING SCORE: The S&P 500 rose 54 points, or 1.9%, to 2,938. The Dow Jones Industrial Average added 371 points, or 1.4%, to 26,378. The Nasdaq rose 176 points, or 2.2%, to 8,039.

Major indexes in Europe notched solid gains.

TRADE WAR RECAP: President Donald Trump spooked the markets last week when he threatened to impose 10% tariffs on all Chinese imports that haven’t already been hit with tariffs of 25%. China retaliated on Monday and allowed its currency, the yuan, to weaken against the U.S. dollar.

China stabilized the yuan on Tuesday and that helped lift U.S. stocks following their worst day of the year. But, central banks in New Zealand, India and Thailand cut key interest rates on Wednesday, sending U.S. stocks into an early dive before recovering at the end of the day. Major U.S. indexes are down about 1% for the week.

BUMPY RIDE: The last couple of weeks feel even more topsy-turvy following the months of relative calm that investors had been enjoying. Before Monday’s 3% drop for the S&P 500, they hadn’t seen a loss of even half that size since mid-May.

Since this bull market began over a decade ago, the S&P 500 has had 24 days where it lost at least 3%. That averages out to one every five months or so, but they don’t happen in such a regular fashion.

Instead, the market tends to shift between periods of calm and sharp bursts of volatility. In 17 of the 24 times that the S&P 500 fell 3%, it either preceded or followed another such drop within a month. So Monday’s 3% fall may be the precursor to more, if history is a guide.

“The foreseeable future is going to be a lot of noise,” said J.J. Kinahan, chief market strategist for TD Ameritrade.

The last time the stock market had a drop of 3% was on Dec. 4, when investors were worried that the Federal Reserve was raising interest rates too aggressively and would combine with trade concerns to create a recession. But it wasn’t in isolation: It was the third such drop within the span of two months.

A more extreme example is the summer of 2011, when the S&P 500 had four drops of more than 4% in just two weeks. Worries about the European debt crisis and the first-ever downgrade of the U.S. credit rating at the time were roiling markets around the world.

That episode also showed that big up days can be interspersed between big down days. That same stretch had two days where the S&P 500 surged more than 4%.

REVENUE LYFT: Ride-hailing service Lyft climbed 3% after reporting a surge in second quarter profit that propelled it well past Wall Street’s second quarter financial forecasts. The company, which went public in March, reported a far narrower loss than analyst’s expected and raised its revenue forecast for the year.

INSURANCE BENEFIT: American International Group rose 4.3% after the insurer blew past Wall Street’s second quarter profit forecasts on strong underwriting and a jump in investment income.

WHIPPED STOCK: Kraft plunged 8.6% after the maker of Oscar Mayer, Cool Whip and other products revealed a sharp profit plunge in the first half of the year and some hefty charges. The company has been hurting as consumers look for food that they perceive is healthier or fresher. The company had to write down the value of some of its brands and revealed an additional subpoena from the Securities and Exchange Commission as it faces scrutiny over its procurement operations.

© The Associated Press. All rights reserved.