An American flag hangs on the New York Stock Exchange (NYSE) on July 8, 2015 in New York City. Stocks were up in mid-day trading on Thursday, July 16, on positive corporate earnings and the passage of a deal that avoids an imminent exit of Greece from the eurozone. Spencer Platt/Getty Images

U.S. markets were up in midday trading Thursday as investors welcomed a raft of positive corporate earnings and applauded the Greek parliament's passage of a bailout deal that puts off concerns of an imminent "Grexit" from the eurozone currency bloc. The Standard & Poor's 500 index was nearing its all-time high amid positive earnings reports from Netflix Inc., Citigroup Inc. and others.

European stocks rallied after Greek lawmakers passed reforms demanded by creditors and the European Central Bank kept interest rates unchanged. U.S. Federal Reserve Chair Janet Yellen will appear before the Senate Banking Committee on Thursday afternoon to continue her semi-annual testimony on monetary policy. Meanwhile, the National Association of Home Builders/Wells Fargo builder sentiment index, a key monthly measure of U.S. economic health, showed that homebuilders are more confident than they have been since November 2005.

“It looks like the equity market likes the Greek settlement,” Ron Anari, senior vice president of trading at ICAP Plc, told Bloomberg. “At this stage of the game the Federal Reserve is in the driver’s seat, we’re going to see a hike sometime in September, and the equity market understands that. It’s expecting more positive economic news.”

The S&P 500 index (INDEXSP:.INX) edged up 12.06 points, or 0.57 percent, to 2,119.46, coming within 12 points of its all-time high struck on May 21. The index had shed nearly 4 percent since then over concerns about a Greek exit from the eurozone and a massive selloff in Chinese stocks, but has largely recovered since earlier this month. The Dow Jones Industrial Average (INDEXDJX:.DJI) gained 32.50 points, or 0.18 percent, to 18,082.67. The Nasdaq composite (INDEXNASDAQ:.IXIC) rose 48.88 points, or 0.96 percent, to 5,148.01.

Netflix Inc. (NASDAQ:NFLX) stocks continued to rally after the Internet television network posted record subscribers in its second quarter. The company gaining 15.66 percent to $113.50 by mid-day Thursday after leaping nearly 10 percent in extended-hours trading on Wednesday.

Intel Corp. (NASDAQ:INTC) shares gained 0.33 percent to $29.79 by mid-day Thursday after the tech giant reported Wednesday beating Wall Street’s estimates on second-quarter net profit and revenue.

Goldman Sachs Group Inc. (NYSE:GS) was trading down 1.47 percent to $209.82 Thursday morning after the New York-based investment bank reported that its second quarter profits were more than halved compared to the same quarter last year on mortgage-related litigation costs that increased five-fold compared to the same period last year.

Citigroup Inc. (NYSE:C) shares were up 3 percent to $58.26 after America’s third-largest bank reported Thursday the highest profit in eight years in its second quarter as restructuring and litigation costs plunged.

EBay Inc. (NASDAQ:EBAY) was up 4 percent to $65.98 after the global technology company reported better-than-expected earnings and before a major write-off. The company announced in its earnings report Thursday that it was spinning off its warehouse and logistics business to focus on its core Paypal payments service and its online marketplace.

UnitedHealth Group Inc. (NYSE:UNH) shares dropped 1.60 percent to $123.84 despite announcing Thursday better-than-expected second quarter profits and boosting its full-year profit forecast.