Nasdaq has agreed to buy a London-based software company that uses artificial intelligence to sniff out rogue traders, as the US group seeks to acquire cutting edge technology under its new chief executive.