* Top Republican lawmaker optimistic can avert fiscal crisis
* Getco, Virtu make rival bids for Knight Capital
* Costco to pay special dividend
* Dow up 0.5 pct, S&P 500 up 0.3 pct, Nasdaq up 0.3 pct
By Rodrigo Campos
NEW YORK, Nov 28 (Reuters) - U.S. stocks rose in volatile trade on Wednesday after comments from the top Republican in Congress on a possible compromise to avoid the "fiscal cliff" turned the market on its head.
House Speaker John Boehner, an Ohio Republican, said he was optimistic that a budget deal to avert large tax hikes and spending cuts currently under discussion in Washington could be reached. President Barack Obama, speaking later in the day, said he hoped to get a deal done in the next four weeks.
"The fiscal cliff is dominating the discussion, and short term, we're a little bit too optimistic on it being fixed right away," said John Manley, chief equity strategist for Wells Fargo Advantage Funds in New York.
The market has been swinging on headlines from Washington for weeks now, with Wednesday's gyrations once again highlighting the importance that Wall Street is giving to finding a solution to avoid the "fiscal cliff."
Liberals want tax increases on the wealthiest Americans to help balance the budget, while conservatives make a case for deep cuts in programs for the poor and a widening of the tax base to raise revenues without raising tax rates.
"Both (Democrats and Republicans) have potential to benefit from compromise. It's just a question of not losing face in the process," Manley said.
Boehner's words triggered a comeback in stocks after the S&P 500 fell 1 percent, partly on weak data on the housing sector.
Shares of Costco Wholesale Corp jumped 5.9 percent to $102.19 after the retailer became the latest company to announce a special dividend ahead of expected tax hikes that are part of the negotiations.
The Dow Jones industrial average rose 65.16 points, or 0.51 percent, to 12,943.29. The S&P 500 Index gained 4.71 points, or 0.34 percent, to 1,403.65. The Nasdaq Composite added 10.20 points, or 0.34 percent, to 2,977.99.
Housing stocks fell after data showed new U.S. single-family home sales fell slightly in October, while September's pace of sales was revised sharply lower.
The PHLX housing index slipped 0.6 percent, but is still up more than 8 percent in the last eight sessions.
Knight Capital Group Inc shares jumped 13.5 percent to $3.37 on news that Getco Holding proposed a $1.4 billion merger with Knight, while Virtu Financial offered to buy Knight for at least $1.1 billion.
Apparel retailer Express Inc rose 9.8 percent to $14.26 after it forecast strong earnings for the current quarter as lower prices and easy-to-understand discounts led to robust Black Friday sales.
Green Mountain Coffee Roasters stock surged 27.3 percent to $36.86 a day after it forecast quarterly and full-year earnings well ahead of analysts' expectations.