Analysing Institutional Investors Stocks Holdings with Python

Analysing Institutional Investors Stocks Holdings with Python

How many institutions are holding a particular stock?

  • First option is going manually through each of the 13F filings. I would not recommended this since it will be super time consuming
  • The second option would be to scrape the SEC site and extract the 13F filing information using Python. This would be the best way since we have all information publicly available and for free. The problem with this approach is that it is quite challenging parsing SEC filings
  • And the last option, and the one I will use in this post, is to use an API provider. The API provider has already done the job to collect data for us. In this post, we will be using financialmodelingprep which has great API end points on institutional stock ownership. The problem with this approach is that we require an API subscription to retrieve the data.

Analysing Institutional Holdings with Python

import requests 
import pandas as pd
import matplotlib.pyplot as plt
stock = 'FB' api_key = 'your api key'
ownswership_by_stock = requests.get(f'https://financialmodelingprep.com/api/v4/institutional-ownership/symbol-ownership?symbol={stock}&apikey={api_key}').json()
print(ownswership_by_stock)
Facebook institutional holdings
data_points = {}  for item in ownswership_by_stock:   
data_points[item['date']] = item['investorsHolding']
pd_DF = pd.DataFrame(data_points,index=["Inst Investors Holdings"]).T
pd_DF["Inst Investors Holdings"] = pd_DF["Inst Investors Holdings"].astype(float)
#reverse dates and take only latest 15 data points
pd_DF = pd_DF.iloc[::-1][-15:-1] print(pd_DF)

Plotting number of institutions holding Facebook

fig, ax = plt.subplots() 
ax.plot(pd_DF["Inst Investors Holdings"])
# Rotate and align the tick labels so they look better. fig.autofmt_xdate()
plt.title("Number of Institutions holding " + stock)
plt.show()
Python for FInance

Wrapping Up

--

--

--

Python for Finance. Learn step by step how to automate cool financial analysis tools.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Jose Manu (CodingFun)

Jose Manu (CodingFun)

Python for Finance. Learn step by step how to automate cool financial analysis tools.

More from Medium

Arithmetic vs Log Stock Returns in Python

Backtesting A Call Spread In Python Using Data In Yahoo Finance

Examining Financial Data to Make Smart Investing Decisions

Automated Investing: How You Can Save Time on Your Excel Stock Analysis