  Automated market makers (AMMs) are a new prototype of decentralised exchanges
which are revolutionising market interactions. The majority of AMMs are
constant product markets (CPMs) where exchange rates are set by a trading
function. This work studies optimal trading and statistical arbitrage in CPMs
where balancing exchange rate risk and execution costs is key. Empirical
evidence shows that execution costs are accurately estimated by the convexity
of the trading function. These convexity costs are linear in the trade size and
are nonlinear in the depth of liquidity and in the exchange rate. We develop
models for when exchange rates form in a competing centralised exchange, in a
CPM, or in both venues. Finally, we derive computationally efficient strategies
that account for stochastic convexity costs and we showcase their out-of-sample
performance.
