Small repo, where an agent learns to trade against a constant product market with constant fees.
Code for the paper The Case for Variable Fees in Constant Product Markets: An Agent Based Simulation, accepted at defi'22.
Abstract:
We are interested in how the relationship between the fee in constant a product market (CPM)
and the volatility of the swapped pair on other liquid exchanges influences the losses / gains
of the liquidity providers. We review three classical market making models: Glosten and
Milgrom, Kyle and Grossman and Miller and note that these very different models there is always
a relationship between volatility and how rational market makers set prices. Motivated by this
we set up an agent based model to explore this in the con- text of CPMs like Uniswap.
We conclude that if the fee is too low relative to the volatility of the traded pair then the
liquidity providers will end up making a loss over the medium term. From this we go to suggesting that
CPM markets need to let liquidity providers set the fee via a governance mechanism especially as
volatilities of assets fluctuate. The code for all simulations is available at https://github.com/kGFRqao2/cpmagentbasedsim.