I have been delighted to collaborate with Alexander Lipton on a paper where we develop a quantitative approach for making arbitrage-free pricing between decentralized exchanges (DEX), relying on Automated Market Making (AMM), and traditional exchanges, relying on the order book. As a very relevant case for developing central bank digital coins (CBDC) on interoperable blockchains, we simulated our model using high-frequency FX data from a traditional exchange to validate our approach.
This post is a small communication of the background and key results from our paper that can be downloaded from SSRN https://ssrn.com/abstract=3939695
Automated Market Making
Automated market making (AMM) for crypto asset has become one of the most interesting developments in the Decentralized Finance (DeFi) space.
Vitalik Buterin, the founder of Ethereum protocol, originally proposed AMM in 2016 as a concept to exchange on-chain assets on decentralized exchanges which operate entirely on-chain . The purpose was to reduce the spreads and gas fees, that had been excess of 10% at the time. The solution was suggested to create two-sided pools of different coins (for an example, ETH vs BTC) and to fix the exchange rate relative to the pool depth (liquidity).
This concept was formalized by the Uniswap protocol that introduced the so-called constant function market maker (CFMM) using product rule as for marginal pricing of one token vs the other by mean of smart contracts (SC).
The AMM is an interesting concept like a dark pool (in a good sense) where investors can place a large orders and get immediate executions without revealing their intentions prior to their trades.
In Figure 1, I show the relative pricing of a representative USDC-EUDC (US Dollar – Euro) pool (the initial parameters are EUR/USD rate of 1.25) using the three CFMM rules:
- Sum rule that allows to swap full balances of one token into another so that the change in the relative rate is a constant.
- Product rule that fixes the relative exchange rate inversely proportional to pool balances. Outside of the equilibrium rate of 0.8 EUDC per 1.0 USDC, the relative rate of EUDC will decline or increase faster than the constant exchange rate
- Mixed rule with a parameter alpha which is a blended rule between the sum and the product rule.
Bid/Ask marginal rates
Using the CFMM we can derive the marginal exchange rates as functions of the ratio of the order size to the pool liquidity. This is a very convenient feature that enables to explicitly assign the exchange rate to each order size.
In Figure 2, I show the marginal AMM rates as functions of the CFMM specification. I use the EUR-USD FX spot of 1.25 and equivalent USD-EUR spot of 0.8. Then we can present a representative bid/ask book for trading in both EUDC and USDC from the same USDC-EUDC pool.
It follows that the sum rule enforces no feedback from pool liquidity for the marginal exchange (zero slippage costs) while the product rule produces strong feedback from the pool liquidity (slippage costs proportional to the ratio of traded order to the pool liquidity). By introducing the mixed rule with a parameter alpha between 0 (product rule) and infinity (sum rule), we can design flexible CFMM.
One of the most interesting challenges for on-chain exchanging of different CBDCs is how to avoid arbitrage opportunities between on-chain exchanges and traditional markets. We solve this problem by introducing a pool arbitrageur (either a pool operator or designated market-maker) who follows an optimization problem to arbitrage opportunities between the on-chain pool and traditional markets. Because of the pool arbitrageur, the pool bid/ask spreads for small orders are consistent with a traditional exchange.
We apply our model for simulation of hypothetical CBDC pools using actual high-frequency data FX data. In Figure 3, I show the simulation of USDC-EUDC pool using intraday EUR-USD FX spot rate on 3rd June 2021. For convenience, I normalize the sport FX rate to 1.0 at the start of the trading session. I apply the constant product CFMM.
In the first panel I show the optimal pool balances that are determined by the pool arbitrageur to exclude arbitrage between the pool and the FX spot rate. In the second panel I show the bid/ask spreads for trading 1bp of the pool liquidity. We see that the actual FX spot rate is sandwiched between the AMM bid/ask rates. The final figure is the arbitrage profits.
Application to G-10 currencies
As as a final validation, we also included the volumes for simulations of CBDC pools using the actual FX buy and sell orders. Intraday volumes are normalized so that the pool daily turnover is 100% for each day in our sample of last 3 years of FX data.
In the Figure 4, I show the boxplot of key variables from the simulation of the CBDC pools for G-10 currencies including the Chinese Yuan. I apply the mixed rule CFMM with alpha equal to 5 and the transaction fees of 1bp.
In the first panel, I show the volume-weighted average bid-ask spread. The average spread is about 1.3 across all FX pair, which is competitive to traditional FX markets. The second panel shows the annual P&L (daily P&L multiplied by 260). The last panel shows the Hedged P&L which is produced by hedging the spot exposure or equivalent by allocation to the pool using borrowed CBDCs. It is clear that liquidity providers benefit from both pool fees and the convexity generated by the trading volumes
Automated market making is one of the core elements for on-chain exchange of digital assets. Of course, one of the most important questions is the arbitrage between on-chain and off-chain exchanges. Alexander Lipton and myself have developed a quantitative approach in this direction.
Lipton, A. and Sepp, A., Automated Market-Making for Fiat Currencies (2021). Working Paper, available at SSRN: https://ssrn.com/abstract=3939695