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 cadCADarrow-up-right, 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 coursearrow-up-right 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 resultsarrow-up-right.

We are following the cadCAD System Model standardarrow-up-right, 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.

Adding On-chain Transaction Data and USD Priceschevron-right

B) external price data, to add information on token prices in USD and analyse arbitrage opportunities, or metrics like Total Value Locked (TVL)

Adding On-chain Transaction Data and USD Priceschevron-right

C) the general model of a Balancer Pool V1

Balancer: the Python editionchevron-right

D) and a Jupyter Notebook to tie together all elements, to customize simulations, plot charts and draw conclusions

Pool Explorationchevron-right

Last updated

Was this helpful?