From 3ad3375c6ae096ff0a0bce842f2978580efb44ca Mon Sep 17 00:00:00 2001 From: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Date: Fri, 8 Sep 2023 12:11:46 +0100 Subject: [PATCH] fix missing descriptions (#5420) * fix missing descriptions * black & ruff * remove f string * update desc * update desc * update desc * update desc * update desc * update desc --- openbb_sdk/openbb/package/economy.py | 6 +-- openbb_sdk/openbb/package/extension_map.json | 2 +- openbb_sdk/openbb/package/news.py | 2 +- openbb_sdk/openbb/package/stocks.py | 36 +++++++-------- openbb_sdk/openbb/package/stocks_options.py | 20 ++++---- .../models/stock_historical.py | 2 +- .../openbb_benzinga/models/stock_news.py | 6 +-- .../models/european_index_historical.py | 2 +- .../models/major_indices_historical.py | 2 +- .../openbb_cboe/models/stock_historical.py | 2 +- .../models/major_indices_historical.py | 2 +- .../fmp/openbb_fmp/models/stock_historical.py | 2 +- .../openbb_intrinio/models/global_news.py | 2 +- .../openbb_intrinio/models/options_chains.py | 22 ++++----- .../models/stock_historical.py | 2 +- .../openbb_intrinio/models/stock_news.py | 2 +- .../openbb_polygon/models/stock_historical.py | 5 +- .../openbb_polygon/models/stock_news.py | 32 +++++-------- .../models/available_indices.py | 4 +- .../openbb_core/app/provider_interface.py | 46 ++++++++++++------- openbb_sdk/sdk/core/openbb_core/app/query.py | 2 +- 21 files changed, 99 insertions(+), 102 deletions(-) diff --git a/openbb_sdk/openbb/package/economy.py b/openbb_sdk/openbb/package/economy.py index 0c72399ab0e..12b5d5c5e98 100644 --- a/openbb_sdk/openbb/package/economy.py +++ b/openbb_sdk/openbb/package/economy.py @@ -65,7 +65,7 @@ class CLASS_economy(Container): region : Optional[str] Region for the index. Valid only for European indices (provider: cboe) symbol : Optional[str] - Symbol for the index. (provider: cboe) + Symbol for the index. (provider: cboe, yfinance) description : Optional[str] Description for the index. Valid only for US indices. (provider: cboe) data_delay : Optional[int] @@ -364,7 +364,7 @@ class CLASS_economy(Container): If None, the provider specified in defaults is selected or 'cboe' if there is no default. interval : Union[Literal['1d', '1m'], NoneType] - Use interval, 1m, for intraday prices during the most recent trading period. (provider: cboe) + Data granularity. (provider: cboe) Returns ------- @@ -532,7 +532,7 @@ class CLASS_economy(Container): If None, the provider specified in defaults is selected or 'cboe' if there is no default. interval : Union[Literal['1d', '1m'], NoneType, Literal['1min', '5min', '15min', '30min', '1hour', '4hour', '1day'], Literal['1m', '2m', '5m', '15m', '30m', '60m', '90m', '1h', '1d', '5d', '1wk', '1mo', '3mo']] - None + Data granularity. (provider: cboe, fmp, yfinance) timeseries : Union[pydantic.types.NonNegativeInt, NoneType] Number of days to look back. (provider: fmp) timespan : Literal['minute', 'hour', 'day', 'week', 'month', 'quarter', 'year'] diff --git a/openbb_sdk/openbb/package/extension_map.json b/openbb_sdk/openbb/package/extension_map.json index 3f7ce765fdf..b11b4e0560d 100644 --- a/openbb_sdk/openbb/package/extension_map.json +++ b/openbb_sdk/openbb/package/extension_map.json @@ -23,4 +23,4 @@ "quandl@0.1.0a0", "yfinance@0.1.0a0" ] -} +} \ No newline at end of file diff --git a/openbb_sdk/openbb/package/news.py b/openbb_sdk/openbb/package/news.py index 54c14aab342..ca86b4f4bae 100644 --- a/openbb_sdk/openbb/package/news.py +++ b/openbb_sdk/openbb/package/news.py @@ -113,7 +113,7 @@ class CLASS_news(Container): site : Optional[str] Site of the news. (provider: fmp) id : Optional[str] - Intrinio ID for the news article. (provider: intrinio) + Article ID. (provider: intrinio) company : Optional[Mapping[str, Any]] Company details related to the news article. (provider: intrinio)""" # noqa: E501 diff --git a/openbb_sdk/openbb/package/stocks.py b/openbb_sdk/openbb/package/stocks.py index 7fa05f325d0..49e3d986071 100644 --- a/openbb_sdk/openbb/package/stocks.py +++ b/openbb_sdk/openbb/package/stocks.py @@ -206,11 +206,11 @@ class CLASS_stocks(Container): If None, the provider specified in defaults is selected or 'alpha_vantage' if there is no default. period : Union[Literal['intraday', 'daily', 'weekly', 'monthly'], Literal['1d', '5d', '1mo', '3mo', '6mo', '1y', '2y', '5y', '10y', 'ytd', 'max'], NoneType] - None + Period of the data to return. (provider: alpha_vantage, yfinance) interval : Union[Literal['1min', '5min', '15min', '30min', '60min'], NoneType, Literal['1d', '1m'], Literal['1min', '5min', '15min', '30min', '1hour', '4hour', '1day'], Literal['1m', '2m', '5m', '15m', '30m', '60m', '90m', '1h', '1d', '5d', '1wk', '1mo', '3mo']] - None + Data granularity. (provider: alpha_vantage, cboe, fmp, yfinance) adjusted : Union[bool, NoneType] - None + Output time series is adjusted by historical split and dividend events. (provider: alpha_vantage, polygon) extended_hours : Union[bool, NoneType] Extended trading hours during pre-market and after-hours. (provider: alpha_vantage) month : Union[str, NoneType] @@ -230,7 +230,7 @@ class CLASS_stocks(Container): interval_size : Union[Literal['1m', '5m', '10m', '15m', '30m', '60m', '1h'], NoneType] The data time frequency. (provider: intrinio) limit : Union[pydantic.types.NonNegativeInt, NoneType, pydantic.types.PositiveInt] - None + The number of data entries to return. (provider: intrinio, polygon) next_page : Union[str, NoneType] Token to get the next page of data from a previous API call. (provider: intrinio) all_pages : Union[bool, NoneType] @@ -295,7 +295,7 @@ class CLASS_stocks(Container): unadjusted_volume : Optional[float] Unadjusted volume of the symbol. (provider: fmp) change : Optional[float] - Change in the price of the symbol from the previous day. (provider: fmp) + Change in the price of the symbol from the previous day. (provider: fmp, intrinio) change_percent : Optional[float] Change \\% in the price of the symbol. (provider: fmp) label : Optional[str] @@ -565,7 +565,7 @@ class CLASS_stocks(Container): published_since : Union[int, NoneType] Number of seconds since the news was published. (provider: benzinga) sort : Union[Literal['published_at', 'updated_at', 'title', 'author', 'channel', 'ticker', 'topic', 'content_type'], NoneType, str] - None + Order in which to sort the news. (provider: benzinga, polygon) isin : Union[str, NoneType] The ISIN of the news to retrieve. (provider: benzinga) cusip : Union[str, NoneType] @@ -583,25 +583,25 @@ class CLASS_stocks(Container): all_pages : Union[bool, NoneType] Returns all pages of data from the API call at once. (provider: intrinio) ticker_lt : Union[str, NoneType] - Less than, by default None (provider: polygon) + Less than. (provider: polygon) ticker_lte : Union[str, NoneType] - Less than or equal, by default None (provider: polygon) + Less than or equal. (provider: polygon) ticker_gt : Union[str, NoneType] - Greater than, by default None (provider: polygon) + Greater than. (provider: polygon) ticker_gte : Union[str, NoneType] - Greater than or equal, by default None (provider: polygon) + Greater than or equal. (provider: polygon) published_utc : Union[str, NoneType] - Published date of the query, by default None (provider: polygon) + Published date of the query. (provider: polygon) published_utc_lt : Union[str, NoneType] - Less than, by default None (provider: polygon) + Less than. (provider: polygon) published_utc_lte : Union[str, NoneType] - Less than or equal, by default None (provider: polygon) + Less than or equal. (provider: polygon) published_utc_gt : Union[str, NoneType] - Greater than, by default None (provider: polygon) + Greater than. (provider: polygon) published_utc_gte : Union[str, NoneType] - Greater than or equal, by default None (provider: polygon) + Greater than or equal. (provider: polygon) order : Union[Literal['asc', 'desc'], NoneType] - Sort order of the query, by default None (provider: polygon) + Sort order of the query. (provider: polygon) Returns ------- @@ -644,7 +644,7 @@ class CLASS_stocks(Container): site : Optional[str] Name of the news source. (provider: fmp) id : Optional[str] - Intrinio ID for the news article. (provider: intrinio) + Article ID. (provider: intrinio, polygon) amp_url : Optional[str] AMP URL. (provider: polygon) author : Optional[str] @@ -654,7 +654,7 @@ class CLASS_stocks(Container): keywords : Optional[List[str]] Keywords in the article (provider: polygon) publisher : Union[PolygonPublisher, NoneType, str] - Publisher of the article. (provider: polygon) + Publisher of the article. (provider: polygon, yfinance) tickers : Optional[List[str]] Tickers covered in the article. (provider: polygon) uuid : Optional[str] diff --git a/openbb_sdk/openbb/package/stocks_options.py b/openbb_sdk/openbb/package/stocks_options.py index df099faaf7a..9363e2ddc7b 100644 --- a/openbb_sdk/openbb/package/stocks_options.py +++ b/openbb_sdk/openbb/package/stocks_options.py @@ -80,11 +80,11 @@ class CLASS_stocks_options(Container): theoretical : Optional[float] Theoretical value of the option. (provider: cboe) open : Optional[float] - Opening price of the option. (provider: cboe) + Opening price of the option. (provider: cboe, intrinio) high : Optional[float] - High price of the option. (provider: cboe) + High price of the option. (provider: cboe, intrinio) low : Optional[float] - Low price of the option. (provider: cboe) + Low price of the option. (provider: cboe, intrinio) last_trade_price : Optional[float] Last trade price of the option. (provider: cboe) tick : Optional[str] @@ -96,21 +96,21 @@ class CLASS_stocks_options(Container): change_percent : Optional[float] Change, in percent, of the option. (provider: cboe) implied_volatility : Optional[float] - Implied volatility of the option. (provider: cboe) + Implied volatility of the option. (provider: cboe, intrinio) delta : Optional[float] - Delta of the option. (provider: cboe) + Delta of the option. (provider: cboe, intrinio) gamma : Optional[float] - Gamma of the option. (provider: cboe) + Gamma of the option. (provider: cboe, intrinio) vega : Optional[float] - Vega of the option. (provider: cboe) + Vega of the option. (provider: cboe, intrinio) theta : Optional[float] - Theta of the option. (provider: cboe) + Theta of the option. (provider: cboe, intrinio) rho : Optional[float] Rho of the option. (provider: cboe) last_trade_timestamp : Optional[datetime] Last trade timestamp of the option. (provider: cboe) dte : Optional[int] - Days to expiration for the option. (provider: cboe) + Days to expiration for the option. (provider: cboe, intrinio) mark : Optional[float] The mid-price between the latest bid-ask spread. (provider: intrinio) open_bid : Optional[float] @@ -126,7 +126,7 @@ class CLASS_stocks_options(Container): ask_high : Optional[float] The highest ask price for the option that day. (provider: intrinio) close : Optional[float] - The close price for the option that day. (provider: intrinio) + Close price for the option that day. (provider: intrinio) eod_date : Optional[date] Historical date for which the options chains data is from. (provider: intrinio) """ # noqa: E501 diff --git a/openbb_sdk/providers/alpha_vantage/openbb_alpha_vantage/models/stock_historical.py b/openbb_sdk/providers/alpha_vantage/openbb_alpha_vantage/models/stock_historical.py index fbbb402e14e..601df7ee269 100644 --- a/openbb_sdk/providers/alpha_vantage/openbb_alpha_vantage/models/stock_historical.py +++ b/openbb_sdk/providers/alpha_vantage/openbb_alpha_vantage/models/stock_historical.py @@ -38,7 +38,7 @@ class AVStockHistoricalQueryParams(StockHistoricalQueryParams): default="daily", description=QUERY_DESCRIPTIONS.get("period", "") ) interval: Optional[Literal["1min", "5min", "15min", "30min", "60min"]] = Field( - description="The interval between two consecutive data points in the time series.", + description="Data granularity.", default="60min", available_on_functions=["TIME_SERIES_INTRADAY"], required_on_functions=["TIME_SERIES_INTRADAY"], diff --git a/openbb_sdk/providers/benzinga/openbb_benzinga/models/stock_news.py b/openbb_sdk/providers/benzinga/openbb_benzinga/models/stock_news.py index 91efb44a491..cb63ea4e7f3 100644 --- a/openbb_sdk/providers/benzinga/openbb_benzinga/models/stock_news.py +++ b/openbb_sdk/providers/benzinga/openbb_benzinga/models/stock_news.py @@ -52,11 +52,7 @@ class BenzingaStockNewsQueryParams(StockNewsQueryParams): "topic", "content_type", ] - ] = Field( - default=None, - description="Order in which to sort the news. " - "Options are: published_at, updated_at, title, author, channel, ticker, topic, content_type.", - ) + ] = Field(default=None, description="Order in which to sort the news.") isin: Optional[str] = Field( default=None, description="The ISIN of the news to retrieve." ) diff --git a/openbb_sdk/providers/cboe/openbb_cboe/models/european_index_historical.py b/openbb_sdk/providers/cboe/openbb_cboe/models/european_index_historical.py index b5f35b81c92..38dfaeb3968 100644 --- a/openbb_sdk/providers/cboe/openbb_cboe/models/european_index_historical.py +++ b/openbb_sdk/providers/cboe/openbb_cboe/models/european_index_historical.py @@ -22,7 +22,7 @@ class CboeEuropeanIndexHistoricalQueryParams(EuropeanIndexHistoricalQueryParams) """ interval: Optional[Literal["1d", "1m"]] = Field( - description="Use interval, 1m, for intraday prices during the most recent trading period.", + description="Data granularity.", default="1d", ) diff --git a/openbb_sdk/providers/cboe/openbb_cboe/models/major_indices_historical.py b/openbb_sdk/providers/cboe/openbb_cboe/models/major_indices_historical.py index 3844367e5a1..4825a0f12a8 100644 --- a/openbb_sdk/providers/cboe/openbb_cboe/models/major_indices_historical.py +++ b/openbb_sdk/providers/cboe/openbb_cboe/models/major_indices_historical.py @@ -26,7 +26,7 @@ class CboeMajorIndicesHistoricalQueryParams(MajorIndicesHistoricalQueryParams): """ interval: Optional[Literal["1d", "1m"]] = Field( - description="Use interval, 1m, for intraday prices during the most recent trading period.", + description="Data granularity.", default="1d", ) diff --git a/openbb_sdk/providers/cboe/openbb_cboe/models/stock_historical.py b/openbb_sdk/providers/cboe/openbb_cboe/models/stock_historical.py index 95098ef5aba..8a34349d736 100644 --- a/openbb_sdk/providers/cboe/openbb_cboe/models/stock_historical.py +++ b/openbb_sdk/providers/cboe/openbb_cboe/models/stock_historical.py @@ -27,7 +27,7 @@ class CboeStockHistoricalQueryParams(StockHistoricalQueryParams): """ interval: Optional[Literal["1d", "1m"]] = Field( - description="Use interval, 1m, for intraday prices during the most recent trading period.", + description="Data granularity.", default="1d", ) diff --git a/openbb_sdk/providers/fmp/openbb_fmp/models/major_indices_historical.py b/openbb_sdk/providers/fmp/openbb_fmp/models/major_indices_historical.py index 6f401a3cbee..0042cf65a1d 100644 --- a/openbb_sdk/providers/fmp/openbb_fmp/models/major_indices_historical.py +++ b/openbb_sdk/providers/fmp/openbb_fmp/models/major_indices_historical.py @@ -26,7 +26,7 @@ class FMPMajorIndicesHistoricalQueryParams(MajorIndicesHistoricalQueryParams): ) interval: Literal[ "1min", "5min", "15min", "30min", "1hour", "4hour", "1day" - ] = Field(default="1day", description="Interval of the data to fetch.") + ] = Field(default="1day", description="Data granularity.") class FMPMajorIndicesHistoricalData(MajorIndicesHistoricalData): diff --git a/openbb_sdk/providers/fmp/openbb_fmp/models/stock_historical.py b/openbb_sdk/providers/fmp/openbb_fmp/models/stock_historical.py index 0191c0c2c23..685080e8c8c 100644 --- a/openbb_sdk/providers/fmp/openbb_fmp/models/stock_historical.py +++ b/openbb_sdk/providers/fmp/openbb_fmp/models/stock_historical.py @@ -26,7 +26,7 @@ class FMPStockHistoricalQueryParams(StockHistoricalQueryParams): ) interval: Literal[ "1min", "5min", "15min", "30min", "1hour", "4hour", "1day" - ] = Field(default="1day", description="Interval of the data to fetch.") + ] = Field(default="1day", description="Data granularity.") class FMPStockHistoricalData(StockHistoricalData): diff --git a/openbb_sdk/providers/intrinio/openbb_intrinio/models/global_news.py b/openbb_sdk/providers/intrinio/openbb_intrinio/models/global_news.py index 913754fc2a6..810a7e796f6 100644 --- a/openbb_sdk/providers/intrinio/openbb_intrinio/models/global_news.py +++ b/openbb_sdk/providers/intrinio/openbb_intrinio/models/global_news.py @@ -45,7 +45,7 @@ class IntrinioGlobalNewsData(GlobalNewsData): "text": "summary", } - id: str = Field(description="Intrinio ID for the news article.") + id: str = Field(description="Article ID.") company: Dict[str, Any] = Field( description="Company details related to the news article." ) diff --git a/openbb_sdk/providers/intrinio/openbb_intrinio/models/options_chains.py b/openbb_sdk/providers/intrinio/openbb_intrinio/models/options_chains.py index e8b20f497ee..24dcd7ca84c 100644 --- a/openbb_sdk/providers/intrinio/openbb_intrinio/models/options_chains.py +++ b/openbb_sdk/providers/intrinio/openbb_intrinio/models/options_chains.py @@ -273,23 +273,21 @@ class IntrinioOptionsChainsData(OptionsChainsData): ask_high: Optional[float] = Field( description="The highest ask price for the option that day." ) - open: Optional[float] = Field(description="The open price for the option that day.") - high: Optional[float] = Field(description="The high price for the option that day.") - low: Optional[float] = Field(description="The low price for the option that day.") - close: Optional[float] = Field( - description="The close price for the option that day." - ) + open: Optional[float] = Field(description="Opening price of the option.") + high: Optional[float] = Field(description="High price of the option.") + low: Optional[float] = Field(description="Low price of the option.") + close: Optional[float] = Field(description="Close price for the option that day.") implied_volatility: Optional[float] = Field( - description="The implied volatility for the option at the end of day." + description="Implied volatility of the option." ) - delta: Optional[float] = Field(description="The delta value at the end of day.") - gamma: Optional[float] = Field(description="The gamma value at the end of day.") - vega: Optional[float] = Field(description="The vega value at the end of day.") - theta: Optional[float] = Field(description="The theta value at the end of day.") + delta: Optional[float] = Field(description="Delta of the option.") + gamma: Optional[float] = Field(description="Gamma of the option.") + vega: Optional[float] = Field(description="Vega of the option.") + theta: Optional[float] = Field(description="Theta of the option.") eod_date: Optional[dateType] = Field( description="Historical date for which the options chains data is from.", ) - dte: Optional[int] = Field(description="The number of days until expiry.") + dte: Optional[int] = Field(description="Days to expiration for the option.") @validator("expiration", pre=True, check_fields=False) def date_validate(cls, v): # pylint: disable=E0213 diff --git a/openbb_sdk/providers/intrinio/openbb_intrinio/models/stock_historical.py b/openbb_sdk/providers/intrinio/openbb_intrinio/models/stock_historical.py index d178d1f4a02..01b8e631955 100644 --- a/openbb_sdk/providers/intrinio/openbb_intrinio/models/stock_historical.py +++ b/openbb_sdk/providers/intrinio/openbb_intrinio/models/stock_historical.py @@ -43,7 +43,7 @@ class IntrinioStockHistoricalQueryParams(StockHistoricalQueryParams): ) limit: Optional[NonNegativeInt] = Field( default=300, - description=f"{QUERY_DESCRIPTIONS.get('limit', '')}. Max value allowed is 300.", + description=f"{QUERY_DESCRIPTIONS.get('limit', '')}", ) next_page: Optional[str] = Field( description="Token to get the next page of data from a previous API call." diff --git a/openbb_sdk/providers/intrinio/openbb_intrinio/models/stock_news.py b/openbb_sdk/providers/intrinio/openbb_intrinio/models/stock_news.py index ae6a99466ee..876b341737c 100644 --- a/openbb_sdk/providers/intrinio/openbb_intrinio/models/stock_news.py +++ b/openbb_sdk/providers/intrinio/openbb_intrinio/models/stock_news.py @@ -54,7 +54,7 @@ class IntrinioStockNewsData(StockNewsData): "text": "summary", } - id: str = Field(description="Intrinio ID for the news article.") + id: str = Field(description="Article ID.") @validator("publication_date", pre=True, check_fields=False) def date_validate(cls, v): # pylint: disable=E0213 diff --git a/openbb_sdk/providers/polygon/openbb_polygon/models/stock_historical.py b/openbb_sdk/providers/polygon/openbb_polygon/models/stock_historical.py index 83467765fb6..aba6204262b 100644 --- a/openbb_sdk/providers/polygon/openbb_polygon/models/stock_historical.py +++ b/openbb_sdk/providers/polygon/openbb_polygon/models/stock_historical.py @@ -33,7 +33,10 @@ class PolygonStockHistoricalQueryParams(StockHistoricalQueryParams): limit: PositiveInt = Field( default=49999, description=QUERY_DESCRIPTIONS.get("limit", "") ) - adjusted: bool = Field(default=True, description="Whether the data is adjusted.") + adjusted: bool = Field( + default=True, + description="Output time series is adjusted by historical split and dividend events.", + ) multiplier: PositiveInt = Field( default=1, description="Multiplier of the timespan." ) diff --git a/openbb_sdk/providers/polygon/openbb_polygon/models/stock_news.py b/openbb_sdk/providers/polygon/openbb_polygon/models/stock_news.py index 617315ef15c..71c994a008d 100644 --- a/openbb_sdk/providers/polygon/openbb_polygon/models/stock_news.py +++ b/openbb_sdk/providers/polygon/openbb_polygon/models/stock_news.py @@ -23,38 +23,28 @@ class PolygonStockNewsQueryParams(StockNewsQueryParams): class Config: fields = {"symbols": "ticker"} - ticker_lt: Optional[str] = Field( - default=None, description="Less than, by default None" - ) - ticker_lte: Optional[str] = Field( - default=None, description="Less than or equal, by default None" - ) - ticker_gt: Optional[str] = Field( - default=None, description="Greater than, by default None" - ) + ticker_lt: Optional[str] = Field(default=None, description="Less than.") + ticker_lte: Optional[str] = Field(default=None, description="Less than or equal.") + ticker_gt: Optional[str] = Field(default=None, description="Greater than.") ticker_gte: Optional[str] = Field( - default=None, description="Greater than or equal, by default None" + default=None, description="Greater than or equal." ) published_utc: Optional[str] = Field( - default=None, description="Published date of the query, by default None" - ) - published_utc_lt: Optional[str] = Field( - default=None, description="Less than, by default None" + default=None, description="Published date of the query." ) + published_utc_lt: Optional[str] = Field(default=None, description="Less than.") published_utc_lte: Optional[str] = Field( - default=None, description="Less than or equal, by default None" - ) - published_utc_gt: Optional[str] = Field( - default=None, description="Greater than, by default None" + default=None, description="Less than or equal." ) + published_utc_gt: Optional[str] = Field(default=None, description="Greater than.") published_utc_gte: Optional[str] = Field( - default=None, description="Greater than or equal, by default None" + default=None, description="Greater than or equal." ) order: Optional[Literal["asc", "desc"]] = Field( - default=None, description="Sort order of the query, by default None" + default=None, description="Sort order of the query." ) sort: Optional[str] = Field( - default=None, description="Sort of the query, by default None" + default=None, description="Order in which to sort the news." ) diff --git a/openbb_sdk/providers/yfinance/openbb_yfinance/models/available_indices.py b/openbb_sdk/providers/yfinance/openbb_yfinance/models/available_indices.py index 690b2766305..06d4c77340c 100644 --- a/openbb_sdk/providers/yfinance/openbb_yfinance/models/available_indices.py +++ b/openbb_sdk/providers/yfinance/openbb_yfinance/models/available_indices.py @@ -23,9 +23,7 @@ class YFinanceAvailableIndicesData(AvailableIndicesData): code: str = Field( description="ID code for keying the index in the OpenBB Terminal." ) - symbol: str = Field( - description="yFinance ticker symbol for the index.", alias="ticker" - ) + symbol: str = Field(description="Symbol for the index.", alias="ticker") class YFinanceAvailableIndicesFetcher( diff --git a/openbb_sdk/sdk/core/openbb_core/app/provider_interface.py b/openbb_sdk/sdk/core/openbb_core/app/provider_interface.py index e142f8ef732..ea0d79efd17 100644 --- a/openbb_sdk/sdk/core/openbb_core/app/provider_interface.py +++ b/openbb_sdk/sdk/core/openbb_core/app/provider_interface.py @@ -1,12 +1,13 @@ from dataclasses import dataclass, make_dataclass -from typing import Any, Dict, List, Literal, Optional, Tuple, Type, Union +from difflib import SequenceMatcher +from typing import Any, Callable, Dict, List, Literal, Optional, Tuple, Type, Union from fastapi import Query from openbb_provider.query_executor import QueryExecutor from openbb_provider.registry_map import MapType, RegistryMap from openbb_provider.utils.helpers import to_snake_case from pydantic import BaseConfig, BaseModel, Extra, Field, create_model -from pydantic.fields import ModelField +from pydantic.fields import FieldInfo, ModelField from openbb_core.app.model.abstract.singleton import SingletonMeta @@ -154,15 +155,33 @@ class ProviderInterface(metaclass=SingletonMeta): ) -> DataclassField: current_name = current.name current_type = current.type_ - incoming_type = incoming.type_ + current_desc = getattr(current.default, "description", "") - if query: - merged_default = Query( - default=current.default.default, - title=f"{current.default.title}, {incoming.default.title}", - ) + incoming_type = incoming.type_ + incoming_desc = getattr(incoming.default, "description", "") + + F: Union[Callable, object] = Query if query else FieldInfo + + def split_desc(desc: str) -> Tuple[str, str]: + """Split field description""" + item = desc.split(" (provider: ") + detail = item[0] if item else "" + prov = item[-1].replace(")", "") if len(item) > 1 else "" + return detail, prov + + curr_detail, curr_prov = split_desc(current_desc) + inc_detail, inc_prov = split_desc(incoming_desc) + + if SequenceMatcher(None, curr_detail, inc_detail).ratio() > 0.8: + new_desc = f"{curr_detail} (provider: {curr_prov}, {inc_prov})" else: - merged_default = current.default + new_desc = f"{current_desc}; {incoming_desc}" + + merged_default = F( # type: ignore + default=current.default.default, + title=f"{current.default.title},{incoming.default.title}", + description=new_desc, + ) merged_type = ( Union[current_type, incoming_type] @@ -256,13 +275,6 @@ class ProviderInterface(metaclass=SingletonMeta): else: updated = incoming - if not updated.default.title.startswith( - "Available for providers:" - ): - updated.default.title = ( - "Available for providers: " + updated.default.title - ) - extra[updated.name] = ( updated.name, updated.type_, @@ -331,7 +343,7 @@ class ProviderInterface(metaclass=SingletonMeta): pageSize: int = Query(default=15, title="benzinga") displayOutput: int = Query(default="headline", title="benzinga") ... - sort: str = Query(default=None, title="benzinga, polygon") + sort: str = Query(default=None, title="benzinga,polygon") """ result: Dict = {} diff --git a/openbb_sdk/sdk/core/openbb_core/app/query.py b/openbb_sdk/sdk/core/openbb_core/app/query.py index 02a9c28dc34..f254fa3bd06 100644 --- a/openbb_sdk/sdk/core/openbb_core/app/query.py +++ b/openbb_sdk/sdk/core/openbb_core/app/query.py @@ -46,7 +46,7 @@ class Query: for k, v in original.items(): f = fields[k] - providers = f.title.replace("Available for providers: ", "").split(", ") + providers = f.title.split(",") if v != f.default: if provider_name in providers: filtered[k] = v