Get RealTime stock price from AlphaVantage
Asked Answered
S

3

5

I am working on a trading app project, and i am using Alpha Vantage API to get stock prices.

I tried the TIME_SERIES_INTRADAY function to get real time stock prices in a 5 minute interval, but i get only the data from the previous market day instead of the current day.

For example if launch the API today (2020-01-03 at 12:30) the last refresh is at "2020-01-02 12:50:00":

Request

https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&apikey=********&symbol=DAX&interval=5min

Response

{
"Meta Data": {
    "1. Information": "Intraday (5min) open, high, low, close prices and volume",
    "2. Symbol": "DAX",
    "3. Last Refreshed": "2020-01-02 12:50:00",
    "4. Interval": "5min",
    "5. Output Size": "Compact",
    "6. Time Zone": "US/Eastern"
},
"Time Series (5min)": {
    "2020-01-02 12:50:00": {
        "1. open": "28.4635",
        "2. high": "28.5001",
        "3. low": "28.4635",
        "4. close": "28.5001",
        "5. volume": "359"
    },
    "2020-01-02 11:15:00": {
        "1. open": "28.6631",
        "2. high": "28.6631",
        "3. low": "28.6631",
        "4. close": "28.6631",
        "5. volume": "105"
    },
   ...

I do not see what i am missing.

Really glad if anyone could help.

Thanks!

Syst answered 3/1, 2020 at 11:43 Comment(1)
Any answers using TIME SERIES INTRADAY endpoint?Haematozoon
A
2

DAX is an index. Alpha Vantage does not currently support indexes.

They support stock, FX, crypto, technical indicators, and sector performance. If they have some, they are considered bonus.

Amoretto answered 3/1, 2020 at 21:44 Comment(1)
You're right! I always did tests on indexes. Thank a lot!Syst
W
6

It looks like Alpha Vantage has changed their output from the API recently. I use to be able to get "real time" price data from their "Quotes Endpoint". Now they are reporting data from the prior day's close. They are sending people that want real time data to a different company that is charging the access - no limited, demo type account is offered there. I did find that Alpha Vantage has a "Sector Performance" data set that still seems to have a real time component. I sent an inquiry to Alpha Vantage to see if that will continue to be available before modifying my application (a color changing orb) to use this data.

By the way, so far, Alpha Vantage has not confirmed to me that anything has changed in the API, but their documentation appears to have changed, with a link that points people to this other company for real time data. In addition, in an e-mail, they added the following blurb:

"FYI on the legal side: NASDAQ has set its licensing policy and fees for realtime market data - likewise for NYSE. Under the latest framework, Polygon is one of the cheapest NASDAQ-approved providers of realtime market data. If you find other realtime data sources that are cheaper (or free), chances are that they are illegally redistributing realtime NASDAQ data and will likely get shut down by the exchanges in the near future. We strongly recommend choosing exchange-approved data providers such as Polygon to avoid any legal liability to yourself."

Maybe they were having a bit of trouble, and had to make a change to comply.

Steve

Whited answered 8/7, 2020 at 17:23 Comment(0)
A
2

DAX is an index. Alpha Vantage does not currently support indexes.

They support stock, FX, crypto, technical indicators, and sector performance. If they have some, they are considered bonus.

Amoretto answered 3/1, 2020 at 21:44 Comment(1)
You're right! I always did tests on indexes. Thank a lot!Syst
T
1

Dont know if this is still needed but just for clarification:

It does support indexes! But you have to use another symbol. Just DAX is not right.

You have to look for the right symbol and this is a bit difficult to do with the Alpha Vantage API. I found that using the search input at finance.yahoo.com entering "DAX" you see that the symbol is ^GDAXI.

To sum it up: You have to prefix indexes with ^ and find the right symbol via finance.yahoo.com

So use:

https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol=^GDAXI&interval=5min&outputsize=full&apikey=***********


DowJones: ^DJI

S&P 500: ^GSPC

Nikkei: ^N225

Nasdaq Composite: ^IXIC

Throughcomposed answered 23/6, 2020 at 8:20 Comment(1)
Not sure if this used to work, but I just tried it for ^DJI and ^GDAXI and it seems like indexes aren't supported. It returns an empty object {}Sauveur

© 2022 - 2024 — McMap. All rights reserved.