# Forward Testing with Monte Carlo

### How Monte Carlo can be used to simulate the future price of ETH.

We all know backtesting, but how about forward testing?

This is the first of a series of #ResearchBites tutorials where we discuss methods for simulating cryptos prices.

Let's explore! ๐งต

๐ฒ We will devote the first thread in this series to the Monte Carlo (MC) method.

๐ MC method is a simulation technique used to model the behavior of complex systems like crypto prices, markets, LP positions, etc.

๐๐ป Useful when a direct prediction is not possible.

It works by repeating three simple steps:

Sample from a probability distribution that represents our understanding of the underlying system ๐ฒ

Repeat this process many times ๐

Take the average of some quantity of interest over all these simulations ๐ค

๐๐ปMeant to simulate events that are unpredictable & can only be simulated using random number generation. In the case of crypto, this could involve estimating values for asset volatility, drift, etc., and then using these values to simulate future price movements of an asset.

By repeating steps 1-3 multiple times, we can generate a large number of different scenarios for the future price of the asset. This allows us to understand the potential range of outcomes and estimate the likelihood of different price levels.

Let's consider a simple example:

Suppose Alice is standing at a position x0, and that she takes one step to the right or to the left each w/ 50% chance.

Questions:

Where do we expect Alice to be after N steps?

How likely is it for her to get 20 steps away from x0?

๐can be answered using MC!

Simulate Alice's random path for N steps, M times (M large)

Take the mean of her position after N steps, and the # of times she was 20 steps away from x0.

Taking M=1000, N=100 yields:

Expected position โ 0.0

Prob. 20 steps away = 6.8%

Monte Carlo simulations can also be used to generate Value-at-Risk (VaR) measures, which indicate the maximum potential loss that an investment in a crypto asset could experience over a given time horizon. Read more about VaR measures here ๐

A standard model to simulate asset prices is the so-called Geometric Brownian Motion (GBM). It assumes that the rate of change of the price of an asset follows a random walk with constant volatility and a drift term representing the expected return. In math-y terms, let S denote an asset with price process {S}. Furthermore, let ฮผ denote the *drift * parameter of the price process and ฯ>0 its *volatility, *and let W denote the standard Wienner process. We say that {S} follows a Geometric Brownian motion (GBM) if {S} satisfies the following stochastic differential equation:

Given an initial price S0, it follows from Itoโs lemma that

An exemplary #Python implementation to sample a price process S modeled as a GBM is shown below ๐ป

mu= drift

sigma = volatility

T = time horizon

N = number of steps

S0 = price at time 0

Let's use our code to simulate the daily ETH price for the next year!

Example: ETH price

๐ฎ We simulate 1000 prices, 1 year into the future

๐ค sigma = 0.845, mu = -0.47 from historical data

๐ 95% VaR, yearly= -49%

๐ 95% CVaR, yearly = -72%

๐ฒ Probability of price > $3,000 at any time = 12%

Comments ๐

ฮผ & ฯ influenced by the time period they're estimated (e.g., negative drift due to ๐ last April)

Useful to reassess ๐ with different parameter values!

VaR and CVaR are worst-case scenarios (95% confidence)๐ & useful metrics to mange risks/hedge ๐

ฮผ & ฯ can be made stochastic, too โ more powerful model

MC can be used to price options & estimate Greeks

We used GBM model, which might not be suitable for pools or stablecoins, see๐

Can we use MC to simulate these? We'll discuss in future #ResearchBites! ๐

Summary:

MC is a simulation-based approach to modeling complex systems like crypto prices.

Provides valuable insights into potential outcomes & risk levels.

While not perfect & can be influenced by the assumptions, it remains a very valuable tool!