Instantly share code, notes, and snippets.

What would you like to do?
import math
import numpy
import random
import decimal
import scipy.linalg
import numpy.random as nrand
import matplotlib.pyplot as plt
Note that this Gist uses the Model Parameters class found here -
def brownian_motion_log_returns(param):
This method returns a Wiener process. The Wiener process is also called Brownian motion. For more information
about the Wiener process check out the Wikipedia page:
:param param: the model parameters object
:return: brownian motion log returns
sqrt_delta_sigma = math.sqrt(param.all_delta) * param.all_sigma
return nrand.normal(loc=0, scale=sqrt_delta_sigma, size=param.all_time)
def brownian_motion_levels(param):
Returns a price sequence whose returns evolve according to a brownian motion
:param param: model parameters object
:return: returns a price sequence which follows a brownian motion
return convert_to_prices(param, brownian_motion_log_returns(param))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment