OHLC.dev editorialIDX

Stock Market Analysis Using IDX API for Indonesian Stock Screening

This article presents an analysis of the Indonesian stock market using IDX API to identify active stocks, examine broker activity, and screen potential multibagger candidates based on market indicators and trading data.

September 8, 20264 min readRafatar
Stock Market Analysis Using IDX API for Indonesian Stock Screening

Stock market analysis requires the integration of various market indicators to understand price movement, investor activity, and potential investment opportunities. Relying only on price changes is often insufficient because market behavior is also influenced by trading activity, broker transactions, foreign flow, accumulation patterns, and company growth potential.

This project develops an Indonesian Stock Market Insight Dashboard using IDX API data processing. The system is designed to collect and analyze stock market information through several analytical components, including:

  • Top stock activity analysis

  • Broker activity analysis

  • Multibagger stock screening

The objective of this project is to transform raw stock market data into structured information that can help investors understand market activity and identify potential stock candidates.

The system is implemented using Python with API integration, data processing using Pandas, and visualization using Matplotlib.


System Implementation

Cell 1 — Import Library and API Setup

import requests
import pandas as pd
import matplotlib.pyplot as plt


API_HOST = "indonesia-stock-exchange-idx.p.rapidapi.com"


headers = {
    "Content-Type": "application/json",
    "x-rapidapi-host": API_HOST,
    "x-rapidapi-key": "YOUR_API_KEY"
}

This cell initializes the required Python libraries and prepares the API configuration. The system uses requests for API communication, Pandas for data processing, and Matplotlib for visualization.


Cell 2 — Retrieve Top Stock Activity Data

import requests
import pandas as pd


url = "https://indonesia-stock-exchange-idx.p.rapidapi.com/api/market-detector/top-stock"


params = {
    "page": 1,
    "investorType": "INVESTOR_TYPE_ALL",
    "start": "2026-01-05",
    "end": "2026-01-05",
    "marketType": "MARKET_TYPE_ALL",
    "valueType": "VALUE_TYPE_TOTAL"
}


response = requests.get(
    url,
    headers=headers,
    params=params
)


print("Status Code:", response.status_code)


top_stock = response.json()


print("\nIsi Response:")

print(top_stock)

This cell retrieves top stock activity data from IDX API. The collected information contains market activity based on investor type, market type, transaction value, and trading period.

The response data is stored in JSON format for further processing.


Cell 3 — Process and Visualize Top Stock Activity

# Ambil data top stock

df_top = pd.DataFrame(
    top_stock["data"]["data"]["total"]
)



# Pisahkan nilai transaksi menjadi angka

df_top["value_raw"] = df_top["value"].apply(
    lambda x: int(x["raw"])
)



df_top["frequency_raw"] = df_top["frequency"].apply(
    lambda x: int(x["raw"])
)



df_top.head()

This cell converts the top stock API response into a Pandas DataFrame.

The process extracts important numerical information such as:


  • transaction value


  • transaction frequency

The processed dataset is prepared for stock activity analysis.


Cell 4 — Broker Activity Analysis

url_broker = """
https://indonesia-stock-exchange-idx.p.rapidapi.com/api/market-detector/broker-activity/DH
"""


params_broker = {
    "from":"2026-01-02",
    "to":"2026-01-02",
    "investorType":"INVESTOR_TYPE_ALL",
    "transactionType":"TRANSACTION_TYPE_NET",
    "page":1,
    "limit":50,
    "marketBoard":"MARKET_BOARD_REGULER"
}


response_broker = requests.get(
    url_broker,
    headers=headers,
    params=params_broker
)


broker_data = response_broker.json()


broker_data

This cell retrieves broker transaction activity data.

The analysis focuses on broker-level trading behavior by evaluating:

  • transaction direction

  • investor type

  • net transaction activity

The output provides additional information about market participant behavior.


Cell 5 — Multibagger Scanner and Final Analysis

# Mengambil kandidat saham

candidates = multi_data["data"]["candidates"]



# Membuat dataframe sederhana

analysis = []


for stock in candidates:

    analysis.append({

        "Kode": stock["symbol"],

        "Nama": stock["name"],

        "Score": stock["multibagger_score"],

        "Harga Saat Ini": stock["current_price"],

        "Potensi Return": stock["potential_return"],

        "Timeframe": stock["timeframe"],

        "Risiko": stock["risk_level"],

        "Trend": stock["reasons"]["technical"]["trend"],

        "Volume": stock["reasons"]["volume"]["volume_trend"],

        "Foreign Flow": stock["reasons"]["foreign_flow"]["net_foreign_flow"],

        "Akumulasi": stock["reasons"]["accumulation"]["status"],

        "Target 1": stock["target_prices"][0]["target"],

        "Target 2": stock["target_prices"][1]["target"],

        "Stop Loss": stock["stop_loss"]

    })



df_analysis = pd.DataFrame(analysis)



# Urut berdasarkan score tertinggi

df_analysis = df_analysis.sort_values(
    "Score",
    ascending=False
)



df_analysis

This cell performs multibagger stock screening by extracting stock candidates from the API response.

The system evaluates several parameters:

  • Multibagger score

  • Current price

  • Potential return

  • Risk level

  • Technical trend

  • Volume trend

  • Foreign flow

  • Accumulation status

  • Target price

  • Stop loss level

The final dataframe is sorted based on the highest score to identify the most promising candidates.

report

Conclusion

This project successfully developed an Indonesian Stock Market Insight Dashboard using IDX API integration and Python-based data processing. The system combines multiple market analysis components to provide a broader understanding of stock activity and investment opportunities.

The Top Stock Activity Analysis module provides information regarding stocks with significant market activity by processing transaction value and frequency data. The Broker Activity Analysis module provides additional insight into trading behavior by evaluating broker-level transactions.

The Multibagger Scanner module expands the analysis by ranking stock candidates based on multiple factors, including technical trend, volume behavior, foreign flow, accumulation status, potential return, and risk level.

By integrating these components, the dashboard provides a structured approach for analyzing Indonesian stock market conditions. However, the generated insights should not be considered as direct investment recommendations. Further evaluation using company fundamentals, financial performance, valuation analysis, and broader market conditions remains necessary before making investment decisions.