tensortrade.stochastic.processes.gbm module

tensortrade.stochastic.processes.gbm.gbm(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 a GBM 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/Geometric_Brownian_motion

tensortrade.stochastic.processes.gbm.geometric_brownian_motion_levels(params: tensortrade.stochastic.utils.parameters.ModelParameters)[source]

Constructs a sequence of price levels for an asset which evolves according to a geometric brownian motion process.

Parameters:params (ModelParameters) – The parameters for the stochastic model.
Returns:np.array – The price levels for the asset
tensortrade.stochastic.processes.gbm.geometric_brownian_motion_log_returns(params: tensortrade.stochastic.utils.parameters.ModelParameters) → numpy.array[source]

Constructs a sequence of log returns.

When log returns are exponentiated, it produces a random Geometric Brownian Motion (GBM). The GBM is the stochastic process underlying the Black-Scholes options pricing formula.

Parameters:params (ModelParameters) – The parameters for the stochastic model.
Returns:np.array – The log returns of a geometric brownian motion process