Broker summary data in Python with Pandas
Pandas is a natural fit for broker summary data. Install the two packages you need with pip, then pull a ticker into a DataFrame:
pip install requests pandasSingle ticker
import pandas as pd
import requests
API_KEY = "<YOUR_API_KEY>"
BASE_URL = "https://api.indexalpha.id"
headers = {"Authorization": f"Bearer {API_KEY}"}
params = {"ticker": "BBCA", "from": "2026-03-26", "to": "2026-03-26", "investor": "all"}
resp = requests.get(f"{BASE_URL}/stocks/broker-summary", headers=headers, params=params)
resp.raise_for_status()
df = pd.DataFrame(resp.json()["data"])
print(df.head())Each row is one broker. buy_value and sell_value are in IDR, buy_volume and sell_volume are in shares, and buy_avg and sell_avg are weighted average prices.
Batch into one DataFrame
To load a batch of tickers into one DataFrame:
import pandas as pd
import requests
API_KEY = "<YOUR_API_KEY>"
BASE_URL = "https://api.indexalpha.id"
headers = {"Authorization": f"Bearer {API_KEY}"}
payload = {
"tickers": ["BBCA", "BBRI", "TLKM"],
"from": "2026-03-26",
"to": "2026-03-26",
"investor": "all",
"market": "RG",
}
resp = requests.post(f"{BASE_URL}/stocks/broker-summary/batch", json=payload, headers=headers)
resp.raise_for_status()
frames = []
for ticker, rows in resp.json()["data"].items():
frame = pd.DataFrame(rows)
frame.insert(0, "ticker", ticker)
frames.append(frame)
df = pd.concat(frames, ignore_index=True)
print(df.head())If a column arrives as text - for example after re-loading a CSV export - coerce buy_value to a numeric dtype before doing arithmetic:
df["buy_value"] = pd.to_numeric(df["buy_value"])