mortada / fredapi

Python API for FRED (Federal Reserve Economic Data) and ALFRED (Archival FRED)
Apache License 2.0
902 stars 159 forks source link

Vintage Dates Limit #28

Closed abadrinath15 closed 2 years ago

abadrinath15 commented 4 years ago

Hello @mortada; thanks for a really great library! I noticed an interesting issue -- I think FRED has a limitation on vintage dates for a query (I believe it's 2000). I ran into this when trying to call get_series_all_releases with series_id='DFF' (Effective Fed Funds Rate, published daily). As is, there wasn't a good way to get around it since the realtime_start and realtime_end parameters are class variables instead of being passed in. I believe the code just errors out (i.e. it doesn't even provide a partial data set) .

Here is my proposal for a solution; see if it makes sense:

  1. Allow realtime_start and realtime_end to be arguments (defaulted to None so it doesn't break anyone's code)
  2. If the arguments are not None, update self.realtime_start and self.realtime_end to new values
  3. Run get_series_vintage_dates on the series_id and see if there are more than 2,000 values within the self.realtime_start and self.realtime_end values
  4. If not, return the dataset with new values.
  5. If > 2,000... I am not 100% certain what the best way to handle it would be. I'm biased towards taking the most recent 2,000 values, but perhaps that wouldn't be the best/ most consistent behavior?

If you agree with the idea, I'm happy to code it up and submit a pull request! Thank you.

mortada commented 2 years ago

please use version 0.5.0, thanks for reporting this! (sorry for the super late response, I haven't been checking often)