From f69868d9658a603d718af2d45101cb96b3184b67 Mon Sep 17 00:00:00 2001 From: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com> Date: Thu, 19 Oct 2023 19:38:15 +0200 Subject: [PATCH] Add tests for provider (#5583) * Add tests for provider * Test standard models * Lint * Fix standard model issues. Co-authored-by: @the-praxs * linting * `symbol` -> `is_symbol` in `economy.index_search` * static --------- Co-authored-by: Pratyush Shukla --- .../economy/integration/test_economy_api.py | 11 +-- .../integration/test_economy_python.py | 11 +-- .../openbb/package/__extensions__.py | 19 +--- openbb_platform/openbb/package/crypto.py | 26 ++---- .../openbb/package/econometrics.py | 21 ++--- openbb_platform/openbb/package/economy.py | 72 +++++++-------- openbb_platform/openbb/package/fixedincome.py | 26 ++---- openbb_platform/openbb/package/forex.py | 26 ++---- openbb_platform/openbb/package/futures.py | 26 ++---- openbb_platform/openbb/package/news.py | 32 +++---- openbb_platform/openbb/package/qa.py | 21 ++--- openbb_platform/openbb/package/stocks.py | 56 ++++++------ openbb_platform/openbb/package/stocks_ca.py | 23 ++--- openbb_platform/openbb/package/stocks_fa.py | 84 ++++++++---------- .../openbb/package/stocks_options.py | 35 +++----- openbb_platform/openbb/package/ta.py | 21 ++--- .../provider/openbb_provider/abstract/data.py | 1 + .../standard_models/analyst_estimates.py | 6 +- .../standard_models/balance_sheet.py | 6 +- .../standard_models/balance_sheet_growth.py | 2 +- .../standard_models/cash_flow.py | 13 +-- .../standard_models/cash_flow_growth.py | 2 +- .../standard_models/company_filings.py | 7 +- .../standard_models/company_overview.py | 4 +- .../standard_models/cot_search.py | 5 +- .../standard_models/crypto_historical.py | 3 +- .../standard_models/dividend_calendar.py | 2 +- .../standard_models/earnings_calendar.py | 2 +- .../earnings_call_transcript.py | 2 +- .../standard_models/economic_calendar.py | 4 +- .../standard_models/esg_risk_rating.py | 4 +- .../standard_models/esg_score.py | 6 +- .../standard_models/etf_countries.py | 3 +- .../standard_models/etf_historical_nav.py | 5 +- .../standard_models/etf_holdings.py | 7 +- .../standard_models/etf_info.py | 5 +- .../standard_models/etf_search.py | 3 +- .../standard_models/etf_sectors.py | 3 +- .../european_index_constituents.py | 5 +- .../standard_models/executive_compensation.py | 4 +- .../standard_models/financial_ratios.py | 6 +- .../standard_models/forex_historical.py | 3 +- .../standard_models/futures_curve.py | 2 +- .../standard_models/gdpforecast.py | 3 +- .../openbb_provider/standard_models/gdpnom.py | 3 +- .../standard_models/gdpreal.py | 7 +- .../standard_models/global_news.py | 10 ++- .../standard_models/historical_dividends.py | 4 +- .../standard_models/historical_employees.py | 4 +- .../standard_models/historical_eps.py | 6 +- .../standard_models/income_statement.py | 9 +- .../income_statement_growth.py | 3 +- .../standard_models/index_constituents.py | 5 +- .../standard_models/index_info.py | 5 +- .../standard_models/index_search.py | 7 +- .../standard_models/index_sectors.py | 3 +- .../standard_models/index_snapshots.py | 15 ++-- .../standard_models/industry_pe.py | 3 +- .../institutional_ownership.py | 2 +- .../standard_models/key_metrics.py | 2 +- .../major_indices_constituents.py | 4 +- .../standard_models/market_movers.py | 3 +- .../standard_models/options_chains.py | 20 +++-- .../standard_models/price_target.py | 4 +- .../standard_models/price_target_consensus.py | 4 +- .../standard_models/recent_performance.py | 3 +- .../standard_models/sector_pe.py | 3 +- .../standard_models/share_statistics.py | 6 +- .../standard_models/sp500_multiples.py | 7 +- .../standard_models/stock_info.py | 14 +-- .../standard_models/stock_insider_trading.py | 4 +- .../standard_models/stock_news.py | 14 ++- .../standard_models/stock_ownership.py | 2 +- .../standard_models/stock_quote.py | 8 +- .../standard_models/stock_search.py | 6 +- .../standard_models/stock_splits.py | 6 +- .../standard_models/us_yield_curve.py | 4 +- .../provider/openbb_provider/utils/helpers.py | 5 +- .../platform/provider/tests/.gitkeep | 0 .../provider/tests/abstract/test_data.py | 43 +++++++++ .../provider/tests/abstract/test_fetcher.py | 68 ++++++++++++++ .../provider/tests/abstract/test_provider.py | 44 ++++++++++ .../tests/abstract/test_query_params.py | 30 +++++++ .../standard_models/test_standard_models.py | 57 ++++++++++++ .../provider/tests/test_query_executor.py | 88 +++++++++++++++++++ .../platform/provider/tests/test_registry.py | 30 +++++++ .../provider/tests/test_registry_map.py | 37 ++++++++ .../provider/tests/utils/test_descriptions.py | 13 +++ .../provider/tests/utils/test_errors.py | 38 ++++++++ .../provider/tests/utils/test_helpers.py | 79 +++++++++++++++++ .../cboe/openbb_cboe/models/index_search.py | 2 +- 91 files changed, 886 insertions(+), 476 deletions(-) delete mode 100644 openbb_platform/platform/provider/tests/.gitkeep create mode 100644 openbb_platform/platform/provider/tests/abstract/test_data.py create mode 100644 openbb_platform/platform/provider/tests/abstract/test_fetcher.py create mode 100644 openbb_platform/platform/provider/tests/abstract/test_provider.py create mode 100644 openbb_platform/platform/provider/tests/abstract/test_query_params.py create mode 100644 openbb_platform/platform/provider/tests/standard_models/test_standard_models.py create mode 100644 openbb_platform/platform/provider/tests/test_query_executor.py create mode 100644 openbb_platform/platform/provider/tests/test_registry.py create mode 100644 openbb_platform/platform/provider/tests/test_registry_map.py create mode 100644 openbb_platform/platform/provider/tests/utils/test_descriptions.py create mode 100644 openbb_platform/platform/provider/tests/utils/test_errors.py create mode 100644 openbb_platform/platform/provider/tests/utils/test_helpers.py diff --git a/openbb_platform/extensions/economy/integration/test_economy_api.py b/openbb_platform/extensions/economy/integration/test_economy_api.py index da5678de5103..b94d4f51fb59 100644 --- a/openbb_platform/extensions/economy/integration/test_economy_api.py +++ b/openbb_platform/extensions/economy/integration/test_economy_api.py @@ -265,15 +265,8 @@ def test_economy_risk(params, headers): @pytest.mark.parametrize( "params", [ - ({"query": "D", "symbol": True, "provider": "cboe"}), - ( - { - "europe": True, - "provider": "cboe", - "query": "A", - "symbol": False, - } - ), + ({"query": "D", "is_symbol": True, "provider": "cboe"}), + ({"europe": True, "provider": "cboe", "query": "A", "is_symbol": False}), ], ) @pytest.mark.integration diff --git a/openbb_platform/extensions/economy/integration/test_economy_python.py b/openbb_platform/extensions/economy/integration/test_economy_python.py index 87db8fc3b7d2..18dd055f4439 100644 --- a/openbb_platform/extensions/economy/integration/test_economy_python.py +++ b/openbb_platform/extensions/economy/integration/test_economy_python.py @@ -236,15 +236,8 @@ def test_economy_risk(params, obb): @pytest.mark.parametrize( "params", [ - ({"query": "D", "symbol": True}), - ( - { - "europe": True, - "provider": "cboe", - "query": "A", - "symbol": False, - } - ), + ({"query": "D", "is_symbol": True}), + ({"europe": True, "provider": "cboe", "query": "A", "is_symbol": False}), ], ) @pytest.mark.integration diff --git a/openbb_platform/openbb/package/__extensions__.py b/openbb_platform/openbb/package/__extensions__.py index ee21b66e8574..792b3378d91d 100644 --- a/openbb_platform/openbb/package/__extensions__.py +++ b/openbb_platform/openbb/package/__extensions__.py @@ -1,24 +1,7 @@ ### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ### + from openbb_core.app.static.container import Container -from openbb_core.app.model.obbject import OBBject -from openbb_core.app.model.custom_parameter import OpenBBCustomParameter -import openbb_provider -import pandas -import datetime -import pydantic -from pydantic import BaseModel -from inspect import Parameter -import typing -from typing import List, Dict, Union, Optional, Literal -from annotated_types import Ge, Le, Gt, Lt -import typing_extensions -from openbb_core.app.utils import df_to_basemodel -from openbb_core.app.static.decorators import validate - -from openbb_core.app.static.filters import filter_inputs - -from openbb_provider.abstract.data import Data class Extensions(Container): diff --git a/openbb_platform/openbb/package/crypto.py b/openbb_platform/openbb/package/crypto.py index 88920352dd48..113b76b6d1e9 100644 --- a/openbb_platform/openbb/package/crypto.py +++ b/openbb_platform/openbb/package/crypto.py @@ -1,27 +1,15 @@ ### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ### -from openbb_core.app.static.container import Container -from openbb_core.app.model.obbject import OBBject -from openbb_core.app.model.custom_parameter import OpenBBCustomParameter -import openbb_provider -import pandas import datetime -import pydantic -from pydantic import BaseModel -from inspect import Parameter -import typing -from typing import List, Dict, Union, Optional, Literal -from annotated_types import Ge, Le, Gt, Lt +from typing import List, Literal, Union + import typing_extensions -from openbb_core.app.utils import df_to_basemodel +from openbb_core.app.model.custom_parameter import OpenBBCustomParameter +from openbb_core.app.model.obbject import OBBject +from openbb_core.app.static.container import Container from openbb_core.app.static.decorators import validate - from openbb_core.app.static.filters import filter_inputs - from openbb_provider.abstract.data import Data -import openbb_core.app.model.command_context -import openbb_core.app.model.obbject -import types class ROUTER_crypto(Container): @@ -38,7 +26,7 @@ def load( symbol: typing_extensions.Annotated[ Union[str, List[str]], OpenBBCustomParameter( - description="Symbol Pair to get data for in CURR1-CURR2 or CURR1CURR2 format." + description="Symbol to get data for. Can use CURR1-CURR2 or CURR1CURR2 format." ), ], start_date: typing_extensions.Annotated[ @@ -61,7 +49,7 @@ def load( Parameters ---------- symbol : str - Symbol Pair to get data for in CURR1-CURR2 or CURR1CURR2 format. + Symbol to get data for. Can use CURR1-CURR2 or CURR1CURR2 format. start_date : Union[datetime.date, None] Start date of the data, in YYYY-MM-DD format. end_date : Union[datetime.date, None] diff --git a/openbb_platform/openbb/package/econometrics.py b/openbb_platform/openbb/package/econometrics.py index 325e6f81bc32..f4a1e9f34227 100644 --- a/openbb_platform/openbb/package/econometrics.py +++ b/openbb_platform/openbb/package/econometrics.py @@ -1,26 +1,15 @@ ### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ### -from openbb_core.app.static.container import Container -from openbb_core.app.model.obbject import OBBject -from openbb_core.app.model.custom_parameter import OpenBBCustomParameter -import openbb_provider +from typing import Dict, List, Literal, Union + import pandas -import datetime -import pydantic -from pydantic import BaseModel -from inspect import Parameter -import typing -from typing import List, Dict, Union, Optional, Literal -from annotated_types import Ge, Le, Gt, Lt import typing_extensions -from openbb_core.app.utils import df_to_basemodel +from annotated_types import Gt +from openbb_core.app.model.obbject import OBBject +from openbb_core.app.static.container import Container from openbb_core.app.static.decorators import validate - from openbb_core.app.static.filters import filter_inputs - from openbb_provider.abstract.data import Data -import openbb_core.app.model.obbject -import typing class ROUTER_econometrics(Container): diff --git a/openbb_platform/openbb/package/economy.py b/openbb_platform/openbb/package/economy.py index 73e964242d06..dd16cd403804 100644 --- a/openbb_platform/openbb/package/economy.py +++ b/openbb_platform/openbb/package/economy.py @@ -1,27 +1,15 @@ ### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ### -from openbb_core.app.static.container import Container -from openbb_core.app.model.obbject import OBBject -from openbb_core.app.model.custom_parameter import OpenBBCustomParameter -import openbb_provider -import pandas import datetime -import pydantic -from pydantic import BaseModel -from inspect import Parameter -import typing -from typing import List, Dict, Union, Optional, Literal -from annotated_types import Ge, Le, Gt, Lt +from typing import List, Literal, Union + import typing_extensions -from openbb_core.app.utils import df_to_basemodel +from openbb_core.app.model.custom_parameter import OpenBBCustomParameter +from openbb_core.app.model.obbject import OBBject +from openbb_core.app.static.container import Container from openbb_core.app.static.decorators import validate - from openbb_core.app.static.filters import filter_inputs - from openbb_provider.abstract.data import Data -import openbb_core.app.model.command_context -import openbb_core.app.model.obbject -import types class ROUTER_economy(Container): @@ -171,7 +159,7 @@ def const( MajorIndicesConstituents ------------------------ symbol : str - Symbol to get data for. + Symbol representing the entity requested in the data. name : str Name of the constituent company in the index. sector : str @@ -356,7 +344,7 @@ def cot_search( units : Optional[Union[str]] The units for one contract. symbol : Optional[Union[str]] - Trading symbol representing the underlying asset. + Symbol representing the entity requested in the data. Example ------- @@ -615,7 +603,7 @@ def econcal( EconomicCalendar ---------------- date : Optional[Union[datetime]] - Date and time of event. + The date of the data. country : Optional[Union[str]] Country of event. category : Optional[Union[str]] @@ -799,7 +787,7 @@ def european_index_constituents( EuropeanIndexConstituents ------------------------- symbol : str - Symbol of the constituent company in the index. + Symbol representing the entity requested in the data. The symbol is the constituent company in the index. price : float Current price of the constituent company in the index. open : float @@ -948,7 +936,7 @@ def gdpforecast( period: typing_extensions.Annotated[ Literal["quarter", "annual"], OpenBBCustomParameter( - description="Units for nominal GDP period. Either quarter or annual." + description="Time period of the data to return. Units for nominal GDP period. Either quarter or annual." ), ] = "annual", start_date: typing_extensions.Annotated[ @@ -977,7 +965,7 @@ def gdpforecast( Parameters ---------- period : Literal['quarter', 'annual'] - Units for nominal GDP period. Either quarter or annual. + Time period of the data to return. Units for nominal GDP period. Either quarter or annual. start_date : Union[datetime.date, None] Start date of the data, in YYYY-MM-DD format. end_date : Union[datetime.date, None] @@ -1042,7 +1030,7 @@ def gdpnom( units: typing_extensions.Annotated[ Literal["usd", "usd_cap"], OpenBBCustomParameter( - description="Units to get nominal GDP in. Either usd or usd_cap indicating per capita." + description="The data units. Units to get nominal GDP in. Either usd or usd_cap indicating per capita." ), ] = "usd", start_date: typing_extensions.Annotated[ @@ -1065,7 +1053,7 @@ def gdpnom( Parameters ---------- units : Literal['usd', 'usd_cap'] - Units to get nominal GDP in. Either usd or usd_cap indicating per capita. + The data units. Units to get nominal GDP in. Either usd or usd_cap indicating per capita. start_date : Union[datetime.date, None] Start date of the data, in YYYY-MM-DD format. end_date : Union[datetime.date, None] @@ -1127,7 +1115,7 @@ def gdpreal( units: typing_extensions.Annotated[ Literal["idx", "qoq", "yoy"], OpenBBCustomParameter( - description="Units to get real GDP in. Either idx (indicating 2015=100), qoq (previous period) or yoy (same period, previous year).)" + description="The data units. Either idx (indicating 2015=100), qoq (previous period) or yoy (same period, previous year).)" ), ] = "yoy", start_date: typing_extensions.Annotated[ @@ -1150,7 +1138,7 @@ def gdpreal( Parameters ---------- units : Literal['idx', 'qoq', 'yoy'] - Units to get real GDP in. Either idx (indicating 2015=100), qoq (previous period) or yoy (same period, previous year).) + The data units. Either idx (indicating 2015=100), qoq (previous period) or yoy (same period, previous year).) start_date : Union[datetime.date, None] Start date of the data, in YYYY-MM-DD format. end_date : Union[datetime.date, None] @@ -1341,8 +1329,8 @@ def index_search( query: typing_extensions.Annotated[ str, OpenBBCustomParameter(description="Search query.") ] = "", - symbol: typing_extensions.Annotated[ - Union[bool, List[str]], + is_symbol: typing_extensions.Annotated[ + bool, OpenBBCustomParameter(description="Whether to search by ticker symbol."), ] = False, provider: Union[Literal["cboe"], None] = None, @@ -1354,7 +1342,7 @@ def index_search( ---------- query : str Search query. - symbol : bool + is_symbol : bool Whether to search by ticker symbol. provider : Union[Literal['cboe'], None] The provider to use for the query, by default None. @@ -1380,7 +1368,7 @@ def index_search( IndexSearch ----------- symbol : str - Symbol of the index. + Symbol representing the entity requested in the data. name : str Name of the index. isin : Optional[Union[str]] @@ -1418,7 +1406,7 @@ def index_search( }, standard_params={ "query": query, - "symbol": ",".join(symbol) if isinstance(symbol, list) else symbol, + "is_symbol": is_symbol, }, extra_params=kwargs, ) @@ -1468,7 +1456,7 @@ def index_snapshots( IndexSnapshots -------------- symbol : str - Symbol of the index. + Symbol representing the entity requested in the data. name : Optional[Union[str]] Name of the index. currency : Optional[Union[str]] @@ -1476,13 +1464,13 @@ def index_snapshots( price : Optional[Union[float]] Current price of the index. open : Optional[Union[float]] - Opening price of the index. + The open price of the symbol. high : Optional[Union[float]] - Highest price of the index. + The high price of the symbol. low : Optional[Union[float]] - Lowest price of the index. + The low price of the symbol. close : Optional[Union[float]] - Closing price of the index. + The close price of the symbol. prev_close : Optional[Union[float]] Previous closing price of the index. change : Optional[Union[float]] @@ -1621,13 +1609,13 @@ def sp500_multiples( start_date: typing_extensions.Annotated[ Union[str, None], OpenBBCustomParameter( - description="The start date of the time series. Format: YYYY-MM-DD" + description="Start date of the data, in YYYY-MM-DD format." ), ] = "", end_date: typing_extensions.Annotated[ Union[str, None], OpenBBCustomParameter( - description="The end date of the time series. Format: YYYY-MM-DD" + description="End date of the data, in YYYY-MM-DD format." ), ] = "", collapse: typing_extensions.Annotated[ @@ -1650,9 +1638,9 @@ def sp500_multiples( series_name : Literal['Shiller PE Ratio by Month', 'Shiller PE Ratio by Year', 'PE Rat... The name of the series. Defaults to 'PE Ratio by Month'. start_date : Union[str, None] - The start date of the time series. Format: YYYY-MM-DD + Start date of the data, in YYYY-MM-DD format. end_date : Union[str, None] - The end date of the time series. Format: YYYY-MM-DD + End date of the data, in YYYY-MM-DD format. collapse : Union[Literal['daily', 'weekly', 'monthly', 'quarterly', 'annual'... Collapse the frequency of the time series. transform : Union[Literal['diff', 'rdiff', 'cumul', 'normalize'], None] @@ -1679,7 +1667,7 @@ def sp500_multiples( SP500Multiples -------------- date : str - The date data for the time series. + The date of the data. value : float The data value for the time series. diff --git a/openbb_platform/openbb/package/fixedincome.py b/openbb_platform/openbb/package/fixedincome.py index 6d495e3563c6..f7ece0001f36 100644 --- a/openbb_platform/openbb/package/fixedincome.py +++ b/openbb_platform/openbb/package/fixedincome.py @@ -1,27 +1,15 @@ ### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ### -from openbb_core.app.static.container import Container -from openbb_core.app.model.obbject import OBBject -from openbb_core.app.model.custom_parameter import OpenBBCustomParameter -import openbb_provider -import pandas import datetime -import pydantic -from pydantic import BaseModel -from inspect import Parameter -import typing -from typing import List, Dict, Union, Optional, Literal -from annotated_types import Ge, Le, Gt, Lt +from typing import List, Literal, Union + import typing_extensions -from openbb_core.app.utils import df_to_basemodel +from openbb_core.app.model.custom_parameter import OpenBBCustomParameter +from openbb_core.app.model.obbject import OBBject +from openbb_core.app.static.container import Container from openbb_core.app.static.decorators import validate - from openbb_core.app.static.filters import filter_inputs - from openbb_provider.abstract.data import Data -import openbb_core.app.model.command_context -import openbb_core.app.model.obbject -import types class ROUTER_fixedincome(Container): @@ -696,7 +684,7 @@ def ycrv( date: typing_extensions.Annotated[ Union[datetime.date, None], OpenBBCustomParameter( - description="Date to get Yield Curve data. Defaults to the most recent FRED entry." + description="A specific date to get data for. Defaults to the most recent FRED entry." ), ] = None, inflation_adjusted: typing_extensions.Annotated[ @@ -711,7 +699,7 @@ def ycrv( Parameters ---------- date : Union[datetime.date, None] - Date to get Yield Curve data. Defaults to the most recent FRED entry. + A specific date to get data for. Defaults to the most recent FRED entry. inflation_adjusted : Union[bool, None] Get inflation adjusted rates. provider : Union[Literal['fred'], None] diff --git a/openbb_platform/openbb/package/forex.py b/openbb_platform/openbb/package/forex.py index fa5f2db81950..0b3adc2c570f 100644 --- a/openbb_platform/openbb/package/forex.py +++ b/openbb_platform/openbb/package/forex.py @@ -1,27 +1,15 @@ ### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ### -from openbb_core.app.static.container import Container -from openbb_core.app.model.obbject import OBBject -from openbb_core.app.model.custom_parameter import OpenBBCustomParameter -import openbb_provider -import pandas import datetime -import pydantic -from pydantic import BaseModel -from inspect import Parameter -import typing -from typing import List, Dict, Union, Optional, Literal -from annotated_types import Ge, Le, Gt, Lt +from typing import List, Literal, Union + import typing_extensions -from openbb_core.app.utils import df_to_basemodel +from openbb_core.app.model.custom_parameter import OpenBBCustomParameter +from openbb_core.app.model.obbject import OBBject +from openbb_core.app.static.container import Container from openbb_core.app.static.decorators import validate - from openbb_core.app.static.filters import filter_inputs - from openbb_provider.abstract.data import Data -import openbb_core.app.model.command_context -import openbb_core.app.model.obbject -import types class ROUTER_forex(Container): @@ -39,7 +27,7 @@ def load( symbol: typing_extensions.Annotated[ Union[str, List[str]], OpenBBCustomParameter( - description="Symbol Pair to get data for in CURR1-CURR2 or CURR1CURR2 format." + description="Symbol to get data for. Can use CURR1-CURR2 or CURR1CURR2 format." ), ], start_date: typing_extensions.Annotated[ @@ -62,7 +50,7 @@ def load( Parameters ---------- symbol : str - Symbol Pair to get data for in CURR1-CURR2 or CURR1CURR2 format. + Symbol to get data for. Can use CURR1-CURR2 or CURR1CURR2 format. start_date : Union[datetime.date, None] Start date of the data, in YYYY-MM-DD format. end_date : Union[datetime.date, None] diff --git a/openbb_platform/openbb/package/futures.py b/openbb_platform/openbb/package/futures.py index 33e6727bddf1..f0cb8ae4f699 100644 --- a/openbb_platform/openbb/package/futures.py +++ b/openbb_platform/openbb/package/futures.py @@ -1,27 +1,15 @@ ### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ### -from openbb_core.app.static.container import Container -from openbb_core.app.model.obbject import OBBject -from openbb_core.app.model.custom_parameter import OpenBBCustomParameter -import openbb_provider -import pandas import datetime -import pydantic -from pydantic import BaseModel -from inspect import Parameter -import typing -from typing import List, Dict, Union, Optional, Literal -from annotated_types import Ge, Le, Gt, Lt +from typing import List, Literal, Union + import typing_extensions -from openbb_core.app.utils import df_to_basemodel +from openbb_core.app.model.custom_parameter import OpenBBCustomParameter +from openbb_core.app.model.obbject import OBBject +from openbb_core.app.static.container import Container from openbb_core.app.static.decorators import validate - from openbb_core.app.static.filters import filter_inputs - from openbb_provider.abstract.data import Data -import openbb_core.app.model.command_context -import openbb_core.app.model.obbject -import types class ROUTER_futures(Container): @@ -42,7 +30,7 @@ def curve( ], date: typing_extensions.Annotated[ Union[datetime.date, None], - OpenBBCustomParameter(description="Historical date to search curve for."), + OpenBBCustomParameter(description="A specific date to get data for."), ] = None, provider: Union[Literal["cboe", "yfinance"], None] = None, **kwargs @@ -54,7 +42,7 @@ def curve( symbol : str Symbol to get data for. date : Union[datetime.date, None] - Historical date to search curve for. + A specific date to get data for. provider : Union[Literal['cboe', 'yfinance'], None] The provider to use for the query, by default None. If None, the provider specified in defaults is selected or 'cboe' if there is diff --git a/openbb_platform/openbb/package/news.py b/openbb_platform/openbb/package/news.py index 3698341e18f6..b189e94390ad 100644 --- a/openbb_platform/openbb/package/news.py +++ b/openbb_platform/openbb/package/news.py @@ -1,27 +1,14 @@ ### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ### -from openbb_core.app.static.container import Container -from openbb_core.app.model.obbject import OBBject -from openbb_core.app.model.custom_parameter import OpenBBCustomParameter -import openbb_provider -import pandas -import datetime -import pydantic -from pydantic import BaseModel -from inspect import Parameter -import typing -from typing import List, Dict, Union, Optional, Literal -from annotated_types import Ge, Le, Gt, Lt +from typing import List, Literal, Union + import typing_extensions -from openbb_core.app.utils import df_to_basemodel +from openbb_core.app.model.custom_parameter import OpenBBCustomParameter +from openbb_core.app.model.obbject import OBBject +from openbb_core.app.static.container import Container from openbb_core.app.static.decorators import validate - from openbb_core.app.static.filters import filter_inputs - from openbb_provider.abstract.data import Data -import openbb_core.app.model.command_context -import openbb_core.app.model.obbject -import types class ROUTER_news(Container): @@ -36,7 +23,10 @@ def __repr__(self) -> str: def globalnews( self, limit: typing_extensions.Annotated[ - int, OpenBBCustomParameter(description="Number of articles to return.") + int, + OpenBBCustomParameter( + description="The number of data entries to return. Here its the no. of articles to return." + ), ] = 20, provider: Union[Literal["benzinga", "fmp", "intrinio"], None] = None, **kwargs @@ -46,7 +36,7 @@ def globalnews( Parameters ---------- limit : int - Number of articles to return. + The number of data entries to return. Here its the no. of articles to return. provider : Union[Literal['benzinga', 'fmp', 'intrinio'], None] The provider to use for the query, by default None. If None, the provider specified in defaults is selected or 'benzinga' if there is @@ -97,7 +87,7 @@ def globalnews( GlobalNews ---------- date : datetime - Published date of the news. + The date of the data. Here it is the published date of the news. title : str Title of the news. images : Optional[Union[List[Dict[str, str]]]] diff --git a/openbb_platform/openbb/package/qa.py b/openbb_platform/openbb/package/qa.py index a60ff23db1e8..0be073b7b4c3 100644 --- a/openbb_platform/openbb/package/qa.py +++ b/openbb_platform/openbb/package/qa.py @@ -1,23 +1,14 @@ ### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ### -from openbb_core.app.static.container import Container -from openbb_core.app.model.obbject import OBBject -from openbb_core.app.model.custom_parameter import OpenBBCustomParameter -import openbb_provider +from typing import List, Literal, Union + import pandas -import datetime -import pydantic -from pydantic import BaseModel -from inspect import Parameter -import typing -from typing import List, Dict, Union, Optional, Literal -from annotated_types import Ge, Le, Gt, Lt import typing_extensions -from openbb_core.app.utils import df_to_basemodel +from annotated_types import Ge, Gt +from openbb_core.app.model.obbject import OBBject +from openbb_core.app.static.container import Container from openbb_core.app.static.decorators import validate - from openbb_core.app.static.filters import filter_inputs - from openbb_provider.abstract.data import Data from openbb_qa.qa_models import ( CAPMModel, @@ -26,8 +17,6 @@ SummaryModel, UnitRootModel, ) -import openbb_core.app.model.obbject -import typing class ROUTER_qa(Container): diff --git a/openbb_platform/openbb/package/stocks.py b/openbb_platform/openbb/package/stocks.py index e3660d7e64dd..38ff7d9df958 100644 --- a/openbb_platform/openbb/package/stocks.py +++ b/openbb_platform/openbb/package/stocks.py @@ -1,27 +1,16 @@ ### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ### -from openbb_core.app.static.container import Container -from openbb_core.app.model.obbject import OBBject -from openbb_core.app.model.custom_parameter import OpenBBCustomParameter -import openbb_provider -import pandas import datetime -import pydantic -from pydantic import BaseModel -from inspect import Parameter -import typing -from typing import List, Dict, Union, Optional, Literal -from annotated_types import Ge, Le, Gt, Lt +from typing import List, Literal, Union + import typing_extensions -from openbb_core.app.utils import df_to_basemodel +from annotated_types import Ge +from openbb_core.app.model.custom_parameter import OpenBBCustomParameter +from openbb_core.app.model.obbject import OBBject +from openbb_core.app.static.container import Container from openbb_core.app.static.decorators import validate - from openbb_core.app.static.filters import filter_inputs - from openbb_provider.abstract.data import Data -import openbb_core.app.model.command_context -import openbb_core.app.model.obbject -import types class ROUTER_stocks(Container): @@ -90,19 +79,19 @@ def info( StockInfo --------- symbol : str - Symbol to get data for. + Symbol representing the entity requested in the data. name : str Name associated with the ticker symbol. price : Optional[Union[float]] Last transaction price. open : Optional[Union[float]] - Opening price of the stock. + The open price of the symbol. high : Optional[Union[float]] - High price of the current trading day. + The high price of the symbol. low : Optional[Union[float]] - Low price of the current trading day. + The low price of the symbol. close : Optional[Union[float]] - Closing price of the most recent trading day. + The close price of the symbol. change : Optional[Union[float]] Change in price over the current trading period. change_percent : Optional[Union[float]] @@ -552,11 +541,14 @@ def multiples( def news( self, symbols: typing_extensions.Annotated[ - str, OpenBBCustomParameter(description="Comma separated list of symbols.") + str, + OpenBBCustomParameter( + description=" Here it is a separated list of symbols." + ), ], limit: typing_extensions.Annotated[ Union[typing_extensions.Annotated[int, Ge(ge=0)], None], - OpenBBCustomParameter(description="Number of results to return per page."), + OpenBBCustomParameter(description="The number of data entries to return."), ] = 20, chart: bool = False, provider: Union[ @@ -569,9 +561,9 @@ def news( Parameters ---------- symbols : str - Comma separated list of symbols. + Here it is a separated list of symbols. limit : Union[typing_extensions.Annotated[int, Ge(ge=0)], None] - Number of results to return per page. + The number of data entries to return. chart : bool Whether to create a chart or not, by default False. provider : Union[Literal['benzinga', 'fmp', 'intrinio', 'polygon', 'yfinance... @@ -628,7 +620,7 @@ def news( StockNews --------- date : datetime - Published date of the news. + The date of the data. Here it is the date of the news. title : str Title of the news. image : Optional[Union[str]] @@ -710,7 +702,9 @@ def quote( self, symbol: typing_extensions.Annotated[ Union[str, List[str]], - OpenBBCustomParameter(description="Comma separated list of symbols."), + OpenBBCustomParameter( + description="Symbol to get data for. In this case, the comma separated list of symbols." + ), ], provider: Union[Literal["fmp", "intrinio"], None] = None, **kwargs @@ -720,7 +714,7 @@ def quote( Parameters ---------- symbol : str - Comma separated list of symbols. + Symbol to get data for. In this case, the comma separated list of symbols. provider : Union[Literal['fmp', 'intrinio'], None] The provider to use for the query, by default None. If None, the provider specified in defaults is selected or 'fmp' if there is @@ -749,7 +743,7 @@ def quote( day_high : Optional[Union[float]] Highest price of the stock in the current trading day. date : Optional[Union[datetime]] - Timestamp of the stock quote. + The date of the data. symbol : Optional[Union[str]] Symbol of the company. (provider: fmp) name : Optional[Union[str]] @@ -897,7 +891,7 @@ def search( StockSearch ----------- symbol : str - Symbol to get data for. + Symbol representing the entity requested in the data. name : str Name of the company. dpm_name : Optional[Union[str]] diff --git a/openbb_platform/openbb/package/stocks_ca.py b/openbb_platform/openbb/package/stocks_ca.py index f16968410fee..1d3f3a74a207 100644 --- a/openbb_platform/openbb/package/stocks_ca.py +++ b/openbb_platform/openbb/package/stocks_ca.py @@ -1,27 +1,14 @@ ### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ### -from openbb_core.app.static.container import Container -from openbb_core.app.model.obbject import OBBject -from openbb_core.app.model.custom_parameter import OpenBBCustomParameter -import openbb_provider -import pandas -import datetime -import pydantic -from pydantic import BaseModel -from inspect import Parameter -import typing -from typing import List, Dict, Union, Optional, Literal -from annotated_types import Ge, Le, Gt, Lt +from typing import List, Literal, Union + import typing_extensions -from openbb_core.app.utils import df_to_basemodel +from openbb_core.app.model.custom_parameter import OpenBBCustomParameter +from openbb_core.app.model.obbject import OBBject +from openbb_core.app.static.container import Container from openbb_core.app.static.decorators import validate - from openbb_core.app.static.filters import filter_inputs - from openbb_provider.abstract.data import Data -import openbb_core.app.model.command_context -import openbb_core.app.model.obbject -import types class ROUTER_stocks_ca(Container): diff --git a/openbb_platform/openbb/package/stocks_fa.py b/openbb_platform/openbb/package/stocks_fa.py index 47b0da47f6c7..b226e8db048a 100644 --- a/openbb_platform/openbb/package/stocks_fa.py +++ b/openbb_platform/openbb/package/stocks_fa.py @@ -1,27 +1,15 @@ ### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ### -from openbb_core.app.static.container import Container -from openbb_core.app.model.obbject import OBBject -from openbb_core.app.model.custom_parameter import OpenBBCustomParameter -import openbb_provider -import pandas import datetime -import pydantic -from pydantic import BaseModel -from inspect import Parameter -import typing -from typing import List, Dict, Union, Optional, Literal -from annotated_types import Ge, Le, Gt, Lt +from typing import List, Literal, Union + import typing_extensions -from openbb_core.app.utils import df_to_basemodel +from openbb_core.app.model.custom_parameter import OpenBBCustomParameter +from openbb_core.app.model.obbject import OBBject +from openbb_core.app.static.container import Container from openbb_core.app.static.decorators import validate - from openbb_core.app.static.filters import filter_inputs - from openbb_provider.abstract.data import Data -import openbb_core.app.model.command_context -import openbb_core.app.model.obbject -import types class ROUTER_stocks_fa(Container): @@ -147,9 +135,9 @@ def balance( BalanceSheet ------------ symbol : Optional[Union[str]] - Symbol to get data for. + Symbol representing the entity requested in the data. date : date - Date of the fetched statement. + The date of the data. cik : Optional[Union[str]] Central Index Key (CIK) of the company. currency : Optional[Union[str]] @@ -328,7 +316,7 @@ def balance_growth( BalanceSheetGrowth ------------------ symbol : Optional[Union[str]] - Symbol to get data for. + Symbol representing the entity requested in the data. date : date The date of the data. period : str @@ -482,7 +470,7 @@ def cal( DividendCalendar ---------------- symbol : str - Symbol to get data for. + Symbol representing the entity requested in the data. date : date The date of the data. label : str @@ -608,9 +596,9 @@ def cash( CashFlowStatement ----------------- symbol : Optional[Union[str]] - Symbol to get data for. + Symbol representing the entity requested in the data. date : date - Date of the fetched statement. + The date of the data. period : Optional[Union[str]] Reporting period of the statement. cik : Optional[Union[str]] @@ -769,7 +757,7 @@ def cash_growth( CashFlowStatementGrowth ----------------------- symbol : Optional[Union[str]] - Symbol to get data for. + Symbol representing the entity requested in the data. date : date The date of the data. period : str @@ -895,7 +883,7 @@ def comp( ExecutiveCompensation --------------------- symbol : str - Symbol to get data for. + Symbol representing the entity requested in the data. cik : Optional[Union[str]] Central Index Key (CIK) of the company. filing_date : date @@ -990,11 +978,11 @@ def comsplit( StockSplitCalendar ------------------ date : date - Date of the stock splits. + The date of the data. label : str Label of the stock splits. symbol : str - Symbol of the company. + Symbol representing the entity requested in the data. numerator : float Numerator of the stock splits. denominator : float @@ -1060,7 +1048,7 @@ def divs( HistoricalDividends ------------------- date : date - Date of the historical dividends. + The date of the data. label : str Label of the historical dividends. adj_dividend : float @@ -1139,7 +1127,7 @@ def earning( EarningsCalendar ---------------- symbol : str - Symbol to get data for. + Symbol representing the entity requested in the data. date : date The date of the data. eps : Optional[Union[float]] @@ -1217,7 +1205,7 @@ def emp( HistoricalEmployees ------------------- symbol : str - Symbol to get data for. + Symbol representing the entity requested in the data. cik : int CIK of the company to retrieve the historical employees of. acceptance_time : datetime @@ -1306,9 +1294,9 @@ def est( AnalystEstimates ---------------- symbol : str - Symbol to get data for. + Symbol representing the entity requested in the data. date : date - A specific date to get data for. + The date of the data. estimated_revenue_low : int Estimated revenue low. estimated_revenue_high : int @@ -1421,7 +1409,7 @@ def filings( CompanyFilings -------------- date : date - The date of the filing. + The date of the data. In this case, it is the date of the filing. type : str Type of document. link : str @@ -1545,9 +1533,9 @@ def income( IncomeStatement --------------- symbol : Optional[Union[str]] - Symbol to get data for. + Symbol representing the entity requested in the data. date : date - Date of the income statement. + The date of the data. In this case, the date of the income statement. period : Optional[Union[str]] Period of the income statement. cik : Optional[Union[str]] @@ -1712,7 +1700,7 @@ def income_growth( IncomeStatementGrowth --------------------- symbol : Optional[Union[str]] - Symbol to get data for. + Symbol representing the entity requested in the data. date : date The date of the data. period : str @@ -1868,7 +1856,7 @@ def ins( StockInsiderTrading ------------------- symbol : str - Symbol to get data for. + Symbol representing the entity requested in the data. filing_date : datetime Filing date of the stock insider trading. transaction_date : date @@ -1971,7 +1959,7 @@ def ins_own( InstitutionalOwnership ---------------------- symbol : str - Symbol to get data for. + Symbol representing the entity requested in the data. cik : Optional[Union[str]] CIK of the company. date : date @@ -2118,7 +2106,7 @@ def metrics( KeyMetrics ---------- symbol : Optional[Union[str]] - Symbol to get data for. + Symbol representing the entity requested in the data. date : date The date of the data. period : str @@ -2374,7 +2362,7 @@ def overview( CompanyOverview --------------- symbol : str - Symbol to get data for. + Symbol representing the entity requested in the data. price : Optional[Union[float]] Price of the company. beta : Optional[Union[float]] @@ -2525,7 +2513,7 @@ def own( investor_name : str Investor name of the stock ownership. symbol : str - Symbol of the stock ownership. + Symbol representing the entity requested in the data. security_name : str Security name of the stock ownership. type_of_security : str @@ -2656,7 +2644,7 @@ def pt( PriceTargetConsensus -------------------- symbol : str - Symbol to get data for. + Symbol representing the entity requested in the data. target_high : Optional[Union[float]] High target of the price target consensus. target_low : Optional[Union[float]] @@ -2727,7 +2715,7 @@ def pta( PriceTarget ----------- symbol : str - Symbol to get data for. + Symbol representing the entity requested in the data. published_date : datetime Published date of the price target. news_url : Optional[Union[str]] @@ -2828,9 +2816,9 @@ def ratios( FinancialRatios --------------- symbol : str - Symbol of the company. + Symbol representing the entity requested in the data. date : str - Date of the financial ratios. + The date of the data. period : str Period of the financial ratios. current_ratio : Optional[Union[float]] @@ -3167,9 +3155,9 @@ def shrs( ShareStatistics --------------- symbol : str - Symbol to get data for. + Symbol representing the entity requested in the data. date : Optional[Union[date]] - A specific date to get data for. + The date of the data. free_float : Optional[Union[float]] Percentage of unrestricted shares of a publicly-traded company. float_shares : Optional[Union[float]] @@ -3319,7 +3307,7 @@ def transcript( EarningsCallTranscript ---------------------- symbol : str - Symbol to get data for. + Symbol representing the entity requested in the data. quarter : int Quarter of the earnings call transcript. year : int diff --git a/openbb_platform/openbb/package/stocks_options.py b/openbb_platform/openbb/package/stocks_options.py index 681885964330..5c2af298509a 100644 --- a/openbb_platform/openbb/package/stocks_options.py +++ b/openbb_platform/openbb/package/stocks_options.py @@ -1,27 +1,14 @@ ### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ### -from openbb_core.app.static.container import Container -from openbb_core.app.model.obbject import OBBject -from openbb_core.app.model.custom_parameter import OpenBBCustomParameter -import openbb_provider -import pandas -import datetime -import pydantic -from pydantic import BaseModel -from inspect import Parameter -import typing -from typing import List, Dict, Union, Optional, Literal -from annotated_types import Ge, Le, Gt, Lt +from typing import List, Literal, Union + import typing_extensions -from openbb_core.app.utils import df_to_basemodel +from openbb_core.app.model.custom_parameter import OpenBBCustomParameter +from openbb_core.app.model.obbject import OBBject +from openbb_core.app.static.container import Container from openbb_core.app.static.decorators import validate - from openbb_core.app.static.filters import filter_inputs - from openbb_provider.abstract.data import Data -import openbb_core.app.model.command_context -import openbb_core.app.model.obbject -import types class ROUTER_stocks_options(Container): @@ -74,7 +61,7 @@ def chains( contract_symbol : str Contract symbol for the option. symbol : Optional[Union[str]] - Underlying symbol for the option. + Symbol representing the entity requested in the data. Here its the underlying symbol for the option. expiration : date Expiration date of the contract. strike : float @@ -84,15 +71,15 @@ def chains( eod_date : Optional[Union[date]] Date for which the options chains are returned. close : Optional[Union[float]] - Close price for the option that day. + The close price of the symbol. close_bid : Optional[Union[float]] The closing bid price for the option that day. close_ask : Optional[Union[float]] The closing ask price for the option that day. volume : Optional[Union[float]] - Current trading volume on the contract. + The volume of the symbol. open : Optional[Union[float]] - Opening price of the option. + The open price of the symbol. open_bid : Optional[Union[float]] The opening bid price for the option that day. open_ask : Optional[Union[float]] @@ -100,9 +87,9 @@ def chains( open_interest : Optional[Union[float]] Open interest on the contract. high : Optional[Union[float]] - High price of the option. + The high price of the symbol. low : Optional[Union[float]] - Low price of the option. + The low price of the symbol. mark : Optional[Union[float]] The mid-price between the latest bid-ask spread. ask_high : Optional[Union[float]] diff --git a/openbb_platform/openbb/package/ta.py b/openbb_platform/openbb/package/ta.py index 7f93ff3b9af8..1c1e7d6c2fbc 100644 --- a/openbb_platform/openbb/package/ta.py +++ b/openbb_platform/openbb/package/ta.py @@ -1,26 +1,15 @@ ### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ### -from openbb_core.app.static.container import Container -from openbb_core.app.model.obbject import OBBject -from openbb_core.app.model.custom_parameter import OpenBBCustomParameter -import openbb_provider +from typing import List, Literal, Union + import pandas -import datetime -import pydantic -from pydantic import BaseModel -from inspect import Parameter -import typing -from typing import List, Dict, Union, Optional, Literal -from annotated_types import Ge, Le, Gt, Lt import typing_extensions -from openbb_core.app.utils import df_to_basemodel +from annotated_types import Ge, Gt +from openbb_core.app.model.obbject import OBBject +from openbb_core.app.static.container import Container from openbb_core.app.static.decorators import validate - from openbb_core.app.static.filters import filter_inputs - from openbb_provider.abstract.data import Data -import openbb_core.app.model.obbject -import typing class ROUTER_ta(Container): diff --git a/openbb_platform/platform/provider/openbb_provider/abstract/data.py b/openbb_platform/platform/provider/openbb_provider/abstract/data.py index 7b6a2cc4dd0e..e5c6fbd0faf2 100644 --- a/openbb_platform/platform/provider/openbb_provider/abstract/data.py +++ b/openbb_platform/platform/provider/openbb_provider/abstract/data.py @@ -8,6 +8,7 @@ def check_int(v: int) -> int: + """Check if the value is an int.""" try: return int(v) except ValueError as exc: diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/analyst_estimates.py b/openbb_platform/platform/provider/openbb_provider/standard_models/analyst_estimates.py index 5149a05e3002..96f3a9d3da73 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/analyst_estimates.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/analyst_estimates.py @@ -8,7 +8,7 @@ from openbb_provider.abstract.data import Data, StrictInt from openbb_provider.abstract.query_params import QueryParams -from openbb_provider.utils.descriptions import QUERY_DESCRIPTIONS +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS, QUERY_DESCRIPTIONS class AnalystEstimatesQueryParams(QueryParams): @@ -31,8 +31,8 @@ def upper_symbol(cls, v: Union[str, List[str], Set[str]]): class AnalystEstimatesData(Data): """Analyst estimates data.""" - symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", "")) - date: dateType = Field(description=QUERY_DESCRIPTIONS.get("date", "")) + symbol: str = Field(description=DATA_DESCRIPTIONS.get("symbol", "")) + date: dateType = Field(description=DATA_DESCRIPTIONS.get("date", "")) estimated_revenue_low: StrictInt = Field(description="Estimated revenue low.") estimated_revenue_high: StrictInt = Field(description="Estimated revenue high.") estimated_revenue_avg: StrictInt = Field(description="Estimated revenue average.") diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/balance_sheet.py b/openbb_platform/platform/provider/openbb_provider/standard_models/balance_sheet.py index 07a42688c92a..3a24add7b72a 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/balance_sheet.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/balance_sheet.py @@ -11,7 +11,7 @@ from openbb_provider.abstract.data import Data, StrictInt from openbb_provider.abstract.query_params import QueryParams -from openbb_provider.utils.descriptions import QUERY_DESCRIPTIONS +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS, QUERY_DESCRIPTIONS class BalanceSheetQueryParams(QueryParams): @@ -37,9 +37,9 @@ class BalanceSheetData(Data): """Balance Sheet Data.""" symbol: Optional[str] = Field( - default=None, description=QUERY_DESCRIPTIONS.get("symbol", "") + default=None, description=DATA_DESCRIPTIONS.get("symbol", "") ) - date: dateType = Field(description="Date of the fetched statement.") + date: dateType = Field(description=DATA_DESCRIPTIONS.get("date", "")) cik: Optional[str] = Field( default=None, description="Central Index Key (CIK) of the company." ) diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/balance_sheet_growth.py b/openbb_platform/platform/provider/openbb_provider/standard_models/balance_sheet_growth.py index ef9f1c38ea0c..8fa7c2876324 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/balance_sheet_growth.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/balance_sheet_growth.py @@ -29,7 +29,7 @@ class BalanceSheetGrowthData(Data): """Balance Sheet Statement Growth Data.""" symbol: Optional[str] = Field( - default=None, description=QUERY_DESCRIPTIONS.get("symbol", "") + default=None, description=DATA_DESCRIPTIONS.get("symbol", "") ) date: dateType = Field(description=DATA_DESCRIPTIONS.get("date", "")) period: str = Field(description="Reporting period.") diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/cash_flow.py b/openbb_platform/platform/provider/openbb_provider/standard_models/cash_flow.py index 34fde28caebe..e712639bc003 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/cash_flow.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/cash_flow.py @@ -1,16 +1,14 @@ """Cash Flow Statement Data Model.""" -from datetime import ( - date as dateType, -) +from datetime import date as dateType from typing import List, Literal, Optional, Set, Union from pydantic import Field, NonNegativeInt, field_validator from openbb_provider.abstract.data import Data, StrictInt from openbb_provider.abstract.query_params import QueryParams -from openbb_provider.utils.descriptions import QUERY_DESCRIPTIONS +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS, QUERY_DESCRIPTIONS class CashFlowStatementQueryParams(QueryParams): @@ -36,9 +34,9 @@ class CashFlowStatementData(Data): """Cash Flow Statement Data.""" symbol: Optional[str] = Field( - default=None, description=QUERY_DESCRIPTIONS.get("symbol", "") + default=None, description=DATA_DESCRIPTIONS.get("symbol", "") ) - date: dateType = Field(description="Date of the fetched statement.") + date: dateType = Field(description=DATA_DESCRIPTIONS.get("date" "")) period: Optional[str] = Field( default=None, description="Reporting period of the statement." ) @@ -138,3 +136,6 @@ def upper_symbol(cls, v: Union[str, List[str], Set[str]]): if isinstance(v, str): return v.upper() return ",".join([symbol.upper() for symbol in list(v)]) if v else None + + +DATA_DESCRIPTIONS.get("date", "") diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/cash_flow_growth.py b/openbb_platform/platform/provider/openbb_provider/standard_models/cash_flow_growth.py index 06d64a66beaf..797244c51941 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/cash_flow_growth.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/cash_flow_growth.py @@ -29,7 +29,7 @@ class CashFlowStatementGrowthData(Data): """Cash Flow Statement Growth Data.""" symbol: Optional[str] = Field( - default=None, description=QUERY_DESCRIPTIONS.get("symbol", "") + default=None, description=DATA_DESCRIPTIONS.get("symbol", "") ) date: dateType = Field(description=DATA_DESCRIPTIONS.get("date", "")) period: str = Field(description="Period the statement is returned for.") diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/company_filings.py b/openbb_platform/platform/provider/openbb_provider/standard_models/company_filings.py index 87431721172a..fac6f857cd7b 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/company_filings.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/company_filings.py @@ -8,7 +8,7 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams -from openbb_provider.utils.descriptions import QUERY_DESCRIPTIONS +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS, QUERY_DESCRIPTIONS SEC_FORM_TYPES = Literal[ "1", @@ -133,6 +133,9 @@ def upper_symbol(cls, v: Union[str, List[str], Set[str]]): class CompanyFilingsData(Data): """Company Filings Data.""" - date: dateType = Field(description="The date of the filing.") + date: dateType = Field( + description=DATA_DESCRIPTIONS.get("date", "") + + " In this case, it is the date of the filing." + ) type: str = Field(description="Type of document.") link: str = Field(description="URL to the document.") diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/company_overview.py b/openbb_platform/platform/provider/openbb_provider/standard_models/company_overview.py index 565b783ea954..53406616caf6 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/company_overview.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/company_overview.py @@ -8,7 +8,7 @@ from openbb_provider.abstract.data import Data, StrictInt from openbb_provider.abstract.query_params import QueryParams -from openbb_provider.utils.descriptions import QUERY_DESCRIPTIONS +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS, QUERY_DESCRIPTIONS class CompanyOverviewQueryParams(QueryParams): @@ -30,7 +30,7 @@ class CompanyOverviewData(Data): Returns the profile of a given company. """ - symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", "")) + symbol: str = Field(description=DATA_DESCRIPTIONS.get("symbol", "")) price: Optional[float] = Field(default=None, description="Price of the company.") beta: Optional[float] = Field(default=None, description="Beta of the company.") vol_avg: Optional[StrictInt] = Field( diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/cot_search.py b/openbb_platform/platform/provider/openbb_provider/standard_models/cot_search.py index e072c62554ca..26584dd2a5ba 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/cot_search.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/cot_search.py @@ -6,10 +6,11 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS class CotSearchQueryParams(QueryParams): - """Commitment of Traders Reports Search Query Params""" + """Commitment of Traders Reports Search Query Params.""" query: str = Field(description="Search query.", default="") @@ -29,5 +30,5 @@ class CotSearchData(Data): default=None, description="The units for one contract." ) symbol: Optional[str] = Field( - default=None, description="Trading symbol representing the underlying asset." + default=None, description=DATA_DESCRIPTIONS.get("symbol", "") ) diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/crypto_historical.py b/openbb_platform/platform/provider/openbb_provider/standard_models/crypto_historical.py index 5c6c2453d796..1e174dcbaea3 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/crypto_historical.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/crypto_historical.py @@ -19,7 +19,8 @@ class CryptoHistoricalQueryParams(QueryParams): """Crypto end of day Query.""" symbol: str = Field( - description="Symbol Pair to get data for in CURR1-CURR2 or CURR1CURR2 format." + description=QUERY_DESCRIPTIONS.get("symbol", "") + + " Can use CURR1-CURR2 or CURR1CURR2 format." ) start_date: Optional[dateType] = Field( default=None, diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/dividend_calendar.py b/openbb_platform/platform/provider/openbb_provider/standard_models/dividend_calendar.py index fece09979a7e..7545bfd4e316 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/dividend_calendar.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/dividend_calendar.py @@ -25,7 +25,7 @@ class DividendCalendarQueryParams(QueryParams): class DividendCalendarData(Data): """Dividend Calendar Data.""" - symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", "")) + symbol: str = Field(description=DATA_DESCRIPTIONS.get("symbol", "")) date: dateType = Field(description=DATA_DESCRIPTIONS.get("date")) label: str = Field(description="Date in human readable form in the calendar.") adj_dividend: Optional[float] = Field( diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/earnings_calendar.py b/openbb_platform/platform/provider/openbb_provider/standard_models/earnings_calendar.py index 4c3cd0da2acf..b35020dbdbbb 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/earnings_calendar.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/earnings_calendar.py @@ -30,7 +30,7 @@ def upper_symbol(cls, v: Union[str, List[str], Set[str]]): class EarningsCalendarData(Data): """Earnings calendar Data.""" - symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", "")) + symbol: str = Field(description=DATA_DESCRIPTIONS.get("symbol", "")) date: dateType = Field(description=DATA_DESCRIPTIONS.get("date", "")) eps: Optional[float] = Field( default=None, description="EPS of the earnings calendar." diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/earnings_call_transcript.py b/openbb_platform/platform/provider/openbb_provider/standard_models/earnings_call_transcript.py index eadbf2ef791b..995b222a9a12 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/earnings_call_transcript.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/earnings_call_transcript.py @@ -34,7 +34,7 @@ def upper_symbol(cls, v: Union[str, List[str], Set[str]]): class EarningsCallTranscriptData(Data): """Earnings call transcript Data.""" - symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", "")) + symbol: str = Field(description=DATA_DESCRIPTIONS.get("symbol", "")) quarter: int = Field(description="Quarter of the earnings call transcript.") year: int = Field(description="Year of the earnings call transcript.") date: datetime = Field(description=DATA_DESCRIPTIONS.get("date", "")) diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/economic_calendar.py b/openbb_platform/platform/provider/openbb_provider/standard_models/economic_calendar.py index 1b06bf5530db..b0be5fc1a70e 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/economic_calendar.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/economic_calendar.py @@ -11,7 +11,7 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams -from openbb_provider.utils.descriptions import QUERY_DESCRIPTIONS +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS, QUERY_DESCRIPTIONS class EconomicCalendarQueryParams(QueryParams): @@ -61,7 +61,7 @@ class EconomicCalendarData(Data): """Economic calendar Data.""" date: Optional[datetime] = Field( - default=None, description="Date and time of event." + default=None, description=DATA_DESCRIPTIONS.get("date", "") ) country: Optional[str] = Field(default=None, description="Country of event.") category: Optional[str] = Field(default=None, description="Category of event.") diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/esg_risk_rating.py b/openbb_platform/platform/provider/openbb_provider/standard_models/esg_risk_rating.py index 2b0de25d7728..ae1943fa5347 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/esg_risk_rating.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/esg_risk_rating.py @@ -7,7 +7,7 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams -from openbb_provider.utils.descriptions import QUERY_DESCRIPTIONS +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS, QUERY_DESCRIPTIONS class ESGRiskRatingQueryParams(QueryParams): @@ -26,7 +26,7 @@ def upper_symbol(cls, v: Union[str, List[str], Set[str]]): class ESGRiskRatingData(Data): """ESG Risk Rating data.""" - symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", "")) + symbol: str = Field(description=DATA_DESCRIPTIONS.get("symbol", "")) cik: str = Field(description="CIK of the company.") company_name: str = Field(description="Company name of the company.") industry: str = Field(description="Industry of the company.") diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/esg_score.py b/openbb_platform/platform/provider/openbb_provider/standard_models/esg_score.py index 199f695e2a2c..ee070348d64c 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/esg_score.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/esg_score.py @@ -11,7 +11,7 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams -from openbb_provider.utils.descriptions import QUERY_DESCRIPTIONS +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS, QUERY_DESCRIPTIONS class ESGScoreQueryParams(QueryParams): @@ -30,12 +30,12 @@ def upper_symbol(cls, v: Union[str, List[str], Set[str]]): class ESGScoreData(Data): """ESG Score data.""" - symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", "")) + symbol: str = Field(description=DATA_DESCRIPTIONS.get("symbol", "")) cik: str = Field(description="CIK of the company.") company_name: str = Field(description="Company name of the company.") form_type: str = Field(description="Form type of the company.") accepted_date: datetime = Field(description="Accepted date of the company.") - date: dateType = Field(description="Date of the fetched score.") + date: dateType = Field(description=DATA_DESCRIPTIONS.get("date", "")) environmental_score: float = Field( description="Environmental score of the company." ) diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/etf_countries.py b/openbb_platform/platform/provider/openbb_provider/standard_models/etf_countries.py index 28e9a3d10acb..8b8ce3b8650d 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/etf_countries.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/etf_countries.py @@ -6,12 +6,13 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams +from openbb_provider.utils.descriptions import QUERY_DESCRIPTIONS class EtfCountriesQueryParams(QueryParams): """ETF Countries Query Params.""" - symbol: str = Field(description="The exchange ticker symbol for the ETF.") + symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", "")) @field_validator("symbol") @classmethod diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/etf_historical_nav.py b/openbb_platform/platform/provider/openbb_provider/standard_models/etf_historical_nav.py index 2b490bc888ce..d3a9f88da6dd 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/etf_historical_nav.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/etf_historical_nav.py @@ -7,12 +7,13 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS, QUERY_DESCRIPTIONS class EtfHistoricalNavQueryParams(QueryParams): """ETF Historical Net Asset Value Query Params.""" - symbol: str = Field(description="The exchange ticker symbol for the ETF.") + symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", "")) @field_validator("symbol") @classmethod @@ -26,5 +27,5 @@ def upper_symbol(cls, v: Union[str, List[str], Set[str]]): class EtfHistoricalNavData(Data): """ETF Historical Net Asset Value Data.""" - date: dateType = Field(description="The date of the NAV.") + date: dateType = Field(description=DATA_DESCRIPTIONS.get("date", "")) nav: float = Field(description="The net asset value on the date.") diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/etf_holdings.py b/openbb_platform/platform/provider/openbb_provider/standard_models/etf_holdings.py index 97247d0f643f..d8f8fa35c09b 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/etf_holdings.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/etf_holdings.py @@ -6,19 +6,18 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS, QUERY_DESCRIPTIONS class EtfHoldingsQueryParams(QueryParams): """ETF Holdings Query Params""" - symbol: str = Field(description="The exchange ticker symbol for the ETF.") + symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", "")) class EtfHoldingsData(Data): """ETF Holdings Data.""" - symbol: Optional[str] = Field( - description="The exchange ticker symbol for the holding." - ) + symbol: Optional[str] = Field(description=DATA_DESCRIPTIONS.get("symbol", "")) name: Optional[str] = Field(description="Name of the ETF holding.") weight: Optional[float] = Field(description="Weight of the ETF holding.") diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/etf_info.py b/openbb_platform/platform/provider/openbb_provider/standard_models/etf_info.py index 8f3e34670af3..3e341f7a2653 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/etf_info.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/etf_info.py @@ -6,12 +6,13 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS, QUERY_DESCRIPTIONS class EtfInfoQueryParams(QueryParams): """ETF Info Query Params.""" - symbol: str = Field(description="The exchange ticker symbol for the ETF.") + symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", "")) @field_validator("symbol") @classmethod @@ -25,6 +26,6 @@ def upper_symbol(cls, v: Union[str, List[str], Set[str]]): class EtfInfoData(Data): """ETF Info Data.""" - symbol: str = Field(description="The exchange ticker symbol for the ETF.") + symbol: str = Field(description=DATA_DESCRIPTIONS.get("symbol", "")) inception_date: Optional[str] = Field(description="Inception date of the ETF.") name: Optional[str] = Field(description="Name of the ETF.") diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/etf_search.py b/openbb_platform/platform/provider/openbb_provider/standard_models/etf_search.py index deff74a6d636..6725d120c6a1 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/etf_search.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/etf_search.py @@ -6,6 +6,7 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS class EtfSearchQueryParams(QueryParams): @@ -17,5 +18,5 @@ class EtfSearchQueryParams(QueryParams): class EtfSearchData(Data): """ETF Search Data.""" - symbol: str = Field(description="The exchange ticker symbol for the ETF.") + symbol: str = Field(description=DATA_DESCRIPTIONS.get("symbol", "")) name: Optional[str] = Field(description="Name of the ETF.", default=None) diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/etf_sectors.py b/openbb_platform/platform/provider/openbb_provider/standard_models/etf_sectors.py index 6570a29b0e03..39c7b352ebc1 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/etf_sectors.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/etf_sectors.py @@ -6,12 +6,13 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams +from openbb_provider.utils.descriptions import QUERY_DESCRIPTIONS class EtfSectorsQueryParams(QueryParams): """ETF Sectors Query Params.""" - symbol: str = Field(description="The exchange ticker symbol for the ETF.") + symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", "")) @field_validator("symbol") @classmethod diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/european_index_constituents.py b/openbb_platform/platform/provider/openbb_provider/standard_models/european_index_constituents.py index 02835f407461..927362b7b0bd 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/european_index_constituents.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/european_index_constituents.py @@ -26,7 +26,10 @@ def upper_symbol(cls, v: Union[str, List[str], Set[str]]): class EuropeanIndexConstituentsData(Data): """European Index Constituents data.""" - symbol: str = Field(description="Symbol of the constituent company in the index.") + symbol: str = Field( + description=DATA_DESCRIPTIONS.get("symbol", "") + + " The symbol is the constituent company in the index." + ) price: float = Field( description="Current price of the constituent company in the index." ) diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/executive_compensation.py b/openbb_platform/platform/provider/openbb_provider/standard_models/executive_compensation.py index 7169577583c1..be0e577cedd7 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/executive_compensation.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/executive_compensation.py @@ -11,7 +11,7 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams -from openbb_provider.utils.descriptions import QUERY_DESCRIPTIONS +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS, QUERY_DESCRIPTIONS class ExecutiveCompensationQueryParams(QueryParams): @@ -30,7 +30,7 @@ def upper_symbol(cls, v: Union[str, List[str], Set[str]]): class ExecutiveCompensationData(Data): """Return Executive Compensation Data.""" - symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", "")) + symbol: str = Field(description=DATA_DESCRIPTIONS.get("symbol", "")) cik: Optional[str] = Field( default=None, description="Central Index Key (CIK) of the company." ) diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/financial_ratios.py b/openbb_platform/platform/provider/openbb_provider/standard_models/financial_ratios.py index 649cbc783916..142151b49a16 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/financial_ratios.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/financial_ratios.py @@ -7,7 +7,7 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams -from openbb_provider.utils.descriptions import QUERY_DESCRIPTIONS +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS, QUERY_DESCRIPTIONS class FinancialRatiosQueryParams(QueryParams): @@ -32,8 +32,8 @@ def upper_symbol(cls, v: Union[str, List[str], Set[str]]): class FinancialRatiosData(Data): """Financial ratios data model.""" - symbol: str = Field(description="Symbol of the company.") - date: str = Field(description="Date of the financial ratios.") + symbol: str = Field(description=DATA_DESCRIPTIONS.get("symbol", "")) + date: str = Field(description=DATA_DESCRIPTIONS.get("date", "")) period: str = Field(description="Period of the financial ratios.") current_ratio: Optional[float] = Field(default=None, description="Current ratio.") quick_ratio: Optional[float] = Field(default=None, description="Quick ratio.") diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/forex_historical.py b/openbb_platform/platform/provider/openbb_provider/standard_models/forex_historical.py index dddcd844bd84..9250f387796e 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/forex_historical.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/forex_historical.py @@ -19,7 +19,8 @@ class ForexHistoricalQueryParams(QueryParams): """Forex end of day Query.""" symbol: str = Field( - description="Symbol Pair to get data for in CURR1-CURR2 or CURR1CURR2 format." + description=QUERY_DESCRIPTIONS.get("symbol", "") + + " Can use CURR1-CURR2 or CURR1CURR2 format." ) start_date: Optional[dateType] = Field( default=None, diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/futures_curve.py b/openbb_platform/platform/provider/openbb_provider/standard_models/futures_curve.py index 4f3aa3a8c7dc..5778eb2b93d4 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/futures_curve.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/futures_curve.py @@ -17,7 +17,7 @@ class FuturesCurveQueryParams(QueryParams): symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", "")) date: Optional[dateType] = Field( default=None, - description="Historical date to search curve for.", + description=QUERY_DESCRIPTIONS.get("date", ""), ) @field_validator("symbol", mode="before", check_fields=False) diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/gdpforecast.py b/openbb_platform/platform/provider/openbb_provider/standard_models/gdpforecast.py index 2fc26aedecbe..e7fb1a10c7c5 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/gdpforecast.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/gdpforecast.py @@ -14,7 +14,8 @@ class GDPForecastQueryParams(QueryParams): period: Literal["quarter", "annual"] = Field( default="annual", - description="Units for nominal GDP period. Either quarter or annual.", + description=QUERY_DESCRIPTIONS.get("period", "") + + " Units for nominal GDP period. Either quarter or annual.", ) start_date: Optional[dateType] = Field( default=None, description=QUERY_DESCRIPTIONS.get("start_date") diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/gdpnom.py b/openbb_platform/platform/provider/openbb_provider/standard_models/gdpnom.py index 64d2a9ea2b10..949e2506267e 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/gdpnom.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/gdpnom.py @@ -14,7 +14,8 @@ class GDPNomQueryParams(QueryParams): units: Literal["usd", "usd_cap"] = Field( default="usd", - description="Units to get nominal GDP in. Either usd or usd_cap indicating per capita.", + description=QUERY_DESCRIPTIONS.get("units", "") + + " Units to get nominal GDP in. Either usd or usd_cap indicating per capita.", ) start_date: Optional[dateType] = Field( default=None, description=QUERY_DESCRIPTIONS.get("start_date") diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/gdpreal.py b/openbb_platform/platform/provider/openbb_provider/standard_models/gdpreal.py index e8ad24efe25a..2b854ef7c00a 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/gdpreal.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/gdpreal.py @@ -14,8 +14,8 @@ class GDPRealQueryParams(QueryParams): units: Literal["idx", "qoq", "yoy"] = Field( default="yoy", - description="Units to get real GDP in. " - + "Either idx (indicating 2015=100), " + description=QUERY_DESCRIPTIONS.get("units", "") + + " Either idx (indicating 2015=100), " + "qoq (previous period) " + "or yoy (same period, previous year).)", ) @@ -36,3 +36,6 @@ class GDPRealData(Data): value: Optional[float] = Field( default=None, description="Nominal GDP value on the date." ) + + +QUERY_DESCRIPTIONS diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/global_news.py b/openbb_platform/platform/provider/openbb_provider/standard_models/global_news.py index 0b29a18d2e76..3765db7a496c 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/global_news.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/global_news.py @@ -8,20 +8,26 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS, QUERY_DESCRIPTIONS class GlobalNewsQueryParams(QueryParams): """Global news Query.""" limit: NonNegativeInt = Field( - default=20, description="Number of articles to return." + default=20, + description=QUERY_DESCRIPTIONS.get("limit", "") + + " Here its the no. of articles to return.", ) class GlobalNewsData(Data): """Global News Data.""" - date: datetime = Field(description="Published date of the news.") + date: datetime = Field( + description=DATA_DESCRIPTIONS.get("date", "") + + " Here it is the published date of the news." + ) title: str = Field(description="Title of the news.") images: Optional[List[Dict[str, str]]] = Field( default=None, description="Images associated with the news." diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/historical_dividends.py b/openbb_platform/platform/provider/openbb_provider/standard_models/historical_dividends.py index a31aa0e42902..099f1d4ab3fc 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/historical_dividends.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/historical_dividends.py @@ -8,7 +8,7 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams -from openbb_provider.utils.descriptions import QUERY_DESCRIPTIONS +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS, QUERY_DESCRIPTIONS class HistoricalDividendsQueryParams(QueryParams): @@ -27,7 +27,7 @@ def upper_symbol(cls, v: Union[str, List[str], Set[str]]): class HistoricalDividendsData(Data): """Historical dividends data.""" - date: dateType = Field(description="Date of the historical dividends.") + date: dateType = Field(description=DATA_DESCRIPTIONS.get("date", "")) label: str = Field(description="Label of the historical dividends.") adj_dividend: float = Field( description="Adjusted dividend of the historical dividends." diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/historical_employees.py b/openbb_platform/platform/provider/openbb_provider/standard_models/historical_employees.py index b2e6cf690d0b..6863a20d73e1 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/historical_employees.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/historical_employees.py @@ -7,7 +7,7 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams -from openbb_provider.utils.descriptions import QUERY_DESCRIPTIONS +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS, QUERY_DESCRIPTIONS class HistoricalEmployeesQueryParams(QueryParams): @@ -26,7 +26,7 @@ def upper_symbol(cls, v: Union[str, List[str], Set[str]]): class HistoricalEmployeesData(Data): """Historical Employees Data.""" - symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", "")) + symbol: str = Field(description=DATA_DESCRIPTIONS.get("symbol", "")) cik: int = Field( description="CIK of the company to retrieve the historical employees of." ) diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/historical_eps.py b/openbb_platform/platform/provider/openbb_provider/standard_models/historical_eps.py index b412ea4f007a..26b68f59c368 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/historical_eps.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/historical_eps.py @@ -1,9 +1,7 @@ """Historical EPS data model.""" -from datetime import ( - date as dateType, -) +from datetime import date as dateType from typing import List, Optional, Set, Union from dateutil import parser @@ -32,7 +30,7 @@ class HistoricalEpsData(Data): """Historical Earnings Per Share Data.""" date: dateType = Field(default=None, description=DATA_DESCRIPTIONS.get("date", "")) - symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", "")) + symbol: str = Field(description=DATA_DESCRIPTIONS.get("symbol", "")) announce_time: Optional[str] = Field( default=None, description="Timing of the earnings announcement." ) diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/income_statement.py b/openbb_platform/platform/provider/openbb_provider/standard_models/income_statement.py index 2dfe6022a126..936499ba549b 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/income_statement.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/income_statement.py @@ -8,7 +8,7 @@ from openbb_provider.abstract.data import Data, StrictInt from openbb_provider.abstract.query_params import QueryParams -from openbb_provider.utils.descriptions import QUERY_DESCRIPTIONS +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS, QUERY_DESCRIPTIONS class IncomeStatementQueryParams(QueryParams): @@ -34,9 +34,12 @@ class IncomeStatementData(Data): """Income Statement Data.""" symbol: Optional[str] = Field( - default=None, description=QUERY_DESCRIPTIONS.get("symbol", "") + default=None, description=DATA_DESCRIPTIONS.get("symbol", "") + ) + date: dateType = Field( + description=DATA_DESCRIPTIONS.get("date", "") + + " In this case, the date of the income statement." ) - date: dateType = Field(description="Date of the income statement.") period: Optional[str] = Field( default=None, description="Period of the income statement." ) diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/income_statement_growth.py b/openbb_platform/platform/provider/openbb_provider/standard_models/income_statement_growth.py index e4e970fb4ac5..e667fabc36f1 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/income_statement_growth.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/income_statement_growth.py @@ -32,7 +32,7 @@ class IncomeStatementGrowthData(Data): """Income Statement Growth Data.""" symbol: Optional[str] = Field( - default=None, description=QUERY_DESCRIPTIONS.get("symbol", "") + default=None, description=DATA_DESCRIPTIONS.get("symbol", "") ) date: dateType = Field(description=DATA_DESCRIPTIONS.get("date", "")) period: str = Field(description="Period the statement is returned for.") @@ -113,3 +113,4 @@ def upper_symbol(cls, v: Union[str, List[str], Set[str]]): if isinstance(v, str): return v.upper() return ",".join([symbol.upper() for symbol in list(v)]) if v else None + return ",".join([symbol.upper() for symbol in list(v)]) if v else None diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/index_constituents.py b/openbb_platform/platform/provider/openbb_provider/standard_models/index_constituents.py index cd545b317237..9e658a3a553d 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/index_constituents.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/index_constituents.py @@ -6,12 +6,13 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS, QUERY_DESCRIPTIONS class IndexConstituentsQueryParams(QueryParams): """Index Constituents Query Params.""" - symbol: str = Field(description="The index ticker symbol.") + symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", "")) @field_validator("symbol") @classmethod @@ -25,7 +26,7 @@ def upper_symbol(cls, v: Union[str, List[str], Set[str]]): class IndexConstituentsData(Data): """Index Constituents Data.""" - symbol: str = Field(description="The ticker symbol of the index constituent.") + symbol: str = Field(description=DATA_DESCRIPTIONS.get("symbol", "")) name: Optional[str] = Field( description="The name of the index constituent.", default=None ) diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/index_info.py b/openbb_platform/platform/provider/openbb_provider/standard_models/index_info.py index a1a3e526f75c..c6f853dbce9f 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/index_info.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/index_info.py @@ -6,12 +6,13 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS, QUERY_DESCRIPTIONS class IndexInfoQueryParams(QueryParams): """Index Info Query Params.""" - symbol: str = Field(description="The index ticker symbol.") + symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", "")) @field_validator("symbol") @classmethod @@ -25,7 +26,7 @@ def upper_symbol(cls, v: Union[str, List[str], Set[str]]): class IndexInfoData(Data): """Index Info Data.""" - symbol: str = Field(description="The index ticker symbol.") + symbol: str = Field(description=DATA_DESCRIPTIONS.get("symbol", "")) name: str = Field(description="The name of the index.") description: Optional[str] = Field( description="The short description of the index.", default=None diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/index_search.py b/openbb_platform/platform/provider/openbb_provider/standard_models/index_search.py index 14ae4cc4702e..4c8d5bfc701d 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/index_search.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/index_search.py @@ -4,13 +4,14 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS class IndexSearchQueryParams(QueryParams): - """Index Search Query Params""" + """Index Search Query Params.""" query: str = Field(description="Search query.", default="") - symbol: bool = Field( + is_symbol: bool = Field( description="Whether to search by ticker symbol.", default=False ) @@ -18,5 +19,5 @@ class IndexSearchQueryParams(QueryParams): class IndexSearchData(Data): """Company Search Data.""" - symbol: str = Field(description="Symbol of the index.") + symbol: str = Field(description=DATA_DESCRIPTIONS.get("symbol", "")) name: str = Field(description="Name of the index.") diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/index_sectors.py b/openbb_platform/platform/provider/openbb_provider/standard_models/index_sectors.py index 90b6a8e2297c..17602a01b166 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/index_sectors.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/index_sectors.py @@ -6,12 +6,13 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams +from openbb_provider.utils.descriptions import QUERY_DESCRIPTIONS class IndexSectorsQueryParams(QueryParams): """Index Info Query Params.""" - symbol: str = Field(description="The index ticker symbol.") + symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", "")) @field_validator("symbol") @classmethod diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/index_snapshots.py b/openbb_platform/platform/provider/openbb_provider/standard_models/index_snapshots.py index 6f0a8bdaea80..7023de122216 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/index_snapshots.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/index_snapshots.py @@ -6,10 +6,11 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS class IndexSnapshotsQueryParams(QueryParams): - """Index Search Query Params""" + """Index Search Query Params.""" region: Optional[Literal["US", "EU"]] = Field( description="The region to return. Currently supports US and EU.", default="US" @@ -19,21 +20,23 @@ class IndexSnapshotsQueryParams(QueryParams): class IndexSnapshotsData(Data): """Index Snapshot Data.""" - symbol: str = Field(description="Symbol of the index.") + symbol: str = Field(description=DATA_DESCRIPTIONS.get("symbol", "")) name: Optional[str] = Field(default=None, description="Name of the index.") currency: Optional[str] = Field(default=None, description="Currency of the index.") price: Optional[float] = Field( default=None, description="Current price of the index." ) open: Optional[float] = Field( - default=None, description="Opening price of the index." + default=None, description=DATA_DESCRIPTIONS.get("open", "") ) high: Optional[float] = Field( - default=None, description="Highest price of the index." + default=None, description=DATA_DESCRIPTIONS.get("high", "") + ) + low: Optional[float] = Field( + default=None, description=DATA_DESCRIPTIONS.get("low", "") ) - low: Optional[float] = Field(default=None, description="Lowest price of the index.") close: Optional[float] = Field( - default=None, description="Closing price of the index." + default=None, description=DATA_DESCRIPTIONS.get("close", "") ) prev_close: Optional[float] = Field( default=None, description="Previous closing price of the index." diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/industry_pe.py b/openbb_platform/platform/provider/openbb_provider/standard_models/industry_pe.py index 076b970c93e0..48baf5ae8257 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/industry_pe.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/industry_pe.py @@ -7,6 +7,7 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS class IndustryPEQueryParams(QueryParams): @@ -17,7 +18,7 @@ class IndustryPEData(Data): """Industry Price to Earnings Ratio Data.""" date: Optional[dateType] = Field( - description="The date of the P/E ratio.", default=None + description=DATA_DESCRIPTIONS.get("date", ""), default=None ) exchange: Optional[str] = Field( default=None, description="The exchange where the data is from." diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/institutional_ownership.py b/openbb_platform/platform/provider/openbb_provider/standard_models/institutional_ownership.py index 5ea5cb0c660e..92fb62e935f9 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/institutional_ownership.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/institutional_ownership.py @@ -33,7 +33,7 @@ def upper_symbol(cls, v: Union[str, List[str], Set[str]]): class InstitutionalOwnershipData(Data): """Institutional Ownership Data.""" - symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", "")) + symbol: str = Field(description=DATA_DESCRIPTIONS.get("symbol", "")) cik: Optional[str] = Field(default=None, description="CIK of the company.") date: dateType = Field(description=DATA_DESCRIPTIONS.get("date", "")) investors_holding: int = Field(description="Number of investors holding the stock.") diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/key_metrics.py b/openbb_platform/platform/provider/openbb_provider/standard_models/key_metrics.py index 1528723fbf34..b439c5644a2d 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/key_metrics.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/key_metrics.py @@ -34,7 +34,7 @@ class KeyMetricsData(Data): """Key Metrics Data.""" symbol: Optional[str] = Field( - default=None, description=QUERY_DESCRIPTIONS.get("symbol", "") + default=None, description=DATA_DESCRIPTIONS.get("symbol", "") ) date: dateType = Field(description=DATA_DESCRIPTIONS.get("date", "")) period: str = Field(description="Period of the data.") diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/major_indices_constituents.py b/openbb_platform/platform/provider/openbb_provider/standard_models/major_indices_constituents.py index 28f55e960744..2f82504d8efa 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/major_indices_constituents.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/major_indices_constituents.py @@ -8,7 +8,7 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams -from openbb_provider.utils.descriptions import QUERY_DESCRIPTIONS +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS class MajorIndicesConstituentsQueryParams(QueryParams): @@ -23,7 +23,7 @@ class MajorIndicesConstituentsQueryParams(QueryParams): class MajorIndicesConstituentsData(Data): """Major Indices Constituents Data.""" - symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", "")) + symbol: str = Field(description=DATA_DESCRIPTIONS.get("symbol", "")) name: str = Field(description="Name of the constituent company in the index.") sector: str = Field( description="Sector the constituent company in the index belongs to." diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/market_movers.py b/openbb_platform/platform/provider/openbb_provider/standard_models/market_movers.py index 097fafadff15..f28ea9bd35f5 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/market_movers.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/market_movers.py @@ -6,6 +6,7 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS class MarketMoversQueryParams(QueryParams): @@ -15,7 +16,7 @@ class MarketMoversQueryParams(QueryParams): class MarketMoversData(Data): """Market Movers Data.""" - symbol: str = Field(description="The ticker symbol.") + symbol: str = Field(description=DATA_DESCRIPTIONS.get("symbol", "")) name: Optional[str] = Field( default=None, description="The name associated with the ticker." ) diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/options_chains.py b/openbb_platform/platform/provider/openbb_provider/standard_models/options_chains.py index 2fa8f844f9bb..50342cc88e3d 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/options_chains.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/options_chains.py @@ -7,7 +7,7 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams -from openbb_provider.utils.descriptions import QUERY_DESCRIPTIONS +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS, QUERY_DESCRIPTIONS class OptionsChainsQueryParams(QueryParams): @@ -28,7 +28,9 @@ class OptionsChainsData(Data): contract_symbol: str = Field(description="Contract symbol for the option.") symbol: Optional[str] = Field( - description="Underlying symbol for the option.", default=None + description=DATA_DESCRIPTIONS.get("symbol", "") + + " Here its the underlying symbol for the option.", + default=None, ) expiration: dateType = Field(description="Expiration date of the contract.") strike: float = Field(description="Strike price of the contract.") @@ -37,7 +39,7 @@ class OptionsChainsData(Data): default=None, description="Date for which the options chains are returned." ) close: Optional[float] = Field( - default=None, description="Close price for the option that day." + default=None, description=DATA_DESCRIPTIONS.get("close", "") ) close_bid: Optional[float] = Field( default=None, description="The closing bid price for the option that day." @@ -46,10 +48,10 @@ class OptionsChainsData(Data): default=None, description="The closing ask price for the option that day." ) volume: Optional[float] = Field( - default=None, description="Current trading volume on the contract." + default=None, description=DATA_DESCRIPTIONS.get("volume", "") ) open: Optional[float] = Field( - default=None, description="Opening price of the option." + default=None, description=DATA_DESCRIPTIONS.get("open", "") ) open_bid: Optional[float] = Field( default=None, description="The opening bid price for the option that day." @@ -60,8 +62,12 @@ class OptionsChainsData(Data): open_interest: Optional[float] = Field( default=None, description="Open interest on the contract." ) - high: Optional[float] = Field(default=None, description="High price of the option.") - low: Optional[float] = Field(default=None, description="Low price of the option.") + high: Optional[float] = Field( + default=None, description=DATA_DESCRIPTIONS.get("high", "") + ) + low: Optional[float] = Field( + default=None, description=DATA_DESCRIPTIONS.get("low", "") + ) mark: Optional[float] = Field( default=None, description="The mid-price between the latest bid-ask spread." ) diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/price_target.py b/openbb_platform/platform/provider/openbb_provider/standard_models/price_target.py index c20195868d78..65342540fb2f 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/price_target.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/price_target.py @@ -8,7 +8,7 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams -from openbb_provider.utils.descriptions import QUERY_DESCRIPTIONS +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS, QUERY_DESCRIPTIONS class PriceTargetQueryParams(QueryParams): @@ -27,7 +27,7 @@ def upper_symbol(cls, v: Union[str, List[str], Set[str]]): class PriceTargetData(Data): """Price target Data.""" - symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", "")) + symbol: str = Field(description=DATA_DESCRIPTIONS.get("symbol", "")) published_date: datetime = Field(description="Published date of the price target.") news_url: Optional[str] = Field( default=None, description="News URL of the price target." diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/price_target_consensus.py b/openbb_platform/platform/provider/openbb_provider/standard_models/price_target_consensus.py index 24f83d706363..1a0fcb6c7ea6 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/price_target_consensus.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/price_target_consensus.py @@ -7,7 +7,7 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams -from openbb_provider.utils.descriptions import QUERY_DESCRIPTIONS +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS, QUERY_DESCRIPTIONS class PriceTargetConsensusQueryParams(QueryParams): @@ -26,7 +26,7 @@ def upper_symbol(cls, v: Union[str, List[str], Set[str]]): class PriceTargetConsensusData(Data): """Price target consensus Data.""" - symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", "")) + symbol: str = Field(description=DATA_DESCRIPTIONS.get("symbol", "")) target_high: Optional[float] = Field( default=None, description="High target of the price target consensus." ) diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/recent_performance.py b/openbb_platform/platform/provider/openbb_provider/standard_models/recent_performance.py index b8378e26dd39..9be64954e3ae 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/recent_performance.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/recent_performance.py @@ -6,12 +6,13 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams +from openbb_provider.utils.descriptions import QUERY_DESCRIPTIONS class RecentPerformanceQueryParams(QueryParams): """Recent Performance Query Params.""" - symbol: str = Field(description="The ticker symbol to fetch.") + symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", "")) @field_validator("symbol") @classmethod diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/sector_pe.py b/openbb_platform/platform/provider/openbb_provider/standard_models/sector_pe.py index 1faf69d44518..4fd99ee75172 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/sector_pe.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/sector_pe.py @@ -7,6 +7,7 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS class SectorPEQueryParams(QueryParams): @@ -17,7 +18,7 @@ class SectorPEData(Data): """Sector Price to Earnings Ratio Data.""" date: Optional[dateType] = Field( - description="The date of the P/E ratio.", default=None + description=DATA_DESCRIPTIONS.get("date", ""), default=None ) exchange: Optional[str] = Field( default=None, description="The exchange where the data is from." diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/share_statistics.py b/openbb_platform/platform/provider/openbb_provider/standard_models/share_statistics.py index 1eaba35ba05e..e159eb72d15d 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/share_statistics.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/share_statistics.py @@ -8,7 +8,7 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams -from openbb_provider.utils.descriptions import QUERY_DESCRIPTIONS +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS, QUERY_DESCRIPTIONS class ShareStatisticsQueryParams(QueryParams): @@ -27,9 +27,9 @@ def upper_symbol(cls, v: Union[str, List[str], Set[str]]): class ShareStatisticsData(Data): """Return Share Statistics Data.""" - symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", "")) + symbol: str = Field(description=DATA_DESCRIPTIONS.get("symbol", "")) date: Optional[dateType] = Field( - default=None, description=QUERY_DESCRIPTIONS.get("date", "") + default=None, description=DATA_DESCRIPTIONS.get("date", "") ) free_float: Optional[float] = Field( default=None, diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/sp500_multiples.py b/openbb_platform/platform/provider/openbb_provider/standard_models/sp500_multiples.py index 1ae96a128415..45a154195cd0 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/sp500_multiples.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/sp500_multiples.py @@ -6,6 +6,7 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS, QUERY_DESCRIPTIONS class SP500MultiplesQueryParams(QueryParams): @@ -53,10 +54,10 @@ class SP500MultiplesQueryParams(QueryParams): default="PE Ratio by Month", ) start_date: Optional[str] = Field( - description="The start date of the time series. Format: YYYY-MM-DD", default="" + description=QUERY_DESCRIPTIONS.get("start_date", ""), default="" ) end_date: Optional[str] = Field( - description="The end date of the time series. Format: YYYY-MM-DD", default="" + description=QUERY_DESCRIPTIONS.get("end_date", ""), default="" ) collapse: Optional[ Literal["daily", "weekly", "monthly", "quarterly", "annual"] @@ -73,5 +74,5 @@ class SP500MultiplesQueryParams(QueryParams): class SP500MultiplesData(Data): """SP500 Multiples Data.""" - date: str = Field(description="The date data for the time series.") + date: str = Field(description=DATA_DESCRIPTIONS.get("date", "")) value: float = Field(description="The data value for the time series.") diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/stock_info.py b/openbb_platform/platform/provider/openbb_provider/standard_models/stock_info.py index d689e43d5e21..a1e14a9e50ff 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/stock_info.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/stock_info.py @@ -7,11 +7,11 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams -from openbb_provider.utils.descriptions import QUERY_DESCRIPTIONS +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS, QUERY_DESCRIPTIONS class StockInfoQueryParams(QueryParams): - """Stock Info Query Params""" + """Stock Info Query Params.""" symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", "")) @@ -26,20 +26,20 @@ def upper_symbol(cls, v: Union[str, List[str], Set[str]]): class StockInfoData(Data): """Stock Info Data.""" - symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", "")) + symbol: str = Field(description=DATA_DESCRIPTIONS.get("symbol", "")) name: str = Field(description="Name associated with the ticker symbol.") price: Optional[float] = Field(default=None, description="Last transaction price.") open: Optional[float] = Field( - default=None, description="Opening price of the stock." + default=None, description=DATA_DESCRIPTIONS.get("open", "") ) high: Optional[float] = Field( - default=None, description="High price of the current trading day." + default=None, description=DATA_DESCRIPTIONS.get("high", "") ) low: Optional[float] = Field( - default=None, description="Low price of the current trading day." + default=None, description=DATA_DESCRIPTIONS.get("low", "") ) close: Optional[float] = Field( - default=None, description="Closing price of the most recent trading day." + default=None, description=DATA_DESCRIPTIONS.get("close", "") ) change: Optional[float] = Field( default=None, description="Change in price over the current trading period." diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/stock_insider_trading.py b/openbb_platform/platform/provider/openbb_provider/standard_models/stock_insider_trading.py index 04c323e05aa0..76b7ffd95dda 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/stock_insider_trading.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/stock_insider_trading.py @@ -8,7 +8,7 @@ from openbb_provider.abstract.data import Data, StrictInt from openbb_provider.abstract.query_params import QueryParams -from openbb_provider.utils.descriptions import QUERY_DESCRIPTIONS +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS, QUERY_DESCRIPTIONS TRANSACTION_TYPES = Literal[ "A-Award", @@ -62,7 +62,7 @@ def upper_symbol(cls, v: Union[str, List[str], Set[str]]): class StockInsiderTradingData(Data): """Stock Insider Trading Data.""" - symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", "")) + symbol: str = Field(description=DATA_DESCRIPTIONS.get("symbol", "")) filing_date: datetime = Field( description="Filing date of the stock insider trading." ) diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/stock_news.py b/openbb_platform/platform/provider/openbb_provider/standard_models/stock_news.py index 458d48efd9d0..426d89c8fd13 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/stock_news.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/stock_news.py @@ -8,14 +8,19 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS, QUERY_DESCRIPTIONS class StockNewsQueryParams(QueryParams): """Stock news query.""" - symbols: str = Field(min_length=1, description="Comma separated list of symbols.") + symbols: str = Field( + min_length=1, + description=QUERY_DESCRIPTIONS.get("symbols", "") + + " Here it is a separated list of symbols.", + ) limit: Optional[NonNegativeInt] = Field( - default=20, description="Number of results to return per page." + default=20, description=QUERY_DESCRIPTIONS.get("limit", "") ) @field_validator("symbols", mode="before") @@ -28,7 +33,10 @@ def symbols_validate(cls, v: str): # pylint: disable=E0213 class StockNewsData(Data): """Stock News data.""" - date: datetime = Field(description="Published date of the news.") + date: datetime = Field( + description=DATA_DESCRIPTIONS.get("date", "") + + " Here it is the date of the news." + ) title: str = Field(description="Title of the news.") image: Optional[str] = Field(default=None, description="Image URL of the news.") text: Optional[str] = Field(default=None, description="Text/body of the news.") diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/stock_ownership.py b/openbb_platform/platform/provider/openbb_provider/standard_models/stock_ownership.py index dcc9be5970e3..2cbc68440d96 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/stock_ownership.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/stock_ownership.py @@ -47,7 +47,7 @@ class StockOwnershipData(Data): ..., description="Investor name of the stock ownership.", ) - symbol: str = Field(description="Symbol of the stock ownership.") + symbol: str = Field(description=DATA_DESCRIPTIONS.get("symbol", "")) security_name: str = Field( ..., description="Security name of the stock ownership.", diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/stock_quote.py b/openbb_platform/platform/provider/openbb_provider/standard_models/stock_quote.py index 05e1ad17bb41..a5c7428800dd 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/stock_quote.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/stock_quote.py @@ -7,12 +7,16 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS, QUERY_DESCRIPTIONS class StockQuoteQueryParams(QueryParams): """Stock Quote query model.""" - symbol: str = Field(description="Comma separated list of symbols.") + symbol: str = Field( + description=QUERY_DESCRIPTIONS.get("symbol", "") + + " In this case, the comma separated list of symbols." + ) @field_validator("symbol", mode="before", check_fields=False) def upper_symbol(cls, v: Union[str, List[str], Set[str]]): @@ -34,5 +38,5 @@ class StockQuoteData(Data): description="Highest price of the stock in the current trading day.", ) date: Optional[datetime] = Field( - description="Timestamp of the stock quote.", default=None + description=DATA_DESCRIPTIONS.get("date", ""), default=None ) diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/stock_search.py b/openbb_platform/platform/provider/openbb_provider/standard_models/stock_search.py index f6c060546850..1f21cbafc588 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/stock_search.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/stock_search.py @@ -6,11 +6,11 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams -from openbb_provider.utils.descriptions import QUERY_DESCRIPTIONS +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS class StockSearchQueryParams(QueryParams): - """Company Search Query Params""" + """Company Search Query Params.""" query: str = Field(description="Search query.", default="") is_symbol: bool = Field( @@ -21,7 +21,7 @@ class StockSearchQueryParams(QueryParams): class StockSearchData(Data): """Company Search Data.""" - symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", "")) + symbol: str = Field(description=DATA_DESCRIPTIONS.get("symbol", "")) name: str = Field(description="Name of the company.") @field_validator("symbol", mode="before", check_fields=False) diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/stock_splits.py b/openbb_platform/platform/provider/openbb_provider/standard_models/stock_splits.py index a6e9208cedc5..26eaa2500984 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/stock_splits.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/stock_splits.py @@ -8,7 +8,7 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams -from openbb_provider.utils.descriptions import QUERY_DESCRIPTIONS +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS, QUERY_DESCRIPTIONS class StockSplitCalendarQueryParams(QueryParams): @@ -25,8 +25,8 @@ class StockSplitCalendarQueryParams(QueryParams): class StockSplitCalendarData(Data): """Stock Split Calendar data.""" - date: dateType = Field(description="Date of the stock splits.") + date: dateType = Field(description=DATA_DESCRIPTIONS.get("date", "")) label: str = Field(description="Label of the stock splits.") - symbol: str = Field(description="Symbol of the company.") + symbol: str = Field(description=DATA_DESCRIPTIONS.get("symbol", "")) numerator: float = Field(description="Numerator of the stock splits.") denominator: float = Field(description="Denominator of the stock splits.") diff --git a/openbb_platform/platform/provider/openbb_provider/standard_models/us_yield_curve.py b/openbb_platform/platform/provider/openbb_provider/standard_models/us_yield_curve.py index 05507fb03dff..fdebb3d9563a 100644 --- a/openbb_platform/platform/provider/openbb_provider/standard_models/us_yield_curve.py +++ b/openbb_platform/platform/provider/openbb_provider/standard_models/us_yield_curve.py @@ -8,6 +8,7 @@ from openbb_provider.abstract.data import Data from openbb_provider.abstract.query_params import QueryParams +from openbb_provider.utils.descriptions import QUERY_DESCRIPTIONS class USYieldCurveQueryParams(QueryParams): @@ -15,7 +16,8 @@ class USYieldCurveQueryParams(QueryParams): date: Optional[dateType] = Field( default=None, - description="Date to get Yield Curve data. Defaults to the most recent FRED entry.", + description=QUERY_DESCRIPTIONS.get("date", "") + + " Defaults to the most recent FRED entry.", ) inflation_adjusted: Optional[bool] = Field( default=False, description="Get inflation adjusted rates." diff --git a/openbb_platform/platform/provider/openbb_provider/utils/helpers.py b/openbb_platform/platform/provider/openbb_provider/utils/helpers.py index ae60edb80157..fd75d54d1d03 100644 --- a/openbb_platform/platform/provider/openbb_provider/utils/helpers.py +++ b/openbb_platform/platform/provider/openbb_provider/utils/helpers.py @@ -122,8 +122,9 @@ def to_snake_case(string: str) -> str: def to_camel_case(string: str): - """Convert a string to camel case. If all characters are lower case we return title - version of the string. + """Convert a string to camel case. + + If all characters are lower case we return title version of the string. Examples -------- diff --git a/openbb_platform/platform/provider/tests/.gitkeep b/openbb_platform/platform/provider/tests/.gitkeep deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/openbb_platform/platform/provider/tests/abstract/test_data.py b/openbb_platform/platform/provider/tests/abstract/test_data.py new file mode 100644 index 000000000000..00b15416437a --- /dev/null +++ b/openbb_platform/platform/provider/tests/abstract/test_data.py @@ -0,0 +1,43 @@ +"""Test the Data.""" + +# pylint: disable=C2801 + +import pytest +from openbb_provider.abstract.data import Data, check_int + + +def test_check_int_valid(): + """Test if the check_int function returns the value when it is an int.""" + assert check_int(10) == 10 + + +def test_check_int_invalid(): + """Test if the check_int function raises an error when the value is not an int.""" + with pytest.raises(TypeError): + check_int("not_an_integer") + + +def test_data_model(): + """Test the Data model.""" + some_data = Data(test="test") + + assert some_data.test == "test" + assert not some_data.__alias_dict__ + assert some_data.__repr__() == "Data(test=test)" + assert some_data.model_dump() == {"test": "test"} + + +def test_data_model_alias(): + """Test the Data model with an alias.""" + + class SomeData(Data): + """Some data.""" + + __alias_dict__ = {"test_alias": "test"} + + some_data = SomeData(test="Hello") + + assert some_data.__alias_dict__ == {"test_alias": "test"} + assert some_data.__repr__() == "SomeData(test_alias=Hello)" + assert some_data.model_dump() == {"test_alias": "Hello"} + assert some_data.test_alias == "Hello" diff --git a/openbb_platform/platform/provider/tests/abstract/test_fetcher.py b/openbb_platform/platform/provider/tests/abstract/test_fetcher.py new file mode 100644 index 000000000000..4a357c3c53f1 --- /dev/null +++ b/openbb_platform/platform/provider/tests/abstract/test_fetcher.py @@ -0,0 +1,68 @@ +"""Test the Fetcher.""" + +from typing import Any, Dict, List, Optional + +from openbb_provider.abstract.fetcher import Data, Fetcher, QueryParams + +# Step 1: Create a dummy subclass of Fetcher + + +class MockData(Data): + """Mock data class.""" + + +class MockQueryParams(QueryParams): + """Mock query params class.""" + + +class MockFetcher(Fetcher[MockQueryParams, List[MockData]]): + """Mock fetcher class.""" + + @staticmethod + def transform_query(params: Dict[str, Any]) -> MockQueryParams: + """Transform the params to the provider-specific query.""" + return MockQueryParams() + + @staticmethod + def extract_data( + query: MockQueryParams, credentials: Optional[Dict[str, str]] + ) -> Any: + """Extract the data from the provider.""" + return [{"mock_key": "mock_value"}] # Mocking a data response + + @staticmethod + def transform_data(query: MockQueryParams, data: Any, **kwargs) -> List[MockData]: + """Transform the provider-specific data.""" + return [MockData(**item) for item in data] + + +def test_fetcher_methods(): + """Test the Fetcher abstract methods using a mock Fetcher subclass.""" + params = {"param1": "value1"} + mock_fetcher = MockFetcher() + + fetched_data = mock_fetcher.fetch_data(params=params) + assert isinstance(fetched_data, list) + assert isinstance(fetched_data[0], MockData) + assert fetched_data[0].model_dump() == {"mock_key": "mock_value"} + + +def test_fetcher_query_params_type(): + """Test the query_params_type classproperty.""" + assert MockFetcher.query_params_type == MockQueryParams + + +def test_fetcher_return_type(): + """Test the return_type classproperty.""" + assert MockFetcher.return_type == List[MockData] + + +def test_fetcher_data_type(): + """Test the data_type classproperty.""" + assert MockFetcher.data_type == MockData + + +def test_fetcher_test(): + """Test the test method.""" + tested = MockFetcher.test(params={}) + assert tested is None diff --git a/openbb_platform/platform/provider/tests/abstract/test_provider.py b/openbb_platform/platform/provider/tests/abstract/test_provider.py new file mode 100644 index 000000000000..60e5507659ce --- /dev/null +++ b/openbb_platform/platform/provider/tests/abstract/test_provider.py @@ -0,0 +1,44 @@ +"""Test the Provider.""" + +from openbb_provider.abstract.provider import Provider + + +def test_provider_initialization(): + """Test the basic initialization of the Provider class.""" + provider = Provider(name="TestProvider", description="A simple test provider.") + + assert provider.name == "TestProvider" + assert provider.description == "A simple test provider." + assert provider.website is None + assert provider.required_credentials == [] + assert provider.fetcher_dict == {} + + +def test_provider_with_optional_parameters(): + """Test the initialization of the Provider class with optional parameters.""" + provider = Provider( + name="TestProvider", + description="A simple test provider.", + website="https://testprovider.example.com", + required_credentials=["api_key"], + fetcher_dict={"fetcher1": None}, + ) + + assert provider.name == "TestProvider" + assert provider.description == "A simple test provider." + assert provider.website == "https://testprovider.example.com" + assert provider.required_credentials == ["testprovider_api_key"] + assert provider.fetcher_dict == {"fetcher1": None} + + +def test_provider_required_credentials_formatting(): + """Test the formatting of required credentials.""" + required_credentials = ["key1", "key2"] + provider = Provider( + name="TestProvider", + description="A simple test provider.", + required_credentials=required_credentials, + ) + + expected_credentials = ["testprovider_key1", "testprovider_key2"] + assert provider.required_credentials == expected_credentials diff --git a/openbb_platform/platform/provider/tests/abstract/test_query_params.py b/openbb_platform/platform/provider/tests/abstract/test_query_params.py new file mode 100644 index 000000000000..5c668f200a10 --- /dev/null +++ b/openbb_platform/platform/provider/tests/abstract/test_query_params.py @@ -0,0 +1,30 @@ +"""Test QueryParams.""" + +from openbb_provider.abstract.query_params import QueryParams + + +def test_query_params_repr(): + """Test the __repr__ method of QueryParams.""" + params = QueryParams(param1="value1", param2="value2") + assert "param1='value1'" in str(params) + assert "param2='value2'" in str(params) + + +def test_query_params_no_alias(): + """Test model_dump without aliases.""" + params = QueryParams(param1="value1", param2="value2") + dumped_params = params.model_dump() + + assert dumped_params == {"param1": "value1", "param2": "value2"} + + +def test_query_params_with_alias(): + """Test model_dump with aliases.""" + + class AliasedQueryParams(QueryParams): + __alias_dict__ = {"param1": "alias1"} + + params = AliasedQueryParams(param1="value1", param2="value2") + dumped_params = params.model_dump() + + assert dumped_params == {"alias1": "value1", "param2": "value2"} diff --git a/openbb_platform/platform/provider/tests/standard_models/test_standard_models.py b/openbb_platform/platform/provider/tests/standard_models/test_standard_models.py new file mode 100644 index 000000000000..157a5269ea92 --- /dev/null +++ b/openbb_platform/platform/provider/tests/standard_models/test_standard_models.py @@ -0,0 +1,57 @@ +"""Test the standard models.""" +# pylint: disable=W0401 + +import inspect +from importlib import import_module +from pathlib import Path + +import pytest +from openbb_provider.abstract.fetcher import Data, QueryParams +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS, QUERY_DESCRIPTIONS +from pydantic.fields import FieldInfo + +models_path = ( + Path(__file__).parent.parent.parent / "openbb_provider" / "standard_models" +).resolve() +model_files = models_path.glob("*.py") + +standard_models = [] +for model_file in model_files: + if model_file.stem == "__init__": + continue + + model_module = import_module(f"openbb_provider.standard_models.{model_file.stem}") + + for _, obj in inspect.getmembers(model_module): + if inspect.isclass(obj) and ( + issubclass(obj, Data) or issubclass(obj, QueryParams) + ): + if "abstract" in obj.__module__: + continue + standard_models.append(obj) + + +@pytest.mark.parametrize("standard_model", standard_models) +def test_standard_models(standard_model): + """Test the standard models.""" + assert issubclass(standard_model, Data) or issubclass( + standard_model, QueryParams + ), f"{standard_model.__name__} should be a subclass of Data or QueryParams" + + fields = standard_model.model_fields + + for name, field in fields.items(): + assert isinstance( + field, FieldInfo + ), f"Field {name} should be a ModelField instance" + if "QueryParams" in standard_model.__name__: + if name in QUERY_DESCRIPTIONS: + assert QUERY_DESCRIPTIONS[name] in field.description, ( + f"Description for {name} is incorrect for the {standard_model.__name__}.\n" + f"Please modify or change the field name to a non-reserved name." + ) + elif name in DATA_DESCRIPTIONS: + assert DATA_DESCRIPTIONS[name] in field.description, ( + f"Description for {name} is incorrect for the {standard_model.__name__}.\n" + f"Please modify or change the field name to a non-reserved name." + ) diff --git a/openbb_platform/platform/provider/tests/test_query_executor.py b/openbb_platform/platform/provider/tests/test_query_executor.py new file mode 100644 index 000000000000..a793630c16dc --- /dev/null +++ b/openbb_platform/platform/provider/tests/test_query_executor.py @@ -0,0 +1,88 @@ +"""Test the Query Executor.""" +# pylint: disable=W0621 + +from unittest.mock import MagicMock, patch + +import pytest +from openbb_provider.abstract.fetcher import Fetcher +from openbb_provider.abstract.provider import Provider +from openbb_provider.query_executor import QueryExecutor +from openbb_provider.utils.errors import ProviderError +from pydantic import SecretStr + + +@pytest.fixture +def mock_query_executor(): + """Mock the query executor.""" + registry = MagicMock() + registry.providers = { + "test_provider": Provider( + name="Test", + description="Test provider", + fetcher_dict={"test_fetcher": Fetcher}, + ), + } + executor = QueryExecutor(registry=registry) + return executor + + +def test_get_provider_success(mock_query_executor): + """Test if the method can retrieve a provider successfully.""" + provider = mock_query_executor.get_provider("test_provider") + assert provider.name == "Test" + + +def test_get_provider_failure(mock_query_executor): + """Test if the method fails properly when the provider does not exist.""" + with pytest.raises(ProviderError, match="Provider 'nonexistent' not found"): + mock_query_executor.get_provider("nonexistent") + + +def test_get_fetcher_success(mock_query_executor): + """Test if the method can retrieve a fetcher successfully.""" + provider = mock_query_executor.get_provider("test_provider") + fetcher = mock_query_executor.get_fetcher(provider, "test_fetcher") + assert issubclass(fetcher, Fetcher) + + +def test_get_fetcher_failure(mock_query_executor): + """Test if the method fails properly when the fetcher does not exist.""" + provider = mock_query_executor.get_provider("test_provider") + with pytest.raises(ProviderError, match="Fetcher not found"): + mock_query_executor.get_fetcher(provider, "nonexistent_fetcher") + + +def test_filter_credentials_success(mock_query_executor): + """Test if credentials are properly filtered.""" + provider = mock_query_executor.get_provider("test_provider") + provider.required_credentials = ["api_key"] + credentials = {"api_key": SecretStr("12345")} + + filtered_credentials = mock_query_executor.filter_credentials(provider, credentials) + + assert filtered_credentials == {"api_key": "12345"} + + +def test_filter_credentials_missing(mock_query_executor): + """Test if the proper error is raised when a credential is missing.""" + provider = mock_query_executor.get_provider("test_provider") + provider.required_credentials = ["api_key"] + + with pytest.raises(ProviderError, match="Missing credential"): + mock_query_executor.filter_credentials(provider, {}) + + +def test_execute_success(mock_query_executor): + """Test if the method can execute a query successfully.""" + mock_result = {"data": "test_data"} + + params = {"param1": "value1"} + credentials = {"api_key": SecretStr("12345")} + + with patch.object(Fetcher, "fetch_data", return_value=mock_result) as mock_fetch: + result = mock_query_executor.execute( + "test_provider", "test_fetcher", params, credentials + ) + + assert result == mock_result + mock_fetch.assert_called_once_with(params, {}, **{}) diff --git a/openbb_platform/platform/provider/tests/test_registry.py b/openbb_platform/platform/provider/tests/test_registry.py new file mode 100644 index 000000000000..4afd3378d7f5 --- /dev/null +++ b/openbb_platform/platform/provider/tests/test_registry.py @@ -0,0 +1,30 @@ +"""Test the Registry.""" + +from openbb_provider.abstract.provider import Provider +from openbb_provider.registry import Registry, RegistryLoader + + +def test_registry(): + """Test the registry.""" + registry = Registry() + assert registry.providers == {} + + mock_provider = Provider(name="TestProvider", description="Just a test provider.") + registry.include_provider(mock_provider) + + assert "testprovider" in registry.providers + assert registry.providers["testprovider"] == mock_provider + + +def test_registry_loader_integration(): + """Execute the loading process.""" + core_providers = ["fmp", "polygon", "fred", "benzinga", "intrinio"] + registry = RegistryLoader.from_extensions() + + assert len(registry.providers) > 0 + + for provider in core_providers: + assert provider in registry.providers + + for provider in registry.providers.values(): + assert isinstance(provider, Provider) diff --git a/openbb_platform/platform/provider/tests/test_registry_map.py b/openbb_platform/platform/provider/tests/test_registry_map.py new file mode 100644 index 000000000000..3782e84f3c70 --- /dev/null +++ b/openbb_platform/platform/provider/tests/test_registry_map.py @@ -0,0 +1,37 @@ +"""Test the registry map.""" +# pylint: disable=W0621 + +import pytest +from openbb_provider.registry_map import RegistryMap + + +@pytest.fixture +def load_registry_map(): + """Mock the registry map.""" + registry_map = RegistryMap() + return registry_map + + +def test_get_required_credentials(load_registry_map): + """Test if the _get_required_credentials method behaves as expected.""" + required_creds = load_registry_map.required_credentials + + assert "fmp_api_key" in required_creds + + +def test_get_available_providers(load_registry_map): + """Test if the _get_available_providers method behaves as expected.""" + available_providers = load_registry_map.available_providers + + assert "fmp" in available_providers + assert len(available_providers) > 0 + + +def test_map_and_models(load_registry_map): + """Test if the _get_map method behaves as expected.""" + map_, return_map = load_registry_map.map, load_registry_map.return_map + models = load_registry_map.models + + assert "StockHistorical" in map_ + assert "StockHistorical" in return_map + assert "StockHistorical" in models diff --git a/openbb_platform/platform/provider/tests/utils/test_descriptions.py b/openbb_platform/platform/provider/tests/utils/test_descriptions.py new file mode 100644 index 000000000000..97155a8b24e1 --- /dev/null +++ b/openbb_platform/platform/provider/tests/utils/test_descriptions.py @@ -0,0 +1,13 @@ +"""Test the provider descriptions.""" + +from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS, QUERY_DESCRIPTIONS + + +def test_query_descriptions(): + """Test the query descriptions.""" + assert QUERY_DESCRIPTIONS + + +def test_data_descriptions(): + """Test the data descriptions.""" + assert DATA_DESCRIPTIONS diff --git a/openbb_platform/platform/provider/tests/utils/test_errors.py b/openbb_platform/platform/provider/tests/utils/test_errors.py new file mode 100644 index 000000000000..ec370be7eaa4 --- /dev/null +++ b/openbb_platform/platform/provider/tests/utils/test_errors.py @@ -0,0 +1,38 @@ +"""Test custom errors.""" + +import pytest +from openbb_provider.utils.errors import EmptyDataError, ProviderError + + +def function_that_raises_provider_error(): + """Raise a ProviderError.""" + raise ProviderError("An error occurred in the provider.") + + +def function_that_raises_empty_data_error(): + """Raise an EmptyDataError.""" + raise EmptyDataError() + + +def test_provider_error_is_raised(): + """Test if the ProviderError is raised.""" + with pytest.raises(ProviderError) as exc_info: + function_that_raises_provider_error() + assert str(exc_info.value) == "An error occurred in the provider." + + +def test_empty_data_error_is_raised(): + """Test if the EmptyDataError is raised.""" + with pytest.raises(EmptyDataError) as exc_info: + function_that_raises_empty_data_error() + assert ( + str(exc_info.value) == "No results found. Try adjusting the query parameters." + ) + + +def test_empty_data_error_custom_message(): + """Test if the EmptyDataError is raised with a custom message.""" + custom_message = "Custom message for no data." + with pytest.raises(EmptyDataError) as exc_info: + raise EmptyDataError(custom_message) + assert str(exc_info.value) == custom_message diff --git a/openbb_platform/platform/provider/tests/utils/test_helpers.py b/openbb_platform/platform/provider/tests/utils/test_helpers.py new file mode 100644 index 000000000000..739c8a78683c --- /dev/null +++ b/openbb_platform/platform/provider/tests/utils/test_helpers.py @@ -0,0 +1,79 @@ +"""Test the provider helpers.""" + +import pytest +import requests +from openbb_provider.utils.helpers import ( + get_querystring, + get_user_agent, + make_request, + to_camel_case, + to_snake_case, +) + + +def test_get_querystring_exclude(): + """Test the get_querystring helper.""" + items = { + "key1": "value1", + "key2": "value2", + "key3": None, + "key4": ["value3", "value4"], + } + exclude = ["key2"] + + querystring = get_querystring(items, exclude) + assert querystring == "key1=value1&key4=value3&key4=value4" + + +def test_get_querystring_no_exclude(): + """Test the get_querystring helper with no exclude list.""" + items = { + "key1": "value1", + "key2": "value2", + "key3": None, + "key4": ["value3", "value4"], + } + + querystring = get_querystring(items, []) + assert querystring == "key1=value1&key2=value2&key4=value3&key4=value4" + + +def test_get_user_agent(): + """Test the get_user_agent helper.""" + user_agent = get_user_agent() + assert "Mozilla/5.0" in user_agent + + +def test_make_request(monkeypatch): + """Test the make_request helper.""" + + class MockResponse: + def __init__(self): + self.status_code = 200 + + def mock_get(*args, **kwargs): + """Mock the requests.get method.""" + return MockResponse() + + monkeypatch.setattr(requests, "get", mock_get) + + response = make_request("http://mock.url") + assert response.status_code == 200 + + with pytest.raises(ValueError): + make_request("http://mock.url", method="PUT") + + +def test_to_snake_case(): + """Test the to_snake_case helper.""" + assert to_snake_case("SomeRandomString") == "some_random_string" + assert to_snake_case("someRandomString") == "some_random_string" + assert to_snake_case("already_snake_case") == "already_snake_case" + + +def test_to_camel_case(): + """Test the to_camel_case helper.""" + assert to_camel_case("some_field") == "someField" + assert to_camel_case("alreadyCamelCase") == "alreadyCamelCase" + assert to_camel_case("close") == "Close" + assert not to_camel_case("") diff --git a/openbb_platform/providers/cboe/openbb_cboe/models/index_search.py b/openbb_platform/providers/cboe/openbb_cboe/models/index_search.py index fe4b24553f18..8412d0eb03ee 100644 --- a/openbb_platform/providers/cboe/openbb_cboe/models/index_search.py +++ b/openbb_platform/providers/cboe/openbb_cboe/models/index_search.py @@ -93,7 +93,7 @@ def extract_data( if query.europe is False: symbols = get_cboe_index_directory().reset_index() - target = "name" if not query.symbol else "symbol" + target = "name" if not query.is_symbol else "symbol" idx = symbols[target].str.contains(query.query, case=False) result = symbols[idx]