forked from OpenBB-finance/OpenBB
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/fred-releases: Adds some FRED functionality to the economy ro…
…uter. (OpenBB-finance#5793) * fred economic releases search * add FRED functions for series and searching. * codespell * ruff * data description. * replace two functions with one fred_search * rename standard model to fred_series * remove consolidated fred model * return series metadata as warning * recapture test * fill nan with None
- Loading branch information
1 parent
f42c457
commit 3959f95
Showing
17 changed files
with
2,224 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,7 @@ vai | |
varian | ||
vie | ||
welp | ||
wew | ||
yeld | ||
zar | ||
zlot |
88 changes: 88 additions & 0 deletions
88
openbb_platform/core/openbb_core/provider/standard_models/fred_search.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
"""FRED Search Model.""" | ||
|
||
from datetime import ( | ||
date as dateType, | ||
datetime, | ||
) | ||
from typing import Optional, Union | ||
|
||
from dateutil import parser | ||
from pydantic import Field, field_validator | ||
|
||
from openbb_core.provider.abstract.data import Data | ||
from openbb_core.provider.abstract.query_params import QueryParams | ||
|
||
|
||
class SearchQueryParams(QueryParams): | ||
"""FRED Search Query Params.""" | ||
|
||
query: Optional[str] = Field(default=None, description="The search word(s).") | ||
|
||
|
||
class SearchData(Data): | ||
"""FRED Search Data.""" | ||
|
||
release_id: Optional[Union[str, int]] = Field( | ||
default=None, | ||
description="The release ID for queries.", | ||
) | ||
series_id: Optional[str] = Field( | ||
default=None, | ||
description="The series ID for the item in the release.", | ||
) | ||
name: Optional[str] = Field( | ||
default=None, | ||
description="The name of the release.", | ||
) | ||
title: Optional[str] = Field( | ||
default=None, | ||
description="The title of the series.", | ||
) | ||
observation_start: Optional[dateType] = Field( | ||
default=None, description="The date of the first observation in the series." | ||
) | ||
observation_end: Optional[dateType] = Field( | ||
default=None, description="The date of the last observation in the series." | ||
) | ||
frequency: Optional[str] = Field( | ||
default=None, | ||
description="The frequency of the data.", | ||
) | ||
frequency_short: Optional[str] = Field( | ||
default=None, | ||
description="Short form of the data frequency.", | ||
) | ||
units: Optional[str] = Field( | ||
default=None, | ||
description="The units of the data.", | ||
) | ||
units_short: Optional[str] = Field( | ||
default=None, | ||
description="Short form of the data units.", | ||
) | ||
seasonal_adjustment: Optional[str] = Field( | ||
default=None, | ||
description="The seasonal adjustment of the data.", | ||
) | ||
seasonal_adjustment_short: Optional[str] = Field( | ||
default=None, | ||
description="Short form of the data seasonal adjustment.", | ||
) | ||
last_updated: Optional[datetime] = Field( | ||
default=None, | ||
description="The datetime of the last update to the data.", | ||
) | ||
notes: Optional[str] = Field( | ||
default=None, description="Description of the release." | ||
) | ||
press_release: Optional[bool] = Field( | ||
description="If the release is a press release.", | ||
default=None, | ||
) | ||
url: Optional[str] = Field(default=None, description="URL to the release.") | ||
|
||
@field_validator("last_updated", mode="before", check_fields=False) | ||
@classmethod | ||
def date_validate(cls, v): | ||
"""Validate datetime format.""" | ||
return parser.isoparse(v) if v else None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.