After five straight days of losses, stocks gained ground Thursday.

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(NKE), one of the newest members of the Dow, released its latest quarterly results after the closing bell. Shares jumped in after-hours trading as the company's earnings topped forecasts. Investors were also impressed by the company's growth in future orders, which is an indication that sales should be strong for the next few months.

What's moving:Facebook(FB) 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."

Oracle is losing America's Software Cup

Yahoo(YHOO) shares rose to a 6-year high of $33 a share, the same price that Microsoft(MSFT) 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.

Shares of eBay(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(OPEN) continue to grow.

J.C. Penney (JCP)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."