AlphaVantage API for Fundamental Data

Maxwell Bosse
3 min readJan 23, 2021

One of the most difficult parts of any data science project is obtaining the data. Many data sources are behind a pay wall or only offer limited features to free users. When it comes to obtaining stock data and technical indicators there is no better API than AlphaVantage.

As a free user you are limited to 5 API calls a minute and 500 API calls a day which is more than enough to look at a portfolio’s worth of data.

When I started using AlphaVantage I found that I was unable to access fundamental data for a given stock. A couple google searches later and not only did I find a way to access the fundamental data but I also a more efficient way to access the other price data offered through the API.

Using the API Wrapper

The simplest way I found to pull relevant data from AlphaVantage is using this alpha_vantage wrapper which implements a python interface to the API. First we will need the following imports.

The first line of code above is to install the package. Uncomment the cell to install it directly into your Jupyter Notebook.

After the package is installed we are importing the TimeSeries, TechnicalIndicators and Fundamental libraries and calling each object with our API key. There is more functionality within these objects you can explore in the README of the wrapper linked above.

Now that we have our imports we can start pulling the data we want.

Pulling Fundamental Data

The README in the wrapper has many examples of how to access time series and technical indicator data for a stock so here I will show how to access the elusive fundamental data through AlphaVantage.

Note: When using the wrapper you need to get the Json object (which is the data of interest) and another object to get the API call’s metadata. This is also discussed in the linked README.

Functionality within the FundamentalData Library

Within the FundamentalData library we imported and called as ‘fd’, there are many functions we can use to get fundamental data on a given stock as shown above. One of the more helpful functions is ‘get_company_overview’ which contains lots of different information. Let’s take a look.

As you can see, using the get_company_overview function we can access many different pieces of information for a stock of interest. You can access the company description, sector, industry, EPS, price to sales ratio and so on.

All of this information is stored in individual columns within ‘data’ so to view any single piece of information you simply need to access the column as we did with QuarterlyEarningsGrowthYoY above.

View of data object

Conclusion

I hope you found this helpful in accessing the fundamental data using the AlphaVantage API.

In working with stock data another pain point I had using AlphaVantage was accessing all the historical earnings information for a stock. In my next post I will show the work around I used to create a dataframe with the the quarterly and annual earnings for a stock.

--

--