Understanding institutional and major shareholder behavior is an important aspect of stock market analysis. Price movement alone does not always represent the real activity behind a stock because changes in ownership structure and holder transactions can provide additional insight into market participation.
This project develops a Smart Money Analysis System using IDX RapidAPI data to identify potential smart money movement through insider transaction and major holder flow analysis. The system evaluates ownership changes, classifies accumulation or distribution behavior, and generates a smart money ranking score.
The analysis workflow consists of five main stages:
IDX API configuration
Insider transaction data retrieval
Major holder flow analysis
Holding composition analysis
Smart money ranking dashboard
The system is developed using Python with Requests for API communication, Pandas for data processing, NumPy for scoring calculation, and Matplotlib/Seaborn for visualization support. The original notebook retrieves insider transaction data from the IDX API and processes holder movement information into structured analysis tables.
Cell 1 — Import Library and API Configuration
The first cell prepares the analytical environment and establishes the IDX RapidAPI connection. The system imports the required libraries and defines API headers and the base endpoint used for retrieving market data.
import requests
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
API_KEY = "YOUR_API_KEY"
headers = {
"x-rapidapi-host": "indonesia-stock-exchange-idx.p.rapidapi.com",
"x-rapidapi-key": API_KEY
}
BASE_URL = "https://indonesia-stock-exchange-idx.p.rapidapi.com/api"Cell 2 — Insider Transaction Data Retrieval
The second cell retrieves insider transaction data from IDX API. The dataset contains shareholder movement information within the selected period and becomes the foundation for smart money analysis.
The response data is converted into a Pandas DataFrame for further processing.
url = f"{BASE_URL}/emiten/insider"
params = {
"action_type":"ACTION_TYPE_UNSPECIFIED",
"page":1,
"date_start":"2026-09-01",
"date_end":"2026-09-22",
"source_type":"SOURCE_TYPE_UNSPECIFIED",
"limit":100
}
response = requests.get(
url,
headers=headers,
params=params
)
insider_json = response.json()
print(insider_json["message"])
movement = insider_json["data"]["movement"]
insider = pd.DataFrame(movement)
print("Jumlah data:", len(insider))
insider.head()Cell 3 — Major Holder Flow Analysis
The third cell analyzes changes in major holder ownership.
The system extracts ownership changes, converts them into numerical values, and classifies the movement into:
Accumulation
Distribution
A positive ownership change indicates accumulation, while a negative change indicates distribution.
The analysis is then summarized by stock symbol to identify net holder flow and transaction frequency.
# Extract perubahan kepemilikan
majorholder = insider.copy()
majorholder["change_value"] = (
majorholder["changes"]
.apply(lambda x: x["value"])
.str.replace(",","")
.astype(float)
)
majorholder["change_pct"] = (
majorholder["changes"]
.apply(lambda x: x["percentage"])
.astype(float)
)
majorholder["flow_signal"] = np.where(
majorholder["change_value"] > 0,
"ACCUMULATION",
"DISTRIBUTION"
)
majorholder_summary = (
majorholder
.groupby("symbol")
.agg(
net_holder_flow=("change_value","sum"),
transaction=("symbol","count")
)
.reset_index()
)
majorholder_summary["signal"] = np.where(
majorholder_summary["net_holder_flow"] > 0,
"SMART MONEY ACCUMULATION",
"SMART MONEY DISTRIBUTION"
)
majorholder_summary.sort_values(
"net_holder_flow",
ascending=False
)Cell 4 — Holding Composition Analysis
The fourth cell evaluates ownership composition.
The system calculates:
Number of major holders
Largest holder ownership percentage
Total major holder ownership percentage
This analysis provides information regarding ownership concentration and holder quality.
ownership = majorholder.copy()
ownership["current_shares"] = (
ownership["current"]
.apply(lambda x:x["value"])
.str.replace(",","")
.astype(float)
)
ownership["current_pct"] = (
ownership["current"]
.apply(lambda x:x["percentage"])
.astype(float)
)
ownership_summary = (
ownership
.groupby("symbol")
.agg(
major_holder_count=("name","nunique"),
largest_holder_pct=("current_pct","max"),
total_major_holder_pct=("current_pct","sum")
)
.reset_index()
)
ownership_summary.sort_values(
"largest_holder_pct",
ascending=False
)Cell 5 — Smart Money Ranking Dashboard
The final cell combines holder flow analysis and ownership composition analysis into a smart money scoring model.
The scoring framework consists of:
Holder Flow Score
Positive net holder flow = +1
Negative net holder flow = -1
Ownership Quality Score
Largest holder ownership ≥10% = +1
The total score is converted into a market signal:
Strong Accumulation
Accumulation
Distribution / Weak
The final ranking sorts stocks based on smart money score.
final = majorholder_summary.copy()
final = final.merge(
ownership_summary,
on="symbol",
how="left"
)
final["holder_flow_score"] = np.where(
final["net_holder_flow"] > 0,
1,
-1
)
final["ownership_score"] = np.where(
final["largest_holder_pct"] >= 10,
1,
0
)
final["smart_money_score"] = (
final["holder_flow_score"]
+
final["ownership_score"]
)
final["signal"] = np.select(
[
final["smart_money_score"] >= 2,
final["smart_money_score"] == 1,
final["smart_money_score"] <= 0
],
[
"STRONG ACCUMULATION",
"ACCUMULATION",
"DISTRIBUTION / WEAK"
],
default="NO SIGNAL"
)
final_rank = final.sort_values(
"smart_money_score",
ascending=False
)
final_rank[
[
"symbol",
"net_holder_flow",
"transaction",
"largest_holder_pct",
"smart_money_score",
"signal"
]
]Conclusion
This project successfully develops a Smart Money Analysis System using IDX insider transaction data and major holder ownership analysis.
The system identifies potential smart money activity by evaluating changes in major holder positions and combining them with ownership concentration metrics. The holder flow analysis detects whether investors are accumulating or distributing shares, while ownership composition provides additional insight into shareholder structure.
The final smart money ranking converts multiple ownership indicators into a simplified scoring framework. This allows users to quickly identify stocks with stronger accumulation signals or weaker ownership conditions.
However, smart money analysis should not be used as a standalone investment decision method. Additional evaluation using company fundamentals, valuation, technical indicators, liquidity, and market conditions remains necessary.
Overall, this IDX-based Smart Money Analysis System demonstrates how insider transaction data and ownership analysis can be transformed into a structured framework for monitoring institutional and major shareholder behavior.
