mirror of
https://github.com/0xrsydn/idx-cli.git
synced 2026-11-07 09:45:36 +00:00
feat: foreign flow (idx stocks flow, get_foreign_flow)
`idx stocks flow SYMBOL` shows what foreign investors bought and sold of a stock, session by session, from IDX's own daily trading summary: foreign buy, sell and net volume, net value at the session's average price, and the share of value traded outside the regular board, with range totals. Latest 10 sessions by default (--days, at most 60) or --from/--to. The MCP server exposes it as get_foreign_flow. - api/idx: pure parser for GetStockSummary (rows dated another session are dropped) and a provider over curl-impersonate's profile fallback with a 30 s limit; Cloudflare passes only some fingerprints. - flow: each session is cached whole by date, so other stocks' flows for the same sessions need no request. Weekends are never requested. - Idx::idx_code is shared by broker and flow for the .JK-only check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V3syn2fN2LNo5pvTSqc6eh
This commit is contained in:
parent
4c2f0acff3
commit
29f143fa1b
40 changed files with 1278 additions and 29 deletions
|
|
@ -68,6 +68,7 @@ Commands:
|
|||
fundamental Run full fundamental analysis on a stock
|
||||
broker Which brokers bought and sold a stock
|
||||
bandar Bandarmology: is buying more concentrated than selling
|
||||
flow Foreign buying and selling of a stock, session by session
|
||||
profile Get company profile
|
||||
financials Get financial statements
|
||||
earnings Get earnings report
|
||||
|
|
@ -429,6 +430,57 @@ Examples:
|
|||
idx stocks screen --filter high-volume | jq -r '.[].symbol' | idx stocks bandar -
|
||||
```
|
||||
|
||||
### `idx stocks flow`
|
||||
|
||||
```text
|
||||
Foreign buying and selling of a stock, session by session, from IDX's daily trading summary: foreign buy, sell and net volume, the net value at the session's average price, and the share of value traded outside the regular board. End of day. Each session is one request to idx.co.id, which needs curl-impersonate.
|
||||
|
||||
Usage: idx stocks flow [OPTIONS] <SYMBOL>
|
||||
|
||||
Arguments:
|
||||
<SYMBOL>
|
||||
Single ticker symbol (e.g. BBCA)
|
||||
|
||||
Options:
|
||||
--days <DAYS>
|
||||
Latest sessions to show (default 10, at most 60)
|
||||
|
||||
-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 92 days)
|
||||
|
||||
--no-color
|
||||
Disable colored output
|
||||
|
||||
-q, --quiet
|
||||
Suppress non-essential output
|
||||
|
||||
--to <TO>
|
||||
Last session of the range, YYYY-MM-DD. Default: today
|
||||
|
||||
-v, --verbose...
|
||||
Increase verbosity (-v, -vv)
|
||||
|
||||
--offline
|
||||
Run without network requests
|
||||
|
||||
--no-cache
|
||||
Bypass local cache
|
||||
|
||||
-h, --help
|
||||
Print help (see a summary with '-h')
|
||||
|
||||
Examples:
|
||||
idx stocks flow BBCA
|
||||
idx stocks flow BBCA --days 20
|
||||
idx stocks flow BBCA --from 2026-10-01 --to 2026-10-16
|
||||
idx -o json stocks flow BBCA | jq '.foreign_net'
|
||||
```
|
||||
|
||||
### `idx stocks profile`
|
||||
|
||||
```text
|
||||
|
|
|
|||
|
|
@ -47,6 +47,24 @@ 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
|
||||
|
||||
```bash
|
||||
idx stocks flow BBCA
|
||||
idx stocks flow BBCA --days 20
|
||||
idx stocks flow BBCA --from 2026-10-01 --to 2026-10-16
|
||||
```
|
||||
|
||||
What foreign investors bought and sold, session by session: buy, sell and
|
||||
net volume in shares, the net value at each session's average price (an
|
||||
estimate), and the share of value traded outside the regular board. The
|
||||
footer gives the net over the range and foreign investors' share of trading.
|
||||
Without dates it shows the latest 10 sessions (`--days`, at most 60).
|
||||
|
||||
The data is IDX's own daily trading summary. Each session is one request to
|
||||
idx.co.id, cached afterwards for every stock, and needs
|
||||
[curl-impersonate](/start/install/) to pass the site's bot protection.
|
||||
|
||||
## Bandarmology
|
||||
|
||||
```bash
|
||||
|
|
@ -108,7 +126,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, and Indo Premier (IPOT) serves broker summaries whichever
|
||||
provider is selected. Switch with `IDX_PROVIDER=msn|yahoo` and
|
||||
price history. Indo Premier (IPOT) serves broker summaries and IDX's own site
|
||||
serves foreign flow, whichever provider is selected. Switch with `IDX_PROVIDER=msn|yahoo` and
|
||||
`IDX_HISTORY_PROVIDER=auto|yahoo|msn`, or the matching
|
||||
[config keys](/start/config/).
|
||||
|
|
|
|||
|
|
@ -63,6 +63,17 @@ Company data for one IDX ticker: profile, financial statements, earnings, analys
|
|||
| `sections` | array of `profile` / `financials` / `earnings` / `sentiment` / `insights` / `news` | no | Sections to fetch (default: all). |
|
||||
| `symbol` | string | yes | IDX ticker, e.g. "BBCA". |
|
||||
|
||||
## `get_foreign_flow`
|
||||
|
||||
Foreign investors' buying and selling of one IDX ticker, session by session (oldest first), from IDX's daily trading summary: foreign buy, sell and net volume in shares, `foreign_net_value` (net shares at the session's average price, an estimate, IDR), `change_bps`, and `non_regular_bps` (share of value traded outside the regular board). Totals cover the whole range; `foreign_share_bps` is foreign investors' share of trading. End of day.
|
||||
|
||||
| Input | Type | Required | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| `days` | integer | no | Latest sessions (default 10, at most 60). Omit when giving from/to. |
|
||||
| `from` | string | no | First session of a range, YYYY-MM-DD (at most 92 days). |
|
||||
| `symbol` | string | yes | IDX ticker, e.g. "BBCA". |
|
||||
| `to` | string | no | Last session of the range, YYYY-MM-DD (default today). |
|
||||
|
||||
## `get_investor_holdings`
|
||||
|
||||
Every IDX holding (above 1%) of one investor, matched by name.
|
||||
|
|
|
|||
|
|
@ -74,12 +74,13 @@ idx version
|
|||
## Helper tools
|
||||
|
||||
Everyday use needs nothing else: stock data with the default MSN provider,
|
||||
price history, `ownership sync` and every local ownership query. A few
|
||||
commands call external tools:
|
||||
price history, broker summaries and bandarmology, `ownership sync` and every
|
||||
local ownership query. A few commands call external tools:
|
||||
|
||||
| Tool | Needed for |
|
||||
| --- | --- |
|
||||
| `curl_chrome*` from [curl-impersonate](https://github.com/lexiforest/curl-impersonate), or `IDX_CURL_IMPERSONATE_BIN` | `ownership discover` and `ownership import --url` (IDX sits behind Cloudflare), and Yahoo fundamentals with `IDX_PROVIDER=yahoo` |
|
||||
| the full curl-impersonate set, with its `curl_safari*` and `curl_firefox*` profiles | `stocks flow`: IDX's Cloudflare rules pass only some browser fingerprints, and idx tries each installed profile |
|
||||
| `mutool` from MuPDF | importing legacy PDF ownership reports |
|
||||
|
||||
## The MCP server
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue