Which industries did three primary institutional investors invest in Taiwan?

How do the three primary institutional investors invest in Taiwan stocks?

Photo by Alexander Mils on Unsplash



The three primary institutional investors are essential participants in the Taiwan stock market. Others investors use three direct institutional investors’ daily trading volume, cumulative trading volume, and the shareholding ratio of stocks to be a benchmark to invest. Therefore, we analyze the changes in the stock market value of the three primary institutional investors in the overall stock market and various industries. Then, we sort out the differences in industry preferences and investment strategies of the three direct institutional investors from 2015 to the present, hoping to inspire readers for transactions.

The remarks of the three primary institutional investors are as follows:

  1. Dealers mean Dealers’ proprietary accounts.
  2. Securities Investment Trust Companies mean domestic mutual funds managed by Securities Investment Trust Companies.
  3. Foreign Investors are defined by Regulations Governing Investment in Securities by Overseas Chinese and Foreign Nationals and Regulations Governing Securities Investment and Futures Trading in Taiwan by Mainland Area Investors.

The Editing Environment and Modules Required

Windows OS and Jupyter Notebook

# 功能模組
import pandas as pd
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif'] = ['Microsoft JhengHei'] # 解決 plot中文問題
plt.rcParams['axes.unicode_minus'] = False#TEJ API
import tejapi
tejapi.ApiConfig.api_key = "your key"

Database Used

Data Processing

Step 1. Obtain data by TEJ API

We obtain the codes of listed companies that exclude the financial industry and depositary receipts from TEJ.

industry = tejapi.get("TWN/AIND",
chinese_column_name=True)industry = industry[~industry['TSE新產業_名稱'].isin(['金融業','','存託憑證']) &
(industry['上市別'].isin(['TSE']))]security_list = industry['公司簡稱'].tolist()

We obtain the market value of listed companies and the market value of the three primary institutional investors.

# TEJ為維持主機運行的穩定,總筆數單次最多為1,000,000筆。故我們可以將公司以50家分一組,以便迴圈分次撈取資料groups = []
while True:
if len(security_list) >= 50:
security_list = security_list[50:]
elif 0 <= len(security_list) < 50:
breakmarket_value = pd.DataFrame()
for group in groups:
market_value = market_value.append(tejapi.get('TWN/APRCD',
coid = group,
mdate= {'gte': '2015-01-01','lte':'2021-01-19'},

data = pd.DataFrame()
for group in groups:
data = data.append(tejapi.get('TWN/ATINST1',
coid = group,
mdate= {'gte': '2015-01-01','lte':'2021-01-19'},

Step 2. Merging Data

We merge the corresponding industry name with the above company information.

data = pd.merge(data,industry, how='left', left_on='證券名稱', right_on='公司簡稱')
data = pd.merge(data,market_value, how='left', left_on=['證券名稱','年月日'], right_on=['證券代碼','年月日'])

Step 3. Calculate the stock market value of the primary institutional investors.

We obtain the market value of TEJ’s three primary institutional investors. Then, we calculated the market value of the otherthe other = all — (foreign investment + Investment Trust + Dealers) That is the sum of retail investors, directors, supervisors, corporate legal persons, the insurer, and private equity funds stock of market value.

# 計算籌碼持股市值
data['其他(百萬元)'] = data['市值(百萬元)'] - data['外資總投資市值(百萬)'] - data['投信持股數市值(百萬)'] \
- data['自營持股數市值(百萬)']data = data[['證券代碼','TSE新產業_名稱', 'TEJ子產業_名稱', '年月日', '外資總投資市值(百萬)',
'投信持股數市值(百萬)', '自營持股數市值(百萬)','其他(百萬元)']]# 改欄位名稱
data = data.rename(columns={'外資總投資市值(百萬)':'外資',

Data Visualization

Step 1. calculate the stock market value percentage of the primary institutional investors.

We can easily group the data through the groupby function to analyze the descriptive statistics under different groups. Then, we use the following code to group the dates and add up the stock market value ratios of the overall listed companies on each date.

The figure below shows that the proportion of foreign investors’ market value in Taiwan stocks has steadily increased since 2015. Even though foreign investors have traded over -447 billion since the beginning of 2021, the market capitalization of foreign investors is still nearly 40%. Investment Trusts and Dealers hold only a smaller percentage of the stock market value.

# 繪製籌碼持股市值百分比
figure_table1 = data.groupby(['年月日'])[['外資','投信','自營','其他']].sum()
figure_table1 = figure_table1.divide(figure_table1.sum(axis=1), axis=0)fig, ax = plt.subplots(figsize = (14,8))
ax.set_title('籌碼持股市值百分比', fontsize=16, fontweight='bold')
ax.set_ylabel('Percentage', fontsize=12,rotation=0)
ax = ax.stackplot(figure_table1.index, figure_table1.T)
plt.legend(figure_table1.columns,loc=2, prop={'size': 12})
plt.show()# 要反過來看圖例去對照圖形

Step 2. the primary institutional investors hold market value percentages in different industries.

The figures below show foreign investment, investment trust, and dealers from left to right. We find that foreign investment and investment trust have similar industry holding market value trends. However, foreign investment is more concentrated in the semiconductor industry than investment trust. Compared to the formers, dealers have relatively volatile industry holdings and similar market capitalizations in different sectors. It reflects their more flexible and short-term investment strategies.

Step 3. Foreign investments hold market value percentage in the semiconductor industry supply chain.

From 2015 to the present, the shareholding ratio of foreign investments in the semiconductor industry has increased from 40% to 70%. Therefore, we would like to further analyze the shareholding value of foreign money in the semiconductor industry chain through the sub-industries classified by the TEJ database. Among the 23 semiconductor sub-industries, foundry accounted for 80%, while 2330 TSMC accounted for more than 95% of the foundry.


60% of the market value held by foreign investors and investment trust companies is in the semiconductor industry. Although dealers also have a relatively high share of market value in the semiconductor industry, the overall sector holding market value has fluctuated dramatically, reflecting the flexible investment strategy of self-operated companies — short line operation. In addition, we also further analyzed the market value ratio of foreign investors in the semiconductor industry chain. We found that the layout of foreign investment in the industry stock selection reflects the 80/20 rule. The proportion of foreign investors holdings in the market value is mainly contributed by 2330 TSMC.

Finally, suppose readers are interested in analyzing primary institutional investors and industry grouping. In that case, readers are welcome to go to TEJ E-Shop to purchase a package combination that meets their needs.

Source Code

Extended Reading

Related Link