Democrats vs. Republicans: Who's better for stocks?

Republican Democrat

Hillary Clinton claims the American economy does better when a Democrat is president. Republican Carly Fiorina says that's a joke.

Who's right?

Our friends at break it down nicely. The short version is: Clinton is an extent.

The economy has performed better under Democratic presidents, but the Princeton professors who did the analysis explicitly say it's not because of superior policies.

Some of it comes down to luck. For example, the global economy does especially well and oil prices don't spike.

Another key question is who's better for investors?

If you are one of the nearly 50% of Americans with money in the stock market, does it make a difference which party is in the White House?

History says yes.

Democrats have been better for the stock market

Since 1945, the average annual gain under a Democratic president is 9.7%. Under a Republican president, it's only been 6.7%, according to Sam Stovall, chief equity strategist at S&P Capital IQ.

Before Democrats take a victory lap, consider that the best stock market performance of all came under Republican President Gerald Ford, who was in office form August 1974 to January 1977. Under Ford, the S&P 500 surged 18.6% a year, on average.

average stock market gain

The timing worked out for Ford, at least in market terms. Stocks tend to surge after big dips, and he came in during quite the downturn. Richard Nixon resigned, oil prices were spiking and the U.S. was in the midst of a recession.

Ford was out of office before the next oil crisis and hyperinflation scare at the end of the 1970s.

Related: The problem with Trump's rants on US debt

A Republican Congress has also been good for stocks

The next best president for the stock market was Bill Clinton. The average annual gain for the S&P 500 was 14.9% during his tenure. For that, he can thank the tech boom.

The only two presidents with negative average annual returns during their tenure are both Republicans -- Nixon (-5.1%) and George W. Bush (-4.6%).

stock market performance US

President Obama is on track to be the 2nd best Democrat for the stock market since World War II, although lately the market has hit a lot of turbulence. Those gains might be dented in his final year in office.

Interestingly, Stovall of S&P Capital IQ also took a look at the how the stock market does depending upon who controls Congress.

When Stovall sliced and diced the data that way since World War II, the best performance was when the nation had a Republican president with a Republican-controlled Congress.

That was followed closely by a Democratic president facing a Republican Congress or split Congress.

-- CNNMoney's Christine Romans and Logan Whiteside contributed to this article.

CNNMoney Sponsors