Skip to content

Commit

Permalink
fix rogue percent value (#6607)
Browse files Browse the repository at this point in the history
  • Loading branch information
deeleeramone authored Aug 2, 2024
1 parent 0f39546 commit 802d7fb
Showing 1 changed file with 15 additions and 3 deletions.
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

0 comments on commit 802d7fb

Please sign in to comment.