mirror of
https://github.com/0xrsydn/idx-cli.git
synced 2026-11-07 09:45:36 +00:00
feat(cli,mcp): idx stocks broker and get_broker_summary
`idx stocks broker SYMBOL` shows the top 10 buyers and sellers of a stock by lots for the latest session with trades, one `--date`, or a `--from`/`--to` range, filtered by `--investor` and `--board`. The MCP server exposes the same as get_broker_summary. - Range and filter parsing lives in idx-core (BrokerRange::from_args, FromStr for the filters), so both frontends accept the same input. - Without dates, the latest session is found by walking back over weekdays; offline, uncached days are skipped. - Table output lists foreign and state-owned brokers, and says when the source rounded figures. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V3syn2fN2LNo5pvTSqc6eh
This commit is contained in:
parent
7c8151a3a6
commit
860d4daf77
25 changed files with 939 additions and 13 deletions
|
|
@ -66,6 +66,7 @@ Commands:
|
|||
valuation Run valuation analysis on a stock
|
||||
risk Run risk analysis on a stock
|
||||
fundamental Run full fundamental analysis on a stock
|
||||
broker Which brokers bought and sold a stock
|
||||
profile Get company profile
|
||||
financials Get financial statements
|
||||
earnings Get earnings report
|
||||
|
|
@ -278,6 +279,78 @@ Examples:
|
|||
idx -o json stocks fundamental BBCA
|
||||
```
|
||||
|
||||
### `idx stocks broker`
|
||||
|
||||
```text
|
||||
Which brokers bought and sold a stock: the top 10 buyers and top 10 sellers by lots, with value and average price, from Indo Premier (IPOT). End of day: IDX does not show broker codes during trading. Without dates, the latest session with trades.
|
||||
|
||||
Usage: idx stocks broker [OPTIONS] <SYMBOL>
|
||||
|
||||
Arguments:
|
||||
<SYMBOL>
|
||||
Single ticker symbol (e.g. BBCA)
|
||||
|
||||
Options:
|
||||
--date <DATE>
|
||||
One session, YYYY-MM-DD. Default: the latest session with trades
|
||||
|
||||
-o, --output <OUTPUT>
|
||||
Output format [default: auto = table on a terminal, json when piped]
|
||||
|
||||
[possible values: auto, table, json, jsonl]
|
||||
|
||||
--from <FROM>
|
||||
First session of a range, YYYY-MM-DD (at most 366 days)
|
||||
|
||||
--no-color
|
||||
Disable colored output
|
||||
|
||||
-q, --quiet
|
||||
Suppress non-essential output
|
||||
|
||||
--to <TO>
|
||||
Last session of the range, YYYY-MM-DD. Default: today
|
||||
|
||||
--investor <INVESTOR>
|
||||
Whose trades to count
|
||||
|
||||
Possible values:
|
||||
- all: Every trade
|
||||
- foreign: Trades by foreign investors only
|
||||
- domestic: Trades by domestic investors only
|
||||
|
||||
[default: all]
|
||||
|
||||
-v, --verbose...
|
||||
Increase verbosity (-v, -vv)
|
||||
|
||||
--board <BOARD>
|
||||
Which board's trades to count; `regular` leaves out negotiated block trades
|
||||
|
||||
Possible values:
|
||||
- all: Every board
|
||||
- regular: Regular market (RG), the continuous order book
|
||||
- cash: Cash market (TN)
|
||||
- negotiated: Negotiated market (NG): pre-arranged block trades
|
||||
|
||||
[default: all]
|
||||
|
||||
--offline
|
||||
Run without network requests
|
||||
|
||||
--no-cache
|
||||
Bypass local cache
|
||||
|
||||
-h, --help
|
||||
Print help (see a summary with '-h')
|
||||
|
||||
Examples:
|
||||
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
|
||||
idx -o json stocks broker BBCA --investor foreign
|
||||
```
|
||||
|
||||
### `idx stocks profile`
|
||||
|
||||
```text
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: Stocks
|
||||
description: Quotes, history, company data, analysis and screening.
|
||||
description: Quotes, history, company data, broker summaries, analysis and screening.
|
||||
---
|
||||
|
||||
All `stocks` commands take IDX tickers (`BBCA`, or `BBCA.JK`). Every flag is
|
||||
|
|
@ -28,6 +28,25 @@ them from stdin. `history` takes `--period` (`1d` to `5y`) and `--interval`
|
|||
| `insights` | AI insights from the provider |
|
||||
| `news` | recent news, this company's first (`ABOUT` = `company`), then general market news (`market`) |
|
||||
|
||||
## Broker summary
|
||||
|
||||
```bash
|
||||
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, 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.
|
||||
|
||||
## Analysis
|
||||
|
||||
| Command | What it computes |
|
||||
|
|
@ -62,6 +81,7 @@ idx stocks screen --filter high-dividend | jq -r '.[].symbol' | idx stocks compa
|
|||
## Providers
|
||||
|
||||
MSN is the default for quotes, company data and screening; Yahoo serves
|
||||
price history. Switch with `IDX_PROVIDER=msn|yahoo` and
|
||||
price history, and Indo Premier (IPOT) serves broker summaries whichever
|
||||
provider is selected. Switch with `IDX_PROVIDER=msn|yahoo` and
|
||||
`IDX_HISTORY_PROVIDER=auto|yahoo|msn`, or the matching
|
||||
[config keys](/start/config/).
|
||||
|
|
|
|||
|
|
@ -27,6 +27,19 @@ Compare fundamental reports (growth, valuation, risk) across IDX tickers. Ticker
|
|||
| --- | --- | --- | --- |
|
||||
| `symbols` | array of string | yes | IDX tickers, e.g. ["BBCA", "BBRI"]; the `.JK` suffix is optional. At most 20. |
|
||||
|
||||
## `get_broker_summary`
|
||||
|
||||
Broker summary for one IDX ticker: the top 10 buyers and top 10 sellers by lots over a session or date range, each with lots (1 lot = 100 shares), value and average price in IDR, plus totals. Buyers and sellers are ranked separately and gross, so a broker can appear on both sides. End of day only (IDX hides broker codes during trading); `kind` is the broker's own status (local, foreign, state_owned), not its clients'. `rounded` = true means figures of a million and more carry one decimal of precision.
|
||||
|
||||
| Input | Type | Required | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| `board` | `all` / `regular` / `cash` / `negotiated` | no | Which board's trades to count (default "all"); "regular" leaves out negotiated block trades. |
|
||||
| `date` | string | no | One session, YYYY-MM-DD. Omit date, from and to for the latest session with trades. |
|
||||
| `from` | string | no | First session of a range, YYYY-MM-DD (at most 366 days). |
|
||||
| `investor` | `all` / `foreign` / `domestic` | no | Whose trades to count, by investor domicile (default "all"). |
|
||||
| `symbol` | string | yes | IDX ticker, e.g. "BBCA". |
|
||||
| `to` | string | no | Last session of the range, YYYY-MM-DD (default today). |
|
||||
|
||||
## `get_company`
|
||||
|
||||
Company data for one IDX ticker: profile, financial statements, earnings, analyst sentiment, insights, and news. News items carry `relevance`: `company` (about this ticker) first, then `market` (general market news). Sections that fail are listed under `errors`; the call fails only if every section fails.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue