Skip to content

Commit

Permalink
[Enhancement] Fix branch government_trades
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuaBri committed Dec 2, 2024
1 parent 4ab4d89 commit 8344207
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def to_upper(cls, v: str) -> str:
class GovernmentTradesData(Data):
"""Government Trades data."""

symbol: str = Field(description=DATA_DESCRIPTIONS.get("symbol", ""))
symbol: Optional[str] = Field(description=DATA_DESCRIPTIONS.get("symbol", ""))
date: dateType = Field(description=DATA_DESCRIPTIONS.get("date", ""))
transaction_date: Optional[dateType] = Field(
default=None, description="Date of Transaction."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ class FMPGovernmentTradesData(GovernmentTradesData):
link: Optional[str] = Field(
default=None, description="Link to the transaction document."
)
transaction_date: Optional[str] = Field(
default=None, description="Date of the transaction."
)
owner: Optional[str] = Field(
default=None, description="Ownership status (e.g., Spouse, Joint)."
)
Expand Down Expand Up @@ -159,4 +156,13 @@ def transform_data(
) -> List[FMPGovernmentTradesData]:
"""Return the transformed data."""

return [FMPGovernmentTradesData(**d) for d in data]
return sorted(
[
FMPGovernmentTradesData(
**{k: v for k, v in d.items() if v and v != "--"}
)
for d in data
],
key=lambda x: x.date,
reverse=True,
)

0 comments on commit 8344207

Please sign in to comment.