This project develops an automated IDX Investor Ownership Analysis System using Python and RapidAPI. The system is designed to analyze company ownership structure, insider trading activity, and business group composition from Indonesian stocks.
The system combines three important investor analysis components:
Holding Composition Analysis
Insider Trading Monitoring
Subsidiary Structure Analysis
The objective of this project is to build a simple investor dashboard that helps analyze company ownership information, management transaction activity, and the strength of corporate business networks.
The project uses Python libraries such as requests for API communication, pandas for data processing, and json for handling API responses.
The workflow is organized into five main cells:
Cell 1: Import library and API configuration
Cell 2: Create universal API request function
Cell 3: Retrieve holding composition data
Cell 4: Retrieve insider trading activity
Cell 5: Generate investor ownership dashboard
This system transforms raw IDX API data into structured ownership insights that are easier for investors to understand.
Cell 1 - Import Library and API Configuration
# =====================================
# CELL 1 : SETUP API CONNECTION
# =====================================
import requests
import pandas as pd
import json
API_KEY = "YOUR_API_KEY"
BASE_URL = (
"https://indonesia-stock-exchange-idx.p.rapidapi.com"
)
HEADERS = {
"Content-Type": "application/json",
"x-rapidapi-host":
"indonesia-stock-exchange-idx.p.rapidapi.com",
"x-rapidapi-key":
API_KEY
}
SYMBOL = "BBCA"Explanation
Cell 1 prepares the Python environment and configures the IDX API connection.
The program imports:
requestsfor sending HTTP requests.pandasfor processing structured data.jsonfor reading API responses.
The API configuration defines:
RapidAPI host.
API authentication key.
Stock symbol that will be analyzed.
In this project, the selected stock example is:
SYMBOL = "BBCA"The configuration allows Python to retrieve ownership and corporate information directly from IDX API services.
Cell 2 - Universal API Request Function
# =====================================
# CELL 2 : UNIVERSAL API FUNCTION
# =====================================
def get_idx_api(endpoint, params=None):
url = BASE_URL + endpoint
response = requests.get(
url,
headers=HEADERS,
params=params,
timeout=30
)
print(
"Status Code:",
response.status_code
)
try:
data = response.json()
return data
except:
print(
response.text
)
return NoneExplanation
Cell 2 creates a universal API request function.
The function:
get_idx_api()is responsible for:
Building the API URL.
Sending GET requests.
Adding authentication headers.
Receiving JSON responses.
Handling invalid responses.
The function simplifies the following analysis process because all IDX API requests can use the same communication method.
Cell 3 - Holding Composition Analysis
# =====================================
# CELL 3 : HOLDING COMPOSITION
# =====================================
holding = get_idx_api(
f"/api/emiten/{SYMBOL}/profile/holding-composition",
params={
"value":
"5,12,24,36",
"type":
"all"
}
)
print(
json.dumps(
holding,
indent=4
)[:3000]
)Explanation
Cell 3 retrieves company holding composition information.
The API endpoint:
/api/emiten/{SYMBOL}/profile/holding-compositionis used to obtain ownership structure data for the selected company.
The request uses parameters:
value = "5,12,24,36"and:
type = "all"to define the ownership data range and category.
Holding composition analysis helps investors understand shareholder structure and ownership concentration within a company.
Cell 4 - Insider Trading Analysis
# =====================================
# CELL 4 : INSIDER TRADING
# =====================================
insider = get_idx_api(
f"/api/emiten/{SYMBOL}/insider",
params={
"date_start":
"2025-11-01",
"date_end":
"2025-12-31",
"limit":
20,
"source_type":
"SOURCE_TYPE_UNSPECIFIED",
"action_type":
"ACTION_TYPE_UNSPECIFIED",
"page":
1
}
)
print(
json.dumps(
insider,
indent=4
)[:3000]
)Explanation
Cell 4 analyzes insider trading activity.
The API endpoint:
/api/emiten/{SYMBOL}/insiderretrieves transactions performed by company insiders.
The analysis uses several parameters:
Transaction date range.Data limit.
Source type.
Action type.
Page number.
Insider activity analysis can provide additional information about management confidence and potential changes in ownership positions.
Cell 5 - Corporate Ownership Summary Dashboard
# =====================================
# CELL 5 : INVESTOR DASHBOARD
# =====================================
from IPython.display import display
print("="*60)
print(
f"{SYMBOL} INVESTOR REPORT"
)
print("="*60)
# HOLDING SUMMARY
print("\nOWNERSHIP / PEMEGANG SAHAM")
print("-"*60)
if holding.get("success") == True:
print(
"Status : Data tersedia"
)
else:
print(
"Status : Data belum tersedia"
)
# INSIDER SUMMARY
print("\nINSIDER ACTIVITY")
print("-"*60)
try:
movement = insider["data"]["movement"]
if len(movement) == 0:
print(
"Jumlah transaksi : 0"
)
print(
"Signal : NETRAL"
)
else:
print(
"Jumlah transaksi :",
len(movement)
)
print(
"Signal : ADA AKTIVITAS"
)
insider_df = pd.DataFrame(
movement
)
display(
insider_df
)
except:
print(
"Data insider tidak tersedia"
)
# SUBSIDIARY SUMMARY
print(
"\nBUSINESS GROUP / ANAK PERUSAHAAN"
)
print("-"*60)Explanation
Cell 5 creates an investor summary dashboard.
The dashboard combines three important analysis sections:
1. Ownership Analysis
The system checks whether holding composition data is available.
2. Insider Activity
The program analyzes insider transaction movement:
If there is no transaction, the signal becomes neutral.
If transactions exist, the system identifies insider activity.
3. Subsidiary Structure
The dashboard also analyzes company subsidiaries.
The system retrieves:
Number of subsidiaries.
Company name.
Business sector.
Ownership percentage.
Total assets.
This information helps investors understand the company's business ecosystem and operational diversification.
Conclusion
This project demonstrates how Python and RapidAPI can be used to build an IDX Investor Ownership Analysis System.
The system integrates three important investor perspectives:
Holding Composition Analysis
To understand shareholder ownership structure.Insider Trading Monitoring
To observe management transaction activity.Subsidiary Structure Analysis
To evaluate business group strength and company diversification.
The dashboard provides a structured view of ownership information and corporate structure.
However, ownership data and insider transactions should not be used as standalone investment signals. Investors should combine this analysis with financial statements, valuation, profitability, market trends, technical analysis, and risk management before making investment decisions.
