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.
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")
@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:
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.
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?