Model Overview
Learn more about the Balancer Pool model structure, and how to run simulations with cadCAD.
Balancer AMM Models and Simulations are built with cadCAD, an open-source Python package for designing, testing, and validating complex systems. In case you haven't used cadCAD yet, we highly recommend taking this beginner course and become familiar with cadCAD.
In Balancer Simulations V1.0 we demonstrate how real-world transactions can be routed through the Balancer Simulations model. Moreover, we add external price feeds to showcase how various data sources can be combined for a most realistic simulation scenario, while the prototyping effort for new Balancer Pool designs is minimized using a Python model. Additionally, we've used real-world transaction data to verify if the model is producing accurate and credible results.
We are following the cadCAD System Model standard, with
  • State Variables to describe the mathematical "state" of the pool
  • State Update Functions, changing the state variables in discrete events according to on-chain transactions and price updates
  • Policy Functions, defining the rules of the system, in our case mapping transactions to the right method in the model to update the state
  • Partial State Update Blocks, which are sets of state updates and policy functions
Simulations in V1.0 allows to combine four components:
A) on-chain transaction data of a Balancer pool you'd like to analyze, formatted as a series of actions in json format.
B) external price data, to add information on token prices in USD and analyse arbitrage opportunities, or metrics like Total Value Locked (TVL)
C) the general model of a Balancer Pool V1
D) and a Jupyter Notebook to tie together all elements, to customize simulations, plot charts and draw conclusions
Copy link