The math behind cross-exchange arbitrage trading