$npx -y skills add kansoku-trade/kansoku --skill chartRender financial charts via the local chart web app (workspace at the repo root — Hono server + React front end, port 5199). Four chart types: intraday capital-flow line (flow) and cross-symbol signed-bar comparison (cohort) — both Recharts — plus SEPA strategy dashboard (`se
| 1 | # chart |
| 2 | |
| 3 | Creates charts through the local chart app so the user can browse them in one |
| 4 | place instead of squinting at tables. The server pulls market data and computes |
| 5 | everything; charts are stored as versioned data JSON and always rendered by the |
| 6 | latest front-end code. |
| 7 | |
| 8 | > **Response language**: match the user — 简体 / 繁體 / English. |
| 9 | |
| 10 | ## When to call |
| 11 | |
| 12 | - After running `longbridge capital --flow` context or when the user wants a flow visual ⇒ `flow` |
| 13 | - For K-line review (multi-timeframe candles + MACD + auto signals) ⇒ `intraday` |
| 14 | - After collecting cumulative net inflow across a cohort of symbols ⇒ `cohort` |
| 15 | - After running `sepa-strategy` on a single name ⇒ `sepa` |
| 16 | - When inside `intraday-signal` ⇒ `intraday` (two-call pattern: POST preview → PATCH prediction) |
| 17 | - When inside `capital-rotation` / `market-session-tracker` / `stock-deep-dive`, |
| 18 | call this as the LAST step and append the chart URL to the markdown journal entry. |
| 19 | |
| 20 | Skip when the user only wants a single number or a tiny series — a Unicode |
| 21 | sparkline in the chat reply is faster. |
| 22 | |
| 23 | ## Server lifecycle |
| 24 | |
| 25 | The app must be running before any API call: |
| 26 | |
| 27 | ```bash |
| 28 | curl -s http://localhost:5199/api/health # {"ok":true,...} = up |
| 29 | ``` |
| 30 | |
| 31 | If it is down, start it (long-running process — use run_in_background): |
| 32 | |
| 33 | ```bash |
| 34 | pnpm start # serves API + built web UI on :5199 |
| 35 | ``` |
| 36 | |
| 37 | First-time setup only: `pnpm install && pnpm build`. |
| 38 | |
| 39 | ## API |
| 40 | |
| 41 | Base URL `http://localhost:5199`. All responses follow the |
| 42 | `{ok, data, meta}` / `{ok:false, error, hint}` contract. |
| 43 | |
| 44 | | Endpoint | Purpose | |
| 45 | | ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | |
| 46 | | `GET /api/health` | liveness check | |
| 47 | | `GET /api/charts?type=&symbol=&limit=` | list chart metas (newest first) | |
| 48 | | `POST /api/charts` | create a chart; body below | |
| 49 | | `GET /api/charts/:id` | full chart doc | |
| 50 | | `GET /api/charts/:id/built?count=` | ephemeral intraday rebuild with a larger bar window (history view; max 1000, never persisted) | |
| 51 | | `PATCH /api/charts/:id` | merge fields into input and rebuild (e.g. add `prediction`) | |
| 52 | | `DELETE /api/charts/:id` | remove a chart | |
| 53 | | `GET /api/legacy` | list old single-file HTML archives (served at `/legacy/<file>`) | |
| 54 | | `GET /api/stream/quotes?extra=` | SSE quote snapshots (watchlist ∪ positions ∪ extra), 10s cadence | |
| 55 | | `GET /api/stream/charts/:id` | SSE live rebuilds for flow/intraday charts, 60s cadence | |
| 56 | | `GET /api/symbols/:sym/{flow,benchmark,position,analyses,latest}` | live per-symbol cockpit data (server-computed, never AI) |