diff --git a/openbb_platform/core/openbb_core/provider/standard_models/compare_groups.py b/openbb_platform/core/openbb_core/provider/standard_models/compare_groups.py index 6a9a4da65bf..e9a6782792f 100644 --- a/openbb_platform/core/openbb_core/provider/standard_models/compare_groups.py +++ b/openbb_platform/core/openbb_core/provider/standard_models/compare_groups.py @@ -1,26 +1,12 @@ """Compare Groups Model.""" -from typing import Optional - from openbb_core.provider.abstract.data import Data from openbb_core.provider.abstract.query_params import QueryParams -from pydantic import Field class CompareGroupsQueryParams(QueryParams): """Compare Groups Query.""" - group: Optional[str] = Field( - default=None, - description="The group to compare - i.e., 'sector', 'industry', 'country'. Choices vary by provider.", - ) - metric: Optional[str] = Field( - default=None, - description="The type of metrics to compare - i.e, 'valuation', 'performance'. Choices vary by provider.", - ) - class CompareGroupsData(Data): """Compare Groups Data.""" - - name: str = Field(description="Name or label of the group.") diff --git a/openbb_platform/providers/finviz/openbb_finviz/models/compare_groups.py b/openbb_platform/providers/finviz/openbb_finviz/models/compare_groups.py index 0c2915f5188..88e3fd9884f 100644 --- a/openbb_platform/providers/finviz/openbb_finviz/models/compare_groups.py +++ b/openbb_platform/providers/finviz/openbb_finviz/models/compare_groups.py @@ -2,7 +2,7 @@ # pylint: disable=unused-argument -from typing import Any, Dict, List, Optional, Union +from typing import Any, Dict, List, Optional from openbb_core.provider.abstract.data import ForceInt from openbb_core.provider.abstract.fetcher import Fetcher @@ -20,18 +20,27 @@ GROUPS_CHOICES = sorted(list(GROUPS_DICT)) class FinvizCompareGroupsQueryParams(CompareGroupsQueryParams): """Finviz Compare Groups Query Params.""" - group: Union[GROUPS, None] = Field( + __json_schema_extra__ = { + "group": { + "multiple_items_allowed": False, + "choices": GROUPS_CHOICES, + }, + "metric": { + "multiple_items_allowed": False, + "choices": ["performance", "valuation", "overview"], + }, + } + + group: GROUPS = Field( default="sector", description="US-listed stocks only." - + " When a sector is selected, it is broken down by industry." - + " The default is sector.", - json_schema_extra={"choices": GROUPS_CHOICES}, # type: ignore + + " When an individual sector is selected, it is broken down by industry." + + " The default is 'sector'.", ) - metric: Union[METRICS, None] = Field( + metric: METRICS = Field( default="performance", - description="Select from: performance, valuation, overview." - + " The default is performance.", - json_schema_extra={"choices": ["performance", "valuation", "overview"]}, + description="Statistical metric to return. Select from: ['performance', 'valuation', 'overview']" + + " The default is 'performance'.", ) @@ -67,6 +76,8 @@ class FinvizCompareGroupsData(CompareGroupsData): "analyst_recommendation": "Recom", } + name: str = Field(description="Name or label of the group.") + stocks: Optional[int] = Field( default=None, description="The number of stocks in the group.",