Skip to content

Commit

Permalink
[BugFix] Fix Yfinance Discovery Percent Values (#6611)
Browse files Browse the repository at this point in the history
* fix yfinance percent values

* test
  • Loading branch information
deeleeramone authored Aug 6, 2024
1 parent dd49c5f commit 972874b
Show file tree
Hide file tree
Showing 9 changed files with 172 additions and 93 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Equity Performance Standard Model."""

from typing import Literal, Optional
from typing import Literal, Optional, Union

from pydantic import Field, field_validator

Expand Down Expand Up @@ -30,18 +30,22 @@ class EquityPerformanceData(Data):
symbol: str = Field(
description=DATA_DESCRIPTIONS.get("symbol", ""),
)
name: str = Field(
name: Optional[str] = Field(
default=None,
description="Name of the entity.",
)
price: float = Field(
description="Last price.",
json_schema_extra={"x-unit_measurement": "currency"},
)
change: float = Field(
description="Change in price value.",
description="Change in price.",
json_schema_extra={"x-unit_measurement": "currency"},
)
percent_change: float = Field(
description="Percent change.",
json_schema_extra={"x-unit_measurement": "percent", "x-frontend_multiply": 100},
)
volume: float = Field(
volume: Union[int, float] = Field(
description=DATA_DESCRIPTIONS.get("volume", ""),
)
154 changes: 99 additions & 55 deletions openbb_platform/openbb/assets/reference.json
Original file line number Diff line number Diff line change
Expand Up @@ -7855,7 +7855,57 @@
"description": "The country to get data. Multiple items allowed for provider(s): oecd.",
"default": "united_states",
"optional": true,
"choices": null
"choices": [
"belgium",
"bulgaria",
"brazil",
"ireland",
"mexico",
"indonesia",
"new_zealand",
"japan",
"united_kingdom",
"france",
"chile",
"canada",
"netherlands",
"united_states",
"south_korea",
"norway",
"austria",
"south_africa",
"denmark",
"switzerland",
"hungary",
"luxembourg",
"australia",
"germany",
"sweden",
"iceland",
"turkey",
"greece",
"israel",
"czech_republic",
"latvia",
"slovenia",
"poland",
"estonia",
"lithuania",
"portugal",
"costa_rica",
"slovakia",
"finland",
"spain",
"romania",
"russia",
"euro_area19",
"colombia",
"italy",
"india",
"china",
"croatia",
"all"
]
},
{
"name": "start_date",
Expand All @@ -7872,13 +7922,6 @@
"default": null,
"optional": true,
"choices": null
},
{
"name": "provider",
"type": "Literal['oecd']",
"description": "The provider to use, by default None. If None, the priority list configured in the settings is used. Default priority: oecd.",
"default": null,
"optional": true
}
],
"oecd": [
Expand All @@ -7888,15 +7931,23 @@
"description": "Duration of the interest rate. 'immediate' is the overnight rate, 'short' is the 3-month rate, and 'long' is the 10-year rate.",
"default": "short",
"optional": true,
"choices": null
"choices": [
"immediate",
"short",
"long"
]
},
{
"name": "frequency",
"type": "Literal['monthly', 'quarter', 'annual']",
"description": "Frequency to get interest rate for for.",
"default": "monthly",
"optional": true,
"choices": null
"choices": [
"monthly",
"quarter",
"annual"
]
}
]
},
Expand Down Expand Up @@ -7933,7 +7984,7 @@
"standard": [
{
"name": "date",
"type": "date",
"type": "Union[date, str]",
"description": "The date of the data.",
"default": null,
"optional": true,
Expand Down Expand Up @@ -12062,8 +12113,8 @@
"name": "name",
"type": "str",
"description": "Name of the entity.",
"default": "",
"optional": false,
"default": null,
"optional": true,
"choices": null
},
{
Expand All @@ -12077,7 +12128,7 @@
{
"name": "change",
"type": "float",
"description": "Change in price value.",
"description": "Change in price.",
"default": "",
"optional": false,
"choices": null
Expand All @@ -12092,7 +12143,7 @@
},
{
"name": "volume",
"type": "float",
"type": "Union[int, float]",
"description": "The trading volume.",
"default": "",
"optional": false,
Expand All @@ -12101,19 +12152,19 @@
],
"yfinance": [
{
"name": "market_cap",
"name": "avg_volume_3_months",
"type": "float",
"description": "Market Cap.",
"default": "",
"optional": false,
"description": "Average volume over the last 3 months in millions.",
"default": null,
"optional": true,
"choices": null
},
{
"name": "avg_volume_3_months",
"name": "market_cap",
"type": "float",
"description": "Average volume over the last 3 months in millions.",
"default": "",
"optional": false,
"description": "Market Cap.",
"default": null,
"optional": true,
"choices": null
},
{
Expand Down Expand Up @@ -12191,8 +12242,8 @@
"name": "name",
"type": "str",
"description": "Name of the entity.",
"default": "",
"optional": false,
"default": null,
"optional": true,
"choices": null
},
{
Expand All @@ -12206,7 +12257,7 @@
{
"name": "change",
"type": "float",
"description": "Change in price value.",
"description": "Change in price.",
"default": "",
"optional": false,
"choices": null
Expand All @@ -12221,7 +12272,7 @@
},
{
"name": "volume",
"type": "float",
"type": "Union[int, float]",
"description": "The trading volume.",
"default": "",
"optional": false,
Expand Down Expand Up @@ -12320,8 +12371,8 @@
"name": "name",
"type": "str",
"description": "Name of the entity.",
"default": "",
"optional": false,
"default": null,
"optional": true,
"choices": null
},
{
Expand All @@ -12335,7 +12386,7 @@
{
"name": "change",
"type": "float",
"description": "Change in price value.",
"description": "Change in price.",
"default": "",
"optional": false,
"choices": null
Expand All @@ -12350,7 +12401,7 @@
},
{
"name": "volume",
"type": "float",
"type": "Union[int, float]",
"description": "The trading volume.",
"default": "",
"optional": false,
Expand Down Expand Up @@ -12449,8 +12500,8 @@
"name": "name",
"type": "str",
"description": "Name of the entity.",
"default": "",
"optional": false,
"default": null,
"optional": true,
"choices": null
},
{
Expand All @@ -12464,7 +12515,7 @@
{
"name": "change",
"type": "float",
"description": "Change in price value.",
"description": "Change in price.",
"default": "",
"optional": false,
"choices": null
Expand All @@ -12479,7 +12530,7 @@
},
{
"name": "volume",
"type": "float",
"type": "Union[int, float]",
"description": "The trading volume.",
"default": "",
"optional": false,
Expand Down Expand Up @@ -12578,8 +12629,8 @@
"name": "name",
"type": "str",
"description": "Name of the entity.",
"default": "",
"optional": false,
"default": null,
"optional": true,
"choices": null
},
{
Expand All @@ -12593,7 +12644,7 @@
{
"name": "change",
"type": "float",
"description": "Change in price value.",
"description": "Change in price.",
"default": "",
"optional": false,
"choices": null
Expand All @@ -12608,7 +12659,7 @@
},
{
"name": "volume",
"type": "float",
"type": "Union[int, float]",
"description": "The trading volume.",
"default": "",
"optional": false,
Expand Down Expand Up @@ -12707,8 +12758,8 @@
"name": "name",
"type": "str",
"description": "Name of the entity.",
"default": "",
"optional": false,
"default": null,
"optional": true,
"choices": null
},
{
Expand All @@ -12722,7 +12773,7 @@
{
"name": "change",
"type": "float",
"description": "Change in price value.",
"description": "Change in price.",
"default": "",
"optional": false,
"choices": null
Expand All @@ -12737,7 +12788,7 @@
},
{
"name": "volume",
"type": "float",
"type": "Union[int, float]",
"description": "The trading volume.",
"default": "",
"optional": false,
Expand Down Expand Up @@ -12836,8 +12887,8 @@
"name": "name",
"type": "str",
"description": "Name of the entity.",
"default": "",
"optional": false,
"default": null,
"optional": true,
"choices": null
},
{
Expand All @@ -12851,7 +12902,7 @@
{
"name": "change",
"type": "float",
"description": "Change in price value.",
"description": "Change in price.",
"default": "",
"optional": false,
"choices": null
Expand All @@ -12866,7 +12917,7 @@
},
{
"name": "volume",
"type": "float",
"type": "Union[int, float]",
"description": "The trading volume.",
"default": "",
"optional": false,
Expand Down Expand Up @@ -27192,13 +27243,6 @@
"default": null,
"optional": true,
"choices": null
},
{
"name": "provider",
"type": "Literal['fmp']",
"description": "The provider to use, by default None. If None, the priority list configured in the settings is used. Default priority: fmp.",
"default": null,
"optional": true
}
],
"fmp": []
Expand Down Expand Up @@ -27236,7 +27280,7 @@
"standard": [
{
"name": "date",
"type": "date",
"type": "Union[date, str]",
"description": "The date of the data.",
"default": "",
"optional": false,
Expand Down
Loading

0 comments on commit 972874b

Please sign in to comment.