diff --git a/openbb_sdk/providers/fmp/openbb_fmp/models/crypto_eod.py b/openbb_sdk/providers/fmp/openbb_fmp/models/crypto_eod.py index 17429fd08b1..42dbbf46fdd 100644 --- a/openbb_sdk/providers/fmp/openbb_fmp/models/crypto_eod.py +++ b/openbb_sdk/providers/fmp/openbb_fmp/models/crypto_eod.py @@ -18,7 +18,8 @@ from openbb_fmp.utils.helpers import get_data_many class FMPCryptoEODQueryParams(CryptoEODQueryParams): """FMP Crypto end of day Query. - Source: https://site.financialmodelingprep.com/developer/docs/cryptocurrency-historical-data-api/#Historical-Daily-Prices + Source: + https://site.financialmodelingprep.com/developer/docs/cryptocurrency-historical-data-api/#Historical-Daily-Prices """ timeseries: Optional[NonNegativeInt] = Field( diff --git a/openbb_sdk/sdk/core/openbb_core/app/model/custom_parameter.py b/openbb_sdk/sdk/core/openbb_core/app/model/custom_parameter.py new file mode 100644 index 00000000000..48beef06f9d --- /dev/null +++ b/openbb_sdk/sdk/core/openbb_core/app/model/custom_parameter.py @@ -0,0 +1,7 @@ +from pydantic import BaseModel + + +class OpenBBCustomParameter(BaseModel): + """Custom parameter for OpenBB.""" + + description: str diff --git a/openbb_sdk/sdk/core/openbb_core/app/static/package/__extensions__.py b/openbb_sdk/sdk/core/openbb_core/app/static/package/__extensions__.py index fc3fea757a4..b2942d73300 100644 --- a/openbb_sdk/sdk/core/openbb_core/app/static/package/__extensions__.py +++ b/openbb_sdk/sdk/core/openbb_core/app/static/package/__extensions__.py @@ -6,18 +6,10 @@ from openbb_core.app.static.container import Container class Extensions(Container): @property - def crypto(self): # route = "/crypto" - from openbb_core.app.static.package import crypto + def news(self): # route = "/news" + from openbb_core.app.static.package import news - return crypto.CLASS_crypto(command_runner_session=self._command_runner_session) - - @property - def economy(self): # route = "/economy" - from openbb_core.app.static.package import economy - - return economy.CLASS_economy( - command_runner_session=self._command_runner_session - ) + return news.CLASS_news(command_runner_session=self._command_runner_session) @property def fixedincome(self): # route = "/fixedincome" @@ -34,16 +26,18 @@ class Extensions(Container): return forex.CLASS_forex(command_runner_session=self._command_runner_session) @property - def news(self): # route = "/news" - from openbb_core.app.static.package import news + def economy(self): # route = "/economy" + from openbb_core.app.static.package import economy - return news.CLASS_news(command_runner_session=self._command_runner_session) + return economy.CLASS_economy( + command_runner_session=self._command_runner_session + ) @property - def qa(self): # route = "/qa" - from openbb_core.app.static.package import qa + def crypto(self): # route = "/crypto" + from openbb_core.app.static.package import crypto - return qa.CLASS_qa(command_runner_session=self._command_runner_session) + return crypto.CLASS_crypto(command_runner_session=self._command_runner_session) @property def stocks(self): # route = "/stocks" @@ -51,6 +45,12 @@ class Extensions(Container): return stocks.CLASS_stocks(command_runner_session=self._command_runner_session) + @property + def qa(self): # route = "/qa" + from openbb_core.app.static.package import qa + + return qa.CLASS_qa(command_runner_session=self._command_runner_session) + @property def ta(self): # route = "/ta" from openbb_core.app.static.package import ta diff --git a/openbb_sdk/sdk/core/openbb_core/app/static/package/crypto.py b/openbb_sdk/sdk/core/openbb_core/app/static/package/crypto.py index ab981aa98fc..79fec6c462b 100644 --- a/openbb_sdk/sdk/core/openbb_core/app/static/package/crypto.py +++ b/openbb_sdk/sdk/core/openbb_core/app/static/package/crypto.py @@ -2,11 +2,12 @@ import datetime import typing -from typing import Literal, Optional, Union +from typing import Annotated, Literal, Optional, Union from pydantic import validate_arguments from openbb_core.app.model.command_output import CommandOutput +from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.static.container import Container from openbb_core.app.static.filters import filter_call, filter_inputs, filter_output @@ -16,11 +17,23 @@ class CLASS_crypto(Container): @validate_arguments def load( self, - symbol: str, - start_date: Union[datetime.date, None, str] = None, - end_date: Union[datetime.date, None, str] = None, + symbol: typing.Annotated[ + str, OpenBBCustomParameter(description="Symbol to get data for.") + ], + start_date: Annotated[ + Union[datetime.date, None, str], + OpenBBCustomParameter( + description="Start date of the data, in YYYY-MM-DD format." + ), + ] = None, + end_date: Annotated[ + Union[datetime.date, None, str], + OpenBBCustomParameter( + description="End date of the data, in YYYY-MM-DD format." + ), + ] = None, chart: bool = False, - provider: Optional[Literal["fmp", "polygon"]] = None, + provider: Optional[Literal["polygon", "fmp"]] = None, **kwargs ) -> CommandOutput[typing.List]: """Crypto Intraday Price. @@ -31,7 +44,7 @@ class CLASS_crypto(Container): Parameters ---------- - provider: Literal[fmp, polygon] + provider: Literal[polygon, fmp] The provider to use for the query. symbol : ConstrainedStrValue Symbol to get data for. @@ -72,6 +85,28 @@ class CLASS_crypto(Container): vwap : PositiveFloat Volume Weighted Average Price of the symbol. + polygon + ======= + + Parameters + ---------- + timespan : Literal['minute', 'hour', 'day', 'week', 'month', 'quarter', 'year'] + The timespan of the data. + sort : Literal['asc', 'desc'] + Sort order of the data. + limit : PositiveInt + The number of data entries to return. + adjusted : bool + Whether the data is adjusted. + multiplier : PositiveInt + The multiplier of the timespan. + + + CryptoEOD + --------- + n : PositiveInt + The number of transactions for the symbol in the time period. + fmp === @@ -94,29 +129,7 @@ class CLASS_crypto(Container): label : str Human readable format of the date. changeOverTime : float - Change \\% in the price of the symbol over a period of time. - - polygon - ======= - - Parameters - ---------- - timespan : Literal['minute', 'hour', 'day', 'week', 'month', 'quarter', 'year'] - The timespan of the data. - sort : Literal['asc', 'desc'] - Sort order of the data. - limit : PositiveInt - The number of data entries to return. - adjusted : bool - Whether the data is adjusted. - multiplier : PositiveInt - The multiplier of the timespan. - - - CryptoEOD - --------- - n : PositiveInt - The number of transactions for the symbol in the time period.""" + Change \\% in the price of the symbol over a period of time.""" inputs = filter_inputs( provider_choices={ "provider": provider, diff --git a/openbb_sdk/sdk/core/openbb_core/app/static/package/economy.py b/openbb_sdk/sdk/core/openbb_core/app/static/package/economy.py index b7a7b96cbc8..936f448ead8 100644 --- a/openbb_sdk/sdk/core/openbb_core/app/static/package/economy.py +++ b/openbb_sdk/sdk/core/openbb_core/app/static/package/economy.py @@ -2,13 +2,14 @@ import datetime import typing -from typing import List, Literal, Optional, Union +from typing import Annotated, List, Literal, Optional, Union from pydantic import validate_arguments import openbb_core.app.model.command_context import openbb_core.app.model.results.empty from openbb_core.app.model.command_output import CommandOutput +from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.static.container import Container from openbb_core.app.static.filters import filter_call, filter_inputs, filter_output @@ -40,7 +41,12 @@ class CLASS_economy(Container): @validate_arguments def const( self, - index: Literal["nasdaq", "sp500", "dowjones"] = "dowjones", + index: Annotated[ + Literal["nasdaq", "sp500", "dowjones"], + OpenBBCustomParameter( + description="The index for which we want to fetch the constituents." + ), + ] = "dowjones", chart: bool = False, provider: Optional[Literal["fmp"]] = None, **kwargs @@ -125,64 +131,88 @@ class CLASS_economy(Container): @validate_arguments def cpi( self, - countries: List[ - Literal[ - "australia", - "austria", - "belgium", - "brazil", - "bulgaria", - "canada", - "chile", - "china", - "croatia", - "cyprus", - "czech_republic", - "denmark", - "estonia", - "euro_area", - "finland", - "france", - "germany", - "greece", - "hungary", - "iceland", - "india", - "indonesia", - "ireland", - "israel", - "italy", - "japan", - "korea", - "latvia", - "lithuania", - "luxembourg", - "malta", - "mexico", - "netherlands", - "new_zealand", - "norway", - "poland", - "portugal", - "romania", - "russian_federation", - "slovak_republic", - "slovakia", - "slovenia", - "south_africa", - "spain", - "sweden", - "switzerland", - "turkey", - "united_kingdom", - "united_states", - ] + countries: Annotated[ + List[ + Literal[ + "australia", + "austria", + "belgium", + "brazil", + "bulgaria", + "canada", + "chile", + "china", + "croatia", + "cyprus", + "czech_republic", + "denmark", + "estonia", + "euro_area", + "finland", + "france", + "germany", + "greece", + "hungary", + "iceland", + "india", + "indonesia", + "ireland", + "israel", + "italy", + "japan", + "korea", + "latvia", + "lithuania", + "luxembourg", + "malta", + "mexico", + "netherlands", + "new_zealand", + "norway", + "poland", + "portugal", + "romania", + "russian_federation", + "slovak_republic", + "slovakia", + "slovenia", + "south_africa", + "spain", + "sweden", + "switzerland", + "turkey", + "united_kingdom", + "united_states", + ] + ], + OpenBBCustomParameter(description="The country or countries to get data."), ], - units: Literal["growth_previous", "growth_same", "index_2015"] = "growth_same", - frequency: Literal["monthly", "quarterly", "annual"] = "monthly", - harmonized: bool = False, - start_date: Union[datetime.date, None, str] = None, - end_date: Union[datetime.date, None, str] = None, + units: Annotated[ + Literal["growth_previous", "growth_same", "index_2015"], + OpenBBCustomParameter(description="The data units."), + ] = "growth_same", + frequency: Annotated[ + Literal["monthly", "quarterly", "annual"], + OpenBBCustomParameter(description="The data time frequency."), + ] = "monthly", + harmonized: typing.Annotated[ + bool, + OpenBBCustomParameter( + description="Whether you wish to obtain harmonized data." + ), + ] = False, + start_date: Annotated[ + Union[datetime.date, None, str], + OpenBBCustomParameter( + description="Start date of the data, in YYYY-MM-DD format." + ), + ] = None, + end_date: Annotated[ + Union[datetime.date, None, str], + OpenBBCustomParameter( + description="End date of the data, in YYYY-MM-DD format." + ), + ] = None, chart: bool = False, provider: Optional[Literal["fred"]] = None, **kwargs @@ -296,11 +326,23 @@ class CLASS_economy(Container): @validate_arguments def index( self, - symbol: str, - start_date: Union[datetime.date, None, str] = None, - end_date: Union[datetime.date, None, str] = None, + symbol: typing.Annotated[ + str, OpenBBCustomParameter(description="Symbol to get data for.") + ], + start_date: Annotated[ + Union[datetime.date, None, str], + OpenBBCustomParameter( + description="Start date of the data, in YYYY-MM-DD format." + ), + ] = None, + end_date: Annotated[ + Union[datetime.date, None, str], + OpenBBCustomParameter( + description="End date of the data, in YYYY-MM-DD format." + ), + ] = None, chart: bool = False, - provider: Optional[Literal["fmp", "polygon"]] = None, + provider: Optional[Literal["polygon", "fmp"]] = None, **kwargs ) -> CommandOutput[typing.List]: """Get OHLCV data for an index. @@ -311,7 +353,7 @@ class CLASS_economy(Container): Parameters ---------- - provider: Literal[fmp, polygon] + provider: Literal[polygon, fmp] The provider to use for the query. symbol : ConstrainedStrValue Symbol to get data for. @@ -348,6 +390,32 @@ class CLASS_economy(Container): volume : PositiveFloat The volume of the symbol. + polygon + ======= + + Parameters + ---------- + timespan : Literal['minute', 'hour', 'day', 'week', 'month', 'quarter', 'year'] + The timespan of the data. + sort : Literal['asc', 'desc'] + Sort order of the data. + limit : PositiveInt + The number of data entries to return. + adjusted : bool + Whether the data is adjusted. + multiplier : PositiveInt + The multiplier of the timespan. + + + MajorIndicesEOD + --------------- + t : datetime + The timestamp of the data. + n : PositiveInt + The number of transactions for the symbol in the time period. + vw : PositiveFloat + The volume weighted average price of the symbol. + fmp === @@ -374,33 +442,7 @@ class CLASS_economy(Container): label : str Human readable format of the date. changeOverTime : float - Change \\% in the price of the symbol over a period of time. - - polygon - ======= - - Parameters - ---------- - timespan : Literal['minute', 'hour', 'day', 'week', 'month', 'quarter', 'year'] - The timespan of the data. - sort : Literal['asc', 'desc'] - Sort order of the data. - limit : PositiveInt - The number of data entries to return. - adjusted : bool - Whether the data is adjusted. - multiplier : PositiveInt - The multiplier of the timespan. - - - MajorIndicesEOD - --------------- - t : datetime - The timestamp of the data. - n : PositiveInt - The number of transactions for the symbol in the time period. - vw : PositiveFloat - The volume weighted average price of the symbol.""" + Change \\% in the price of the symbol over a period of time.""" inputs = filter_inputs( provider_choices={ "provider": provider, diff --git a/openbb_sdk/sdk/core/openbb_core/app/static/package/fixedincome.py b/openbb_sdk/sdk/core/openbb_core/app/static/package/fixedincome.py index 5faacc61adf..3763cb95872 100644 --- a/openbb_sdk/sdk/core/openbb_core/app/static/package/fixedincome.py +++ b/openbb_sdk/sdk/core/openbb_core/app/static/package/fixedincome.py @@ -2,13 +2,14 @@ import datetime import typing -from typing import Literal, Optional, Union +from typing import Annotated, Literal, Optional, Union from pydantic import validate_arguments import openbb_core.app.model.command_context import openbb_core.app.model.results.empty from openbb_core.app.model.command_output import CommandOutput +from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.static.container import Container from openbb_core.app.static.filters import filter_call, filter_inputs, filter_output @@ -18,8 +19,18 @@ class CLASS_fixedincome(Container): @validate_arguments def treasury( self, - start_date: Union[datetime.date, None, str] = None, - end_date: Union[datetime.date, None, str] = None, + start_date: Annotated[ + Union[datetime.date, None, str], + OpenBBCustomParameter( + description="Start date of the data, in YYYY-MM-DD format." + ), + ] = None, + end_date: Annotated[ + Union[datetime.date, None, str], + OpenBBCustomParameter( + description="End date of the data, in YYYY-MM-DD format." + ), + ] = None, chart: bool = False, provider: Optional[Literal["fmp"]] = None, **kwargs diff --git a/openbb_sdk/sdk/core/openbb_core/app/static/package/forex.py b/openbb_sdk/sdk/core/openbb_core/app/static/package/forex.py index b40dd208edc..94532bb1d20 100644 --- a/openbb_sdk/sdk/core/openbb_core/app/static/package/forex.py +++ b/openbb_sdk/sdk/core/openbb_core/app/static/package/forex.py @@ -2,11 +2,12 @@ import datetime import typing -from typing import Literal, Optional, Union +from typing import Annotated, Literal, Optional, Union from pydantic import validate_arguments from openbb_core.app.model.command_output import CommandOutput +from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.static.container import Container from openbb_core.app.static.filters import filter_call, filter_inputs, filter_output @@ -17,7 +18,7 @@ class CLASS_forex(Container): def pairs( self, chart: bool = False, - provider: Optional[Literal["fmp", "polygon"]] = None, + provider: Optional[Literal["polygon", "fmp"]] = None, **kwargs ) -> CommandOutput[typing.List]: """Forex Available Pairs. @@ -28,7 +29,7 @@ class CLASS_forex(Container): Parameters ---------- - provider: Literal[fmp, polygon] + provider: Literal[polygon, fmp] The provider to use for the query. All fields are standardized. @@ -52,25 +53,6 @@ class CLASS_forex(Container): name : str The name of the currency pair. - fmp - === - - Parameters - ---------- - All fields are standardized. - - - ForexPairs - ---------- - symbol : str - The symbol of the currency pair. - currency : str - The base currency of the currency pair. - stockExchange : Optional[str] - The stock exchange of the currency pair. - exchange_short_name : Optional[str] - The short name of the stock exchange of the currency pair. - polygon ======= @@ -109,7 +91,26 @@ class CLASS_forex(Container): last_updated_utc : datetime The last updated timestamp in UTC. delisted_utc : Optional[datetime] - The delisted timestamp in UTC.""" + The delisted timestamp in UTC. + + fmp + === + + Parameters + ---------- + All fields are standardized. + + + ForexPairs + ---------- + symbol : str + The symbol of the currency pair. + currency : str + The base currency of the currency pair. + stockExchange : Optional[str] + The stock exchange of the currency pair. + exchange_short_name : Optional[str] + The short name of the stock exchange of the currency pair.""" inputs = filter_inputs( provider_choices={ "provider": provider, @@ -130,11 +131,23 @@ class CLASS_forex(Container): @validate_arguments def load( self, - symbol: str, - start_date: Union[datetime.date, None, str] = None, - end_date: Union[datetime.date, None, str] = None, + symbol: typing.Annotated[ + str, OpenBBCustomParameter(description="Symbol to get data for.") + ], + start_date: Annotated[ + Union[datetime.date, None, str], + OpenBBCustomParameter( + description="Start date of the data, in YYYY-MM-DD format." + ), + ] = None, + end_date: Annotated[ + Union[datetime.date, None, str], + OpenBBCustomParameter( + description="End date of the data, in YYYY-MM-DD format." + ), + ] = None, chart: bool = False, - provider: Optional[Literal["fmp", "polygon"]] = None, + provider: Optional[Literal["polygon", "fmp"]] = None, **kwargs ) -> CommandOutput[typing.List]: """Forex Intraday Price. @@ -145,7 +158,7 @@ class CLASS_forex(Container): Parameters ---------- - provider: Literal[fmp, polygon] + provider: Literal[polygon, fmp] The provider to use for the query. symbol : ConstrainedStrValue Symbol to get data for. @@ -186,6 +199,28 @@ class CLASS_forex(Container): vwap : Optional[PositiveFloat] Volume Weighted Average Price of the symbol. + polygon + ======= + + Parameters + ---------- + timespan : Literal['minute', 'hour', 'day', 'week', 'month', 'quarter', 'year'] + The timespan of the data. + sort : Literal['asc', 'desc'] + Sort order of the data. + limit : PositiveInt + The number of data entries to return. + adjusted : bool + Whether the data is adjusted. + multiplier : PositiveInt + The multiplier of the timespan. + + + ForexEOD + -------- + n : PositiveInt + The number of transactions for the symbol in the time period. + fmp === @@ -207,29 +242,7 @@ class CLASS_forex(Container): label : str Human readable format of the date. changeOverTime : float - Change \\% in the price of the symbol over a period of time. - - polygon - ======= - - Parameters - ---------- - timespan : Literal['minute', 'hour', 'day', 'week', 'month', 'quarter', 'year'] - The timespan of the data. - sort : Literal['asc', 'desc'] - Sort order of the data. - limit : PositiveInt - The number of data entries to return. - adjusted : bool - Whether the data is adjusted. - multiplier : PositiveInt - The multiplier of the timespan. - - - ForexEOD - -------- - n : PositiveInt - The number of transactions for the symbol in the time period.""" + Change \\% in the price of the symbol over a period of time.""" inputs = filter_inputs( provider_choices={ "provider": provider, diff --git a/openbb_sdk/sdk/core/openbb_core/app/static/package/module_map.json b/openbb_sdk/sdk/core/openbb_core/app/static/package/module_map.json index 83224aab956..f0b46d3741c 100644 --- a/openbb_sdk/sdk/core/openbb_core/app/static/package/module_map.json +++ b/openbb_sdk/sdk/core/openbb_core/app/static/package/module_map.json @@ -1,7 +1,14 @@ { - "crypto_load": "/crypto/load", + "news_globalnews": "/news/globalnews", "__extensions__": "", - "crypto": "/crypto", + "news": "/news", + "news_sectornews": "/news/sectornews", + "fixedincome_treasury": "/fixedincome/treasury", + "fixedincome": "/fixedincome", + "fixedincome_ycrv": "/fixedincome/ycrv", + "forex_pairs": "/forex/pairs", + "forex": "/forex", + "forex_load": "/forex/load", "economy_corecpi": "/economy/corecpi", "economy": "/economy", "economy_const": "/economy/const", @@ -37,41 +44,8 @@ "economy_trust": "/economy/trust", "economy_usbonds": "/economy/usbonds", "economy_valuation": "/economy/valuation", - "fixedincome_treasury": "/fixedincome/treasury", - "fixedincome": "/fixedincome", - "fixedincome_ycrv": "/fixedincome/ycrv", - "forex_pairs": "/forex/pairs", - "forex": "/forex", - "forex_load": "/forex/load", - "news_globalnews": "/news/globalnews", - "news": "/news", - "news_sectornews": "/news/sectornews", - "qa_normality": "/qa/normality", - "qa": "/qa", - "qa_capm": "/qa/capm", - "qa_qqplot": "/qa/qqplot", - "qa_om": "/qa/om", - "qa_kurtosis": "/qa/kurtosis", - "qa_pick": "/qa/pick", - "qa_spread": "/qa/spread", - "qa_rolling": "/qa/rolling", - "qa_var": "/qa/var", - "qa_line": "/qa/line", - "qa_hist": "/qa/hist", - "qa_unitroot": "/qa/unitroot", - "qa_beta": "/qa/beta", - "qa_sh": "/qa/sh", - "qa_so": "/qa/so", - "qa_cusum": "/qa/cusum", - "qa_raw": "/qa/raw", - "qa_cdf": "/qa/cdf", - "qa_decompose": "/qa/decompose", - "qa_skew": "/qa/skew", - "qa_quantile": "/qa/quantile", - "qa_bw": "/qa/bw", - "qa_es": "/qa/es", - "qa_acf": "/qa/acf", - "qa_summary": "/qa/summary", + "crypto_load": "/crypto/load", + "crypto": "/crypto", "stocks_fa_analysis": "/stocks/fa/analysis", "stocks": "/stocks", "stocks_fa": "/stocks/fa", @@ -219,6 +193,32 @@ "stocks_tob": "/stocks/tob", "stocks_quote": "/stocks/quote", "stocks_search": "/stocks/search", + "qa_normality": "/qa/normality", + "qa": "/qa", + "qa_capm": "/qa/capm", + "qa_qqplot": "/qa/qqplot", + "qa_om": "/qa/om", + "qa_kurtosis": "/qa/kurtosis", + "qa_pick": "/qa/pick", + "qa_spread": "/qa/spread", + "qa_rolling": "/qa/rolling", + "qa_var": "/qa/var", + "qa_line": "/qa/line", + "qa_hist": "/qa/hist", + "qa_unitroot": "/qa/unitroot", + "qa_beta": "/qa/beta", + "qa_sh": "/qa/sh", + "qa_so": "/qa/so", + "qa_cusum": "/qa/cusum", + "qa_raw": "/qa/raw", + "qa_cdf": "/qa/cdf", + "qa_decompose": "/qa/decompose", + "qa_skew": "/qa/skew", + "qa_quantile": "/qa/quantile", + "qa_bw": "/qa/bw", + "qa_es": "/qa/es", + "qa_acf": "/qa/acf", + "qa_summary": "/qa/summary", "ta_atr": "/ta/atr", "ta": "/ta", "ta_fib": "/ta/fib", diff --git a/openbb_sdk/sdk/core/openbb_core/app/static/package/news.py b/openbb_sdk/sdk/core/openbb_core/app/static/package/news.py index f247525bb78..703fd2fd0ac 100644 --- a/openbb_sdk/sdk/core/openbb_core/app/static/package/news.py +++ b/openbb_sdk/sdk/core/openbb_core/app/static/package/news.py @@ -9,6 +9,7 @@ from pydantic import validate_arguments import openbb_core.app.model.command_context import openbb_core.app.model.results.empty from openbb_core.app.model.command_output import CommandOutput +from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.static.container import Container from openbb_core.app.static.filters import filter_call, filter_inputs, filter_output @@ -18,7 +19,10 @@ class CLASS_news(Container): @validate_arguments def globalnews( self, - page: pydantic.types.NonNegativeInt = 0, + page: typing.Annotated[ + pydantic.types.NonNegativeInt, + OpenBBCustomParameter(description="The page of the global news."), + ] = 0, chart: bool = False, provider: Optional[Literal["benzinga", "fmp"]] = None, **kwargs diff --git a/openbb_sdk/sdk/core/openbb_core/app/static/package/stocks.py b/openbb_sdk/sdk/core/openbb_core/app/static/package/stocks.py index ab978460a0c..b4c1e005c58 100644 --- a/openbb_sdk/sdk/core/openbb_core/app/static/package/stocks.py +++ b/openbb_sdk/sdk/core/openbb_core/app/static/package/stocks.py @@ -2,7 +2,7 @@ import datetime import typing -from typing import Literal, Optional, Union +from typing import Annotated, Literal, Optional, Union import pydantic from pydantic import validate_arguments @@ -10,6 +10,7 @@ from pydantic import validate_arguments import openbb_core.app.model.command_context import openbb_core.app.model.results.empty from openbb_core.app.model.command_output import CommandOutput +from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.static.container import Container from openbb_core.app.static.filters import filter_call, filter_inputs, filter_output @@ -83,11 +84,23 @@ class CLASS_stocks(Container): @validate_arguments def load( self, - symbol: str, - start_date: Union[datetime.date, None, str] = None, - end_date: Union[datetime.date, None, str] = None, + symbol: typing.Annotated[ + str, OpenBBCustomParameter(description="Symbol to get data for.") + ], + start_date: Annotated[ + Union[datetime.date, None, str], + OpenBBCustomParameter( + description="Start date of the data, in YYYY-MM-DD format." + ), + ] = None, + end_date: Annotated[ + Union[datetime.date, None, str], + OpenBBCustomParameter( + description="End date of the data, in YYYY-MM-DD format." + ), + ] = None, chart: bool = False, - provider: Optional[Literal["fmp", "polygon"]] = None, + provider: Optional[Literal["polygon", "fmp"]] = None, **kwargs ) -> CommandOutput[typing.List]: """Load stock data for a specific ticker. @@ -98,7 +111,7 @@ class CLASS_stocks(Container): Parameters ---------- - provider: Literal[fmp, polygon] + provider: Literal[polygon, fmp] The provider to use for the query. symbol : ConstrainedStrValue Symbol to get data for. @@ -139,6 +152,28 @@ class CLASS_stocks(Container): vwap : PositiveFloat Volume Weighted Average Price of the symbol. + polygon + ======= + + Parameters + ---------- + timespan : Literal['minute', 'hour', 'day', 'week', 'month', 'quarter', 'year'] + The timespan of the data. + sort : Literal['asc', 'desc'] + Sort order of the data. + limit : PositiveInt + The number of data entries to return. + adjusted : bool + Whether the data is adjusted. + multiplier : PositiveInt + The multiplier of the timespan. + + + StockEOD + -------- + n : PositiveInt + The number of transactions for the symbol in the time period. + fmp === @@ -161,29 +196,7 @@ class CLASS_stocks(Container): label : str Human readable format of the date. changeOverTime : float - Change \\% in the price of the symbol over a period of time. - - polygon - ======= - - Parameters - ---------- - timespan : Literal['minute', 'hour', 'day', 'week', 'month', 'quarter', 'year'] - The timespan of the data. - sort : Literal['asc', 'desc'] - Sort order of the data. - limit : PositiveInt - The number of data entries to return. - adjusted : bool - Whether the data is adjusted. - multiplier : PositiveInt - The multiplier of the timespan. - - - StockEOD - -------- - n : PositiveInt - The number of transactions for the symbol in the time period.""" + Change \\% in the price of the symbol over a period of time.""" inputs = filter_inputs( provider_choices={ "provider": provider, @@ -208,11 +221,23 @@ class CLASS_stocks(Container): @validate_arguments def news( self, - symbols: str, - page: int = 0, - limit: Optional[pydantic.types.NonNegativeInt] = 15, + symbols: typing.Annotated[ + str, OpenBBCustomParameter(description="Symbol to get data for.") + ], + page: typing.Annotated[ + int, + OpenBBCustomParameter( + description="The page of the stock news to be retrieved." + ), + ] = 0, + limit: Annotated[ + Optional[pydantic.types.NonNegativeInt], + OpenBBCustomParameter( + description="The number of results to return per page." + ), + ] = 15, chart: bool = False, - provider: Optional[Literal["benzinga", "fmp", "polygon"]] = None, + provider: Optional[Literal["benzinga", "polygon", "fmp"]] = None, **kwargs ) -> CommandOutput[typing.List]: """Get news for one or more stock tickers. @@ -223,7 +248,7 @@ class CLASS_stocks(Container): Parameters ---------- - provider: Literal[benzinga, fmp, polygon] + provider: Literal[benzinga, polygon, fmp] The provider to use for the query. symbols : ConstrainedStrValue Symbol to get data for. @@ -296,23 +321,6 @@ class CLASS_stocks(Container): image : List[BenzingaImage] The images associated with the news. - fmp - === - - Parameters - ---------- - All fields are standardized. - - - StockNews - --------- - symbol : str - Ticker of the fetched news. - image : Optional[str] - URL to the image of the news source. - site : str - Name of the news source. - polygon ======= @@ -357,7 +365,24 @@ class CLASS_stocks(Container): publisher : PolygonPublisher Publisher of the article. tickers : List[str] - Tickers covered in the article.""" + Tickers covered in the article. + + fmp + === + + Parameters + ---------- + All fields are standardized. + + + StockNews + --------- + symbol : str + Ticker of the fetched news. + image : Optional[str] + URL to the image of the news source. + site : str + Name of the news source.""" inputs = filter_inputs( provider_choices={ "provider": provider, @@ -382,8 +407,13 @@ class CLASS_stocks(Container): @validate_arguments def multiples( self, - symbol: str, - limit: Optional[int] = 100, + symbol: typing.Annotated[ + str, OpenBBCustomParameter(description="Symbol to get data for.") + ], + limit: Annotated[ + Optional[int], + OpenBBCustomParameter(description="The number of data entries to return."), + ] = 100, chart: bool = False, provider: Optional[Literal["fmp"]] = None, **kwargs diff --git a/openbb_sdk/sdk/core/openbb_core/app/static/package/stocks_ca.py b/openbb_sdk/sdk/core/openbb_core/app/static/package/stocks_ca.py index 8cd9d795b71..1dbdff8769e 100644 --- a/openbb_sdk/sdk/core/openbb_core/app/static/package/stocks_ca.py +++ b/openbb_sdk/sdk/core/openbb_core/app/static/package/stocks_ca.py @@ -8,6 +8,7 @@ from pydantic import validate_arguments import openbb_core.app.model.command_context import openbb_core.app.model.results.empty from openbb_core.app.model.command_output import CommandOutput +from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.static.container import Container from openbb_core.app.static.filters import filter_call, filter_inputs, filter_output @@ -17,7 +18,9 @@ class CLASS_stocks_ca(Container): @validate_arguments def peers( self, - symbol: str, + symbol: typing.Annotated[ + str, OpenBBCustomParameter(description="Symbol to get data for.") + ], chart: bool = False, provider: Optional[Literal["fmp"]] = None, **kwargs diff --git a/openbb_sdk/sdk/core/openbb_core/app/static/package/stocks_dd.py b/openbb_sdk/sdk/core/openbb_core/app/static/package/stocks_dd.py index 71ff5dea390..792bc303908 100644 --- a/openbb_sdk/sdk/core/openbb_core/app/static/package/stocks_dd.py +++ b/openbb_sdk/sdk/core/openbb_core/app/static/package/stocks_dd.py @@ -1,11 +1,12 @@ ### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ### import typing -from typing import Literal, Optional +from typing import Annotated, Literal, Optional from pydantic import validate_arguments from openbb_core.app.model.command_output import CommandOutput +from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.static.container import Container from openbb_core.app.static.filters import filter_call, filter_inputs, filter_output @@ -15,111 +16,122 @@ class CLASS_stocks_dd(Container): @validate_arguments def sec( self, - symbol: str, - type: Literal[ - "1", - "1-A", - "1-E", - "1-K", - "1-N", - "1-SA", - "1-U", - "1-Z", - "10", - "10-D", - "10-K", - "10-M", - "10-Q", - "11-K", - "12b-25", - "13F", - "13H", - "144", - "15", - "15F", - "17-H", - "18", - "18-K", - "19b-4", - "19b-4(e)", - "19b-7", - "2-E", - "20-F", - "24F-2", - "25", - "3", - "4", - "40-F", - "5", - "6-K", - "7-M", - "8-A", - "8-K", - "8-M", - "9-M", - "ABS-15G", - "ABS-EE", - "ABS DD-15E", - "ADV", - "ADV-E", - "ADV-H", - "ADV-NR", - "ADV-W", - "ATS", - "ATS-N", - "ATS-R", - "BD", - "BD-N", - "BDW", - "C", - "CA-1", - "CB", - "CFPORTAL", - "CRS", - "CUSTODY", - "D", - "F-1", - "F-10", - "F-3", - "F-4", - "F-6", - "F-7", - "F-8", - "F-80", - "F-N", - "F-X", - "ID", - "MA", - "MA-I", - "MA-NR", - "MA-W", - "MSD", - "MSDW", - "N-14", - "N-17D-1", - "N-17f-1", - "N-17f-2", - "N-18f-1", - "N-1A", - "N-2", - "N-23c-3", - "N-27D-1", - "N-3", - "N-4", - "N-5", - "N-54A", - "N-54C", - "N-6", - "N-6EI-1", - "N-6F", - "N-8A", - "N-8B-2", - "N-8B-4", - "N-8F", - "N-CEN", + symbol: typing.Annotated[ + str, OpenBBCustomParameter(description="Symbol to get data for.") + ], + type: Annotated[ + Literal[ + "1", + "1-A", + "1-E", + "1-K", + "1-N", + "1-SA", + "1-U", + "1-Z", + "10", + "10-D", + "10-K", + "10-M", + "10-Q", + "11-K", + "12b-25", + "13F", + "13H", + "144", + "15", + "15F", + "17-H", + "18", + "18-K", + "19b-4", + "19b-4(e)", + "19b-7", + "2-E", + "20-F", + "24F-2", + "25", + "3", + "4", + "40-F", + "5", + "6-K", + "7-M", + "8-A", + "8-K", + "8-M", + "9-M", + "ABS-15G", + "ABS-EE", + "ABS DD-15E", + "ADV", + "ADV-E", + "ADV-H", + "ADV-NR", + "ADV-W", + "ATS", + "ATS-N", + "ATS-R", + "BD", + "BD-N", + "BDW", + "C", + "CA-1", + "CB", + "CFPORTAL", + "CRS", + "CUSTODY", + "D", + "F-1", + "F-10", + "F-3", + "F-4", + "F-6", + "F-7", + "F-8", + "F-80", + "F-N", + "F-X", + "ID", + "MA", + "MA-I", + "MA-NR", + "MA-W", + "MSD", + "MSDW", + "N-14", + "N-17D-1", + "N-17f-1", + "N-17f-2", + "N-18f-1", + "N-1A", + "N-2", + "N-23c-3", + "N-27D-1", + "N-3", + "N-4", + "N-5", + "N-54A", + "N-54C", + "N-6", + "N-6EI-1", + "N-6F", + "N-8A", + "N-8B-2", + "N-8B-4", + "N-8F", + "N-CEN", + ], + OpenBBCustomParameter(description="The type of the SEC filing form."), ] = "10-K", - page: Optional[int] = 0, - limit: Optional[int] = 100, + page: Annotated[ + Optional[int], + OpenBBCustomParameter(description="Page number of the results."), + ] = 0, + limit: Annotated[ + Optional[int], + OpenBBCustomParameter(description="The number of data entries to return."), + ] = 100, chart: bool = False, provider: Optional[Literal["fmp"]] = None, **kwargs diff --git a/openbb_sdk/sdk/core/openbb_core/app/static/package/stocks_fa.py b/openbb_sdk/sdk/core/openbb_core/app/static/package/stocks_fa.py index c005d43ffd0..9cf10adfd43 100644 --- a/openbb_sdk/sdk/core/openbb_core/app/static/package/stocks_fa.py +++ b/openbb_sdk/sdk/core/openbb_core/app/static/package/stocks_fa.py @@ -2,7 +2,7 @@ import datetime import typing -from typing import List, Literal, Optional, Union +from typing import Annotated, List, Literal, Optional, Union import pydantic from pydantic import validate_arguments @@ -10,6 +10,7 @@ from pydantic import validate_arguments import openbb_core.app.model.command_context import openbb_core.app.model.results.empty from openbb_core.app.model.command_output import CommandOutput +from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.static.container import Container from openbb_core.app.static.filters import filter_call, filter_inputs, filter_output @@ -36,11 +37,21 @@ class CLASS_stocks_fa(Container): @validate_arguments def balance( self, - symbol: str, - period: Literal["annually", "quarterly"] = "annually", - limit: Optional[pydantic.types.NonNegativeInt] = 12, + symbol: typing.Annotated[ + str, OpenBBCustomParameter(description="Symbol to get data for.") + ], + period: Annotated[ + Literal["annually", "quarterly"], + OpenBBCustomParameter( + description="Period of the data to return (quarterly or annually)." + ), + ] = "annually", + limit: Annotated[ + Optional[pydantic.types.NonNegativeInt], + OpenBBCustomParameter(description="The number of data entries to return."), + ] = 12, chart: bool = False, - provider: Optional[Literal["fmp", "polygon"]] = None, + provider: Optional[Literal["polygon", "fmp"]] = None, **kwargs ) -> CommandOutput[typing.List]: """Balance Sheet. @@ -51,7 +62,7 @@ class CLASS_stocks_fa(Container): Parameters ---------- - provider: Literal[fmp, polygon] + provider: Literal[polygon, fmp] The provider to use for the query. symbol : ConstrainedStrValue Symbol to get data for. @@ -164,42 +175,6 @@ class CLASS_stocks_fa(Container): total_liabilities_and_total_equity : Optional[int] None - fmp - === - - Parameters - ---------- - cik : Optional[str] - None - - - BalanceSheet - ------------ - calendarYear : Optional[int] - None - link : Optional[str] - None - finalLink : Optional[str] - None - cashAndShortTermInvestments : Optional[int] - None - goodwillAndIntangibleAssets : Optional[int] - None - deferredRevenueNonCurrent : Optional[int] - None - totalInvestments : Optional[int] - None - capitalLeaseObligations : Optional[int] - None - deferredTaxLiabilitiesNonCurrent : Optional[int] - None - totalNonCurrentLiabilities : Optional[int] - None - totalDebt : Optional[int] - None - netDebt : Optional[int] - None - polygon ======= @@ -241,7 +216,43 @@ class CLASS_stocks_fa(Container): BalanceSheet ------------ - All fields are standardized.""" + All fields are standardized. + + fmp + === + + Parameters + ---------- + cik : Optional[str] + None + + + BalanceSheet + ------------ + calendarYear : Optional[int] + None + link : Optional[str] + None + finalLink : Optional[str] + None + cashAndShortTermInvestments : Optional[int] + None + goodwillAndIntangibleAssets : Optional[int] + None + deferredRevenueNonCurrent : Optional[int] + None + totalInvestments : Optional[int] + None + capitalLeaseObligations : Optional[int] + None + deferredTaxLiabilitiesNonCurrent : Optional[int] + None + totalNonCurrentLiabilities : Optional[int] + None + totalDebt : Optional[int] + None + netDebt : Optional[int] + None""" inputs = filter_inputs( provider_choices={ "provider": provider, @@ -266,8 +277,13 @@ class CLASS_stocks_fa(Container): @validate_arguments def balance_growth( self, - symbol: str, - limit: int = 10, + symbol: typing.Annotated[ + str, OpenBBCustomParameter(description="Symbol to get data for.") + ], + limit: typing.Annotated[ + int, + OpenBBCustomParameter(description="The number of data entries to return."), + ] = 10, chart: bool = False, provider: Optional[Literal["fmp"]] = None, **kwargs @@ -423,8 +439,18 @@ class CLASS_stocks_fa(Container): @validate_arguments def cal( self, - start_date: Union[datetime.date, None, str] = None, - end_date: Union[datetime.date, None, str] = None, + start_date: Annotated[ + Union[datetime.date, None, str], + OpenBBCustomParameter( + description="Start date of the data, in YYYY-MM-DD format." + ), + ] = None, + end_date: Annotated[ + Union[datetime.date, None, str], + OpenBBCustomParameter( + description="End date of the data, in YYYY-MM-DD format." + ), + ] = None, chart: bool = False, provider: Optional[Literal["fmp"]] = None, **kwargs @@ -512,11 +538,21 @@ class CLASS_stocks_fa(Container): @validate_arguments def cash( self, - symbol: str, - period: Literal["annually", "quarterly"] = "annually", - limit: Optional[pydantic.types.NonNegativeInt] = 12, + symbol: typing.Annotated[ + str, OpenBBCustomParameter(description="Symbol to get data for.") + ], + period: Annotated[ + Literal["annually", "quarterly"], + OpenBBCustomParameter( + description="Period of the data to return (quarterly or annually)." + ), + ] = "annually", + limit: Annotated[ + Optional[pydantic.types.NonNegativeInt], + OpenBBCustomParameter(description="The number of data entries to return."), + ] = 12, chart: bool = False, - provider: Optional[Literal["fmp", "polygon"]] = None, + provider: Optional[Literal["polygon", "fmp"]] = None, **kwargs ) -> CommandOutput[typing.List]: """Cash Flow Statement. @@ -527,7 +563,7 @@ class CLASS_stocks_fa(Container): Parameters ---------- - provider: Literal[fmp, polygon] + provider: Literal[polygon, fmp] The provider to use for the query. symbol : ConstrainedStrValue Symbol to get data for. @@ -620,24 +656,6 @@ class CLASS_stocks_fa(Container): cash_at_end_of_period : Optional[int] None - fmp - === - - Parameters - ---------- - cik : Optional[str] - Central Index Key (CIK) of the company. - - - CashFlowStatement - ----------------- - calendarYear : Optional[int] - None - link : Optional[str] - None - finalLink : Optional[str] - None - polygon ======= @@ -679,7 +697,25 @@ class CLASS_stocks_fa(Container): CashFlowStatement ----------------- - All fields are standardized.""" + All fields are standardized. + + fmp + === + + Parameters + ---------- + cik : Optional[str] + Central Index Key (CIK) of the company. + + + CashFlowStatement + ----------------- + calendarYear : Optional[int] + None + link : Optional[str] + None + finalLink : Optional[str] + None""" inputs = filter_inputs( provider_choices={ "provider": provider, @@ -704,8 +740,13 @@ class CLASS_stocks_fa(Container): @validate_arguments def cash_growth( self, - symbol: str, - limit: int = 10, + symbol: typing.Annotated[ + str, OpenBBCustomParameter(description="Symbol to get data for.") + ], + limit: typing.Annotated[ + int, + OpenBBCustomParameter(description="The number of data entries to return."), + ] = 10, chart: bool = False, provider: Optional[Literal["fmp"]] = None, **kwargs @@ -843,7 +884,9 @@ class CLASS_stocks_fa(Container): @validate_arguments def comp( self, - symbol: str, + symbol: typing.Annotated[ + str, OpenBBCustomParameter(description="Symbol to get data for.") + ], chart: bool = False, provider: Optional[Literal["fmp"]] = None, **kwargs @@ -938,8 +981,18 @@ class CLASS_stocks_fa(Container): @validate_arguments def comsplit( self, - start_date: Union[datetime.date, None, str] = None, - end_date: Union[datetime.date, None, str] = None, + start_date: Annotated[ + Union[datetime.date, None, str], + OpenBBCustomParameter( + description="Start date of the data, in YYYY-MM-DD format." + ), + ] = None, + end_date: Annotated[ + Union[datetime.date, None, str], + OpenBBCustomParameter( + description="End date of the data, in YYYY-MM-DD format." + ), + ] = None, chart: bool = False, provider: Optional[Literal["fmp"]] = None, **kwargs @@ -1055,7 +1108,9 @@ class CLASS_stocks_fa(Container): @validate_arguments def divs( self, - symbol: str, + symbol: typing.Annotated[ + str, OpenBBCustomParameter(description="Symbol to get data for.") + ], chart: bool = False, provider: Optional[Literal["fmp"]] = None, **kwargs @@ -1155,8 +1210,13 @@ class CLASS_stocks_fa(Container): @validate_arguments def earning( self, - symbol: str, - limit: Optional[int] = 50, + symbol: typing.Annotated[ + str, OpenBBCustomParameter(description="Symbol to get data for.") + ], + limit: Annotated[ + Optional[int], + OpenBBCustomParameter(description="The number of data entries to return."), + ] = 50, chart: bool = False, provider: Optional[Literal["fmp"]] = None, **kwargs @@ -1246,7 +1306,9 @@ class CLASS_stocks_fa(Container): @validate_arguments def emp( self, - symbol: str, + symbol: typing.Annotated[ + str, OpenBBCustomParameter(description="Symbol to get data for.") + ], chart: bool = False, provider: Optional[Literal["fmp"]] = None, **kwargs @@ -1367,9 +1429,19 @@ class CLASS_stocks_fa(Container): @validate_arguments def est( self, - symbol: str, - period: Literal["quarterly", "annually"] = "annually", - limit: int = 30, + symbol: typing.Annotated[ + str, OpenBBCustomParameter(description="Symbol to get data for.") + ], + period: Annotated[ + Literal["quarterly", "annually"], + OpenBBCustomParameter( + description="Period of the data to return (quarterly or annually)." + ), + ] = "annually", + limit: typing.Annotated[ + int, + OpenBBCustomParameter(description="The number of data entries to return."), + ] = 30, chart: bool = False, provider: Optional[Literal["fmp"]] = None, **kwargs @@ -1572,11 +1644,21 @@ class CLASS_stocks_fa(Container): @validate_arguments def income( self, - symbol: str, - period: Literal["annually", "quarterly"] = "annually", - limit: Optional[pydantic.types.NonNegativeInt] = 12, + symbol: typing.Annotated[ + str, OpenBBCustomParameter(description="Symbol to get data for.") + ], + period: Annotated[ + Literal["annually", "quarterly"], + OpenBBCustomParameter( + description="Period of the data to return (quarterly or annually)." + ), + ] = "annually", + limit: Annotated[ + Optional[pydantic.types.NonNegativeInt], + OpenBBCustomParameter(description="The number of data entries to return."), + ] = 12, chart: bool = False, - provider: Optional[Literal["fmp", "polygon"]] = None, + provider: Optional[Literal["polygon", "fmp"]] = None, **kwargs ) -> CommandOutput[typing.List]: """Income Statement. @@ -1587,7 +1669,7 @@ class CLASS_stocks_fa(Container): Parameters ---------- - provider: Literal[fmp, polygon] + provider: Literal[polygon, fmp] The provider to use for the query. symbol : ConstrainedStrValue Symbol to get data for. @@ -1672,34 +1754,6 @@ class CLASS_stocks_fa(Container): weighted_average_shares_outstanding_dil : Optional[int] Weighted average shares outstanding diluted. - fmp - === - - Parameters - ---------- - cik : Optional[str] - The CIK of the company if no symbol is provided. - - - IncomeStatement - --------------- - calendarYear : Optional[int] - None - grossProfitRatio : Optional[float] - None - ebitdaratio : Optional[float] - None - operatingIncomeRatio : Optional[float] - None - incomeBeforeTaxRatio : Optional[float] - None - netIncomeRatio : Optional[float] - None - link : Optional[str] - None - finalLink : Optional[str] - None - polygon ======= @@ -1754,6 +1808,34 @@ class CLASS_stocks_fa(Container): participating_securities_distributed_and_undistributed_earnings_loss_basic : Optional[float] None preferred_stock_dividends_and_other_adjustments : Optional[float] + None + + fmp + === + + Parameters + ---------- + cik : Optional[str] + The CIK of the company if no symbol is provided. + + + IncomeStatement + --------------- + calendarYear : Optional[int] + None + grossProfitRatio : Optional[float] + None + ebitdaratio : Optional[float] + None + operatingIncomeRatio : Optional[float] + None + incomeBeforeTaxRatio : Optional[float] + None + netIncomeRatio : Optional[float] + None + link : Optional[str] + None + finalLink : Optional[str] None""" inputs = filter_inputs( provider_choices={ @@ -1779,9 +1861,19 @@ class CLASS_stocks_fa(Container): @validate_arguments def income_growth( self, - symbol: str, - limit: int = 10, - period: Literal["annually", "quarterly"] = "annually", + symbol: typing.Annotated[ + str, OpenBBCustomParameter(description="Symbol to get data for.") + ], + limit: typing.Annotated[ + int, + OpenBBCustomParameter(description="The number of data entries to return."), + ] = 10, + period: Annotated[ + Literal["annually", "quarterly"], + OpenBBCustomParameter( + description="Period of the data to return (quarterly or annually)." + ), + ] = "annually", chart: bool = False, provider: Optional[Literal["fmp"]] = None, **kwargs @@ -1914,34 +2006,48 @@ class CLASS_stocks_fa(Container): @validate_arguments def ins( self, - symbol: str, - transactionType: Optional[ - List[ - Literal[ - "A-Award", - "C-Conversion", - "D-Return", - "E-ExpireShort", - "F-InKind", - "G-Gift", - "H-ExpireLong", - "I-Discretionary", - "J-Other", - "L-Small", - "M-Exempt", - "O-OutOfTheMoney", - "P-Purchase", - "S-Sale", - "U-Tender", - "W-Will", - "X-InTheMoney", - "Z-Trust", + symbol: typing.Annotated[ + str, OpenBBCustomParameter(description="Symbol to get data for.") + ], + transactionType: Annotated[ + Optional[ + List[ + Literal[ + "A-Award", + "C-Conversion", + "D-Return", + "E-ExpireShort", + "F-InKind", + "G-Gift", + "H-ExpireLong", + "I-Discretionary", + "J-Other", + "L-Small", + "M-Exempt", + "O-OutOfTheMoney", + "P-Purchase", + "S-Sale", + "U-Tender", + "W-Will", + "X-InTheMoney", + "Z-Trust", + ] ] - ] + ], + OpenBBCustomParameter(description="The type of the transaction."), ] = ["P-Purchase"], - reportingCik: Optional[int] = None, - companyCik: Optional[int] = None, - page: Optional[int] = 0, + reportingCik: Annotated[ + Optional[int], + OpenBBCustomParameter(description="The CIK of the reporting owner."), + ] = None, + companyCik: Annotated[ + Optional[int], + OpenBBCustomParameter(description="The CIK of the company owner."), + ] = None, + page: Annotated[ + Optional[int], + OpenBBCustomParameter(description="The page number of the data to fetch."), + ] = 0, chart: bool = False, provider: Optional[Literal["fmp"]] = None, **kwargs @@ -2052,9 +2158,16 @@ class CLASS_stocks_fa(Container): @validate_arguments def ins_own( self, - symbol: str, - include_current_quarter: bool = False, - date: Optional[datetime.date] = None, + symbol: typing.Annotated[ + str, OpenBBCustomParameter(description="Symbol to get data for.") + ], + include_current_quarter: typing.Annotated[ + bool, OpenBBCustomParameter(description="Include current quarter data.") + ] = False, + date: Annotated[ + Optional[datetime.date], + OpenBBCustomParameter(description="A specific date to get data for."), + ] = None, chart: bool = False, provider: Optional[Literal["fmp"]] = None, **kwargs @@ -2217,9 +2330,19 @@ class CLASS_stocks_fa(Container): @validate_arguments def metrics( self, - symbol: str, - period: Literal["annually", "quarterly"] = "annually", - limit: Optional[int] = 100, + symbol: typing.Annotated[ + str, OpenBBCustomParameter(description="Symbol to get data for.") + ], + period: Annotated[ + Literal["annually", "quarterly"], + OpenBBCustomParameter( + description="Period of the data to return (quarterly or annually)." + ), + ] = "annually", + limit: Annotated[ + Optional[int], + OpenBBCustomParameter(description="The number of data entries to return."), + ] = 100, chart: bool = False, provider: Optional[Literal["fmp"]] = None, **kwargs @@ -2414,7 +2537,9 @@ class CLASS_stocks_fa(Container): @validate_arguments def mgmt( self, - symbol: str, + symbol: typing.Annotated[ + str, OpenBBCustomParameter(description="Symbol to get data for.") + ], chart: bool = False, provider: Optional[Literal["fmp"]] = None, **kwargs @@ -2530,7 +2655,9 @@ class CLASS_stocks_fa(Container): @validate_arguments def overview( self, - symbol: str, + symbol: typing.Annotated[ + str, OpenBBCustomParameter(description="Symbol to get data for.") + ], chart: bool = False, provider: Optional[Literal["fmp"]] = None, **kwargs @@ -2671,9 +2798,17 @@ class CLASS_stocks_fa(Container): @validate_arguments def own( self, - symbol: str, - date: datetime.date, - page: Optional[int] = 0, + symbol: typing.Annotated[ + str, OpenBBCustomParameter(description="Symbol to get data for.") + ], + date: typing.Annotated[ + datetime.date, + OpenBBCustomParameter(description="A specific date to get data for."), + ], + page: Annotated[ + Optional[int], + OpenBBCustomParameter(description="The page number of the data to fetch."), + ] = 0, chart: bool = False, provider: Optional[Literal["fmp"]] = None, **kwargs @@ -2826,7 +2961,9 @@ class CLASS_stocks_fa(Container): @validate_arguments def pt( self, - symbol: str, + symbol: typing.Annotated[ + str, OpenBBCustomParameter(description="Symbol to get data for.") + ], chart: bool = False, provider: Optional[Literal["fmp"]] = None, **kwargs @@ -2905,7 +3042,9 @@ class CLASS_stocks_fa(Container): @validate_arguments def pta( self, - symbol: str, + symbol: typing.Annotated[ + str, OpenBBCustomParameter(description="Symbol to get data for.") + ], chart: bool = False, provider: Optional[Literal["fmp"]] = None, **kwargs @@ -3047,9 +3186,19 @@ class CLASS_stocks_fa(Container): @validate_arguments def revgeo( self, - symbol: str, - period: Literal["quarterly", "annually"] = "annually", - structure: Literal["hierarchical", "flat"] = "flat", + symbol: typing.Annotated[ + str, OpenBBCustomParameter(description="Symbol to get data for.") + ], + period: Annotated[ + Literal["quarterly", "annually"], + OpenBBCustomParameter( + description="Period of the data to return (quarterly or annually)." + ), + ] = "annually", + structure: Annotated[ + Literal["hierarchical", "flat"], + OpenBBCustomParameter(description="The structure of the returned data."), + ] = "flat", chart: bool = False, provider: Optional[Literal["fmp"]] = None, **kwargs @@ -3136,9 +3285,19 @@ class CLASS_stocks_fa(Container): @validate_arguments def revseg( self, - symbol: str, - period: Literal["quarterly", "annually"] = "annually", - structure: Literal["hierarchical", "flat"] = "flat", + symbol: typing.Annotated[ + str, OpenBBCustomParameter(description="Symbol to get data for.") + ], + period: Annotated[ + Literal["quarterly", "annually"], + OpenBBCustomParameter( + description="Period of the data to return (quarterly or annually)." + ), + ] = "annually", + structure: Annotated[ + Literal["hierarchical", "flat"], + OpenBBCustomParameter(description="The structure of the returned data."), + ] = "flat", chart: bool = False, provider: Optional[Literal["fmp"]] = None, **kwargs @@ -3283,7 +3442,9 @@ class CLASS_stocks_fa(Container): @validate_arguments def shrs( self, - symbol: str, + symbol: typing.Annotated[ + str, OpenBBCustomParameter(description="Symbol to get data for.") + ], chart: bool = False, provider: Optional[Literal["fmp"]] = None, **kwargs @@ -3364,7 +3525,9 @@ class CLASS_stocks_fa(Container): @validate_arguments def split( self, - symbol: str, + symbol: typing.Annotated[ + str, OpenBBCustomParameter(description="Symbol to get data for.") + ], chart: bool = False, provider: Optional[Literal["fmp"]] = None, **kwargs @@ -3458,9 +3621,21 @@ class CLASS_stocks_fa(Container): @validate_arguments def transcript( self, - symbol: str, - year: int, - quarter: Literal[1, 2, 3, 4] = 1, + symbol: typing.Annotated[ + str, OpenBBCustomParameter(description="Symbol to get data for.") + ], + year: typing.Annotated[ + int, + OpenBBCustomParameter( + description="The year of the earnings call transcript." + ), + ], + quarter: Annotated[ + Literal[1, 2, 3, 4], + OpenBBCustomParameter( + description="The quarter of the earnings call transcript." + ), + ] = 1, chart: bool = False, provider: Optional[Literal["fmp"]] = None, **kwargs diff --git a/openbb_sdk/sdk/core/openbb_core/app/static/package/ta.py b/openbb_sdk/sdk/core/openbb_core/app/static/package/ta.py index 0536c0944b3..1e82589462e 100644 --- a/openbb_sdk/sdk/core/openbb_core/app/static/package/ta.py +++ b/openbb_sdk/sdk/core/openbb_core/app/static/package/ta.py @@ -1,56 +1,63 @@ ### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ### -from openbb_core.app.static.container import Container -from openbb_core.app.model.command_output import CommandOutput +import typing +from typing import List, Literal, Optional, Union + import openbb_provider import pandas -import datetime import pydantic +import pydantic.types from pydantic import validate_arguments -from inspect import Parameter -from typing import List, Dict, Union, Optional, Literal -from openbb_core.app.utils import df_to_basemodel -from openbb_core.app.static.filters import filter_call, filter_inputs, filter_output import openbb_core.app.model.results.empty -import pydantic.types -import typing +from openbb_core.app.model.command_output import CommandOutput +from openbb_core.app.static.container import Container +from openbb_core.app.static.filters import filter_call, filter_inputs, filter_output + class CLASS_ta(Container): - @filter_call @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def atr(self, data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], index: str = 'date', length: pydantic.types.PositiveInt = 14, mamode: Literal['rma', 'ema', 'sma', 'wma'] = 'rma', drift: pydantic.types.NonNegativeInt = 1, offset: int = 0, chart: bool = False) -> CommandOutput[typing.List]: + def atr( + self, + data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], + index: str = "date", + length: pydantic.types.PositiveInt = 14, + mamode: Literal["rma", "ema", "sma", "wma"] = "rma", + drift: pydantic.types.NonNegativeInt = 1, + offset: int = 0, + chart: bool = False, + ) -> CommandOutput[typing.List]: """ - Average True Range is used to measure volatility, especially volatility caused by - gaps or limit moves. + Average True Range is used to measure volatility, especially volatility caused by + gaps or limit moves. - Parameters - ---------- - data : List[Data] - List of data to apply the indicator to. - index : str, optional - Index column name, by default "date" - length : PositiveInt, optional - It's period, by default 14 - mamode : Literal["rma", "ema", "sma", "wma"], optional - Moving average mode, by default "rma" - drift : NonNegativeInt, optional - The difference period, by default 1 - offset : int, optional - How many periods to offset the result, by default 0 + Parameters + ---------- + data : List[Data] + List of data to apply the indicator to. + index : str, optional + Index column name, by default "date" + length : PositiveInt, optional + It's period, by default 14 + mamode : Literal["rma", "ema", "sma", "wma"], optional + Moving average mode, by default "rma" + drift : NonNegativeInt, optional + The difference period, by default 1 + offset : int, optional + How many periods to offset the result, by default 0 - Returns - ------- - CommandOutput[List[Data]] - List of data with the indicator applied. + Returns + ------- + CommandOutput[List[Data]] + List of data with the indicator applied. - Examples - -------- - >>> from openbb import obb - >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") - >>> atr_data = obb.ta.atr(data=stock_data.results) - """ + Examples + -------- + >>> from openbb import obb + >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") + >>> atr_data = obb.ta.atr(data=stock_data.results) + """ inputs = filter_inputs( data=data, index=index, @@ -70,30 +77,39 @@ class CLASS_ta(Container): @filter_call @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def fib(self, data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], index: str = 'date', close_column: Literal['close', 'adj_close'] = 'close', period: pydantic.types.PositiveInt = 120, start_date: Optional[str] = None, end_date: Optional[str] = None, chart: bool = False) -> CommandOutput[typing.List]: + def fib( + self, + data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], + index: str = "date", + close_column: Literal["close", "adj_close"] = "close", + period: pydantic.types.PositiveInt = 120, + start_date: Optional[str] = None, + end_date: Optional[str] = None, + chart: bool = False, + ) -> CommandOutput[typing.List]: """ - Fibonacci Retracement Levels. + Fibonacci Retracement Levels. - Parameters - ---------- - data : List[Data] - List of data to apply the indicator to. - index : str, optional - Index column name, by default "date" - period : PositiveInt, optional - Period to calculate the indicator, by default 120 + Parameters + ---------- + data : List[Data] + List of data to apply the indicator to. + index : str, optional + Index column name, by default "date" + period : PositiveInt, optional + Period to calculate the indicator, by default 120 - Returns - ------- - CommandOutput[List[Data]] - List of data with the indicator applied. + Returns + ------- + CommandOutput[List[Data]] + List of data with the indicator applied. - Examples - -------- - >>> from openbb import obb - >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") - >>> fib_data = obb.ta.fib(data=stock_data.results, period=120) - """ + Examples + -------- + >>> from openbb import obb + >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") + >>> fib_data = obb.ta.fib(data=stock_data.results, period=120) + """ inputs = filter_inputs( data=data, index=index, @@ -113,38 +129,44 @@ class CLASS_ta(Container): @filter_call @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def obv(self, data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], index: str = 'date', offset: int = 0, chart: bool = False) -> CommandOutput[typing.List]: + def obv( + self, + data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], + index: str = "date", + offset: int = 0, + chart: bool = False, + ) -> CommandOutput[typing.List]: """ - The On Balance Volume (OBV) is a cumulative total of the up and - down volume. When the close is higher than the previous close, the volume is added - to the running total, and when the close is lower than the previous close, the volume - is subtracted from the running total. - - To interpret the OBV, look for the OBV - to move with the price or precede price moves. If the price moves before the OBV, - then it is a non-confirmed move. A series of rising peaks, or falling troughs, in the - OBV indicates a strong trend. If the OBV is flat, then the market is not trending. + The On Balance Volume (OBV) is a cumulative total of the up and + down volume. When the close is higher than the previous close, the volume is added + to the running total, and when the close is lower than the previous close, the volume + is subtracted from the running total. - Parameters - ---------- - data : List[Data] - List of data to apply the indicator to. - index : str, optional - Index column name, by default "date" - offset : int, optional - How many periods to offset the result, by default 0. + To interpret the OBV, look for the OBV + to move with the price or precede price moves. If the price moves before the OBV, + then it is a non-confirmed move. A series of rising peaks, or falling troughs, in the + OBV indicates a strong trend. If the OBV is flat, then the market is not trending. - Returns - ------- - CommandOutput[List[Data]] - List of data with the indicator applied. + Parameters + ---------- + data : List[Data] + List of data to apply the indicator to. + index : str, optional + Index column name, by default "date" + offset : int, optional + How many periods to offset the result, by default 0. - Examples - -------- - >>> from openbb import obb - >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") - >>> obv_data = obb.ta.obv(data=stock_data.results, offset=0) - """ + Returns + ------- + CommandOutput[List[Data]] + List of data with the indicator applied. + + Examples + -------- + >>> from openbb import obb + >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") + >>> obv_data = obb.ta.obv(data=stock_data.results, offset=0) + """ inputs = filter_inputs( data=data, index=index, @@ -161,36 +183,43 @@ class CLASS_ta(Container): @filter_call @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def fisher(self, data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], index: str = 'date', length: pydantic.types.PositiveInt = 14, signal: pydantic.types.PositiveInt = 1, chart: bool = False) -> CommandOutput[typing.List]: + def fisher( + self, + data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], + index: str = "date", + length: pydantic.types.PositiveInt = 14, + signal: pydantic.types.PositiveInt = 1, + chart: bool = False, + ) -> CommandOutput[typing.List]: """ - The Fisher Transform is a technical indicator created by John F. Ehlers - that converts prices into a Gaussian normal distribution.1 The indicator - highlights when prices have moved to an extreme, based on recent prices. - This may help in spotting turning points in the price of an asset. It also - helps show the trend and isolate the price waves within a trend. + The Fisher Transform is a technical indicator created by John F. Ehlers + that converts prices into a Gaussian normal distribution.1 The indicator + highlights when prices have moved to an extreme, based on recent prices. + This may help in spotting turning points in the price of an asset. It also + helps show the trend and isolate the price waves within a trend. - Parameters - ---------- - data : List[Data] - List of data to apply the indicator to. - index : str, optional - Index column name, by default "date" - length : PositiveInt, optional - Fisher period, by default 14 - signal : PositiveInt, optional - Fisher Signal period, by default 1 + Parameters + ---------- + data : List[Data] + List of data to apply the indicator to. + index : str, optional + Index column name, by default "date" + length : PositiveInt, optional + Fisher period, by default 14 + signal : PositiveInt, optional + Fisher Signal period, by default 1 - Returns - ------- - CommandOutput[List[Data]] - List of data with the indicator applied. + Returns + ------- + CommandOutput[List[Data]] + List of data with the indicator applied. - Examples - -------- - >>> from openbb import obb - >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") - >>> fisher_data = obb.ta.fisher(data=stock_data.results, length=14, signal=1) - """ + Examples + -------- + >>> from openbb import obb + >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") + >>> fisher_data = obb.ta.fisher(data=stock_data.results, length=14, signal=1) + """ inputs = filter_inputs( data=data, index=index, @@ -208,37 +237,45 @@ class CLASS_ta(Container): @filter_call @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def adosc(self, data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], index: str = 'date', fast: pydantic.types.PositiveInt = 3, slow: pydantic.types.PositiveInt = 10, offset: int = 0, chart: bool = False) -> CommandOutput[typing.List]: + def adosc( + self, + data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], + index: str = "date", + fast: pydantic.types.PositiveInt = 3, + slow: pydantic.types.PositiveInt = 10, + offset: int = 0, + chart: bool = False, + ) -> CommandOutput[typing.List]: """ - Accumulation/Distribution Oscillator, also known as the Chaikin Oscillator - is essentially a momentum indicator, but of the Accumulation-Distribution line - rather than merely price. It looks at both the strength of price moves and the - underlying buying and selling pressure during a given time period. The oscillator - reading above zero indicates net buying pressure, while one below zero registers - net selling pressure. Divergence between the indicator and pure price moves are - the most common signals from the indicator, and often flag market turning points. + Accumulation/Distribution Oscillator, also known as the Chaikin Oscillator + is essentially a momentum indicator, but of the Accumulation-Distribution line + rather than merely price. It looks at both the strength of price moves and the + underlying buying and selling pressure during a given time period. The oscillator + reading above zero indicates net buying pressure, while one below zero registers + net selling pressure. Divergence between the indicator and pure price moves are + the most common signals from the indicator, and often flag market turning points. - Parameters - ---------- - data : List[Data] - List of data to be used for the calculation. - fast : PositiveInt, optional - Number of periods to be used for the fast calculation, by default 3. - slow : PositiveInt, optional - Number of periods to be used for the slow calculation, by default 10. - offset : int, optional - Offset to be used for the calculation, by default 0. + Parameters + ---------- + data : List[Data] + List of data to be used for the calculation. + fast : PositiveInt, optional + Number of periods to be used for the fast calculation, by default 3. + slow : PositiveInt, optional + Number of periods to be used for the slow calculation, by default 10. + offset : int, optional + Offset to be used for the calculation, by default 0. - Returns - ------- - CommandOutput[List[Data]] + Returns + ------- + CommandOutput[List[Data]] - Examples - -------- - >>> from openbb import obb - >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") - >>> adosc_data = obb.ta.adosc(data=stock_data.results, fast=3, slow=10, offset=0) - """ + Examples + -------- + >>> from openbb import obb + >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") + >>> adosc_data = obb.ta.adosc(data=stock_data.results, fast=3, slow=10, offset=0) + """ inputs = filter_inputs( data=data, index=index, @@ -257,7 +294,9 @@ class CLASS_ta(Container): @filter_call @validate_arguments - def tv(self, chart: bool = False) -> CommandOutput[openbb_core.app.model.results.empty.Empty]: + def tv( + self, chart: bool = False + ) -> CommandOutput[openbb_core.app.model.results.empty.Empty]: """TradingView.""" inputs = filter_inputs( chart=chart, @@ -272,51 +311,61 @@ class CLASS_ta(Container): @filter_call @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def bbands(self, data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], target: str = 'close', index: str = 'date', length: int = 50, std: pydantic.types.NonNegativeFloat = 2, mamode: Literal['sma', 'ema', 'wma', 'rma'] = 'sma', offset: int = 0, chart: bool = False) -> CommandOutput[typing.List]: + def bbands( + self, + data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], + target: str = "close", + index: str = "date", + length: int = 50, + std: pydantic.types.NonNegativeFloat = 2, + mamode: Literal["sma", "ema", "wma", "rma"] = "sma", + offset: int = 0, + chart: bool = False, + ) -> CommandOutput[typing.List]: """ - Bollinger Bands consist of three lines. The middle band is a simple - moving average (generally 20 periods) of the typical price (TP). The upper and lower - bands are F standard deviations (generally 2) above and below the middle band. - The bands widen and narrow when the volatility of the price is higher or lower, - respectively. - -Bollinger Bands do not, in themselves, generate buy or sell signals; - they are an indicator of overbought or oversold conditions. When the price is near the - upper or lower band it indicates that a reversal may be imminent. The middle band - becomes a support or resistance level. The upper and lower bands can also be - interpreted as price targets. When the price bounces off of the lower band and crosses - the middle band, then the upper band becomes the price target. + Bollinger Bands consist of three lines. The middle band is a simple + moving average (generally 20 periods) of the typical price (TP). The upper and lower + bands are F standard deviations (generally 2) above and below the middle band. + The bands widen and narrow when the volatility of the price is higher or lower, + respectively. - Parameters - ---------- - data : List[Data] - List of data to be used for the calculation. - target : str - Target column name. - index : str, optional - Index column name to use with `data`, by default "date". - length : int, optional - Number of periods to be used for the calculation, by default 50. - std : NonNegativeFloat, optional - Standard deviation to be used for the calculation, by default 2. - mamode : Literal["sma", "ema", "wma", "rma"], optional - Moving average mode to be used for the calculation, by default "sma". - offset : int, optional - Offset to be used for the calculation, by default 0. + Bollinger Bands do not, in themselves, generate buy or sell signals; + they are an indicator of overbought or oversold conditions. When the price is near the + upper or lower band it indicates that a reversal may be imminent. The middle band + becomes a support or resistance level. The upper and lower bands can also be + interpreted as price targets. When the price bounces off of the lower band and crosses + the middle band, then the upper band becomes the price target. - Returns - ------- - CommandOutput[List[Data]] - The calculated data. + Parameters + ---------- + data : List[Data] + List of data to be used for the calculation. + target : str + Target column name. + index : str, optional + Index column name to use with `data`, by default "date". + length : int, optional + Number of periods to be used for the calculation, by default 50. + std : NonNegativeFloat, optional + Standard deviation to be used for the calculation, by default 2. + mamode : Literal["sma", "ema", "wma", "rma"], optional + Moving average mode to be used for the calculation, by default "sma". + offset : int, optional + Offset to be used for the calculation, by default 0. - Examples - -------- - >>> from openbb import obb - >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") - >>> bbands = obb.ta.bbands( - >>> data=stock_data.results, target="close", length=50, std=2, mamode="sma", offset=0 - >>> ) - """ + Returns + ------- + CommandOutput[List[Data]] + The calculated data. + + Examples + -------- + >>> from openbb import obb + >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") + >>> bbands = obb.ta.bbands( + >>> data=stock_data.results, target="close", length=50, std=2, mamode="sma", offset=0 + >>> ) + """ inputs = filter_inputs( data=data, target=target, @@ -337,7 +386,9 @@ Bollinger Bands do not, in themselves, generate buy or sell signals; @filter_call @validate_arguments - def multi(self, chart: bool = False) -> CommandOutput[openbb_core.app.model.results.empty.Empty]: + def multi( + self, chart: bool = False + ) -> CommandOutput[openbb_core.app.model.results.empty.Empty]: """Plot multiple indicators on the same chart.""" inputs = filter_inputs( chart=chart, @@ -352,40 +403,48 @@ Bollinger Bands do not, in themselves, generate buy or sell signals; @filter_call @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def zlma(self, data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], target: str = 'close', index: str = 'date', length: int = 50, offset: int = 0, chart: bool = False) -> CommandOutput[typing.List]: + def zlma( + self, + data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], + target: str = "close", + index: str = "date", + length: int = 50, + offset: int = 0, + chart: bool = False, + ) -> CommandOutput[typing.List]: """ - The zero lag exponential moving average (ZLEMA) indicator - was created by John Ehlers and Ric Way. The idea is do a - regular exponential moving average (EMA) calculation but - on a de-lagged data instead of doing it on the regular data. - Data is de-lagged by removing the data from "lag" days ago - thus removing (or attempting to) the cumulative effect of - the moving average. + The zero lag exponential moving average (ZLEMA) indicator + was created by John Ehlers and Ric Way. The idea is do a + regular exponential moving average (EMA) calculation but + on a de-lagged data instead of doing it on the regular data. + Data is de-lagged by removing the data from "lag" days ago + thus removing (or attempting to) the cumulative effect of + the moving average. - Parameters - ---------- - data : List[Data] - List of data to be used for the calculation. - target : str - Target column name. - index : str, optional - Index column name to use with `data`, by default "date". - length : int, optional - Number of periods to be used for the calculation, by default 50. - offset : int, optional - Offset to be used for the calculation, by default 0. + Parameters + ---------- + data : List[Data] + List of data to be used for the calculation. + target : str + Target column name. + index : str, optional + Index column name to use with `data`, by default "date". + length : int, optional + Number of periods to be used for the calculation, by default 50. + offset : int, optional + Offset to be used for the calculation, by default 0. - Returns - ------- - CommandOutput[List[Data]] - The calculated data. + Returns + ------- + CommandOutput[List[Data]] + The calculated data. - Examples - -------- - >>> from openbb import obb - >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") - >>> zlma_data = obb.ta.zlma(data=stock_data.results, target="close", length=50, offset=0) - """ + Examples + -------- + >>> from openbb import obb + >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") + >>> zlma_data = obb.ta.zlma(data=stock_data.results, target="close", length=50, offset=0) + """ inputs = filter_inputs( data=data, target=target, @@ -404,43 +463,50 @@ Bollinger Bands do not, in themselves, generate buy or sell signals; @filter_call @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def aroon(self, data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], index: str = 'date', length: int = 25, scalar: int = 100, chart: bool = False) -> CommandOutput[typing.List]: + def aroon( + self, + data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], + index: str = "date", + length: int = 25, + scalar: int = 100, + chart: bool = False, + ) -> CommandOutput[typing.List]: """ - The word aroon is Sanskrit for "dawn's early light." The Aroon - indicator attempts to show when a new trend is dawning. The indicator consists - of two lines (Up and Down) that measure how long it has been since the highest - high/lowest low has occurred within an n period range. - - When the Aroon Up is - staying between 70 and 100 then it indicates an upward trend. When the Aroon Down - is staying between 70 and 100 then it indicates an downward trend. A strong upward - trend is indicated when the Aroon Up is above 70 while the Aroon Down is below 30. - Likewise, a strong downward trend is indicated when the Aroon Down is above 70 while - the Aroon Up is below 30. Also look for crossovers. When the Aroon Down crosses above - the Aroon Up, it indicates a weakening of the upward trend (and vice versa). + The word aroon is Sanskrit for "dawn's early light." The Aroon + indicator attempts to show when a new trend is dawning. The indicator consists + of two lines (Up and Down) that measure how long it has been since the highest + high/lowest low has occurred within an n period range. - Parameters - ---------- - data : List[Data] - List of data to be used for the calculation. - index: str, optional - Index column name to use with `data`, by default "date". - length : int, optional - Number of periods to be used for the calculation, by default 25. - scalar : int, optional - Scalar to be used for the calculation, by default 100. + When the Aroon Up is + staying between 70 and 100 then it indicates an upward trend. When the Aroon Down + is staying between 70 and 100 then it indicates an downward trend. A strong upward + trend is indicated when the Aroon Up is above 70 while the Aroon Down is below 30. + Likewise, a strong downward trend is indicated when the Aroon Down is above 70 while + the Aroon Up is below 30. Also look for crossovers. When the Aroon Down crosses above + the Aroon Up, it indicates a weakening of the upward trend (and vice versa). - Returns - ------- - CommandOutput[List[Data]] - The calculated data. + Parameters + ---------- + data : List[Data] + List of data to be used for the calculation. + index: str, optional + Index column name to use with `data`, by default "date". + length : int, optional + Number of periods to be used for the calculation, by default 25. + scalar : int, optional + Scalar to be used for the calculation, by default 100. - Examples - -------- - >>> from openbb import obb - >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") - >>> aroon_data = obb.ta.aroon(data=stock_data.results, length=25, scalar=100) - """ + Returns + ------- + CommandOutput[List[Data]] + The calculated data. + + Examples + -------- + >>> from openbb import obb + >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") + >>> aroon_data = obb.ta.aroon(data=stock_data.results, length=25, scalar=100) + """ inputs = filter_inputs( data=data, index=index, @@ -458,40 +524,48 @@ Bollinger Bands do not, in themselves, generate buy or sell signals; @filter_call @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def sma(self, data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], target: str = 'close', index: str = 'date', length: int = 50, offset: int = 0, chart: bool = False) -> CommandOutput[typing.List]: + def sma( + self, + data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], + target: str = "close", + index: str = "date", + length: int = 50, + offset: int = 0, + chart: bool = False, + ) -> CommandOutput[typing.List]: """ - Moving Averages are used to smooth the data in an array to - help eliminate noise and identify trends. The Simple Moving Average is literally - the simplest form of a moving average. Each output value is the average of the - previous n values. In a Simple Moving Average, each value in the time period carries - equal weight, and values outside of the time period are not included in the average. - This makes it less responsive to recent changes in the data, which can be useful for - filtering out those changes. + Moving Averages are used to smooth the data in an array to + help eliminate noise and identify trends. The Simple Moving Average is literally + the simplest form of a moving average. Each output value is the average of the + previous n values. In a Simple Moving Average, each value in the time period carries + equal weight, and values outside of the time period are not included in the average. + This makes it less responsive to recent changes in the data, which can be useful for + filtering out those changes. - Parameters - ---------- - data : List[Data] - List of data to be used for the calculation. - target : str - Target column name. - index : str, optional - Index column name to use with `data`, by default "date". - length : int, optional - Number of periods to be used for the calculation, by default 50. - offset : int, optional - Offset from the current period, by default 0. + Parameters + ---------- + data : List[Data] + List of data to be used for the calculation. + target : str + Target column name. + index : str, optional + Index column name to use with `data`, by default "date". + length : int, optional + Number of periods to be used for the calculation, by default 50. + offset : int, optional + Offset from the current period, by default 0. - Returns - ------- - CommandOutput[List[Data]] - The calculated data. + Returns + ------- + CommandOutput[List[Data]] + The calculated data. - Examples - -------- - >>> from openbb import obb - >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") - >>> sma_data = obb.ta.sma(data=stock_data.results,target="close",length=50,offset=0) - """ + Examples + -------- + >>> from openbb import obb + >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") + >>> sma_data = obb.ta.sma(data=stock_data.results,target="close",length=50,offset=0) + """ inputs = filter_inputs( data=data, target=target, @@ -510,36 +584,45 @@ Bollinger Bands do not, in themselves, generate buy or sell signals; @filter_call @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def demark(self, data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], index: str = 'date', target: str = 'close', show_all: bool = False, asint: bool = False, offset: int = 0, chart: bool = False) -> CommandOutput[typing.List]: + def demark( + self, + data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], + index: str = "date", + target: str = "close", + show_all: bool = False, + asint: bool = False, + offset: int = 0, + chart: bool = False, + ) -> CommandOutput[typing.List]: """ - Demark sequential indicator + Demark sequential indicator - Parameters - ---------- - data : List[Data] - List of data to be used for the calculation. - index : str, optional - Index column name to use with `data`, by default "date". - target : str, optional - Target column name, by default "close". - show_all : bool, optional - Show 1 - 13. If set to False, show 6 - 9 - asint : bool, optional - If True, fill NAs with 0 and change type to int, by default False - offset : int, optional - How many periods to offset the result + Parameters + ---------- + data : List[Data] + List of data to be used for the calculation. + index : str, optional + Index column name to use with `data`, by default "date". + target : str, optional + Target column name, by default "close". + show_all : bool, optional + Show 1 - 13. If set to False, show 6 - 9 + asint : bool, optional + If True, fill NAs with 0 and change type to int, by default False + offset : int, optional + How many periods to offset the result - Returns - ------- - CommandOutput[List[Data]] - The calculated data. + Returns + ------- + CommandOutput[List[Data]] + The calculated data. - Examples - -------- - >>> from openbb import obb - >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") - >>> demark_data = obb.ta.demark(data=stock_data.results,offset=0) - """ + Examples + -------- + >>> from openbb import obb + >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") + >>> demark_data = obb.ta.demark(data=stock_data.results,offset=0) + """ inputs = filter_inputs( data=data, index=index, @@ -559,35 +642,42 @@ Bollinger Bands do not, in themselves, generate buy or sell signals; @filter_call @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def vwap(self, data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], index: str = 'date', anchor: str = 'D', offset: int = 0, chart: bool = False) -> CommandOutput[typing.List]: + def vwap( + self, + data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], + index: str = "date", + anchor: str = "D", + offset: int = 0, + chart: bool = False, + ) -> CommandOutput[typing.List]: """ - The Volume Weighted Average Price that measures the average typical price - by volume. It is typically used with intraday charts to identify general direction. + The Volume Weighted Average Price that measures the average typical price + by volume. It is typically used with intraday charts to identify general direction. - Parameters - ---------- - data : List[Data] - List of data to be used for the calculation. - index : str, optional - Index column name to use with `data`, by default "date". - anchor : str, optional - Anchor period to use for the calculation, by default "D". - See Timeseries Offset Aliases below for additional options: - https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#timeseries-offset-aliases - offset : int, optional - Offset from the current period, by default 0. + Parameters + ---------- + data : List[Data] + List of data to be used for the calculation. + index : str, optional + Index column name to use with `data`, by default "date". + anchor : str, optional + Anchor period to use for the calculation, by default "D". + See Timeseries Offset Aliases below for additional options: + https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#timeseries-offset-aliases + offset : int, optional + Offset from the current period, by default 0. - Returns - ------- - CommandOutput[List[Data]] - The calculated data. + Returns + ------- + CommandOutput[List[Data]] + The calculated data. - Examples - -------- - >>> from openbb import obb - >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") - >>> vwap_data = obb.ta.vwap(data=stock_data.results,anchor="D",offset=0) - """ + Examples + -------- + >>> from openbb import obb + >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") + >>> vwap_data = obb.ta.vwap(data=stock_data.results,anchor="D",offset=0) + """ inputs = filter_inputs( data=data, index=index, @@ -605,7 +695,9 @@ Bollinger Bands do not, in themselves, generate buy or sell signals; @filter_call @validate_arguments - def recom(self, chart: bool = False) -> CommandOutput[openbb_core.app.model.results.empty.Empty]: + def recom( + self, chart: bool = False + ) -> CommandOutput[openbb_core.app.model.results.empty.Empty]: """Recommendation.""" inputs = filter_inputs( chart=chart, @@ -620,44 +712,53 @@ Bollinger Bands do not, in themselves, generate buy or sell signals; @filter_call @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def macd(self, data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], target: str = 'close', index: str = 'date', fast: int = 12, slow: int = 26, signal: int = 9, chart: bool = False) -> CommandOutput[typing.List]: + def macd( + self, + data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], + target: str = "close", + index: str = "date", + fast: int = 12, + slow: int = 26, + signal: int = 9, + chart: bool = False, + ) -> CommandOutput[typing.List]: """ - The Moving Average Convergence Divergence (MACD) is the difference - between two Exponential Moving Averages. The Signal line is an Exponential Moving - Average of the MACD. - - The MACD signals trend changes and indicates the start - of new trend direction. High values indicate overbought conditions, low values - indicate oversold conditions. Divergence with the price indicates an end to the - current trend, especially if the MACD is at extreme high or low values. When the MACD - line crosses above the signal line a buy signal is generated. When the MACD crosses - below the signal line a sell signal is generated. To confirm the signal, the MACD - should be above zero for a buy, and below zero for a sell. + The Moving Average Convergence Divergence (MACD) is the difference + between two Exponential Moving Averages. The Signal line is an Exponential Moving + Average of the MACD. - Parameters - ---------- - data : List[Data] - List of data to be used for the calculation. - target : str - Target column name. - fast : int, optional - Number of periods for the fast EMA, by default 12. - slow : int, optional - Number of periods for the slow EMA, by default 26. - signal : int, optional - Number of periods for the signal EMA, by default 9. + The MACD signals trend changes and indicates the start + of new trend direction. High values indicate overbought conditions, low values + indicate oversold conditions. Divergence with the price indicates an end to the + current trend, especially if the MACD is at extreme high or low values. When the MACD + line crosses above the signal line a buy signal is generated. When the MACD crosses + below the signal line a sell signal is generated. To confirm the signal, the MACD + should be above zero for a buy, and below zero for a sell. - Returns - ------- - CommandOutput[List[Data]] - The calculated data. + Parameters + ---------- + data : List[Data] + List of data to be used for the calculation. + target : str + Target column name. + fast : int, optional + Number of periods for the fast EMA, by default 12. + slow : int, optional + Number of periods for the slow EMA, by default 26. + signal : int, optional + Number of periods for the signal EMA, by default 9. - Examples - -------- - >>> from openbb import obb - >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") - >>> macd_data = obb.ta.macd(data=stock_data.results,target="close",fast=12,slow=26,signal=9) - """ + Returns + ------- + CommandOutput[List[Data]] + The calculated data. + + Examples + -------- + >>> from openbb import obb + >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") + >>> macd_data = obb.ta.macd(data=stock_data.results,target="close",fast=12,slow=26,signal=9) + """ inputs = filter_inputs( data=data, target=target, @@ -677,37 +778,45 @@ Bollinger Bands do not, in themselves, generate buy or sell signals; @filter_call @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def hma(self, data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], target: str = 'close', index: str = 'date', length: int = 50, offset: int = 0, chart: bool = False) -> CommandOutput[typing.List]: + def hma( + self, + data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], + target: str = "close", + index: str = "date", + length: int = 50, + offset: int = 0, + chart: bool = False, + ) -> CommandOutput[typing.List]: """ - The Hull Moving Average solves the age old dilemma of making a moving average - more responsive to current price activity whilst maintaining curve smoothness. - In fact the HMA almost eliminates lag altogether and manages to improve smoothing - at the same time. + The Hull Moving Average solves the age old dilemma of making a moving average + more responsive to current price activity whilst maintaining curve smoothness. + In fact the HMA almost eliminates lag altogether and manages to improve smoothing + at the same time. - Parameters - ---------- - data : List[Data] - List of data to be used for the calculation. - target : str - Target column name. - index : str, optional - Index column name to use with `data`, by default "date". - length : int, optional - Number of periods for the HMA, by default 50. - offset : int, optional - Offset of the HMA, by default 0. + Parameters + ---------- + data : List[Data] + List of data to be used for the calculation. + target : str + Target column name. + index : str, optional + Index column name to use with `data`, by default "date". + length : int, optional + Number of periods for the HMA, by default 50. + offset : int, optional + Offset of the HMA, by default 0. - Returns - ------- - CommandOutput[List[Data]] - The calculated data. + Returns + ------- + CommandOutput[List[Data]] + The calculated data. - Examples - -------- - >>> from openbb import obb - >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") - >>> hma_data = obb.ta.hma(data=stock_data.results,target="close",length=50,offset=0) - """ + Examples + -------- + >>> from openbb import obb + >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") + >>> hma_data = obb.ta.hma(data=stock_data.results,target="close",length=50,offset=0) + """ inputs = filter_inputs( data=data, target=target, @@ -726,39 +835,47 @@ Bollinger Bands do not, in themselves, generate buy or sell signals; @filter_call @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def donchian(self, data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], index: str = 'date', lower_length: pydantic.types.PositiveInt = 20, upper_length: pydantic.types.PositiveInt = 20, offset: int = 0, chart: bool = False) -> CommandOutput[typing.List]: + def donchian( + self, + data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], + index: str = "date", + lower_length: pydantic.types.PositiveInt = 20, + upper_length: pydantic.types.PositiveInt = 20, + offset: int = 0, + chart: bool = False, + ) -> CommandOutput[typing.List]: """ - Donchian Channels are three lines generated by moving average - calculations that comprise an indicator formed by upper and lower - bands around a midrange or median band. The upper band marks the - highest price of a security over N periods while the lower band - marks the lowest price of a security over N periods. The area - between the upper and lower bands represents the Donchian Channel. + Donchian Channels are three lines generated by moving average + calculations that comprise an indicator formed by upper and lower + bands around a midrange or median band. The upper band marks the + highest price of a security over N periods while the lower band + marks the lowest price of a security over N periods. The area + between the upper and lower bands represents the Donchian Channel. - Parameters - ---------- - data : List[Data] - List of data to be used for the calculation. - index : str, optional - Index column name to use with `data`, by default "date". - lower_length : PositiveInt, optional - Number of periods for the lower band, by default 20. - upper_length : PositiveInt, optional - Number of periods for the upper band, by default 20. - offset : int, optional - Offset of the Donchian Channel, by default 0. + Parameters + ---------- + data : List[Data] + List of data to be used for the calculation. + index : str, optional + Index column name to use with `data`, by default "date". + lower_length : PositiveInt, optional + Number of periods for the lower band, by default 20. + upper_length : PositiveInt, optional + Number of periods for the upper band, by default 20. + offset : int, optional + Offset of the Donchian Channel, by default 0. - Returns - ------- - CommandOutput[List[Data]] - The calculated data. + Returns + ------- + CommandOutput[List[Data]] + The calculated data. - Examples - -------- - >>> from openbb import obb - >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") - >>> donchian_data = obb.ta.donchian(data=stock_data.results,lower_length=20,upper_length=20,offset=0) - """ + Examples + -------- + >>> from openbb import obb + >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") + >>> donchian_data = obb.ta.donchian(data=stock_data.results,lower_length=20,upper_length=20,offset=0) + """ inputs = filter_inputs( data=data, index=index, @@ -777,30 +894,40 @@ Bollinger Bands do not, in themselves, generate buy or sell signals; @filter_call @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def ichimoku(self, data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], index: str = 'date', conversion: pydantic.types.PositiveInt = 9, base: pydantic.types.PositiveInt = 26, lagging: pydantic.types.PositiveInt = 52, offset: pydantic.types.PositiveInt = 26, lookahead: bool = False, chart: bool = False) -> CommandOutput[typing.List]: + def ichimoku( + self, + data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], + index: str = "date", + conversion: pydantic.types.PositiveInt = 9, + base: pydantic.types.PositiveInt = 26, + lagging: pydantic.types.PositiveInt = 52, + offset: pydantic.types.PositiveInt = 26, + lookahead: bool = False, + chart: bool = False, + ) -> CommandOutput[typing.List]: """ - The Ichimoku Cloud, also known as Ichimoku Kinko Hyo, is a versatile indicator that - defines support and resistance, identifies trend direction, gauges momentum and provides - trading signals. Ichimoku Kinko Hyo translates into "one look equilibrium chart". With - one look, chartists can identify the trend and look for potential signals within that trend. + The Ichimoku Cloud, also known as Ichimoku Kinko Hyo, is a versatile indicator that + defines support and resistance, identifies trend direction, gauges momentum and provides + trading signals. Ichimoku Kinko Hyo translates into "one look equilibrium chart". With + one look, chartists can identify the trend and look for potential signals within that trend. - Parameters - ---------- - data : List[Data] - List of data to be used for the calculation. - index : str, optional - Index column name to use with `data`, by default "date". - conversion : PositiveInt, optional - Number of periods for the conversion line, by default 9. - base : PositiveInt, optional - Number of periods for the base line, by default 26. - lagging : PositiveInt, optional - Number of periods for the lagging span, by default 52. - offset : PositiveInt, optional - Number of periods for the offset, by default 26. - lookahead : bool, optional - drops the Chikou Span Column to prevent potential data leak - """ + Parameters + ---------- + data : List[Data] + List of data to be used for the calculation. + index : str, optional + Index column name to use with `data`, by default "date". + conversion : PositiveInt, optional + Number of periods for the conversion line, by default 9. + base : PositiveInt, optional + Number of periods for the base line, by default 26. + lagging : PositiveInt, optional + Number of periods for the lagging span, by default 52. + offset : PositiveInt, optional + Number of periods for the offset, by default 26. + lookahead : bool, optional + drops the Chikou Span Column to prevent potential data leak + """ inputs = filter_inputs( data=data, index=index, @@ -821,32 +948,39 @@ Bollinger Bands do not, in themselves, generate buy or sell signals; @filter_call @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def clenow(self, data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], index: str = 'date', target: str = 'adj_close', period: pydantic.types.PositiveInt = 90, chart: bool = False) -> CommandOutput[typing.List]: + def clenow( + self, + data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], + index: str = "date", + target: str = "adj_close", + period: pydantic.types.PositiveInt = 90, + chart: bool = False, + ) -> CommandOutput[typing.List]: """ - Clenow Volatility Adjusted Momentum. + Clenow Volatility Adjusted Momentum. - Parameters - ---------- - data : List[Data] - List of data to be used for the calculation. - index : str, optional - Index column name to use with `data`, by default "date". - target : str, optional - Target column name, by default "adj_close". - period : PositiveInt, optional - Number of periods for the momentum, by default 90. + Parameters + ---------- + data : List[Data] + List of data to be used for the calculation. + index : str, optional + Index column name to use with `data`, by default "date". + target : str, optional + Target column name, by default "adj_close". + period : PositiveInt, optional + Number of periods for the momentum, by default 90. - Returns - ------- - CommandOutput[List[Data]] - The calculated data. + Returns + ------- + CommandOutput[List[Data]] + The calculated data. - Examples - -------- - >>> from openbb import obb - >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") - >>> clenow_data = obb.ta.clenow(data=stock_data.results,period=90) - """ + Examples + -------- + >>> from openbb import obb + >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") + >>> clenow_data = obb.ta.clenow(data=stock_data.results,period=90) + """ inputs = filter_inputs( data=data, index=index, @@ -864,40 +998,46 @@ Bollinger Bands do not, in themselves, generate buy or sell signals; @filter_call @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def ad(self, data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], index: str = 'date', offset: int = 0, chart: bool = False) -> CommandOutput[typing.List]: + def ad( + self, + data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], + index: str = "date", + offset: int = 0, + chart: bool = False, + ) -> CommandOutput[typing.List]: """ - The Accumulation/Distribution Line is similar to the On Balance - Volume (OBV), which sums the volume times +1/-1 based on whether the close is - higher than the previous close. The Accumulation/Distribution indicator, however - multiplies the volume by the close location value (CLV). The CLV is based on the - movement of the issue within a single bar and can be +1, -1 or zero. - + The Accumulation/Distribution Line is similar to the On Balance + Volume (OBV), which sums the volume times +1/-1 based on whether the close is + higher than the previous close. The Accumulation/Distribution indicator, however + multiplies the volume by the close location value (CLV). The CLV is based on the + movement of the issue within a single bar and can be +1, -1 or zero. - The Accumulation/Distribution Line is interpreted by looking for a divergence in - the direction of the indicator relative to price. If the Accumulation/Distribution - Line is trending upward it indicates that the price may follow. Also, if the - Accumulation/Distribution Line becomes flat while the price is still rising (or falling) - then it signals an impending flattening of the price. - Parameters - ---------- - data : List[Data] - List of data to be used for the calculation. - index : str, optional - Index column name to use with `data`, by default "date". - offset : int, optional - Offset of the AD, by default 0. + The Accumulation/Distribution Line is interpreted by looking for a divergence in + the direction of the indicator relative to price. If the Accumulation/Distribution + Line is trending upward it indicates that the price may follow. Also, if the + Accumulation/Distribution Line becomes flat while the price is still rising (or falling) + then it signals an impending flattening of the price. - Returns - ------- - CommandOutput[List[Data]] + Parameters + ---------- + data : List[Data] + List of data to be used for the calculation. + index : str, optional + Index column name to use with `data`, by default "date". + offset : int, optional + Offset of the AD, by default 0. - Examples - -------- - >>> from openbb import obb - >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") - >>> ad_data = obb.ta.ad(data=stock_data.results,offset=0) - """ + Returns + ------- + CommandOutput[List[Data]] + + Examples + -------- + >>> from openbb import obb + >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") + >>> ad_data = obb.ta.ad(data=stock_data.results,offset=0) + """ inputs = filter_inputs( data=data, index=index, @@ -914,36 +1054,44 @@ Bollinger Bands do not, in themselves, generate buy or sell signals; @filter_call @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def adx(self, data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], index: str = 'date', length: int = 50, scalar: float = 100.0, drift: int = 1, chart: bool = False) -> CommandOutput[typing.List]: + def adx( + self, + data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], + index: str = "date", + length: int = 50, + scalar: float = 100.0, + drift: int = 1, + chart: bool = False, + ) -> CommandOutput[typing.List]: """ - The ADX is a Welles Wilder style moving average of the Directional Movement Index (DX). - The values range from 0 to 100, but rarely get above 60. To interpret the ADX, consider - a high number to be a strong trend, and a low number, a weak trend. + The ADX is a Welles Wilder style moving average of the Directional Movement Index (DX). + The values range from 0 to 100, but rarely get above 60. To interpret the ADX, consider + a high number to be a strong trend, and a low number, a weak trend. - Parameters - ---------- - data : List[Data] - List of data to be used for the calculation. - index : str, optional - Index column name to use with `data`, by default "date". - length : int, optional - Number of periods for the ADX, by default 50. - scalar : float, optional - Scalar value for the ADX, by default 100.0. - drift : int, optional - Drift value for the ADX, by default 1. + Parameters + ---------- + data : List[Data] + List of data to be used for the calculation. + index : str, optional + Index column name to use with `data`, by default "date". + length : int, optional + Number of periods for the ADX, by default 50. + scalar : float, optional + Scalar value for the ADX, by default 100.0. + drift : int, optional + Drift value for the ADX, by default 1. - Returns - ------- - CommandOutput[List[Data]] - The calculated data. + Returns + ------- + CommandOutput[List[Data]] + The calculated data. - Examples - -------- - >>> from openbb import obb - >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") - >>> adx_data = obb.ta.adx(data=stock_data.results,length=50,scalar=100.0,drift=1) - """ + Examples + -------- + >>> from openbb import obb + >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") + >>> adx_data = obb.ta.adx(data=stock_data.results,length=50,scalar=100.0,drift=1) + """ inputs = filter_inputs( data=data, index=index, @@ -962,37 +1110,45 @@ Bollinger Bands do not, in themselves, generate buy or sell signals; @filter_call @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def wma(self, data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], target: str = 'close', index: str = 'date', length: int = 50, offset: int = 0, chart: bool = False) -> CommandOutput[typing.List]: + def wma( + self, + data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], + target: str = "close", + index: str = "date", + length: int = 50, + offset: int = 0, + chart: bool = False, + ) -> CommandOutput[typing.List]: """ - A Weighted Moving Average puts more weight on recent data and less on past data. - This is done by multiplying each bar’s price by a weighting factor. Because of its - unique calculation, WMA will follow prices more closely than a corresponding Simple - Moving Average. + A Weighted Moving Average puts more weight on recent data and less on past data. + This is done by multiplying each bar’s price by a weighting factor. Because of its + unique calculation, WMA will follow prices more closely than a corresponding Simple + Moving Average. - Parameters - ---------- - data : List[Data] - The data to use for the calculation. - target : str - Target column name. - index : str, optional - Index column name to use with `data`, by default "date". - length : int, optional - The length of the WMA, by default 50. - offset : int, optional - The offset of the WMA, by default 0. + Parameters + ---------- + data : List[Data] + The data to use for the calculation. + target : str + Target column name. + index : str, optional + Index column name to use with `data`, by default "date". + length : int, optional + The length of the WMA, by default 50. + offset : int, optional + The offset of the WMA, by default 0. - Returns - ------- - CommandOutput[List[Data]] - The WMA data. + Returns + ------- + CommandOutput[List[Data]] + The WMA data. - Examples - -------- - >>> from openbb import obb - >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") - >>> wma_data = obb.ta.wma(data=stock_data.results, target="close", length=50, offset=0) - """ + Examples + -------- + >>> from openbb import obb + >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") + >>> wma_data = obb.ta.wma(data=stock_data.results, target="close", length=50, offset=0) + """ inputs = filter_inputs( data=data, target=target, @@ -1011,30 +1167,37 @@ Bollinger Bands do not, in themselves, generate buy or sell signals; @filter_call @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def cci(self, data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], index: str = 'date', length: pydantic.types.PositiveInt = 14, scalar: pydantic.types.PositiveFloat = 0.015, chart: bool = False) -> CommandOutput[typing.List]: + def cci( + self, + data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], + index: str = "date", + length: pydantic.types.PositiveInt = 14, + scalar: pydantic.types.PositiveFloat = 0.015, + chart: bool = False, + ) -> CommandOutput[typing.List]: """ - The CCI is designed to detect beginning and ending market trends. - The range of 100 to -100 is the normal trading range. CCI values outside of this - range indicate overbought or oversold conditions. You can also look for price - divergence in the CCI. If the price is making new highs, and the CCI is not, - then a price correction is likely. + The CCI is designed to detect beginning and ending market trends. + The range of 100 to -100 is the normal trading range. CCI values outside of this + range indicate overbought or oversold conditions. You can also look for price + divergence in the CCI. If the price is making new highs, and the CCI is not, + then a price correction is likely. - Parameters - ---------- - data : List[Data] - The data to use for the CCI calculation. - index : str, optional - Index column name to use with `data`, by default "date". - length : PositiveInt, optional - The length of the CCI, by default 14. - scalar : PositiveFloat, optional - The scalar of the CCI, by default 0.015. + Parameters + ---------- + data : List[Data] + The data to use for the CCI calculation. + index : str, optional + Index column name to use with `data`, by default "date". + length : PositiveInt, optional + The length of the CCI, by default 14. + scalar : PositiveFloat, optional + The scalar of the CCI, by default 0.015. - Returns - ------- - CommandOutput[List[Data]] - The CCI data. - """ + Returns + ------- + CommandOutput[List[Data]] + The CCI data. + """ inputs = filter_inputs( data=data, index=index, @@ -1052,40 +1215,49 @@ Bollinger Bands do not, in themselves, generate buy or sell signals; @filter_call @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def rsi(self, data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], target: str = 'close', index: str = 'date', length: int = 14, scalar: float = 100.0, drift: int = 1, chart: bool = False) -> CommandOutput[typing.List]: + def rsi( + self, + data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], + target: str = "close", + index: str = "date", + length: int = 14, + scalar: float = 100.0, + drift: int = 1, + chart: bool = False, + ) -> CommandOutput[typing.List]: """ - The Relative Strength Index (RSI) calculates a ratio of the - recent upward price movements to the absolute price movement. The RSI ranges - from 0 to 100. The RSI is interpreted as an overbought/oversold indicator when - the value is over 70/below 30. You can also look for divergence with price. If - the price is making new highs/lows, and the RSI is not, it indicates a reversal. + The Relative Strength Index (RSI) calculates a ratio of the + recent upward price movements to the absolute price movement. The RSI ranges + from 0 to 100. The RSI is interpreted as an overbought/oversold indicator when + the value is over 70/below 30. You can also look for divergence with price. If + the price is making new highs/lows, and the RSI is not, it indicates a reversal. - Parameters - ---------- - data : List[Data] - The data to use for the RSI calculation. - target : str - Target column name. - index : str, optional - Index column name to use with `data`, by default "date" - length : int, optional - The length of the RSI, by default 14 - scalar : float, optional - The scalar to use for the RSI, by default 100.0 - drift : int, optional - The drift to use for the RSI, by default 1 + Parameters + ---------- + data : List[Data] + The data to use for the RSI calculation. + target : str + Target column name. + index : str, optional + Index column name to use with `data`, by default "date" + length : int, optional + The length of the RSI, by default 14 + scalar : float, optional + The scalar to use for the RSI, by default 100.0 + drift : int, optional + The drift to use for the RSI, by default 1 - Returns - ------- - CommandOutput[List[Data]] - The RSI data. + Returns + ------- + CommandOutput[List[Data]] + The RSI data. - Examples - -------- - >>> from openbb import obb - >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") - >>> rsi_data = obb.ta.rsi(data=stock_data.results, target="close", length=14, scalar=100.0, drift=1) - """ + Examples + -------- + >>> from openbb import obb + >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") + >>> rsi_data = obb.ta.rsi(data=stock_data.results, target="close", length=14, scalar=100.0, drift=1) + """ inputs = filter_inputs( data=data, target=target, @@ -1105,7 +1277,9 @@ Bollinger Bands do not, in themselves, generate buy or sell signals; @filter_call @validate_arguments - def summary(self, chart: bool = False) -> CommandOutput[openbb_core.app.model.results.empty.Empty]: + def summary( + self, chart: bool = False + ) -> CommandOutput[openbb_core.app.model.results.empty.Empty]: """Summary.""" inputs = filter_inputs( chart=chart, @@ -1120,39 +1294,47 @@ Bollinger Bands do not, in themselves, generate buy or sell signals; @filter_call @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def stoch(self, data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], index: str = 'date', fast_k_period: pydantic.types.NonNegativeInt = 14, slow_d_period: pydantic.types.NonNegativeInt = 3, slow_k_period: pydantic.types.NonNegativeInt = 3, chart: bool = False) -> CommandOutput[typing.List]: + def stoch( + self, + data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], + index: str = "date", + fast_k_period: pydantic.types.NonNegativeInt = 14, + slow_d_period: pydantic.types.NonNegativeInt = 3, + slow_k_period: pydantic.types.NonNegativeInt = 3, + chart: bool = False, + ) -> CommandOutput[typing.List]: """ - The Stochastic Oscillator measures where the close is in relation - to the recent trading range. The values range from zero to 100. %D values over 75 - indicate an overbought condition; values under 25 indicate an oversold condition. - When the Fast %D crosses above the Slow %D, it is a buy signal; when it crosses - below, it is a sell signal. The Raw %K is generally considered too erratic to use - for crossover signals. + The Stochastic Oscillator measures where the close is in relation + to the recent trading range. The values range from zero to 100. %D values over 75 + indicate an overbought condition; values under 25 indicate an oversold condition. + When the Fast %D crosses above the Slow %D, it is a buy signal; when it crosses + below, it is a sell signal. The Raw %K is generally considered too erratic to use + for crossover signals. - Parameters - ---------- - data : List[Data] - The data to use for the Stochastic Oscillator calculation. - index : str, optional - Index column name to use with `data`, by default "date". - fast_k_period : NonNegativeInt, optional - The fast %K period, by default 14. - slow_d_period : NonNegativeInt, optional - The slow %D period, by default 3. - slow_k_period : NonNegativeInt, optional - The slow %K period, by default 3. + Parameters + ---------- + data : List[Data] + The data to use for the Stochastic Oscillator calculation. + index : str, optional + Index column name to use with `data`, by default "date". + fast_k_period : NonNegativeInt, optional + The fast %K period, by default 14. + slow_d_period : NonNegativeInt, optional + The slow %D period, by default 3. + slow_k_period : NonNegativeInt, optional + The slow %K period, by default 3. - Returns - ------- - CommandOutput[List[Data]] - The Stochastic Oscillator data. + Returns + ------- + CommandOutput[List[Data]] + The Stochastic Oscillator data. - Examples - -------- - >>> from openbb import obb - >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") - >>> stoch_data = obb.ta.stoch(data=stock_data.results, fast_k_period=14, slow_d_period=3, slow_k_period=3) - """ + Examples + -------- + >>> from openbb import obb + >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") + >>> stoch_data = obb.ta.stoch(data=stock_data.results, fast_k_period=14, slow_d_period=3, slow_k_period=3) + """ inputs = filter_inputs( data=data, index=index, @@ -1171,7 +1353,9 @@ Bollinger Bands do not, in themselves, generate buy or sell signals; @filter_call @validate_arguments - def rsp(self, chart: bool = False) -> CommandOutput[openbb_core.app.model.results.empty.Empty]: + def rsp( + self, chart: bool = False + ) -> CommandOutput[openbb_core.app.model.results.empty.Empty]: """Relative Strength Performance.""" inputs = filter_inputs( chart=chart, @@ -1186,40 +1370,49 @@ Bollinger Bands do not, in themselves, generate buy or sell signals; @filter_call @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def kc(self, data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], index: str = 'date', length: pydantic.types.PositiveInt = 20, scalar: pydantic.types.PositiveFloat = 20, mamode: Literal['ema', 'sma', 'wma', 'hma', 'zlma'] = 'ema', offset: pydantic.types.NonNegativeInt = 0, chart: bool = False) -> CommandOutput[typing.List]: + def kc( + self, + data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], + index: str = "date", + length: pydantic.types.PositiveInt = 20, + scalar: pydantic.types.PositiveFloat = 20, + mamode: Literal["ema", "sma", "wma", "hma", "zlma"] = "ema", + offset: pydantic.types.NonNegativeInt = 0, + chart: bool = False, + ) -> CommandOutput[typing.List]: """ - Keltner Channels are volatility-based bands that are placed - on either side of an asset's price and can aid in determining - the direction of a trend.The Keltner channel uses the average - true range (ATR) or volatility, with breaks above or below the top - and bottom barriers signaling a continuation. + Keltner Channels are volatility-based bands that are placed + on either side of an asset's price and can aid in determining + the direction of a trend.The Keltner channel uses the average + true range (ATR) or volatility, with breaks above or below the top + and bottom barriers signaling a continuation. - Parameters - ---------- - data : List[Data] - The data to use for the Keltner Channels calculation. - index : str, optional - Index column name to use with `data`, by default "date" - length : PositiveInt, optional - The length of the Keltner Channels, by default 20 - scalar : PositiveFloat, optional - The scalar to use for the Keltner Channels, by default 20 - mamode : Literal["ema", "sma", "wma", "hma", "zlma"], optional - The moving average mode to use for the Keltner Channels, by default "ema" - offset : NonNegativeInt, optional - The offset to use for the Keltner Channels, by default 0 + Parameters + ---------- + data : List[Data] + The data to use for the Keltner Channels calculation. + index : str, optional + Index column name to use with `data`, by default "date" + length : PositiveInt, optional + The length of the Keltner Channels, by default 20 + scalar : PositiveFloat, optional + The scalar to use for the Keltner Channels, by default 20 + mamode : Literal["ema", "sma", "wma", "hma", "zlma"], optional + The moving average mode to use for the Keltner Channels, by default "ema" + offset : NonNegativeInt, optional + The offset to use for the Keltner Channels, by default 0 - Returns - ------- - CommandOutput[List[Data]] - The Keltner Channels data. + Returns + ------- + CommandOutput[List[Data]] + The Keltner Channels data. - Examples - -------- - >>> from openbb import obb - >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") - >>> kc_data = obb.ta.kc(data=stock_data.results, length=20, scalar=20, ma_mode="ema", offset=0) - """ + Examples + -------- + >>> from openbb import obb + >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") + >>> kc_data = obb.ta.kc(data=stock_data.results, length=20, scalar=20, ma_mode="ema", offset=0) + """ inputs = filter_inputs( data=data, index=index, @@ -1239,34 +1432,40 @@ Bollinger Bands do not, in themselves, generate buy or sell signals; @filter_call @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def cg(self, data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], index: str = 'date', length: pydantic.types.PositiveInt = 14, chart: bool = False) -> CommandOutput[typing.List]: + def cg( + self, + data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], + index: str = "date", + length: pydantic.types.PositiveInt = 14, + chart: bool = False, + ) -> CommandOutput[typing.List]: """ - The Center of Gravity indicator, in short, is used to anticipate future price movements - and to trade on price reversals as soon as they happen. However, just like other oscillators, - the COG indicator returns the best results in range-bound markets and should be avoided when - the price is trending. Traders who use it will be able to closely speculate the upcoming - price change of the asset. + The Center of Gravity indicator, in short, is used to anticipate future price movements + and to trade on price reversals as soon as they happen. However, just like other oscillators, + the COG indicator returns the best results in range-bound markets and should be avoided when + the price is trending. Traders who use it will be able to closely speculate the upcoming + price change of the asset. - Parameters - ---------- - data : List[Data] - The data to use for the COG calculation. - index : str, optional - Index column name to use with `data`, by default "date" - length : PositiveInt, optional - The length of the COG, by default 14 + Parameters + ---------- + data : List[Data] + The data to use for the COG calculation. + index : str, optional + Index column name to use with `data`, by default "date" + length : PositiveInt, optional + The length of the COG, by default 14 - Returns - ------- - CommandOutput[List[Data]] - The COG data. + Returns + ------- + CommandOutput[List[Data]] + The COG data. - Examples - -------- - >>> from openbb import obb - >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") - >>> cg_data = obb.ta.cg(data=stock_data.results, length=14) - """ + Examples + -------- + >>> from openbb import obb + >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") + >>> cg_data = obb.ta.cg(data=stock_data.results, length=14) + """ inputs = filter_inputs( data=data, index=index, @@ -1283,57 +1482,73 @@ Bollinger Bands do not, in themselves, generate buy or sell signals; @filter_call @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def cones(self, data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], index: str = 'date', lower_q: float = 0.25, upper_q: float = 0.75, model: Literal['STD', 'Parkinson', 'Garman-Klass', 'Hodges-Tompkins', 'Rogers-Satchell', 'Yang-Zhang'] = 'STD', is_crypto: bool = False, chart: bool = False) -> CommandOutput[typing.List]: + def cones( + self, + data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], + index: str = "date", + lower_q: float = 0.25, + upper_q: float = 0.75, + model: Literal[ + "STD", + "Parkinson", + "Garman-Klass", + "Hodges-Tompkins", + "Rogers-Satchell", + "Yang-Zhang", + ] = "STD", + is_crypto: bool = False, + chart: bool = False, + ) -> CommandOutput[typing.List]: """Calculate the realized volatility quantiles over rolling windows of time. - The model for calculating volatility is selectable. + The model for calculating volatility is selectable. - Parameters - ---------- - data : List[Data] - The data to use for the calculation. - index : str, optional - Index column name to use with `data`, by default "date" - lower_q : float, optional - The lower quantile value for calculations - upper_q : float, optional - The upper quantile value for calculations - model : Literal["STD", "Parkinson", "Garman-Klass", "Hodges-Tompkins", "Rogers-Satchell", "Yang-Zhang"], optional - The model used to calculate realized volatility + Parameters + ---------- + data : List[Data] + The data to use for the calculation. + index : str, optional + Index column name to use with `data`, by default "date" + lower_q : float, optional + The lower quantile value for calculations + upper_q : float, optional + The upper quantile value for calculations + model : Literal["STD", "Parkinson", "Garman-Klass", "Hodges-Tompkins", "Rogers-Satchell", "Yang-Zhang"], optional + The model used to calculate realized volatility - Standard deviation measures how widely returns are dispersed from the average return. - It is the most common (and biased) estimator of volatility. + Standard deviation measures how widely returns are dispersed from the average return. + It is the most common (and biased) estimator of volatility. - Parkinson volatility uses the high and low price of the day rather than just close to close prices. - It is useful for capturing large price movements during the day. + Parkinson volatility uses the high and low price of the day rather than just close to close prices. + It is useful for capturing large price movements during the day. - Garman-Klass volatility extends Parkinson volatility by taking into account the opening and closing price. - As markets are most active during the opening and closing of a trading session; - it makes volatility estimation more accurate. + Garman-Klass volatility extends Parkinson volatility by taking into account the opening and closing price. + As markets are most active during the opening and closing of a trading session; + it makes volatility estimation more accurate. - Hodges-Tompkins volatility is a bias correction for estimation using an overlapping data sample. - It produces unbiased estimates and a substantial gain in efficiency. + Hodges-Tompkins volatility is a bias correction for estimation using an overlapping data sample. + It produces unbiased estimates and a substantial gain in efficiency. - Rogers-Satchell is an estimator for measuring the volatility with an average return not equal to zero. - Unlike Parkinson and Garman-Klass estimators, Rogers-Satchell incorporates a drift term, - mean return not equal to zero. + Rogers-Satchell is an estimator for measuring the volatility with an average return not equal to zero. + Unlike Parkinson and Garman-Klass estimators, Rogers-Satchell incorporates a drift term, + mean return not equal to zero. - Yang-Zhang volatility is the combination of the overnight (close-to-open volatility). - It is a weighted average of the Rogers-Satchell volatility and the open-to-close volatility. - is_crypto : bool, optional - Whether the data is crypto or not. If True, volatility is calculated for 365 days instead of 252 + Yang-Zhang volatility is the combination of the overnight (close-to-open volatility). + It is a weighted average of the Rogers-Satchell volatility and the open-to-close volatility. + is_crypto : bool, optional + Whether the data is crypto or not. If True, volatility is calculated for 365 days instead of 252 - Returns - ------- - CommandOutput[List[Data]] - The cones data. + Returns + ------- + CommandOutput[List[Data]] + The cones data. - Examples - -------- - >>> from openbb import obb - >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") - >>> cones_data = obb.ta.cones(data=stock_data.results, lower_q=0.25, upper_q=0.75, model="STD") - """ + Examples + -------- + >>> from openbb import obb + >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") + >>> cones_data = obb.ta.cones(data=stock_data.results, lower_q=0.25, upper_q=0.75, model="STD") + """ inputs = filter_inputs( data=data, index=index, @@ -1353,42 +1568,50 @@ Bollinger Bands do not, in themselves, generate buy or sell signals; @filter_call @validate_arguments(config=dict(arbitrary_types_allowed=True)) - def ema(self, data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], target: str = 'close', index: str = 'date', length: int = 50, offset: int = 0, chart: bool = False) -> CommandOutput[typing.List]: + def ema( + self, + data: Union[List[openbb_provider.abstract.data.Data], pandas.DataFrame], + target: str = "close", + index: str = "date", + length: int = 50, + offset: int = 0, + chart: bool = False, + ) -> CommandOutput[typing.List]: """ - The Exponential Moving Average is a staple of technical - analysis and is used in countless technical indicators. In a Simple Moving - Average, each value in the time period carries equal weight, and values outside - of the time period are not included in the average. However, the Exponential - Moving Average is a cumulative calculation, including all data. Past values have - a diminishing contribution to the average, while more recent values have a greater - contribution. This method allows the moving average to be more responsive to changes - in the data. + The Exponential Moving Average is a staple of technical + analysis and is used in countless technical indicators. In a Simple Moving + Average, each value in the time period carries equal weight, and values outside + of the time period are not included in the average. However, the Exponential + Moving Average is a cumulative calculation, including all data. Past values have + a diminishing contribution to the average, while more recent values have a greater + contribution. This method allows the moving average to be more responsive to changes + in the data. - Parameters - ---------- - data : List[Data] - The data to use for the calculation. - target : str - Target column name. - index : str, optional - Index column name to use with `data`, by default "date" - length : int, optional - The length of the calculation, by default 50. - offset : int, optional - The offset of the calculation, by default 0. + Parameters + ---------- + data : List[Data] + The data to use for the calculation. + target : str + Target column name. + index : str, optional + Index column name to use with `data`, by default "date" + length : int, optional + The length of the calculation, by default 50. + offset : int, optional + The offset of the calculation, by default 0. - Returns - ------- - CommandOutput[List[Data]] - The calculated data. + Returns + ------- + CommandOutput[List[Data]] + The calculated data. - Examples - -------- - >>> from openbb import obb - >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") - >>> ema_data = obb.ta.ema(data=stock_data.results,target="close",length=50,offset=0) + Examples + -------- + >>> from openbb import obb + >>> stock_data = obb.stocks.load(symbol="TSLA", start_date="2023-01-01", provider="fmp") + >>> ema_data = obb.ta.ema(data=stock_data.results,target="close",length=50,offset=0) - """ + """ inputs = filter_inputs( data=data, target=target, diff --git a/openbb_sdk/sdk/core/openbb_core/app/static/package_builder.py b/openbb_sdk/sdk/core/openbb_core/app/static/package_builder.py index de7e34f1952..bd32af3258a 100644 --- a/openbb_sdk/sdk/core/openbb_core/app/static/package_builder.py +++ b/openbb_sdk/sdk/core/openbb_core/app/static/package_builder.py @@ -21,8 +21,9 @@ from typing import ( import pandas as pd from pydantic.fields import ModelField from starlette.routing import BaseRoute -from typing_extensions import _AnnotatedAlias +from typing_extensions import Annotated, _AnnotatedAlias +from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.provider_interface import get_provider_interface from openbb_core.app.router import RouterLoader @@ -179,6 +180,9 @@ class ImportDefinition: hint_type_list = cls.get_path_hint_type_list(path=path) code = "\nfrom openbb_core.app.static.container import Container" code += "\nfrom openbb_core.app.model.command_output import CommandOutput" + code += ( + "\nfrom openbb_core.app.model.custom_parameter import OpenBBCustomParameter" + ) # These imports were not detected before build, so we add them manually and # ruff --fix the resulting code to remove unused imports. @@ -189,7 +193,7 @@ class ImportDefinition: code += "\nimport pydantic" code += "\nfrom pydantic import validate_arguments" code += "\nfrom inspect import Parameter" - code += "\nfrom typing import List, Dict, Union, Optional, Literal" + code += "\nfrom typing import List, Dict, Union, Optional, Literal, Annotated" code += "\nfrom openbb_core.app.utils import df_to_basemodel" code += "\nfrom openbb_core.app.static.filters import filter_call, filter_inputs, filter_output\n" @@ -347,6 +351,7 @@ class DocstringGenerator: section_docstring += ( f"{cls.get_available_providers(query_mapping)}" ) + # TODO: How do we know if the model has a chart parameter? elif section_name == "Data": underline = "-" * len(model_name) section_docstring += f"\n{model_name}\n{underline}\n" @@ -366,23 +371,26 @@ class DocstringGenerator: return docstring @classmethod - def generate_command_docstring(cls, func: Callable, model_name: str) -> Callable: + def generate_command_docstring( + cls, func: Callable, model_name: Optional[str] = None + ) -> Callable: """Generate the docstring for the command.""" - provider_interface_mapping = get_provider_interface().map - query_mapping = provider_interface_mapping.get(model_name, None) - if query_mapping: - docstring = func.__doc__ or "" - docstring += "\n\n" + if model_name: + provider_interface_mapping = get_provider_interface().map + query_mapping = provider_interface_mapping.get(model_name, None) + if query_mapping: + docstring = func.__doc__ or "" + docstring += "\n\n" - query_mapping_ordered = cls.reorder_dictionary(query_mapping, "openbb") - docstring = cls.generate_provider_docstrings( - docstring=docstring, - query_mapping=query_mapping_ordered, - model_name=model_name, - provider_interface_mapping=provider_interface_mapping, - ) + query_mapping_ordered = cls.reorder_dictionary(query_mapping, "openbb") + docstring = cls.generate_provider_docstrings( + docstring=docstring, + query_mapping=query_mapping_ordered, + model_name=model_name, + provider_interface_mapping=provider_interface_mapping, + ) - func.__doc__ = docstring + func.__doc__ = docstring return func @@ -453,7 +461,7 @@ class MethodDefinition: @staticmethod def format_params( parameter_map: Dict[str, Parameter] - ) -> "OrderedDict[str, Parameter]": + ) -> OrderedDict[str, Parameter]: """Format the params.""" # These are types we want to expand. # For example, start_date is always a 'date', but we also accept 'str' as input. @@ -517,9 +525,45 @@ class MethodDefinition: return MethodDefinition.reorder_params(params=formatted) @staticmethod - def build_func_params(parameter_map: Dict[str, Parameter]) -> str: - """Build the function parameters.""" + def add_field_descriptions( + od: OrderedDict[str, Parameter], model_name: Optional[str] = None + ) -> OrderedDict[str, Parameter]: + """Add the field description to the param signature.""" + + if model_name: + available_fields = ( + get_provider_interface() + .map[model_name]["openbb"]["QueryParams"]["fields"] + .keys() + ) + + for param, value in od.items(): + if param not in available_fields: + continue + + description = ( + get_provider_interface() + .map[model_name]["openbb"]["QueryParams"]["fields"][param] + .field_info.description + ) + + new_value = value.replace( + annotation=Annotated[ + value.annotation, OpenBBCustomParameter(description=description) + ] + ) + + od[param] = new_value + + @staticmethod + def build_func_params( + parameter_map: Dict[str, Parameter], model_name: Optional[str] = None + ) -> str: od = MethodDefinition.format_params(parameter_map=parameter_map) + MethodDefinition.add_field_descriptions( + od=od, model_name=model_name + ) # this modified `od` in place + func_params = ", ".join(str(param) for param in od.values()) func_params = func_params.replace("NoneType", "None") func_params = func_params.replace( @@ -557,10 +601,12 @@ class MethodDefinition: @staticmethod def build_command_method_signature( - func_name: str, parameter_map: Dict[str, Parameter], return_type: type + func_name: str, + parameter_map: Dict[str, Parameter], + return_type: type, + model_name: Optional[str] = None, ) -> str: - """Build the command method signature.""" - func_params = MethodDefinition.build_func_params(parameter_map) + func_params = MethodDefinition.build_func_params(parameter_map, model_name) func_returns = MethodDefinition.build_func_returns(return_type) code = "\n @filter_call" @@ -619,7 +665,7 @@ class MethodDefinition: @classmethod def build_command_method( - cls, path: str, func: Callable, model_name: Optional[str] + cls, path: str, func: Callable, model_name: Optional[str] = None ) -> str: """Build the command method.""" func_name = func.__name__ @@ -627,15 +673,15 @@ class MethodDefinition: sig = signature(func) parameter_map = dict(sig.parameters) - if model_name: - func = DocstringGenerator.generate_command_docstring( - func=func, model_name=model_name - ) + func = DocstringGenerator.generate_command_docstring( + func=func, model_name=model_name + ) code = cls.build_command_method_signature( func_name=func_name, parameter_map=parameter_map, return_type=sig.return_annotation, + model_name=model_name, ) code += cls.build_command_method_doc(func=func) code += cls.build_command_method_implementation(path=path, func=func) diff --git a/openbb_sdk/sdk/provider/openbb_provider/standard_models/balance_sheet.py b/openbb_sdk/sdk/provider/openbb_provider/standard_models/balance_sheet.py index c5de1bc9813..8093cad0043 100644 --- a/openbb_sdk/sdk/provider/openbb_provider/standard_models/balance_sheet.py +++ b/openbb_sdk/sdk/provider/openbb_provider/standard_models/balance_sheet.py @@ -60,7 +60,9 @@ class BalanceSheetData(Data): description="Accrued income taxes, other deferred revenue" ) short_term_debt: Optional[int] = Field( - description="Short-term borrowings, Long-term debt due within one year, Operating lease obligations due within one year, Finance lease obligations due within one year" + description="Short-term borrowings, Long-term debt due within one year, " + "Operating lease obligations due within one year, " + "Finance lease obligations due within one year" ) current_liabilities: Optional[int] diff --git a/openbb_sdk/sdk/provider/openbb_provider/standard_models/institutional_ownership.py b/openbb_sdk/sdk/provider/openbb_provider/standard_models/institutional_ownership.py index 3aff6ff05ae..0b3aed1e0f3 100644 --- a/openbb_sdk/sdk/provider/openbb_provider/standard_models/institutional_ownership.py +++ b/openbb_sdk/sdk/provider/openbb_provider/standard_models/institutional_ownership.py @@ -91,7 +91,8 @@ class InstitutionalOwnershipData(Data, BaseSymbol): description="Total number of call options contracts traded for Apple Inc. on the previous reporting date." ) total_calls_change: int = Field( - description="Change in the total number of call options contracts traded between the current and previous reporting dates." + description="Change in the total number of call options contracts traded between " + "the current and previous reporting dates." ) total_puts: int = Field( description="Total number of put options contracts traded for Apple Inc. on the specified date." @@ -100,10 +101,12 @@ class InstitutionalOwnershipData(Data, BaseSymbol): description="Total number of put options contracts traded for Apple Inc. on the previous reporting date." ) total_puts_change: int = Field( - description="Change in the total number of put options contracts traded between the current and previous reporting dates." + description="Change in the total number of put " + "options contracts traded between the current and previous reporting dates." ) put_call_ratio: float = Field( - description="The put-call ratio, which is the ratio of the total number of put options to call options traded on the specified date." + description="The put-call ratio, which is the ratio of the total number of " + "put options to call options traded on the specified date." ) last_put_call_ratio: float = Field( description="The put-call ratio on the previous reporting date."