BATS Global Markets and Direct Edge are in talks over a potential merger that would create the No. 2 U.S. stock exchange, people close to the matter told FOX Business’s Charlie Gasparino.

The two companies, formed to challenge the dominance of NYSE Euronext (NYX) and Nasdaq OMX Group (NDAQ), each operate U.S. stock exchanges. BATS is the third-largest exchange, while Direct Edge is No. 4.

BATS  runs one of the largest pan-European markets and a U.S. stock-options exchange as well.

The combination would also create the largest cash-equities venue, although that business has been on the decline as derivatives trading and listings have taken prominence.

A merger would create the second-largest U.S. stock-market operator behind NYSE Euronext in terms of shares traded. The transaction would be subject to approval by the Securities and Exchange Commission and other regulators. 

Discussions between BATS and Direct Edge predated Thursday's halt of Nasdaq-listed securities and are therefore unrelated to the 'Flash Freeze,' the sources said.

A spokesperson for Direct Edge declined to comment. BATS didn’t immediately respond to a request for comment.

Last year, Jersey City, N.J.-based Direct Edge said it was in talks to be acquired by Canadian exchange group TMX Group. Those discussions fell apart and a group of Canadian banks and investment firms agreed to buy TMX in September 2012.

Talks between BATS and Direct Edge come at a time when NYSE is planning to complete its merger with IntercontinentalExchange (ICE) this fall.

Follow Matthew Rocco on Twitter @MatthewRocco