MarketData does not return any data with an error in HTTP request() call

I just tried using the MarketData package, and even the basic command returns an error. I’ve tried passing a symbol or even a symbol with a custom YahooOpt struct and also getting the same error. Weirdly it seems to be having a problem with the HTTP package.

julia> using MarketData
julia> yahoo()
ERROR: MethodError: no method matching request(::String, ::String; query=YahooOpt(:period1 => 34819200, :period2 => 1662398347, :interval => "1d", :events => :history))
 [1] get(a::String; kw::Base.Pairs{Symbol, YahooOpt, Tuple{Symbol}, NamedTuple{(:query,), Tuple{YahooOpt}}})
   @ HTTP ~/.julia/packages/HTTP/aTjcj/src/HTTP.jl:407
 [2] yahoo(sym::String, opt::YahooOpt)
   @ MarketData ~/.julia/packages/MarketData/K5wnv/src/downloads.jl:95
 [3] yahoo(sym::String) (repeats 2 times)
   @ MarketData ~/.julia/packages/MarketData/K5wnv/src/downloads.jl:93
 [4] top-level scope
   @ REPL[36]:1

I’m on Julia 1.7.3 and here are my package versions:
(jhal) pkg> status
Project jhal v0.1.0
Status ~/jhal/Project.toml
[6348297c] AlphaVantage v0.4.1
[a10d1c49] DBInterface v2.5.0
[cf6cc811] FunSQL v0.10.2
[cd3eb016] HTTP v0.9.17
[0f8b85d8] JSON3 v1.9.5
[194296ae] LibPQ v1.14.0
[945b72a4] MarketData v0.13.12

1 Like

Hmmm, I’m not quite sure how you would get that error; it seems like an internal HTTP.jl error, but that version has been released for quite a long time, so it seems suspicious that a key API isn’t working? Can you upgrade to HTTP.jl 1.0 release? It included a lot of fixes for a lot of things.

OK this is weird (newbie here). I tested and even the basic HTTP.request(“GET”, ) was failing. I restarted my REPL and it now works perfectly.

I also tried to upgrade my HTTP package but it weirdly doesn’t see the new versions.

(jhal) pkg> update HTTP
    Updating registry at `~/.julia/registries/General.toml`
  No Changes to `~/jhal/Project.toml`
  No Changes to `~/jhal/Manifest.toml`
Precompiling project...
  1 dependency successfully precompiled in 10 seconds (64 already precompiled)

(jhal) pkg> st HTTP
     Project jhal v0.1.0
      Status `~/jhal/Project.toml`
  [cd3eb016] HTTP v0.9.17

In Julia packages must specific also an upper compatibility limit with other packages, so it is well possible that other package force HTTP.jl on that specific version.
The is a way to find the culprit, but I am on a mobile and forgot it :slight_smile:
Note that this is one reason to have a separate environment for each project one works with, rather than work always at the global environment (in Julia environments are cheap, as the different packages are not copied on each environment)

Thanks everyone