(AP) -- It was perhaps the most surprising trade in a record-setting week on Wall Street: How quickly investors swapped presidential pre-election jitters for enthusiasm at Donald Trump's victory over Hillary Clinton.
That enthusiasm -- call it the Trump rally -- ultimately propelled the Dow Jones industrial average to consecutive all-time highs this week and gave the Standard and Poor's 500 index its biggest weekly gain in two years. The rally lost some steam Friday, pulling the S&P 500 slightly lower.
The Dow rose 39.78 points, or 0.2 percent, to 18,847.66. The S&P 500 index fell 3.03 points, or 0.1 percent, to 2,164.45. The Nasdaq composite index gained 28.32 points, or 0.5 percent, to 5,237.11.
For months, investors viewed Trump and his proposed agenda as a more risky bet for the economy and the markets than his rival, who had been widely perceived as the candidate most likely to keep the status quo in place.
But then the billionaire won. And, more importantly, Republicans retained majorities in the House and Senate, ensuring that the president-elect's party will be in control when he takes office on January 20.
"I don't think people planned on a straight Republican sweep," said J.J. Kinahan, TD Ameritrade's chief strategist. "All of a sudden you realize some of the things that the markets have been wishing for have a chance to be done. That's why we've rallied so much. This scenario was such a low probability, nobody was planning for it."
Investors are now betting that Trump and a Republican-controlled congress will have a clear pathway to boost infrastructure spending, cut taxes and relax regulations that affect energy, finance and other businesses.
That agenda flipped investors' priorities this week away from defensive assets like bonds, utilities and phone companies, which traders had favored for much of this year, to health care, industrial and financial stocks, which notched their best week since 2009.
The trades mark a reversal from the last couple of years, when investors coped with government gridlock, sluggish economic growth and low interest rates by prizing less-risky assets and stocks like phone companies and utilities with high dividends.
Health care stocks are perhaps the best example of how investors' mindset has changed in just a few days.
The sector had been one of the worst performers this year in anticipation that Clinton, who had mostly maintained a lead in the polls, would push to expand the government's role in health care and curb price increases by drugmakers. That began to turn around this week, as investors bid up shares in pharmaceutical companies.
Banks also were seen to be potentially hurt by a Clinton win. But this week they went from being a laggard to one of the biggest gainers. The sector is benefiting from the expectation that the Trump administration will remove some of the regulations imposed on banks following the 2008 financial crisis.
"You're seeing strength in those sectors that are going to best be positioned for those changes," said David Lyon, global investment specialist at J.P. Morgan Private Bank. "There's been a massive shift toward a pro-growth bias within portfolios."
Investors also are betting that Trump's policies will lead to higher interest rates, which benefits banks by making it more profitable to lend money.
The anticipation of higher interest rates fueled the sell-off in bonds this week that sent bond prices lower and drove up the yield on the 10-year Treasury note to the highest level since January. On Monday it was 1.83 percent. It hit 2.14 percent as of late Thursday. Bond trading was closed Friday in observance of Veterans' Day.
That yield is a benchmark used to set interest rates on many kinds of loans including home mortgages.
The move away from bonds, utilities and other safe-play assets is likely to continue as long as investors believe that Trump's economic policies will lead to growth in the economy and usher in higher interest rates.
"You've seen people rotating out of them this week because they don't feel the need for the straight safety play, they don't need necessarily the yield of the safe stocks longer-term if they believe that the interest rate market is going to continue higher," Kinahan said.
Despite the market's enthusiasm this week, there is still an element of uncertainty about the Trump administration. Kinahan worries about the impact on the economy should inflation rise quickly. "That's a major worry," he said.
Then there's the question of what steps Trump will take to clamp down on illegal immigration and to renegotiate trade deals with other countries.
"What sounded great on the campaign trail may not be actually so great to a lot of businesses, particularly technology," Kinahan said.
In energy futures trading Friday, benchmark U.S. crude fell $1.25, or 2.8 percent, to close at $43.41 a barrel in New York. Brent crude, used to price international oils, slid $1.09, or 2.4 percent, to close at $44.75 a barrel in London.
Other energy futures also closed lower. Wholesale gasoline lost 3 cents to $1.31 a gallon. Heating oil fell 4 cents to $1.40 a gallon. Natural gas lost a penny to $2.62 per 1,000 cubic feet.
Among metals, the price of gold tumbled $42.10, or 3.3 percent, to $1,224.30 an ounce, while silver slid $1.36, or 7.2 percent, to $17.38 an ounce. Copper fell 4 cents, or 1.6 percent, to $2.51 a pound.
In currency trading, the dollar fell to 106.78 yen from 106.83 yen late Thursday. The euro slid to $1.0845 from $1.0890. The Mexican peso continued to drop, as investors worried about Trump's promises to scrap trade deals and build a wall along the border. One dollar bought 20.94 pesos on Friday, more than the 19.61 pesos it bought late Thursday.