diff --git a/openbb_platform/core/openbb_core/provider/standard_models/sector_news.py b/openbb_platform/core/openbb_core/provider/standard_models/sector_news.py new file mode 100644 index 00000000000..8b29b7847ef --- /dev/null +++ b/openbb_platform/core/openbb_core/provider/standard_models/sector_news.py @@ -0,0 +1,44 @@ +"""Sector News Standard Model.""" + + +from datetime import datetime +from typing import Dict, List, Optional + +from pydantic import Field, NonNegativeInt + +from openbb_core.provider.abstract.data import Data +from openbb_core.provider.abstract.query_params import QueryParams +from openbb_core.provider.utils.descriptions import ( + DATA_DESCRIPTIONS, + QUERY_DESCRIPTIONS, +) + + +class SectorNewsQueryParams(QueryParams): + """Sector News Query.""" + + sectors: str = Field( + min_length=1, + description="A coma separated list of sectors.", + ) + + limit: NonNegativeInt = Field( + default=20, + description=QUERY_DESCRIPTIONS.get("limit", "") + + " Here it is the no. of articles to return.", + ) + + +class SectorNewsData(Data): + """Sector News Data.""" + + 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." + ) + text: Optional[str] = Field(default=None, description="Text/body of the news.") + url: Optional[str] = Field(default=None, description="URL of the news.") diff --git a/openbb_platform/extensions/news/integration/test_news_api.py b/openbb_platform/extensions/news/integration/test_news_api.py index 3aff0a40c0a..d4f7e17466b 100644 --- a/openbb_platform/extensions/news/integration/test_news_api.py +++ b/openbb_platform/extensions/news/integration/test_news_api.py @@ -139,6 +139,13 @@ def test_news_world(params, headers): "source": "bloomberg.com", } ), + ( + { + "provider": "ultima", + "symbols": "AAPL,MSFT", + "limit": 20, + } + ), ], ) @pytest.mark.integration diff --git a/openbb_platform/extensions/news/integration/test_news_python.py b/openbb_platform/extensions/news/integration/test_news_python.py index 9874f633b77..97484593c1d 100644 --- a/openbb_platform/extensions/news/integration/test_news_python.py +++ b/openbb_platform/extensions/news/integration/test_news_python.py @@ -140,6 +140,13 @@ def test_news_world(params, obb): "source": "bloomberg.com", } ), + ( + { + "provider": "ultima", + "symbols": "AAPL,MSFT", + "limit": 20, + } + ), ], ) @pytest.mark.integration