Another attempt to resolve even more linting errors

This commit is contained in:
Theodore Aptekarev
2023-10-11 19:18:41 +02:00
parent 68dc4a3fa0
commit 58717ece01
8 changed files with 41 additions and 276 deletions

View File

@@ -38,7 +38,6 @@ Extensions:
- fmp@0.1.0a2
- fred@0.1.0a2
- intrinio@0.1.0a2
- oecd@0.1.0a2
- polygon@0.1.0a2
- quandl@0.1.0a2
- yfinance@0.1.0a2 """

View File

@@ -53,6 +53,7 @@ class ROUTER_econometrics(Container):
List of columns to use as exogenous variables.
lags: PositiveInt
Number of lags to use in the test.
Returns
-------
OBBject[Data]
@@ -85,6 +86,7 @@ class ROUTER_econometrics(Container):
Data columns to check cointegration
maxlag: PositiveInt
Number of lags to use in the test.
Returns
-------
OBBject[Data]
@@ -132,7 +134,7 @@ class ROUTER_econometrics(Container):
y_column: str,
x_columns: List[str],
) -> OBBject[Dict]:
"""Perform Durbin-Watson test for autocorrelation
"""Perform Durbin-Watson test for autocorrelation.
Parameters
----------
@@ -180,6 +182,7 @@ class ROUTER_econometrics(Container):
Columns to use as exogenous variables.
lag: PositiveInt
Number of lags to use in the test.
Returns
-------
OBBject[Data]
@@ -275,7 +278,7 @@ class ROUTER_econometrics(Container):
y_column: str,
x_columns: List[str],
) -> OBBject[Dict]:
"""Perform a Between estimator regression on panel data
"""Perform a Between estimator regression on panel data.
Parameters
----------
@@ -310,7 +313,7 @@ class ROUTER_econometrics(Container):
y_column: str,
x_columns: List[str],
) -> OBBject[Dict]:
"""Perform a first-difference estimate for panel data
"""Perform a first-difference estimate for panel data.
Parameters
----------
@@ -345,7 +348,7 @@ class ROUTER_econometrics(Container):
y_column: str,
x_columns: List[str],
) -> OBBject[Dict]:
"""Fama-MacBeth estimator for panel data
"""Fama-MacBeth estimator for panel data.
Parameters
----------
@@ -380,7 +383,7 @@ class ROUTER_econometrics(Container):
y_column: str,
x_columns: List[str],
) -> OBBject[Dict]:
"""One- and two-way fixed effects estimator for panel data
"""One- and two-way fixed effects estimator for panel data.
Parameters
----------
@@ -415,7 +418,7 @@ class ROUTER_econometrics(Container):
y_column: str,
x_columns: List[str],
) -> OBBject[Dict]:
"""Perform a Pooled coefficvient estimator regression on panel data
"""Perform a Pooled coefficvient estimator regression on panel data.
Parameters
----------
@@ -450,7 +453,7 @@ class ROUTER_econometrics(Container):
y_column: str,
x_columns: List[str],
) -> OBBject[Dict]:
"""Perform One-way Random Effects model for panel data
"""Perform One-way Random Effects model for panel data.
Parameters
----------
@@ -496,6 +499,7 @@ class ROUTER_econometrics(Container):
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]

View File

@@ -22,9 +22,6 @@ class ROUTER_economy(Container):
european_index
european_index_constituents
fred_index
gdpforecast
gdpnom
gdpreal
index
index_search
index_snapshots
@@ -741,252 +738,6 @@ class ROUTER_economy(Container):
**inputs,
)
@validate_call
def gdpforecast(
self,
period: Annotated[
Literal["quarter", "annual"],
OpenBBCustomParameter(
description="Units for nominal GDP period. Either quarter or annual."
),
] = "annual",
start_date: Annotated[
Union[datetime.date, None, str],
OpenBBCustomParameter(
description="Start date of the data, in YYYY-MM-DD format."
),
] = None,
end_date: Annotated[
Union[datetime.date, None, str],
OpenBBCustomParameter(
description="End date of the data, in YYYY-MM-DD format."
),
] = None,
type: Annotated[
Literal["nominal", "real"],
OpenBBCustomParameter(
description="Type of GDP to get forecast of. Either nominal or real."
),
] = "real",
provider: Optional[Literal["oecd"]] = None,
**kwargs
) -> OBBject[List[Data]]:
"""GDP Data.
Parameters
----------
period : Literal['quarter', 'annual']
Units for nominal GDP period. Either quarter or annual.
start_date : Optional[datetime.date]
Start date of the data, in YYYY-MM-DD format.
end_date : Optional[datetime.date]
End date of the data, in YYYY-MM-DD format.
type : Literal['nominal', 'real']
Type of GDP to get forecast of. Either nominal or real.
provider : Optional[Literal['oecd']]
The provider to use for the query, by default None.
If None, the provider specified in defaults is selected or 'oecd' if there is
no default.
country : Literal['argentina', 'asia', 'australia', 'austria', 'belgium', 'brazil', 'bulgaria', 'canada', 'chile', 'china', 'colombia', 'costa_rica', 'croatia', 'czech_republic', 'denmark', 'estonia', 'euro_area_17', 'finland', 'france', 'germany', 'greece', 'hungary', 'iceland', 'india', 'indonesia', 'ireland', 'israel', 'italy', 'japan', 'korea', 'latvia', 'lithuania', 'luxembourg', 'mexico', 'netherlands', 'new_zealand', 'non-oecd', 'norway', 'oecd_total', 'peru', 'poland', 'portugal', 'romania', 'russia', 'slovak_republic', 'slovenia', 'south_africa', 'spain', 'sweden', 'switzerland', 'turkey', 'united_kingdom', 'united_states', 'world']
Country to get GDP for. (provider: oecd)
Returns
-------
OBBject
results : List[GDPForecast]
Serializable results.
provider : Optional[Literal['oecd']]
Provider name.
warnings : Optional[List[Warning_]]
List of warnings.
chart : Optional[Chart]
Chart object.
extra: Dict[str, Any]
Extra info.
GDPForecast
-----------
date : Optional[date]
The date of the data.
value : Optional[float]
Nominal GDP value on the date.""" # noqa: E501
inputs = filter_inputs(
provider_choices={
"provider": provider,
},
standard_params={
"period": period,
"start_date": start_date,
"end_date": end_date,
"type": type,
},
extra_params=kwargs,
)
return self._run(
"/economy/gdpforecast",
**inputs,
)
@validate_call
def gdpnom(
self,
units: Annotated[
Literal["usd", "usd_cap"],
OpenBBCustomParameter(
description="Units to get nominal GDP in. Either usd or usd_cap indicating per capita."
),
] = "usd",
start_date: Annotated[
Union[datetime.date, None, str],
OpenBBCustomParameter(
description="Start date of the data, in YYYY-MM-DD format."
),
] = None,
end_date: Annotated[
Union[datetime.date, None, str],
OpenBBCustomParameter(
description="End date of the data, in YYYY-MM-DD format."
),
] = None,
provider: Optional[Literal["oecd"]] = None,
**kwargs
) -> OBBject[List[Data]]:
"""GDP Data.
Parameters
----------
units : Literal['usd', 'usd_cap']
Units to get nominal GDP in. Either usd or usd_cap indicating per capita.
start_date : Optional[datetime.date]
Start date of the data, in YYYY-MM-DD format.
end_date : Optional[datetime.date]
End date of the data, in YYYY-MM-DD format.
provider : Optional[Literal['oecd']]
The provider to use for the query, by default None.
If None, the provider specified in defaults is selected or 'oecd' if there is
no default.
country : Literal['australia', 'austria', 'belgium', 'brazil', 'canada', 'chile', 'colombia', 'costa_rica', 'czech_republic', 'denmark', 'estonia', 'euro_area', 'european_union', 'finland', 'france', 'germany', 'greece', 'hungary', 'iceland', 'indonesia', 'ireland', 'israel', 'italy', 'japan', 'korea', 'latvia', 'lithuania', 'luxembourg', 'mexico', 'netherlands', 'new_zealand', 'norway', 'poland', 'portugal', 'russia', 'slovak_republic', 'slovenia', 'south_africa', 'spain', 'sweden', 'switzerland', 'turkey', 'united_kingdom', 'united_states']
Country to get GDP for. (provider: oecd)
Returns
-------
OBBject
results : List[GDPNom]
Serializable results.
provider : Optional[Literal['oecd']]
Provider name.
warnings : Optional[List[Warning_]]
List of warnings.
chart : Optional[Chart]
Chart object.
extra: Dict[str, Any]
Extra info.
GDPNom
------
date : Optional[date]
The date of the data.
value : Optional[float]
Nominal GDP value on the date.""" # noqa: E501
inputs = filter_inputs(
provider_choices={
"provider": provider,
},
standard_params={
"units": units,
"start_date": start_date,
"end_date": end_date,
},
extra_params=kwargs,
)
return self._run(
"/economy/gdpnom",
**inputs,
)
@validate_call
def gdpreal(
self,
units: Annotated[
Literal["idx", "qoq", "yoy"],
OpenBBCustomParameter(
description="Units to get real GDP in. Either idx (indicating 2015=100), qoq (previous period) or yoy (same period, previous year).)"
),
] = "yoy",
start_date: Annotated[
Union[datetime.date, None, str],
OpenBBCustomParameter(
description="Start date of the data, in YYYY-MM-DD format."
),
] = None,
end_date: Annotated[
Union[datetime.date, None, str],
OpenBBCustomParameter(
description="End date of the data, in YYYY-MM-DD format."
),
] = None,
provider: Optional[Literal["oecd"]] = None,
**kwargs
) -> OBBject[List[Data]]:
"""GDP Data.
Parameters
----------
units : Literal['idx', 'qoq', 'yoy']
Units to get real GDP in. Either idx (indicating 2015=100), qoq (previous period) or yoy (same period, previous year).)
start_date : Optional[datetime.date]
Start date of the data, in YYYY-MM-DD format.
end_date : Optional[datetime.date]
End date of the data, in YYYY-MM-DD format.
provider : Optional[Literal['oecd']]
The provider to use for the query, by default None.
If None, the provider specified in defaults is selected or 'oecd' if there is
no default.
country : Literal['G20', 'G7', 'argentina', 'australia', 'austria', 'belgium', 'brazil', 'bulgaria', 'canada', 'chile', 'china', 'colombia', 'costa_rica', 'croatia', 'czech_republic', 'denmark', 'estonia', 'euro_area_19', 'europe', 'european_union_27', 'finland', 'france', 'germany', 'greece', 'hungary', 'iceland', 'india', 'indonesia', 'ireland', 'israel', 'italy', 'japan', 'korea', 'latvia', 'lithuania', 'luxembourg', 'mexico', 'netherlands', 'new_zealand', 'norway', 'oecd_total', 'poland', 'portugal', 'romania', 'russia', 'saudi_arabia', 'slovak_republic', 'slovenia', 'south_africa', 'spain', 'sweden', 'switzerland', 'turkey', 'united_kingdom', 'united_states']
Country to get GDP for. (provider: oecd)
Returns
-------
OBBject
results : List[GDPReal]
Serializable results.
provider : Optional[Literal['oecd']]
Provider name.
warnings : Optional[List[Warning_]]
List of warnings.
chart : Optional[Chart]
Chart object.
extra: Dict[str, Any]
Extra info.
GDPReal
-------
date : Optional[date]
The date of the data.
value : Optional[float]
Nominal GDP value on the date.""" # noqa: E501
inputs = filter_inputs(
provider_choices={
"provider": provider,
},
standard_params={
"units": units,
"start_date": start_date,
"end_date": end_date,
},
extra_params=kwargs,
)
return self._run(
"/economy/gdpreal",
**inputs,
)
@validate_call
def index(
self,

View File

@@ -19,7 +19,6 @@
"fmp@0.1.0a2",
"fred@0.1.0a2",
"intrinio@0.1.0a2",
"oecd@0.1.0a2",
"polygon@0.1.0a2",
"quandl@0.1.0a2",
"yfinance@0.1.0a2"

View File

@@ -26,9 +26,6 @@
"economy_european_index": "/economy/european_index",
"economy_european_index_constituents": "/economy/european_index_constituents",
"economy_fred_index": "/economy/fred_index",
"economy_gdpforecast": "/economy/gdpforecast",
"economy_gdpnom": "/economy/gdpnom",
"economy_gdpreal": "/economy/gdpreal",
"economy_index": "/economy/index",
"economy_index_search": "/economy/index_search",
"economy_index_snapshots": "/economy/index_snapshots",

View File

@@ -40,7 +40,7 @@ class ROUTER_qa(Container):
def capm(
self, data: Union[List[Data], pandas.DataFrame], target: str
) -> OBBject[CAPMModel]:
"""Capital Asset Pricing Model.""" # noqa: E501
"""Get Capital Asset Pricing Model.""" # noqa: E501
inputs = filter_inputs(
data=data,
@@ -59,7 +59,7 @@ class ROUTER_qa(Container):
target: str,
window: Annotated[int, Gt(gt=0)],
) -> OBBject[List[Data]]:
"""Kurtosis.
"""Get the Kurtosis.
Parameters
----------
@@ -91,8 +91,7 @@ class ROUTER_qa(Container):
def normality(
self, data: Union[List[Data], pandas.DataFrame], target: str
) -> OBBject[NormalityModel]:
"""
Normality Statistics.
"""Get Normality Statistics.
- **Kurtosis**: whether the kurtosis of a sample differs from the normal distribution.
- **Skewness**: whether the skewness of a sample differs from the normal distribution.
@@ -131,7 +130,7 @@ class ROUTER_qa(Container):
threshold_start: float = 0.0,
threshold_end: float = 1.5,
) -> OBBject[List[OmegaModel]]:
"""Omega Ratio.
"""Calculate the Omega Ratio.
Parameters
----------
@@ -170,7 +169,24 @@ class ROUTER_qa(Container):
window: Annotated[int, Gt(gt=0)],
quantile_pct: Annotated[float, Ge(ge=0)] = 0.5,
) -> OBBject[List[Data]]:
"""Quantile.""" # noqa: E501
"""Get Quantile.
Parameters
----------
data : List[Data]
Time series data.
target : str
Target column name.
window : PositiveInt
Window size.
quantile_pct : NonNegativeFloat, optional
Quantile percentage, by default 0.5
Returns
-------
OBBject[List[Data]]
Quantile.
""" # noqa: E501
inputs = filter_inputs(
data=data,
@@ -192,7 +208,7 @@ class ROUTER_qa(Container):
rfr: float = 0.0,
window: Annotated[int, Gt(gt=0)] = 252,
) -> OBBject[List[Data]]:
"""Sharpe Ratio.
"""Get Sharpe Ratio.
Parameters
----------
@@ -230,7 +246,7 @@ class ROUTER_qa(Container):
target: str,
window: Annotated[int, Gt(gt=0)],
) -> OBBject[List[Data]]:
"""Skewness.
"""Get Skewness.
Parameters
----------
@@ -267,7 +283,7 @@ class ROUTER_qa(Container):
window: Annotated[int, Gt(gt=0)] = 252,
adjusted: bool = False,
) -> OBBject[List[Data]]:
"""Sortino Ratio.
"""Get Sortino Ratio.
For method & terminology see: http://www.redrockcapital.com/Sortino__A__Sharper__Ratio_Red_Rock_Capital.pdf
@@ -307,7 +323,7 @@ class ROUTER_qa(Container):
def summary(
self, data: Union[List[Data], pandas.DataFrame], target: str
) -> OBBject[SummaryModel]:
"""Summary.
"""Get Summary Statistics.
Parameters
----------
@@ -340,7 +356,7 @@ class ROUTER_qa(Container):
fuller_reg: Literal["c", "ct", "ctt", "nc"] = "c",
kpss_reg: Literal["c", "ct"] = "c",
) -> OBBject[UnitRootModel]:
"""Unit Root Test.
"""Get Unit Root Test.
Augmented Dickey-Fuller test for unit root.
Kwiatkowski-Phillips-Schmidt-Shin test for unit root.

View File

@@ -612,8 +612,8 @@ class ROUTER_ta(Container):
data: Union[List[Data], pandas.DataFrame],
index: str = "date",
target: str = "close",
show_all: bool = False,
asint: bool = False,
show_all: bool = True,
asint: bool = True,
offset: int = 0,
) -> OBBject[List[Data]]:
"""
@@ -630,7 +630,7 @@ class ROUTER_ta(Container):
show_all : bool, optional
Show 1 - 13. If set to False, show 6 - 9
asint : bool, optional
If True, fill NAs with 0 and change type to int, by default False
If True, fill NAs with 0 and change type to int, by default True.
offset : int, optional
How many periods to offset the result

View File

@@ -11,7 +11,6 @@ from openbb_core.api.auth.user import (
get_user_settings,
)
# ruff: noqa: S105 S106