The New York Stock Exchange, part of Atlanta-based Intercontinental Exchange, said Wednesday that it is buying the National Stock Exchange.

The Jersey City, N.J.-based National Stock Exchange is an all-electronic market for trading stocks and exchange-traded funds, or ETFs, that has been struggling for years.

It was set to cease trading on Friday.

The acquisition continues a years-long buying campaign by Intercontinental Exchange, also known as ICE,that made it the world's largest securities market operator in terms of revenues.

ICE said the National Stock Exchange will continue its trading operations as a result of the deal. ICE did not disclose the terms of the acquisition, which is expected to close in the first quarter of next year.

ICE said the deal, which is subject to the Securities and Exchange Commission’s approval, will give the company a fourth licence to operate a securities exchange in the U.S.

The 131-year-old National Stock Exchange got its start in Cincinnati as the Cincinnati Stock Exchange, but has moved and changed ownership several times.

It moved its headquarters to Chicago in 1995 and later changed ownership and changed its name to the National Stock Exchange.

After it moved to New Jersey, the NSE was bought by the CBOE Stock Exchange in 2011. It shut down trading in 2014, only to re-open last year under new ownership.