CLI wrapping the Stockbit exodus REST API. Prints raw JSON to stdout.
# Directly from git
cargo install --git https://github.com/gitshrl/stockbit-cli --locked
# Or from a local checkout
git clone https://github.com/gitshrl/stockbit-cli.git
cd stockbit-cli && cargo install --path . --lockedRequires Rust 1.96 (pinned in rust-toolchain.toml).
Stockbit's exodus API uses bearer tokens. Save yours once, then forget about it:
stockbit config set token eyJhbG…This writes ~/.stockbit-cli/config.yaml (file 0600, dir 0700). All subsequent invocations pick it up automatically.
Other sources, resolved in this order (first wins):
| Priority | Source | Example |
|---|---|---|
| 1 | CLI flag | stockbit --token eyJhbG… keystats BBRI |
| 2 | Environment | STOCKBIT_BEARER_TOKEN=eyJhbG… stockbit ... |
| 3 | ~/.stockbit-cli/config.yaml |
(written by config set) |
stockbit config show # print stored config (token shown as <set>/<unset>)
stockbit config path # print path: ~/.stockbit-cli/config.yaml
stockbit config set token <VAL> # save token (or base-url)
stockbit config unset token # remove a keySame precedence rules apply to base-url (CLI flag > stored config > default https://exodus.stockbit.com).
stockbit keystats <SYMBOL> [--year-limit 0|3|10]
stockbit info <SYMBOL>
stockbit profile <SYMBOL>
stockbit emitten <SYMBOL> # info + profile in parallel
stockbit market-detectors <SYMBOL> [--from YYYY-MM-DD] [--to YYYY-MM-DD]
[--limit N] [--transaction-type T]
[--market-board B] [--investor-type I]
stockbit orderbook <SYMBOL>
stockbit broker-distribution <SYMBOL> --date YYYY-MM-DD
stockbit trade-book <SYMBOL> --date YYYY-MM-DD
[--group-by G] [--time-interval 10m]
stockbit shareholders <SYMBOL>
Global flags: --token, --base-url, --pretty/-p, -v/-vv/-vvv.
# Pretty-print BBRI's keystats
stockbit -p keystats BBRI
# Foreign-flow signal for the last 5 days, piped through jq
stockbit market-detectors BBRI --from 2026-05-19 --to 2026-05-23 \
| jq '.data.broker_summary.brokers_buy[] | {code:.netbs_broker_code, val:.bval}'
# Cache today's orderbook + tradebook
stockbit orderbook BBRI > bbri-ob.json
stockbit trade-book BBRI --date 2026-05-26 > bbri-tb.json
# Combined info + profile for several symbols
for s in BBRI BBCA BMRI; do
stockbit emitten "$s" > "data/$s.json"
donecargo fmt --check
cargo clippy --all-targets --all-features -- -D warnings
cargo test # unit + hermetic CLI tests (no network)
cargo test --test stockbit # end-to-end against real Stockbit
# (skipped automatically if no token)The end-to-end tests use wiremock for the unit suite and hit real exodus.stockbit.com for the integration suite (gated on STOCKBIT_BEARER_TOKEN).
keystatsonly acceptsyear_limit ∈ {0, 3, 10}. The CLI snaps other values up to the nearest allowed one.- Dates must be valid
YYYY-MM-DD.2026-02-30or2026-13-01fail locally before any network call. shareholdersreturns 404 for ETFs and suspended issues; the CLI surfaces this as{"data": null, "_note": "..."}rather than an error.- Retries on
5xx,429, network timeouts; never on4xx(apart from the 404 case above). - IDX trading days only: avoid weekends and Indonesian public holidays for date-bounded endpoints.