diff options
author | montezdesousa <79287829+montezdesousa@users.noreply.github.com> | 2023-09-21 09:17:40 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-21 09:17:40 +0100 |
commit | 4f4e941267d564fa73a6773c132839d6345b944e (patch) | |
tree | bd5503749bd07d04fa183d14d62e2c5af43af244 | |
parent | 4851da1945470a61df2db5c30ef2ec8471876da9 (diff) |
Hotfix/ext map test (#5459)
* add tests and rebuild
* remove files before rebuild to avoid leftovers
* replace NoneType with None
* docstring
20 files changed, 172 insertions, 3918 deletions
diff --git a/noxfile.py b/noxfile.py index 62e602e956b..9c305b66e32 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1,6 +1,10 @@ import nox -test_locations = ["openbb_sdk/sdk/core/tests", "openbb_sdk/providers"] +test_locations = [ + "openbb_sdk/tests", + "openbb_sdk/sdk/core/tests", + "openbb_sdk/providers", +] @nox.session(python=["3.8", "3.9", "3.10", "3.11"]) diff --git a/openbb_sdk/openbb/package/__extensions__.py b/openbb_sdk/openbb/package/__extensions__.py index 445cb6fa972..f7de27006cf 100644 --- a/openbb_sdk/openbb/package/__extensions__.py +++ b/openbb_sdk/openbb/package/__extensions__.py @@ -7,15 +7,11 @@ from openbb_core.app.static.container import Container class Extensions(Container): """ /crypto - /econometrics /economy /fixedincome /forex - /futures /news - /qa /stocks - /ta """ def __repr__(self) -> str: @@ -28,12 +24,6 @@ class Extensions(Container): return crypto.CLASS_crypto(command_runner=self._command_runner) @property - def econometrics(self): # route = "/econometrics" - from . import econometrics - - return econometrics.CLASS_econometrics(command_runner=self._command_runner) - - @property def economy(self): # route = "/economy" from . import economy @@ -52,31 +42,13 @@ class Extensions(Container): return forex.CLASS_forex(command_runner=self._command_runner) @property - def futures(self): # route = "/futures" - from . import futures - - return futures.CLASS_futures(command_runner=self._command_runner) - - @property def news(self): # route = "/news" from . import news return news.CLASS_news(command_runner=self._command_runner) @property - def qa(self): # route = "/qa" - from . import qa - - return qa.CLASS_qa(command_runner=self._command_runner) - - @property def stocks(self): # route = "/stocks" from . import stocks return stocks.CLASS_stocks(command_runner=self._command_runner) - - @property - def ta(self): # route = "/ta" - from . import ta - - return ta.CLASS_ta(command_runner=self._command_runner) diff --git a/openbb_sdk/openbb/package/crypto.py b/openbb_sdk/openbb/package/crypto.py index f0d9e513cc5..7eaa0d7bbf2 100644 --- a/openbb_sdk/openbb/package/crypto.py +++ b/openbb_sdk/openbb/package/crypto.py @@ -38,7 +38,7 @@ class CLASS_crypto(Container): description="End date of the data, in YYYY-MM-DD format." ), ] = None, - provider: Union[Literal["fmp", "polygon", "yfinance"], None] = None, + provider: Union[Literal["fmp", "polygon"], None] = None, **kwargs ) -> OBBject[List]: """Crypto Historical Price. @@ -51,7 +51,7 @@ class CLASS_crypto(Container): Start date of the data, in YYYY-MM-DD format. end_date : Union[datetime.date, None, str] End date of the data, in YYYY-MM-DD format. - provider : Union[Literal['fmp', 'polygon', 'yfinance'], None] + provider : Union[Literal['fmp', 'polygon'], None] The provider to use for the query, by default None. If None, the provider specified in defaults is selected or 'fmp' if there is no default. @@ -67,17 +67,13 @@ class CLASS_crypto(Container): Whether the data is adjusted. (provider: polygon) multiplier : PositiveInt Multiplier of the timespan. (provider: polygon) - interval : Literal['1m', '2m', '5m', '15m', '30m', '60m', '90m', '1h', '1d', '5d', '1wk', '1mo', '3mo'] - Data granularity. (provider: yfinance) - period : Literal['1d', '5d', '1mo', '3mo', '6mo', '1y', '2y', '5y', '10y', 'ytd', 'max'] - Period of the data to return. (provider: yfinance) Returns ------- OBBject results : List[CryptoHistorical] Serializable results. - provider : Union[Literal['fmp', 'polygon', 'yfinance'], NoneType] + provider : Union[Literal['fmp', 'polygon'], None] Provider name. warnings : Optional[List[Warning_]] List of warnings. diff --git a/openbb_sdk/openbb/package/econometrics.py b/openbb_sdk/openbb/package/econometrics.py deleted file mode 100644 index 62f7f350f5b..00000000000 --- a/openbb_sdk/openbb/package/econometrics.py +++ /dev/null @@ -1,519 +0,0 @@ -### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ### - -from typing import Dict, List, Literal, Union - -import openbb_provider -import openbb_provider.abstract.data -import pandas -import pydantic -import pydantic.types -from openbb_core.app.model.obbject import OBBject -from openbb_core.app.static.container import Container -from openbb_core.app.static.filters import filter_inputs -from pydantic import validate_arguments - - -class CLASS_econometrics(Container): - """/econometrics - bgot - coint - corr - dwat - granger - ols - ols_summary - panelbols - panelfd - panelfmac - panelols - panelpols - panelre - unitroot - """ - - def __repr__(self) -> str: - return self.__doc__ or "" - - @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def bgot( - self, - data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], - y_column: str, - x_columns: List[str], - lags: pydantic.types.PositiveInt = 1, - ) -> OBBject[openbb_provider.abstract.data.Data]: - """Perform Breusch-Godfrey Lagrange Multiplier tests for residual autocorrelation. - - Parameters - ---------- - data: List[Data] - Input dataset. - y_column: str - Target column. - x_columns: str - List of columns to use as exogenous variables. - lags: PositiveInt - Number of lags to use in the test. - Returns - ------- - OBBject[Data] - OBBject with the results being the score from the test. - """ # noqa: E501 - - inputs = filter_inputs( - data=data, - y_column=y_column, - x_columns=x_columns, - lags=lags, - ) - - return self._command_runner.run( - "/econometrics/bgot", - **inputs, - ) - - @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def coint( - self, - data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], - columns: List[str], - ) -> OBBject[openbb_provider.abstract.data.Data]: - """Show co-integration between two timeseries using the two step Engle-Granger test. - - Parameters - ---------- - data: List[Data] - Input dataset. - columns: List[str] - Data columns to check cointegration - maxlag: PositiveInt - Number of lags to use in the test. - Returns - ------- - OBBject[Data] - OBBject with the results being the score from the test. - """ # noqa: E501 - - inputs = filter_inputs( - data=data, - columns=columns, - ) - - return self._command_runner.run( - "/econometrics/coint", - **inputs, - ) - - @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def corr( - self, data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame] - ) -> OBBject[List]: - """Get the corrlelation matrix of an input dataset. - - Parameters - ---------- - data : List[Data] - Input dataset. - - Returns - ------- - OBBject[List[Data]] - Correlation matrix. - """ # noqa: E501 - - inputs = filter_inputs( - data=data, - ) - - return self._command_runner.run( - "/econometrics/corr", - **inputs, - ) - - @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def dwat( - self, - data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], - y_column: str, - x_columns: List[str], - ) -> OBBject[Dict]: - """Perform Durbin-Watson test for autocorrelation - - Parameters - ---------- - data: List[Data] - Input dataset. - y_column: str - Target column. - x_columns: str - List of columns to use as exogenous variables. - - Returns - ------- - OBBject[Data] - OBBject with the results being the score from the test. - """ # noqa: E501 - - inputs = filter_inputs( - data=data, - y_column=y_column, - x_columns=x_columns, - ) - - return self._command_runner.run( - "/econometrics/dwat", - **inputs, - ) - - @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def granger( - self, - data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], - y_column: str, - x_column: str, - lag: pydantic.types.PositiveInt = 3, - ) -> OBBject[openbb_provider.abstract.data.Data]: - """Perform Granger causality test to determine if X "causes" y. - - Parameters - ---------- - data: List[Data] - Input dataset. - y_column: str - Target column. - x_column: str - Columns to use as exogenous variables. - lag: PositiveInt - Number of lags to use in the test. - Returns - ------- - OBBject[Data] - OBBject with the results being the score from the test. - """ # noqa: E501 - - inputs = filter_inputs( - data=data, - y_column=y_column, - x_column=x_column, - lag=lag, - ) - - return self._command_runner.run( - "/econometrics/granger", - **inputs, - ) - - @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def ols( - self, - data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], - y_column: str, - x_columns: List[str], - ) -> OBBject[Dict]: - """Perform OLS regression. This returns the model and results objects from statsmodels. - - Parameters - ---------- - data: List[Data] - Input dataset. - y_column: str - Target column. - x_columns: str - List of columns to use as exogenous variables. - - Returns - ------- - OBBject[Dict] - OBBject with the results being model and results objects. - """ # noqa: E501 - - inputs = filter_inputs( - data=data, - y_column=y_column, - x_columns=x_columns, - ) - - return self._command_runner.run( - "/econometrics/ols", - **inputs, - ) - - @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def ols_summary( - self, - data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], - y_column: str, - x_columns: List[str], - ) -> OBBject[openbb_provider.abstract.data.Data]: - """Perform OLS regression. This returns the summary object from statsmodels. - - Parameters - ---------- - data: List[Data] - Input dataset. - y_column: str - Target column. - x_columns: str - List of columns to use as exogenous variables. - - Returns - ------- - OBBject[Dict] - OBBject with the results being summary object. - """ # noqa: E501 - - inputs = filter_inputs( - data=data, - y_column=y_column, - x_columns=x_columns, - ) - - return self._command_runner.run( - "/econometrics/ols_summary", - **inputs, - ) - - @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def panelbols( - self, - data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], - y_column: str, - x_columns: List[str], - ) -> OBBject[Dict]: - """Perform a Between estimator regression on panel data - - Parameters - ---------- - data: List[Data] - Input dataset. - y_column: str - Target column. - x_columns: str - List of columns to use as exogenous variables. - - Returns - ------- - OBBject[Dict] - OBBject with the fit model returned - """ # noqa: E501 - - inputs = filter_inputs( - data=data, - y_column=y_column, - x_columns=x_columns, - ) - - return self._command_runner.run( - "/econometrics/panelbols", - **inputs, - ) - - @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def panelfd( - self, - data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], - y_column: str, - x_columns: List[str], - ) -> OBBject[Dict]: - """Perform a first-difference estimate for panel data - - Parameters - ---------- - data: List[Data] - Input dataset. - y_column: str - Target column. - x_columns: str - List of columns to use as exogenous variables. - - Returns - ------- - OBBject[Dict] - OBBject with the fit model returned - """ # noqa: E501 - - inputs = filter_inputs( - data=data, - y_column=y_column, - x_columns=x_columns, - ) - - return self._command_runner.run( - "/econometrics/panelfd", - **inputs, - ) - - @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def panelfmac( - self, - data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], - y_column: str, - x_columns: List[str], - ) -> OBBject[Dict]: - """Fama-MacBeth estimator for panel data - - Parameters - ---------- - data: List[Data] - Input dataset. - y_column: str - Target column. - x_columns: str - List of columns to use as exogenous variables. - - Returns - ------- - OBBject[Dict] - OBBject with the fit model returned - """ # noqa: E501 - - inputs = filter_inputs( - data=data, - y_column=y_column, - x_columns=x_columns, - ) - - return self._command_runner.run( - "/econometrics/panelfmac", - **inputs, - ) - - @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def panelols( - self, - data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], - y_column: str, - x_columns: List[str], - ) -> OBBject[Dict]: - """One- and two-way fixed effects estimator for panel data - - Parameters - ---------- - data: List[Data] - Input dataset. - y_column: str - Target column. - x_columns: str - List of columns to use as exogenous variables. - - Returns - ------- - OBBject[Dict] - OBBject with the fit model returned - """ # noqa: E501 - - inputs = filter_inputs( - data=data, - y_column=y_column, - x_columns=x_columns, - ) - - return self._command_runner.run( - "/econometrics/panelols", - **inputs, - ) - - @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def panelpols( - self, - data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], - y_column: str, - x_columns: List[str], - ) -> OBBject[Dict]: - """Perform a Pooled coefficvient estimator regression on panel data - - Parameters - ---------- - data: List[Data] - Input dataset. - y_column: str - Target column. - x_columns: str - List of columns to use as exogenous variables. - - Returns - ------- - OBBject[Dict] - OBBject with the fit model returned - """ # noqa: E501 - - inputs = filter_inputs( - data=data, - y_column=y_column, - x_columns=x_columns, - ) - - return self._command_runner.run( - "/econometrics/panelpols", - **inputs, - ) - - @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def panelre( - self, - data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], - y_column: str, - x_columns: List[str], - ) -> OBBject[Dict]: - """Perform One-way Random Effects model for panel data - - Parameters - ---------- - data: List[Data] - Input dataset. - y_column: str - Target column. - x_columns: str - List of columns to use as exogenous variables. - - Returns - ------- - OBBject[Dict] - OBBject with the fit model returned - """ # noqa: E501 - - inputs = filter_inputs( - data=data, - y_column=y_column, - x_columns=x_columns, - ) - - return self._command_runner.run( - "/econometrics/panelre", - **inputs, - ) - - @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def unitroot( - self, - data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], - column: str, - regression: Literal["c", "ct", "ctt"] = "c", - ) -> OBBject[openbb_provider.abstract.data.Data]: - """Perform Augmented Dickey-Fuller unit root test. - - Parameters - ---------- - data: List[Data] - Input dataset. - column: str - Data columns to check unit root - regression: str - Regression type to use in the test. Either "c" for constant only, "ct" for constant and trend, or "ctt" for - constant, trend, and trend-squared. - Returns - ------- - OBBject[Data] - OBBject with the results being the score from the test. - """ # noqa: E501 - - inputs = filter_inputs( - data=data, - column=column, - regression=regression, - ) - - return self._command_runner.run( - "/econometrics/unitroot", - **inputs, - ) diff --git a/openbb_sdk/openbb/package/economy.py b/openbb_sdk/openbb/package/economy.py index 58e0e9ea5cf..48753544223 100644 --- a/openbb_sdk/openbb/package/economy.py +++ b/openbb_sdk/openbb/package/economy.py @@ -8,23 +8,16 @@ from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.model.obbject import OBBject from openbb_core.app.static.container import Container from openbb_core.app.static.filters import filter_inputs -from pydantic import BaseModel, validate_arguments +from pydantic import validate_arguments class CLASS_economy(Container): """/economy available_indices const - cot - cot_search cpi - european_index - european_index_constituents index - index_search - index_snapshots risk - sp500_multiples """ def __repr__(self) -> str: @@ -32,25 +25,23 @@ class CLASS_economy(Container): @validate_arguments def available_indices( - self, provider: Union[Literal["cboe", "fmp", "yfinance"], None] = None, **kwargs + self, provider: Union[Literal["fmp"], None] = None, **kwargs ) -> OBBject[List]: """Lists of available indices from a provider. Parameters ---------- - provider : Union[Literal['cboe', 'fmp', 'yfinance'], None] + provider : Union[Literal['fmp'], None] The provider to use for the query, by default None. - If None, the provider specified in defaults is selected or 'cboe' if there is + If None, the provider specified in defaults is selected or 'fmp' if there is no default. - europe : bool - Filter for European indices. False for US indices. (provider: cboe) Returns ------- OBBject results : List[AvailableIndices] Serializable results. - provider : Union[Literal['cboe', 'fmp', 'yfinance'], NoneType] + provider : Union[Literal['fmp'], None] Provider name. warnings : Optional[List[Warning_]] List of warnings. @@ -65,34 +56,11 @@ class CLASS_economy(Container): Name of the index. currency : Optional[str] Currency the index is traded in. - isin : Optional[str] - ISIN code for the index. Valid only for European indices. (provider: cboe) - region : Optional[str] - Region for the index. Valid only for European indices (provider: cboe) - symbol : Optional[str] - Symbol for the index. (provider: cboe, yfinance) - description : Optional[str] - Description for the index. Valid only for US indices. (provider: cboe) - data_delay : Optional[int] - Data delay for the index. Valid only for US indices. (provider: cboe) - open_time : Optional[time] - Opening time for the index. Valid only for US indices. (provider: cboe) - close_time : Optional[time] - Closing time for the index. Valid only for US indices. (provider: cboe) - time_zone : Optional[str] - Time zone for the index. Valid only for US indices. (provider: cboe) - tick_days : Optional[str] - The trading days for t |