Analysing Institutional Investors Stocks Holdings with Python

Analysing Institutional Investors Stocks Holdings with Python

How many institutions are holding a particular stock?

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