Stochastic Data¶
Generating Price Data using Stocastic Processes
- Geometric Brownian Motion (GBM)
- Fractional Brownian Motion (FBM)
- Heston Stochastic Volatility Model
- Cox Ingersoll Ross (CIR)
- Ornstein Uhlebneck stochastic process
Model Parameters
The model parameters class contains all of the parameters used by the following stochastic processes. The parameters have been prefixed with the name of the stochastic process they are used in. Calibration of the stochastic processes would involve looking for the parameter values which best fit some historical data.
all_s0
This is the starting asset valueall_time
This is the amount of time to simulate forall_delta
This is the delta, the rate of time e.g. 1/252 = daily, 1/12 = monthlyall_sigma
This is the volatility of the stochastic processesgbm_mu
This is the annual drift factor for geometric brownian motionjumps_lamda
This is the probability of a jump happening at each point in timejumps_sigma
This is the volatility of the jump sizejumps_mu
This is the average jump sizecir_a
This is the rate of mean reversion for Cox Ingersoll Rosscir_mu
This is the long run average interest rate for Cox Ingersoll Rossall_r0
This is the starting interest rate valuecir_rho
This is the correlation between the wiener processes of the Heston modelou_a
This is the rate of mean reversion for Ornstein Uhlenbeckou_mu
This is the long run average interest rate for Ornstein Uhlenbecksheston_a
This is the rate of mean reversion for volatility in the Heston modelheston_mu
This is the long run average volatility for the Heston modelheston_vol0
This is the starting volatility value for the Heston model
import random
import tensortrade.stochastic as sp
%matplotlib inline
Geometric Brownian Motion
data = sp.gbm(
base_price=100,
base_volume=5,
start_date="2010-01-01",
times_to_generate=1000,
time_frame='1H'
)
data.close.plot()
png
Heston Stochastic Volatility Model
data = sp.heston(
base_price=100,
base_volume=5,
start_date="2010-01-01",
times_to_generate=1000,
time_frame='1H'
)
data.close.plot()
png
Fractional Brownian Motion
data = sp.fbm(
base_price=100,
base_volume=5,
start_date="2010-01-01",
times_to_generate=1000,
time_frame='1H'
)
data.close.plot()
png
Cox Ingersoll Ross (CIR)
data = sp.cox(
base_price=100,
base_volume=5,
start_date="2010-01-01",
times_to_generate=1000,
time_frame='1H'
)
data.close.plot()
png
Ornstein Uhlenbeck Process
data = sp.ornstein(
base_price=100,
base_volume=5,
start_date="2010-01-01",
times_to_generate=1000,
time_frame='1H'
)
data.close.plot()
png