RandomDataProvider#

class RandomDataProvider(tickers=None, start=datetime.datetime(2016, 1, 1, 0, 0), end=datetime.datetime(2016, 1, 30, 0, 0), seed=None)[source]#

Bases: BaseDataProvider

Pseudo-randomly generated mock stock-market data provider.

Parameters:
  • tickers (str | List[str] | None) – tickers

  • start (datetime) – first data point

  • end (datetime) – last data point precedes this date

  • seed (int | None) – optional random seed

Methods

get_coordinates()#

Returns random coordinates for visualisation purposes.

Return type:

Tuple[ndarray, ndarray]

get_covariance_matrix()#

Returns the covariance matrix.

Returns:

an asset-to-asset covariance matrix.

Raises:

QiskitFinanceError – no data loaded

Return type:

ndarray

get_mean_vector()#

Returns a vector containing the mean value of each asset.

Returns:

a per-asset mean vector.

Raises:

QiskitFinanceError – no data loaded

Return type:

ndarray

get_period_return_covariance_matrix()#

Returns a vector containing the mean value of each asset.

Returns:

a per-asset mean vector.

Raises:

QiskitFinanceError – no data loaded

Return type:

ndarray

get_period_return_mean_vector()#

Returns a vector containing the mean value of each asset.

Returns:

a per-asset mean vector.

Raises:

QiskitFinanceError – no data loaded

Return type:

ndarray

get_similarity_matrix()#

Returns time-series similarity matrix computed using dynamic time warping.

Returns:

an asset-to-asset similarity matrix.

Raises:

QiskitFinanceError – no data loaded

Return type:

ndarray

run()[source]#

Generates data pseudo-randomly, thus enabling get_similarity_matrix and get_covariance_matrix methods in the base class.