Developing investment strategies based on data requires confidence and speed in data collection. Any failure in the collection process, normally caused by the providers, can have catastrophic consequences on your investments. In this blog, I will demonstrate a strong solution on how to collect data using the Intrinio API using Python.
If you already have Python installed on your computer, open the terminal and install the necessary libraries with the command:
Now, we will start the development of our small data collection program. The first step is to import the necessary libraries:
We define the symbols of the assets that we want to analyze in an array. The case is a fictitious scenario. Please don't consider it as advice.
For each symbol in the array, we collect the data defining the time of each bar and the quantity. Then, we feed the data frame with the closing prices of each request, defined by start date, end date, and the frequency:
Calculating returns is quite easy. Just call the dataframe’s pct_change () method, and you’re good to go.
Like returns, correlations can also be easily calculated by calling the dataframe’s corr () method.
To build the heat graph, we will use the matplotlib library. So:
In this post, we saw how to install the Intrinio SDK using Python, how to import the data of the assets we want to analyze through the Intrinio API, and how to create a heatmap of the correlations of the returns of these assets.
If you want to learn more about Intrinio, visit intrinio.com.
If you want to read more from me, visit my Medium blog.
Thanks for reading, see you next time!