-
Notifications
You must be signed in to change notification settings - Fork 169
Description
@mortada, one more thing I'd like to fix. When one calls get_series with realtime_start or realtime_end, the argument is passed verbatim and if the format is not a valid YYYY-MM-DD date, the url is invalid and Fred rejects the request.
I'd like to handle realtime_start and realtime_end the same way as observation_start and observation_end. Then if any of the 2 realtime argument is specified, return a pandas.DataFrame instead of a pandas.Series with a pandas.MultiIndex composed of the observation dates as well as the realtime start and realtime end.
I recognize that it's a little bit redundant with the other functions of the Fred class (e.g. get_series_all_releases) but it provides more flexibility like asking for revisions during a specific time span (say 3M at the begining of the year). I also think that having both realtime_start and realtime_end in the index makes it easier to manipulate the data to find what was the value of the series at a particular point in time.
I've uploaded my branch to https://github.com/elmotec/fredapi/tree/get_series_with_realtime (see TestFred.test_get_series_with_realtime for an example). Let me know what you think.
I also think it would make sense to even be able to request multiple series and leverage pandas to align the dates. That would be my next enhancement.