tensortrade.stochastic.processes.cox module

tensortrade.stochastic.processes.cox.cox(base_price: int = 1, base_volume: int = 1, start_date: str = '2010-01-01', start_date_format: str = '%Y-%m-%d', times_to_generate: int = 1000, time_frame: str = '1h', params: Optional[tensortrade.stochastic.utils.parameters.ModelParameters] = None) → pandas.core.frame.DataFrame[source]

Generates price data from the CIR process.

Parameters:
  • base_price (int, default 1) – The base price to use for price generation.
  • base_volume (int, default 1) – The base volume to use for volume generation.
  • start_date (str, default '2010-01-01') – The start date of the generated data
  • start_date_format (str, default '%Y-%m-%d') – The format for the start date of the generated data.
  • times_to_generate (int, default 1000) – The number of bars to make.
  • time_frame (str, default '1h') – The time frame.
  • params (ModelParameters, optional) – The model parameters.
Returns:

pd.DataFrame – The generated data frame containing the OHLCV bars.

References

[1] https://en.wikipedia.org/wiki/Cox%E2%80%93Ingersoll%E2%80%93Ross_model

tensortrade.stochastic.processes.cox.cox_ingersoll_ross_levels(params: tensortrade.stochastic.utils.parameters.ModelParameters) → numpy.array[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. We pass a correlated Brownian motion process into the method from which the interest rate levels are constructed because the returns between the underlying and the stochastic volatility should be correlated. The other correlated process is used in the Heston model.

Parameters:params (ModelParameters) – The parameters for the stochastic model.
Returns:np.array – The interest rate levels for the CIR process.