mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 12:40:35 +00:00
Fix buggy docstring in python package methods (#5548)
* fix buggy docstring for methods
* remove space
* fix typing
* avoid name collision with validator
* Revert "avoid name collision with validator"
This reverts commit 8a30a44555.
* typing
* rebuild
* python 3.8, ParamSpec not available
* lint
* ruff noqa
This commit is contained in:
@@ -9,38 +9,25 @@ class Extensions(Container):
|
||||
"""
|
||||
Routers:
|
||||
/crypto
|
||||
/econometrics
|
||||
/economy
|
||||
/fixedincome
|
||||
/forex
|
||||
/futures
|
||||
/news
|
||||
/qa
|
||||
/stocks
|
||||
/ta
|
||||
|
||||
Extensions:
|
||||
- crypto@0.1.0a2
|
||||
- econometrics@0.1.0a2
|
||||
- economy@0.1.0a2
|
||||
- fixedincome@0.1.0a2
|
||||
- forex@0.1.0a2
|
||||
- futures@0.1.0a2
|
||||
- news@0.1.0a2
|
||||
- openbb_charting@0.1.0a2
|
||||
- qa@0.1.0a2
|
||||
- stocks@0.1.0a2
|
||||
- ta@0.1.0a2
|
||||
|
||||
- alpha_vantage@0.1.0a2
|
||||
- benzinga@0.1.0a2
|
||||
- cboe@0.1.0a2
|
||||
- fmp@0.1.0a2
|
||||
- fred@0.1.0a2
|
||||
- intrinio@0.1.0a2
|
||||
- polygon@0.1.0a2
|
||||
- quandl@0.1.0a2
|
||||
- yfinance@0.1.0a2 """
|
||||
- polygon@0.1.0a2 """
|
||||
# fmt: on
|
||||
def __repr__(self) -> str:
|
||||
return self.__doc__ or ""
|
||||
@@ -51,12 +38,6 @@ Extensions:
|
||||
|
||||
return crypto.ROUTER_crypto(command_runner=self._command_runner)
|
||||
|
||||
@property
|
||||
def econometrics(self): # route = "/econometrics"
|
||||
from . import econometrics
|
||||
|
||||
return econometrics.ROUTER_econometrics(command_runner=self._command_runner)
|
||||
|
||||
@property
|
||||
def economy(self): # route = "/economy"
|
||||
from . import economy
|
||||
@@ -75,32 +56,14 @@ Extensions:
|
||||
|
||||
return forex.ROUTER_forex(command_runner=self._command_runner)
|
||||
|
||||
@property
|
||||
def futures(self): # route = "/futures"
|
||||
from . import futures
|
||||
|
||||
return futures.ROUTER_futures(command_runner=self._command_runner)
|
||||
|
||||
@property
|
||||
def news(self): # route = "/news"
|
||||
from . import news
|
||||
|
||||
return news.ROUTER_news(command_runner=self._command_runner)
|
||||
|
||||
@property
|
||||
def qa(self): # route = "/qa"
|
||||
from . import qa
|
||||
|
||||
return qa.ROUTER_qa(command_runner=self._command_runner)
|
||||
|
||||
@property
|
||||
def stocks(self): # route = "/stocks"
|
||||
from . import stocks
|
||||
|
||||
return stocks.ROUTER_stocks(command_runner=self._command_runner)
|
||||
|
||||
@property
|
||||
def ta(self): # route = "/ta"
|
||||
from . import ta
|
||||
|
||||
return ta.ROUTER_ta(command_runner=self._command_runner)
|
||||
|
||||
@@ -7,9 +7,9 @@ import typing_extensions
|
||||
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.decorators import validate
|
||||
from openbb_core.app.static.filters import filter_inputs
|
||||
from openbb_provider.abstract.data import Data
|
||||
from pydantic import validate_call
|
||||
|
||||
|
||||
class ROUTER_crypto(Container):
|
||||
@@ -20,7 +20,7 @@ class ROUTER_crypto(Container):
|
||||
def __repr__(self) -> str:
|
||||
return self.__doc__ or ""
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def load(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
@@ -41,7 +41,7 @@ class ROUTER_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[Data]]:
|
||||
"""Crypto Historical Price.
|
||||
@@ -54,14 +54,14 @@ class ROUTER_crypto(Container):
|
||||
Start date of the data, in YYYY-MM-DD format.
|
||||
end_date : Union[datetime.date, None]
|
||||
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.
|
||||
timeseries : Optional[Union[typing_extensions.Annotated[int, Ge(ge=0)]]]
|
||||
Number of days to look back. (provider: fmp)
|
||||
interval : Optional[Union[Literal['1min', '5min', '15min', '30min', '1hour', '4hour', '1day'], Literal['1m', '2m', '5m', '15m', '30m', '60m', '90m', '1h', '1d', '5d', '1wk', '1mo', '3mo']]]
|
||||
Data granularity. (provider: fmp, yfinance)
|
||||
interval : Literal['1min', '5min', '15min', '30min', '1hour', '4hour', '1day']
|
||||
Data granularity. (provider: fmp)
|
||||
multiplier : int
|
||||
Multiplier of the timespan. (provider: polygon)
|
||||
timespan : Literal['minute', 'hour', 'day', 'week', 'month', 'quarter', 'year']
|
||||
@@ -72,15 +72,13 @@ class ROUTER_crypto(Container):
|
||||
The number of data entries to return. (provider: polygon)
|
||||
adjusted : bool
|
||||
Whether the data is adjusted. (provider: polygon)
|
||||
period : Optional[Union[Literal['1d', '5d', '1mo', '3mo', '6mo', '1y', '2y', '5y', '10y', 'ytd', 'max']]]
|
||||
Period of the data to return. (provider: yfinance)
|
||||
|
||||
Returns
|
||||
-------
|
||||
OBBject
|
||||
results : Union[List[CryptoHistorical]]
|
||||
Serializable results.
|
||||
provider : Union[Literal['fmp', 'polygon', 'yfinance'], None]
|
||||
provider : Union[Literal['fmp', 'polygon'], None]
|
||||
Provider name.
|
||||
warnings : Optional[List[Warning_]]
|
||||
List of warnings.
|
||||
|
||||
@@ -1,518 +0,0 @@
|
||||
### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ###
|
||||
|
||||
from typing import Dict, List, Literal, Union
|
||||
|
||||
import pandas
|
||||
import typing_extensions
|
||||
from annotated_types import Gt
|
||||
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 openbb_provider.abstract.data import Data
|
||||
from pydantic import validate_call
|
||||
|
||||
|
||||
class ROUTER_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_call(config=dict(arbitrary_types_allowed=True))
|
||||
def bgot(
|
||||
self,
|
||||
data: Union[List[Data], pandas.DataFrame],
|
||||
y_column: str,
|
||||
x_columns: List[str],
|
||||
lags: typing_extensions.Annotated[int, Gt(gt=0)] = 1,
|
||||
) -> OBBject[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._run(
|
||||
"/econometrics/bgot",
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call(config=dict(arbitrary_types_allowed=True))
|
||||
def coint(
|
||||
self, data: Union[List[Data], pandas.DataFrame], columns: List[str]
|
||||
) -> OBBject[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._run(
|
||||
"/econometrics/coint",
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call(config=dict(arbitrary_types_allowed=True))
|
||||
def corr(self, data: Union[List[Data], pandas.DataFrame]) -> OBBject[List[Data]]:
|
||||
"""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._run(
|
||||
"/econometrics/corr",
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call(config=dict(arbitrary_types_allowed=True))
|
||||
def dwat(
|
||||
self,
|
||||
data: Union[List[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._run(
|
||||
"/econometrics/dwat",
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call(config=dict(arbitrary_types_allowed=True))
|
||||
def granger(
|
||||
self,
|
||||
data: Union[List[Data], pandas.DataFrame],
|
||||
y_column: str,
|
||||
x_column: str,
|
||||
lag: typing_extensions.Annotated[int, Gt(gt=0)] = 3,
|
||||
) -> OBBject[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._run(
|
||||
"/econometrics/granger",
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call(config=dict(arbitrary_types_allowed=True))
|
||||
def ols(
|
||||
self,
|
||||
data: Union[List[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._run(
|
||||
"/econometrics/ols",
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call(config=dict(arbitrary_types_allowed=True))
|
||||
def ols_summary(
|
||||
self,
|
||||
data: Union[List[Data], pandas.DataFrame],
|
||||
y_column: str,
|
||||
x_columns: List[str],
|
||||
) -> OBBject[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._run(
|
||||
"/econometrics/ols_summary",
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call(config=dict(arbitrary_types_allowed=True))
|
||||
def panelbols(
|
||||
self,
|
||||
data: Union[List[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._run(
|
||||
"/econometrics/panelbols",
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call(config=dict(arbitrary_types_allowed=True))
|
||||
def panelfd(
|
||||
self,
|
||||
data: Union[List[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._run(
|
||||
"/econometrics/panelfd",
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call(config=dict(arbitrary_types_allowed=True))
|
||||
def panelfmac(
|
||||
self,
|
||||
data: Union[List[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._run(
|
||||
"/econometrics/panelfmac",
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call(config=dict(arbitrary_types_allowed=True))
|
||||
def panelols(
|
||||
self,
|
||||
data: Union[List[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._run(
|
||||
"/econometrics/panelols",
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call(config=dict(arbitrary_types_allowed=True))
|
||||
def panelpols(
|
||||
self,
|
||||
data: Union[List[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._run(
|
||||
"/econometrics/panelpols",
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call(config=dict(arbitrary_types_allowed=True))
|
||||
def panelre(
|
||||
self,
|
||||
data: Union[List[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._run(
|
||||
"/econometrics/panelre",
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call(config=dict(arbitrary_types_allowed=True))
|
||||
def unitroot(
|
||||
self,
|
||||
data: Union[List[Data], pandas.DataFrame],
|
||||
column: str,
|
||||
regression: Literal["c", "ct", "ctt"] = "c",
|
||||
) -> OBBject[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._run(
|
||||
"/econometrics/unitroot",
|
||||
**inputs,
|
||||
)
|
||||
@@ -7,52 +7,43 @@ import typing_extensions
|
||||
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.decorators import validate
|
||||
from openbb_core.app.static.filters import filter_inputs
|
||||
from openbb_provider.abstract.data import Data
|
||||
from pydantic import validate_call
|
||||
|
||||
|
||||
class ROUTER_economy(Container):
|
||||
"""/economy
|
||||
available_indices
|
||||
const
|
||||
cot
|
||||
cot_search
|
||||
cpi
|
||||
european_index
|
||||
european_index_constituents
|
||||
fred_index
|
||||
index
|
||||
index_search
|
||||
index_snapshots
|
||||
risk
|
||||
sp500_multiples
|
||||
"""
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return self.__doc__ or ""
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def available_indices(
|
||||
self, provider: Union[Literal["cboe", "fmp", "yfinance"], None] = None, **kwargs
|
||||
self, provider: Union[Literal["fmp"], None] = None, **kwargs
|
||||
) -> OBBject[List[Data]]:
|
||||
"""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 : Union[List[AvailableIndices]]
|
||||
Serializable results.
|
||||
provider : Union[Literal['cboe', 'fmp', 'yfinance'], None]
|
||||
provider : Union[Literal['fmp'], None]
|
||||
Provider name.
|
||||
warnings : Optional[List[Warning_]]
|
||||
List of warnings.
|
||||
@@ -67,34 +58,11 @@ class ROUTER_economy(Container):
|
||||
Name of the index.
|
||||
currency : Optional[Union[str]]
|
||||
Currency the index is traded in.
|
||||
isin : Optional[Union[str]]
|
||||
ISIN code for the index. Valid only for European indices. (provider: cboe)
|
||||
region : Optional[Union[str]]
|
||||
Region for the index. Valid only for European indices (provider: cboe)
|
||||
symbol : Optional[Union[str]]
|
||||
Symbol for the index. (provider: cboe, yfinance)
|
||||
description : Optional[Union[str]]
|
||||
Description for the index. Valid only for US indices. (provider: cboe)
|
||||
data_delay : Optional[Union[int]]
|
||||
Data delay for the index. Valid only for US indices. (provider: cboe)
|
||||
open_time : Optional[Union[datetime.time]]
|
||||
Opening time for the index. Valid only for US indices. (provider: cboe)
|
||||
close_time : Optional[Union[datetime.time]]
|
||||
Closing time for the index. Valid only for US indices. (provider: cboe)
|
||||
time_zone : Optional[Union[str]]
|
||||
Time zone for the index. Valid only for US indices. (provider: cboe)
|
||||
tick_days : Optional[Union[str]]
|
||||
The trading days for the index. Valid only for US indices. (provider: cboe)
|
||||
tick_frequency : Optional[Union[str]]
|
||||
The frequency of the index ticks. Valid only for US indices. (provider: cboe)
|
||||
tick_period : Optional[Union[str]]
|
||||
The period of the index ticks. Valid only for US indices. (provider: cboe)
|
||||
stock_exchange : Optional[Union[str]]
|
||||
Stock exchange where the index is listed. (provider: fmp)
|
||||
exchange_short_name : Optional[Union[str]]
|
||||
Short name of the stock exchange where the index is listed. (provider: fmp)
|
||||
code : Optional[Union[str]]
|
||||
ID code for keying the index in the OpenBB Terminal. (provider: yfinance)""" # noqa: E501
|
||||
""" # noqa: E501
|
||||
|
||||
inputs = filter_inputs(
|
||||
provider_choices={
|
||||
@@ -109,7 +77,7 @@ class ROUTER_economy(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def const(
|
||||
self,
|
||||
index: typing_extensions.Annotated[
|
||||
@@ -180,163 +148,7 @@ class ROUTER_economy(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
def cot(
|
||||
self, provider: Union[Literal["quandl"], None] = None, **kwargs
|
||||
) -> OBBject[List[Data]]:
|
||||
"""Lookup Commitment of Traders Reports by series ID.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
provider : Union[Literal['quandl'], None]
|
||||
The provider to use for the query, by default None.
|
||||
If None, the provider specified in defaults is selected or 'quandl' if there is
|
||||
no default.
|
||||
code : str
|
||||
|
||||
CFTC series code. Use search_cot() to find the code.
|
||||
Codes not listed in the curated list, but are published by on the Nasdaq Data Link website, are valid.
|
||||
Certain symbols, such as "ES=F", or exact names are also valid.
|
||||
Default report is: S&P 500 Consolidated (CME))
|
||||
(provider: quandl)
|
||||
data_type : Optional[Union[Literal['F', 'FO', 'CITS']]]
|
||||
|
||||
The type of data to reuturn. Default is "FO".
|
||||
|
||||
F = Futures only
|
||||
|
||||
FO = Futures and Options
|
||||
|
||||
CITS = Commodity Index Trader Supplemental. Only valid for commodities.
|
||||
(provider: quandl)
|
||||
legacy_format : Optional[Union[bool]]
|
||||
Returns the legacy format of report. Default is False. (provider: quandl)
|
||||
report_type : Optional[Union[Literal['ALL', 'CHG', 'OLD', 'OTR']]]
|
||||
|
||||
The type of report to return. Default is "ALL".
|
||||
|
||||
ALL = All
|
||||
|
||||
CHG = Change in Positions
|
||||
|
||||
OLD = Old Crop Years
|
||||
|
||||
OTR = Other Crop Years
|
||||
(provider: quandl)
|
||||
measure : Optional[Union[Literal['CR', 'NT', 'OI', 'CHG']]]
|
||||
|
||||
The measure to return. Default is None.
|
||||
|
||||
CR = Concentration Ratios
|
||||
|
||||
NT = Number of Traders
|
||||
|
||||
OI = Percent of Open Interest
|
||||
|
||||
CHG = Change in Positions. Only valid when data_type is "CITS".
|
||||
(provider: quandl)
|
||||
start_date : Optional[Union[datetime.date]]
|
||||
The start date of the time series. Defaults to all. (provider: quandl)
|
||||
end_date : Optional[Union[datetime.date]]
|
||||
The end date of the time series. Defaults to the most recent data. (provider: quandl)
|
||||
transform : Optional[Union[Literal['diff', 'rdiff', 'cumul', 'normalize']]]
|
||||
Transform the data as w/w difference, percent change, cumulative, or normalize. (provider: quandl)
|
||||
|
||||
Returns
|
||||
-------
|
||||
OBBject
|
||||
results : Union[List[COT]]
|
||||
Serializable results.
|
||||
provider : Union[Literal['quandl'], None]
|
||||
Provider name.
|
||||
warnings : Optional[List[Warning_]]
|
||||
List of warnings.
|
||||
chart : Optional[Chart]
|
||||
Chart object.
|
||||
extra: Dict[str, Any]
|
||||
Extra info.
|
||||
|
||||
COT
|
||||
---""" # noqa: E501
|
||||
|
||||
inputs = filter_inputs(
|
||||
provider_choices={
|
||||
"provider": provider,
|
||||
},
|
||||
standard_params={},
|
||||
extra_params=kwargs,
|
||||
)
|
||||
|
||||
return self._run(
|
||||
"/economy/cot",
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
def cot_search(
|
||||
self,
|
||||
query: typing_extensions.Annotated[
|
||||
str, OpenBBCustomParameter(description="Search query.")
|
||||
] = "",
|
||||
provider: Union[Literal["quandl"], None] = None,
|
||||
**kwargs
|
||||
) -> OBBject[List[Data]]:
|
||||
"""Fuzzy search and list of curated Commitment of Traders Reports series information.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
query : str
|
||||
Search query.
|
||||
provider : Union[Literal['quandl'], None]
|
||||
The provider to use for the query, by default None.
|
||||
If None, the provider specified in defaults is selected or 'quandl' if there is
|
||||
no default.
|
||||
|
||||
Returns
|
||||
-------
|
||||
OBBject
|
||||
results : Union[List[COTSearch]]
|
||||
Serializable results.
|
||||
provider : Union[Literal['quandl'], None]
|
||||
Provider name.
|
||||
warnings : Optional[List[Warning_]]
|
||||
List of warnings.
|
||||
chart : Optional[Chart]
|
||||
Chart object.
|
||||
extra: Dict[str, Any]
|
||||
Extra info.
|
||||
|
||||
COTSearch
|
||||
---------
|
||||
code : str
|
||||
CFTC Code of the report.
|
||||
name : str
|
||||
Name of the underlying asset.
|
||||
category : Optional[Union[str]]
|
||||
Category of the underlying asset.
|
||||
subcategory : Optional[Union[str]]
|
||||
Subcategory of the underlying asset.
|
||||
units : Optional[Union[str]]
|
||||
The units for one contract.
|
||||
symbol : Optional[Union[str]]
|
||||
Trading symbol representing the underlying asset.""" # noqa: E501
|
||||
|
||||
inputs = filter_inputs(
|
||||
provider_choices={
|
||||
"provider": provider,
|
||||
},
|
||||
standard_params={
|
||||
"query": query,
|
||||
},
|
||||
extra_params=kwargs,
|
||||
)
|
||||
|
||||
return self._run(
|
||||
"/economy/cot_search",
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def cpi(
|
||||
self,
|
||||
countries: typing_extensions.Annotated[
|
||||
@@ -486,175 +298,7 @@ class ROUTER_economy(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
def european_index(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
Union[str, List[str]],
|
||||
OpenBBCustomParameter(description="Symbol to get data for."),
|
||||
],
|
||||
start_date: typing_extensions.Annotated[
|
||||
Union[datetime.date, None, str],
|
||||
OpenBBCustomParameter(
|
||||
description="Start date of the data, in YYYY-MM-DD format."
|
||||
),
|
||||
] = None,
|
||||
end_date: typing_extensions.Annotated[
|
||||
Union[datetime.date, None, str],
|
||||
OpenBBCustomParameter(
|
||||
description="End date of the data, in YYYY-MM-DD format."
|
||||
),
|
||||
] = None,
|
||||
provider: Union[Literal["cboe"], None] = None,
|
||||
**kwargs
|
||||
) -> OBBject[List[Data]]:
|
||||
"""Get historical close values for select European indices.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
symbol : str
|
||||
Symbol to get data for.
|
||||
start_date : Union[datetime.date, None]
|
||||
Start date of the data, in YYYY-MM-DD format.
|
||||
end_date : Union[datetime.date, None]
|
||||
End date of the data, in YYYY-MM-DD format.
|
||||
provider : Union[Literal['cboe'], 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
|
||||
no default.
|
||||
interval : Optional[Union[Literal['1d', '1m']]]
|
||||
Data granularity. (provider: cboe)
|
||||
|
||||
Returns
|
||||
-------
|
||||
OBBject
|
||||
results : Union[List[EuropeanIndexHistorical]]
|
||||
Serializable results.
|
||||
provider : Union[Literal['cboe'], None]
|
||||
Provider name.
|
||||
warnings : Optional[List[Warning_]]
|
||||
List of warnings.
|
||||
chart : Optional[Chart]
|
||||
Chart object.
|
||||
extra: Dict[str, Any]
|
||||
Extra info.
|
||||
|
||||
EuropeanIndexHistorical
|
||||
-----------------------
|
||||
date : datetime
|
||||
The date of the data.
|
||||
close : float
|
||||
The close price of the symbol.
|
||||
open : Optional[Union[float]]
|
||||
Opening price for the interval. Only valid when interval is 1m. (provider: cboe)
|
||||
high : Optional[Union[float]]
|
||||
High price for the interval. Only valid when interval is 1m. (provider: cboe)
|
||||
low : Optional[Union[float]]
|
||||
Low price for the interval. Only valid when interval is 1m. (provider: cboe)
|
||||
utc_datetime : Optional[Union[datetime]]
|
||||
UTC datetime. Only valid when interval is 1m. (provider: cboe)""" # noqa: E501
|
||||
|
||||
inputs = filter_inputs(
|
||||
provider_choices={
|
||||
"provider": provider,
|
||||
},
|
||||
standard_params={
|
||||
"symbol": ",".join(symbol) if isinstance(symbol, list) else symbol,
|
||||
"start_date": start_date,
|
||||
"end_date": end_date,
|
||||
},
|
||||
extra_params=kwargs,
|
||||
)
|
||||
|
||||
return self._run(
|
||||
"/economy/european_index",
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
def european_index_constituents(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
Union[str, List[str]],
|
||||
OpenBBCustomParameter(description="Symbol to get data for."),
|
||||
],
|
||||
provider: Union[Literal["cboe"], None] = None,
|
||||
**kwargs
|
||||
) -> OBBject[List[Data]]:
|
||||
"""Get current levels for constituents of select European indices.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
symbol : str
|
||||
Symbol to get data for.
|
||||
provider : Union[Literal['cboe'], 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
|
||||
no default.
|
||||
|
||||
Returns
|
||||
-------
|
||||
OBBject
|
||||
results : Union[List[EuropeanIndexConstituents]]
|
||||
Serializable results.
|
||||
provider : Union[Literal['cboe'], None]
|
||||
Provider name.
|
||||
warnings : Optional[List[Warning_]]
|
||||
List of warnings.
|
||||
chart : Optional[Chart]
|
||||
Chart object.
|
||||
extra: Dict[str, Any]
|
||||
Extra info.
|
||||
|
||||
EuropeanIndexConstituents
|
||||
-------------------------
|
||||
symbol : str
|
||||
Symbol of the constituent company in the index.
|
||||
price : float
|
||||
Current price of the constituent company in the index.
|
||||
open : float
|
||||
The open price of the symbol.
|
||||
high : float
|
||||
The high price of the symbol.
|
||||
low : float
|
||||
The low price of the symbol.
|
||||
close : float
|
||||
The close price of the symbol.
|
||||
volume : float
|
||||
The volume of the symbol.
|
||||
prev_close : Optional[Union[float]]
|
||||
Previous closing price. (provider: cboe)
|
||||
change : Optional[Union[float]]
|
||||
Change in price. (provider: cboe)
|
||||
change_percent : Optional[Union[float]]
|
||||
Change in price as a percentage. (provider: cboe)
|
||||
tick : Optional[Union[str]]
|
||||
Whether the last sale was an up or down tick. (provider: cboe)
|
||||
last_trade_timestamp : Optional[Union[datetime]]
|
||||
Last trade timestamp for the symbol. (provider: cboe)
|
||||
exchange_id : Optional[Union[int]]
|
||||
The Exchange ID number. (provider: cboe)
|
||||
seqno : Optional[Union[int]]
|
||||
Sequence number of the last trade on the tape. (provider: cboe)
|
||||
asset_type : Optional[Union[str]]
|
||||
Type of asset. (provider: cboe)""" # noqa: E501
|
||||
|
||||
inputs = filter_inputs(
|
||||
provider_choices={
|
||||
"provider": provider,
|
||||
},
|
||||
standard_params={
|
||||
"symbol": ",".join(symbol) if isinstance(symbol, list) else symbol,
|
||||
},
|
||||
extra_params=kwargs,
|
||||
)
|
||||
|
||||
return self._run(
|
||||
"/economy/european_index_constituents",
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def fred_index(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
@@ -740,7 +384,7 @@ class ROUTER_economy(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def index(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
@@ -759,7 +403,7 @@ class ROUTER_economy(Container):
|
||||
description="End date of the data, in YYYY-MM-DD format."
|
||||
),
|
||||
] = None,
|
||||
provider: Union[Literal["cboe", "fmp", "polygon", "yfinance"], None] = None,
|
||||
provider: Union[Literal["fmp", "polygon"], None] = None,
|
||||
**kwargs
|
||||
) -> OBBject[List[Data]]:
|
||||
"""Get historical levels for an index.
|
||||
@@ -772,14 +416,14 @@ class ROUTER_economy(Container):
|
||||
Start date of the data, in YYYY-MM-DD format.
|
||||
end_date : Union[datetime.date, None]
|
||||
End date of the data, in YYYY-MM-DD format.
|
||||
provider : Union[Literal['cboe', '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 'cboe' if there is
|
||||
If None, the provider specified in defaults is selected or 'fmp' if there is
|
||||
no default.
|
||||
interval : Optional[Union[Literal['1d', '1m'], Literal['1min', '5min', '15min', '30min', '1hour', '4hour', '1day'], Literal['1m', '2m', '5m', '15m', '30m', '60m', '90m', '1h', '1d', '5d', '1wk', '1mo', '3mo']]]
|
||||
Use interval, 1m, for intraday prices during the most recent trading period. (provider: cboe); Data granularity. (provider: fmp); Data granularity. (provider: yfinance)
|
||||
timeseries : Optional[Union[typing_extensions.Annotated[int, Ge(ge=0)]]]
|
||||
Number of days to look back. (provider: fmp)
|
||||
interval : Literal['1min', '5min', '15min', '30min', '1hour', '4hour', '1day']
|
||||
Data granularity. (provider: fmp)
|
||||
timespan : Literal['minute', 'hour', 'day', 'week', 'month', 'quarter', 'year']
|
||||
Timespan of the data. (provider: polygon)
|
||||
sort : Literal['asc', 'desc']
|
||||
@@ -790,19 +434,13 @@ class ROUTER_economy(Container):
|
||||
Whether the data is adjusted. (provider: polygon)
|
||||
multiplier : int
|
||||
Multiplier of the timespan. (provider: polygon)
|
||||
period : Optional[Union[Literal['1d', '5d', '1mo', '3mo', '6mo', '1y', '2y', '5y', '10y', 'ytd', 'max']]]
|
||||
Period of the data to return. (provider: yfinance)
|
||||
prepost : bool
|
||||
Include Pre and Post market data. (provider: yfinance)
|
||||
rounding : bool
|
||||
Round prices to two decimals? (provider: yfinance)
|
||||
|
||||
Returns
|
||||
-------
|
||||
OBBject
|
||||
results : Union[List[MajorIndicesHistorical]]
|
||||
Serializable results.
|
||||
provider : Union[Literal['cboe', 'fmp', 'polygon', 'yfinance'], None]
|
||||
provider : Union[Literal['fmp', 'polygon'], None]
|
||||
Provider name.
|
||||
warnings : Optional[List[Warning_]]
|
||||
List of warnings.
|
||||
@@ -825,12 +463,6 @@ class ROUTER_economy(Container):
|
||||
The close price of the symbol.
|
||||
volume : Optional[int]
|
||||
The volume of the symbol.
|
||||
calls_volume : Optional[Union[float]]
|
||||
Number of calls traded during the most recent trading period. Only valid if interval is 1m. (provider: cboe)
|
||||
puts_volume : Optional[Union[float]]
|
||||
Number of puts traded during the most recent trading period. Only valid if interval is 1m. (provider: cboe)
|
||||
total_options_volume : Optional[Union[float]]
|
||||
Total number of options traded during the most recent trading period. Only valid if interval is 1m. (provider: cboe)
|
||||
adj_close : Optional[Union[float]]
|
||||
Adjusted Close Price of the symbol. (provider: fmp)
|
||||
unadjusted_volume : Optional[Union[float]]
|
||||
@@ -864,175 +496,7 @@ class ROUTER_economy(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
def index_search(
|
||||
self,
|
||||
query: typing_extensions.Annotated[
|
||||
str, OpenBBCustomParameter(description="Search query.")
|
||||
] = "",
|
||||
symbol: typing_extensions.Annotated[
|
||||
Union[bool, List[str]],
|
||||
OpenBBCustomParameter(description="Whether to search by ticker symbol."),
|
||||
] = False,
|
||||
provider: Union[Literal["cboe"], None] = None,
|
||||
**kwargs
|
||||
) -> OBBject[List[Data]]:
|
||||
"""Search for indices.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
query : str
|
||||
Search query.
|
||||
symbol : bool
|
||||
Whether to search by ticker symbol.
|
||||
provider : Union[Literal['cboe'], 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
|
||||
no default.
|
||||
europe : bool
|
||||
Filter for European indices. False for US indices. (provider: cboe)
|
||||
|
||||
Returns
|
||||
-------
|
||||
OBBject
|
||||
results : Union[List[IndexSearch]]
|
||||
Serializable results.
|
||||
provider : Union[Literal['cboe'], None]
|
||||
Provider name.
|
||||
warnings : Optional[List[Warning_]]
|
||||
List of warnings.
|
||||
chart : Optional[Chart]
|
||||
Chart object.
|
||||
extra: Dict[str, Any]
|
||||
Extra info.
|
||||
|
||||
IndexSearch
|
||||
-----------
|
||||
symbol : str
|
||||
Symbol of the index.
|
||||
name : str
|
||||
Name of the index.
|
||||
isin : Optional[Union[str]]
|
||||
ISIN code for the index. Valid only for European indices. (provider: cboe)
|
||||
region : Optional[Union[str]]
|
||||
Region for the index. Valid only for European indices (provider: cboe)
|
||||
description : Optional[Union[str]]
|
||||
Description for the index. (provider: cboe)
|
||||
data_delay : Optional[Union[int]]
|
||||
Data delay for the index. Valid only for US indices. (provider: cboe)
|
||||
currency : Optional[Union[str]]
|
||||
Currency for the index. (provider: cboe)
|
||||
time_zone : Optional[Union[str]]
|
||||
Time zone for the index. Valid only for US indices. (provider: cboe)
|
||||
open_time : Optional[Union[datetime.time]]
|
||||
Opening time for the index. Valid only for US indices. (provider: cboe)
|
||||
close_time : Optional[Union[datetime.time]]
|
||||
Closing time for the index. Valid only for US indices. (provider: cboe)
|
||||
tick_days : Optional[Union[str]]
|
||||
The trading days for the index. Valid only for US indices. (provider: cboe)
|
||||
tick_frequency : Optional[Union[str]]
|
||||
Tick frequency for the index. Valid only for US indices. (provider: cboe)
|
||||
tick_period : Optional[Union[str]]
|
||||
Tick period for the index. Valid only for US indices. (provider: cboe)""" # noqa: E501
|
||||
|
||||
inputs = filter_inputs(
|
||||
provider_choices={
|
||||
"provider": provider,
|
||||
},
|
||||
standard_params={
|
||||
"query": query,
|
||||
"symbol": ",".join(symbol) if isinstance(symbol, list) else symbol,
|
||||
},
|
||||
extra_params=kwargs,
|
||||
)
|
||||
|
||||
return self._run(
|
||||
"/economy/index_search",
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
def index_snapshots(
|
||||
self,
|
||||
region: typing_extensions.Annotated[
|
||||
Union[Literal["US", "EU"], None],
|
||||
OpenBBCustomParameter(
|
||||
description="The region to return. Currently supports US and EU."
|
||||
),
|
||||
] = "US",
|
||||
provider: Union[Literal["cboe"], None] = None,
|
||||
**kwargs
|
||||
) -> OBBject[List[Data]]:
|
||||
"""Get current levels for all indices from a provider.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
region : Union[Literal['US', 'EU'], None]
|
||||
The region to return. Currently supports US and EU.
|
||||
provider : Union[Literal['cboe'], 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
|
||||
no default.
|
||||
|
||||
Returns
|
||||
-------
|
||||
OBBject
|
||||
results : Union[List[IndexSnapshots]]
|
||||
Serializable results.
|
||||
provider : Union[Literal['cboe'], None]
|
||||
Provider name.
|
||||
warnings : Optional[List[Warning_]]
|
||||
List of warnings.
|
||||
chart : Optional[Chart]
|
||||
Chart object.
|
||||
extra: Dict[str, Any]
|
||||
Extra info.
|
||||
|
||||
IndexSnapshots
|
||||
--------------
|
||||
symbol : str
|
||||
Symbol of the index.
|
||||
name : Optional[Union[str]]
|
||||
Name of the index.
|
||||
currency : Optional[Union[str]]
|
||||
Currency of the index.
|
||||
price : Optional[Union[float]]
|
||||
Current price of the index.
|
||||
open : Optional[Union[float]]
|
||||
Opening price of the index.
|
||||
high : Optional[Union[float]]
|
||||
Highest price of the index.
|
||||
low : Optional[Union[float]]
|
||||
Lowest price of the index.
|
||||
close : Optional[Union[float]]
|
||||
Closing price of the index.
|
||||
prev_close : Optional[Union[float]]
|
||||
Previous closing price of the index.
|
||||
change : Optional[Union[float]]
|
||||
Change of the index.
|
||||
change_percent : Optional[Union[float]]
|
||||
Change percent of the index.
|
||||
isin : Optional[Union[str]]
|
||||
ISIN code for the index. Valid only for European indices. (provider: cboe)
|
||||
last_trade_timestamp : Optional[Union[datetime]]
|
||||
Last trade timestamp for the index. (provider: cboe)""" # noqa: E501
|
||||
|
||||
inputs = filter_inputs(
|
||||
provider_choices={
|
||||
"provider": provider,
|
||||
},
|
||||
standard_params={
|
||||
"region": region,
|
||||
},
|
||||
extra_params=kwargs,
|
||||
)
|
||||
|
||||
return self._run(
|
||||
"/economy/index_snapshots",
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def risk(
|
||||
self, provider: Union[Literal["fmp"], None] = None, **kwargs
|
||||
) -> OBBject[List[Data]]:
|
||||
@@ -1082,133 +546,3 @@ class ROUTER_economy(Container):
|
||||
"/economy/risk",
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
def sp500_multiples(
|
||||
self,
|
||||
series_name: typing_extensions.Annotated[
|
||||
Literal[
|
||||
"Shiller PE Ratio by Month",
|
||||
"Shiller PE Ratio by Year",
|
||||
"PE Ratio by Year",
|
||||
"PE Ratio by Month",
|
||||
"Dividend by Year",
|
||||
"Dividend by Month",
|
||||
"Dividend Growth by Quarter",
|
||||
"Dividend Growth by Year",
|
||||
"Dividend Yield by Year",
|
||||
"Dividend Yield by Month",
|
||||
"Earnings by Year",
|
||||
"Earnings by Month",
|
||||
"Earnings Growth by Year",
|
||||
"Earnings Growth by Quarter",
|
||||
"Real Earnings Growth by Year",
|
||||
"Real Earnings Growth by Quarter",
|
||||
"Earnings Yield by Year",
|
||||
"Earnings Yield by Month",
|
||||
"Real Price by Year",
|
||||
"Real Price by Month",
|
||||
"Inflation Adjusted Price by Year",
|
||||
"Inflation Adjusted Price by Month",
|
||||
"Sales by Year",
|
||||
"Sales by Quarter",
|
||||
"Sales Growth by Year",
|
||||
"Sales Growth by Quarter",
|
||||
"Real Sales by Year",
|
||||
"Real Sales by Quarter",
|
||||
"Real Sales Growth by Year",
|
||||
"Real Sales Growth by Quarter",
|
||||
"Price to Sales Ratio by Year",
|
||||
"Price to Sales Ratio by Quarter",
|
||||
"Price to Book Value Ratio by Year",
|
||||
"Price to Book Value Ratio by Quarter",
|
||||
"Book Value per Share by Year",
|
||||
"Book Value per Share by Quarter",
|
||||
],
|
||||
OpenBBCustomParameter(
|
||||
description="The name of the series. Defaults to 'PE Ratio by Month'."
|
||||
),
|
||||
] = "PE Ratio by Month",
|
||||
start_date: typing_extensions.Annotated[
|
||||
Union[str, None],
|
||||
OpenBBCustomParameter(
|
||||
description="The start date of the time series. Format: YYYY-MM-DD"
|
||||
),
|
||||
] = "",
|
||||
end_date: typing_extensions.Annotated[
|
||||
Union[str, None],
|
||||
OpenBBCustomParameter(
|
||||
description="The end date of the time series. Format: YYYY-MM-DD"
|
||||
),
|
||||
] = "",
|
||||
collapse: typing_extensions.Annotated[
|
||||
Union[Literal["daily", "weekly", "monthly", "quarterly", "annual"], None],
|
||||
OpenBBCustomParameter(
|
||||
description="Collapse the frequency of the time series."
|
||||
),
|
||||
] = "monthly",
|
||||
transform: typing_extensions.Annotated[
|
||||
Union[Literal["diff", "rdiff", "cumul", "normalize"], None],
|
||||
OpenBBCustomParameter(description="The transformation of the time series."),
|
||||
] = None,
|
||||
provider: Union[Literal["quandl"], None] = None,
|
||||
**kwargs
|
||||
) -> OBBject[List[Data]]:
|
||||
"""Historical S&P 500 multiples and Shiller PE ratios.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
series_name : Literal['Shiller PE Ratio by Month', 'Shiller PE Ratio by Year', 'PE Rat...
|
||||
The name of the series. Defaults to 'PE Ratio by Month'.
|
||||
start_date : Union[str, None]
|
||||
The start date of the time series. Format: YYYY-MM-DD
|
||||
end_date : Union[str, None]
|
||||
The end date of the time series. Format: YYYY-MM-DD
|
||||
collapse : Union[Literal['daily', 'weekly', 'monthly', 'quarterly', 'annual'...
|
||||
Collapse the frequency of the time series.
|
||||
transform : Union[Literal['diff', 'rdiff', 'cumul', 'normalize'], None]
|
||||
The transformation of the time series.
|
||||
provider : Union[Literal['quandl'], None]
|
||||
The provider to use for the query, by default None.
|
||||
If None, the provider specified in defaults is selected or 'quandl' if there is
|
||||
no default.
|
||||
|
||||
Returns
|
||||
-------
|
||||
OBBject
|
||||
results : Union[List[SP500Multiples]]
|
||||
Serializable results.
|
||||
provider : Union[Literal['quandl'], None]
|
||||
Provider name.
|
||||
warnings : Optional[List[Warning_]]
|
||||
List of warnings.
|
||||
chart : Optional[Chart]
|
||||
Chart object.
|
||||
extra: Dict[str, Any]
|
||||
Extra info.
|
||||
|
||||
SP500Multiples
|
||||
--------------
|
||||
date : str
|
||||
The date data for the time series.
|
||||
value : float
|
||||
The data value for the time series.""" # noqa: E501
|
||||
|
||||
inputs = filter_inputs(
|
||||
provider_choices={
|
||||
"provider": provider,
|
||||
},
|
||||
standard_params={
|
||||
"series_name": series_name,
|
||||
"start_date": start_date,
|
||||
"end_date": end_date,
|
||||
"collapse": collapse,
|
||||
"transform": transform,
|
||||
},
|
||||
extra_params=kwargs,
|
||||
)
|
||||
|
||||
return self._run(
|
||||
"/economy/sp500_multiples",
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@@ -1,26 +1,17 @@
|
||||
{
|
||||
"openbb_core_extension": [
|
||||
"crypto@0.1.0a2",
|
||||
"econometrics@0.1.0a2",
|
||||
"economy@0.1.0a2",
|
||||
"fixedincome@0.1.0a2",
|
||||
"forex@0.1.0a2",
|
||||
"futures@0.1.0a2",
|
||||
"news@0.1.0a2",
|
||||
"openbb_charting@0.1.0a2",
|
||||
"qa@0.1.0a2",
|
||||
"stocks@0.1.0a2",
|
||||
"ta@0.1.0a2"
|
||||
"stocks@0.1.0a2"
|
||||
],
|
||||
"openbb_provider_extension": [
|
||||
"alpha_vantage@0.1.0a2",
|
||||
"benzinga@0.1.0a2",
|
||||
"cboe@0.1.0a2",
|
||||
"fmp@0.1.0a2",
|
||||
"fred@0.1.0a2",
|
||||
"intrinio@0.1.0a2",
|
||||
"polygon@0.1.0a2",
|
||||
"quandl@0.1.0a2",
|
||||
"yfinance@0.1.0a2"
|
||||
"polygon@0.1.0a2"
|
||||
]
|
||||
}
|
||||
@@ -7,9 +7,9 @@ import typing_extensions
|
||||
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.decorators import validate
|
||||
from openbb_core.app.static.filters import filter_inputs
|
||||
from openbb_provider.abstract.data import Data
|
||||
from pydantic import validate_call
|
||||
|
||||
|
||||
class ROUTER_fixedincome(Container):
|
||||
@@ -28,7 +28,7 @@ class ROUTER_fixedincome(Container):
|
||||
def __repr__(self) -> str:
|
||||
return self.__doc__ or ""
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def ameribor(
|
||||
self,
|
||||
start_date: typing_extensions.Annotated[
|
||||
@@ -101,7 +101,7 @@ class ROUTER_fixedincome(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def estr(
|
||||
self,
|
||||
start_date: typing_extensions.Annotated[
|
||||
@@ -175,7 +175,7 @@ class ROUTER_fixedincome(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def fed(
|
||||
self,
|
||||
start_date: typing_extensions.Annotated[
|
||||
@@ -249,7 +249,7 @@ class ROUTER_fixedincome(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def iorb(
|
||||
self,
|
||||
start_date: typing_extensions.Annotated[
|
||||
@@ -321,7 +321,7 @@ class ROUTER_fixedincome(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def projections(
|
||||
self, provider: Union[Literal["fred"], None] = None, **kwargs
|
||||
) -> OBBject[List[Data]]:
|
||||
@@ -386,7 +386,7 @@ class ROUTER_fixedincome(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def sofr(
|
||||
self,
|
||||
start_date: typing_extensions.Annotated[
|
||||
@@ -456,7 +456,7 @@ class ROUTER_fixedincome(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def sonia(
|
||||
self,
|
||||
start_date: typing_extensions.Annotated[
|
||||
@@ -529,7 +529,7 @@ class ROUTER_fixedincome(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def treasury(
|
||||
self,
|
||||
start_date: typing_extensions.Annotated[
|
||||
@@ -619,7 +619,7 @@ class ROUTER_fixedincome(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def ycrv(
|
||||
self,
|
||||
date: typing_extensions.Annotated[
|
||||
|
||||
@@ -7,9 +7,9 @@ import typing_extensions
|
||||
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.decorators import validate
|
||||
from openbb_core.app.static.filters import filter_inputs
|
||||
from openbb_provider.abstract.data import Data
|
||||
from pydantic import validate_call
|
||||
|
||||
|
||||
class ROUTER_forex(Container):
|
||||
@@ -21,7 +21,7 @@ class ROUTER_forex(Container):
|
||||
def __repr__(self) -> str:
|
||||
return self.__doc__ or ""
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def load(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
@@ -42,7 +42,7 @@ class ROUTER_forex(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[Data]]:
|
||||
"""Forex Intraday Price.
|
||||
@@ -55,12 +55,12 @@ class ROUTER_forex(Container):
|
||||
Start date of the data, in YYYY-MM-DD format.
|
||||
end_date : Union[datetime.date, None]
|
||||
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.
|
||||
interval : Optional[Union[Literal['1min', '5min', '15min', '30min', '1hour', '4hour', '1day'], Literal['1m', '2m', '5m', '15m', '30m', '60m', '90m', '1h', '1d', '5d', '1wk', '1mo', '3mo']]]
|
||||
Data granularity. (provider: fmp, yfinance)
|
||||
interval : Literal['1min', '5min', '15min', '30min', '1hour', '4hour', '1day']
|
||||
Data granularity. (provider: fmp)
|
||||
multiplier : int
|
||||
Multiplier of the timespan. (provider: polygon)
|
||||
timespan : Literal['minute', 'hour', 'day', 'week', 'month', 'quarter', 'year']
|
||||
@@ -71,15 +71,13 @@ class ROUTER_forex(Container):
|
||||
The number of data entries to return. (provider: polygon)
|
||||
adjusted : bool
|
||||
Whether the data is adjusted. (provider: polygon)
|
||||
period : Optional[Union[Literal['1d', '5d', '1mo', '3mo', '6mo', '1y', '2y', '5y', '10y', 'ytd', 'max']]]
|
||||
Period of the data to return. (provider: yfinance)
|
||||
|
||||
Returns
|
||||
-------
|
||||
OBBject
|
||||
results : Union[List[ForexHistorical]]
|
||||
Serializable results.
|
||||
provider : Union[Literal['fmp', 'polygon', 'yfinance'], None]
|
||||
provider : Union[Literal['fmp', 'polygon'], None]
|
||||
Provider name.
|
||||
warnings : Optional[List[Warning_]]
|
||||
List of warnings.
|
||||
@@ -137,7 +135,7 @@ class ROUTER_forex(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def pairs(
|
||||
self,
|
||||
provider: Union[Literal["fmp", "intrinio", "polygon"], None] = None,
|
||||
|
||||
@@ -1,188 +0,0 @@
|
||||
### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ###
|
||||
|
||||
import datetime
|
||||
from typing import List, Literal, Union
|
||||
|
||||
import typing_extensions
|
||||
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 openbb_provider.abstract.data import Data
|
||||
from pydantic import validate_call
|
||||
|
||||
|
||||
class ROUTER_futures(Container):
|
||||
"""/futures
|
||||
curve
|
||||
load
|
||||
"""
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return self.__doc__ or ""
|
||||
|
||||
@validate_call
|
||||
def curve(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
Union[str, List[str]],
|
||||
OpenBBCustomParameter(description="Symbol to get data for."),
|
||||
],
|
||||
date: typing_extensions.Annotated[
|
||||
Union[datetime.date, None],
|
||||
OpenBBCustomParameter(description="Historical date to search curve for."),
|
||||
] = None,
|
||||
provider: Union[Literal["cboe", "yfinance"], None] = None,
|
||||
**kwargs
|
||||
) -> OBBject[List[Data]]:
|
||||
"""Futures Historical Price.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
symbol : str
|
||||
Symbol to get data for.
|
||||
date : Union[datetime.date, None]
|
||||
Historical date to search curve for.
|
||||
provider : Union[Literal['cboe', 'yfinance'], 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
|
||||
no default.
|
||||
|
||||
Returns
|
||||
-------
|
||||
OBBject
|
||||
results : Union[List[FuturesCurve]]
|
||||
Serializable results.
|
||||
provider : Union[Literal['cboe', 'yfinance'], None]
|
||||
Provider name.
|
||||
warnings : Optional[List[Warning_]]
|
||||
List of warnings.
|
||||
chart : Optional[Chart]
|
||||
Chart object.
|
||||
extra: Dict[str, Any]
|
||||
Extra info.
|
||||
|
||||
FuturesCurve
|
||||
------------
|
||||
expiration : str
|
||||
Futures expiration month.
|
||||
price : Optional[Union[float]]
|
||||
The close price of the symbol.
|
||||
symbol : Optional[Union[str]]
|
||||
The trading symbol for the tenor of future. (provider: cboe)""" # noqa: E501
|
||||
|
||||
inputs = filter_inputs(
|
||||
provider_choices={
|
||||
"provider": provider,
|
||||
},
|
||||
standard_params={
|
||||
"symbol": ",".join(symbol) if isinstance(symbol, list) else symbol,
|
||||
"date": date,
|
||||
},
|
||||
extra_params=kwargs,
|
||||
)
|
||||
|
||||
return self._run(
|
||||
"/futures/curve",
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
def load(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
Union[str, List[str]],
|
||||
OpenBBCustomParameter(description="Symbol to get data for."),
|
||||
],
|
||||
start_date: typing_extensions.Annotated[
|
||||
Union[datetime.date, None, str],
|
||||
OpenBBCustomParameter(
|
||||
description="Start date of the data, in YYYY-MM-DD format."
|
||||
),
|
||||
] = None,
|
||||
end_date: typing_extensions.Annotated[
|
||||
Union[datetime.date, None, str],
|
||||
OpenBBCustomParameter(
|
||||
description="End date of the data, in YYYY-MM-DD format."
|
||||
),
|
||||
] = None,
|
||||
expiration: typing_extensions.Annotated[
|
||||
Union[str, None],
|
||||
OpenBBCustomParameter(description="Future expiry date with format YYYY-MM"),
|
||||
] = None,
|
||||
provider: Union[Literal["yfinance"], None] = None,
|
||||
**kwargs
|
||||
) -> OBBject[List[Data]]:
|
||||
"""Futures Historical Price.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
symbol : str
|
||||
Symbol to get data for.
|
||||
start_date : Union[datetime.date, None]
|
||||
Start date of the data, in YYYY-MM-DD format.
|
||||
end_date : Union[datetime.date, None]
|
||||
End date of the data, in YYYY-MM-DD format.
|
||||
expiration : Union[str, None]
|
||||
Future expiry date with format YYYY-MM
|
||||
provider : Union[Literal['yfinance'], None]
|
||||
The provider to use for the query, by default None.
|
||||
If None, the provider specified in defaults is selected or 'yfinance' if there is
|
||||
no default.
|
||||
interval : Optional[Union[Literal['1m', '2m', '5m', '15m', '30m', '60m', '90m', '1h', '1d', '5d', '1wk', '1mo', '3mo']]]
|
||||
Data granularity. (provider: yfinance)
|
||||
period : Optional[Union[Literal['1d', '5d', '1mo', '3mo', '6mo', '1y', '2y', '5y', '10y', 'ytd', 'max']]]
|
||||
Period of the data to return. (provider: yfinance)
|
||||
prepost : bool
|
||||
Include Pre and Post market data. (provider: yfinance)
|
||||
adjust : bool
|
||||
Adjust all the data automatically. (provider: yfinance)
|
||||
back_adjust : bool
|
||||
Back-adjusted data to mimic true historical prices. (provider: yfinance)
|
||||
|
||||
Returns
|
||||
-------
|
||||
OBBject
|
||||
results : Union[List[FuturesHistorical]]
|
||||
Serializable results.
|
||||
provider : Union[Literal['yfinance'], None]
|
||||
Provider name.
|
||||
warnings : Optional[List[Warning_]]
|
||||
List of warnings.
|
||||
chart : Optional[Chart]
|
||||
Chart object.
|
||||
extra: Dict[str, Any]
|
||||
Extra info.
|
||||
|
||||
FuturesHistorical
|
||||
-----------------
|
||||
date : datetime
|
||||
The date of the data.
|
||||
open : float
|
||||
The open price of the symbol.
|
||||
high : float
|
||||
The high price of the symbol.
|
||||
low : float
|
||||
The low price of the symbol.
|
||||
close : float
|
||||
The close price of the symbol.
|
||||
volume : float
|
||||
The volume of the symbol.""" # noqa: E501
|
||||
|
||||
inputs = filter_inputs(
|
||||
provider_choices={
|
||||
"provider": provider,
|
||||
},
|
||||
standard_params={
|
||||
"symbol": ",".join(symbol) if isinstance(symbol, list) else symbol,
|
||||
"start_date": start_date,
|
||||
"end_date": end_date,
|
||||
"expiration": expiration,
|
||||
},
|
||||
extra_params=kwargs,
|
||||
)
|
||||
|
||||
return self._run(
|
||||
"/futures/load",
|
||||
**inputs,
|
||||
)
|
||||
67
openbb_platform/openbb/package/module_map.json
vendored
67
openbb_platform/openbb/package/module_map.json
vendored
@@ -2,35 +2,13 @@
|
||||
"__extensions__": "",
|
||||
"crypto": "/crypto",
|
||||
"crypto_load": "/crypto/load",
|
||||
"econometrics": "/econometrics",
|
||||
"econometrics_bgot": "/econometrics/bgot",
|
||||
"econometrics_coint": "/econometrics/coint",
|
||||
"econometrics_corr": "/econometrics/corr",
|
||||
"econometrics_dwat": "/econometrics/dwat",
|
||||
"econometrics_granger": "/econometrics/granger",
|
||||
"econometrics_ols": "/econometrics/ols",
|
||||
"econometrics_ols_summary": "/econometrics/ols_summary",
|
||||
"econometrics_panelbols": "/econometrics/panelbols",
|
||||
"econometrics_panelfd": "/econometrics/panelfd",
|
||||
"econometrics_panelfmac": "/econometrics/panelfmac",
|
||||
"econometrics_panelols": "/econometrics/panelols",
|
||||
"econometrics_panelpols": "/econometrics/panelpols",
|
||||
"econometrics_panelre": "/econometrics/panelre",
|
||||
"econometrics_unitroot": "/econometrics/unitroot",
|
||||
"economy": "/economy",
|
||||
"economy_available_indices": "/economy/available_indices",
|
||||
"economy_const": "/economy/const",
|
||||
"economy_cot": "/economy/cot",
|
||||
"economy_cot_search": "/economy/cot_search",
|
||||
"economy_cpi": "/economy/cpi",
|
||||
"economy_european_index": "/economy/european_index",
|
||||
"economy_european_index_constituents": "/economy/european_index_constituents",
|
||||
"economy_fred_index": "/economy/fred_index",
|
||||
"economy_index": "/economy/index",
|
||||
"economy_index_search": "/economy/index_search",
|
||||
"economy_index_snapshots": "/economy/index_snapshots",
|
||||
"economy_risk": "/economy/risk",
|
||||
"economy_sp500_multiples": "/economy/sp500_multiples",
|
||||
"fixedincome": "/fixedincome",
|
||||
"fixedincome_ameribor": "/fixedincome/ameribor",
|
||||
"fixedincome_estr": "/fixedincome/estr",
|
||||
@@ -44,22 +22,8 @@
|
||||
"forex": "/forex",
|
||||
"forex_load": "/forex/load",
|
||||
"forex_pairs": "/forex/pairs",
|
||||
"futures": "/futures",
|
||||
"futures_curve": "/futures/curve",
|
||||
"futures_load": "/futures/load",
|
||||
"news": "/news",
|
||||
"news_globalnews": "/news/globalnews",
|
||||
"qa": "/qa",
|
||||
"qa_capm": "/qa/capm",
|
||||
"qa_kurtosis": "/qa/kurtosis",
|
||||
"qa_normality": "/qa/normality",
|
||||
"qa_om": "/qa/om",
|
||||
"qa_quantile": "/qa/quantile",
|
||||
"qa_sh": "/qa/sh",
|
||||
"qa_skew": "/qa/skew",
|
||||
"qa_so": "/qa/so",
|
||||
"qa_summary": "/qa/summary",
|
||||
"qa_unitroot": "/qa/unitroot",
|
||||
"stocks": "/stocks",
|
||||
"stocks_ca": "/stocks/ca",
|
||||
"stocks_ca_peers": "/stocks/ca/peers",
|
||||
@@ -92,39 +56,10 @@
|
||||
"stocks_fa_shrs": "/stocks/fa/shrs",
|
||||
"stocks_fa_split": "/stocks/fa/split",
|
||||
"stocks_fa_transcript": "/stocks/fa/transcript",
|
||||
"stocks_info": "/stocks/info",
|
||||
"stocks_load": "/stocks/load",
|
||||
"stocks_multiples": "/stocks/multiples",
|
||||
"stocks_news": "/stocks/news",
|
||||
"stocks_options": "/stocks/options",
|
||||
"stocks_options_chains": "/stocks/options/chains",
|
||||
"stocks_quote": "/stocks/quote",
|
||||
"stocks_search": "/stocks/search",
|
||||
"ta": "/ta",
|
||||
"ta_ad": "/ta/ad",
|
||||
"ta_adosc": "/ta/adosc",
|
||||
"ta_adx": "/ta/adx",
|
||||
"ta_aroon": "/ta/aroon",
|
||||
"ta_atr": "/ta/atr",
|
||||
"ta_bbands": "/ta/bbands",
|
||||
"ta_cci": "/ta/cci",
|
||||
"ta_cg": "/ta/cg",
|
||||
"ta_clenow": "/ta/clenow",
|
||||
"ta_cones": "/ta/cones",
|
||||
"ta_demark": "/ta/demark",
|
||||
"ta_donchian": "/ta/donchian",
|
||||
"ta_ema": "/ta/ema",
|
||||
"ta_fib": "/ta/fib",
|
||||
"ta_fisher": "/ta/fisher",
|
||||
"ta_hma": "/ta/hma",
|
||||
"ta_ichimoku": "/ta/ichimoku",
|
||||
"ta_kc": "/ta/kc",
|
||||
"ta_macd": "/ta/macd",
|
||||
"ta_obv": "/ta/obv",
|
||||
"ta_rsi": "/ta/rsi",
|
||||
"ta_sma": "/ta/sma",
|
||||
"ta_stoch": "/ta/stoch",
|
||||
"ta_vwap": "/ta/vwap",
|
||||
"ta_wma": "/ta/wma",
|
||||
"ta_zlma": "/ta/zlma"
|
||||
"stocks_quote": "/stocks/quote"
|
||||
}
|
||||
@@ -6,9 +6,9 @@ import typing_extensions
|
||||
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.decorators import validate
|
||||
from openbb_core.app.static.filters import filter_inputs
|
||||
from openbb_provider.abstract.data import Data
|
||||
from pydantic import validate_call
|
||||
|
||||
|
||||
class ROUTER_news(Container):
|
||||
@@ -19,7 +19,7 @@ class ROUTER_news(Container):
|
||||
def __repr__(self) -> str:
|
||||
return self.__doc__ or ""
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def globalnews(
|
||||
self,
|
||||
limit: typing_extensions.Annotated[
|
||||
|
||||
@@ -1,391 +0,0 @@
|
||||
### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ###
|
||||
|
||||
from typing import List, Literal, Union
|
||||
|
||||
import pandas
|
||||
import typing_extensions
|
||||
from annotated_types import Ge, Gt
|
||||
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 openbb_provider.abstract.data import Data
|
||||
from openbb_qa.qa_models import (
|
||||
CAPMModel,
|
||||
NormalityModel,
|
||||
OmegaModel,
|
||||
SummaryModel,
|
||||
UnitRootModel,
|
||||
)
|
||||
from pydantic import validate_call
|
||||
|
||||
|
||||
class ROUTER_qa(Container):
|
||||
"""/qa
|
||||
capm
|
||||
kurtosis
|
||||
normality
|
||||
om
|
||||
quantile
|
||||
sh
|
||||
skew
|
||||
so
|
||||
summary
|
||||
unitroot
|
||||
"""
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return self.__doc__ or ""
|
||||
|
||||
@validate_call(config=dict(arbitrary_types_allowed=True))
|
||||
def capm(
|
||||
self, data: Union[List[Data], pandas.DataFrame], target: str
|
||||
) -> OBBject[CAPMModel]:
|
||||
"""Get Capital Asset Pricing Model.""" # noqa: E501
|
||||
|
||||
inputs = filter_inputs(
|
||||
data=data,
|
||||
target=target,
|
||||
)
|
||||
|
||||
return self._run(
|
||||
"/qa/capm",
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call(config=dict(arbitrary_types_allowed=True))
|
||||
def kurtosis(
|
||||
self,
|
||||
data: Union[List[Data], pandas.DataFrame],
|
||||
target: str,
|
||||
window: typing_extensions.Annotated[int, Gt(gt=0)],
|
||||
) -> OBBject[List[Data]]:
|
||||
"""Get the Kurtosis.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
data : List[Data]
|
||||
Time series data.
|
||||
target : str
|
||||
Target column name.
|
||||
window : PositiveInt
|
||||
Window size.
|
||||
|
||||
Returns
|
||||
-------
|
||||
OBBject[List[Data]]
|
||||
Kurtosis.
|
||||
""" # noqa: E501
|
||||
|
||||
inputs = filter_inputs(
|
||||
data=data,
|
||||
target=target,
|
||||
window=window,
|
||||
)
|
||||
|
||||
return self._run(
|
||||
"/qa/kurtosis",
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call(config=dict(arbitrary_types_allowed=True))
|
||||
def normality(
|
||||
self, data: Union[List[Data], pandas.DataFrame], target: str
|
||||
) -> OBBject[NormalityModel]:
|
||||
"""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.
|
||||
- **Jarque-Bera**: whether the sample data has the skewness and kurtosis matching a normal distribution.
|
||||
- **Shapiro-Wilk**: whether a random sample comes from a normal distribution.
|
||||
- **Kolmogorov-Smirnov**: whether two underlying one-dimensional probability distributions differ.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
data : List[Data]
|
||||
Time series data.
|
||||
target : str
|
||||
Target column name.
|
||||
|
||||
Returns
|
||||
-------
|
||||
OBBject[NormalityModel]
|
||||
Normality tests summary. See qa_models.NormalityModel for details.
|
||||
""" # noqa: E501
|
||||
|
||||
inputs = filter_inputs(
|
||||
data=data,
|
||||
target=target,
|
||||
)
|
||||
|
||||
return self._run(
|
||||
"/qa/normality",
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call(config=dict(arbitrary_types_allowed=True))
|
||||
def om(
|
||||
self,
|
||||
data: Union[List[Data], pandas.DataFrame],
|
||||
target: str,
|
||||
threshold_start: float = 0.0,
|
||||
threshold_end: float = 1.5,
|
||||
) -> OBBject[List[OmegaModel]]:
|
||||
"""Calculate the Omega Ratio.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
data : List[Data]
|
||||
Time series data.
|
||||
target : str
|
||||
Target column name.
|
||||
threshold_start : float, optional
|
||||
Start threshold, by default 0.0
|
||||
threshold_end : float, optional
|
||||
End threshold, by default 1.5
|
||||
|
||||
Returns
|
||||
-------
|
||||
OBBject[List[OmegaModel]]
|
||||
Omega ratios.
|
||||
""" # noqa: E501
|
||||
|
||||
inputs = filter_inputs(
|
||||
data=data,
|
||||
target=target,
|
||||
threshold_start=threshold_start,
|
||||
threshold_end=threshold_end,
|
||||
)
|
||||
|
||||
return self._run(
|
||||
"/qa/om",
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call(config=dict(arbitrary_types_allowed=True))
|
||||
def quantile(
|
||||
self,
|
||||
data: Union[List[Data], pandas.DataFrame],
|
||||
target: str,
|
||||
window: typing_extensions.Annotated[int, Gt(gt=0)],
|
||||
quantile_pct: typing_extensions.Annotated[float, Ge(ge=0)] = 0.5,
|
||||
) -> OBBject[List[Data]]:
|
||||
"""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,
|
||||
target=target,
|
||||
window=window,
|
||||
quantile_pct=quantile_pct,
|
||||
)
|
||||
|
||||
return self._run(
|
||||
"/qa/quantile",
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call(config=dict(arbitrary_types_allowed=True))
|
||||
def sh(
|
||||
self,
|
||||
data: Union[List[Data], pandas.DataFrame],
|
||||
target: str,
|
||||
rfr: float = 0.0,
|
||||
window: typing_extensions.Annotated[int, Gt(gt=0)] = 252,
|
||||
) -> OBBject[List[Data]]:
|
||||
"""Get Sharpe Ratio.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
data : List[Data]
|
||||
Time series data.
|
||||
target : str
|
||||
Target column name.
|
||||
rfr : float, optional
|
||||
Risk-free rate, by default 0.0
|
||||
window : PositiveInt, optional
|
||||
Window size, by default 252
|
||||
|
||||
Returns
|
||||
-------
|
||||
OBBject[List[Data]]
|
||||
Sharpe ratio.
|
||||
""" # noqa: E501
|
||||
|
||||
inputs = filter_inputs(
|
||||
data=data,
|
||||
target=target,
|
||||
rfr=rfr,
|
||||
window=window,
|
||||
)
|
||||
|
||||
return self._run(
|
||||
"/qa/sh",
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call(config=dict(arbitrary_types_allowed=True))
|
||||
def skew(
|
||||
self,
|
||||
data: Union[List[Data], pandas.DataFrame],
|
||||
target: str,
|
||||
window: typing_extensions.Annotated[int, Gt(gt=0)],
|
||||
) -> OBBject[List[Data]]:
|
||||
"""Get Skewness.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
data : List[Data]
|
||||
Time series data.
|
||||
target : str
|
||||
Target column name.
|
||||
window : PositiveInt
|
||||
Window size.
|
||||
|
||||
Returns
|
||||
-------
|
||||
OBBject[List[Data]]
|
||||
Skewness.
|
||||
""" # noqa: E501
|
||||
|
||||
inputs = filter_inputs(
|
||||
data=data,
|
||||
target=target,
|
||||
window=window,
|
||||
)
|
||||
|
||||
return self._run(
|
||||
"/qa/skew",
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call(config=dict(arbitrary_types_allowed=True))
|
||||
def so(
|
||||
self,
|
||||
data: Union[List[Data], pandas.DataFrame],
|
||||
target: str,
|
||||
target_return: float = 0.0,
|
||||
window: typing_extensions.Annotated[int, Gt(gt=0)] = 252,
|
||||
adjusted: bool = False,
|
||||
) -> OBBject[List[Data]]:
|
||||
"""Get Sortino Ratio.
|
||||
|
||||
For method & terminology see: http://www.redrockcapital.com/Sortino__A__Sharper__Ratio_Red_Rock_Capital.pdf
|
||||
|
||||
Parameters
|
||||
----------
|
||||
data : List[Data]
|
||||
Time series data.
|
||||
target : str
|
||||
Target column name.
|
||||
target_return : float, optional
|
||||
Target return, by default 0.0
|
||||
window : PositiveInt, optional
|
||||
Window size, by default 252
|
||||
adjusted : bool, optional
|
||||
Adjust sortino ratio to compare it to sharpe ratio, by default False
|
||||
|
||||
Returns
|
||||
-------
|
||||
OBBject[List[Data]]
|
||||
Sortino ratio.
|
||||
""" # noqa: E501
|
||||
|
||||
inputs = filter_inputs(
|
||||
data=data,
|
||||
target=target,
|
||||
target_return=target_return,
|
||||
window=window,
|
||||
adjusted=adjusted,
|
||||
)
|
||||
|
||||
return self._run(
|
||||
"/qa/so",
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call(config=dict(arbitrary_types_allowed=True))
|
||||
def summary(
|
||||
self, data: Union[List[Data], pandas.DataFrame], target: str
|
||||
) -> OBBject[SummaryModel]:
|
||||
"""Get Summary Statistics.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
data : List[Data]
|
||||
Time series data.
|
||||
target : str
|
||||
Target column name.
|
||||
|
||||
Returns
|
||||
-------
|
||||
OBBject[SummaryModel]
|
||||
Summary table.
|
||||
""" # noqa: E501
|
||||
|
||||
inputs = filter_inputs(
|
||||
data=data,
|
||||
target=target,
|
||||
)
|
||||
|
||||
return self._run(
|
||||
"/qa/summary",
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call(config=dict(arbitrary_types_allowed=True))
|
||||
def unitroot(
|
||||
self,
|
||||
data: Union[List[Data], pandas.DataFrame],
|
||||
target: str,
|
||||
fuller_reg: Literal["c", "ct", "ctt", "nc", "c"] = "c",
|
||||
kpss_reg: Literal["c", "ct"] = "c",
|
||||
) -> OBBject[UnitRootModel]:
|
||||
"""Get Unit Root Test.
|
||||
|
||||
Augmented Dickey-Fuller test for unit root.
|
||||
Kwiatkowski-Phillips-Schmidt-Shin test for unit root.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
data : List[Data]
|
||||
Time series data.
|
||||
target : str
|
||||
Target column name.
|
||||
fuller_reg : Literal["c", "ct", "ctt", "nc", "c"]
|
||||
Regression type for ADF test.
|
||||
kpss_reg : Literal["c", "ct"]
|
||||
Regression type for KPSS test.
|
||||
|
||||
Returns
|
||||
-------
|
||||
OBBject[UnitRootModel]
|
||||
Unit root tests summary.
|
||||
""" # noqa: E501
|
||||
|
||||
inputs = filter_inputs(
|
||||
data=data,
|
||||
target=target,
|
||||
fuller_reg=fuller_reg,
|
||||
kpss_reg=kpss_reg,
|
||||
)
|
||||
|
||||
return self._run(
|
||||
"/qa/unitroot",
|
||||
**inputs,
|
||||
)
|
||||
@@ -8,22 +8,20 @@ from annotated_types import Ge
|
||||
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.decorators import validate
|
||||
from openbb_core.app.static.filters import filter_inputs
|
||||
from openbb_provider.abstract.data import Data
|
||||
from pydantic import validate_call
|
||||
|
||||
|
||||
class ROUTER_stocks(Container):
|
||||
"""/stocks
|
||||
/ca
|
||||
/fa
|
||||
info
|
||||
load
|
||||
multiples
|
||||
news
|
||||
/options
|
||||
quote
|
||||
search
|
||||
"""
|
||||
|
||||
def __repr__(self) -> str:
|
||||
@@ -41,122 +39,7 @@ class ROUTER_stocks(Container):
|
||||
|
||||
return stocks_fa.ROUTER_stocks_fa(command_runner=self._command_runner)
|
||||
|
||||
@validate_call
|
||||
def info(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
Union[str, List[str]],
|
||||
OpenBBCustomParameter(description="Symbol to get data for."),
|
||||
],
|
||||
provider: Union[Literal["cboe"], None] = None,
|
||||
**kwargs
|
||||
) -> OBBject[List[Data]]:
|
||||
"""Get general price and performance metrics of a stock.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
symbol : str
|
||||
Symbol to get data for.
|
||||
provider : Union[Literal['cboe'], 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
|
||||
no default.
|
||||
|
||||
Returns
|
||||
-------
|
||||
OBBject
|
||||
results : Union[List[StockInfo]]
|
||||
Serializable results.
|
||||
provider : Union[Literal['cboe'], None]
|
||||
Provider name.
|
||||
warnings : Optional[List[Warning_]]
|
||||
List of warnings.
|
||||
chart : Optional[Chart]
|
||||
Chart object.
|
||||
extra: Dict[str, Any]
|
||||
Extra info.
|
||||
|
||||
StockInfo
|
||||
---------
|
||||
symbol : str
|
||||
Symbol to get data for.
|
||||
name : str
|
||||
Name associated with the ticker symbol.
|
||||
price : Optional[Union[float]]
|
||||
Last transaction price.
|
||||
open : Optional[Union[float]]
|
||||
Opening price of the stock.
|
||||
high : Optional[Union[float]]
|
||||
High price of the current trading day.
|
||||
low : Optional[Union[float]]
|
||||
Low price of the current trading day.
|
||||
close : Optional[Union[float]]
|
||||
Closing price of the most recent trading day.
|
||||
change : Optional[Union[float]]
|
||||
Change in price over the current trading period.
|
||||
change_percent : Optional[Union[float]]
|
||||
Percent change in price over the current trading period.
|
||||
prev_close : Optional[Union[float]]
|
||||
Previous closing price.
|
||||
type : Optional[Union[str]]
|
||||
Type of asset. (provider: cboe)
|
||||
exchange_id : Optional[Union[int]]
|
||||
The Exchange ID number. (provider: cboe)
|
||||
tick : Optional[Union[str]]
|
||||
Whether the last sale was an up or down tick. (provider: cboe)
|
||||
bid : Optional[Union[float]]
|
||||
Current bid price. (provider: cboe)
|
||||
bid_size : Optional[Union[float]]
|
||||
Bid lot size. (provider: cboe)
|
||||
ask : Optional[Union[float]]
|
||||
Current ask price. (provider: cboe)
|
||||
ask_size : Optional[Union[float]]
|
||||
Ask lot size. (provider: cboe)
|
||||
volume : Optional[Union[float]]
|
||||
Stock volume for the current trading day. (provider: cboe)
|
||||
iv30 : Optional[Union[float]]
|
||||
The 30-day implied volatility of the stock. (provider: cboe)
|
||||
iv30_change : Optional[Union[float]]
|
||||
Change in 30-day implied volatility of the stock. (provider: cboe)
|
||||
last_trade_timestamp : Optional[Union[datetime]]
|
||||
Last trade timestamp for the stock. (provider: cboe)
|
||||
iv30_annual_high : Optional[Union[float]]
|
||||
The 1-year high of implied volatility. (provider: cboe)
|
||||
hv30_annual_high : Optional[Union[float]]
|
||||
The 1-year high of realized volatility. (provider: cboe)
|
||||
iv30_annual_low : Optional[Union[float]]
|
||||
The 1-year low of implied volatility. (provider: cboe)
|
||||
hv30_annual_low : Optional[Union[float]]
|
||||
The 1-year low of realized volatility. (provider: cboe)
|
||||
iv60_annual_high : Optional[Union[float]]
|
||||
The 60-day high of implied volatility. (provider: cboe)
|
||||
hv60_annual_high : Optional[Union[float]]
|
||||
The 60-day high of realized volatility. (provider: cboe)
|
||||
iv60_annual_low : Optional[Union[float]]
|
||||
The 60-day low of implied volatility. (provider: cboe)
|
||||
hv60_annual_low : Optional[Union[float]]
|
||||
The 60-day low of realized volatility. (provider: cboe)
|
||||
iv90_annual_high : Optional[Union[float]]
|
||||
The 90-day high of implied volatility. (provider: cboe)
|
||||
hv90_annual_high : Optional[Union[float]]
|
||||
The 90-day high of realized volatility. (provider: cboe)""" # noqa: E501
|
||||
|
||||
inputs = filter_inputs(
|
||||
provider_choices={
|
||||
"provider": provider,
|
||||
},
|
||||
standard_params={
|
||||
"symbol": ",".join(symbol) if isinstance(symbol, list) else symbol,
|
||||
},
|
||||
extra_params=kwargs,
|
||||
)
|
||||
|
||||
return self._run(
|
||||
"/stocks/info",
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def load(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
@@ -175,11 +58,7 @@ class ROUTER_stocks(Container):
|
||||
description="End date of the data, in YYYY-MM-DD format."
|
||||
),
|
||||
] = None,
|
||||
chart: bool = False,
|
||||
provider: Union[
|
||||
Literal["alpha_vantage", "cboe", "fmp", "intrinio", "polygon", "yfinance"],
|
||||
None,
|
||||
] = None,
|
||||
provider: Union[Literal["fmp", "intrinio", "polygon"], None] = None,
|
||||
**kwargs
|
||||
) -> OBBject[List[Data]]:
|
||||
"""Load stock data for a specific ticker.
|
||||
@@ -192,28 +71,14 @@ class ROUTER_stocks(Container):
|
||||
Start date of the data, in YYYY-MM-DD format.
|
||||
end_date : Union[datetime.date, None]
|
||||
End date of the data, in YYYY-MM-DD format.
|
||||
chart : bool
|
||||
Whether to create a chart or not, by default False.
|
||||
provider : Union[Literal['alpha_vantage', 'cboe', 'fmp', 'intrinio', 'polygo...
|
||||
provider : Union[Literal['fmp', 'intrinio', 'polygon'], None]
|
||||
The provider to use for the query, by default None.
|
||||
If None, the provider specified in defaults is selected or 'alpha_vantage' if there is
|
||||
If None, the provider specified in defaults is selected or 'fmp' if there is
|
||||
no default.
|
||||
function_ : Literal['TIME_SERIES_INTRADAY', 'TIME_SERIES_DAILY', 'TIME_SERIES_WEEKLY', 'TIME_SERIES_MONTHLY', 'TIME_SERIES_DAILY_ADJUSTED', 'TIME_SERIES_WEEKLY_ADJUSTED', 'TIME_SERIES_MONTHLY_ADJUSTED']
|
||||
The time series of your choice. (provider: alpha_vantage)
|
||||
period : Optional[Union[Literal['intraday', 'daily', 'weekly', 'monthly'], Literal['1d', '5d', '1mo', '3mo', '6mo', '1y', '2y', '5y', '10y', 'ytd', 'max']]]
|
||||
Period of the data to return. (provider: alpha_vantage, yfinance)
|
||||
interval : Optional[Union[Literal['1min', '5min', '15min', '30min', '60min'], Literal['1d', '1m'], Literal['1min', '5min', '15min', '30min', '1hour', '4hour', '1day'], Literal['1m', '2m', '5m', '15m', '30m', '60m', '90m', '1h', '1d', '5d', '1wk', '1mo', '3mo']]]
|
||||
Data granularity. (provider: alpha_vantage, cboe, fmp, yfinance)
|
||||
adjusted : Optional[Union[bool]]
|
||||
Output time series is adjusted by historical split and dividend events. (provider: alpha_vantage, polygon)
|
||||
extended_hours : Optional[Union[bool]]
|
||||
Extended trading hours during pre-market and after-hours. (provider: alpha_vantage)
|
||||
month : Optional[Union[str]]
|
||||
Query a specific month in history (in YYYY-MM format). (provider: alpha_vantage)
|
||||
outputsize : Optional[Union[Literal['compact', 'full']]]
|
||||
Compact returns only the latest 100 data points in the intraday time series; full returns trailing 30 days of the most recent intraday data if the month parameter (see above) is not specified, or the full intraday data for a specific month in history if the month parameter is specified. (provider: alpha_vantage)
|
||||
timeseries : Optional[Union[typing_extensions.Annotated[int, Ge(ge=0)]]]
|
||||
Number of days to look back. (provider: fmp)
|
||||
interval : Literal['1min', '5min', '15min', '30min', '1hour', '4hour', '1day']
|
||||
Data granularity. (provider: fmp)
|
||||
timezone : Optional[Union[Literal['Africa/Algiers', 'Africa/Cairo', 'Africa/Casablanca', 'Africa/Harare', 'Africa/Johannesburg', 'Africa/Monrovia', 'Africa/Nairobi', 'America/Argentina/Buenos_Aires', 'America/Bogota', 'America/Caracas', 'America/Chicago', 'America/Chihuahua', 'America/Denver', 'America/Godthab', 'America/Guatemala', 'America/Guyana', 'America/Halifax', 'America/Indiana/Indianapolis', 'America/Juneau', 'America/La_Paz', 'America/Lima', 'America/Lima', 'America/Los_Angeles', 'America/Mazatlan', 'America/Mexico_City', 'America/Mexico_City', 'America/Monterrey', 'America/Montevideo', 'America/New_York', 'America/Phoenix', 'America/Regina', 'America/Santiago', 'America/Sao_Paulo', 'America/St_Johns', 'America/Tijuana', 'Asia/Almaty', 'Asia/Baghdad', 'Asia/Baku', 'Asia/Bangkok', 'Asia/Bangkok', 'Asia/Chongqing', 'Asia/Colombo', 'Asia/Dhaka', 'Asia/Dhaka', 'Asia/Hong_Kong', 'Asia/Irkutsk', 'Asia/Jakarta', 'Asia/Jerusalem', 'Asia/Kabul', 'Asia/Kamchatka', 'Asia/Karachi', 'Asia/Karachi', 'Asia/Kathmandu', 'Asia/Kolkata', 'Asia/Kolkata', 'Asia/Kolkata', 'Asia/Kolkata', 'Asia/Krasnoyarsk', 'Asia/Kuala_Lumpur', 'Asia/Kuwait', 'Asia/Magadan', 'Asia/Muscat', 'Asia/Muscat', 'Asia/Novosibirsk', 'Asia/Rangoon', 'Asia/Riyadh', 'Asia/Seoul', 'Asia/Shanghai', 'Asia/Singapore', 'Asia/Srednekolymsk', 'Asia/Taipei', 'Asia/Tashkent', 'Asia/Tbilisi', 'Asia/Tehran', 'Asia/Tokyo', 'Asia/Tokyo', 'Asia/Tokyo', 'Asia/Ulaanbaatar', 'Asia/Urumqi', 'Asia/Vladivostok', 'Asia/Yakutsk', 'Asia/Yekaterinburg', 'Asia/Yerevan', 'Atlantic/Azores', 'Atlantic/Cape_Verde', 'Atlantic/South_Georgia', 'Australia/Adelaide', 'Australia/Brisbane', 'Australia/Darwin', 'Australia/Hobart', 'Australia/Melbourne', 'Australia/Melbourne', 'Australia/Perth', 'Australia/Sydney', 'Etc/UTC', 'UTC', 'Europe/Amsterdam', 'Europe/Athens', 'Europe/Belgrade', 'Europe/Berlin', 'Europe/Berlin', 'Europe/Bratislava', 'Europe/Brussels', 'Europe/Bucharest', 'Europe/Budapest', 'Europe/Copenhagen', 'Europe/Dublin', 'Europe/Helsinki', 'Europe/Istanbul', 'Europe/Kaliningrad', 'Europe/Kiev', 'Europe/Lisbon', 'Europe/Ljubljana', 'Europe/London', 'Europe/London', 'Europe/Madrid', 'Europe/Minsk', 'Europe/Moscow', 'Europe/Moscow', 'Europe/Paris', 'Europe/Prague', 'Europe/Riga', 'Europe/Rome', 'Europe/Samara', 'Europe/Sarajevo', 'Europe/Skopje', 'Europe/Sofia', 'Europe/Stockholm', 'Europe/Tallinn', 'Europe/Vienna', 'Europe/Vilnius', 'Europe/Volgograd', 'Europe/Warsaw', 'Europe/Zagreb', 'Pacific/Apia', 'Pacific/Auckland', 'Pacific/Auckland', 'Pacific/Chatham', 'Pacific/Fakaofo', 'Pacific/Fiji', 'Pacific/Guadalcanal', 'Pacific/Guam', 'Pacific/Honolulu', 'Pacific/Majuro', 'Pacific/Midway', 'Pacific/Midway', 'Pacific/Noumea', 'Pacific/Pago_Pago', 'Pacific/Port_Moresby', 'Pacific/Tongatapu']]]
|
||||
Returns trading times in this timezone. (provider: intrinio)
|
||||
source : Optional[Union[Literal['realtime', 'delayed', 'nasdaq_basic']]]
|
||||
@@ -232,33 +97,15 @@ class ROUTER_stocks(Container):
|
||||
Sort order of the data. (provider: polygon)
|
||||
limit : int
|
||||
The number of data entries to return. (provider: polygon)
|
||||
prepost : bool
|
||||
Include Pre and Post market data. (provider: yfinance)
|
||||
actions : bool
|
||||
Include actions. (provider: yfinance)
|
||||
auto_adjust : bool
|
||||
Adjust all OHLC data automatically. (provider: yfinance)
|
||||
back_adjust : bool
|
||||
Attempt to adjust all the data automatically. (provider: yfinance)
|
||||
progress : bool
|
||||
Show progress bar. (provider: yfinance)
|
||||
ignore_tz : bool
|
||||
When combining from different timezones, ignore that part of datetime. (provider: yfinance)
|
||||
rounding : bool
|
||||
Round to two decimal places? (provider: yfinance)
|
||||
repair : bool
|
||||
Detect currency unit 100x mixups and attempt repair. (provider: yfinance)
|
||||
keepna : bool
|
||||
Keep NaN rows returned by Yahoo? (provider: yfinance)
|
||||
group_by : Literal['ticker', 'column']
|
||||
Group by ticker or column. (provider: yfinance)
|
||||
adjusted : bool
|
||||
Output time series is adjusted by historical split and dividend events. (provider: polygon)
|
||||
|
||||
Returns
|
||||
-------
|
||||
OBBject
|
||||
results : Union[List[StockHistorical]]
|
||||
Serializable results.
|
||||
provider : Union[Literal['alpha_vantage', 'cboe', 'fmp', 'intrinio', 'polygon', 'yfinance'], None]
|
||||
provider : Union[Literal['fmp', 'intrinio', 'polygon'], None]
|
||||
Provider name.
|
||||
warnings : Optional[List[Warning_]]
|
||||
List of warnings.
|
||||
@@ -283,18 +130,8 @@ class ROUTER_stocks(Container):
|
||||
The volume of the symbol.
|
||||
vwap : Optional[Union[typing_extensions.Annotated[float, Gt(gt=0)]]]
|
||||
Volume Weighted Average Price of the symbol.
|
||||
adj_close : Optional[Union[typing_extensions.Annotated[float, Gt(gt=0)], float]]
|
||||
The adjusted close price of the symbol. (provider: alpha_vantage, fmp)
|
||||
dividend_amount : Optional[Union[typing_extensions.Annotated[float, Ge(ge=0)]]]
|
||||
Dividend amount paid for the corresponding date. (provider: alpha_vantage)
|
||||
split_coefficient : Optional[Union[typing_extensions.Annotated[float, Ge(ge=0)]]]
|
||||
Split coefficient for the corresponding date. (provider: alpha_vantage)
|
||||
calls_volume : Optional[Union[float]]
|
||||
Number of calls traded during the most recent trading period. Only valid if interval is 1m. (provider: cboe)
|
||||
puts_volume : Optional[Union[float]]
|
||||
Number of puts traded during the most recent trading period. Only valid if interval is 1m. (provider: cboe)
|
||||
total_options_volume : Optional[Union[float]]
|
||||
Total number of options traded during the most recent trading period. Only valid if interval is 1m. (provider: cboe)
|
||||
adj_close : Optional[Union[float]]
|
||||
Adjusted Close Price of the symbol. (provider: fmp)
|
||||
unadjusted_volume : Optional[Union[float]]
|
||||
Unadjusted volume of the symbol. (provider: fmp)
|
||||
change : Optional[Union[float]]
|
||||
@@ -325,7 +162,6 @@ class ROUTER_stocks(Container):
|
||||
"end_date": end_date,
|
||||
},
|
||||
extra_params=kwargs,
|
||||
chart=chart,
|
||||
)
|
||||
|
||||
return self._run(
|
||||
@@ -333,7 +169,7 @@ class ROUTER_stocks(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def multiples(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
@@ -344,7 +180,6 @@ class ROUTER_stocks(Container):
|
||||
Union[int, None],
|
||||
OpenBBCustomParameter(description="The number of data entries to return."),
|
||||
] = 100,
|
||||
chart: bool = False,
|
||||
provider: Union[Literal["fmp"], None] = None,
|
||||
**kwargs
|
||||
) -> OBBject[List[Data]]:
|
||||
@@ -356,8 +191,6 @@ class ROUTER_stocks(Container):
|
||||
Symbol to get data for.
|
||||
limit : Union[int, None]
|
||||
The number of data entries to return.
|
||||
chart : bool
|
||||
Whether to create a chart or not, by default False.
|
||||
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 'fmp' if there is
|
||||
@@ -509,7 +342,6 @@ class ROUTER_stocks(Container):
|
||||
"limit": limit,
|
||||
},
|
||||
extra_params=kwargs,
|
||||
chart=chart,
|
||||
)
|
||||
|
||||
return self._run(
|
||||
@@ -517,7 +349,7 @@ class ROUTER_stocks(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def news(
|
||||
self,
|
||||
symbols: typing_extensions.Annotated[
|
||||
@@ -527,10 +359,7 @@ class ROUTER_stocks(Container):
|
||||
Union[typing_extensions.Annotated[int, Ge(ge=0)], None],
|
||||
OpenBBCustomParameter(description="Number of results to return per page."),
|
||||
] = 20,
|
||||
chart: bool = False,
|
||||
provider: Union[
|
||||
Literal["benzinga", "fmp", "intrinio", "polygon", "yfinance"], None
|
||||
] = None,
|
||||
provider: Union[Literal["benzinga", "fmp", "intrinio", "polygon"], None] = None,
|
||||
**kwargs
|
||||
) -> OBBject[List[Data]]:
|
||||
"""Get news for one or more stock tickers.
|
||||
@@ -541,9 +370,7 @@ class ROUTER_stocks(Container):
|
||||
Comma separated list of symbols.
|
||||
limit : Union[typing_extensions.Annotated[int, Ge(ge=0)], None]
|
||||
Number of results to return per page.
|
||||
chart : bool
|
||||
Whether to create a chart or not, by default False.
|
||||
provider : Union[Literal['benzinga', 'fmp', 'intrinio', 'polygon', 'yfinance...
|
||||
provider : Union[Literal['benzinga', 'fmp', 'intrinio', 'polygon'], None]
|
||||
The provider to use for the query, by default None.
|
||||
If None, the provider specified in defaults is selected or 'benzinga' if there is
|
||||
no default.
|
||||
@@ -583,7 +410,7 @@ class ROUTER_stocks(Container):
|
||||
OBBject
|
||||
results : Union[List[StockNews]]
|
||||
Serializable results.
|
||||
provider : Union[Literal['benzinga', 'fmp', 'intrinio', 'polygon', 'yfinance'], None]
|
||||
provider : Union[Literal['benzinga', 'fmp', 'intrinio', 'polygon'], None]
|
||||
Provider name.
|
||||
warnings : Optional[List[Warning_]]
|
||||
List of warnings.
|
||||
@@ -630,18 +457,10 @@ class ROUTER_stocks(Container):
|
||||
Image URL. (provider: polygon)
|
||||
keywords : Optional[Union[List[str]]]
|
||||
Keywords in the article (provider: polygon)
|
||||
publisher : Optional[Union[openbb_polygon.models.stock_news.PolygonPublisher, str]]
|
||||
Publisher of the article. (provider: polygon, yfinance)
|
||||
publisher : Optional[Union[openbb_polygon.models.stock_news.PolygonPublisher]]
|
||||
Publisher of the article. (provider: polygon)
|
||||
tickers : Optional[Union[List[str]]]
|
||||
Tickers covered in the article. (provider: polygon)
|
||||
uuid : Optional[Union[str]]
|
||||
Unique identifier for the news article (provider: yfinance)
|
||||
type : Optional[Union[str]]
|
||||
Type of the news article (provider: yfinance)
|
||||
thumbnail : Optional[Union[List]]
|
||||
Thumbnail related data to the ticker news article. (provider: yfinance)
|
||||
related_tickers : Optional[Union[str]]
|
||||
Tickers related to the news article. (provider: yfinance)""" # noqa: E501
|
||||
Tickers covered in the article. (provider: polygon)""" # noqa: E501
|
||||
|
||||
inputs = filter_inputs(
|
||||
provider_choices={
|
||||
@@ -652,7 +471,6 @@ class ROUTER_stocks(Container):
|
||||
"limit": limit,
|
||||
},
|
||||
extra_params=kwargs,
|
||||
chart=chart,
|
||||
)
|
||||
|
||||
return self._run(
|
||||
@@ -666,7 +484,7 @@ class ROUTER_stocks(Container):
|
||||
|
||||
return stocks_options.ROUTER_stocks_options(command_runner=self._command_runner)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def quote(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
@@ -808,70 +626,3 @@ class ROUTER_stocks(Container):
|
||||
"/stocks/quote",
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
def search(
|
||||
self,
|
||||
query: typing_extensions.Annotated[
|
||||
str, OpenBBCustomParameter(description="Search query.")
|
||||
] = "",
|
||||
is_symbol: typing_extensions.Annotated[
|
||||
bool,
|
||||
OpenBBCustomParameter(description="Whether to search by ticker symbol."),
|
||||
] = False,
|
||||
provider: Union[Literal["cboe"], None] = None,
|
||||
**kwargs
|
||||
) -> OBBject[List[Data]]:
|
||||
"""Search for a company or stock ticker.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
query : str
|
||||
Search query.
|
||||
is_symbol : bool
|
||||
Whether to search by ticker symbol.
|
||||
provider : Union[Literal['cboe'], 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
|
||||
no default.
|
||||
|
||||
Returns
|
||||
-------
|
||||
OBBject
|
||||
results : Union[List[StockSearch]]
|
||||
Serializable results.
|
||||
provider : Union[Literal['cboe'], None]
|
||||
Provider name.
|
||||
warnings : Optional[List[Warning_]]
|
||||
List of warnings.
|
||||
chart : Optional[Chart]
|
||||
Chart object.
|
||||
extra: Dict[str, Any]
|
||||
Extra info.
|
||||
|
||||
StockSearch
|
||||
-----------
|
||||
symbol : str
|
||||
Symbol to get data for.
|
||||
name : str
|
||||
Name of the company.
|
||||
dpm_name : Optional[Union[str]]
|
||||
Name of the primary market maker. (provider: cboe)
|
||||
post_station : Optional[Union[str]]
|
||||
Post and station location on the CBOE trading floor. (provider: cboe)""" # noqa: E501
|
||||
|
||||
inputs = filter_inputs(
|
||||
provider_choices={
|
||||
"provider": provider,
|
||||
},
|
||||
standard_params={
|
||||
"query": query,
|
||||
"is_symbol": is_symbol,
|
||||
},
|
||||
extra_params=kwargs,
|
||||
)
|
||||
|
||||
return self._run(
|
||||
"/stocks/search",
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@@ -6,9 +6,9 @@ import typing_extensions
|
||||
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.decorators import validate
|
||||
from openbb_core.app.static.filters import filter_inputs
|
||||
from openbb_provider.abstract.data import Data
|
||||
from pydantic import validate_call
|
||||
|
||||
|
||||
class ROUTER_stocks_ca(Container):
|
||||
@@ -19,7 +19,7 @@ class ROUTER_stocks_ca(Container):
|
||||
def __repr__(self) -> str:
|
||||
return self.__doc__ or ""
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def peers(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
|
||||
@@ -7,9 +7,9 @@ import typing_extensions
|
||||
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.decorators import validate
|
||||
from openbb_core.app.static.filters import filter_inputs
|
||||
from openbb_provider.abstract.data import Data
|
||||
from pydantic import validate_call
|
||||
|
||||
|
||||
class ROUTER_stocks_fa(Container):
|
||||
@@ -47,7 +47,7 @@ class ROUTER_stocks_fa(Container):
|
||||
def __repr__(self) -> str:
|
||||
return self.__doc__ or ""
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def balance(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
@@ -62,7 +62,7 @@ class ROUTER_stocks_fa(Container):
|
||||
int,
|
||||
OpenBBCustomParameter(description="The number of data entries to return."),
|
||||
] = 12,
|
||||
provider: Union[Literal["fmp", "intrinio", "polygon", "yfinance"], None] = None,
|
||||
provider: Union[Literal["fmp", "intrinio", "polygon"], None] = None,
|
||||
**kwargs
|
||||
) -> OBBject[List[Data]]:
|
||||
"""Balance Sheet.
|
||||
@@ -75,7 +75,7 @@ class ROUTER_stocks_fa(Container):
|
||||
Period of the data to return.
|
||||
limit : int
|
||||
The number of data entries to return.
|
||||
provider : Union[Literal['fmp', 'intrinio', 'polygon', 'yfinance'], None]
|
||||
provider : Union[Literal['fmp', 'intrinio', '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.
|
||||
@@ -123,7 +123,7 @@ class ROUTER_stocks_fa(Container):
|
||||
OBBject
|
||||
results : Union[List[BalanceSheet]]
|
||||
Serializable results.
|
||||
provider : Union[Literal['fmp', 'intrinio', 'polygon', 'yfinance'], None]
|
||||
provider : Union[Literal['fmp', 'intrinio', 'polygon'], None]
|
||||
Provider name.
|
||||
warnings : Optional[List[Warning_]]
|
||||
List of warnings.
|
||||
@@ -266,7 +266,7 @@ class ROUTER_stocks_fa(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def balance_growth(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
@@ -410,7 +410,7 @@ class ROUTER_stocks_fa(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def cal(
|
||||
self,
|
||||
start_date: typing_extensions.Annotated[
|
||||
@@ -490,7 +490,7 @@ class ROUTER_stocks_fa(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def cash(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
@@ -505,7 +505,7 @@ class ROUTER_stocks_fa(Container):
|
||||
int,
|
||||
OpenBBCustomParameter(description="The number of data entries to return."),
|
||||
] = 12,
|
||||
provider: Union[Literal["fmp", "intrinio", "polygon", "yfinance"], None] = None,
|
||||
provider: Union[Literal["fmp", "intrinio", "polygon"], None] = None,
|
||||
**kwargs
|
||||
) -> OBBject[List[Data]]:
|
||||
"""Cash Flow Statement.
|
||||
@@ -518,7 +518,7 @@ class ROUTER_stocks_fa(Container):
|
||||
Period of the data to return.
|
||||
limit : int
|
||||
The number of data entries to return.
|
||||
provider : Union[Literal['fmp', 'intrinio', 'polygon', 'yfinance'], None]
|
||||
provider : Union[Literal['fmp', 'intrinio', '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.
|
||||
@@ -566,7 +566,7 @@ class ROUTER_stocks_fa(Container):
|
||||
OBBject
|
||||
results : Union[List[CashFlowStatement]]
|
||||
Serializable results.
|
||||
provider : Union[Literal['fmp', 'intrinio', 'polygon', 'yfinance'], None]
|
||||
provider : Union[Literal['fmp', 'intrinio', 'polygon'], None]
|
||||
Provider name.
|
||||
warnings : Optional[List[Warning_]]
|
||||
List of warnings.
|
||||
@@ -689,7 +689,7 @@ class ROUTER_stocks_fa(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def cash_growth(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
@@ -815,7 +815,7 @@ class ROUTER_stocks_fa(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def comp(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
@@ -894,7 +894,7 @@ class ROUTER_stocks_fa(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def comsplit(
|
||||
self,
|
||||
start_date: typing_extensions.Annotated[
|
||||
@@ -968,7 +968,7 @@ class ROUTER_stocks_fa(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def divs(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
@@ -1035,7 +1035,7 @@ class ROUTER_stocks_fa(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def earning(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
@@ -1113,7 +1113,7 @@ class ROUTER_stocks_fa(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def emp(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
@@ -1184,7 +1184,7 @@ class ROUTER_stocks_fa(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def est(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
@@ -1295,7 +1295,7 @@ class ROUTER_stocks_fa(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def filings(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
@@ -1373,7 +1373,7 @@ class ROUTER_stocks_fa(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def income(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
@@ -1388,7 +1388,7 @@ class ROUTER_stocks_fa(Container):
|
||||
int,
|
||||
OpenBBCustomParameter(description="The number of data entries to return."),
|
||||
] = 12,
|
||||
provider: Union[Literal["fmp", "intrinio", "polygon", "yfinance"], None] = None,
|
||||
provider: Union[Literal["fmp", "intrinio", "polygon"], None] = None,
|
||||
**kwargs
|
||||
) -> OBBject[List[Data]]:
|
||||
"""Income Statement.
|
||||
@@ -1401,7 +1401,7 @@ class ROUTER_stocks_fa(Container):
|
||||
Period of the data to return.
|
||||
limit : int
|
||||
The number of data entries to return.
|
||||
provider : Union[Literal['fmp', 'intrinio', 'polygon', 'yfinance'], None]
|
||||
provider : Union[Literal['fmp', 'intrinio', '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.
|
||||
@@ -1449,7 +1449,7 @@ class ROUTER_stocks_fa(Container):
|
||||
OBBject
|
||||
results : Union[List[IncomeStatement]]
|
||||
Serializable results.
|
||||
provider : Union[Literal['fmp', 'intrinio', 'polygon', 'yfinance'], None]
|
||||
provider : Union[Literal['fmp', 'intrinio', 'polygon'], None]
|
||||
Provider name.
|
||||
warnings : Optional[List[Warning_]]
|
||||
List of warnings.
|
||||
@@ -1572,7 +1572,7 @@ class ROUTER_stocks_fa(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def income_growth(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
@@ -1697,7 +1697,7 @@ class ROUTER_stocks_fa(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def ins(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
@@ -1819,7 +1819,7 @@ class ROUTER_stocks_fa(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def ins_own(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
@@ -1959,7 +1959,7 @@ class ROUTER_stocks_fa(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def metrics(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
@@ -2150,7 +2150,7 @@ class ROUTER_stocks_fa(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def mgmt(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
@@ -2217,7 +2217,7 @@ class ROUTER_stocks_fa(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def overview(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
@@ -2342,7 +2342,7 @@ class ROUTER_stocks_fa(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def own(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
@@ -2487,7 +2487,7 @@ class ROUTER_stocks_fa(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def pt(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
@@ -2550,7 +2550,7 @@ class ROUTER_stocks_fa(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def pta(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
@@ -2633,7 +2633,7 @@ class ROUTER_stocks_fa(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def ratios(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
@@ -2816,7 +2816,7 @@ class ROUTER_stocks_fa(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def revgeo(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
@@ -2897,7 +2897,7 @@ class ROUTER_stocks_fa(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def revseg(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
@@ -2968,7 +2968,7 @@ class ROUTER_stocks_fa(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def shrs(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
@@ -3033,7 +3033,7 @@ class ROUTER_stocks_fa(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def split(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
@@ -3094,7 +3094,7 @@ class ROUTER_stocks_fa(Container):
|
||||
**inputs,
|
||||
)
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def transcript(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
|
||||
@@ -6,9 +6,9 @@ import typing_extensions
|
||||
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.decorators import validate
|
||||
from openbb_core.app.static.filters import filter_inputs
|
||||
from openbb_provider.abstract.data import Data
|
||||
from pydantic import validate_call
|
||||
|
||||
|
||||
class ROUTER_stocks_options(Container):
|
||||
@@ -19,14 +19,14 @@ class ROUTER_stocks_options(Container):
|
||||
def __repr__(self) -> str:
|
||||
return self.__doc__ or ""
|
||||
|
||||
@validate_call
|
||||
@validate
|
||||
def chains(
|
||||
self,
|
||||
symbol: typing_extensions.Annotated[
|
||||
Union[str, List[str]],
|
||||
OpenBBCustomParameter(description="Symbol to get data for."),
|
||||
],
|
||||
provider: Union[Literal["cboe", "intrinio"], None] = None,
|
||||
provider: Union[Literal["intrinio"], None] = None,
|
||||
**kwargs
|
||||
) -> OBBject[List[Data]]:
|
||||
"""Get the complete options chain for a ticker.
|
||||
@@ -35,9 +35,9 @@ class ROUTER_stocks_options(Container):
|
||||
----------
|
||||
symbol : str
|
||||
Symbol to get data for.
|
||||
provider : Union[Literal['cboe', 'intrinio'], None]
|
||||
provider : Union[Literal['intrinio'], 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 'intrinio' if there is
|
||||
no default.
|
||||
date : Optional[Union[str]]
|
||||
Date for which the options chains are returned. (provider: intrinio)
|
||||
@@ -47,7 +47,7 @@ class ROUTER_stocks_options(Container):
|
||||
OBBject
|
||||
results : Union[List[OptionsChains]]
|
||||
Serializable results.
|
||||
provider : Union[Literal['cboe', 'intrinio'], None]
|
||||
provider : Union[Literal['intrinio'], None]
|
||||
Provider name.
|
||||
warnings : Optional[List[Warning_]]
|
||||
List of warnings.
|
||||
@@ -109,29 +109,7 @@ class ROUTER_stocks_options(Container):
|
||||
theta : Optional[Union[float]]
|
||||
Theta of the option.
|
||||
vega : Optional[Union[float]]
|
||||
Vega of the option.
|
||||
bid_size : Optional[Union[int]]
|
||||
Bid size for the option. (provider: cboe)
|
||||
ask_size : Optional[Union[int]]
|
||||
Ask size for the option. (provider: cboe)
|
||||
theoretical : Optional[Union[float]]
|
||||
Theoretical value of the option. (provider: cboe)
|
||||
last_trade_price : Optional[Union[float]]
|
||||
Last trade price of the option. (provider: cboe)
|
||||
tick : Optional[Union[str]]
|
||||
Whether the last tick was up or down in price. (provider: cboe)
|
||||
prev_close : Optional[Union[float]]
|
||||
Previous closing price of the option. (provider: cboe)
|
||||
change : Optional[Union[float]]
|
||||
Change in price of the option. (provider: cboe)
|
||||
change_percent : Optional[Union[float]]
|
||||
Change, in percent, of the option. (provider: cboe)
|
||||
rho : Optional[Union[float]]
|
||||
Rho of the option. (provider: cboe)
|
||||
last_trade_timestamp : Optional[Union[datetime]]
|
||||
Last trade timestamp of the option. (provider: cboe)
|
||||
dte : Optional[Union[int]]
|
||||
Days to expiration for the option. (provider: cboe)""" # noqa: E501
|
||||
Vega of the option.""" # noqa: E501
|
||||
|
||||
inputs = filter_inputs(
|
||||
provider_choices={
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,36 @@
|
||||
from functools import wraps
|
||||
from typing import Any, Callable, Optional, TypeVar, overload
|
||||
|
||||
from pydantic.validate_call import validate_call
|
||||
from typing_extensions import ParamSpec
|
||||
|
||||
P = ParamSpec("P")
|
||||
R = TypeVar("R")
|
||||
|
||||
|
||||
@overload
|
||||
def validate(func: Callable[P, R]) -> Callable[P, R]:
|
||||
pass
|
||||
|
||||
|
||||
@overload
|
||||
def validate(**dec_kwargs) -> Callable[P, R]:
|
||||
pass
|
||||
|
||||
|
||||
def validate(
|
||||
func: Optional[Callable[P, R]] = None,
|
||||
**dec_kwargs,
|
||||
) -> Any:
|
||||
"""Validate function calls."""
|
||||
|
||||
def decorated(f: Callable[P, R]):
|
||||
"""Decorated function."""
|
||||
|
||||
@wraps(f)
|
||||
def wrapper(*f_args, **f_kwargs):
|
||||
return validate_call(f, **dec_kwargs)(*f_args, **f_kwargs)
|
||||
|
||||
return wrapper
|
||||
|
||||
return decorated if func is None else decorated(func)
|
||||
@@ -252,7 +252,7 @@ class ImportDefinition:
|
||||
code += "\nimport pandas"
|
||||
code += "\nimport datetime"
|
||||
code += "\nimport pydantic"
|
||||
code += "\nfrom pydantic import validate_call, BaseModel"
|
||||
code += "\nfrom pydantic import BaseModel"
|
||||
code += "\nfrom inspect import Parameter"
|
||||
code += "\nimport typing"
|
||||
code += "\nfrom typing import List, Dict, Union, Optional, Literal"
|
||||
@@ -262,6 +262,7 @@ class ImportDefinition:
|
||||
else:
|
||||
code += "\nfrom typing_extensions import Annotated"
|
||||
code += "\nfrom openbb_core.app.utils import df_to_basemodel"
|
||||
code += "\nfrom openbb_core.app.static.decorators import validate\n"
|
||||
code += "\nfrom openbb_core.app.static.filters import filter_inputs\n"
|
||||
code += "\nfrom openbb_provider.abstract.data import Data"
|
||||
if path.startswith("/qa"):
|
||||
@@ -721,12 +722,12 @@ class MethodDefinition:
|
||||
func_params = MethodDefinition.build_func_params(formatted_params)
|
||||
func_returns = MethodDefinition.build_func_returns(return_type, model_name)
|
||||
|
||||
extra = (
|
||||
args = (
|
||||
"(config=dict(arbitrary_types_allowed=True))"
|
||||
if "pandas.DataFrame" in func_params
|
||||
else ""
|
||||
)
|
||||
code = f"\n @validate_call{extra}"
|
||||
code = f"\n @validate{args}"
|
||||
code += f"\n def {func_name}(self, {func_params}) -> {func_returns}:\n"
|
||||
|
||||
return code
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
"""Test the user module."""
|
||||
# ruff: noqa: S105 S106
|
||||
|
||||
import asyncio
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
@@ -11,8 +13,6 @@ from openbb_core.api.auth.user import (
|
||||
get_user_settings,
|
||||
)
|
||||
|
||||
# ruff: noqa: S105 S106
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"error, correct, received",
|
||||
|
||||
Reference in New Issue
Block a user