If you'd like to receive our daily "5 Things You Must Know" newsletter, please register here.

Stocks gained on Wednesday, Sept. 6, after President Donald Trump agreed to endorse a Democratic plan to raise the debt ceiling to mid-December, getting a head start on at least one item on Congress' to-do list.

The Dow Jones Industrial Average was up 0.38% on Wednesday, the S&P 500 gained 0.4%, and the Nasdaq fell 0.36%. 

On Wednesday afternoon, Trump agreed to raise the debt limit through to Dec. 15, agreeing to a three-month extension deal offered by Senate Democratic Leader Chuck Schumer and House Minority Leader Nancy Pelosi.

Schumer and Pelosi said in a statement that the proposal offered a bipartisan approach to the debt ceiling so that Congress could focus on other issues such as "government funding, DREAMers, and health care." House Speaker Paul Ryan had called the proposal "unworkable" and accused Democrats of playing politics. 

Economic activity in the U.S. rose at a "modest to moderate pace" across the 12 Federal Reserve districts in July and August, according to the Fed's latest "Beige Book," an anecdotal reading on economic conditions. Consumer spending grew in most districts, while employment growth slowed, though not enough to introduce slack into the labor market. The Fed said it was "too soon to gauge the full extent of the impact" of Hurricane Harvey on the economy.

Hurricanes and North Korea worries, meanwhile, kept a cap on market gains on Wednesday. Hurricane Irma, the latest weather risk, made landfall in the Caribbean earlier Wednesday and has the potential to reach Florida by the weekend. A state of emergency has been declared in Florida and Puerto Rico. 

Irma could be only the fourth category 5 hurricane to hit the U.S. mainland since the early 1930s. The last category 5 storm -- Hurricane Andrew in 1992 -- caused about $50 billion in damage in 2017 dollar terms. 

The latest weather threat has forced cruiseliners such as Carnival Corp. (CCL) - Get Report and Norwegian Cruise Line Holdings Ltd. (NCLH) - Get Report to cancel or alter a number of their trips. Insurers such as Travelers Cos. (TRV) - Get Report , Allstate Corp. (ALL) - Get Report , and Progressive Corp. (PGR) - Get Report were also on watch.

Meanwhile, geopolitical worries over North Korea have yet to die down with no clear resolution in sight. New developments in the North Korea-U.S. conflict over the weekend sent the Dow tumbling more than 200 points on Tuesday, Sept. 5. The Volatility Index, otherwise known as the fear index, spiked more than 38% to 14 by Tuesday afternoon. That was its largest daily increase since Aug. 10.

The threat of military action from North Korea spiked over the weekend break after the ready-to-strike authoritarian nation successfully conducted its sixth nuclear test on Sunday, Sept. 3. South Korea's defense ministry said that North Korea is preparing the launch of another intercontinental ballistic missile, one that could be fitted with a nuclear warhead. North Korea launched its first two ICBM tests in July.

The threat of conflict with North Korea dominated market action at the beginning of August after Trump warned of severe retribution should the authoritarian state proceed with any more missile tests or threats. Trump said that further threats would be met with "fire and fury like the world has never seen."

Even with Tuesday's selloff, markets have generally been resistant to the North Korea threat and other geopolitical risks. Since July 28 when North Korea tested its second intercontinental ballistic missile, the S&P 500 has fallen just 0.3%.

"We're all just scared to be out of this market," said Jason Thomas, chief economist at AssetMark, in a call. "Despite all of the things we could talk about on the horizon -- North Korea, the debt ceiling, tax reform -- it's hard to get the courage to be out of this market given how it's reacted in the past and the dry powder that the central banks, first and foremost the Fed, now have as a result of raising rates."

Crude oil prices surged again even as the latest hurricane threatened to throw U.S. production and demand into a spin. A number of refineries in Texas and Louisiana have reopened after Hurricane Harvey, reinvigorating demand for crude. 

West Texas Intermediate crude was up 1% to $49.16 a barrel on Wednesday. 

Energy stocks were the best performers on markets Wednesday. Exxon Mobil Corp. (XOM) - Get Report , Chevron Corp. (CVX) - Get Report , Halliburton Co. (HAL) - Get Report , Schlumberger Ltd. (SLB) - Get Report , and BP PLC (BP) - Get Report were all higher, while the Energy Select Sector SPDR ETF (XLE) - Get Report added more than 1%. 

Schlumberger is a holding in Jim Cramer's Action Alerts PLUS Charitable Trust Portfolio. Want to be alerted before Cramer buys or sells SLB? Learn more now.

Federal Reserve Vice Chair Stanley Fischer announced his retirement in a letter to President Trump on Wednesday morning. Fischer will resign from his post by mid-October. He cited personal reasons. His term was set to finish next June.

Newell Brands Inc. (NWL) - Get Report declined by 5.3% after cutting profit forecasts as it accounts for the effects of Hurricane Harvey on its resin supplier facilities in Texas and Louisiana. Many of its facilities in the region have declared force majeure and a number are still not operational more than a week after the worst of the storm. Newell anticipates profit of $2.95 to $3.05 a share, down from previous guidance of $3 to $3.20. 

Newell Brands is a holding in Jim Cramer's Action Alerts PLUS Charitable Trust Portfolio. Want to be alerted before Cramer buys or sells NWL? Learn more now.

Hewlett Packard Enterprise Inc. (HPE) - Get Report  reported fiscal third-quarter earnings and sales that were stronger than expected. The technology solutions company posted adjusted earnings in the quarter of 30 cents a share on revenue of $8.21 billion. Wall Street was expecting profit of 26 cents a share on revenue of $7.5 billion.

Sales of HPE's enterprise group, which contains servers and storage and accounts for the bulk of revenue, rose 3% to $6.8 billion. Server revenue dropped 1%, but storage gained 11%. Revenue from HPE's networking products gained 16% and the technology services business rose 1%.

Trivago NV (TRVG) - Get Report shares staggered 22% lower on Wednesday after the hotel search engine slashed its third-quarter and full-year guidance. The company now anticipates full-year sales growth of roughly 40%. Trivago said in a statement that it has "algorithmically pulled back our performance marketing activities more than previously anticipated, which has resulted in a further slowdown in traffic and revenue growth from those channels." Fellow online travel companies Expedia Inc. (EXPE) - Get Report and Priceline Group Inc. (PCLN) were also lower. 

United Continental Holdings Inc. (UAL) - Get Report declined 2% on Wednesday after reducing a key revenue metric for its third quarter as it realizes the fallout from Hurricane Harvey and higher fuel expenses. For the third quarter, the airline anticipates passenger revenue per available seat mile to drop between 3% and 5%, worse than a previous range of down 1% to up 1%. Forecasts for fuel prices were raised to $1.72 to $1.77 per gallon, up from a previous $1.56 to $1.61. 

Kohl's Corp. (KSS) - Get Report added 5% after announcing that it will fit a number of its stores with a dedicated Amazon display. The Amazon smart home experience will be fitted into 10 stores in L.A. and Chicago beginning in October. Customers will be able to purchase Amazon products and smart home tech. 

CSX Corp. (CSX) - Get Report lowered its full-year profit guidance range following "operating challenges" in July and August. The railroad operator anticipates full-year earnings growth of 20% to 25%, compared to a previous target at the top-end of that range. In a statement, CEO Hunter Harrison said the company is "returning to a normal operating rhythm, and our performance metrics are improving." 

The U.S. trade deficit widened in July, though not at the pace anticipated. The deficit as of July came in at $43.7 billion from $43.5 billion in June. Economists expected the deficit to widen to $44.6 billion. Exports fell by 0.3%, while imports declined 0.2%.  

Services activity in August rose, though at a weaker pace than expected. The ISM non-manufacturing index increased to 55.3 in August from a previous reading of 53.9. Analysts expected an increase to 55.8. Any reading over 50 indicates expansion -- the measure has been above that level for 92 straight months. Business activity, new orders, and employment all increased. 

Updated from 1:41 p.m. ET, Sept. 6.

More of What's Trending on TheStreet: