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: AlphaVantage.jl - Getting Market Data into Julia | Dean Markwick
and you can view the project here: https://github.com/ellisvalentiner/AlphaVantage.jl

22 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

https://github.com/ellisvalentiner/AlphaVantage.jl/blob/0aae3c481f2732d91cc58daaa8c0c1ee022681a7/src/AlphaVantage.jl#L14

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
Plotting Market Data from AlphaVantage.jl with Gnuplot.jl - Nextjournal! Here, some examples.

2 Likes

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

The package has since been updated to provide fundamental data for stocks. You can read more about these new functions here: Fundamental Stock Data from AlphaVantage.jl | Dean Markwick

4 Likes

The tutorial is very helpful However, can I download the stock data for several stocks with alphavantage API and save it on a local database using a cron job that runs during market hours daily?

Yeah, nothing stopping you doing that. I would be aware of the limits of their free tier though

Does it have the ability to include commodity prices?

They don’t provide explicit commodity prices but you could use an ETF like USO for oil etc.

Ok thanks

Recently updated with economic indicators. Read about the new features here: Economic Indicators from AlphaVantage | Dean Markwick

2 Likes