Working With Quandl Financial Data In Python

Hi there. In this page, I talk about working with financial data from Quandl in the Python programming language. I include two examples with plots.

 


Sections

 


Getting Started

Quandl is a platform which stores economical, financial and alternative data. The data can be accessed through Excel, R, Python and more. For this page, Python is used. I have other pages which deal with R such as this one and this one.

There are a handful of datasets on Quandl which are free and available to the public. Some of the datasets do require payment for access. The datasets in this page would be free.

You do need an authorization token in order to access to Quandl. This token can be obtained by signing up for an account. You may want to refer to this Quick Start guide.

Here are the first few lines of code in Python. You may need to install the packages by using pip in the command prompt or by using conda if you are using Anaconda.

 

 

 


Housing Prices Example From Zillow

This first example involves housing prices in Clarkson, NY from Zillow in Quandl. In the top right corner of the link, you should see a Quandl code. This code and the your authorization code is needed in order to extract data from Quandl with the Quandl.get() function.

Here are some screenshot images.

 

You can preview the data with print() function. (I’ve erased some rows from the output to save space.)

Next, I create a simple plot of the housing prices versus time in matplotlib.

 

From this plot, the overall trend is that the home value is going up over time. This plot provides some idea about the region and its real estate market. You need additional information by considering context. Some questions can include:

  • How long will these housing prices continue to go up?
  • Is this a bubble?
  • What type of houses are being sold?
  • What is the average income for the homebuyer in this area?
  • How many homes are being sold per month/year?

 


Perth Mint Silver Prices Example

The second example is about silver prices from the Perth Mint dataset in Quandl. Screenshot images are found below.

 

The tail() function from pandas gives the rows from the bottom of the data frame. I preview the last 12 rows.

 

 

 

There is not much difference from the average ask prices and the average bid prices in the plot. Silver prices were low and stable until about 2006. The peak silver price is around 2011 (after the great recession).

 


References

  • https://www.quandl.com/data/ZILLOW/C3821_ZHVITT-Zillow-Home-Value-Index-City-Zillow-Home-Value-Index-Top-Tier-Clarkson-NY
  • https://pythonprogramming.net/using-quandl-data/
  • https://www.quandl.com/data/PERTH/SLVR_USD_M-Silver-Spot-Prices-USD-Monthly
  • Quick Start Guide: https://blog.quandl.com/getting-started-with-the-quandl-api

Leave a Reply