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

151 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: YahooDataProvider (v0.29)
description: API reference for qiskit.finance.data_providers.YahooDataProvider in qiskit v0.29
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.finance.data_providers.YahooDataProvider
---
# YahooDataProvider
<Class id="qiskit.finance.data_providers.YahooDataProvider" isDedicatedPage={true} github="https://github.com/qiskit-community/qiskit-aqua/tree/stable/0.9/qiskit/finance/data_providers/yahoo_data_provider.py" signature="YahooDataProvider(tickers=None, start=datetime.datetime(2016, 1, 1, 0, 0), end=datetime.datetime(2016, 1, 30, 0, 0))" modifiers="class">
Bases: `qiskit.finance.data_providers._base_data_provider.BaseDataProvider`
Yahoo 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 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**](qiskit.aqua.MissingOptionalLibraryError "qiskit.aqua.MissingOptionalLibraryError") YFinance not installed
## Methods
<span id="qiskit-finance-data-providers-yahoodataprovider-get-coordinates" />
### get\_coordinates
<Function id="qiskit.finance.data_providers.YahooDataProvider.get_coordinates" signature="YahooDataProvider.get_coordinates()">
Returns random coordinates for visualisation purposes.
**Return type**
`Tuple`\[`ndarray`, `ndarray`]
</Function>
<span id="qiskit-finance-data-providers-yahoodataprovider-get-covariance-matrix" />
### get\_covariance\_matrix
<Function id="qiskit.finance.data_providers.YahooDataProvider.get_covariance_matrix" signature="YahooDataProvider.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-yahoodataprovider-get-mean-vector" />
### get\_mean\_vector
<Function id="qiskit.finance.data_providers.YahooDataProvider.get_mean_vector" signature="YahooDataProvider.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-yahoodataprovider-get-period-return-covariance-matrix" />
### get\_period\_return\_covariance\_matrix
<Function id="qiskit.finance.data_providers.YahooDataProvider.get_period_return_covariance_matrix" signature="YahooDataProvider.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-yahoodataprovider-get-period-return-mean-vector" />
### get\_period\_return\_mean\_vector
<Function id="qiskit.finance.data_providers.YahooDataProvider.get_period_return_mean_vector" signature="YahooDataProvider.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-yahoodataprovider-get-similarity-matrix" />
### get\_similarity\_matrix
<Function id="qiskit.finance.data_providers.YahooDataProvider.get_similarity_matrix" signature="YahooDataProvider.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-yahoodataprovider-run" />
### run
<Function id="qiskit.finance.data_providers.YahooDataProvider.run" signature="YahooDataProvider.run()">
Loads data, thus enabling get\_similarity\_matrix and get\_covariance\_matrix methods in the base class.
**Return type**
`None`
</Function>
</Class>