Using the Intrinio Financial Data API (application programming interface) we can programmatically retrieve end-of-day OHLC (open, high, low, close) prices for thousands of U.S. company securities (stocks) which are actively traded on major exchanges such as NASDAQ and NYSE.
We will use the Get Security Stock Prices API end-point to retrieve stock prices throughout this lab.
In this lab we will cover:
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:
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
In this section we'll use the Get Security Stock Prices API end-point to retrieve stock prices for Apple Inc. from January 1st, 2015 through January 1st, 2020.
Run the code below to see the result...
Now that we've seen how to retrieve stock prices for a single company, let's create an array of multiple companies and retrieve 5 years of stock price data for all of them.
To do so we'll iterate over an array of company tickers, executing a call to Get Security Stock Prices for each company.
The API response for each stock will contain Open, High, Low and Close pricing data - along with split-adjusted versions of those values. Here, we are interested in the Adjusted Close Prices for each stock.
We'll process the API responses for each company to extract all Adjusted Close Prices , storing them in a new object called 'adjusted_close_price_data'.
Run the code below to see the result...
Building on our previous work, now let's graph the adjusted close prices for all of our companies.
Run the code below to see the result...