Image source: White House.

President Barack Obama is serving out his final hours in the White House, with President-elect Donald Trump to take over on Friday at noon. Over the past eight years, the stock market has soared, with the S&P 500 (^GSPC -0.57%) climbing from around 850 when Obama took office to more than 2,250 today.

Yet even though most S&P 500 stocks have gained ground over that timeframe, a few stocks completely missed out on the bull market. Let's look at the 10 worst-performing stocks currently in the S&P 500, to see what they say about the outgoing president's legacy for investors.

Stock

Total Return

First Solar (FSLR 1.27%)

(74%)

Southwestern Energy

(62.7%)

Transocean (RIG 1.60%)

(58%)

Chesapeake Energy (CHKA.Q)

(41.5%)

Endo International (ENDP)

(38.8%)

NRG Energy

(28.4%)

Staples (SPLS)

(28.3%)

FirstEnergy

(7.8%)

Devon Energy

(5.6%)

Exelon

(3.7%)

Data source: S&P Global Market Intelligence.

One thing to keep in mind with this list is that the S&P 500 suffers from the phenomenon known as survivor bias. Companies that lose too much of their value stop qualifying as large-cap stocks for the purposes of staying on the index, and so the hardest-hit companies likely got downgraded to mid-cap or small-cap benchmarks, or taken out of the S&P universe entirely. Nevertheless, a look at these companies can still reveal some of the key trends the market has seen.

Energy misses the bull-market boat

The most obvious conclusion to draw from this list is that energy companies are among the biggest losers. That might seem to make sense, given the recent plunge in the oil and gas markets. Yet one thing that's easy to forget is that in early 2009, the oil market was also in a huge slump. On the day that Obama took office, West Texas Intermediate closed at less than $39 per barrel, having fallen from triple-digit levels within just a few short months during the height of the financial crisis.

Yet the reason no one remembers that painful episode in the energy market is that it didn't last long. By midyear, crude had climbed back above $70 per barrel, and it took only until 2011 for oil to climb back into triple digits.

Meanwhile, natural gas prices at the time of the 2009 inauguration were around $5 per million BTU, compared to just over $3 today. That's a big reason why companies like Chesapeake Energy and Southwestern Energy have struggled, because their focus at the time was on natural gas. Chesapeake in particular has moved aggressively to diversify and expand its oil exposure. But even gains in the crude oil market haven't been substantial enough to lift share prices as much as investors would have liked. Moreover, offshore projects remain expensive, hurting offshore driller Transocean, and preventing it from recovering fully from the Deepwater Horizon disaster in 2010.

Damage in the energy market hasn't been limited to oil and gas producers. Economic viability of solar projects has also diminished in a cheap fossil-fuel environment, and that has hurt First Solar and many of its renewable-energy peers. Meanwhile, utilities have also seen pressure on their share prices, although to a large extent, healthy dividends have helped offset share-price declines.

Pain outside the oil patch

You can find a few companies outside the energy sector that have come on hard times as well. Office-supply giant Staples has fallen victim to the rise of online retail, and a hoped-for merger of the remaining players in the brick-and-mortar office-supply space failed to gain the necessary approvals. Staples now has the unattractive prospect of finding ways to compete by capitalizing on its own online sales channel, and few believe that its long-term prospects are particularly promising.

For Endo International, trouble has come more recently; the company lost almost three-quarters of its value in 2016. Allegations of participation in a price-fixing scheme, competition from generic alternatives, and product-liability concerns in its women's health division all played a role in holding the stock down lately. Some believe a more favorable environment for pharmaceutical stocks could come after President-elect Trump takes office, but others point to bipartisan attacks on pharma stocks as being negative for the sector in general.

Despite the stock market's gains during the Obama administration, these 10 stocks took big hits. A rebound in energy could change most of their prospects positively, but a few might have trouble ever fully recovering from their downturns.