# Model Overview

Balancer AMM Models and Simulations are built with [**cadCAD**](https://cadcad.org/), 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](https://www.cadcad.education/) 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](https://token-engineering-balancer.gitbook.io/balancer-simulations/additional-code-and-instructions/balancer-the-python-edition/model-verification-and-limitations).

&#x20;We are following the[ cadCAD System Model standard](https://github.com/cadCAD-org/cadCAD/tree/master/documentation), 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

![](https://3783327733-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MRsZ0HLNwm4Q6a-HrJx%2F-MUrJB_j6G9hr3g_4zNT%2F-MUrmmW9yGEcz_XJp2H3%2FBalancerAMM_software_architecture.png?alt=media\&token=ad562eae-fe77-4776-aca8-0b198bec911a)

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.

{% content-ref url="../additional-code-and-instructions/onchaintransactions" %}
[onchaintransactions](https://token-engineering-balancer.gitbook.io/balancer-simulations/additional-code-and-instructions/onchaintransactions)
{% endcontent-ref %}

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

{% content-ref url="../additional-code-and-instructions/onchaintransactions" %}
[onchaintransactions](https://token-engineering-balancer.gitbook.io/balancer-simulations/additional-code-and-instructions/onchaintransactions)
{% endcontent-ref %}

C) the general **model of a Balancer Pool V1**

{% content-ref url="../additional-code-and-instructions/balancer-the-python-edition" %}
[balancer-the-python-edition](https://token-engineering-balancer.gitbook.io/balancer-simulations/additional-code-and-instructions/balancer-the-python-edition)
{% endcontent-ref %}

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

{% content-ref url="pool-exploration" %}
[pool-exploration](https://token-engineering-balancer.gitbook.io/balancer-simulations/balancer-simulations/pool-exploration)
{% endcontent-ref %}
