Historical Data Lab


Overview

Using the Intrinio Financial Data API (application programming interface) we can programmatically retrieve historical company data points such as Total Revenue, Net Income, Debt, Gross Margin, Market Cap, Beta and numerous others.

We will use the Historical Data for Company API end-point to retrieve historical company data points throughout this lab.

In this lab we will cover:

  • Retrieving Total Revenue, Market Cap, and Beta for Apple Inc. (AAPL) since 2010 using Python or R
  • Charting Total Revenue, Market Cap, and Beta for Apple Inc.

Code Examples

Code examples in Python and R are provided throughout this lab.

All code examples can be run in your browser using a Jupter Notebook. To launch the Jupyter Notebook for any code example simply click the Run Jupyter Notebook button at the top of the code example.

If you wish to run the code examples in your own development environment, be sure to first install the Intrino SDK for the language of your choice:

API Keys

In code examples throughout this lab you will be asked to provide your API Key.

The API keys assigned to you are available below.

For the purposes of this lab, be sure to use your Production API key

Production
To view your API keys, click here to log in.

Section 1

Retrieving Total Revenue, Market Cap, and Beta for Apple Inc.

In this section we use the Historical Data for Company API end-point to retrieve Total Revenue, Market Cap, and Beta for Apple Inc. since 2010.

Total Revenue, Market Cap, and Beta values can be retrieved from the Historical Data for Company end-point using the concept of 'Data Tags'. Each 'Data Tag' represents a type of data point - such as Total Revenue, Net Income, or Debt.

In the Data Tag Reference Library you'll find a listing of all Data Tags supported by the Intrinio Financial Data Platform.

In this lab we'll be using the following Data Tags:

Item Data Tag
Total Revenue totalrevenue
Market Cap marketcap
Beta beta

While retrieving all historical data values for each Data Tag, we'll extract the historical data values from the API response as an array. We'll then store this array of data tag values in a new object called 'historical_data'.

Run the code below to see the result...

Section 2

Charting Total Revenue, Market Cap, and Beta for Apple Inc.

Building on our previous work, now let's iterate through our 'data_points' array to graph the Total Revenue, Market Cap, and Beta for Apple Inc.

Run the code below to see the result...

Going further...
  • Try adding a new data point to the 'data_points' array - can you add Apple's Gross Margin?
  • What are the most important metrics and ratios for finding value investment opportunities?
  • Can you use the Historical Data for Company API end-point to find value investment opportunities?