Introduction
bandar distribution retail bandar sentiment Python analysis is a useful method for understanding stock market behavior beyond simple price movement. In stock trading, price alone is not enough. Traders often want to know whether big players are accumulating, distributing, or leaving a stock.
In this tutorial, we will use Python in Google Colab to fetch and analyze two important API data sources: Bandar Distribution and Retail Bandar Sentiment. The first API helps us understand whether there is potential bandar accumulation or distribution in a stock. The second API adds sentiment information from retail and bandar activity.
This article is designed for beginners. Each cell will be explained in simple language so you can understand what the code does, why it matters, and how it can help in stock analysis.
LINK API
https://rapidapi.com/user/yasimpratama88
Cell 1 — Import Library
import requestsThis cell imports the requests library.
For beginners, requests is a Python library used to connect with an API. In this notebook, we use it to request stock analysis data from RapidAPI.
Cell 2 — Setup API
API_KEY = "YOUR_RAPIDAPI_KEY_HERE"
headers = {
"Content-Type": "application/json",
"x-rapidapi-host": "indonesia-stock-exchange-idx.p.rapidapi.com",
"x-rapidapi-key": API_KEY
}This cell prepares the API connection.
The API_KEY is your private access key from RapidAPI. The headers section tells the API who is making the request and what type of data format is being used.
Important: never publish your real API key in a public article.
Cell 3 — Get Bandar Distribution Data
url_bandar = "https://indonesia-stock-exchange-idx.p.rapidapi.com/api/analysis/bandar/distribution/BUMI?days=30"
response_bandar = requests.get(url_bandar, headers=headers)
data_bandar = response_bandar.json()
print("Bandar Status:", response_bandar.status_code)
import json
print(json.dumps(data_bandar, indent=2))This cell fetches Bandar Distribution data for the stock symbol BUMI over the last 30 days.
The API response is stored in data_bandar. The status code shows whether the request was successful. If the status code is 200, it usually means the data was fetched successfully.
The json.dumps() function is used to display the API response in a cleaner and easier-to-read format.
Cell 4 — Ambil Data Utama
bandar = data_bandar["data"]This cell takes the main data from the API response.
The API response usually contains several layers. The important part is inside the "data" key, so we store it inside the variable bandar.
This makes the next analysis easier because we can access the important information directly.
Cell 5 — Ringkasan Bandar
print("=== BANDAR SUMMARY ===")
print("Saham :", bandar["symbol"])
print("Status :", bandar["status"])
print("Score :", bandar["distribution_score"])
print("Confidence :", bandar["confidence"], "%")
print("Risk Level :", bandar["risk_level"])
print("Rekomendasi :", bandar["recommendation"])This cell prints a summary of bandar activity.
It shows:
Stock symbol
Bandar status
Distribution score
Confidence level
Risk level
Recommendation
For beginners, this is like reading the main conclusion from the API. It helps us quickly understand whether the stock is showing signs of distribution, accumulation, or neutral movement.
Cell 6 — Analisis Broker
broker = bandar["indicators"]["broker_exit_pattern"]
print("\n=== BROKER ANALYSIS ===")
print("Top Seller :", ", ".join(broker["top_brokers_selling"]))
print("Selling % :", broker["selling_percentage"], "%")
print("Net Flow :", broker["net_flow"])
if broker["net_flow"] < 0:
print("📉 Bandar keluar (Distribusi)")
else:
print("📈 Bandar masuk (Akumulasi)")This cell analyzes broker activity.
The variable broker takes data from broker_exit_pattern. This section shows which brokers are selling, the selling percentage, and the net flow.
If net_flow is negative, the code prints that bandar may be exiting or distributing. If net_flow is positive, the code prints that bandar may be entering or accumulating.
This is useful because broker movement can give clues about big player activity.
Cell 7 — Foreign Flow
foreign = bandar["indicators"]["foreign_flow"]
print("\n=== FOREIGN FLOW ===")
print("Net Sell :", foreign["net_foreign_sell"])
print("Consecutive Sell :", foreign["consecutive_sell_days"], "hari")
if foreign["consecutive_sell_days"] > 5:
print("⚠️ Asing keluar terus → bearish signal")This cell analyzes foreign investor flow.
It checks:
Net foreign sell
Consecutive foreign selling days
If foreign investors are selling for more than 5 consecutive days, the code gives a bearish warning.
For beginners, bearish means the market or stock may have downward pressure.
Cell 8 — Price vs Volume
pv = bandar["indicators"]["price_volume_divergence"]
print("\n=== PRICE vs VOLUME ===")
print("Price Change :", pv["price_increase"], "%")
print("Volume Change:", pv["volume_decrease"], "%")
if pv["divergence_detected"]:
print("⚠️ Divergence → potensi reversal")
else:
print("✔️ Tidak ada divergence")This cell checks price and volume divergence.
Price-volume divergence happens when price movement and volume movement do not support each other. For example, price may increase while volume decreases. This can sometimes indicate weakness in the trend.
If divergence is detected, the code warns about a possible reversal.
Cell 9 — Smart Final Analysis
print("\n=== FINAL ANALYSIS ===")
score = bandar["distribution_score"]
status = bandar["status"]
if score > 7:
print("🔥 Distribusi kuat → potensi turun")
elif score > 5:
print("⚠️ Distribusi mulai terjadi")
else:
print("📈 Masih aman")
if status == "EARLY_DISTRIBUTION":
print("⚠️ Fase awal distribusi → hati-hati")This cell creates a simple final analysis based on the distribution score.
If the score is above 7, the code assumes strong distribution.
If the score is above 5, it assumes early distribution.
If the score is lower, the stock is considered relatively safer.
It also checks whether the status is EARLY_DISTRIBUTION, which means traders should be careful.
Cell 10 — Trading Insight
print("\n=== TRADING INSIGHT ===")
if bandar["recommendation"] == "TAKE_PROFIT":
print("💰 Disarankan TAKE PROFIT")
elif bandar["recommendation"] == "BUY":
print("📈 Potensi BUY")
else:
print("📊 HOLD / WAIT")This cell gives a simple trading insight based on the API recommendation.
If the recommendation is TAKE_PROFIT, the code suggests taking profit.
If the recommendation is BUY, the code shows a potential buying signal.
Otherwise, the result is HOLD / WAIT.
This is useful for beginners because it turns complex data into a simple action category.
Cell 11 — Get Retail Bandar Sentiment Data
url_sentiment = "https://indonesia-stock-exchange-idx.p.rapidapi.com/api/analysis/sentiment/BBCA?days=7"
response_sentiment = requests.get(url_sentiment, headers=headers)
data_sentiment = response_sentiment.json()
print("Sentiment Status:", response_sentiment.status_code)This cell fetches sentiment data for BBCA over the last 7 days.
The sentiment API helps compare retail sentiment and bandar sentiment. This is useful because sometimes retail traders and big players may have different behavior.
Cell 12 — Cek Struktur Sentiment
import json
print(json.dumps(data_sentiment, indent=2))This cell displays the sentiment API response in a readable format.
Before analyzing API data, it is important to inspect its structure. This helps us know which keys are available and how to extract the correct values.
Cell 13 — Ambil Data Sentiment
sentiment = data_sentiment.get("data", {})This cell extracts the main sentiment data.
The .get() method is safer than direct indexing because it avoids errors if the "data" key is missing.
If no data is found, it returns an empty dictionary {}.
Cell 14 — Combined Bandar and Sentiment Analysis
print("\n=== COMBINED BANDAR + SENTIMENT ANALYSIS ===")
# dari bandar
bandar_status = bandar["status"]
recommendation = bandar["recommendation"]
risk = bandar["risk_level"]
# dari sentiment (contoh umum)
retail_sentiment = sentiment.get("retail_sentiment", "neutral")
bandar_sentiment = sentiment.get("bandar_sentiment", "neutral")
print("Bandar Status :", bandar_status)
print("Bandar Action :", recommendation)
print("Risk Level :", risk)
print("Retail Sentiment:", retail_sentiment)
print("Bandar Sentiment:", bandar_sentiment)This is the most important part of the notebook because it combines two API results.
It combines:
Bandar status
Bandar recommendation
Risk level
Retail sentiment
Bandar sentiment
For beginners, this combined analysis gives a more complete market picture. Instead of only looking at bandar distribution, we also compare it with sentiment data.
This can help traders understand whether the stock has high risk, positive sentiment, or possible warning signs.
Result:

Conclusion
bandar distribution retail bandar sentiment Python analysis helps traders understand stock movement from a deeper perspective. Instead of only looking at price charts, this notebook analyzes bandar distribution, broker selling patterns, foreign flow, price-volume divergence, and sentiment data.
By combining Bandar Distribution and Retail Bandar Sentiment APIs, we can build a more complete view of market conditions. This workflow is beginner-friendly, but it can also become the foundation for more advanced trading dashboards, stock screening tools, or automated market analysis systems.
The main lesson is simple: good trading analysis is not only about price movement. It is also about understanding who is buying, who is selling, how strong the risk is, and whether the market sentiment supports the movement.
