samplepaths¶
samplepaths is a Python package for generating realizations (sample
paths) of stochastic processes as numpy arrays. It is pure Python on
numpy, and for large simulations as fast as compiled code.
from samplepaths import BrownianMotion
bm = BrownianMotion(drift=1, scale=2, t=10)
path = bm.sample(1000) # 1001 values on [0, 10]
paths = bm.sample_paths(1000, paths=5000) # 5000 realizations at once
paths = bm.sample_paths(1000, paths=50_000, workers=8) # on 8 threads
It provides 68 processes in six families, all sharing one small interface:
Continuous-time Processes, such as Brownian motion, the Poisson and the Hawkes processes, the gamma process and jump diffusions
Diffusion Processes, such as the Vasicek, Cox-Ingersoll-Ross and Jacobi models and their fractional counterparts
Discrete-time Processes, such as Markov chains and random walks
Time Series Models, such as the ARIMA and the GARCH models
Processes with Several Components, such as correlated Brownian motions, the Heston and SABR models and interest rate models with two factors
Noise Processes, such as Gaussian, fractional Gaussian and colored noise
samplepaths is an independently maintained fork of
stochastic by Christopher Flynn,
modernized for current Python, numpy and scipy releases and shipped
with type hints. See About the Project for what the fork adds and
Migrating from stochastic for the changes needed to port existing code.
samplepaths is maintained by Bassem Girgis.
Getting started
User guide
Reference
Project