qiskit-documentation/docs/api/qiskit/0.29/qiskit.finance.data_provide...

149 lines
4.8 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: RandomDataProvider (v0.29)
description: API reference for qiskit.finance.data_providers.RandomDataProvider in qiskit v0.29
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.finance.data_providers.RandomDataProvider
---
# RandomDataProvider
<Class id="qiskit.finance.data_providers.RandomDataProvider" isDedicatedPage={true} github="https://github.com/qiskit-community/qiskit-aqua/tree/stable/0.9/qiskit/finance/data_providers/random_data_provider.py" signature="RandomDataProvider(tickers=None, start=datetime.datetime(2016, 1, 1, 0, 0), end=datetime.datetime(2016, 1, 30, 0, 0), seed=None)" modifiers="class">
Bases: `qiskit.finance.data_providers._base_data_provider.BaseDataProvider`
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**](qiskit.aqua.MissingOptionalLibraryError "qiskit.aqua.MissingOptionalLibraryError") Pandas not installed
## Methods
<span id="qiskit-finance-data-providers-randomdataprovider-get-coordinates" />
### get\_coordinates
<Function id="qiskit.finance.data_providers.RandomDataProvider.get_coordinates" signature="RandomDataProvider.get_coordinates()">
Returns random coordinates for visualisation purposes.
**Return type**
`Tuple`\[`ndarray`, `ndarray`]
</Function>
<span id="qiskit-finance-data-providers-randomdataprovider-get-covariance-matrix" />
### get\_covariance\_matrix
<Function id="qiskit.finance.data_providers.RandomDataProvider.get_covariance_matrix" signature="RandomDataProvider.get_covariance_matrix()">
Returns the covariance matrix.
**Return type**
`ndarray`
**Returns**
an asset-to-asset covariance matrix.
**Raises**
[**QiskitFinanceError**](qiskit.finance.QiskitFinanceError "qiskit.finance.QiskitFinanceError") no data loaded
</Function>
<span id="qiskit-finance-data-providers-randomdataprovider-get-mean-vector" />
### get\_mean\_vector
<Function id="qiskit.finance.data_providers.RandomDataProvider.get_mean_vector" signature="RandomDataProvider.get_mean_vector()">
Returns a vector containing the mean value of each asset.
**Return type**
`ndarray`
**Returns**
a per-asset mean vector.
**Raises**
[**QiskitFinanceError**](qiskit.finance.QiskitFinanceError "qiskit.finance.QiskitFinanceError") no data loaded
</Function>
<span id="qiskit-finance-data-providers-randomdataprovider-get-period-return-covariance-matrix" />
### get\_period\_return\_covariance\_matrix
<Function id="qiskit.finance.data_providers.RandomDataProvider.get_period_return_covariance_matrix" signature="RandomDataProvider.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**](qiskit.finance.QiskitFinanceError "qiskit.finance.QiskitFinanceError") no data loaded
</Function>
<span id="qiskit-finance-data-providers-randomdataprovider-get-period-return-mean-vector" />
### get\_period\_return\_mean\_vector
<Function id="qiskit.finance.data_providers.RandomDataProvider.get_period_return_mean_vector" signature="RandomDataProvider.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**](qiskit.finance.QiskitFinanceError "qiskit.finance.QiskitFinanceError") no data loaded
</Function>
<span id="qiskit-finance-data-providers-randomdataprovider-get-similarity-matrix" />
### get\_similarity\_matrix
<Function id="qiskit.finance.data_providers.RandomDataProvider.get_similarity_matrix" signature="RandomDataProvider.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**](qiskit.finance.QiskitFinanceError "qiskit.finance.QiskitFinanceError") no data loaded
</Function>
<span id="qiskit-finance-data-providers-randomdataprovider-run" />
### run
<Function id="qiskit.finance.data_providers.RandomDataProvider.run" signature="RandomDataProvider.run()">
Generates data pseudo-randomly, thus enabling get\_similarity\_matrix and get\_covariance\_matrix methods in the base class.
**Return type**
`None`
</Function>
</Class>