mirror of
https://github.com/0xrsydn/idx-cli.git
synced 2026-11-07 09:45:36 +00:00
`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
520 lines
14 KiB
TOML
520 lines
14 KiB
TOML
# Golden output cases for tests/golden.rs.
|
|
#
|
|
# Each case runs once per entry in `formats` (default: table and json) with
|
|
# `-o <format>` prepended; `formats = []` runs the args as given, which means
|
|
# the auto format: stdout is a pipe here, so auto resolves to compact JSON.
|
|
# Every run uses the mock provider (IDX_USE_MOCK_PROVIDER=1) and an isolated
|
|
# home directory. `ownership = true` seeds the fixture DB; `before` runs setup
|
|
# commands first; `stdin` is piped to the command.
|
|
#
|
|
# `idx version` is excluded on purpose: its output changes with every release.
|
|
|
|
# --- help and shell completions ---------------------------------------------
|
|
|
|
[[case]]
|
|
name = "help-root"
|
|
args = ["--help"]
|
|
formats = []
|
|
|
|
[[case]]
|
|
name = "help-stocks"
|
|
args = ["stocks", "--help"]
|
|
formats = []
|
|
|
|
[[case]]
|
|
name = "help-ownership"
|
|
args = ["ownership", "--help"]
|
|
formats = []
|
|
|
|
[[case]]
|
|
name = "help-config"
|
|
args = ["config", "--help"]
|
|
formats = []
|
|
|
|
[[case]]
|
|
name = "help-cache"
|
|
args = ["cache", "--help"]
|
|
formats = []
|
|
|
|
[[case]]
|
|
name = "completions-bash"
|
|
args = ["completions", "bash"]
|
|
formats = []
|
|
|
|
# --- config and cache ---------------------------------------------------------
|
|
|
|
[[case]]
|
|
name = "config-path"
|
|
args = ["config", "path"]
|
|
formats = []
|
|
|
|
[[case]]
|
|
name = "config-init"
|
|
args = ["config", "init"]
|
|
formats = []
|
|
|
|
[[case]]
|
|
name = "config-get"
|
|
args = ["config", "get", "general.provider"]
|
|
formats = []
|
|
before = [["config", "init"]]
|
|
|
|
[[case]]
|
|
name = "config-set"
|
|
args = ["config", "set", "general.provider", "yahoo"]
|
|
formats = []
|
|
|
|
[[case]]
|
|
name = "config-set-output-jsonl"
|
|
args = ["config", "set", "general.output", "jsonl"]
|
|
formats = []
|
|
|
|
[[case]]
|
|
name = "config-set-output-invalid"
|
|
args = ["config", "set", "general.output", "yaml"]
|
|
formats = []
|
|
|
|
[[case]]
|
|
name = "config-output-table-pins-format"
|
|
args = ["stocks", "quote", "BBCA"]
|
|
formats = []
|
|
before = [["config", "set", "general.output", "table"]]
|
|
|
|
[[case]]
|
|
name = "cache-info-empty"
|
|
args = ["cache", "info"]
|
|
|
|
[[case]]
|
|
name = "cache-clear"
|
|
args = ["cache", "clear"]
|
|
|
|
# --- stocks: MSN (default provider) --------------------------------------------
|
|
|
|
[[case]]
|
|
name = "stocks-quote"
|
|
args = ["stocks", "quote", "BBCA"]
|
|
|
|
[[case]]
|
|
name = "stocks-quote-multi"
|
|
formats = ["table", "json", "jsonl"]
|
|
args = ["stocks", "quote", "BBCA,BBRI"]
|
|
|
|
[[case]]
|
|
name = "stocks-history"
|
|
formats = ["table", "json", "jsonl"]
|
|
args = ["stocks", "history", "BBCA"]
|
|
|
|
[[case]]
|
|
name = "stocks-history-msn"
|
|
args = ["stocks", "history", "BBCA", "--history-provider", "msn"]
|
|
|
|
[[case]]
|
|
name = "stocks-technical"
|
|
args = ["stocks", "technical", "BBCA"]
|
|
|
|
[[case]]
|
|
name = "stocks-growth"
|
|
args = ["stocks", "growth", "BBCA"]
|
|
|
|
[[case]]
|
|
name = "stocks-valuation"
|
|
args = ["stocks", "valuation", "BBCA"]
|
|
|
|
[[case]]
|
|
name = "stocks-valuation-nonfinite"
|
|
args = ["stocks", "valuation", "BBCA"]
|
|
env = { IDX_MOCK_MSN_KEYRATIOS_FIXTURE = "tests/fixtures/msn_keyratios_infinity.json" }
|
|
|
|
[[case]]
|
|
name = "stocks-risk"
|
|
args = ["stocks", "risk", "BBCA"]
|
|
|
|
[[case]]
|
|
name = "stocks-fundamental"
|
|
formats = ["table", "json", "jsonl"]
|
|
args = ["stocks", "fundamental", "BBCA"]
|
|
|
|
[[case]]
|
|
name = "stocks-compare"
|
|
args = ["stocks", "compare", "BBCA", "BBRI"]
|
|
|
|
[[case]]
|
|
name = "stocks-profile"
|
|
args = ["stocks", "profile", "BBCA"]
|
|
|
|
[[case]]
|
|
name = "stocks-financials"
|
|
args = ["stocks", "financials", "BBCA"]
|
|
|
|
[[case]]
|
|
name = "stocks-financials-income"
|
|
args = ["stocks", "financials", "BBCA", "--statement", "income"]
|
|
|
|
[[case]]
|
|
name = "stocks-earnings"
|
|
args = ["stocks", "earnings", "BBCA"]
|
|
|
|
[[case]]
|
|
name = "stocks-earnings-history-quarterly"
|
|
args = ["stocks", "earnings", "BBCA", "--history", "--quarterly"]
|
|
|
|
[[case]]
|
|
name = "stocks-earnings-forecast-annual"
|
|
args = ["stocks", "earnings", "BBCA", "--forecast", "--annual"]
|
|
|
|
[[case]]
|
|
name = "stocks-sentiment"
|
|
args = ["stocks", "sentiment", "BBCA"]
|
|
|
|
[[case]]
|
|
name = "stocks-insights"
|
|
args = ["stocks", "insights", "BBCA"]
|
|
|
|
[[case]]
|
|
name = "stocks-news"
|
|
args = ["stocks", "news", "BBCA", "--limit", "5"]
|
|
|
|
[[case]]
|
|
name = "stocks-screen"
|
|
args = ["stocks", "screen"]
|
|
|
|
[[case]]
|
|
name = "stocks-screen-worst"
|
|
args = ["stocks", "screen", "--filter", "worst-performers", "--limit", "5"]
|
|
|
|
[[case]]
|
|
name = "stocks-screen-high-volume"
|
|
args = ["stocks", "screen", "--filter", "high-volume"]
|
|
|
|
[[case]]
|
|
name = "stocks-screen-large-cap"
|
|
args = ["stocks", "screen", "--filter", "large-cap"]
|
|
|
|
[[case]]
|
|
name = "auto-format-piped"
|
|
args = ["stocks", "quote", "BBCA,BBRI"]
|
|
formats = []
|
|
|
|
[[case]]
|
|
name = "auto-format-env-table"
|
|
args = ["stocks", "quote", "BBCA"]
|
|
formats = []
|
|
env = { IDX_OUTPUT = "table" }
|
|
|
|
[[case]]
|
|
name = "stocks-quote-stdin"
|
|
args = ["stocks", "quote", "-"]
|
|
stdin = "BBCA\nBBRI\n"
|
|
|
|
[[case]]
|
|
name = "stocks-compare-stdin"
|
|
args = ["stocks", "compare", "-"]
|
|
stdin = "BBCA, BBRI"
|
|
|
|
[[case]]
|
|
name = "error-stdin-empty"
|
|
args = ["stocks", "quote", "-"]
|
|
stdin = ""
|
|
|
|
[[case]]
|
|
name = "error-invalid-output-env"
|
|
args = ["stocks", "quote", "BBCA"]
|
|
formats = []
|
|
env = { IDX_OUTPUT = "yaml" }
|
|
|
|
[[case]]
|
|
name = "stocks-quote-offline-warm"
|
|
args = ["--offline", "stocks", "quote", "BBCA"]
|
|
before = [["stocks", "quote", "BBCA"]]
|
|
|
|
# --- stocks: Yahoo provider -----------------------------------------------------
|
|
|
|
[[case]]
|
|
name = "yahoo-quote"
|
|
args = ["stocks", "quote", "BBCA"]
|
|
env = { IDX_PROVIDER = "yahoo" }
|
|
|
|
[[case]]
|
|
name = "yahoo-history"
|
|
args = ["stocks", "history", "BBCA"]
|
|
env = { IDX_PROVIDER = "yahoo" }
|
|
|
|
[[case]]
|
|
name = "yahoo-fundamental"
|
|
args = ["stocks", "fundamental", "BBCA"]
|
|
env = { IDX_PROVIDER = "yahoo" }
|
|
|
|
# --- stocks: Stockbit (intraday, and the opt-in quote provider) -----------------
|
|
|
|
[[case]]
|
|
name = "stocks-intraday"
|
|
args = ["stocks", "intraday", "BBCA"]
|
|
|
|
[[case]]
|
|
name = "stocks-intraday-index"
|
|
args = ["stocks", "intraday", "^JKSE"]
|
|
formats = ["table"]
|
|
|
|
[[case]]
|
|
name = "stocks-intraday-suspended"
|
|
args = ["stocks", "intraday", "MABA"]
|
|
|
|
[[case]]
|
|
name = "stockbit-quote"
|
|
args = ["--provider", "stockbit", "stocks", "quote", "BBCA,MABA"]
|
|
|
|
# With a session: IDX_STOCKBIT_REFRESH_TOKEN seeds an unsigned test token that
|
|
# expires in 2100; the mock serves the recorded exodus responses.
|
|
|
|
[[case]]
|
|
name = "stockbit-session-orderbook"
|
|
args = ["stocks", "orderbook", "BBCA", "--depth", "3"]
|
|
env = { IDX_STOCKBIT_REFRESH_TOKEN = "eyJhbGciOiJub25lIn0.eyJleHAiOiA0MTAyNDQ0ODAwLCAibm90ZSI6ICJ0ZXN0IHRva2VuLCBzaWduZWQgYnkgbm9ib2R5In0.c2ln" }
|
|
|
|
[[case]]
|
|
name = "stockbit-session-quote"
|
|
args = ["--provider", "stockbit", "stocks", "quote", "BBCA"]
|
|
env = { IDX_STOCKBIT_REFRESH_TOKEN = "eyJhbGciOiJub25lIn0.eyJleHAiOiA0MTAyNDQ0ODAwLCAibm90ZSI6ICJ0ZXN0IHRva2VuLCBzaWduZWQgYnkgbm9ib2R5In0.c2ln" }
|
|
|
|
[[case]]
|
|
name = "stockbit-session-history"
|
|
args = ["--provider", "stockbit", "stocks", "history", "BBCA", "--period", "1mo"]
|
|
env = { IDX_STOCKBIT_REFRESH_TOKEN = "eyJhbGciOiJub25lIn0.eyJleHAiOiA0MTAyNDQ0ODAwLCAibm90ZSI6ICJ0ZXN0IHRva2VuLCBzaWduZWQgYnkgbm9ib2R5In0.c2ln" }
|
|
|
|
[[case]]
|
|
name = "stockbit-status-logged-out"
|
|
args = ["stockbit", "status"]
|
|
|
|
# Corporate actions: BBCA's recorded dividends, splits, meetings and exposes
|
|
# (no fixture for a kind means none, as Stockbit answers); the calendar reads
|
|
# the market-wide recordings of 2026-11-03.
|
|
|
|
[[case]]
|
|
name = "stockbit-actions"
|
|
args = ["stocks", "actions", "BBCA", "--kind", "split,meeting,expose"]
|
|
env = { IDX_STOCKBIT_REFRESH_TOKEN = "eyJhbGciOiJub25lIn0.eyJleHAiOiA0MTAyNDQ0ODAwLCAibm90ZSI6ICJ0ZXN0IHRva2VuLCBzaWduZWQgYnkgbm9ib2R5In0.c2ln" }
|
|
|
|
[[case]]
|
|
name = "stockbit-actions-dividends"
|
|
args = ["stocks", "actions", "BBCA", "--kind", "dividend"]
|
|
env = { IDX_STOCKBIT_REFRESH_TOKEN = "eyJhbGciOiJub25lIn0.eyJleHAiOiA0MTAyNDQ0ODAwLCAibm90ZSI6ICJ0ZXN0IHRva2VuLCBzaWduZWQgYnkgbm9ib2R5In0.c2ln" }
|
|
|
|
[[case]]
|
|
name = "stockbit-calendar"
|
|
args = ["stocks", "calendar", "--to", "2026-11-12", "--kind", "dividend,bonus,rights,warrant,split,ipo,tender"]
|
|
env = { IDX_STOCKBIT_REFRESH_TOKEN = "eyJhbGciOiJub25lIn0.eyJleHAiOiA0MTAyNDQ0ODAwLCAibm90ZSI6ICJ0ZXN0IHRva2VuLCBzaWduZWQgYnkgbm9ib2R5In0.c2ln", IDX_MOCK_TODAY = "2026-11-03" }
|
|
|
|
[[case]]
|
|
name = "stockbit-calendar-meetings"
|
|
args = ["stocks", "calendar", "--from", "2026-11-05", "--to", "2026-11-06", "--kind", "meeting,expose"]
|
|
env = { IDX_STOCKBIT_REFRESH_TOKEN = "eyJhbGciOiJub25lIn0.eyJleHAiOiA0MTAyNDQ0ODAwLCAibm90ZSI6ICJ0ZXN0IHRva2VuLCBzaWduZWQgYnkgbm9ib2R5In0.c2ln", IDX_MOCK_TODAY = "2026-11-03" }
|
|
|
|
# --- stocks: broker summaries (IPOT) and foreign flow (IDX) --------------------
|
|
|
|
[[case]]
|
|
name = "stocks-broker"
|
|
args = ["stocks", "broker", "BBCA", "--date", "2026-10-16"]
|
|
|
|
[[case]]
|
|
name = "stocks-broker-range"
|
|
args = ["stocks", "broker", "BBCA", "--from", "2026-10-12", "--to", "2026-10-16"]
|
|
|
|
[[case]]
|
|
name = "stocks-broker-no-trades"
|
|
args = ["stocks", "broker", "BBCA", "--date", "2026-10-17"]
|
|
|
|
[[case]]
|
|
name = "stocks-bandar"
|
|
args = ["stocks", "bandar", "BBCA", "--date", "2026-10-16"]
|
|
|
|
[[case]]
|
|
name = "stocks-bandar-screen"
|
|
formats = ["table", "json", "jsonl"]
|
|
args = ["stocks", "bandar", "BBCA,BBRI,TLKM", "--date", "2026-10-16", "--top", "3"]
|
|
|
|
[[case]]
|
|
name = "stocks-flow"
|
|
formats = ["table", "json", "jsonl"]
|
|
args = ["stocks", "flow", "BBCA", "--from", "2026-10-12", "--to", "2026-10-16"]
|
|
|
|
[[case]]
|
|
name = "stocks-flow-idx"
|
|
formats = ["table", "json", "jsonl"]
|
|
args = ["stocks", "flow", "BBCA", "--from", "2026-10-12", "--to", "2026-10-16", "--source", "idx"]
|
|
|
|
[[case]]
|
|
name = "stocks-flow-idx-latest"
|
|
args = ["stocks", "flow", "TLKM", "--days", "3", "--source", "idx"]
|
|
env = { IDX_MOCK_TODAY = "2026-10-18" }
|
|
|
|
[[case]]
|
|
name = "error-broker-unknown-symbol"
|
|
args = ["stocks", "broker", "ZZZZ", "--date", "2026-10-16"]
|
|
|
|
# --- errors ---------------------------------------------------------------------
|
|
|
|
[[case]]
|
|
name = "error-usage-missing-symbol"
|
|
args = ["stocks", "quote"]
|
|
|
|
[[case]]
|
|
name = "error-invalid-provider"
|
|
args = ["stocks", "quote", "BBCA"]
|
|
env = { IDX_PROVIDER = "bogus" }
|
|
|
|
[[case]]
|
|
name = "error-yahoo-profile-unsupported"
|
|
args = ["stocks", "profile", "BBCA"]
|
|
env = { IDX_PROVIDER = "yahoo" }
|
|
|
|
[[case]]
|
|
name = "error-industry-only-fundamentals"
|
|
args = ["stocks", "valuation", "BBCA"]
|
|
env = { IDX_MOCK_MSN_KEYRATIOS_FIXTURE = "tests/fixtures/msn_keyratios_industry_only.json" }
|
|
|
|
[[case]]
|
|
name = "error-screen-region"
|
|
formats = ["table", "json", "jsonl"]
|
|
args = ["stocks", "screen", "--region", "eu"]
|
|
|
|
[[case]]
|
|
name = "error-offline-no-cache-flags"
|
|
args = ["--offline", "--no-cache", "stocks", "quote", "BBCA"]
|
|
|
|
[[case]]
|
|
name = "error-offline-cache-miss"
|
|
args = ["--offline", "stocks", "quote", "BBCA"]
|
|
|
|
[[case]]
|
|
name = "error-provider-failure"
|
|
args = ["stocks", "quote", "BBCA"]
|
|
env = { IDX_MOCK_ERROR = "1" }
|
|
|
|
[[case]]
|
|
name = "error-compare-total-failure"
|
|
args = ["stocks", "compare", "BBCA", "BBRI"]
|
|
env = { IDX_MOCK_ERROR = "1" }
|
|
|
|
[[case]]
|
|
name = "error-fetch-bing-unsupported"
|
|
args = ["ownership", "import", "--fetch-bing", "BBCA"]
|
|
|
|
[[case]]
|
|
name = "error-intraday-blocked"
|
|
args = ["stocks", "intraday", "BBCA"]
|
|
env = { IDX_MOCK_STOCKBIT_STATUS = "403" }
|
|
|
|
[[case]]
|
|
name = "error-intraday-unknown-symbol"
|
|
args = ["stocks", "intraday", "ZZZZ"]
|
|
|
|
[[case]]
|
|
name = "error-stockbit-fundamental-unsupported"
|
|
args = ["--provider", "stockbit", "stocks", "fundamental", "BBCA"]
|
|
|
|
[[case]]
|
|
name = "error-orderbook-no-session"
|
|
args = ["stocks", "orderbook", "BBCA"]
|
|
|
|
[[case]]
|
|
name = "error-actions-no-session"
|
|
args = ["stocks", "actions", "BBCA"]
|
|
|
|
[[case]]
|
|
name = "error-calendar-range"
|
|
args = ["stocks", "calendar", "--from", "2026-11-10", "--to", "2026-11-01"]
|
|
env = { IDX_STOCKBIT_REFRESH_TOKEN = "eyJhbGciOiJub25lIn0.eyJleHAiOiA0MTAyNDQ0ODAwLCAibm90ZSI6ICJ0ZXN0IHRva2VuLCBzaWduZWQgYnkgbm9ib2R5In0.c2ln", IDX_MOCK_TODAY = "2026-11-03" }
|
|
|
|
[[case]]
|
|
name = "error-stockbit-history-window"
|
|
args = ["stocks", "history", "BBCA", "--period", "5y", "--history-provider", "stockbit"]
|
|
env = { IDX_STOCKBIT_REFRESH_TOKEN = "eyJhbGciOiJub25lIn0.eyJleHAiOiA0MTAyNDQ0ODAwLCAibm90ZSI6ICJ0ZXN0IHRva2VuLCBzaWduZWQgYnkgbm9ib2R5In0.c2ln" }
|
|
|
|
# --- ownership --------------------------------------------------------------------
|
|
|
|
[[case]]
|
|
name = "ownership-releases-empty"
|
|
args = ["ownership", "releases"]
|
|
|
|
[[case]]
|
|
name = "ownership-ticker-empty"
|
|
args = ["ownership", "ticker", "BBCA"]
|
|
|
|
[[case]]
|
|
name = "ownership-import-xlsx"
|
|
args = ["ownership", "import", "--file", "tests/fixtures/ksei_above1_20260831_excerpt.xlsx"]
|
|
|
|
[[case]]
|
|
name = "ownership-import-archive-txt"
|
|
args = ["ownership", "import", "--file", "tests/fixtures/ksei_balancepos_20260227_excerpt.txt"]
|
|
|
|
[[case]]
|
|
name = "ownership-releases"
|
|
args = ["ownership", "releases"]
|
|
ownership = true
|
|
|
|
[[case]]
|
|
name = "ownership-ticker"
|
|
args = ["ownership", "ticker", "BBCA"]
|
|
ownership = true
|
|
|
|
[[case]]
|
|
name = "ownership-ticker-ksei"
|
|
args = ["ownership", "ticker", "BBCA", "--source", "ksei"]
|
|
ownership = true
|
|
|
|
[[case]]
|
|
name = "ownership-entity"
|
|
args = ["ownership", "entity", "ANTHONI SALIM"]
|
|
ownership = true
|
|
|
|
[[case]]
|
|
name = "ownership-search"
|
|
args = ["ownership", "search", "salim"]
|
|
ownership = true
|
|
|
|
[[case]]
|
|
name = "ownership-cross-holders"
|
|
args = ["ownership", "cross-holders", "--min-tickers", "1"]
|
|
ownership = true
|
|
|
|
[[case]]
|
|
name = "ownership-concentration"
|
|
args = ["ownership", "concentration"]
|
|
ownership = true
|
|
|
|
[[case]]
|
|
name = "ownership-flow"
|
|
args = ["ownership", "flow", "BBCA"]
|
|
ownership = true
|
|
|
|
[[case]]
|
|
name = "ownership-changes"
|
|
formats = ["table", "json", "jsonl"]
|
|
args = ["ownership", "changes", "--from", "2026-01-30", "--to", "2026-02-27"]
|
|
ownership = true
|
|
|
|
[[case]]
|
|
name = "ownership-graph"
|
|
args = ["ownership", "graph", "BBCA"]
|
|
ownership = true
|
|
|
|
[[case]]
|
|
name = "ownership-graph-dot"
|
|
args = ["ownership", "graph", "BBCA", "--format", "dot"]
|
|
ownership = true
|
|
|
|
[[case]]
|
|
name = "ownership-resolve-unresolved"
|
|
args = ["ownership", "resolve", "unresolved"]
|
|
ownership = true
|
|
|
|
[[case]]
|
|
name = "ownership-resolve-map"
|
|
args = ["ownership", "resolve", "map", "SALIM ANTHONI", "ANTHONI SALIM"]
|
|
ownership = true
|
|
|
|
[[case]]
|
|
name = "ownership-resolve-merge"
|
|
args = ["ownership", "resolve", "merge", "1", "2"]
|
|
ownership = true
|