Skip to main contentIBM Quantum Documentation
This page is from an old version of Qiskit SDK and does not exist in the latest version. We recommend you migrate to the latest version. See the release notes for more information.

qiskit.finance.data_providers.RandomDataProvider

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

GitHub

Pseudo-randomly generated mock stock-market data provider.

Initializer :type tickers: Union[str, List[str], None] :param tickers: tickers :type start: datetime :param start: first data point :type end: datetime :param end: last data point precedes this date :type seed: Optional[int] :param seed: shall a seed be used?

Raises

MissingOptionalLibraryError – Pandas not installed

__init__

__init__(tickers=None, start=datetime.datetime(2016, 1, 1, 0, 0), end=datetime.datetime(2016, 1, 30, 0, 0), seed=None)

Initializer :type tickers: Union[str, List[str], None] :param tickers: tickers :type start: datetime :param start: first data point :type end: datetime :param end: last data point precedes this date :type seed: Optional[int] :param seed: shall a seed be used?

Raises

MissingOptionalLibraryError – Pandas not installed


Methods

__init__([tickers, start, end, seed])Initializer :type tickers: Union[str, List[str], None] :param tickers: tickers :type start: datetime :param start: first data point :type end: datetime :param end: last data point precedes this date :type seed: Optional[int] :param seed: shall a seed be used?
get_coordinates()Returns random coordinates for visualisation purposes.
get_covariance_matrix()Returns the covariance matrix.
get_mean_vector()Returns a vector containing the mean value of each asset.
get_period_return_covariance_matrix()Returns a vector containing the mean value of each asset.
get_period_return_mean_vector()Returns a vector containing the mean value of each asset.
get_similarity_matrix()Returns time-series similarity matrix computed using dynamic time warping.
run()Generates data pseudo-randomly, thus enabling get_similarity_matrix and get_covariance_matrix methods in the base class.

get_coordinates

get_coordinates()

Returns random coordinates for visualisation purposes.

Return type

Tuple[float, float]

get_covariance_matrix

get_covariance_matrix()

Returns the covariance matrix.

Return type

ndarray

Returns

an asset-to-asset covariance matrix.

Raises

QiskitFinanceError – no data loaded

get_mean_vector

get_mean_vector()

Returns a vector containing the mean value of each asset.

Return type

ndarray

Returns

a per-asset mean vector.

Raises

QiskitFinanceError – no data loaded

get_period_return_covariance_matrix

get_period_return_covariance_matrix()

Returns a vector containing the mean value of each asset.

Return type

ndarray

Returns

a per-asset mean vector.

Raises

QiskitFinanceError – no data loaded

get_period_return_mean_vector

get_period_return_mean_vector()

Returns a vector containing the mean value of each asset.

Return type

ndarray

Returns

a per-asset mean vector.

Raises

QiskitFinanceError – no data loaded

get_similarity_matrix

get_similarity_matrix()

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

Return type

ndarray

Returns

an asset-to-asset similarity matrix.

Raises

QiskitFinanceError – no data loaded

run

run()

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

Return type

None

Was this page helpful?
Report a bug or request content on GitHub.