Using Alpha Vantage API is subject to limits. There are two main types: per day and per minute. If you make more API requests than allowed within the time period, you will get an error.
Free plan API limits
With the free API key you can make at most:
- 500 API requests per day
- 5 API requests per minute
Paid plan API limits
Paid Alpha Vantage subscriptions have no daily limit. They mainly differ in the per-minute limit – the more expensive the plan, the more requests per minute you can make.
At the moment, the cheapest plan ($49.99/month) allows 75 API requests per minute.
A complete overview of prices and limits is here:
https://www.alphavantage.co/premium/#api-key
When you exceed the limit
When you try and make more API requests per minute (or per day) than your plan allows, you will get an error like this:
{ "Note": "Thank you for using Alpha Vantage! Our standard API call frequency is 5 calls per minute and 500 calls per day. Please visit https://www.alphavantage.co/premium/ if you would like to target a higher API call frequency." }
The solution (other than upgrading to a higher plan) is simple: You only need to wait for the period to pass before you make new requests.
Exceeding API limits does not get your account banned or penalized – you just don't get the data. That said, it is still good practice to consider the limits in your code and not try to make more requests than allowed.
Implementing API limits in your code (Python)
If you are bulk downloading data on the free plan, the easiest way to deal with Alpha Vantage usage limits is to make the execution wait 12 seconds between iterations, so you don't make more than 5 API requests per minute.
For instance, in Python you can use the sleep
function from the time
module. Its argument is number of seconds to wait.
from time import sleep
for symbol in SYMBOLS: # your loop
process_symbol(symbol) # your function that makes one API call
sleep(12) # wait 12 seconds