Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplifies code in Data Providers and enhances API reference #335

Merged
merged 25 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
95eef34
Simplify pandas usage, update type hinting and improve API docs
edoaltamura Feb 24, 2024
78b8786
Trigger workflow
edoaltamura Feb 24, 2024
330517a
Add more documentation
edoaltamura Feb 24, 2024
c235ee9
Whitelist datetime in pylint
edoaltamura Feb 24, 2024
7c92647
Whitelist `datetime` in pylint
edoaltamura Feb 24, 2024
891b47d
Whitelist `datetime` in pylint
edoaltamura Feb 24, 2024
f5594ff
Whitelist `DTW` in pylint (wasn't flagged locally)
edoaltamura Feb 25, 2024
56e14b8
Merge branch 'qiskit-community:main' into main
edoaltamura Feb 29, 2024
40a00fa
Merge branch 'qiskit-community:main' into main
edoaltamura May 24, 2024
e1ca6ef
Add `from __future__ import annotations`
edoaltamura May 24, 2024
d080169
Remove Return None statements
edoaltamura May 24, 2024
daa0985
Remove ticker str type
edoaltamura May 28, 2024
e65c76f
Remove ticker str type
edoaltamura Jun 7, 2024
5718ef2
Remove ticker str type
edoaltamura Jun 7, 2024
d7530e1
Enhance documentation for str | list[str] | None and restore str type
edoaltamura Jun 10, 2024
ef53f9e
Resolve Incompatible types in assignment in linter
edoaltamura Jun 10, 2024
4ad61fe
Add to dictionary
edoaltamura Jun 10, 2024
7c92d97
Replace f-string with lazy formatting
edoaltamura Jun 10, 2024
25cd223
Remove redundant strings
edoaltamura Jun 10, 2024
f71d98f
Fix html compilation
edoaltamura Jun 10, 2024
4e5ce49
Whitelist Euronext in lint
edoaltamura Jun 11, 2024
dfd8f8a
Whitelist singapore and paris in lint
edoaltamura Jun 11, 2024
1837fe3
Correct the docstrings and fix scattered typos
edoaltamura Jun 12, 2024
0ca7b4a
Correct method links in API docs
edoaltamura Jun 12, 2024
ed6d09d
Spell check
edoaltamura Jun 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions qiskit_finance/data_providers/_base_data_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ class StockMarket(Enum):


class BaseDataProvider(ABC):
"""The abstract base class for data_provider modules within Qiskit Finance module.
"""The abstract base class for :code:`data_provider` modules within Qiskit Finance.

To create add-on data_provider module subclass the BaseDataProvider class in this module.
Creates :code:`data_provider` module subclasses based on the :code:`BaseDataProvider`
abstract class in this module.
Doing so requires that the required driver interface is implemented.

To use the subclasses, please see
Expand All @@ -74,11 +75,8 @@ def run(self) -> None:
"""
Abstract method to load data.

Method responsible for loading data. Subclasses of `BaseDataProvider`
Method responsible for loading data. Subclasses of :code:`BaseDataProvider`
must implement this method to load data from a specific data source.

Raises:
NotImplementedError: This method must be implemented in a subclass.
"""
pass

Expand All @@ -92,7 +90,7 @@ def _check_data_loaded(self) -> None:
"""
if not hasattr(self, "_data") or not self._data:
raise QiskitFinanceError(
"No data loaded yet. Please run the method :code:`run()` first to load the data."
"No data loaded yet. Please run the method `run()` first to load the data."
)

# it does not have to be overridden in non-abstract derived classes.
Expand Down Expand Up @@ -230,7 +228,7 @@ def get_similarity_matrix(self) -> np.ndarray:
# it does not have to be overridden in non-abstract derived classes.
def get_coordinates(self) -> tuple[np.ndarray, np.ndarray]:
"""
Generates random coordinates for visualisation purposes.
Generates random coordinates for visualization purposes.

Returns random coordinates for visualization purposes. These coordinates
can be used to plot assets in a two-dimensional space, facilitating visualization
Expand Down
4 changes: 2 additions & 2 deletions qiskit_finance/data_providers/exchange_data_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __init__(
Defaults to January 30th, 2016.

Raises:
QiskitFinanceError: provider doesn't support given stock market
QiskitFinanceError: provider doesn't support given stock market.
"""
super().__init__()

Expand All @@ -88,7 +88,7 @@ def __init__(

def run(self) -> None:
"""
Loads data, thus enabling get_similarity_matrix and get_covariance_matrix
Loads data, thus enabling :code:`get_similarity_matrix` and :code:`get_covariance_matrix`
edoaltamura marked this conversation as resolved.
Show resolved Hide resolved
methods in the base class.
"""
nasdaqdatalink.ApiConfig.api_key = self._token
Expand Down
Loading