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

147 lines
4.4 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: BaseDataProvider (v0.31)
description: API reference for qiskit.finance.data_providers.BaseDataProvider in qiskit v0.31
in_page_toc_min_heading_level: 1
python_api_type: class
python_api_name: qiskit.finance.data_providers.BaseDataProvider
---
# BaseDataProvider
<Class id="qiskit.finance.data_providers.BaseDataProvider" isDedicatedPage={true} github="https://github.com/qiskit-community/qiskit-aqua/tree/stable/0.9/qiskit/finance/data_providers/_base_data_provider.py" signature="BaseDataProvider" modifiers="class">
Bases: `abc.ABC`
The abstract base class for data\_provider modules within Qiskits finance module.
To create add-on data\_provider module subclass the BaseDataProvider class in this module. Doing so requires that the required driver interface is implemented.
To use the subclasses, 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)
## Methods
<span id="qiskit-finance-data-providers-basedataprovider-get-coordinates" />
### get\_coordinates
<Function id="qiskit.finance.data_providers.BaseDataProvider.get_coordinates" signature="BaseDataProvider.get_coordinates()">
Returns random coordinates for visualisation purposes.
**Return type**
`Tuple`\[`ndarray`, `ndarray`]
</Function>
<span id="qiskit-finance-data-providers-basedataprovider-get-covariance-matrix" />
### get\_covariance\_matrix
<Function id="qiskit.finance.data_providers.BaseDataProvider.get_covariance_matrix" signature="BaseDataProvider.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-basedataprovider-get-mean-vector" />
### get\_mean\_vector
<Function id="qiskit.finance.data_providers.BaseDataProvider.get_mean_vector" signature="BaseDataProvider.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-basedataprovider-get-period-return-covariance-matrix" />
### get\_period\_return\_covariance\_matrix
<Function id="qiskit.finance.data_providers.BaseDataProvider.get_period_return_covariance_matrix" signature="BaseDataProvider.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-basedataprovider-get-period-return-mean-vector" />
### get\_period\_return\_mean\_vector
<Function id="qiskit.finance.data_providers.BaseDataProvider.get_period_return_mean_vector" signature="BaseDataProvider.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-basedataprovider-get-similarity-matrix" />
### get\_similarity\_matrix
<Function id="qiskit.finance.data_providers.BaseDataProvider.get_similarity_matrix" signature="BaseDataProvider.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-basedataprovider-run" />
### run
<Function id="qiskit.finance.data_providers.BaseDataProvider.run" signature="BaseDataProvider.run()" modifiers="abstract">
Loads data.
**Return type**
`None`
</Function>
</Class>