Coder Social home page Coder Social logo

micahjsmith / freddata.jl Goto Github PK

View Code? Open in Web Editor NEW
62.0 7.0 19.0 209 KB

Pull data from Federal Reserve Economic Data (FRED) directly into Julia

Home Page: https://micahjsmith.github.io/FredData.jl/dev

License: Other

Julia 100.00%
julia fred-api economic-data financial-data

freddata.jl's Introduction

Dev Tests Coverage version pkgeval

FredData.jl

A third-party Julia library to pull data from Federal Reserve Economic Data (FRED).

Disclaimer

FredData is not affiliated in any way with Federal Reserve Bank of St. Louis and is not officially maintained or otherwise supported by Federal Reserve Bank of St. Louis.

Quickstart

Here is what you can do with FredData:

julia> using FredData

julia> f = Fred()
API key loaded.
FRED API Connection
        url: http://api.stlouisfed.org/fred/
        key: 0123456789abcdef0123456789abcdef

julia> a = get_data(f, "GDPC1")
FredSeries
        id: GDPC1
        title: Real Gross Domestic Product
        units: Billions of Chained 2009 Dollars
        seas_adj (native): Seasonally Adjusted Annual Rate
        freq (native): Quarterly
        realtime_start: 2015-12-11
        realtime_end: 2015-12-11
        last_updated: 2015-11-24T08:01:09
        notes: BEA Account Code: A191RX1 Real gross domestic product is the inflation adjusted value of the goods and services produced by labor and property located in the United States. For more information see the Guide to the National Income and Product Accounts of the United States (NIPA) - (http://www.bea.gov/national/pdf/nipaguid.pdf)
        trans_short: lin
        data: 275x4 DataFrame with columns [:realtime_start,:realtime_end,:date,:value]

For full usage, refer to the documentation

freddata.jl's People

Contributors

chenwilliam77 avatar femtocleaner[bot] avatar fratrik avatar greimel avatar micahjsmith avatar pearlzli avatar staticfloat avatar tkelman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

freddata.jl's Issues

Freeze during a request

Hi,

Thank you for this package, this is really great.
But sometimes the library gets stuck on one request.
For instance, sometimes Julia is blocked at line 3:

using FredData
f = Fred()
FredData.get_data(f,"STTMINWGCA")

If I interrupt the process with Control+C and run the same command again, the pacakge works as expected. Is it because there is a limited number of requests per second associated with my API key? Is there a clean way of handling those "freezing"? So far, I have tried to add sleep(20) in between 2 requests, which did not solve the problem.

Thanks.

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

Fetch series when metadata fields are missing

get_data fails without returning the data series when metadata queries fail. For example,

f = Fred()
data = get_data(f, "PRS85006063"; frequency="q", observation_start="1959-01-01")

throws a KeyError. Would it be possible to throw a warning but still return the series if non-essential metadata is missing?

Support creation of pseudo-vintages

Most series do not have vintage data available before certain dates. For example, Fred does not have GDPC1 vintages from before 1991. However, you might like to do the best you can and create "pseudo-vintages".

In particular, you might not have the 01-Jan-1989 GDPC1 vintage, but you can take the first available vintage for the series from 12-Dec-1991, and chop off enough of the 1989 and 1990 releases to simulate publication lags, constructing an information set close to what you would have had at 01-Jan-1989.

Use the median publication delay (computed over the entire available history of the series) to discard observations.

API would be something like

get_data(f, "GDPC1"; vintage_dates="1989-01-01", pseudo_vintage=true)

See also: https://github.com/MattCocci/FredFetch/blob/master/%2Bfred/vintsFromAll_.m

proxy settings

Hi,
How can I specify the proxy server through which the HTTP requests are made? After get_data call I get ERROR; HTTP/1.1 407 Proxy Authentication Required
Thanks!

update HTTP

FredData.jl is currently blocking my attempts to update to the latest http.jl version. Changing Project.toml to

HTTP = "0.8, 0.9, 1.2"

works well on my local machine

API keys

Thank you for putting up this package!,

I wanted to use it, so I followed the link to the API key application. There it says

Each user of an application may use the same API key. Developers should request an API key for each application they build.

So wouldn't it suffice if you put an application-wide key into this repo and everybody could use it? The R package quantmodseems to work that way.

Make the instructions clearer on how to setup the API

This may sound like a silly request, but it is not directly obvious to me where I should insert "export FRED_API_KEY=abcdefghijklmnopqrstuvwxyz123456" or the other option.

Could you help me with that also include the explanation in the instructions?

Real-time datasets

Hi,

I have written a small piece of code that generates multivariate real-time vintages merging FredData.jl output and unrevised data (stored in an Excel file). I am unsure on whether I should register a new package or open a pull request. Would you be open on the latter?

FredData throwing error related to SSL/TLS on simple request

using FredData

FredKey = "e8xxxd5"

fr = Fred(FredKey)

test = get_data(fr,"GDPC1")

The key above was generated for my "tutorial" on reading data from various sources in Julia.

This throws:


ERROR: HTTP.Exceptions.RequestError(HTTP.Messages.Request:
"""
GET /fred/series/observations?api_key=e8xxxd5&series_id=GDPC1&file_type=json HTTP/1.1
Host: api.stlouisfed.org
Accept: */*
User-Agent: HTTP.jl/1.8.2
Content-Length: 0
Accept-Encoding: gzip

""", MethodError(HTTP.ConnectionPool.var"#sslconnection##kw"(), ((require_ssl_verification = true, iofunction = nothing, decompress = nothing, verbose = 0), HTTP.ConnectionPool.sslconnection, Sockets.TCPSocket, Sockets.TCPSocket(RawFD(4294967295) closed, 0 bytes waiting), "api.stlouisfed.org"), 0x0000000000007f93))
Stacktrace:
  [1] (::HTTP.ConnectionRequest.var"#1#7"{HTTP.ConnectionRequest.var"#1#2#8"{HTTP.TimeoutRequest.var"#1#6"{HTTP.TimeoutRequest.var"#1#2#7"{HTTP.ExceptionRequest.var"#1#3"{HTTP.ExceptionRequest.var"#1#2#4"{typeof(HTTP.StreamRequest.streamlayer)}}}}}})(req::HTTP.Messages.Request; proxy::String, socket_type::Type, socket_type_tls::Type, readtimeout::Int64, kw::Base.Pairs{Symbol, Union{Nothing, Int64}, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:iofunction, :decompress, :verbose), Tuple{Nothing, Nothing, Int64}}})
    @ HTTP.ConnectionRequest ~/.julia/packages/HTTP/XR4MX/src/clientlayers/ConnectionRequest.jl:116
  [2] (::HTTP.CanonicalizeRequest.var"#1#3"{HTTP.CanonicalizeRequest.var"#1#2#4"{HTTP.ConnectionRequest.var"#1#7"{HTTP.ConnectionRequest.var"#1#2#8"{HTTP.TimeoutRequest.var"#1#6"{HTTP.TimeoutRequest.var"#1#2#7"{HTTP.ExceptionRequest.var"#1#3"{HTTP.ExceptionRequest.var"#1#2#4"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}})(req::HTTP.Messages.Request; canonicalize_headers::Bool, kw::Base.Pairs{Symbol, Union{Nothing, Int64}, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:iofunction, :decompress, :verbose), Tuple{Nothing, Nothing, Int64}}})
    @ HTTP.CanonicalizeRequest ~/.julia/packages/HTTP/XR4MX/src/clientlayers/CanonicalizeRequest.jl:17
  [3] (::Base.var"#88#90"{Base.var"#88#89#91"{ExponentialBackOff, HTTP.RetryRequest.var"#3#6"{Int64, HTTP.Messages.Request, Base.RefValue{Int64}}, HTTP.CanonicalizeRequest.var"#1#3"{HTTP.CanonicalizeRequest.var"#1#2#4"{HTTP.ConnectionRequest.var"#1#7"{HTTP.ConnectionRequest.var"#1#2#8"{HTTP.TimeoutRequest.var"#1#6"{HTTP.TimeoutRequest.var"#1#2#7"{HTTP.ExceptionRequest.var"#1#3"{HTTP.ExceptionRequest.var"#1#2#4"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}}}})(args::HTTP.Messages.Request; kwargs::Base.Pairs{Symbol, Union{Nothing, Int64}, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:iofunction, :decompress, :verbose), Tuple{Nothing, Nothing, Int64}}})
    @ Base ./error.jl:296
  [4] (::HTTP.RetryRequest.var"#1#4"{HTTP.RetryRequest.var"#1#2#5"{HTTP.CanonicalizeRequest.var"#1#3"{HTTP.CanonicalizeRequest.var"#1#2#4"{HTTP.ConnectionRequest.var"#1#7"{HTTP.ConnectionRequest.var"#1#2#8"{HTTP.TimeoutRequest.var"#1#6"{HTTP.TimeoutRequest.var"#1#2#7"{HTTP.ExceptionRequest.var"#1#3"{HTTP.ExceptionRequest.var"#1#2#4"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}}}})(req::HTTP.Messages.Request; retry::Bool, retries::Int64, retry_non_idempotent::Bool, kw::Base.Pairs{Symbol, Union{Nothing, Int64}, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:iofunction, :decompress, :verbose), Tuple{Nothing, Nothing, Int64}}})
    @ HTTP.RetryRequest ~/.julia/packages/HTTP/XR4MX/src/clientlayers/RetryRequest.jl:60
  [5] (::HTTP.CookieRequest.var"#1#5"{HTTP.CookieRequest.var"#1#2#6"{HTTP.RetryRequest.var"#1#4"{HTTP.RetryRequest.var"#1#2#5"{HTTP.CanonicalizeRequest.var"#1#3"{HTTP.CanonicalizeRequest.var"#1#2#4"{HTTP.ConnectionRequest.var"#1#7"{HTTP.ConnectionRequest.var"#1#2#8"{HTTP.TimeoutRequest.var"#1#6"{HTTP.TimeoutRequest.var"#1#2#7"{HTTP.ExceptionRequest.var"#1#3"{HTTP.ExceptionRequest.var"#1#2#4"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}}}}}})(req::HTTP.Messages.Request; cookies::Bool, cookiejar::HTTP.Cookies.CookieJar, kw::Base.Pairs{Symbol, Union{Nothing, Int64}, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:iofunction, :decompress, :verbose), Tuple{Nothing, Nothing, Int64}}})
    @ HTTP.CookieRequest ~/.julia/packages/HTTP/XR4MX/src/clientlayers/CookieRequest.jl:42
  [6] (::HTTP.ContentTypeDetection.var"#1#3"{HTTP.ContentTypeDetection.var"#1#2#4"{HTTP.CookieRequest.var"#1#5"{HTTP.CookieRequest.var"#1#2#6"{HTTP.RetryRequest.var"#1#4"{HTTP.RetryRequest.var"#1#2#5"{HTTP.CanonicalizeRequest.var"#1#3"{HTTP.CanonicalizeRequest.var"#1#2#4"{HTTP.ConnectionRequest.var"#1#7"{HTTP.ConnectionRequest.var"#1#2#8"{HTTP.TimeoutRequest.var"#1#6"{HTTP.TimeoutRequest.var"#1#2#7"{HTTP.ExceptionRequest.var"#1#3"{HTTP.ExceptionRequest.var"#1#2#4"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}}}}}}}})(req::HTTP.Messages.Request; detect_content_type::Bool, kw::Base.Pairs{Symbol, Union{Nothing, Int64}, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:iofunction, :decompress, :verbose), Tuple{Nothing, Nothing, Int64}}})
    @ HTTP.ContentTypeDetection ~/.julia/packages/HTTP/XR4MX/src/clientlayers/ContentTypeRequest.jl:23
  [7] (::HTTP.BasicAuthRequest.var"#1#3"{HTTP.BasicAuthRequest.var"#1#2#4"{HTTP.ContentTypeDetection.var"#1#3"{HTTP.ContentTypeDetection.var"#1#2#4"{HTTP.CookieRequest.var"#1#5"{HTTP.CookieRequest.var"#1#2#6"{HTTP.RetryRequest.var"#1#4"{HTTP.RetryRequest.var"#1#2#5"{HTTP.CanonicalizeRequest.var"#1#3"{HTTP.CanonicalizeRequest.var"#1#2#4"{HTTP.ConnectionRequest.var"#1#7"{HTTP.ConnectionRequest.var"#1#2#8"{HTTP.TimeoutRequest.var"#1#6"{HTTP.TimeoutRequest.var"#1#2#7"{HTTP.ExceptionRequest.var"#1#3"{HTTP.ExceptionRequest.var"#1#2#4"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}}}}}}}}}})(req::HTTP.Messages.Request; basicauth::Bool, kw::Base.Pairs{Symbol, Union{Nothing, Int64}, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:iofunction, :decompress, :verbose), Tuple{Nothing, Nothing, Int64}}})
    @ HTTP.BasicAuthRequest ~/.julia/packages/HTTP/XR4MX/src/clientlayers/BasicAuthRequest.jl:22
  [8] (::HTTP.DefaultHeadersRequest.var"#1#3"{HTTP.DefaultHeadersRequest.var"#1#2#4"{HTTP.BasicAuthRequest.var"#1#3"{HTTP.BasicAuthRequest.var"#1#2#4"{HTTP.ContentTypeDetection.var"#1#3"{HTTP.ContentTypeDetection.var"#1#2#4"{HTTP.CookieRequest.var"#1#5"{HTTP.CookieRequest.var"#1#2#6"{HTTP.RetryRequest.var"#1#4"{HTTP.RetryRequest.var"#1#2#5"{HTTP.CanonicalizeRequest.var"#1#3"{HTTP.CanonicalizeRequest.var"#1#2#4"{HTTP.ConnectionRequest.var"#1#7"{HTTP.ConnectionRequest.var"#1#2#8"{HTTP.TimeoutRequest.var"#1#6"{HTTP.TimeoutRequest.var"#1#2#7"{HTTP.ExceptionRequest.var"#1#3"{HTTP.ExceptionRequest.var"#1#2#4"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}}}}}}}}}}}})(req::HTTP.Messages.Request; iofunction::Nothing, decompress::Nothing, kw::Base.Pairs{Symbol, Int64, Tuple{Symbol}, NamedTuple{(:verbose,), Tuple{Int64}}})
    @ HTTP.DefaultHeadersRequest ~/.julia/packages/HTTP/XR4MX/src/clientlayers/DefaultHeadersRequest.jl:47
  [9] (::HTTP.RedirectRequest.var"#1#4"{HTTP.RedirectRequest.var"#1#2#5"{HTTP.DefaultHeadersRequest.var"#1#3"{HTTP.DefaultHeadersRequest.var"#1#2#4"{HTTP.BasicAuthRequest.var"#1#3"{HTTP.BasicAuthRequest.var"#1#2#4"{HTTP.ContentTypeDetection.var"#1#3"{HTTP.ContentTypeDetection.var"#1#2#4"{HTTP.CookieRequest.var"#1#5"{HTTP.CookieRequest.var"#1#2#6"{HTTP.RetryRequest.var"#1#4"{HTTP.RetryRequest.var"#1#2#5"{HTTP.CanonicalizeRequest.var"#1#3"{HTTP.CanonicalizeRequest.var"#1#2#4"{HTTP.ConnectionRequest.var"#1#7"{HTTP.ConnectionRequest.var"#1#2#8"{HTTP.TimeoutRequest.var"#1#6"{HTTP.TimeoutRequest.var"#1#2#7"{HTTP.ExceptionRequest.var"#1#3"{HTTP.ExceptionRequest.var"#1#2#4"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}}}}}}}}}}}}}})(req::HTTP.Messages.Request; redirect::Bool, redirect_limit::Int64, redirect_method::Nothing, forwardheaders::Bool, response_stream::Nothing, kw::Base.Pairs{Symbol, Int64, Tuple{Symbol}, NamedTuple{(:verbose,), Tuple{Int64}}})
    @ HTTP.RedirectRequest ~/.julia/packages/HTTP/XR4MX/src/clientlayers/RedirectRequest.jl:25
 [10] #1#2
    @ ~/.julia/packages/HTTP/XR4MX/src/clientlayers/DebugRequest.jl:23 [inlined]
 [11] (::HTTP.MessageRequest.var"#1#3"{HTTP.MessageRequest.var"#1#2#4"{HTTP.DebugRequest.var"#1#4"{HTTP.DebugRequest.var"#1#2#5"{HTTP.RedirectRequest.var"#1#4"{HTTP.RedirectRequest.var"#1#2#5"{HTTP.DefaultHeadersRequest.var"#1#3"{HTTP.DefaultHeadersRequest.var"#1#2#4"{HTTP.BasicAuthRequest.var"#1#3"{HTTP.BasicAuthRequest.var"#1#2#4"{HTTP.ContentTypeDetection.var"#1#3"{HTTP.ContentTypeDetection.var"#1#2#4"{HTTP.CookieRequest.var"#1#5"{HTTP.CookieRequest.var"#1#2#6"{HTTP.RetryRequest.var"#1#4"{HTTP.RetryRequest.var"#1#2#5"{HTTP.CanonicalizeRequest.var"#1#3"{HTTP.CanonicalizeRequest.var"#1#2#4"{HTTP.ConnectionRequest.var"#1#7"{HTTP.ConnectionRequest.var"#1#2#8"{HTTP.TimeoutRequest.var"#1#6"{HTTP.TimeoutRequest.var"#1#2#7"{HTTP.ExceptionRequest.var"#1#3"{HTTP.ExceptionRequest.var"#1#2#4"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}}}}}}}}}}}}}}}}}})(method::String, url::URIs.URI, headers::Vector{Pair{SubString{String}, SubString{String}}}, body::Vector{UInt8}; response_stream::Nothing, http_version::VersionNumber, kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ HTTP.MessageRequest ~/.julia/packages/HTTP/XR4MX/src/clientlayers/MessageRequest.jl:17
 [12] #1
    @ ~/.julia/packages/HTTP/XR4MX/src/clientlayers/MessageRequest.jl:15 [inlined]
 [13] request(stack::HTTP.MessageRequest.var"#1#3"{HTTP.MessageRequest.var"#1#2#4"{HTTP.DebugRequest.var"#1#4"{HTTP.DebugRequest.var"#1#2#5"{HTTP.RedirectRequest.var"#1#4"{HTTP.RedirectRequest.var"#1#2#5"{HTTP.DefaultHeadersRequest.var"#1#3"{HTTP.DefaultHeadersRequest.var"#1#2#4"{HTTP.BasicAuthRequest.var"#1#3"{HTTP.BasicAuthRequest.var"#1#2#4"{HTTP.ContentTypeDetection.var"#1#3"{HTTP.ContentTypeDetection.var"#1#2#4"{HTTP.CookieRequest.var"#1#5"{HTTP.CookieRequest.var"#1#2#6"{HTTP.RetryRequest.var"#1#4"{HTTP.RetryRequest.var"#1#2#5"{HTTP.CanonicalizeRequest.var"#1#3"{HTTP.CanonicalizeRequest.var"#1#2#4"{HTTP.ConnectionRequest.var"#1#7"{HTTP.ConnectionRequest.var"#1#2#8"{HTTP.TimeoutRequest.var"#1#6"{HTTP.TimeoutRequest.var"#1#2#7"{HTTP.ExceptionRequest.var"#1#3"{HTTP.ExceptionRequest.var"#1#2#4"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}}}}}}}}}}}}}}}}}}, method::String, url::String, h::Vector{Any}, b::Vector{UInt8}, q::Dict{String, String}; headers::Vector{Any}, body::Vector{UInt8}, query::Dict{String, String}, kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ HTTP ~/.julia/packages/HTTP/XR4MX/src/HTTP.jl:417
 [14] request(stack::Function, method::String, url::String, h::Vector{Any}, b::Vector{UInt8}, q::Dict{String, String})
    @ HTTP ~/.julia/packages/HTTP/XR4MX/src/HTTP.jl:415
 [15] #request#16
    @ ~/.julia/packages/HTTP/XR4MX/src/HTTP.jl:277 [inlined]
 [16] get_data(f::Fred, series::String; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ FredData ~/.julia/packages/FredData/5M7x4/src/get_data.jl:52
 [17] get_data(f::Fred, series::String)
    @ FredData ~/.julia/packages/FredData/5M7x4/src/get_data.jl:32
 [18] top-level scope
    @ ~/Consulting/LakelandAppliedSciLLC/JuliaDataYouTube/CASchools/ReadingWritingData/FredTimeseries.jl:7

caused by: MethodError: no method matching sslconnection(::Type{Sockets.TCPSocket}, ::Sockets.TCPSocket, ::SubString{String}; require_ssl_verification=true, iofunction=nothing, decompress=nothing, verbose=0)
Closest candidates are:
  sslconnection(::Type{OpenSSL.SSLStream}, ::Sockets.TCPSocket, ::AbstractString; require_ssl_verification, sslconfig, kw...) at ~/.julia/packages/HTTP/XR4MX/src/ConnectionPool.jl:489
  sslconnection(::Type{MbedTLS.SSLContext}, ::Sockets.TCPSocket, ::AbstractString; require_ssl_verification, sslconfig, kw...) at ~/.julia/packages/HTTP/XR4MX/src/ConnectionPool.jl:503
Stacktrace:
  [1] sslupgrade(::Type{Sockets.TCPSocket}, c::HTTP.ConnectionPool.Connection, host::SubString{String}; require_ssl_verification::Bool, readtimeout::Int64, kw::Base.Pairs{Symbol, Union{Nothing, Int64}, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:iofunction, :decompress, :verbose), Tuple{Nothing, Nothing, Int64}}})
    @ HTTP.ConnectionPool ~/.julia/packages/HTTP/XR4MX/src/ConnectionPool.jl:533
  [2] (::HTTP.ConnectionRequest.var"#1#7"{HTTP.ConnectionRequest.var"#1#2#8"{HTTP.TimeoutRequest.var"#1#6"{HTTP.TimeoutRequest.var"#1#2#7"{HTTP.ExceptionRequest.var"#1#3"{HTTP.ExceptionRequest.var"#1#2#4"{typeof(HTTP.StreamRequest.streamlayer)}}}}}})(req::HTTP.Messages.Request; proxy::String, socket_type::Type, socket_type_tls::Type, readtimeout::Int64, kw::Base.Pairs{Symbol, Union{Nothing, Int64}, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:iofunction, :decompress, :verbose), Tuple{Nothing, Nothing, Int64}}})
    @ HTTP.ConnectionRequest ~/.julia/packages/HTTP/XR4MX/src/clientlayers/ConnectionRequest.jl:105
  [3] (::HTTP.CanonicalizeRequest.var"#1#3"{HTTP.CanonicalizeRequest.var"#1#2#4"{HTTP.ConnectionRequest.var"#1#7"{HTTP.ConnectionRequest.var"#1#2#8"{HTTP.TimeoutRequest.var"#1#6"{HTTP.TimeoutRequest.var"#1#2#7"{HTTP.ExceptionRequest.var"#1#3"{HTTP.ExceptionRequest.var"#1#2#4"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}})(req::HTTP.Messages.Request; canonicalize_headers::Bool, kw::Base.Pairs{Symbol, Union{Nothing, Int64}, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:iofunction, :decompress, :verbose), Tuple{Nothing, Nothing, Int64}}})
    @ HTTP.CanonicalizeRequest ~/.julia/packages/HTTP/XR4MX/src/clientlayers/CanonicalizeRequest.jl:17
  [4] (::Base.var"#88#90"{Base.var"#88#89#91"{ExponentialBackOff, HTTP.RetryRequest.var"#3#6"{Int64, HTTP.Messages.Request, Base.RefValue{Int64}}, HTTP.CanonicalizeRequest.var"#1#3"{HTTP.CanonicalizeRequest.var"#1#2#4"{HTTP.ConnectionRequest.var"#1#7"{HTTP.ConnectionRequest.var"#1#2#8"{HTTP.TimeoutRequest.var"#1#6"{HTTP.TimeoutRequest.var"#1#2#7"{HTTP.ExceptionRequest.var"#1#3"{HTTP.ExceptionRequest.var"#1#2#4"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}}}})(args::HTTP.Messages.Request; kwargs::Base.Pairs{Symbol, Union{Nothing, Int64}, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:iofunction, :decompress, :verbose), Tuple{Nothing, Nothing, Int64}}})
    @ Base ./error.jl:296
  [5] (::HTTP.RetryRequest.var"#1#4"{HTTP.RetryRequest.var"#1#2#5"{HTTP.CanonicalizeRequest.var"#1#3"{HTTP.CanonicalizeRequest.var"#1#2#4"{HTTP.ConnectionRequest.var"#1#7"{HTTP.ConnectionRequest.var"#1#2#8"{HTTP.TimeoutRequest.var"#1#6"{HTTP.TimeoutRequest.var"#1#2#7"{HTTP.ExceptionRequest.var"#1#3"{HTTP.ExceptionRequest.var"#1#2#4"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}}}})(req::HTTP.Messages.Request; retry::Bool, retries::Int64, retry_non_idempotent::Bool, kw::Base.Pairs{Symbol, Union{Nothing, Int64}, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:iofunction, :decompress, :verbose), Tuple{Nothing, Nothing, Int64}}})
    @ HTTP.RetryRequest ~/.julia/packages/HTTP/XR4MX/src/clientlayers/RetryRequest.jl:60
  [6] (::HTTP.CookieRequest.var"#1#5"{HTTP.CookieRequest.var"#1#2#6"{HTTP.RetryRequest.var"#1#4"{HTTP.RetryRequest.var"#1#2#5"{HTTP.CanonicalizeRequest.var"#1#3"{HTTP.CanonicalizeRequest.var"#1#2#4"{HTTP.ConnectionRequest.var"#1#7"{HTTP.ConnectionRequest.var"#1#2#8"{HTTP.TimeoutRequest.var"#1#6"{HTTP.TimeoutRequest.var"#1#2#7"{HTTP.ExceptionRequest.var"#1#3"{HTTP.ExceptionRequest.var"#1#2#4"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}}}}}})(req::HTTP.Messages.Request; cookies::Bool, cookiejar::HTTP.Cookies.CookieJar, kw::Base.Pairs{Symbol, Union{Nothing, Int64}, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:iofunction, :decompress, :verbose), Tuple{Nothing, Nothing, Int64}}})
    @ HTTP.CookieRequest ~/.julia/packages/HTTP/XR4MX/src/clientlayers/CookieRequest.jl:42
  [7] (::HTTP.ContentTypeDetection.var"#1#3"{HTTP.ContentTypeDetection.var"#1#2#4"{HTTP.CookieRequest.var"#1#5"{HTTP.CookieRequest.var"#1#2#6"{HTTP.RetryRequest.var"#1#4"{HTTP.RetryRequest.var"#1#2#5"{HTTP.CanonicalizeRequest.var"#1#3"{HTTP.CanonicalizeRequest.var"#1#2#4"{HTTP.ConnectionRequest.var"#1#7"{HTTP.ConnectionRequest.var"#1#2#8"{HTTP.TimeoutRequest.var"#1#6"{HTTP.TimeoutRequest.var"#1#2#7"{HTTP.ExceptionRequest.var"#1#3"{HTTP.ExceptionRequest.var"#1#2#4"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}}}}}}}})(req::HTTP.Messages.Request; detect_content_type::Bool, kw::Base.Pairs{Symbol, Union{Nothing, Int64}, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:iofunction, :decompress, :verbose), Tuple{Nothing, Nothing, Int64}}})
    @ HTTP.ContentTypeDetection ~/.julia/packages/HTTP/XR4MX/src/clientlayers/ContentTypeRequest.jl:23
  [8] (::HTTP.BasicAuthRequest.var"#1#3"{HTTP.BasicAuthRequest.var"#1#2#4"{HTTP.ContentTypeDetection.var"#1#3"{HTTP.ContentTypeDetection.var"#1#2#4"{HTTP.CookieRequest.var"#1#5"{HTTP.CookieRequest.var"#1#2#6"{HTTP.RetryRequest.var"#1#4"{HTTP.RetryRequest.var"#1#2#5"{HTTP.CanonicalizeRequest.var"#1#3"{HTTP.CanonicalizeRequest.var"#1#2#4"{HTTP.ConnectionRequest.var"#1#7"{HTTP.ConnectionRequest.var"#1#2#8"{HTTP.TimeoutRequest.var"#1#6"{HTTP.TimeoutRequest.var"#1#2#7"{HTTP.ExceptionRequest.var"#1#3"{HTTP.ExceptionRequest.var"#1#2#4"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}}}}}}}}}})(req::HTTP.Messages.Request; basicauth::Bool, kw::Base.Pairs{Symbol, Union{Nothing, Int64}, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:iofunction, :decompress, :verbose), Tuple{Nothing, Nothing, Int64}}})
    @ HTTP.BasicAuthRequest ~/.julia/packages/HTTP/XR4MX/src/clientlayers/BasicAuthRequest.jl:22
  [9] (::HTTP.DefaultHeadersRequest.var"#1#3"{HTTP.DefaultHeadersRequest.var"#1#2#4"{HTTP.BasicAuthRequest.var"#1#3"{HTTP.BasicAuthRequest.var"#1#2#4"{HTTP.ContentTypeDetection.var"#1#3"{HTTP.ContentTypeDetection.var"#1#2#4"{HTTP.CookieRequest.var"#1#5"{HTTP.CookieRequest.var"#1#2#6"{HTTP.RetryRequest.var"#1#4"{HTTP.RetryRequest.var"#1#2#5"{HTTP.CanonicalizeRequest.var"#1#3"{HTTP.CanonicalizeRequest.var"#1#2#4"{HTTP.ConnectionRequest.var"#1#7"{HTTP.ConnectionRequest.var"#1#2#8"{HTTP.TimeoutRequest.var"#1#6"{HTTP.TimeoutRequest.var"#1#2#7"{HTTP.ExceptionRequest.var"#1#3"{HTTP.ExceptionRequest.var"#1#2#4"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}}}}}}}}}}}})(req::HTTP.Messages.Request; iofunction::Nothing, decompress::Nothing, kw::Base.Pairs{Symbol, Int64, Tuple{Symbol}, NamedTuple{(:verbose,), Tuple{Int64}}})
    @ HTTP.DefaultHeadersRequest ~/.julia/packages/HTTP/XR4MX/src/clientlayers/DefaultHeadersRequest.jl:47
 [10] (::HTTP.RedirectRequest.var"#1#4"{HTTP.RedirectRequest.var"#1#2#5"{HTTP.DefaultHeadersRequest.var"#1#3"{HTTP.DefaultHeadersRequest.var"#1#2#4"{HTTP.BasicAuthRequest.var"#1#3"{HTTP.BasicAuthRequest.var"#1#2#4"{HTTP.ContentTypeDetection.var"#1#3"{HTTP.ContentTypeDetection.var"#1#2#4"{HTTP.CookieRequest.var"#1#5"{HTTP.CookieRequest.var"#1#2#6"{HTTP.RetryRequest.var"#1#4"{HTTP.RetryRequest.var"#1#2#5"{HTTP.CanonicalizeRequest.var"#1#3"{HTTP.CanonicalizeRequest.var"#1#2#4"{HTTP.ConnectionRequest.var"#1#7"{HTTP.ConnectionRequest.var"#1#2#8"{HTTP.TimeoutRequest.var"#1#6"{HTTP.TimeoutRequest.var"#1#2#7"{HTTP.ExceptionRequest.var"#1#3"{HTTP.ExceptionRequest.var"#1#2#4"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}}}}}}}}}}}}}})(req::HTTP.Messages.Request; redirect::Bool, redirect_limit::Int64, redirect_method::Nothing, forwardheaders::Bool, response_stream::Nothing, kw::Base.Pairs{Symbol, Int64, Tuple{Symbol}, NamedTuple{(:verbose,), Tuple{Int64}}})
    @ HTTP.RedirectRequest ~/.julia/packages/HTTP/XR4MX/src/clientlayers/RedirectRequest.jl:25
 [11] #1#2
    @ ~/.julia/packages/HTTP/XR4MX/src/clientlayers/DebugRequest.jl:23 [inlined]
 [12] (::HTTP.MessageRequest.var"#1#3"{HTTP.MessageRequest.var"#1#2#4"{HTTP.DebugRequest.var"#1#4"{HTTP.DebugRequest.var"#1#2#5"{HTTP.RedirectRequest.var"#1#4"{HTTP.RedirectRequest.var"#1#2#5"{HTTP.DefaultHeadersRequest.var"#1#3"{HTTP.DefaultHeadersRequest.var"#1#2#4"{HTTP.BasicAuthRequest.var"#1#3"{HTTP.BasicAuthRequest.var"#1#2#4"{HTTP.ContentTypeDetection.var"#1#3"{HTTP.ContentTypeDetection.var"#1#2#4"{HTTP.CookieRequest.var"#1#5"{HTTP.CookieRequest.var"#1#2#6"{HTTP.RetryRequest.var"#1#4"{HTTP.RetryRequest.var"#1#2#5"{HTTP.CanonicalizeRequest.var"#1#3"{HTTP.CanonicalizeRequest.var"#1#2#4"{HTTP.ConnectionRequest.var"#1#7"{HTTP.ConnectionRequest.var"#1#2#8"{HTTP.TimeoutRequest.var"#1#6"{HTTP.TimeoutRequest.var"#1#2#7"{HTTP.ExceptionRequest.var"#1#3"{HTTP.ExceptionRequest.var"#1#2#4"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}}}}}}}}}}}}}}}}}})(method::String, url::URIs.URI, headers::Vector{Pair{SubString{String}, SubString{String}}}, body::Vector{UInt8}; response_stream::Nothing, http_version::VersionNumber, kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ HTTP.MessageRequest ~/.julia/packages/HTTP/XR4MX/src/clientlayers/MessageRequest.jl:17
 [13] #1
    @ ~/.julia/packages/HTTP/XR4MX/src/clientlayers/MessageRequest.jl:15 [inlined]
 [14] request(stack::HTTP.MessageRequest.var"#1#3"{HTTP.MessageRequest.var"#1#2#4"{HTTP.DebugRequest.var"#1#4"{HTTP.DebugRequest.var"#1#2#5"{HTTP.RedirectRequest.var"#1#4"{HTTP.RedirectRequest.var"#1#2#5"{HTTP.DefaultHeadersRequest.var"#1#3"{HTTP.DefaultHeadersRequest.var"#1#2#4"{HTTP.BasicAuthRequest.var"#1#3"{HTTP.BasicAuthRequest.var"#1#2#4"{HTTP.ContentTypeDetection.var"#1#3"{HTTP.ContentTypeDetection.var"#1#2#4"{HTTP.CookieRequest.var"#1#5"{HTTP.CookieRequest.var"#1#2#6"{HTTP.RetryRequest.var"#1#4"{HTTP.RetryRequest.var"#1#2#5"{HTTP.CanonicalizeRequest.var"#1#3"{HTTP.CanonicalizeRequest.var"#1#2#4"{HTTP.ConnectionRequest.var"#1#7"{HTTP.ConnectionRequest.var"#1#2#8"{HTTP.TimeoutRequest.var"#1#6"{HTTP.TimeoutRequest.var"#1#2#7"{HTTP.ExceptionRequest.var"#1#3"{HTTP.ExceptionRequest.var"#1#2#4"{typeof(HTTP.StreamRequest.streamlayer)}}}}}}}}}}}}}}}}}}}}}}}}, method::String, url::String, h::Vector{Any}, b::Vector{UInt8}, q::Dict{String, String}; headers::Vector{Any}, body::Vector{UInt8}, query::Dict{String, String}, kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ HTTP ~/.julia/packages/HTTP/XR4MX/src/HTTP.jl:417
 [15] request(stack::Function, method::String, url::String, h::Vector{Any}, b::Vector{UInt8}, q::Dict{String, String})
    @ HTTP ~/.julia/packages/HTTP/XR4MX/src/HTTP.jl:415
 [16] #request#16
    @ ~/.julia/packages/HTTP/XR4MX/src/HTTP.jl:277 [inlined]
 [17] get_data(f::Fred, series::String; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ FredData ~/.julia/packages/FredData/5M7x4/src/get_data.jl:52
 [18] get_data(f::Fred, series::String)
    @ FredData ~/.julia/packages/FredData/5M7x4/src/get_data.jl:32
 [19] top-level scope
    @ ~/Consulting/LakelandAppliedSciLLC/JuliaDataYouTube/CASchools/ReadingWritingData/FredTimeseries.jl:7

Formatting problem with TimeZones

After upgrading to Julia 1.3.1 yesterday, I encountered the following error while trying to fetch the US GDP series from FRED:

MethodError: Cannot convert an object of type TimeZones.ZonedDateTime to an object of type DateTime
Closest candidates are:
 convert(::Type{DateTime}, !Matched::Date) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/Dates/src/conversions.jl:30
 convert(::Type{DateTime}, !Matched::Millisecond) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/Dates/src/conversions.jl:34
 convert(::Type{DateTime}, !Matched::PyCall.PyObject) at /Users/jensherold/.julia/packages/PyCall/ttONZ/src/pydates.jl:135
 ...
DateTime(::TimeZones.ZonedDateTime) at conversions.jl:20
(::FredData.var"#parse_last_updated#4")(::String) at get_data.jl:82
#get_data#3(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::typeof(get_data), ::Fred, ::String) at get_data.jl:84
get_data(::Fred, ::String) at get_data.jl:34
top-level scope at hp_filter_us_gdp_FRED_pull.jl:7

This is my minimum working example:

using FredData

f = Fred()
Fred_Key  = "GDPC1"
pull_data = get_data(f, Fred_Key)

I am running this code on Juno in Atom using FredData version v0.3.1

Any help/ideas is appreciated.

Best,

Jens

Make API more idiomatic

Some parts of the FredData.jl API could be made more idiomatic. Notable examples are

  • df(s::FredSeries accesses the DataFrame, but df is commonly used as a variable
  • get_data(f, series) downloads the specified data series. It would be better if there was a function that wascommonly used across packages for this sort of task, such as get, fetch, or download.

I find that the functions used to access data from the FredSeries object are not very intuitive. It may make sense to replace realtime_end with get_realtime_end e.g. One could also access fields by defining methods for getindex and using s[:realtime_end]. (This latter solution allows s[:data] which seems better than df(s)).

Any input is welcomed from those browsing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.