yabte.utilities.simulation
Weiner Process
Weiner process.
Weiner process \(W_t\) such that,
\(W_0 = 0\)
\(\forall t>0, u \ge 0, s<t \Rightarrow W_{t+u}-W_{t} \text{ independent of } W_s\)
\(W_{t+u}-W_{t}\sim {\mathcal {N}}(0,u)\)
\(W_t\) is continuous
- yabte.utilities.simulation.weiner.weiner_simulate_paths(n_steps: int, n_sims: int = 1, stdev: float | ndarray = 1, R: ndarray = array([[1]]), rng=None)[source]
Generate simulated Weiner paths.
stdev is the increment size, R a correlation matrix, n_steps is how many time steps, n_sims the number of simulations and rng a numpy random number generator (optional). If stdev is a scalar it will be broadcasted to the size of n_sims.
Geometric Brownian Motion
Geometric Brownian motion simulation.
Simulate stochastic process \(S_t\) where,
\[dS_t = \mu S_t dt + \sigma S_t dW_t\]where \(\mu\) is the drift, \(\sigma\) is the volatility and \(dW_t\) is a Weiner process.
- yabte.utilities.simulation.geometric_brownian_motion.gbm_simulate_paths(S0: float, mu: ndarray, sigma: ndarray, R: ndarray, T: int, n_steps: int, n_sims: int, rng=None)[source]
Generate simulated paths using vectorised numpy calls.
S0 is initial value, mu is the drift, sigma is volatility, R a correlation matrix, T is the time span, n_steps is how many time steps, n_sims the number of simulations and rng a numpy random number generator (optional).
TODO: support Euler–Maruyama / Milstein / Antithetic.
Heston Model
Heston Stochastic Volatility simulation.
Simulate stochastic process \(S_t\) where,
\[\begin{split}dS_t = \mu S_t dt + \sqrt{\nu_t} S_t dW_t^S \\ d\nu_t = \kappa(\theta - \nu_t) dt + \xi \sqrt{\nu_t} dW_t^{\nu}\end{split}\]where \(\mu\) is the drift, \(\nu_t\) is the variance (volatility squared) and \(dW_t^S\), \(dW_t^{\nu_t}\) are Weiner processes. \(\theta\) is long term variance and \(\kappa\) is mean reversion rate. \(xi\) is volatility of volatility.
- yabte.utilities.simulation.heston.heston_simulate_paths(S0: float, v0: float, mu: float, kappa: float, theta: float, xi: float, R: ndarray, T: int, n_steps: int, n_sims: int, rng=None)[source]
Generate simulated paths.
S0 and v0 are initial values, mu is the drift, xi is volatility of volatility, theta is long term variance, R a correlation matrix, T is the time span, n_steps is how many time steps, n_sims the number of simulations and rng a numpy random number generator (optional).
TODO: support Euler–Maruyama / Milstein / Antithetic.