Do market makers use machine learning?
Today we take a look at a paper from the brilliant Professor Sebastian Jaimungal of the University of Toronto’s Department of Statistics! See our list Top 10 Machine Learning Minds on Wall Street 2022 & How do you construct a volatility surface?
The paper, entitled : ‘Optimal Trading in Automatic Market Makers with Deep Learning‘ with co-authors:
Yuri Saporito of Getulio Vargas Foundation (FGV) – EMAp – School of Applied Mathematics. Max O. Souza of UFF – Universidade Federal Fluminense – Instituto de Matemática e Estatística. Yuri Thamsten of UFF – Universidade Federal Fluminense – Instituto de Matemática e Estatística
The works focuses on; “the optimisation of trading strategies in Constant Function Market Makers (CFMMs) and centralised exchanges. develop a model that accounts for the interaction between these two markets, estimating the conditional dependence between variables using the concept of conditional elicibility.”
Firstly, what is a ‘Constant Function Market Maker?
A constant function market maker (CFMM) is a type of automated market maker (AMM) that provides liquidity to decentralized exchanges (DEXs). CFMMs are designed to maintain a constant ratio between two assets in a liquidity pool, allowing traders to buy or sell either asset at any time.
Unlike traditional market makers, who use their own capital to buy and sell assets in order to maintain a balanced market, CFMMs use a mathematical formula to determine the price of each asset in the liquidity pool. This formula takes into account the current ratio of each asset and the amount of liquidity in the pool, ensuring that the price of each asset remains stable and predictable.
CFMMs become particularly well-suited for DEXs because they can operate autonomously!
As a result, require no central authority to manage. This allows for trustless trading between buyers and sellers, as well as lower transaction fees and faster settlement times.
One of the most popular CFMMs is Uniswap. Launched in 2018 and quickly rose to become one of the most popular DEXs in the cryptocurrency market!
Uniswap uses a variant of the constant function formula known as the x*y=k model. Where x and y represent the amount of each asset in the pool. And k is a constant value determined by the total value of the pool.
While CFMMs have proven to be a popular and effective way of providing liquidity to DEXs, they are not without their limitations. Because CFMMs rely on mathematical formulas to determine asset prices, they may not be able to respond quickly to sudden market shifts or price volatility. Additionally, CFMMs may be vulnerable to manipulation by traders who are able to game the formula to their advantage.
Furthermore, “pose an optimal execution problem where the agent hides their orders by controlling the rate at which they trade.” And, “without approximating the market dynamics. The resulting dynamic programming equation is not analytically tractable, therefore, we employ the deep Galerkin method to solve it.”
The Galerkin method is a numerical technique used to solve partial differential equations (PDEs). It is named after Boris Galerkin, a Russian mathematician who developed the method in the early 20th century. The Galerkin method is a popular and powerful technique for solving a wide range of PDEs, including elliptic, parabolic, and hyperbolic equations.

Unknown – Creation date: 1941 Original Publication: unknown Immediate source: http://goskatalog.ru/portal/#/collections?id=5973937
At a high level, the Galerkin method works by approximating the solution to a PDE using a finite-dimensional subspace of the full solution space.
SerSem – Own work
This subspace is typically chosen to be spanned by a set of basis functions, such as polynomials or trigonometric functions. The basis functions are chosen based on the structure of the PDE and the geometry of the domain on which it is defined.
To apply the Galerkin method, one first obtains a weak formulation of the PDE.
This involves multiplying the PDE by a test function, integrating over the domain, and applying integration by parts. The resulting equation is a system of linear equations involving the coefficients of the basis functions.
The Galerkin method then involves choosing a suitable set of basis functions and solving the resulting system of linear equations for the coefficients. Once the coefficients become obtained, the approximate solution to the PDE becomes reconstructed by evaluating the basis functions at the points in the domain.
The Galerkin method has several advantages over other numerical methods for solving PDEs. A general-purpose method applicable to a wide range of problems, and it is highly accurate when a sufficiently large number of basis functions are used. The method also has good stability properties, meaning that small errors in the input data or numerical approximations do not cause the solution to diverge.
Despite its advantages, the Galerkin method does have some limitations. Specifically, the accuracy of the method depends on the choice of basis functions. In addition, the computational cost can become high for problems with complex geometries or large domains.
In conclusion, the researchers, “conduct numerical experiments and illustrate that the optimal strategy is not prone to price slippage and outperforms naive strategies.”
Download the full paper: Optimal Trading in Automatic Market Makers with Deep Learning by Sebastian Jaimungal, Yuri Saporito, Max O. Souza, Yuri Thamsten :: SSRN
Do market makers use machine learning?



