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

158 lines
9.9 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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: WikipediaDataProvider (v0.26)
description: API reference for qiskit.finance.data_providers.WikipediaDataProvider in qiskit v0.26
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.finance.data_providers.WikipediaDataProvider
---
<span id="qiskit-finance-data-providers-wikipediadataprovider" />
# qiskit.finance.data\_providers.WikipediaDataProvider
<Class id="qiskit.finance.data_providers.WikipediaDataProvider" isDedicatedPage={true} github="https://github.com/qiskit-community/qiskit-aqua/tree/stable/0.9/qiskit/finance/data_providers/wikipedia_data_provider.py" signature="WikipediaDataProvider(token=None, tickers=None, start=datetime.datetime(2016, 1, 1, 0, 0), end=datetime.datetime(2016, 1, 30, 0, 0))" modifiers="class">
Wikipedia data provider.
Please see: [https://github.com/Qiskit/qiskit-tutorials/blob/stable/0.25.x/tutorials/finance/11\_time\_series.ipynb](https://github.com/Qiskit/qiskit-tutorials/blob/stable/0.25.x/tutorials/finance/11_time_series.ipynb) for instructions on use.
Initializer :type token: `Optional`\[`str`] :param token: quandl access token, which is not needed, strictly speaking :type tickers: `Union`\[`str`, `List`\[`str`], `None`] :param tickers: tickers :type start: `datetime` :param start: start time :type end: `datetime` :param end: end time
> **Raises:**
>
> MissingOptionalLibraryError: Quandl not installed
### \_\_init\_\_
<Function id="qiskit.finance.data_providers.WikipediaDataProvider.__init__" signature="__init__(token=None, tickers=None, start=datetime.datetime(2016, 1, 1, 0, 0), end=datetime.datetime(2016, 1, 30, 0, 0))">
Initializer :type token: `Optional`\[`str`] :param token: quandl access token, which is not needed, strictly speaking :type tickers: `Union`\[`str`, `List`\[`str`], `None`] :param tickers: tickers :type start: `datetime` :param start: start time :type end: `datetime` :param end: end time
> **Raises:**
>
> MissingOptionalLibraryError: Quandl not installed
</Function>
## Methods
| | |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [`__init__`](#qiskit.finance.data_providers.WikipediaDataProvider.__init__ "qiskit.finance.data_providers.WikipediaDataProvider.__init__")(\[token, tickers, start, end]) | Initializer :type token: `Optional`\[`str`] :param token: quandl access token, which is not needed, strictly speaking :type tickers: `Union`\[`str`, `List`\[`str`], `None`] :param tickers: tickers :type start: `datetime` :param start: start time :type end: `datetime` :param end: end time |
| [`get_coordinates`](#qiskit.finance.data_providers.WikipediaDataProvider.get_coordinates "qiskit.finance.data_providers.WikipediaDataProvider.get_coordinates")() | Returns random coordinates for visualisation purposes. |
| [`get_covariance_matrix`](#qiskit.finance.data_providers.WikipediaDataProvider.get_covariance_matrix "qiskit.finance.data_providers.WikipediaDataProvider.get_covariance_matrix")() | Returns the covariance matrix. |
| [`get_mean_vector`](#qiskit.finance.data_providers.WikipediaDataProvider.get_mean_vector "qiskit.finance.data_providers.WikipediaDataProvider.get_mean_vector")() | Returns a vector containing the mean value of each asset. |
| [`get_period_return_covariance_matrix`](#qiskit.finance.data_providers.WikipediaDataProvider.get_period_return_covariance_matrix "qiskit.finance.data_providers.WikipediaDataProvider.get_period_return_covariance_matrix")() | Returns a vector containing the mean value of each asset. |
| [`get_period_return_mean_vector`](#qiskit.finance.data_providers.WikipediaDataProvider.get_period_return_mean_vector "qiskit.finance.data_providers.WikipediaDataProvider.get_period_return_mean_vector")() | Returns a vector containing the mean value of each asset. |
| [`get_similarity_matrix`](#qiskit.finance.data_providers.WikipediaDataProvider.get_similarity_matrix "qiskit.finance.data_providers.WikipediaDataProvider.get_similarity_matrix")() | Returns time-series similarity matrix computed using dynamic time warping. |
| [`run`](#qiskit.finance.data_providers.WikipediaDataProvider.run "qiskit.finance.data_providers.WikipediaDataProvider.run")() | Loads data, thus enabling get\_similarity\_matrix and get\_covariance\_matrix methods in the base class. |
### get\_coordinates
<Function id="qiskit.finance.data_providers.WikipediaDataProvider.get_coordinates" signature="get_coordinates()">
Returns random coordinates for visualisation purposes.
**Return type**
`Tuple`\[`ndarray`, `ndarray`]
</Function>
### get\_covariance\_matrix
<Function id="qiskit.finance.data_providers.WikipediaDataProvider.get_covariance_matrix" signature="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>
### get\_mean\_vector
<Function id="qiskit.finance.data_providers.WikipediaDataProvider.get_mean_vector" signature="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>
### get\_period\_return\_covariance\_matrix
<Function id="qiskit.finance.data_providers.WikipediaDataProvider.get_period_return_covariance_matrix" signature="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>
### get\_period\_return\_mean\_vector
<Function id="qiskit.finance.data_providers.WikipediaDataProvider.get_period_return_mean_vector" signature="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>
### get\_similarity\_matrix
<Function id="qiskit.finance.data_providers.WikipediaDataProvider.get_similarity_matrix" signature="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>
### run
<Function id="qiskit.finance.data_providers.WikipediaDataProvider.run" signature="run()">
Loads data, thus enabling get\_similarity\_matrix and get\_covariance\_matrix methods in the base class.
**Return type**
`None`
</Function>
</Class>