diff options
13 files changed, 39 insertions, 58 deletions
diff --git a/openbb_platform/core/openbb_core/provider/standard_models/company_news.py b/openbb_platform/core/openbb_core/provider/standard_models/company_news.py index cae56e2d081..03d893e9a6e 100644 --- a/openbb_platform/core/openbb_core/provider/standard_models/company_news.py +++ b/openbb_platform/core/openbb_core/provider/standard_models/company_news.py @@ -4,7 +4,7 @@ from datetime import ( date as dateType, datetime, ) -from typing import Dict, List, Optional +from typing import Dict, List, Optional, Union from dateutil.relativedelta import relativedelta from pydantic import Field, NonNegativeInt, field_validator @@ -75,3 +75,8 @@ class CompanyNewsData(Data): symbols: Optional[str] = Field( default=None, description="Symbols associated with the article." ) + source: Optional[str] = Field(default=None, description="Source of the article.") + id: Optional[Union[int, str]] = Field(default=None, description="Article ID.") + tags: Optional[str] = Field( + default=None, description="Tags associated with the article." + ) diff --git a/openbb_platform/core/openbb_core/provider/standard_models/etf_info.py b/openbb_platform/core/openbb_core/provider/standard_models/etf_info.py index 20591c4be04..69dfddc8826 100644 --- a/openbb_platform/core/openbb_core/provider/standard_models/etf_info.py +++ b/openbb_platform/core/openbb_core/provider/standard_models/etf_info.py @@ -33,3 +33,22 @@ class EtfInfoData(Data): default=None, description="Description of the fund." ) inception_date: Optional[str] = Field(description="Inception date of the ETF.") + prev_close: Optional[float] = Field( + default=None, description=DATA_DESCRIPTIONS.get("prev_close", "") + ) + website: Optional[str] = Field(default=None, description="Website of the issuer.") + issuer: Optional[str] = Field(description="The issuer of the ETF.", default=None) + return_ytd: Optional[float] = Field( + description="The year-to-date return of the ETF, as a normalized percent.", + default=None, + json_schema_extra={"unit_measurement": "percent", "frontend_multiply": 100}, + ) + avg_volume: Optional[int] = Field( + description="The average daily volume of the ETF.", + default=None, + ) + aum: Optional[float] = Field(description="Assets under management.", default=None) + currency: Optional[str] = Field( + default=None, + description="The currency in which the fund is listed.", + ) diff --git a/openbb_platform/providers/cboe/openbb_cboe/models/available_indices.py b/openbb_platform/providers/cboe/openbb_cboe/models/available_indices.py index d4b06a324f9..979358bcd35 100644 --- a/openbb_platform/providers/cboe/openbb_cboe/models/available_indices.py +++ b/openbb_platform/providers/cboe/openbb_cboe/models/available_indices.py @@ -38,8 +38,6 @@ class CboeAvailableIndicesData(AvailableIndicesData): "close_time": "calc_end_time", } - symbol: Optional[str] = Field(description="Symbol for the index.") - description: Optional[str] = Field( default=None, description="Description for the index. Valid only for US indices.", diff --git a/openbb_platform/providers/fmp/openbb_fmp/models/company_news.py b/openbb_platform/providers/fmp/openbb_fmp/models/company_news.py index 32cddb7823a..4d6119365b9 100644 --- a/openbb_platform/providers/fmp/openbb_fmp/models/company_news.py +++ b/openbb_platform/providers/fmp/openbb_fmp/models/company_news.py @@ -37,8 +37,6 @@ class FMPCompanyNewsData(CompanyNewsData): "source": "site", } - source: str = Field(description="Name of the news source.") - @field_validator("images", mode="before", check_fields=False) @classmethod def validate_images(cls, v): diff --git a/openbb_platform/providers/fmp/openbb_fmp/models/etf_info.py b/openbb_platform/providers/fmp/openbb_fmp/models/etf_info.py index d6cf1ff1b8d..8775a8d45a2 100644 --- a/openbb_platform/providers/fmp/openbb_fmp/models/etf_info.py +++ b/openbb_platform/providers/fmp/openbb_fmp/models/etf_info.py @@ -26,16 +26,12 @@ class FMPEtfInfoQueryParams(EtfInfoQueryParams): class FMPEtfInfoData(EtfInfoData): """FMP ETF Info Data.""" - issuer: Optional[str] = Field( - default=None, description="Company of the ETF.", alias="etfCompany" - ) cusip: Optional[str] = Field(default=None, description="CUSIP of the ETF.") isin: Optional[str] = Field(default=None, description="ISIN of the ETF.") domicile: Optional[str] = Field(default=None, description="Domicile of the ETF.") asset_class: Optional[str] = Field( default=None, description="Asset class of the ETF." ) - aum: Optional[float] = Field(default=None, description="Assets under management.") nav: Optional[float] = Field( default=None, description="Net asset value of the ETF." ) @@ -53,7 +49,6 @@ class FMPEtfInfoData(EtfInfoData): avg_volume: Optional[float] = Field( default=None, description="Average daily trading volume." ) - website: Optional[str] = Field(default=None, description="Website of the issuer.") class FMPEtfInfoFetcher( diff --git a/openbb_platform/providers/polygon/openbb_polygon/models/company_news.py b/openbb_platform/providers/polygon/openbb_polygon/models/company_news.py index b91e7f12239..00e91c8406b 100644 --- a/openbb_platform/providers/polygon/openbb_polygon/models/company_news.py +++ b/openbb_platform/providers/polygon/openbb_polygon/models/company_news.py @@ -54,7 +54,6 @@ class PolygonCompanyNewsData(CompanyNewsData): "tags": "keywords", } - source: Optional[str] = Field(default=None, description="Source of the article.") tags: Optional[str] = Field( default=None, description="Keywords/tags in the article" ) diff --git a/openbb_platform/providers/tiingo/openbb_tiingo/models/company_news.py b/openbb_platform/providers/tiingo/openbb_tiingo/models/company_news.py index c11e12f424d..356b1af2346 100644 --- a/openbb_platform/providers/tiingo/openbb_tiingo/models/company_news.py +++ b/openbb_platform/providers/tiingo/openbb_tiingo/models/company_news.py @@ -50,7 +50,6 @@ class TiingoCompanyNewsData(CompanyNewsData): default=None, description="Tags associated with the news article." ) article_id: int = Field(description="Unique ID of the news article.", alias="id") - source: str = Field(description="News source.") crawl_date: datetime = Field(description="Date the news article was crawled.") @field_validator("tags", "symbols", mode="before") diff --git a/openbb_platform/providers/tmx/openbb_tmx/models/available_indices.py b/openbb_platform/providers/tmx/openbb_tmx/models/available_indices.py index 5eb827936be..f6218620689 100644 --- a/openbb_platform/providers/tmx/openbb_tmx/models/available_indices.py +++ b/openbb_platform/providers/tmx/openbb_tmx/models/available_indices.py @@ -28,8 +28,6 @@ class TmxAvailableIndicesQueryParams(AvailableIndicesQueryParams): class TmxAvailableIndicesData(AvailableIndicesData): """TMX Available Indices Data.""" - symbol: str = Field(description="The ticker symbol of the index.") - class TmxAvailableIndicesFetcher( Fetcher[ diff --git a/openbb_platform/providers/tmx/openbb_tmx/models/company_news.py b/openbb_platform/providers/tmx/openbb_tmx/models/company_news.py index 4c8269ac241..adeb2d08651 100644 --- a/openbb_platform/providers/tmx/openbb_tmx/models/company_news.py +++ b/openbb_platform/providers/tmx/openbb_tmx/models/company_news.py @@ -28,15 +28,13 @@ class TmxCompanyNewsQueryParams(CompanyNewsQueryParams): class TmxCompanyNewsData(CompanyNewsData): - """TMX Stock News Data""" + """TMX Stock News Data.""" __alias_dict__ = { "date": "datetime", "title": "headline", } - source: Optional[str] = Field(description="Source of the news.", default=None) - @field_validator("date", mode="before", check_fields=False) @classmethod def date_validate(cls, v): # pylint: disable=E0213 @@ -68,7 +66,6 @@ class TmxCompanyNewsFetcher( async def create_task(symbol, results): """Makes a POST request to the TMX GraphQL endpoint for a single symbol.""" - symbol = ( symbol.upper().replace(".TO", "").replace(".TSX", "").replace("-", ".") ) diff --git a/openbb_platform/providers/tmx/openbb_tmx/models/etf_info.py b/openbb_platform/providers/tmx/openbb_tmx/models/etf_info.py index da1b720c909..5f811f437ea 100644 --- a/openbb_platform/providers/tmx/openbb_tmx/models/etf_info.py +++ b/openbb_platform/providers/tmx/openbb_tmx/models/etf_info.py @@ -14,7 +14,7 @@ from pydantic import Field, field_validator class TmxEtfInfoQueryParams(EtfInfoQueryParams): - """TMX ETF Info Query Params""" + """TMX ETF Info Query Params.""" __json_schema_extra__ = {"symbol": ["multiple_items_allowed"]} @@ -28,23 +28,20 @@ class TmxEtfInfoQueryParams(EtfInfoQueryParams): class TmxEtfInfoData(EtfInfoData): """TMX ETF Info Data.""" - issuer: Optional[str] = Field( - description="The issuer of the ETF.", alias="fund_family", default=None - ) + __alias_dict__ = { + "issuer": "fund_family", + "avg_volume": "volume_avg_daily", + } investment_style: Optional[str] = Field( description="The investment style of the ETF.", default=None ) esg: Optional[bool] = Field( description="Whether the ETF qualifies as an ESG fund.", default=None ) - currency: Optional[str] = Field(description="The currency of the ETF.") unit_price: Optional[float] = Field( description="The unit price of the ETF.", default=None ) close: Optional[float] = Field(description="The closing price of the ETF.") - prev_close: Optional[float] = Field( - description="The previous closing price of the ETF.", default=None - ) return_1m: Optional[float] = Field( description="The one-month return of the ETF, as a normalized percent", default=None, @@ -60,11 +57,6 @@ class TmxEtfInfoData(EtfInfoData): default=None, json_schema_extra={"unit_measurement": "percent", "frontend_multiply": 100}, ) - return_ytd: Optional[float] = Field( - description="The year-to-date return of the ETF, as a normalized percent.", - default=None, - json_schema_extra={"unit_measurement": "percent", "frontend_multiply": 100}, - ) return_1y: Optional[float] = Field( description="The one-year return of the ETF, as a normalized percent.", default=None, @@ -90,17 +82,11 @@ class TmxEtfInfoData(EtfInfoData): default=None, json_schema_extra={"unit_measurement": "percent", "frontend_multiply": 100}, ) - avg_volume: Optional[int] = Field( - description="The average daily volume of the ETF.", - alias="volume_avg_daily", - default=None, - ) avg_volume_30d: Optional[int] = Field( description="The 30-day average volume of the ETF.", alias="volume_avg_30d", default=None, ) - aum: Optional[float] = Field(description="The AUM of the ETF.", default=None) pe_ratio: Optional[float] = Field( description="The price-to-earnings ratio of the ETF.", default=None ) @@ -125,7 +111,6 @@ class TmxEtfInfoData(EtfInfoData): dividend_frequency: Optional[str] = Field( description="The dividend payment frequency of the ETF.", default=None ) - website: Optional[str] = Field(description="The website of the ETF.", default=None) description: Optional[str] = Field( description="The description of the ETF.", alias="investment_objectives", @@ -174,7 +159,6 @@ class TmxEtfInfoFetcher( **kwargs: Any, ) -> List[Dict]: """Return the raw data from the TMX endpoint.""" - results = [] symbols = ( query.symbol.split(",") if "," in query.symbol else [query.symbol.upper()] diff --git a/openbb_platform/providers/yfinance/openbb_yfinance/models/available_indices.py b/openbb_platform/providers/yfinance/openbb_yfinance/models/available_indices.py index cb5eda90a15..3c2b35f11fb 100644 --- a/openbb_platform/providers/yfinance/openbb_yfinance/models/available_indices.py +++ b/openbb_platform/providers/yfinance/openbb_yfinance/models/available_indices.py @@ -22,10 +22,13 @@ class YFinanceAvailableIndicesQueryParams(AvailableIndicesQueryParams): class YFinanceAvailableIndicesData(AvailableIndicesData): """Yahoo Finance Available Indices Data.""" + __alias_dict__ = { + "symbol": "ticker", + } + code: str = Field( description="ID code for keying the index in the OpenBB Terminal." ) - symbol: str = Field(description="Symbol for the index.", alias="ticker") class YFinanceAvailableIndicesFetcher( @@ -41,6 +44,7 @@ class YFinanceAvailableIndicesFetcher( """Transform the query params.""" return YFinanceAvailableIndicesQueryParams(**params) + # pylint: disable=unused-argument @staticmethod def extract_data( query: YFinanceAvailableIndicesQueryParams, @@ -52,6 +56,7 @@ class YFinanceAvailableIndicesFetcher( return indices.to_dict("records") + # pylint: disable=unused-argument @staticmethod def transform_data( query: YFinanceAvailableIndicesQueryParams, data: List[Dict], **kwargs: Any diff --git a/openbb_platform/providers/yfinance/openbb_yfinance/models/company_news.py b/openbb_platform/providers/yfinance/openbb_yfinance/models/company_news.py index 29209ebd5b4..579e4eb7bf9 100644 --- a/openbb_platform/providers/yfinance/openbb_yfinance/models/company_news.py +++ b/openbb_platform/providers/yfinance/openbb_yfinance/models/company_news.py @@ -11,7 +11,7 @@ from openbb_core.provider.standard_models.company_news import ( CompanyNewsData, CompanyNewsQueryParams, ) -from pydantic import Field, field_validator +from pydantic import field_validator from yfinance import Ticker @@ -35,8 +35,6 @@ class YFinanceCompanyNewsData(CompanyNewsData): "source": "publisher", } - source: str = Field(description="Source of the news article") - @field_validator("symbols", mode="before", check_fields=False) @classmethod def symbols_string(cls, v): diff --git a/openbb_platform/providers/yfinance/openbb_yfinance/models/etf_info.py b/openbb_platform/providers/yfinance/openbb_yfinance/models/etf_info.py index 546ee9c8fb3..b9efe803200 100644 --- a/openbb_platform/providers/yfinance/openbb_yfinance/models/etf_info.py +++ b/openbb_platform/providers/yfinance/openbb_yfinance/models/etf_info.py @@ -30,6 +30,7 @@ class YFinanceEtfInfoData(EtfInfoData): "name": "longName", "inception_date": "fundInceptionDate", "description": "longBusinessSummary", + "return_ytd": "ytdReturn", } fund_type: Optional[str] = Field( @@ -55,10 +56,6 @@ class YFinanceEtfInfoData(EtfInfoData): description="The timezone of the exchange.", alias="timeZoneFullName", ) - currency: Optional[str] = Field( - default=None, - description="The currency in which the fund is listed.", - ) nav_price: Optional[float] = Field( default=None, description="The net asset value per unit of the fund.", @@ -111,12 +108,6 @@ class YFinanceEtfInfoData(EtfInfoData): description="200-day moving average price.", alias="twoHundredDayAverage", ) - return_ytd: Optional[float] = Field( - default=None, - description="The year-to-date return of the fund, as a normalized percent.", - json_schema_extra={"unit_measurement": "percent", "frontend_multiply": 100}, - alias="ytdReturn", - ) return_3y_avg: Optional[float] = Field( default=None, description="The three year average return of the fund, as a normalized percent.", @@ -180,11 +171,6 @@ class YFinanceEtfInfoData(EtfInfoData): default=None, description="The trading volume of the most recent trading session.", ) - prev_close: Optional[float] = Field( - default=None, - description="The previous closing price.", - alias="previousClose", - ) @field_validator("inception_date", mode="before", check_fields=False) @classmethod |