Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alpha Vantage - Can you pull for multiple stocks with the API?

For example, if I want to list out all the stocks on NASAQ and their closing price, is there a way to do this without using the API for each individual stock?

What I mean is, you pull data for a company using the company's ticker symbol in the API url. If there are 3000 companies on the NASDAQ, can I get all their closing prices without calling the URL 3000 times?

like image 319
Eric Avatar asked Sep 01 '25 02:09

Eric


1 Answers

Yes, there is an undocumented BATCH_STOCK_QUOTES that lets you pass in a comma seperated list of ticker symbols.
It seems like the endpoint BATCH_STOCK_QUOTES is not working anymore.

Example HTTP GET request (use your apikey instead of xxx):

https://www.alphavantage.co/query?function=BATCH_STOCK_QUOTES&apikey=xxx&symbols=MSFT,AAPL,FB

Response:

{
    "Meta Data": {
        "1. Information": "Batch Stock Market Quotes",
        "2. Notes": "IEX Real-Time",
        "3. Time Zone": "US/Eastern"
    },
    "Stock Quotes": [
        {
            "1. symbol": "MSFT",
            "2. price": "119.1900",
            "3. volume": "10711735",
            "4. timestamp": "2019-04-09 14:39:53"
        },
        {
            "1. symbol": "AAPL",
            "2. price": "199.9100",
            "3. volume": "27681098",
            "4. timestamp": "2019-04-09 14:39:56"
        },
        {
            "1. symbol": "FB",
            "2. price": "177.1800",
            "3. volume": "14088849",
            "4. timestamp": "2019-04-09 14:39:50"
        }
    ]
}

I found this looking at the source of this javascript api wrapper: https://github.com/zackurben/alphavantage

Specifically: https://raw.githubusercontent.com/zackurben/alphavantage/master/lib/data.js

like image 165
stlawrence Avatar answered Sep 02 '25 16:09

stlawrence