AlphaVantage.jl - A New Package for Getting Market Data into Julia

Hot off the general repository is a new package for using the AlphaVantage API in Julia.

AlphaVantage provides a free tier of stock, fx and cyrpto data, with even intraday level of detail. You can use this package to easily get the data into your projects.

I’ve written a tutorial here: http://dm13450.github.io/2020/07/05/AlphaVantage.html
and you can view the project here: https://github.com/ellisvalentiner/AlphaVantage.jl

16 Likes

Great work!

1 Like

Hey, once I get my API keys, how do I set them up?, now I get this warning:

julia> using AlphaVantage
┌ Warning: No API key found
└ @ AlphaVantage ~/.julia/packages/AlphaVantage/ZJWPi/src/AlphaVantage.jl:15

so, how do I resolve this?

1 Like

you want to put your key in your environment variable

1 Like

this looks rather cumbersome…and not completly clear. It should be more intuitive…

1 Like

before loading your package, just do:

ENV["ALPHA_VANTAGE_API_KEY"] = <your key>, easy, no?

1 Like

yes. This works… so a MWE will be:

ENV["ALPHA_VANTAGE_API_KEY"] = "your key"
using AlphaVantage
using DataFrames
using StatPlots
gr(size=(800,470))
# Get daily S&P 500 data
spy = time_series_daily("SPY", datatype="csv");
# Convert to a DataFrame
data = DataFrame(spy[1]);
# Add column names
data = rename(data, Symbol.(vcat(spy[2]...)));
# Convert timestamp column to Date type
data[!, :timestamp] = Dates.Date.(data[!, :timestamp]);
data[!, :open] = Float64.(data[!, :open])
# Plot the timeseries
plot(data[!, :timestamp], data[!, :open], label=["Open"])
savefig("sp500.png")

Nice !, thanks !!

1 Like

Thanks everyone, I’ve updated the readme to help with this.

Hello,
I took your post idea and replot everything with Gnuplot, I think it looks nicer. Take a look at
https://nextjournal.com/lazarus/plotting-market-data-from-alphavantagejl-with-gnuplotjl! Here, some examples.

1 Like

Those look great, I’ve tweeted it out, great work!

1 Like

@dm13450 Hello, your AlphaVantage package look awesome, i´m looking forward to used, i was wondering if you guys can help me make it run. I followed the instruction, i got the Key and everything, but when i try to run the code that you have I got the following error:

IOError(MbedTLS error code -9984: X509 - Certificate verification failed, e.g. CRL, CA or signature check failed during request(https://www.alphavantage.co/query?function=FX_INTRADAY&from_symbol=USD&to_symbol=CLP&interval=1min&outputsize=compact&datatype=csv&apikey= Key)) (i got the key number there)

I try to go to the link and I’m able to get a csv with the data, so i guess is something with Julia, i try look it how to solve it but i didn’t find anything. I’m new to Julia.

Hope you guys can help me, I would really appreciated.

Thanks for using the package and sorry that it doesn’t seem to be working.
A few things you can try:
Can you confirm that your api key is in the ENV correctly? I.e. ENV["ALPHA_VANTAGE_API_KEY"]
should return your key.
Secondly, try updating your packages?
] update
Otherwise I’m not too sure what is going wrong, it looks like an error in one of the networking packages AlphaVantage.jl uses. I’ve been able to pull USDCLP data on my machine without the error.

It worked now, i updated the packages and also maybe the Api key needs a while in order to be recognize by data base, well thank you for your fast answers and for your help.

Grettings.

1 Like