feat: corporate actions from the Stockbit session (stocks actions, stocks calendar)

`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
This commit is contained in:
Rasyidan Akbar F. 2026-11-03 14:35:20 +07:00
commit 43ff4aa433
55 changed files with 2026 additions and 34 deletions

View file

@ -283,6 +283,19 @@ WIB as the fallback.
provider uses Stockbit's daily windows (`5d` to `1y`, trimmed from `1m`,
`3m` or `1y`), Yahoo otherwise. Without one, quotes use the public page and
the order book is `AUTHERROR`.
- Corporate actions (`corporate/`, `api/stockbit/corpaction.rs`):
`/corpaction/{type}` per kind (`dividend`, `stock_dividend`, `bonus`,
`rightissue`, `warrant`, `stocksplit`, `reversesplit`, `rups`, `pubex`,
`ipo`, `tenderoffer`), with `?symbol=` for one stock's history or without
for the market (about a year back and what is announced ahead). Each type
has its own field prefix and the list key is not always the path's, so
entitlements are read by field suffix (`_cumdate`, `_exdate`, ...). One
request per kind, cached 6 hours under `stockbit-corpaction`
(`<kind>:<SYMBOL.JK>` or `<kind>:market`); `stocks actions` /
`get_corporate_actions` sort newest first, `stocks calendar` /
`get_corporate_calendar` filter by `CorporateAction::date` (the cum date
for entitlements) and sort oldest first. Endpoint notes and the wider
design: `docs/STOCKBIT.md`.
### Capability Gating
```
@ -296,6 +309,7 @@ Factory functions:
trading_summary_provider() → Box<dyn TradingSummaryProvider>
intraday_provider() → Box<dyn IntradayProvider>
orderbook_provider() → Box<dyn OrderBookProvider>
corporate_action_provider() → Box<dyn CorporateActionProvider>
```
`ProviderKind::Stockbit` serves quotes (and, with a session, daily history):

View file

@ -44,7 +44,7 @@ All on `https://exodus.stockbit.com`, bearer access token, HTTP 200 on
| `/company-price-feed/market-time/session` | market state | shipped (#74) |
| `/charts/{SYM}/daily?timeframe=1m\|3m\|1y` | daily candles | shipped (#74) |
| `/charts/{SYM}/daily?timeframe=1w` | hourly candles, 5 sessions | P2 |
| `/corpaction/{type}[?symbol=SYM]` | corporate actions and calendar | **P1** |
| `/corpaction/{type}[?symbol=SYM]` | corporate actions and calendar | shipped: `stocks actions`, `stocks calendar` |
| `/insider/company/majorholder` | insider / major-holder movements | **P1** |
| `/insider/shareholding/composition/companies/{SYM}` | holder composition by period | P2 |
| `/marketdetectors/{SYM}` | broker summary, Stockbit's bandar detector | P2 |
@ -95,9 +95,12 @@ Hourly history needs a datetime bar (`Ohlc.date` is a `NaiveDate`) and an
hourly `Interval`, across Yahoo, MSN, output, goldens and the MCP schema; that
is its own change.
## P1: corporate actions
## P1: corporate actions (shipped)
idx has none today (only the `high-dividend` screen and Yahoo's dividend
Shipped as `idx stocks actions`, `idx stocks calendar` (not a top-level
`calendar`: it sits beside `stocks screen`) and the MCP tools
`get_corporate_actions`, `get_corporate_calendar`; the notes below are the
endpoint as recorded. Before, idx had none (only the `high-dividend` screen and Yahoo's dividend
yield). They explain price gaps in history (splits, bonuses, rights) and give
a calendar of cum dates.
@ -151,10 +154,10 @@ lists are not errors. A row whose dates are all placeholders is dropped.
### Surface
- `idx stocks actions SYM [--kind dividend,rights,...] [--since DATE]`: one
stock's history, newest first.
- `idx calendar [--kind ...] [--from DATE] [--to DATE]`: market-wide, default
today to +30 days, sorted by the next relevant date.
- `idx stocks actions SYM [--kind dividend,rights,...]`: one stock's
history, newest first; every kind but `ipo` by default.
- `idx stocks calendar [--kind ...] [--from DATE] [--to DATE]`: market-wide,
default today to +30 days, oldest first by `date`.
- MCP: `get_corporate_actions {symbol, kinds?, since?}`,
`get_corporate_calendar {kinds?, from?, to?}`.
- Later: `stocks history` notes ex-dates of splits, bonuses and rights in the
@ -231,7 +234,8 @@ Yahoo prices, forward 5/20/60-session returns against IHSG).
1. Close #74: the open-state name in trading hours, fixtures for the observed
states (done 2026-11-03).
2. Corporate actions (parsers, `stocks actions`, `calendar`, MCP, goldens).
2. Corporate actions (parsers, `stocks actions`, `stocks calendar`, MCP,
goldens) (done).
3. Shareholder movements, rows first, then `--summary`.
4. Event study for the movement score; P2 by demand.