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

153 lines
5.2 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: DataOnDemandProvider (v0.31)
description: API reference for qiskit.finance.data_providers.DataOnDemandProvider in qiskit v0.31
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.finance.data_providers.DataOnDemandProvider
---
# DataOnDemandProvider
<Class id="qiskit.finance.data_providers.DataOnDemandProvider" isDedicatedPage={true} github="https://github.com/qiskit-community/qiskit-aqua/tree/stable/0.9/qiskit/finance/data_providers/data_on_demand_provider.py" signature="DataOnDemandProvider(token, tickers, start=datetime.datetime(2016, 1, 1, 0, 0), end=datetime.datetime(2016, 1, 30, 0, 0), verify=None)" modifiers="class">
Bases: `qiskit.finance.data_providers._base_data_provider.BaseDataProvider`
NASDAQ Data on Demand 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, which involve obtaining a NASDAQ DOD access token.
**Parameters**
* **token** (`str`) data on demand access token
* **tickers** (`Union`\[`str`, `List`\[`str`]]) tickers
* **start** (`datetime`) first data point
* **end** (`datetime`) last data point precedes this date
* **verify** (`Union`\[`str`, `bool`, `None`]) if verify is None, certify certificates will be used (default); if this is False, no certificates will be checked; if this is a string, it should be pointing to a certificate for the HTTPS connection to NASDAQ (dataondemand.nasdaq.com), either in the form of a CA\_BUNDLE file or a directory wherein to look.
## Methods
<span id="qiskit-finance-data-providers-dataondemandprovider-get-coordinates" />
### get\_coordinates
<Function id="qiskit.finance.data_providers.DataOnDemandProvider.get_coordinates" signature="DataOnDemandProvider.get_coordinates()">
Returns random coordinates for visualisation purposes.
**Return type**
`Tuple`\[`ndarray`, `ndarray`]
</Function>
<span id="qiskit-finance-data-providers-dataondemandprovider-get-covariance-matrix" />
### get\_covariance\_matrix
<Function id="qiskit.finance.data_providers.DataOnDemandProvider.get_covariance_matrix" signature="DataOnDemandProvider.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-dataondemandprovider-get-mean-vector" />
### get\_mean\_vector
<Function id="qiskit.finance.data_providers.DataOnDemandProvider.get_mean_vector" signature="DataOnDemandProvider.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-dataondemandprovider-get-period-return-covariance-matrix" />
### get\_period\_return\_covariance\_matrix
<Function id="qiskit.finance.data_providers.DataOnDemandProvider.get_period_return_covariance_matrix" signature="DataOnDemandProvider.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-dataondemandprovider-get-period-return-mean-vector" />
### get\_period\_return\_mean\_vector
<Function id="qiskit.finance.data_providers.DataOnDemandProvider.get_period_return_mean_vector" signature="DataOnDemandProvider.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-dataondemandprovider-get-similarity-matrix" />
### get\_similarity\_matrix
<Function id="qiskit.finance.data_providers.DataOnDemandProvider.get_similarity_matrix" signature="DataOnDemandProvider.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-dataondemandprovider-run" />
### run
<Function id="qiskit.finance.data_providers.DataOnDemandProvider.run" signature="DataOnDemandProvider.run()">
Loads data, thus enabling get\_similarity\_matrix and get\_covariance\_matrix methods in the base class.
**Return type**
`None`
</Function>
</Class>