The agreement follows a month of political gridlock that threatened to make America a deadbeat and derail global financial markets. Investors have stayed largely calm throughout in the current drama in Washington, with the S&P 500 actually gaining 2.4 percent since the shutdown began on Oct. 1.
Wall Street had bet that politicians wouldn't let the U.S. default, a calamity economists said could paralyze lending and push the economy into another recession.
"We knew it was going to be dramatic, but the consequences of a U.S. default are just so severe that the base case was always that a compromise was going to be reached," said Tom Franks, a managing director at TIAA CREF, a large retirement funds manager.
Congress was racing to pass the legislation Wednesday.
If the deal wraps up soon, investors can turn their attention back to basics like earnings and the economy. Corporations have begun to report third-quarter earnings, but Wall Street has been glued to the budget brinksmanship. Overall earnings at companies in the S&P 500 index is forecast to grow 3.1 percent from a year earlier, according to data from S&P Capital IQ. That's slower than the growth of 4.9 percent in the second quarter and 5.2 percent in the first quarter.