Inspired by Emilio's talk on GHO and Decentralized Stablecoins, this project attempts to show how PIDs can be used to control the borrow rates of a token to try to keep the value of the token pegged to a pre-defined value.
Users and their behaviors are simulated using Monte Carlo method. For example, their wallet is given 0 to 1000 USD in a uniform random distribution. External events (both positive and negative) happen at each epoch with their intensity being sampled according to a normal distribution. Users' instinct (whether the current value is high or low) is also sampled according to a normal distribution.
The project is made in Python3 using Jupyter Notebooks. It uses numpy and matplotlib for necessary functionalities.
There are three major pieces: