mirror of
https://github.com/0xrsydn/idx-cli.git
synced 2026-11-07 09:45:36 +00:00
feat: bandarmology (idx stocks bandar, analyze_bandar)
`idx stocks bandar SYMBOL...` reads the broker summary: for the top 1, 3, 5 and 10 brokers per side, buy value minus sell value in basis points of value traded, with a signal from big accumulation to big distribution on the headline tier (--top, default 5). Several symbols give a screen ranked by that figure (at most 100, one request each), which pipes from `stocks screen`. The MCP server exposes it as analyze_bandar (20 symbols). - analysis/bandar.rs is pure and versioned (`top_concentration_v1`): integer basis points, no figure missing counted as zero, buy/sell VWAP from exact averages, and the brokers on both sides listed because their gross figures overstate their direction. - Thresholds (±5%/±15%) follow fzn0x/idx (MIT); docs call them heuristics. - Invalid input fails a screen at once; other errors fail one symbol and are warned about on stderr. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V3syn2fN2LNo5pvTSqc6eh
This commit is contained in:
parent
ae7a1e2b5c
commit
970da26a0e
25 changed files with 1588 additions and 37 deletions
|
|
@ -67,6 +67,7 @@ Commands:
|
|||
risk Run risk analysis on a stock
|
||||
fundamental Run full fundamental analysis on a stock
|
||||
broker Which brokers bought and sold a stock
|
||||
bandar Bandarmology: is buying more concentrated than selling
|
||||
profile Get company profile
|
||||
financials Get financial statements
|
||||
earnings Get earnings report
|
||||
|
|
@ -351,6 +352,83 @@ Examples:
|
|||
idx -o json stocks broker BBCA --investor foreign
|
||||
```
|
||||
|
||||
### `idx stocks bandar`
|
||||
|
||||
```text
|
||||
Bandarmology from the broker summary: the top 1, 3, 5 and 10 buyers' value against the same number of sellers', as a share of value traded, with a signal from big accumulation to big distribution. Several symbols give a screen ranked by the headline tier (at most 100, one request each). A heuristic over end-of-day broker codes, not advice.
|
||||
|
||||
Usage: idx stocks bandar [OPTIONS] <SYMBOLS>...
|
||||
|
||||
Arguments:
|
||||
<SYMBOLS>...
|
||||
One or more symbols, comma-separated or space-separated; `-` reads them from stdin
|
||||
|
||||
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
|
||||
|
||||
--top <TOP>
|
||||
Tier behind the headline signal: 1, 3, 5 or 10 brokers per side
|
||||
|
||||
[default: 5]
|
||||
|
||||
-h, --help
|
||||
Print help (see a summary with '-h')
|
||||
|
||||
Examples:
|
||||
idx stocks bandar BBCA
|
||||
idx stocks bandar BBCA --from 2026-10-12 --to 2026-10-16 --top 3
|
||||
idx stocks bandar BBCA,BBRI,BMRI,TLKM
|
||||
idx stocks screen --filter high-volume | jq -r '.[].symbol' | idx stocks bandar -
|
||||
```
|
||||
|
||||
### `idx stocks profile`
|
||||
|
||||
```text
|
||||
|
|
|
|||
|
|
@ -47,6 +47,32 @@ 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.
|
||||
|
||||
## Bandarmology
|
||||
|
||||
```bash
|
||||
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`. 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 |
|
||||
|
|
|
|||
|
|
@ -10,6 +10,20 @@ starts with `--allow-sync`. Results that come from a live provider are wrapped
|
|||
as `{data, source, fetched_at, stale}`; failures return `{error, code,
|
||||
message}` with `isError` set.
|
||||
|
||||
## `analyze_bandar`
|
||||
|
||||
Bandarmology for one or more IDX tickers from the broker summary: for the top 1, 3, 5 and 10 brokers per side, buy value minus sell value as basis points of value traded (`imbalance_bps`), with a `signal` from big_accumulation (>= +1500) through neutral (within +-500) to big_distribution (<= -1500), headlined by `top` (default 5). Reports come strongest accumulation first; tickers that fail are listed under `failures`. A heuristic over end-of-day broker codes: brokers trade for many clients, and `both_sides` lists brokers whose gross figures overstate their direction. `method` names the rules applied.
|
||||
|
||||
| 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"). |
|
||||
| `symbols` | array of string | yes | IDX tickers, e.g. ["BBCA", "BBRI"]; the `.JK` suffix is optional. At most 20. |
|
||||
| `to` | string | no | Last session of the range, YYYY-MM-DD (default today). |
|
||||
| `top` | integer | no | Tier behind the headline signal: 1, 3, 5 or 10 brokers per side (default 5). |
|
||||
|
||||
## `analyze_stock`
|
||||
|
||||
Analyze one IDX ticker: technical signals (trend, RSI, MACD, moving averages) and fundamental growth, valuation, and risk ratings. Analyses that fail are listed under `errors`; the call fails only if every analysis fails.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue