(New York) CNN Money — After five straight days of losses, stocks gained ground Thursday.
The Dow Jones industrial average, S&P 500 and Nasdaq ended slightly higher. The Dow and S&P 500 are about 2% from the record highs hit just last week.
Market sentiment has taken a hit in the past few days as investors worry about a possible government shutdown and the upcoming debt limit. Congress has less than a week to agree on a short-term funding bill to prevent a shutdown on Oct. 1, and despite all the squabbling, investors largely assume that lawmakers will reach a last-minute deal.
"Expectations are that a stop gap budget will once again be proposed and approved," said Tom Stringfellow, chief investment officer at Frost Investment Advisors.
Senate Majority Leader Harry Reid tried to use the recent dip in stocks to help convince lawmakers to come to an agreements.
"Five days in a row, the longest continuous period since 2012, the stock market has gone down and they all say it is a result of the fear of the government shutting down," he said on the Senate floor Thursday morning. "And why should the financial markets feel any differently? People are still speaking about closing the government!"
Earnings on the horizon: Though Washington is in the spotlight, investors will also soon turn their attention to third-quarter earnings .
Analysts expect earnings growth of 3.6% for the S&P 500 companies, according to S&P Capital IQ estimates. That would be the smallest increase in a year. But revenue is forecast to grow by 4.8%, the best pace in over a year.
Nike, one of the newest members of the Dow, will release its latest quarterly results after the closing bell.
What's moving: Facebook shares hit an all-time high above $50 a share. Shares have nearly doubled since Facebook's second-quarter earnings report in July that reassured investors about the company's mobile strategy. The rally marks a sharp reversal for the stock , which was a big disappointment after its botched May 2012 IPO.
"$FB Smoking!," commented StockTwits users smarterthanyou. "How quickly disdain can turn to ravenous passion. $FB has gone from the most hated to one of the most adored."
Yahoo shares rose to a 6-year high of $33 a share, the same price that Microsoft bid for the company in 2008. Yahoo is in the midst of a turnaround, led by CEO Marissa Mayer. Plus, the stock has been getting extra attention as investors anticipate the upcoming IPO of Alibaba. Yahoo owns 24% of Alibaba, making it the second largest shareholder in the company.
"The Yahooligans just keep winning, well deserved, hard turnaround but it seems like they are on track, and Alibaba going public $YHOO," said LDrogen on StockTwits.
StockTwits trader Cow added, "Buy $YHOO = buy a piece of alibaba before the IPO."
Shares of eBay jumped after the company said it will buy online payment platform Braintree for $800 million, and will combine it with PayPal. Traders were optimistic about the acquisition.
"$EBAY Braintree deal pretty much guarantee that Paypal hits their annual transaction goals by 2015," said crosenfield, noting that Braintree will benefit as its customers like AirBNB, Uber and OpenTable continue to grow.
J.C. Penney shares bounced back Thursday after J.C. Penney CEO Mike Ullman reportedly told investors that the company won't need to raise capital this year, according to CNBC. On Wednesday, the stock plunged 15% following reports that the retailer might seek $1 billion through a stock sale.
In a statement Thursday morning, J.C. Penney said it is "pleased thus far in the company's turnaround efforts," and added that it expects to book positive same-store sales during the third and fourth quarters.
But some StockTwits users remained skeptical.
"$JCP I want to believe in a turnaround but who really thinks $JCP has anything competitive except price?" asked zwischler. "Their clothes are not great brands."