mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 04:31:13 +00:00
move fields to provider models to let docstrings and choices populate (#6995)
Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>
This commit is contained in:
@@ -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.")
|
||||
|
||||
@@ -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.",
|
||||
|
||||
Reference in New Issue
Block a user