idx-cli/web/src/content/docs/cli/stocks.md
0xrsydn 43ff4aa433 feat: corporate actions from the Stockbit session (stocks actions, stocks calendar)
`idx stocks actions SYM [--kind ...]`: one stock's cash and stock
dividends, bonus shares, rights, warrants, splits and reverse splits,
meetings, public exposes and tender offers (`--kind ipo` adds its IPO),
newest first. `idx stocks calendar [--from] [--to] [--kind ...]`: the
market's actions dated in the range (default today and 30 days ahead),
oldest first. MCP: get_corporate_actions, get_corporate_calendar.

Stockbit's `/corpaction/{type}` serves one kind per request; each type has
its own field prefix and list key, so entitlements are read by field
suffix. An action's `date` is the cum date for entitlements, else the
event's first day. Dividends keep their decimals. One request per kind,
cached 6 hours. AUTHERROR without a session.

Fixtures are the 2026-11-03 recordings (market-wide ones trimmed to
October-December). Goldens added; help-stocks and completions-bash gain
the two subcommands, MCP tools.json the two tools (regenerated with
UPDATE_GOLDEN=1). The MCP docs counted 17 tools without stockbit_login;
now 20.

Claude-Session: https://claude.ai/code/session_01RqPPVeVDrnLoP7NUZmLRxY
2026-11-03 14:35:20 +07:00

7.7 KiB

title description
Stocks Quotes, history, company data, broker summaries, analysis and screening.

All stocks commands take IDX tickers (BBCA, or BBCA.JK). Every flag is listed in the command reference.

Quotes and history

idx stocks quote BBCA BBRI,BMRI
idx stocks history BBCA --period 1y --interval 1wk

quote takes several tickers, separated by spaces or commas, or - to read them from stdin. When a quote's last trade is from before the latest IDX session, the table says so under it, and JSON sets behind_session: the provider may still show the previous close. history takes --period (1d to 5y) and --interval (1d, 1wk, 1mo).

Today by the minute

idx stocks intraday BBCA
idx stocks intraday ^JKSE
idx -o json stocks intraday BBCA | jq '.points[-1]'

intraday shows today's session from Stockbit's public page, without a login: the quote, the best bid and offer while the market is open, a sparkline and the last five minutes. JSON gives every minute in points. It is delayed at least 10 minutes. See Stockbit for what it covers and the terms it comes with.

Order book (Stockbit login)

idx stocks orderbook BBCA
idx stocks orderbook BBRI --depth 5

With your own Stockbit session (idx stockbit login), orderbook shows every bid and offer level with lots and queued orders, the session's OHLC, value and trades, and foreign buy, sell and net once Stockbit marks them current (not during trading, when they lag a day). Without one it answers AUTHERROR. See Stockbit.

Corporate actions (Stockbit login)

idx stocks actions BBCA                       # newest first
idx stocks actions TLKM --kind dividend
idx stocks calendar                           # today and the next 30 days
idx stocks calendar --kind dividend,rights --to 2026-12-31

actions lists one stock's cash and stock dividends, bonus shares, rights issues, warrants, splits and reverse splits, shareholders' meetings, public exposes and tender offers (--kind ipo adds its IPO). calendar lists them across the market between --from and --to (at most 366 days), including what is announced ahead. An action's date is its cum date for dividends, bonuses, rights and splits: buy by then to be entitled. For the others it is the event's first day. Dividends per share keep their decimals (Rp 3.8).

Both need your Stockbit session and answer AUTHERROR without one. Stockbit serves one kind per request, 1 s apart, so a first call with every kind takes about ten seconds; answers are then cached for 6 hours. --kind asks for less.

Company data

Command What it shows
profile sector, industry, description, contacts and officers
financials income, balance sheet and cash flow statements (--statement income,balance)
earnings reported and estimated earnings
sentiment crowd sentiment
insights AI insights from the provider
news recent news, this company's first (ABOUT = company), then general market news (market)

Broker summary

idx stocks broker BBCA
idx stocks broker BBCA --date 2026-10-16
idx stocks broker BBCA --from 2026-10-12 --to 2026-10-16 --board regular

Which brokers bought and sold a stock: the top 10 buyers and the top 10 sellers by lots, each with lots, value and average price, plus totals and the net foreign value. Without dates it shows the latest session with trades. --investor foreign|domestic counts only one side's clients (each broker row is then that broker's foreign or domestic clients' trades, and the footer gives what that side bought and sold), and --board regular leaves out negotiated block trades.

The data comes from Indo Premier (IPOT) and is end of day: IDX hides broker codes during trading. Buyers and sellers are ranked separately on gross lots, so a broker can appear on both sides. The source rounds figures of a million and more to one decimal, and the output says so.

Foreign flow

idx stocks flow BBCA
idx stocks flow BBCA --days 20
idx stocks flow BBCA --from 2026-10-01 --to 2026-10-16
idx stocks flow BBCA --source idx

What foreign investors bought and sold, session by session, with the totals over the range. Without dates it shows the latest 10 sessions (--days, at most 60).

By default the figures come from Indo Premier (IPOT), like broker: foreign buy, sell and net value across all boards and foreign investors' share of trading. It needs nothing installed, takes two requests per session, and rounds figures of a million and more to one decimal.

--source idx reads IDX's own daily trading summary instead: exact foreign share counts, the close and day change, and the share of value traded outside the regular board. Those figures are the regular board, and values are estimated at each session's average price. Each session is one request to idx.co.id, cached for every stock, and needs curl-impersonate and a network IDX's Cloudflare lets through; even then it can answer 403.

Bandarmology

idx stocks bandar BBCA
idx stocks bandar BBCA --from 2026-10-12 --to 2026-10-16 --top 3
idx stocks screen --filter high-volume | jq -r '.[].symbol' | idx stocks bandar -

bandar reads the broker summary: for the top 1, 3, 5 and 10 brokers on each side, the buyers' value minus the sellers' value as a share of the value traded. The headline tier (--top, default 5) gives the signal:

Top-N buy minus sell, % of value Signal
+15% or more big accumulation
+5% to +15% accumulation
within ±5% neutral
-15% to -5% distribution
-15% or less big distribution

Several symbols give a screen ranked by that figure (at most 100, one request each), and it takes the same date and filter flags as broker. With --investor foreign (or domestic) it reads that side alone: the top buyers' share of foreign buying against the top sellers' share of foreign selling. That needs --board all, since IPOT gives one side's selling only across all boards. It is a heuristic: a broker trades for many clients, and a broker on both sides of the summary is listed, since its gross figures overstate which way it traded. The JSON names the rules in method (top_concentration_v1).

Analysis

Command What it computes
technical trend, RSI, MACD, moving averages and signals
growth revenue and earnings growth rating
valuation P/E, P/B, ROE, net margin and EV/EBITDA, with a rating
risk debt to equity, current ratio and ROA, with a rating
fundamental growth, valuation and risk in one report
compare fundamental for several tickers side by side
idx stocks fundamental BBRI
idx stocks compare BBCA BBRI BMRI

Screening

idx stocks screen --filter high-dividend --limit 20

Filters: top-performers (default), worst-performers, high-dividend, low-pe, 52w-high, 52w-low, high-volume, large-cap.

Screen results pipe straight into compare:

idx stocks screen --filter high-dividend | jq -r '.[].symbol' | idx stocks compare -

Providers

MSN is the default for quotes, company data and screening; Yahoo serves price history. Indo Premier (IPOT) serves broker summaries and foreign flow (IDX's own site with flow --source idx), and Stockbit serves intraday and, with your login, orderbook, whichever provider is selected. Switch with --provider msn|yahoo|stockbit (or IDX_PROVIDER) and IDX_HISTORY_PROVIDER=auto|yahoo|msn|stockbit, or the matching config keys. --provider stockbit serves quotes only, with the best bid/offer, live when you are logged in; see Stockbit.