The S&P 500 ended marginally lower in a choppy session on Friday, but the major equity indexes posted weekly gains for the first time in December following a wild few days of trading that saw equities rebound from a prolonged slide.

Major indexes moved in and out of positive territory during the day, action that was emblematic of recent volatility though lacking the huge swings of the past week. The Dow finished modestly lower, while the Nasdaq eked out a slight gain.

With the year coming to an end, attention will turn to key economic reports next week, including on manufacturing and employment.

For the week, the S&P 500 rose 2.86 percent, the Dow added 2.75 percent, and the Nasdaq gained 3.97 percent.

Even so, the S&P 500 was on track to drop more than 9 percent in December, its largest monthly percentage decline since February 2009, during the throes of the financial crisis.

Concerns about trade tensions between the United States and China, instability in Washington as underscored by the partial federal government shutdown and slowing corporate profit growth continue to worry investors heading into 2019.

However, the recent slide in stocks means valuations are more reasonable, while it seems that Wall Street is becoming more confident about the Federal Reserve’s approach to interest rate policy and monetary tightening.

The rebound in stocks this week is due in part to a rotating into equities from bonds. Fund investors added $5.2 billion to equity funds in the first net positive flows for such funds this month, while bonds funds saw $8.3 billion in outflows, according to Lipper data for the latest weekly period.

Contracts to buy previously owned homes fell unexpectedly in November, the National Association of Realtors said, the latest sign of weakness in the U.S. housing market.

In corporate news, Tesla rose 5.6 percent after the company named Oracle’s co-founder Larry Ellison to its board, in response to a demand by regulators for independent oversight of company management.

Dell returned to public markets, nearly six years after the company’s founder and chief executive, Michael Dell, took it private.

Approximately 8 billion shares changed hands on the major domestic equity exchanges, a number that was below the 9.2 billion share average over the past 20 trading sessions.

Pending Home Sales Fall

According to a report by the National Association of Realtors, contracts to buy previously owned homes fell unexpectedly in November, the latest sign of weakness in the U.S. housing market.

The NAR’s pending home sales index decreased 0.7 percent from the prior month to 101.4. October’s index was unrevised.

Pending home sales are seen as a forward-looking indicator of the health of the housing market because they become actual sales approximately one to two months later.

Compared to one year ago, pending sales were down 7.7 percent in November, the eleventh straight year-over-year drop.

The housing market has been constrained by higher mortgage rates as well as land and labor shortages, which have led to tight inventory. Though house price inflation has slowed significantly, it continues to outpace wage growth, sidelining some first-time homebuyers.

The NAR previously reported that home resales rose in November but recorded their largest annual decline in 7-1/2 years.

Groundbreaking for new homes also rebounded in November, but completions on single-family homes fell for a third straight month to their lowest level in more than a year.

Lawrence Yun, the NAR’s chief economist, said in a statement on Friday that the pending home sales data was not yet reflecting recent favorable mortgage rate conditions.