If the U.S. stock market was a movie, Reversal of Fortune would be a fitting title.

Stocks began the year by recording their worst 10-day calendar year start in history. How bad was it? Worse than dreaded years like 1929, 1974, 1987, 2000, and 2008.

By the end of January, just one S&P 500 sector was in positive territory (utilities, a defensive sector no less) while the remaining sectors where sinking fast like the Titanic. The S&P 500 itself was down 4.98 percent while volatility was up 10.93 percent. As the market’s sentiment or mood toward stocks was souring, risk appetite was contracting and defensive assets like gold and treasuries were spurting higher.

Just nine months later, the shift from negative sentiment toward equities to positive has completely reversed. And it’s being reflected in the underlying results of sector ETFs. 

All 11 Sector SPDR ETFs have scored positive year-to-date gains through the end of August. The funds divide the S&P 500 by industry group, thereby allowing investors to concentrate their equity exposure to their favorite sectors.

Within sector groupings are the Financial Services Sector SPDR Fund (XLFS) and Real Estate Sector SPDR Fund (XLRE), which were recently launched as a result of indexing changes made by the Global Industry Classification Standard (GICS). Since the start of the year, XLRE has gained 8.83 percent while XLFS has edged higher by 2.53 percent.

The Materials Sector SPDR Fund (XLB), which is the smallest S&P 500 sector, has made some noteworthy reversals. After declining 8.67 percent in 2015, XLB has already shot ahead by 12.70 percent this year. XLB owns a basket of 27 commodity-linked stocks such as Dow Chemical, Freeport McMoRan, and Monsanto.

For this year’s second quarter, the blended earnings decline for the S&P 500 was -3.2%, according to FactSet. The energy sector had the worst second quarter earnings results, posting an -84.10 percent  decline. Nevertheless, Energy Select Sector SPDR Fund (XLE) has jumped 14.77% this year and been among the top performers.

Despite resurgent stock prices, fundamentals have been lagging. 

Second quarter earnings marks the first time the S&P 500 has recorded five consecutive quarters of year-over-year declines in earnings since the third quarter 2008 through third quarter 2009. Are better times ahead?

A report titled “Peak Profits” from Research Affiliates noted earnings per share for the S&P 500 Index peaked in the third quarter of 2014 and have slid 14% since then. According to the report, this decline represents “only one of four drops of similar magnitude during the past 25 years and each event resulted in double-digit price declines for the U.S. stock market.”

For now, it seems like equity sector performance has largely discounted the reality of decelerating corporate earnings. And until that changes, the stock market’s bullish psychology likely will continue.

Ron DeLegge is founder and chief portfolio strategist at ETFguide.