gs_quant.timeseries.statistics.generate_series

generate_series(length, direction=Direction.START_TODAY)[source]

Generate sample timeseries

Parameters:
  • length (int) – number of observations

  • direction (Direction) – whether generated series should start from today or end on today

Return type:

Series

Returns:

date-based time series of randomly generated prices

Usage

Create timeseries from returns generated from a normally distributed random variables (IDD). Length determines the number of observations to be generated.

Assume random variables \(R\) which follow a normal distribution with mean \(0\) and standard deviation of \(1\)

\(R \sim N(0, 1)\)

The timeseries is generated from these random numbers through:

\(X_t = (1 + R)X_{t-1}\)

Examples

Generate price series with 100 observations starting from today’s date:

>>> prices = generate_series(100)

See also

numpy.random.normal()