Simulation Engine

Runs simulations of the Concrete protocol to predict its outcomes.

Introduction

The simulation engine is a python library that replicates the logic and business rules of the Concrete Protocol. Given a price trajectory, and a set of assumptions and parameters, the simulation engine outputs metrics to understand the outcomes of the protocol.

For now, it is used to:

  • Test and validate the business logic of the protocol.

  • Measure and manage our portfolio metrics.

  • Design or fine tune decisioning and pricing strategies.

  • Produce data insights and serve as a business intelligence tool.

How it works

Single Scenario Mode

In single scenario mode, the process is the following:

  1. The user provides a price trajectory, including the prices per token, lending market interests rates and slippage statistics.

  2. The user provides a set of assumptions and parameters, covering market environment, user behavior, and Concrete protocol parameters.

  3. Simulates borrowing, buying policies, claims, repayments, defaults, all according to the rules of the protocol, hour by hour, until it reaches the end of the scenario.

  4. Outputs logs and metrics to describe the outcome of the scenario.

Montecarlo Scenario Mode

In Montecarlo mode, the process builds up on the single mode:

  1. Generate N scenarios with price lines and user behaviours randomly drawn from the input distributions over a number of days, for example 365 days.

  2. Run each scenario just like single scenario mode.

  3. Aggregate the results from all runs and outputs probabilities for different outcomes.

By aggregating all the simulation runs, we can get:

  • Median and average values (=expectation)

  • Bottom 95% and 99% percentiles (=VaR)

  • Worst values (=Black Swan)

Therefore, the outputs of the simulation engine can provide financial reports and forecasts backed by confidence intervals, allowing the protocol to measure and manage risk.

Integration within the Product Ecosystem

The simulation engine is a component of the Internal/Portfolio Metrics Service, and will be integrated as python code into the service itself to produce some of its IR-Scores.

It can also be executed from a jupyter notebook: examples.

Last updated