It’s been a wild few hours in the stock markets as the country and the world await the final results from a white-knuckle U.S. presidential race.

And yet, despite the uncertainty surrounding the election, markets posted gains on Wednesday before the opening bell rang. The S&P 500 futures had a gain of 1.8% in pre-market trading, the Dow Jones industrial average rose .52%, and the Nasdaq 100 was up 3.7%. That’s in stark contrast to where some of the indices were in the early hours of Wednesday. President Donald Trump’s spurious claims that the Democrats were trying to steal an election that he had won, as well as his pledge to seek Supreme Court intervention, pushed the S&P down, but it has clawed back as the vote count has continued.

Currently, the race between Trump and Joe Biden is too close to call, with vote tallying ongoing in critical swing states such as Nevada, Arizona, Pennsylvania, North Carolina, Michigan, Wisconsin and Georgia. Biden does hold a popular vote lead, but the presidency hinges on who will score an Electoral College victory. Experts believe that it could be days before we know if Biden or Trump has prevailed.

It does appear that hopes of a Democrat “blue wave” have been expunged — the Senate is likely to remain in Republican control, which could impact the debate over a new fiscal stimulus to help businesses and individuals hit hard by the coronavirus pandemic.

The Democrats do appear likely to hold the House of Representatives. There could be more market volatility as the races in the various swing states tighten. That situation could be exacerbated if the country seems likely to plunge into a protracted legal battle over election results.