OHLC.dev editorialIDX

IDX Stock Intelligence Analyzer Using Sentiment Analysis and Commodity Impact Evaluation

This article presents an IDX Stock Intelligence Analyzer using IDX API data to analyze company information stock sentiment commodity risk and market intelligence scoring.

September 25, 20264 min readRafatar
IDX Stock Intelligence Analyzer Using Sentiment Analysis and Commodity Impact Evaluation

Stock market analysis requires multiple perspectives to understand market conditions. Price movement alone cannot fully represent investor sentiment and external factors that influence stock performance. Combining company information, market sentiment, and commodity impact can provide a more structured approach for evaluating market conditions.

This project develops an IDX Stock Intelligence Analyzer using Indonesia Stock Exchange API data to generate a market intelligence report. The system integrates three main analytical components:

  • Company search analysis

  • Stock sentiment analysis

  • Commodity impact analysis

The objective of this system is to transform IDX API data into an intelligence score that combines sentiment conditions and external commodity risk factors. The final output provides a simplified market signal based on the calculated intelligence score.

The project is developed using Python with Requests for API communication, Pandas for data processing, NumPy for numerical calculation, and Matplotlib for visualization support. The system configuration defines the stock symbol, IDX API endpoint, and authentication headers required for data retrieval.


Cell 1 — Import Library and API Configuration

The first cell prepares the Python environment and configures the IDX RapidAPI connection. The selected stock symbol in this analysis is BBCA.

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


# ==============================
# CONFIG
# ==============================

SYMBOL = "BBCA"


API_KEY = "YOUR_API_KEY"


BASE_URL = "https://indonesia-stock-exchange-idx.p.rapidapi.com"



HEADERS = {

    "x-rapidapi-host":
    "indonesia-stock-exchange-idx.p.rapidapi.com",

    "x-rapidapi-key":
    API_KEY

}


print("IDX Intelligence System Ready")

Cell 2 — Company Search Analysis

The second cell retrieves company information using the IDX company search endpoint. This function allows the system to identify company data based on the selected stock symbol.

# ==============================
# COMPANY SEARCH ANALYSIS
# ==============================


def company_search(symbol):

    url = BASE_URL + "/api/main/search"


    params = {

        "type":"company",

        "page":0,

        "keyword":symbol

    }


    r = requests.get(

        url,

        headers=HEADERS,

        params=params

    )


    return r.json()



company = company_search(SYMBOL)


company

Cell 3 — Sentiment Analyzer

The third cell analyzes stock sentiment using the IDX sentiment analysis endpoint. The system retrieves sentiment information from the last seven days and uses the result as one of the intelligence scoring components.

# ==============================
# SENTIMENT ANALYZER
# ==============================


def sentiment_analysis(symbol):

    url = (

        BASE_URL+

        f"/api/analysis/sentiment/{symbol}"

    )


    params={

        "days":7

    }


    r=requests.get(

        url,

        headers=HEADERS,

        params=params

    )


    return r.json()



sentiment = sentiment_analysis(SYMBOL)


sentiment

Cell 4 — Commodity Impact Analyzer

The fourth cell retrieves commodity impact information from IDX API. Commodity conditions are considered an external risk factor that may influence market sentiment.

# ==============================
# COMMODITY IMPACT ANALYZER
# ==============================


def commodity_impact():

    url = (

        BASE_URL+

        "/api/main/commodities-impact"

    )


    r=requests.get(

        url,

        headers=HEADERS

    )


    return r.json()



commodity = commodity_impact()


commodity

Cell 5 — Intelligence Scoring Dashboard

The final cell combines sentiment and commodity risk into a single intelligence score.

The scoring model uses:

  • Sentiment Score weight: 70%

  • Commodity Risk factor weight: 30%

The final score is classified into three market conditions:

  • Accumulation Watch

  • Neutral

  • High Risk

# ==========================
# SENTIMENT SCORE
# ==========================


try:

    sentiment_score = (

        sentiment_df

        .select_dtypes(include=np.number)

        .mean()

        .mean()

    )


except:

    sentiment_score = 50



# ==========================
# COMMODITY RISK
# ==========================


commodity_risk = 50



# ==========================
# FINAL SCORE
# ==========================


final_score = (

    sentiment_score*0.7

    +

    (100-commodity_risk)*0.3

)



if final_score >=70:

    signal="ACCUMULATION WATCH"



elif final_score>=50:

    signal="NEUTRAL"



else:

    signal="HIGH RISK"



print("""

====================================

IDX MARKET INTELLIGENCE REPORT

====================================


Stock:

{}


Sentiment Score:

{:.2f}/100



Commodity Risk:

{} /100



Final Intelligence Score:

{:.2f}/100



Market Signal:

{}


====================================

""".format(

SYMBOL,

sentiment_score,

commodity_risk,

final_score,

signal

))


Conclusion

This project successfully develops an IDX Stock Intelligence Analyzer using IDX API data to evaluate stock sentiment and external commodity impact.

The system integrates company search information, seven-day sentiment analysis, and commodity risk evaluation into a simplified intelligence scoring framework.

By combining sentiment score and commodity risk factors, the analyzer produces a final intelligence score and market signal classification. This approach provides a structured method for transforming raw API data into a market monitoring tool.

However, the generated intelligence score should not be considered as a standalone investment decision. Further validation using financial fundamentals, valuation analysis, technical indicators, liquidity conditions, and broader market conditions is required.

Overall, this IDX Stock Intelligence Analyzer demonstrates how API-based financial data processing can support systematic stock market research and automated intelligence reporting.