FMP

FMP

Analysing Institutional Investor Transactions with Python

What are institutions doing respect to the stocks of a company? Are institutions buying or selling a particular stock? These are questions that all analysts loo

Analysing Institutional Investor Transactions with Python

Sep 11, 2023 5:15 PM - Rajnish Katharotiya

twitterlinkedinfacebook
blog post cover photo

Image credit: Austin Distel

What are institutions doing respect to the stocks of a company? Are institutions buying or selling a particular stock? These are questions that all analysts looking into a company should ask themselves. In this post, we are going to learn how to analyse institutional investor transactions with Python.

Photo by Burak K on Pexels.com

What are Institutional Investors?

Institutional investors are entities holding big amounts of money to invest in securities and other asset classes. Institutional investors include:

  • Mutual Funds

  • Hedge Funds

  • Trust Companies

  • Pension Funds

  • Banks and Insurance Companies

Why to Analyse what Institutional Investors do?

Institutional investors are very often buying (assuming they buy) a large number of shares when they make a move in the market. When this happens, the price of the affected stock may move up, specially if it is a small market cap stock. On top of this, large trades made by institutions may attract attention from other investors. This may push the price of the stock even higher.

Another thing to take into consideration is that institutional investors, after making a big move in a company, have the incentive for the stock price of that company to go up. For that reason, they may try to influence public opinion to take their side of the trade by for example writing public favourable reports.

In addition, managers of institutional investment funds tend to be very experienced at evaluating companies (although not always). Therefore, we could assume that if institutional investors are buying stocks for a particular company, they may perceive it as undervalued. Or, they may see potential growth happening soon.

How do we know what Institutional Investors are doing?

Institutional investors with at least $100m in Assets Under Management must report to the SEC a quarterly report disclosing all their equity holdings. This disclosing takes place through the SEC Form called 13F.

Therefore, investors can use the Form 13 filling to know what big players are doing. In the next section, we will use Python and an API in order to obtain below four data points. We will do it for a list of companies during a defined period of time:

  • Total number of institutional investors transacting the stock.

  • Number of institutional investors buying the stock.

  • Number of institutional investors selling the stock.

  • Net shares exchanged by all institutional investors.

Analysing Institutional Investor Transactions with Python

In order to analyse institutional investor transactions with Python, we are going to use Insitutional Stock Ownership Endpoint.

First, we make a request to the API to get a list of all institutional transactions for a given company.

As we want to retrieve this information for 4 different companies, we use a for loop.

Within each of the requests, we pass API Key and the ticker of the company as part of the url. The request returns a Python list containing all transactions reported by institutions for the selected company. See below screenshot including an example for Apple.

Holder is the institution reporting the holdings. Shares is the number of shares hold by the institutions at the end of the reporting period. Date Reported is the date when the institution filled the report (for transactions happening in the previous quarter). And the change is the numbers of shares transacted (< 0 means the institution is buying while > 0 means that the institution is selling).

Next, we loop through each of the elements in the list in order to extract the desired information. Let's focus only on the transactions reported after the 11th of February so that we do not get very old transactions.

In addition, we count the number of transactions that are buys and the number of sales. We add this information to the change dictionary.

Note that the key of the dictionary includes a unique identifier. The reason is to be able to store all transactions happening in one day. For instance, for the 11th of February, there were more than 4 different institutions reporting their holdings in Apple. If we would not have the unique identifier, every time that we run the code, we will overwrite the previous iteration of the loop.

Finally, we convert the dictionary into a Pandas DataFrame and select only the relevant columns for displaying purposes. Below is the obtained result:

Please note that this is a special endpoint and you might be need to upgrade your plan.

import requests

import pandas as pd

companies = ['AAPL','MSFT','ETSY','ATVI']

change = {}

for company in companies:

institutions = requests.get(f'https://financialmodelingprep.com/api/v3/institutional-holder/{company}?apikey=your_api_key_here').json()

change[company] = {}

identify = 0

count_down = 0

count_up = 0

total_shares_exchanged = 0

for item in institutions:

identify = identify + 1

if item['dateReported'] > '2021-02-11':

change[company][item['dateReported']+ str(identify)] = item['change']

if item['change'] > 0:

count_up = count_up + 1

if item['change'] < 0:

count_down = count_down + 1

total_shares_exchanged = total_shares_exchanged + item['change']

change[company]['total'] = count_up + count_down

change[company]['buys'] = count_up

change[company]['sells'] = count_down

change[company]['total_shares_exchanged'] = total_shares_exchanged

institutions_DF = pd.DataFrame(change)

institutions_DF = institutions_DF.T

print(institutions_DF[['total','buys','sells','total_shares_exchanged']])

Institutional Investors and Form 13F IssuesForm 13F is the source of the data that we are retrieving.

The problem is that institutional investors, only need to report in the 13F Form within 3 months of the time that the transaction took place. This means that we only see the transaction after the fact.

Wrapping Up

Knowing what institutional investors are doing regarding a particular stock may be super beneficial for us. It can helps us to know if a stock is attracting attention from big players.

It would be interesting to be able to have a benchmark in order to know if the results that we got by our script (i.e. number of buys for Apple) are significant or not. For instance, we could compare the number of transactions in a given period to the similar period of the prior year. That way, we could spot unusual high level of transactions.

Another approach would be to compare the daily transactions with the volume of the day. If for a given day, the volume and the number of transactions performed by institutions are very high, we probably know that something is going with that company.

In addition to looking into institutional investor transactions, we can also look at what insiders of the company are doing.

Other Blogs

Sep 11, 2023 - Rajnish Katharotiya

P/E Ratios Using Normalized Earnings

Price to Earnings is one of the key metrics use to value companies using multiples. The P/E ratio and other multiples are relative valuation metrics and they cannot be looked at in isolation. One of the problems with the P/E metric is the fact that if we are in the peak of a business cycle, earni...

blog post title

Sep 11, 2023 - Rajnish Katharotiya

What is Price To Earnings Ratio and How to Calculate it using Python

Price-to-Earnings ratio is a relative valuation tool. It is used by investors to find great companies at low prices. In this post, we will build a Python script to calculate Price Earnings Ratio for comparable companies. Photo by Skitterphoto on Pexels Price Earnings Ratio and Comparable Compa...

blog post title

Oct 17, 2023 - Davit Kirakosyan

VMware Stock Drops 12% as China May Hold Up the Broadcom Acquisition

Shares of VMware (NYSE:VMW) witnessed a sharp drop of 12% intra-day today due to rising concerns about China's review of the company's significant sale deal to Broadcom. Consequently, Broadcom's shares also saw a dip of around 4%. Even though there aren’t any apparent problems with the proposed solu...

blog post title
FMP

FMP

Financial Modeling Prep API provides real time stock price, company financial statements, major index prices, stock historical data, forex real time rate and cryptocurrencies. Financial Modeling Prep stock price API is in real time, the company reports can be found in quarter or annual format, and goes back 30 years in history.
twitterlinkedinfacebookinstagram
2017-2023 © Financial Modeling Prep