Stock market analysis requires comprehensive market information to understand trading activity, company distribution, and investor participation. Market participants need structured data regarding corporate instruments, sector composition, transaction activity, and foreign participation to evaluate current market conditions.
This project develops an IDX Market Intelligence Analyzer using Indonesia Stock Exchange API data. The system integrates multiple market information sources including warrant calendar data, sector-based company information, and top stock market activity.
The main objective of this system is to transform raw IDX API responses into structured analytical information that can support market monitoring and investment research.
The system analyzes several components:
Warrant activity monitoring
Sector company analysis
Top stock transaction activity
Foreign participation analysis
Market intelligence summary dashboard
The project is implemented using Python with API-based data collection, Pandas for data processing, and Excel export functionality for reporting purposes.
The first stage prepares the analysis environment by importing required libraries and configuring IDX RapidAPI access. The system defines API credentials, host configuration, and request headers to enable data retrieval from IDX services.
Cell 1 — Import Library and API Configuration
import requests
import pandas as pd
import json
from datetime import datetime
from IPython.display import display
RAPIDAPI_KEY = "YOUR_API_KEY"
HOST = "indonesia-stock-exchange-idx.p.rapidapi.com"
BASE_URL = f"https://{HOST}"
HEADERS = {
"Content-Type": "application/json",
"x-rapidapi-host": HOST,
"x-rapidapi-key": RAPIDAPI_KEY
}
print("="*80)
print("IDX MARKET INTELLIGENCE ANALYZER")
print("="*80)
print("API Host :", HOST)
print("Status : Ready")This cell establishes the API connection and prepares the environment for collecting IDX market data.
The second stage retrieves warrant calendar information from IDX API. Because API responses may have different nested structures, the system applies a recursive extraction function to identify list-based records and convert the result into a DataFrame format.
Cell 2 — Warrant Calendar Data Processing
url_warrant = f"{BASE_URL}/api/calendar/warrant"
response = requests.get(
url_warrant,
headers=HEADERS,
timeout=30
)
print("Status Code:", response.status_code)
warrant_json = response.json()
def extract_records(data):
if isinstance(data, list):
return data
if isinstance(data, dict):
for key in data.keys():
if isinstance(data[key], list):
return data[key]
if isinstance(data[key], dict):
result = extract_records(data[key])
if result:
return result
return []
warrant_data = extract_records(warrant_json)
df_warrant = pd.DataFrame(warrant_data)
print("Jumlah Data Warrant :", len(df_warrant))
display(df_warrant.head())This module provides structured warrant information that can be used for monitoring market instruments and corporate activity.
The third stage analyzes companies based on sector and subsector classification. The system retrieves company information from IDX API using predefined sector and subsector identifiers, then converts the response into a structured dataset.
Cell 3 — Sector Company Analysis
sector_id = 7
subsector_id = 19
url_company = (
f"{BASE_URL}/api/sectors/"
f"{sector_id}/subsectors/"
f"{subsector_id}/companies"
)
response = requests.get(
url_company,
headers=HEADERS,
timeout=30
)
print("Status Code:", response.status_code)
company_json = response.json()
company_data = extract_records(company_json)
df_company = pd.DataFrame(company_data)
print(
"Jumlah Perusahaan:",
len(df_company)
)
display(df_company.head())This process provides sector-level company mapping that helps identify the distribution of listed companies within selected market segments.
The fourth stage collects top stock market activity data. The system extracts transaction ranking information and normalizes important variables including stock code, transaction value, lot volume, average price, foreign value, and trading frequency.
Cell 4 — Top Stock Market Activity Analysis
top_data = (
top_json
.get("data", {})
.get("data", {})
.get("total", [])
)
df_top = pd.DataFrame(top_data)
df_top_clean = pd.DataFrame({
"Rank":
df_top["rank"],
"Code":
df_top["code"],
"Value_Rp":
df_top["value"].apply(
lambda x: int(x["raw"])
),
"Value_Format":
df_top["value"].apply(
lambda x: x["formatted"]
),
"Lot":
df_top["lot"].apply(
lambda x: x["formatted"]
),
"Average_Price":
df_top["average"].apply(
lambda x: int(x["raw"])
),
"Foreign_Value":
df_top["foreign_value"].apply(
lambda x: x["formatted"]
),
"Frequency":
df_top["frequency"].apply(
lambda x: x["formatted"]
)
})
display(df_top_clean.head(10))This module identifies stocks with significant transaction activity and prepares market activity indicators for further analysis.
The final stage creates the IDX Market Intelligence Summary Dashboard. The system summarizes total warrant records, sector company count, and top stock count. It also ranks stocks based on transaction activity and analyzes foreign participation before exporting the results into an Excel report.
Cell 5 — Market Intelligence Summary Dashboard
summary = pd.DataFrame({
"Parameter": [
"Total Warrant",
"Total Company Sector",
"Total Top Stock"
],
"Value": [
len(df_warrant),
len(df_company),
len(df_top_clean)
]
})
display(summary)
print("\nTOP STOCK BASED ON TRANSACTION VALUE")
display(
df_top_clean
.sort_values(
by="Rank"
)
.head(10)
)
print("\nTOP FOREIGN PARTICIPATION")
foreign_analysis = (
df_top_clean[
[
"Code",
"Foreign_Value",
"Value_Format",
"Frequency"
]
]
.head(10)
)
display(foreign_analysis)
output_file = "IDX_Market_Intelligence.xlsx"
with pd.ExcelWriter(output_file) as writer:
df_warrant.to_excel(
writer,
sheet_name="Warrant",
index=False
)
df_company.to_excel(
writer,
sheet_name="Companies",
index=False
)
df_top_clean.to_excel(
writer,
sheet_name="Top_Stock",
index=False
)
summary.to_excel(
writer,
sheet_name="Summary",
index=False
)
print("\nFile berhasil dibuat:")
print(output_file)This dashboard combines multiple IDX datasets into a single market intelligence report and provides export functionality for further analysis.

Conclusion
This project successfully developed an IDX Market Intelligence Analyzer using Indonesia Stock Exchange API data processing. The system integrates warrant calendar monitoring, sector company analysis, and top stock market activity analysis into a structured workflow.
The warrant module provides information regarding market instrument activities, while sector analysis helps identify company distribution based on selected market categories. The top stock analysis module evaluates transaction activity by processing trading value, frequency, lot volume, average price, and foreign participation.
The final dashboard provides a consolidated market overview and exports analytical results into an Excel report for easier monitoring and further evaluation.
Although this system improves efficiency in collecting and organizing IDX market information, it functions as a market monitoring and research tool rather than a direct investment recommendation. Additional analysis involving company fundamentals, valuation, technical indicators, and broader economic conditions is still required before making investment decisions.
Overall, the IDX Market Intelligence Analyzer demonstrates the application of API-based financial data analytics to support structured stock market monitoring and investment research.
