Wall Street on Tuesday initially reacted to news of an impeachment inquiry to be lodged against president Donald Trump the same way it did when former president Bill Clinton was in the same boat back in 1998 -- it took a dive.

News of Trump's impeachment inquiry being set in motion sent the S&P 500 0.8 percent lower, its biggest plunge in a month, while the Dow Jones Industrial Average shed 0.5 percent.

Back in Oct. 8, 1998, the day House voted to begin impeachment proceedings against Clinton, the S&P 500 fell as much as 4.9 percent while the Dow lost 3.5 percent.

The parallel is uncannily eerie and Wall Street investors today are betting the market will ultimately rally to new heights as it did under Clinton at the end of the impeachment saga.

Wall Street's optimism was borne out Wednesday with all major indices posting gains after the market appeared to ignore the impeachment inquiry against Trump launched by Democrats in the House of Representatives as a result of the worsening Ukraine scandal.

The Dow rose 0.5 percent, the S&P 500 got a 0.27 boost while the NASDAQ Composite gained 0.4 percent.

Analysts said the Street's optimism is predicted on the reality that while the House will eventually impeach Trump, the president won't be removed from office by the Republican-controlled Senate.

“The Senate is just going to ignore it,” contends Jack Ablin, CIO at Cresset Wealth Advisors. “It’s probably at worst a distraction. I really don’t think investors will take the risk of impeachment seriously at this point. If there’s really strong damning evidence, that’s a different matter.”

Other analysts point to Clinton's impeachment proceedings as a source of optimism. Clinton was impeached by the House of Representatives on Dec. 19, 1998 but was immediately acquitted by the Senate in February 1999.

The S&P 500 rallied 28 percent from January 1998 after the the first reports of Clinton’s affair with White House intern Monica Lewinsky until the Senate acquittal.

“Sure, there was a decline of 20% at one point in between, but that was due to the Russia Crisis and the collapse of Long-Term Capital rather than anything to do with what was going on in the White House,” according to Paul Hickey, co-founder of Bespoke Investment Group.

Bill Clinton
Former President Bill Clinton poses for photographs after addressing the nation from the Oval Office in the White House following the end of hostilities in Yugoslavia on June 10, 1999. Getty Images/JOYCE NALTCHAYAN