# CFMM Optimal Routing

This repository contains the code needed to generate the figures used in the paper Optimal Routing for Constant Function Market Makers.

## Requirements

The requirements for running these examples are:

`NumPy`

`Matplotlib`

`Cvxpy`

(see here for installation)

In order to generate the figures as done in the paper you will also need a working TeX distribution.

## How to run

All examples are self-contained and can be run directly, e.g.:

`python arbitrage.py`

The figures were generated by running

`python two-asset.py`

but note that this requires a working TeX distribution. (This can be avoided by commenting out any call to `latexify`

in `two-asset.py`

which requires `ps`

as a backend for plotting.)