tensortrade.stochastic.processes.heston module

tensortrade.stochastic.processes.heston.cox_ingersoll_ross_heston(params)[source]

Constructs the rate levels of a mean-reverting cox ingersoll ross process. Used to model interest rates as well as stochastic volatility in the Heston model. The returns between the underlying and the stochastic volatility should be correlated we pass a correlated Brownian motion process into the method from which the interest rate levels are constructed. The other correlated process are used in the Heston model.

Parameters:params – ModelParameters The parameters for the stochastic model.
Returns:The interest rate levels for the CIR process
tensortrade.stochastic.processes.heston.geometric_brownian_motion_jump_diffusion_levels(params)[source]

Converts a sequence of gbm jmp returns into a price sequence which evolves according to a geometric brownian motion but can contain jumps at any point in time.

Parameters:params (ModelParameters) – ModelParameters The parameters for the stochastic model.
Returns:The price levels
tensortrade.stochastic.processes.heston.geometric_brownian_motion_jump_diffusion_log_returns(params)[source]

Constructs combines a geometric brownian motion process (log returns) with a jump diffusion process (log returns) to produce a sequence of gbm jump returns.

Parameters:params (ModelParameters) – ModelParameters The parameters for the stochastic model.
Returns:A GBM process with jumps in it
tensortrade.stochastic.processes.heston.get_correlated_geometric_brownian_motions(params, correlation_matrix, n)[source]

Constructs a basket of correlated asset paths using the Cholesky decomposition method.

Parameters:
  • params (ModelParameters) – ModelParameters The parameters for the stochastic model.
  • correlation_matrix (array) – np.array An n x n correlation matrix.
  • n (int) – int Number of assets (number of paths to return)
Returns:

n correlated log return geometric brownian motion processes

tensortrade.stochastic.processes.heston.heston(base_price=1, base_volume=1, start_date='2010-01-01', start_date_format='%Y-%m-%d', times_to_generate=1000, time_frame='1h', params=None)[source]
tensortrade.stochastic.processes.heston.heston_construct_correlated_path(params, brownian_motion_one)[source]

This method is a simplified version of the Cholesky decomposition method for just two assets. It does not make use of matrix algebra and is therefore quite easy to implement.

Parameters:
  • params (ModelParameters) – ModelParameters The parameters for the stochastic model.
  • brownian_motion_one (array) – np.array (Not filled)
Returns:

A correlated brownian motion path.

tensortrade.stochastic.processes.heston.heston_model_levels(params)[source]

NOTE - this method is dodgy! Need to debug! The Heston model is the geometric brownian motion model with stochastic volatility. This stochastic volatility is given by the cox ingersoll ross process. Step one on this method is to construct two correlated GBM processes. One is used for the underlying asset prices and the other is used for the stochastic volatility levels.

Parameters:params – ModelParameters The parameters for the stochastic model.
Returns:The prices for an underlying following a Heston process
tensortrade.stochastic.processes.heston.jump_diffusion_process(params)[source]

Produces a sequence of Jump Sizes which represent a jump diffusion process. These jumps are combined with a geometric brownian motion (log returns) to produce the Merton model.

Parameters:params (ModelParameters) – ModelParameters The parameters for the stochastic model.
Returns:jump sizes for each point in time (mostly zeroes if jumps are infrequent)