Skip to content

Commit

Permalink
add missing caches
Browse files Browse the repository at this point in the history
  • Loading branch information
theOGognf committed May 15, 2024
1 parent dff0e9b commit 9eeccb1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/finagg/fred/api/_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def get(
return df

@classmethod
def get_first_observations(
def get_original_observations(
cls,
series_id: str,
/,
Expand All @@ -246,6 +246,7 @@ def get_first_observations(
frequency: None | str = None,
aggregation_method: None | str = "avg",
paginate: bool = False,
cache: bool = True,
api_key: None | str = None,
) -> pd.DataFrame:
"""Get only the initial releases/observations for an
Expand Down Expand Up @@ -306,6 +307,7 @@ def get_first_observations(
paginate: Whether to manage `offset` automatically, making multiple
API calls until all results are returned.
cache: Whether to cache the response from the API.
api_key: Your FRED API key. Defaults to the ``FRED_API_KEY``
environment variable.
Expand Down Expand Up @@ -340,6 +342,7 @@ def get_first_observations(
aggregation_method=aggregation_method,
output_type=4,
paginate=paginate,
cache=cache,
api_key=api_key,
)
except HTTPError:
Expand All @@ -354,6 +357,7 @@ def get_first_observations(
frequency=frequency,
aggregation_method=aggregation_method,
paginate=paginate,
cache=cache,
api_key=api_key,
)

Expand Down
2 changes: 1 addition & 1 deletion src/finagg/fred/feat/_raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def install(
leave=True,
):
try:
df = api.series.observations.get_first_observations(
df = api.series.observations.get_original_observations(
series_id,
)
rowcount = len(df.index)
Expand Down
2 changes: 1 addition & 1 deletion src/finagg/fred/feat/_refined.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def from_api(
end = end or utils.today
dfs = []
for series_id in api.popular_series:
df = api.series.observations.get_first_observations(
df = api.series.observations.get_original_observations(
series_id,
observation_start=start,
observation_end=end,
Expand Down
3 changes: 3 additions & 0 deletions src/finagg/sec/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ def get_multiple_original(
form: None | str = None,
start: None | str = None,
end: None | str = None,
cache: bool = True,
user_agent: None | str = None,
) -> pd.DataFrame:
"""Return original (not amended) XBRL disclosures for a single company
Expand All @@ -221,6 +222,7 @@ def get_multiple_original(
first recorded date.
end: The end date of the observation period. Defaults to the
last recorded date.
cache: Whether to cache the response from the API.
user_agent: Self-declared bot header. Defaults to the value
found in the ``SEC_API_USER_AGENT`` environment variable.
Expand Down Expand Up @@ -253,6 +255,7 @@ def get_multiple_original(
ticker=ticker,
taxonomy=taxonomy,
units=units,
cache=cache,
user_agent=user_agent,
)
df = filter_original_filings(df, form=form, units=units)
Expand Down

0 comments on commit 9eeccb1

Please sign in to comment.