### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ### import datetime from typing import List, Literal, Optional, Union from openbb_core.app.model.custom_parameter import OpenBBCustomParameter from openbb_core.app.model.obbject import OBBject from openbb_core.app.static.container import Container from openbb_core.app.static.decorators import validate as _validate from openbb_core.app.static.filters import filter_inputs from openbb_provider.abstract.data import Data from typing_extensions import Annotated class ROUTER_economy(Container): """/economy available_indices const cpi fred_index index risk """ def __repr__(self) -> str: return self.__doc__ or "" @_validate def available_indices( self, provider: Optional[Literal["fmp"]] = None, **kwargs ) -> OBBject[List[Data]]: """Lists of available indices from a provider. Parameters ---------- provider : Optional[Literal['fmp']] The provider to use for the query, by default None. If None, the provider specified in defaults is selected or 'fmp' if there is no default. Returns ------- OBBject results : List[AvailableIndices] Serializable results. provider : Optional[Literal['fmp']] Provider name. warnings : Optional[List[Warning_]] List of warnings. chart : Optional[Chart] Chart object. extra: Dict[str, Any] Extra info. AvailableIndices ---------------- name : Optional[str] Name of the index. currency : Optional[str] Currency the index is traded in. stock_exchange : Optional[str] Stock exchange where the index is listed. (provider: fmp) exchange_short_name : Optional[str] Short name of the stock exchange where the index is listed. (provider: fmp) """ # noqa: E501 inputs = filter_inputs( provider_choices={ "provider": provider, }, standard_params={}, extra_params=kwargs, ) return self._run( "/economy/available_indices", **inputs, ) @_validate def const( self, index: Annotated[ Literal["nasdaq", "sp500", "dowjones"], OpenBBCustomParameter( description="Index for which we want to fetch the constituents." ), ] = "dowjones", provider: Optional[Literal["fmp"]] = None, **kwargs ) -> OBBject[List[Data]]: """Get the constituents of an index. Parameters ---------- index : Literal['nasdaq', 'sp500', 'dowjones'] Index for which we want to fetch the constituents. provider : Optional[Literal['fmp']] The provider to use for the query, by default None. If None, the provider specified in defaults is selected or 'fmp' if there is no default. Returns ------- OBBject results : List[MajorIndicesConstituents] Serializable results. provider : Optional[Literal['fmp']] Provider name. warnings : Optional[List[Warning_]] List of warnings. chart : Optional[Chart] Chart object. extra: Dict[str, Any] Extra info. MajorIndicesConstituents ------------------------ symbol : str Symbol to get data for. name : str Name of the constituent company in the index. sector : str Sector the constituent company in the index belongs to. sub_sector : Optional[str] Sub-sector the constituent company in the index belongs to. headquarter : Optional[str] Location of the headquarter of the constituent company in the index. date_first_added : Optional[Union[date, str]] Date the constituent company was added to the index. cik : int Central Index Key of the constituent company in the index. founded : Optional[Union[date, str]] Founding year of the constituent company in the index.""" # noqa: E501 inputs = filter_inputs( provider_choices={ "provider": provider, }, standard_params={ "index": index, }, extra_params=kwargs, ) return self._run( "/economy/const", **inputs, ) @_validate def cpi( self, 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: Annotated[ Literal["growth_previous", "growth_same", "index_2015"], OpenBBCustomParameter(description="The data units."), ] = "growth_same", frequency: Annotated[ Literal["monthly", "quarter", "annual"], OpenBBCustomParameter(description="The data time frequency."), ] = "monthly", harmonized: 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, provider: Optional[Literal["fred"]] = None, **kwargs ) -> OBBject[List[Data]]: """CPI. Parameters ---------- countries : List[Literal['australia', 'austria', 'belgium', 'brazil', 'bulgar... The country or countries to get data. units : Literal['growth_previous', 'growth_same', 'index_2015'] The data units. frequency : Literal['monthly', 'quarter', 'annual'] The data time frequency. harmonized : bool Whether you wish to obtain harmonized data. start_date : Optional[datetime.date] Start date of the data, in YYYY-MM-DD format. end_date : Optional[datetime.date] End date of the data, in YYYY-MM-DD format. provider : Optional[Literal['fred']] The provider to use for the query, by default None. If None, the provider specified in defaults is selected or 'fred' if there is no default. Returns ------- OBBject results : List[CPI] Serializable results. provider : Optional[Literal['fred']] Provider name. warnings : Optional[List[Warning_]] List of warnings. chart : Optional[Chart] Chart object. extra: Dict[str, Any] Extra info. CPI --- date : Optional[date] The date of the data. value : Optional[float] CPI value on the date.""" # noqa: E501 inputs = filter_inputs( provider_choices={ "provider": provider, }, standard_params={ "countries": countries, "units": units, "frequency": frequency, "harmonized": harmonized, "start_date": start_date, "end_date": end_date, }, extra_params=kwargs, ) return self._run( "/economy/cpi", **inputs, ) @_validate def fred_index( self, symbol: Annotated[ Union[str, List[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, limit: Annotated[ Optional[int], OpenBBCustomParameter(description="The number of data entries to return."), ] = 100, provider: Optional[Literal["intrinio"]] = None, **kwargs ) -> OBBject[List[Data]]: """Fred Historical. Parameters ---------- symbol : str Symbol to get data for. start_date : Optional[datetime.date] Start date of the data, in YYYY-MM-DD format. end_date : Optional[datetime.date] End date of the data, in YYYY-MM-DD format. limit : Optional[int] The number of data entries to return. provider : Optional[Literal['intrinio']] The provider to use for the query, by default None. If None, the provider specified in defaults is selected or 'intrinio' if there is no default. next_page : Optional[str] Token to get the next page of data from a previous API call. (provider: intrinio) all_pages : Optional[bool] Returns all pages of data from the API call at once. (provider: intrinio) Returns ------- OBBject results : List[FredHistorical] Serializable results. provider : Optional[Literal['intrinio']] Provider name. warnings : Optional[List[Warning_]] List of warnings. chart : Optional[Chart] Chart object. extra: Dict[str, Any] Extra info. FredHistorical -------------- date : date The date of the data. value : Optional[Annotated[float, Gt(gt=0)]] Value of the index.""" # noqa: E501 inputs = filter_inputs( provider_choices={ "provider": provider, }, standard_params={ "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, "start_date": start_date, "end_date": end_date, "limit": limit, }, extra_params=kwargs, ) return self._run( "/economy/fred_index", **inputs, ) @_validate def index( self, symbol: Annotated[ Union[str, List[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, provider: Optional[Literal["fmp", "polygon"]] = None, **kwargs ) -> OBBject[List[Data]]: """Get historical levels for an index. Parameters ---------- symbol : str Symbol to get data for. start_date : Optional[datetime.date] Start date of the data, in YYYY-MM-DD format. end_date : Optional[datetime.date] End date of the data, in YYYY-MM-DD format. provider : Optional[Literal['fmp', 'polygon']] The provider to use for the query, by default None. If None, the provider specified in defaults is selected or 'fmp' if there is no default. timeseries : Optional[Annotated[int, Ge(ge=0)]] Number of days to look back. (provider: fmp) interval : Literal['1min', '5min', '15min', '30min', '1hour', '4hour', '1day'] Data granularity. (provider: fmp) timespan : Literal['minute', 'hour', 'day', 'week', 'month', 'quarter', 'year'] Timespan of the data. (provider: polygon) sort : Literal['asc', 'desc'] Sort order of the data. (provider: polygon) limit : int The number of data entries to return. (provider: polygon) adjusted : bool Whether the data is adjusted. (provider: polygon) multiplier : int Multiplier of the timespan. (provider: polygon) Returns ------- OBBject results : List[MajorIndicesHistorical] Serializable results. provider : Optional[Literal['fmp', 'polygon']] Provider name. warnings : Optional[List[Warning_]] List of warnings. chart : Optional[Chart] Chart object. extra: Dict[str, Any] Extra info. MajorIndicesHistorical ---------------------- date : datetime The date of the data. open : float The open price of the symbol. high : float The high price of the symbol. low : float The low price of the symbol. close : float The close price of the symbol. volume : Optional[int] The volume of the symbol. adj_close : Optional[float] Adjusted Close Price of the symbol. (provider: fmp) unadjusted_volume : Optional[float] Unadjusted volume of the symbol. (provider: fmp) change : Optional[float] Change in the price of the symbol from the previous day. (provider: fmp) change_percent : Optional[float] Change % in the price of the symbol. (provider: fmp) label : Optional[str] Human readable format of the date. (provider: fmp) change_over_time : Optional[float] Change % in the price of the symbol over a period of time. (provider: fmp) transactions : Optional[Annotated[int, Gt(gt=0)]] Number of transactions for the symbol in the time period. (provider: polygon) """ # noqa: E501 inputs = filter_inputs( provider_choices={ "provider": provider, }, standard_params={ "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, "start_date": start_date, "end_date": end_date, }, extra_params=kwargs, ) return self._run( "/economy/index", **inputs, ) @_validate def risk( self, provider: Optional[Literal["fmp"]] = None, **kwargs ) -> OBBject[List[Data]]: """Market Risk Premium. Parameters ---------- provider : Optional[Literal['fmp']] The provider to use for the query, by default None. If None, the provider specified in defaults is selected or 'fmp' if there is no default. Returns ------- OBBject results : List[RiskPremium] Serializable results. provider : Optional[Literal['fmp']] Provider name. warnings : Optional[List[Warning_]] List of warnings. chart : Optional[Chart] Chart object. extra: Dict[str, Any] Extra info. RiskPremium ----------- country : str Market country. continent : Optional[str] Continent of the country. total_equity_risk_premium : Optional[Annotated[float, Gt(gt=0)]] Total equity risk premium for the country. country_risk_premium : Optional[Annotated[float, Ge(ge=0)]] Country-specific risk premium.""" # noqa: E501 inputs = filter_inputs( provider_choices={ "provider": provider, }, standard_params={}, extra_params=kwargs, ) return self._run( "/economy/risk", **inputs, )