Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alpha Vantage API Review #13

Closed
wickenden-g opened this issue Aug 19, 2017 · 68 comments
Closed

Alpha Vantage API Review #13

wickenden-g opened this issue Aug 19, 2017 · 68 comments

Comments

@wickenden-g
Copy link

wickenden-g commented Aug 19, 2017

Alpha Vantage API Review from a Python Developer

@RomelTorres congratulations on your wonderful python library for Alpha Vantage!

I am a full-stack python developer who uses the Alpha Vantage API to develop trading strategies for stocks, ETFs, and OTCs. I am wondering whether you are affiliated with Alpha Vantage, and whether this is a good place for me to leave a 360° review on their API service for future reference by the developer community.

So technically this is not a bug report or feature request - hope it's OK with you :)

The Experience

I was one of the "yahoo refugees" who stumbled upon Alpha Vantage via Google search. My first interactions with their website could be summarized by the good-old term WYSIWYG (what-you-see-is-what-you-get). Their documentation promised three things: (1) time series data with various resolutions, (2) over 50 technical signals, (3) sector data, and they kept their promise by providing demo URLs for all the said API functions.

image

They promised free API keys, and they also delivered. They promised "no promotional materials to your inbox," and indeed the only email I got from them so far was the announcement email for their new CSV feature.

This being said, there are a couple areas they could optimize upon.

  • Be more specific about their business model. Being "100% free" is good, but it can also be a bit scary, especially for a yahoo refugee like me.
  • Add multi-symbol support so that one can query multiple stocks with a single API call.
  • Their FAQ recommends "~200 API calls per minute." It would be great if they can set a hard limit on the call volume to prevent client-side abuses in the form of ultra-high-frequency requests.

The Data

Of the thousands of US-based equities I have analyzed so far, their historical data and technical indicators seem to match other reputable data sources. Their intraday data is realtime up to the current minute, which is fine for my research purposes but may not satisfy users who want to beat the market with millisecond precision. Perhaps a premium feature for this down the road?

Their JSON output is easily readable and python-parsable. For the daily time series, however, I understand that their most recent data point is the cumulative information of the current trading day (updated realtime), but why is the first timestamp in YYYY-MM-DD HH:MM:SS format while all the others are in the normal YYYY-MM-DD format typical of the EOD data?

"Meta Data": {
"1. Information": "Daily Prices (open, high, low, close) and Volumes",
"2. Symbol": "MSFT",
"3. Last Refreshed": "2017-08-18 16:00:00",
"4. Output Size": "Compact",
"5. Time Zone": "US/Eastern"
},
"Time Series (Daily)": {
"2017-08-18 16:00:00": {
"1. open": "72.2700",
"2. high": "72.8400",
"3. low": "71.9300",
"4. close": "72.4900",
"5. volume": "18215276"
},
"2017-08-17": {
"1. open": "73.5800",
"2. high": "73.8700",
"3. low": "72.4000",
"4. close": "72.4000",
"5. volume": "21834250"
},

I would love to see a consistent YYYY-MM-DD format across all the timestamps. The "last refreshed" timestamp can be specified in Meta Data instead:

"Meta Data": {
"1. Information": "Daily Prices (open, high, low, close) and Volumes",
"2. Symbol": "MSFT",
"3. Last Refreshed": "2017-08-18 16:00:00",
"4. Output Size": "Compact",
"5. Time Zone": "US/Eastern"
},
"Time Series (Daily)": {
"2017-08-18": {
"1. open": "72.2700",
"2. high": "72.8400",
"3. low": "71.9300",
"4. close": "72.4900",
"5. volume": "18215276"
},
"2017-08-17": {
"1. open": "73.5800",
"2. high": "73.8700",
"3. low": "72.4000",
"4. close": "72.4000",
"5. volume": "21834250"
},

In addition to the data presentation aspects, below are couple other data-related proposals:

  • Expand CSV support to all API functions. CSV is currently enabled only for the time series APIs.
  • Make error messages more informative for debugging purposes.

In Summary

It is always a pleasure to have an API service that is well documented, platform/language-agnostic, and easily integratable. The fact that we have several third-party libraries built on top of Alpha Vantage on GitHub is in a sense testament to its developer-friendly nature. While there is still room for them to become a better version of themselves, I hope they thrive and stay true to the description on their home page - "driven by rigorous research, cutting edge technology, and a disciplined focus on democratizing access to data."

@RomelTorres
Copy link
Owner

RomelTorres commented Aug 19, 2017

@wickenden-g Thank you very much for your incredible review.

Sadly I am not related to Alpha Vantage. One day I also discovered their API while googling and decided to write the python wrapper for it as my first step in playing around with financial algorithms. I am very happy and grateful for the acceptance it has had in the community since this is my first open source project.

I would contact them directly on their website. They actually write back quickly and are always open to suggestions. Yours seem pretty reasonable. I was thinking on suggesting them on having some sort of company account in Github.

Thanks again for the
Romel

@frederic-adda
Copy link

Is it only US-stocks?

@coryleuck
Copy link

@frederic-adda According to my experience with Alpha Vantage, it covers US-based stocks, ETFs, and mutual funds AND stocks traded on major global stock exchanges. Perhaps @RomelTorres could shed some light on this?

@thecodeflash
Copy link

thecodeflash commented Nov 16, 2017

@frederic-adda @RomelTorres @coryleuck If you want to get data of Stocks from other exchanges other then US-Stock exchanges then you need to do something like this, If I wanted to get the stock value for TITAN from Indian Exchange NSE, then I need to use this in symbol NSE:TITAN .

Ex:

ts = TimeSeries(key='API_KEY', output_format='pandas')
data, meta_data = ts.get_daily_adjusted(symbol='NSE:TITAN', outputsize='full')
data['close'].plot()
plt.title('Daily Adjusted for the TITAN stock ')
plt.show()

@frederic-adda
Copy link

frederic-adda commented Nov 16, 2017 via email

@thecodeflash
Copy link

@frederic-adda I doubt that there is an API which will provide you the list of all Stock Exchanges around the world.

But still are here some links that might help you out, http://www.wikinvest.com/wiki/List_of_Stock_Exchanges
http://www.eoddata.com/

@frederic-adda
Copy link

frederic-adda commented Nov 16, 2017 via email

@kevingebert
Copy link

HI, great python framework. Thank you so much for putting it together. I would love to see the adjusted data as an option

@RomelTorres
Copy link
Owner

Hi @kevingebert; what do you mean by adjusted data? Any call from the API I am missing?

@kevingebert
Copy link

Maybe I am missing it. I'm talking about the split adjusted data.

@samperd
Copy link

samperd commented Nov 28, 2017

@RomelTorres ,

Great work on the API wrapper. I use the yahoo python wrapper ystocks a number of years ago. now that I have returned to a financial project I learned about the changes at yahoo. And then i found Alpha Vantage and then your API.

I will poke through the basics and see what is there right now.

The first thing I have not been able to find is the dividend event data. See issue #27

Great work so far.

@vignesh989
Copy link

Hi Guys,
@RomelTorres,@wickenden-g
This is a really amazing API, now that Google API is no longer supporting APIs. This seems to be the next best thing.
I have two major concerns, I'm creating a Machine Learning algorithm to predict trends. So for this, I require Intraday data ( 5Mins ) for a stock for the past let's say 200 days, as a training set for my algorithm.

  1. Is there a way to specify past x days, or specify the date on which I want the intraday data for ?

  2. @Vj-vicky What seems to be wrong with my query?
    https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol=NSE:TITAN&outputsize=compact&interval=5min&datatype=json&apikey=Key
    The Solution you suggested for the specifying the EXchange is not working it is returning me an error.

@RomelTorres
Copy link
Owner

Hi @vignesh989 if it is not specified in the API by alphavantage, it is not doable direct in the python wrapper, nevertheless once you have the data in a pandas data frame. It should be easy to slice it. I would say first do the intraday call with full size and then slice it from there.

@vignesh989
Copy link

@RomelTorres Thank you, I get a max for past 3 days even if I get the full size, I guess I should try a different data source.

@ellissitzky
Copy link

Hi, I am currently developing a basic Java (Android) app for portfolios management. Alpha Vantage data are very good for my purpose. I am wondering if i can load this applet on GooglePlay (free with little advertising) each user should request his own ApiKey. Could it be compatible with the terms of usage?Thank you.

@RomelTorres
Copy link
Owner

Hi @ellissitzky. That I cannot answer you, since here in github I just habe the python wrapper. Please send an email to the people from alphavantage on their website.

Thanks,

Romel

@ellissitzky
Copy link

@RomelTorres, thank you for your answer, i first asked to this blog in order to know if this info were already clear.. I read everything on AlphaVantage site, but the only part that may be about the topic is : https://www.alphavantage.co/terms_of_service/ - Intellectual Property. It's no clearly expressed a prohibition of use in apps, etc, but not even an encouragement to it. So, I will ask them by email .
Thanks,
Giuseppe

@team-alphavantage
Copy link

@ellissitzky Thank you for developing the Java application on top of Alpha Vantage. We have addressed your request via support@alphavantage.co

@ellissitzky
Copy link

@team-alphavantage, I just read (and answered) it!
Thanks, Great!

@RobertFlatt
Copy link

RobertFlatt commented Dec 12, 2017

Wonderful piece of work, thank you.

One small issue using "get_digital_currency_daily()". The result is returned in two currencies, market and USD, OK. But if I set the market to USD I get duplicate Pandas labels.

So indexing a row ( row['. close (USD)'] ) results in a two element series for USD, and a scalar for other markets. I can special case USD, but it would be nice if you did as this might be a surprise for somebody.

@RomelTorres
Copy link
Owner

Hi @Ham-Merhead, I will have to check it out, I have been super busy lately and have not had a chance to sit down and solve some of the issues that have arisen in the past few weeks. Could you please post this in a separate issue with the piece of code and the resulting pandas data frame?

I am planning to do a rework of the unittests, since they are not working well anymore, although most of the calls are correct (because I was a noob and did not know better when I wrote that part of code)

I will try to get some free time and sit and do it properly.

Saludos Romel

@RobertFlatt
Copy link

Done. Thanks for the the response. I have a workaround for now. Interesting question as to if any change would happen here or by AV.......

@igorcc
Copy link

igorcc commented Jan 5, 2018

What's about Swiss Exchange (SIX) ? I tried to request SIX:NESN but with no success.. Is there a way to request data from SIX, LSE, Xetra?
Thanks!

@ChillarAnand
Copy link

@vignesh989 Did you manage to get data from NSE? I am not able to pull the data. Here is the sample code.

import os

from alpha_vantage.timeseries import TimeSeries


key = os.environ.get('ALPHAVANTAGE_KEY')
print(key)
ts = TimeSeries(key=key)

data, meta_data = ts.get_intraday('NSE:TITAN')
# data, meta_data = ts.get_intraday('NSE:RELIANCE')
# data, meta_data = ts.get_intraday('GOOGL')
print(meta_data)

@igorcc
Copy link

igorcc commented Jan 5, 2018

I cannot retrieve data for NSE. Just TITAN works well.
NSE:TITAN produces following error: "ValueError: Invalid API call. Please retry or visit the documentation (https://www.alphavantage.co/documentation/) for TIME_SERIES_INTRADAY."

@RomelTorres
Copy link
Owner

Hi people, you can try directly in a web browser and see if it works. If it does create a new issue and I will work on it. If not we can ask in the alphavantage forum.

@igorcc
Copy link

igorcc commented Jan 5, 2018

Browser produces the same error. I think the problem is in alphavantage data.

@vignesh989
Copy link

@ChillarAnand @igorcc No Guys they do not support it as of now, So this is workaround. So you can determine if the data is coming from NYSE or NSE the following way.
You can convert date column to your local time.
DateTime estTime = Convert.ToDateTime(item.Key.ToString());
TimeZoneInfo estZone = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
TimeZoneInfo istZone = TimeZoneInfo.Local;
DateTime yourLocalTime = TimeZoneInfo.ConvertTime(estTime, estZone, istZone);

If the market Start Time/End Time syncs with your market time it means its from your market, else its from NYSE.

image
If you look at the image above you will see that the closing time for HDFC ( NSE ) and INFY ( NYSE ) is different. If you convert it to IST it translates to 3:30 PM ( NSE closing time )

So the best bet for people who are working with other markets is ignore stocks that have the same symbol as the stocks in NYSE.

image

@ChillarAnand this is still a very good set of stocks, in NIFTY50 only 3 gets eliminated this way, rest of the stock data works as expected.

@team-alphavantage It would be wonderful if you can add a parameter to your API to specify the market.

@RomelTorres I'm so sorry to hijack your thread like this.

@mark100net
Copy link

@sanjes1 They have never responded to me. They don't believe in support apparently.

@SterlingButters
Copy link

SterlingButters commented Feb 10, 2019

  1. Is there a way to specify past x days, or specify the date on which I want the intraday data for?

I too would much like to see this since even though panda df slicing isnt a problem, trying to download a mass of data for one data point is quite expensive. This the most anticipated prospective feature of the Alpha Vantage API for me.

@sanjes1 @mark100net Can confirm. I have reached out to them several times with this^ inquiry (dating weeks back) but received no response... Maybe if we all send a request? haha

@sanjes1
Copy link

sanjes1 commented Feb 12, 2019

Ok, so they will talk, but you need to pay them. I subscribed to their monthly plan. They responded pretty quick.
Also for my question they provide last 1 week~ of intraday 1 min data. I dont see any interface to request for a particular date

@SterlingButters
Copy link

@sanjes1 The "~" 1 week of intraday depends on how many days the market is open out of the that last 7 I believe. I would use your premium status to request features such as that if you haven't already.

@sanjes1
Copy link

sanjes1 commented Feb 12, 2019

@SterlingButters
I tried, They said, they are working on it to get more data and dont have any dates :)

@ramkoduru
Copy link

Hi, Is there any way where we can get information of the corresponding sector for the stocks we get the data or any way we can pull the stock performance(API available) along with corresponding industries. i am working on stock predictions so checking i may get any help on this

@StevenWilliams
Copy link

What's the split coefficient supposed to be? I checked for some stocks that split and it was always 1.00

@hsunesen
Copy link

For me it has worked, using this formel for symbol, for european stocks:

Fingerprint Cards (STO: FING-B) == FING-B.STO
Novo Nordisk (CPH: NOVO-B) == NOVO-B.CPH
BMW (DE: BMW) == BMW.DE

I think you got the point ;)

@PushT
Copy link

PushT commented Sep 28, 2019

If AlphaVantage are rearranging the letters in the acronyms of the stocks on different stock exchanges(for their API calls), they have to have a list clarifying the logic behind that. There IS no logic otherwise.

@BipinSha
Copy link

BipinSha commented Nov 5, 2019

NSE:TITAN

@RomelTorres @thecodeflash, are you guys getting the correct timestamp for NSE:TITAN or any other NSE stock, i think it should show till 3:30 PM or something, it is showing 4:59.

@PatrickAlphaC
Copy link
Collaborator

NSE:TITAN

@RomelTorres @thecodeflash, are you guys getting the correct timestamp for NSE:TITAN or any other NSE stock, i think it should show till 3:30 PM or something, it is showing 4:59.

If you look at the time zone, it's in 6. Time Zone: "US/Eastern" you'll have to convert it to IST if that's what you're looking for.
Check out this thread in StackOverflow that answers the question.

@jcisio
Copy link

jcisio commented Nov 21, 2019

Hello,

I know this is a long thread with a lot of questions. I should not add another comment, but I will do now, because there is a repeated question without a real question.

To get the symbol of the instrument, you can search using ISIN. For example https://www.alphavantage.co/query?function=SYMBOL_SEARCH&keywords=FR0000120172&apikey=demo

{
    "bestMatches": [
        {
            "1. symbol": "CA.PAR",
            "2. name": "Carrefour SA",
            "3. type": "Equity",
            "4. region": "Paris",
            "5. marketOpen": "09:00",
            "6. marketClose": "17:30",
            "7. timezone": "UTC+01",
            "8. currency": "EUR",
            "9. matchScore": "0.1667"
        }
    ]
}

@spateltc
Copy link

spateltc commented Jan 6, 2020

how to fetch data for nifty 50?can anyone help me with the url which fetch nifty 50 data

@PatrickAlphaC
Copy link
Collaborator

Hi @spateltc,

Currently, Alpha Vantage has support for stocks, crypto, TIs, sector, and FX. Index data you can get from pulling the individual stocks in the nifty 50.

@jcisio
Copy link

jcisio commented Jan 6, 2020

how to fetch data for nifty 50?can anyone help me with the url which fetch nifty 50 data

The symbol is NFTY. Use the search function as I pointed out in the previous comment to find the symbol. The first result is the correct one.

https://www.alphavantage.co/query?function=SYMBOL_SEARCH&keywords=NIFTY&apikey=${"apikey"}

{
    "bestMatches": [
        {
            "1. symbol": "NFTY",
            "2. name": "First Trust India NIFTY 50 Equal Weight ETF",
            "3. type": "ETF",
            "4. region": "United States",
            "5. marketOpen": "09:30",
            "6. marketClose": "16:00",
            "7. timezone": "UTC-05",
            "8. currency": "USD",
            "9. matchScore": "0.8889"
        },
        {
            "1. symbol": "ICICINIFTY.BSE",
            "2. name": "ICICI Prudential Nifty ETF",
            "3. type": "Equity",
            "4. region": "India/Bombay",
            "5. marketOpen": "09:15",
            "6. marketClose": "15:30",
            "7. timezone": "UTC+5.5",
            "8. currency": "INR",
            "9. matchScore": "0.5556"
        }
    ]
}

Then fetch the data:

https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol=NFTY&apikey=${"apikey"}

{
    "Global Quote": {
        "01. symbol": "NFTY",
        "02. open": "34.8600",
        "03. high": "34.8600",
        "04. low": "34.8600",
        "05. price": "34.8600",
        "06. volume": "6",
        "07. latest trading day": "2020-01-06",
        "08. previous close": "34.9252",
        "09. change": "-0.0652",
        "10. change percent": "-0.1867%"
    }
}

@jcisio
Copy link

jcisio commented Jan 6, 2020

Please ignore my previous comment. It was about an ETF. As per @PatrickAlphaVantage 's answer, to calculate an index, calculate the components is a solution.

@PatrickAlphaC
Copy link
Collaborator

Thanks @jcisio for the info on the ETF

@jcisio
Copy link

jcisio commented Jan 6, 2020

@PatrickAlphaVantage I was looking for an alternative to my costly provider and alphavantage was one of the candiates but it has some blocking problems. Now I've just found out another big problem: no index data :( I've just searching a few examples and it really does not have index data. We can also use maths to calculate, but then it adds extra complexity.

@wickenden-g
Copy link
Author

Hi folks, I am the OP of this Github issue. Appreciate the responses to my post (my inbox is exploding!), but frankly I don't feel comfortable seeing my review article morphing into tangential discussions. This issue is for reviewing the Alpha Vantage APIs, not for technical support or marketing campaigns.

Can the moderators do something about the off-topic posts?

Repository owner locked as off-topic and limited conversation to collaborators May 11, 2020
Repository owner deleted a comment from dominhtri1995 Jul 28, 2020
Repository owner deleted a comment from PatrickAlphaC Jul 28, 2020
Repository owner deleted a comment from dattran2346 Jul 28, 2020
Repository owner deleted a comment from PatrickAlphaC Jul 28, 2020
Repository owner deleted a comment from steveotistrader Jul 28, 2020
Repository owner deleted a comment from PatrickAlphaC Jul 28, 2020
Repository owner deleted a comment from tmd2142 Jul 28, 2020
Repository owner deleted a comment from tmd2142 Jul 28, 2020
Repository owner deleted a comment from jcisio Jul 28, 2020
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests