Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BugFix] Fix Rogue Percent Value In FMP ETF Info #6607

Merged
merged 1 commit into from
Aug 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions openbb_platform/providers/fmp/openbb_fmp/models/etf_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
EtfInfoQueryParams,
)
from openbb_core.provider.utils.helpers import amake_request
from pydantic import Field
from pydantic import Field, field_validator


class FMPEtfInfoQueryParams(EtfInfoQueryParams):
Expand All @@ -33,9 +33,15 @@ class FMPEtfInfoData(EtfInfoData):
asset_class: Optional[str] = Field(
default=None, description="Asset class of the ETF."
)
aum: Optional[float] = Field(default=None, description="Assets under management.")
aum: Optional[float] = Field(
default=None,
description="Assets under management.",
json_schema_extra={"x-unit_measurement": "currency"},
)
nav: Optional[float] = Field(
default=None, description="Net asset value of the ETF."
default=None,
description="Net asset value of the ETF.",
json_schema_extra={"x-unit_measurement": "currency"},
)
nav_currency: Optional[str] = Field(
default=None, description="Currency of the ETF's net asset value."
Expand All @@ -53,6 +59,12 @@ class FMPEtfInfoData(EtfInfoData):
)
website: Optional[str] = Field(default=None, description="Website of the issuer.")

@field_validator("expense_ratio", mode="before", check_fields=False)
@classmethod
def validate_expense_ratio(cls, v):
"""Format expense ratio as percent."""
return v / 100 if v else None


class FMPEtfInfoFetcher(
Fetcher[
Expand Down
Loading