gloomberb 0.20.3 → 0.20.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (348) hide show
  1. package/README.md +2 -0
  2. package/bin/gloom +9 -0
  3. package/bin/without-bun.cjs +98 -0
  4. package/package.json +3 -1
  5. package/src/account/auth-dialog.tsx +17 -0
  6. package/src/api-client/data.ts +144 -35
  7. package/src/api-client/fx-interventions.ts +64 -0
  8. package/src/api-client/index.ts +1 -0
  9. package/src/api-client/release-summaries.ts +21 -0
  10. package/src/api-client/types/econ.ts +12 -0
  11. package/src/api-client/yield-curves.ts +1 -1
  12. package/src/app/global-shortcuts.ts +4 -1
  13. package/src/app/keybindings/actions.ts +8 -2
  14. package/src/app/keybindings/config.ts +2 -1
  15. package/src/app/keybindings/index.ts +1 -0
  16. package/src/app/keybindings/labels.ts +6 -1
  17. package/src/app/keybindings/resolve.ts +23 -4
  18. package/src/app/keybindings/terminal-keys.ts +35 -0
  19. package/src/app/pane-runtime/index.tsx +2 -2
  20. package/src/app/pane-runtime/ticker-open-runtime.ts +274 -67
  21. package/src/architecture/ui-literals-allowlist.json +1 -1
  22. package/src/capabilities/chart-series.ts +27 -1
  23. package/src/cli/commands/keybindings.ts +5 -5
  24. package/src/cli/commands/market.ts +154 -21
  25. package/src/cli/commands/news-search.ts +60 -10
  26. package/src/cli/commands/overview.ts +16 -1
  27. package/src/cli/commands/plugins.ts +27 -5
  28. package/src/cli/commands/remote.ts +16 -17
  29. package/src/cli/commands/system.ts +20 -4
  30. package/src/cli/commands/ticker.ts +60 -19
  31. package/src/cli/fx-forward.ts +25 -7
  32. package/src/cli/glossary.ts +19 -5
  33. package/src/cli/history-rows.ts +5 -3
  34. package/src/cli/index.ts +8 -8
  35. package/src/cli/known-gaps.ts +27 -1
  36. package/src/cli/listing-arg.ts +11 -1
  37. package/src/cli/name-entries.ts +5 -1
  38. package/src/cli/not-a-ticker.ts +4 -0
  39. package/src/cli/pane-functions/function-help.ts +5 -5
  40. package/src/cli/report-tables.ts +18 -6
  41. package/src/cli/result.ts +15 -7
  42. package/src/cli/types.ts +2 -0
  43. package/src/components/chart/composite/axis-overlays.tsx +22 -0
  44. package/src/components/chart/composite/composite-chart.tsx +54 -13
  45. package/src/components/chart/composite/event-captions.ts +109 -0
  46. package/src/components/chart/composite/event-guides.ts +74 -0
  47. package/src/components/chart/composite/rasterizer.ts +2 -0
  48. package/src/components/chart/composite/text-renderer.ts +2 -0
  49. package/src/components/chart/composite/types.ts +31 -0
  50. package/src/components/command-bar/layout-items/focused-pane.ts +5 -5
  51. package/src/components/command-bar/pane-settings.ts +2 -2
  52. package/src/components/command-bar/routes/root/provider-search.ts +5 -4
  53. package/src/components/command-bar/routes/root/results.ts +6 -2
  54. package/src/components/command-bar/routes/ticker-search/results.ts +51 -0
  55. package/src/components/command-bar/routes/ticker-search/route.ts +3 -2
  56. package/src/components/input-search-bar.tsx +9 -2
  57. package/src/components/layout/detached-pane-shell.tsx +1 -1
  58. package/src/components/layout/floating-pane.tsx +5 -1
  59. package/src/components/layout/pane/footer/index.tsx +21 -14
  60. package/src/components/layout/pane/footer/model.ts +6 -0
  61. package/src/components/layout/pane/header.tsx +2 -0
  62. package/src/components/layout/shell/action-menu-overlay.tsx +10 -5
  63. package/src/components/layout/shell/active-drag.ts +149 -105
  64. package/src/components/layout/shell/drag/drop-zones.ts +162 -0
  65. package/src/components/layout/shell/drag/index.ts +47 -218
  66. package/src/components/layout/shell/drag/live.ts +10 -3
  67. package/src/components/layout/shell/drag/overlays.tsx +182 -5
  68. package/src/components/layout/shell/drag/runtime.ts +29 -6
  69. package/src/components/layout/shell/drag/shared-edges.ts +156 -0
  70. package/src/components/layout/shell/index.tsx +11 -6
  71. package/src/components/layout/shell/menu.ts +11 -2
  72. package/src/components/layout/shell/native/pointer-runtime.ts +25 -0
  73. package/src/components/layout/shell/native/window-state.ts +2 -2
  74. package/src/components/layout/shell/pane/capture.ts +4 -1
  75. package/src/components/layout/shell/pane/layers.tsx +71 -7
  76. package/src/components/layout/shell/terminal-pointer-runtime.ts +18 -9
  77. package/src/components/layout/shell/window-mode/index.ts +8 -10
  78. package/src/components/layout/status-bar.tsx +6 -1
  79. package/src/components/layout/window-edit/mode.ts +39 -7
  80. package/src/components/layout/window-edit/presentation.ts +1 -1
  81. package/src/components/onboarding/first-run-workspace.ts +44 -2
  82. package/src/components/onboarding/onboarding-frame.tsx +11 -2
  83. package/src/components/onboarding/onboarding-keyboard.ts +20 -0
  84. package/src/components/onboarding/onboarding-wizard.tsx +16 -11
  85. package/src/components/onboarding/portfolio-step/positions-panel.tsx +62 -1
  86. package/src/components/onboarding/use-onboarding-progress.ts +12 -4
  87. package/src/components/pane-settings-dialog/desktop.tsx +2 -2
  88. package/src/components/pane-settings-dialog/tui.tsx +2 -2
  89. package/src/components/pane-settings-dialog/value.ts +6 -0
  90. package/src/components/pane-settings-dialog.tsx +3 -3
  91. package/src/components/reader/detail-reader.tsx +4 -0
  92. package/src/components/ui/button.tsx +2 -0
  93. package/src/components/ui/choice-dialog.tsx +1 -0
  94. package/src/components/ui/data-table/index.tsx +4 -3
  95. package/src/components/ui/index.ts +1 -1
  96. package/src/components/ui/list-view.tsx +7 -12
  97. package/src/components/ui/loading.tsx +10 -3
  98. package/src/components/ui/menu.tsx +6 -2
  99. package/src/components/ui/page-stack-view.tsx +3 -0
  100. package/src/components/ui/pane-link-chip.tsx +269 -54
  101. package/src/components/ui/query-bar.tsx +2 -1
  102. package/src/components/ui/quote.ts +14 -1
  103. package/src/components/ui/tabs.tsx +97 -19
  104. package/src/core/state/app/layout-reducer.ts +7 -0
  105. package/src/core/state/app/layout.ts +44 -7
  106. package/src/core/state/app/state.ts +1 -1
  107. package/src/core/state/app/types.ts +22 -2
  108. package/src/data/config/layout.ts +5 -2
  109. package/src/docs/snapshot.json +54 -13
  110. package/src/i18n/es.ts +9 -8
  111. package/src/i18n/ja.ts +9 -8
  112. package/src/i18n/ko.ts +9 -8
  113. package/src/i18n/zh-cn.ts +9 -8
  114. package/src/i18n/zh-tw.ts +9 -8
  115. package/src/layout/pane-manager/floating-actions.ts +17 -0
  116. package/src/layout/pane-manager/floating-stack.ts +187 -0
  117. package/src/layout/pane-manager/floating.ts +4 -2
  118. package/src/layout/pane-manager/gridlock.ts +5 -1
  119. package/src/layout/pane-manager/index.ts +11 -0
  120. package/src/layout/pane-manager/layout-state.ts +10 -3
  121. package/src/market-data/depositary-pair.ts +5 -3
  122. package/src/market-data/futures-board.ts +46 -1
  123. package/src/market-data/futures-contract.ts +12 -3
  124. package/src/market-data/fx-interventions.ts +270 -0
  125. package/src/market-data/market/dated-previous-close.ts +94 -15
  126. package/src/market-data/market/status.ts +17 -1
  127. package/src/news/news-model.ts +44 -2
  128. package/src/plugins/builtin/alerts/cli.ts +4 -4
  129. package/src/plugins/builtin/alerts/format.ts +1 -2
  130. package/src/plugins/builtin/alerts/headless.ts +1 -2
  131. package/src/plugins/builtin/alerts/move-checks.ts +12 -6
  132. package/src/plugins/builtin/alerts/move.ts +30 -9
  133. package/src/plugins/builtin/alerts/pane.tsx +0 -2
  134. package/src/plugins/builtin/alerts/storage.ts +4 -2
  135. package/src/plugins/builtin/alerts/types.ts +12 -0
  136. package/src/plugins/builtin/analytics/risk-client.ts +10 -4
  137. package/src/plugins/builtin/analytics/risk-episodes.ts +5 -4
  138. package/src/plugins/builtin/analytics/risk-headless.ts +4 -2
  139. package/src/plugins/builtin/analytics/risk-sectors.ts +91 -0
  140. package/src/plugins/builtin/awards/index.tsx +1 -1
  141. package/src/plugins/builtin/buildout/index.tsx +1 -0
  142. package/src/plugins/builtin/catalysts/index.tsx +2 -2
  143. package/src/plugins/builtin/cds/headless.ts +4 -0
  144. package/src/plugins/builtin/changelog/index.tsx +292 -101
  145. package/src/plugins/builtin/changelog/versions.ts +293 -0
  146. package/src/plugins/builtin/chart-composer/headless.ts +2 -1
  147. package/src/plugins/builtin/chart-composer/index.tsx +1 -0
  148. package/src/plugins/builtin/chart-composer/intervention-events.ts +105 -0
  149. package/src/plugins/builtin/chart-composer/pane.tsx +21 -7
  150. package/src/plugins/builtin/chat/content/composer.tsx +5 -4
  151. package/src/plugins/builtin/chat/content/index.tsx +12 -2
  152. package/src/plugins/builtin/chat/content/layout-metrics.ts +3 -3
  153. package/src/plugins/builtin/chat/content/open-targets.ts +3 -3
  154. package/src/plugins/builtin/chat/layout.ts +5 -2
  155. package/src/plugins/builtin/chat/message/pane-chip.tsx +61 -40
  156. package/src/plugins/builtin/chat/message/render-state.ts +2 -5
  157. package/src/plugins/builtin/chat/message/terminal.tsx +13 -15
  158. package/src/plugins/builtin/chat/pane-links/previews.ts +51 -5
  159. package/src/plugins/builtin/chat/pane-links/share-card.ts +36 -0
  160. package/src/plugins/builtin/cloud/askg/attached-pane.tsx +10 -5
  161. package/src/plugins/builtin/cloud/askg/controller.ts +141 -5
  162. package/src/plugins/builtin/cloud/askg/executor.ts +113 -4
  163. package/src/plugins/builtin/cloud/askg/manifest.ts +28 -13
  164. package/src/plugins/builtin/cloud/askg/model.ts +14 -4
  165. package/src/plugins/builtin/cloud/askg/pane.tsx +70 -46
  166. package/src/plugins/builtin/cloud/askg/tool-display.ts +1 -0
  167. package/src/plugins/builtin/cloud/askg/turn-parts.tsx +70 -0
  168. package/src/plugins/builtin/cloud/terminal-relay/engine.ts +50 -130
  169. package/src/plugins/builtin/cloud/terminal-relay/policy.ts +327 -7
  170. package/src/plugins/builtin/cloud/terminal-relay/prompts.tsx +2 -1
  171. package/src/plugins/builtin/cloud/terminal-relay/redact.ts +52 -9
  172. package/src/plugins/builtin/commodities-energy/index.tsx +1 -3
  173. package/src/plugins/builtin/commodities-energy/view-state.ts +3 -0
  174. package/src/plugins/builtin/commodity-balances/index.tsx +1 -0
  175. package/src/plugins/builtin/company-attention/index.tsx +1 -1
  176. package/src/plugins/builtin/company-kpis/headless.ts +3 -1
  177. package/src/plugins/builtin/company-kpis/index.tsx +2 -2
  178. package/src/plugins/builtin/cot/headless.ts +14 -2
  179. package/src/plugins/builtin/cot/index.tsx +1 -1
  180. package/src/plugins/builtin/cpi/index.tsx +1 -1
  181. package/src/plugins/builtin/crypto-board/index.tsx +1 -0
  182. package/src/plugins/builtin/dividend-yield/index.tsx +1 -0
  183. package/src/plugins/builtin/doe/index.tsx +1 -1
  184. package/src/plugins/builtin/earnings/index.tsx +2 -2
  185. package/src/plugins/builtin/earnings-calls/headless.ts +5 -1
  186. package/src/plugins/builtin/earnings-calls/index.tsx +1 -0
  187. package/src/plugins/builtin/econ/calendar-model.ts +74 -1
  188. package/src/plugins/builtin/econ/fred-catalog.ts +3 -1
  189. package/src/plugins/builtin/econ/index.tsx +1 -0
  190. package/src/plugins/builtin/econ-statistics/index.tsx +1 -0
  191. package/src/plugins/builtin/econ-statistics/pane.tsx +6 -0
  192. package/src/plugins/builtin/estimate-revisions/index.tsx +1 -0
  193. package/src/plugins/builtin/executives/index.tsx +1 -0
  194. package/src/plugins/builtin/filing-events/index.tsx +1 -0
  195. package/src/plugins/builtin/fixed-income/index.tsx +1 -0
  196. package/src/plugins/builtin/futures/index.tsx +25 -4
  197. package/src/plugins/builtin/futures/model.ts +28 -32
  198. package/src/plugins/builtin/futures/series.ts +4 -3
  199. package/src/plugins/builtin/futures/table.tsx +16 -9
  200. package/src/plugins/builtin/futures/use-board-terms.ts +3 -3
  201. package/src/plugins/builtin/futures-curve/headless.ts +3 -3
  202. package/src/plugins/builtin/futures-curve/index.tsx +1 -1
  203. package/src/plugins/builtin/futures-curve/model.ts +18 -0
  204. package/src/plugins/builtin/gpu/index.tsx +1 -1
  205. package/src/plugins/builtin/help/functions-table.tsx +1 -1
  206. package/src/plugins/builtin/help/index.tsx +14 -4
  207. package/src/plugins/builtin/help/keybindings-editor.tsx +19 -5
  208. package/src/plugins/builtin/holders/index.tsx +1 -0
  209. package/src/plugins/builtin/holders/report-header.ts +2 -2
  210. package/src/plugins/builtin/insider/index.tsx +1 -0
  211. package/src/plugins/builtin/iv-history/index.tsx +1 -1
  212. package/src/plugins/builtin/jobs/index.tsx +1 -0
  213. package/src/plugins/builtin/layout-manager/index.tsx +8 -8
  214. package/src/plugins/builtin/macro-day/headless.ts +27 -8
  215. package/src/plugins/builtin/macro-day/index.tsx +1 -1
  216. package/src/plugins/builtin/macro-day/model.ts +19 -3
  217. package/src/plugins/builtin/macro-day/pane.tsx +14 -9
  218. package/src/plugins/builtin/macro-day/releases.ts +25 -7
  219. package/src/plugins/builtin/market-valuation/index.tsx +1 -0
  220. package/src/plugins/builtin/market-valuation/pane.tsx +8 -0
  221. package/src/plugins/builtin/members/index.tsx +1 -1
  222. package/src/plugins/builtin/mna/index.tsx +1 -0
  223. package/src/plugins/builtin/news/headless.ts +2 -2
  224. package/src/plugins/builtin/news/index.tsx +4 -3
  225. package/src/plugins/builtin/news/wire/index.tsx +5 -1
  226. package/src/plugins/builtin/news/wire/news/detail-view.tsx +4 -0
  227. package/src/plugins/builtin/news/wire/news/list-search.ts +5 -2
  228. package/src/plugins/builtin/options/index.tsx +1 -0
  229. package/src/plugins/builtin/options-positioning/index.tsx +1 -0
  230. package/src/plugins/builtin/pe-band/index.tsx +1 -1
  231. package/src/plugins/builtin/perps/markets-section.tsx +5 -2
  232. package/src/plugins/builtin/plugin-marketplace/pane.tsx +11 -11
  233. package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +25 -0
  234. package/src/plugins/builtin/portfolio-list/headless.ts +15 -6
  235. package/src/plugins/builtin/portfolio-list/summary/index.tsx +3 -1
  236. package/src/plugins/builtin/power/index.tsx +1 -1
  237. package/src/plugins/builtin/realized-vol/index.tsx +1 -1
  238. package/src/plugins/builtin/research/event-model.ts +9 -1
  239. package/src/plugins/builtin/research/event-sources.ts +22 -0
  240. package/src/plugins/builtin/research/headless.ts +11 -5
  241. package/src/plugins/builtin/research/index.tsx +4 -0
  242. package/src/plugins/builtin/research-search/index.tsx +1 -0
  243. package/src/plugins/builtin/research-search/pane.tsx +8 -0
  244. package/src/plugins/builtin/revenue-breakdown/index.tsx +1 -0
  245. package/src/plugins/builtin/reverse-dcf/index.tsx +1 -1
  246. package/src/plugins/builtin/risk-factors/index.tsx +1 -0
  247. package/src/plugins/builtin/scanner/headless.ts +52 -13
  248. package/src/plugins/builtin/seasonality/index.tsx +1 -1
  249. package/src/plugins/builtin/sec/index.tsx +1 -0
  250. package/src/plugins/builtin/series-inventory.ts +1 -1
  251. package/src/plugins/builtin/shared/cloud-upgrade.ts +27 -3
  252. package/src/plugins/builtin/shared/scanner-capture.ts +11 -3
  253. package/src/plugins/builtin/shared/series-list-detail.tsx +5 -0
  254. package/src/plugins/builtin/short-interest/index.tsx +1 -0
  255. package/src/plugins/builtin/social-mentions/index.tsx +1 -1
  256. package/src/plugins/builtin/supply-chain/index.tsx +1 -0
  257. package/src/plugins/builtin/thirteenf/data.ts +43 -10
  258. package/src/plugins/builtin/thirteenf/headless.ts +55 -11
  259. package/src/plugins/builtin/thirteenf/model.ts +25 -9
  260. package/src/plugins/builtin/thirteenf/report-notes.ts +27 -6
  261. package/src/plugins/builtin/thirteenf/types.ts +2 -0
  262. package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +1 -1
  263. package/src/plugins/builtin/ticker-detail/financials/model.ts +12 -0
  264. package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +3 -3
  265. package/src/plugins/builtin/ticker-detail/financials/tab.tsx +5 -5
  266. package/src/plugins/builtin/ticker-detail/headless.ts +18 -13
  267. package/src/plugins/builtin/ticker-detail/index.tsx +4 -0
  268. package/src/plugins/builtin/ticker-detail/overview/components.tsx +54 -5
  269. package/src/plugins/builtin/ticker-detail/overview/model.ts +6 -4
  270. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +34 -17
  271. package/src/plugins/builtin/ticker-detail/pane.tsx +7 -2
  272. package/src/plugins/builtin/time-sales/client.ts +9 -11
  273. package/src/plugins/builtin/time-sales/index.tsx +1 -1
  274. package/src/plugins/builtin/treasury-auctions/after.ts +267 -0
  275. package/src/plugins/builtin/treasury-auctions/cache.ts +18 -3
  276. package/src/plugins/builtin/treasury-auctions/client.ts +33 -2
  277. package/src/plugins/builtin/treasury-auctions/headless.ts +109 -19
  278. package/src/plugins/builtin/treasury-auctions/index.tsx +14 -4
  279. package/src/plugins/builtin/treasury-auctions/model.ts +256 -28
  280. package/src/plugins/builtin/treasury-auctions/pane.tsx +139 -28
  281. package/src/plugins/builtin/treasury-auctions/treasury-direct.ts +5 -2
  282. package/src/plugins/builtin/treasury-auctions/types.ts +7 -1
  283. package/src/plugins/builtin/vol-surface/index.tsx +1 -1
  284. package/src/plugins/builtin/world-venue-map/index.ts +1 -0
  285. package/src/plugins/builtin/yield-curve/curves.ts +10 -4
  286. package/src/plugins/builtin/yield-curve/headless.ts +6 -2
  287. package/src/plugins/builtin/yield-curve/index.tsx +3 -3
  288. package/src/plugins/builtin/yield-curve/series.ts +10 -0
  289. package/src/plugins/builtin/yield-curve/world.ts +3 -1
  290. package/src/plugins/installer.ts +45 -0
  291. package/src/portfolio/column-values.ts +2 -1
  292. package/src/public/__snapshots__/public-api.test.ts.snap +4 -0
  293. package/src/public/remote.ts +7 -1
  294. package/src/remote/client.ts +191 -11
  295. package/src/remote/controller-utils.ts +13 -1
  296. package/src/remote/controller.ts +88 -26
  297. package/src/remote/endpoint.ts +24 -0
  298. package/src/remote/form.ts +59 -4
  299. package/src/remote/resources.ts +56 -19
  300. package/src/remote/schema.ts +22 -9
  301. package/src/remote/secrets.ts +12 -0
  302. package/src/remote/semantic-helpers.ts +29 -1
  303. package/src/remote/semantic-tree.tsx +44 -15
  304. package/src/remote/server.ts +2 -1
  305. package/src/remote/surface.tsx +192 -0
  306. package/src/remote/types.ts +5 -0
  307. package/src/renderers/cloudflare/worker.ts +16 -1
  308. package/src/renderers/dom/styles.css +40 -6
  309. package/src/renderers/opentui/host.tsx +6 -0
  310. package/src/renderers/share/layout-view.tsx +1 -1
  311. package/src/series/standalone.ts +2 -2
  312. package/src/shares/api.ts +21 -4
  313. package/src/shares/item.ts +73 -0
  314. package/src/shares/pane-item.ts +205 -0
  315. package/src/shares/pane.ts +4 -0
  316. package/src/shares/payload.ts +9 -5
  317. package/src/sources/gloomberb-cloud/news.ts +37 -12
  318. package/src/state/opening-ticker-panes.ts +47 -0
  319. package/src/test-support/cli-context.ts +2 -0
  320. package/src/test-support/preload.ts +4 -1
  321. package/src/tickers/instrument-kind.ts +23 -3
  322. package/src/tickers/renamed-listings.ts +105 -0
  323. package/src/tickers/search/index.ts +103 -16
  324. package/src/time-series/resolve.ts +2 -2
  325. package/src/types/config.ts +5 -0
  326. package/src/types/context-menu.ts +2 -0
  327. package/src/types/financials.ts +1 -0
  328. package/src/types/plugin-commands.ts +140 -0
  329. package/src/types/plugin-context.ts +125 -0
  330. package/src/types/plugin-contributions.ts +55 -0
  331. package/src/types/plugin-definition.ts +234 -0
  332. package/src/types/plugin-notifications.ts +38 -0
  333. package/src/types/plugin-pane-settings.ts +116 -0
  334. package/src/types/plugin-pane-templates.ts +160 -0
  335. package/src/types/plugin-panes.ts +243 -0
  336. package/src/types/plugin-reports.ts +35 -0
  337. package/src/types/plugin-shared.ts +14 -0
  338. package/src/types/plugin-state.ts +71 -0
  339. package/src/types/plugin.ts +14 -1169
  340. package/src/ui/index.tsx +14 -3
  341. package/src/updater/github-releases.ts +23 -0
  342. package/src/utils/central-banks.ts +86 -1
  343. package/src/utils/cli-output.ts +22 -9
  344. package/src/utils/datetime-format.ts +12 -3
  345. package/src/utils/depositary-receipt.ts +28 -3
  346. package/src/utils/fundamentals.ts +14 -0
  347. package/src/utils/max-drawdown.ts +97 -16
  348. package/src/utils/untrusted-text.ts +29 -0
@@ -42,7 +42,8 @@ import { stripStrayEdges } from "./symbol-args";
42
42
  import { isNoProviderMessage, isNoSourceAnswer, isProviderBusy } from "../sources/provider-errors";
43
43
  import { dashedCoinPair, exchangeLineCoinListing, isSpotCommodityOrCurrencyPair, MAJOR_COIN_NAMES, TOP_COIN_NAMES } from "../utils/crypto-pair";
44
44
  import { boardCoinFor, primeBoardCoins } from "./board-coins";
45
- import { knownGapMessage } from "./known-gaps";
45
+ import { knownGapMessage, unquotedGapMessage } from "./known-gaps";
46
+ import { renamedListingFor, renamedListingReadAs, renamedListingSymbol } from "../tickers/renamed-listings";
46
47
  import { currencyPairSpelling } from "../utils/currency-pair";
47
48
  import { bareFuturesCode, futuresContractByCode, futuresContractByWord, listedFuturesSymbol } from "../market-data/futures-board";
48
49
  import { classifyInstrumentType, kindFromListingSyntax } from "../tickers/instrument-kind";
@@ -1288,6 +1289,15 @@ export async function resolveCliListing(
1288
1289
  const { message, details } = fredSeriesNotListing(fred);
1289
1290
  throw new ListingArgError(message, details);
1290
1291
  }
1292
+ // "iron ore" has no live price: it says so and where the monthly one is, never Kumba Iron Ore's stock.
1293
+ const unquoted = exchangeOption?.trim() ? null : unquotedGapMessage(typed);
1294
+ if (unquoted) throw new ListingArgError(unquoted);
1295
+ // A listing that moved to a new symbol (ELET3, "eletrobras") is the one it trades as now, saying so.
1296
+ const renamed = exchangeOption?.trim() ? null : renamedListingFor(typed);
1297
+ if (renamed) {
1298
+ const now = await resolveCliListing(renamedListingSymbol(renamed), null, deps, options);
1299
+ return { ...now, readAs: [renamedListingReadAs(typed, renamed), now.readAs].filter(Boolean).join(" "), readFromName: true };
1300
+ }
1291
1301
  const read = await readTerminalCodeArg(deps.dataProvider, typed);
1292
1302
  // A company's name, an entry of a comma list (`WHR, Whirlpool Corporation`), is the listing search names for it.
1293
1303
  // A name before a legal form ("SAP SE", "SIEMENS AG") is looked up first: SE is also SIX Swiss's market code.
@@ -8,6 +8,7 @@ import { splitSymbolWords } from "./symbol-args";
8
8
  import { isNumberCell } from "./symbol-cells";
9
9
  import { isProviderBusy, type ProviderBusyError } from "../sources/provider-errors";
10
10
  import { unknownBloombergMarket } from "../tickers/terminal-codes";
11
+ import { renamedListingFor } from "../tickers/renamed-listings";
11
12
 
12
13
  /**
13
14
  * The entries of a list (`splitSymbolArgs`, or a file's lines) as the symbols
@@ -110,7 +111,8 @@ export type PhraseReading =
110
111
 
111
112
  /**
112
113
  * One quoted argument with spaces: a company's name when search finds the
113
- * company (`"Whirlpool Corporation"`), else a pasted line of symbols when no
114
+ * company (`"Whirlpool Corporation"`) or it is a renamed company's former
115
+ * name (renamed-listings.ts), else a pasted line of symbols when no
114
116
  * word is one the source says is not a ticker (`"AAPL MSFT"`), else a phrase
115
117
  * (`"10 year yield"`), which is never split into symbols such as YEAR and
116
118
  * YIELD. The words are asked in one batch beside the name search, not a
@@ -125,6 +127,8 @@ export async function readPhraseArgument(
125
127
  dataProvider: Pick<DataProvider, "search" | "getQuotesBatch">,
126
128
  ): Promise<PhraseReading> {
127
129
  if (unknownBloombergMarket(phrase) || await readTerminalCodeArg(dataProvider, phrase)) return { kind: "symbols", symbols: [phrase] };
130
+ // A renamed company's former name ("Centrais Elétricas Brasileiras") is the listing it trades as now.
131
+ if (renamedListingFor(phrase)) return { kind: "name", name: phrase };
128
132
  const words = splitSymbolWords([phrase]);
129
133
  const numbered = words.some(isNumberCell);
130
134
  const asked = words.filter((word) => !word.includes(":") && !isNumberCell(word)).map((word) => word.replace(/^\$/, "").toUpperCase());
@@ -1,5 +1,6 @@
1
1
  import { futuresContractByWord } from "../market-data/futures-board";
2
2
  import { notATickerSymbol } from "../sources/provider-errors";
3
+ import { renamedListingFor, renamedListingHint } from "../tickers/renamed-listings";
3
4
  import { boardCoinFor } from "./board-coins";
4
5
  import { currencyNameHint } from "./currency-name-hint";
5
6
  import { splitSymbolArgs, splitSymbolWords } from "./symbol-args";
@@ -52,6 +53,9 @@ export function withSearchHints(text: string, args: readonly string[], isFredSer
52
53
  const typed = typedSymbol(symbol, args);
53
54
  const id = typed.toUpperCase();
54
55
  if (/^[A-Z0-9]+$/.test(id) && isFredSeries(id)) return `${sentence} Try \`gloom fred ${id}\`.`;
56
+ // A listing that moved to a new symbol (ELET3 is AXIA3) points to it, never to a search for the dead one.
57
+ const renamed = renamedListingFor(typed);
58
+ if (renamed) return `${sentence} ${renamedListingHint(renamed)}`;
55
59
  const coin = boardCoinFor(id);
56
60
  if (coin) return `${sentence} Did you mean ${coin.symbol}${coin.name && coin.name.toUpperCase() !== coin.symbol ? ` (${coin.name})` : ""}?`;
57
61
  const tenor = treasuryYieldTenor(typed);
@@ -408,7 +408,7 @@ export const FUNCTION_HELP: Readonly<Record<string, FunctionHelp>> = {
408
408
  bloomberg: ["CACS"],
409
409
  },
410
410
  EVTS: {
411
- summary: "The market's report days with implied and past moves, or a past or coming week or day of them; a ticker picks its row.",
411
+ summary: "The market board: report days with implied and past moves, or a past or coming week or day of them; a ticker highlights its row.",
412
412
  usage: ["EVTS", "EVTS NVDA", "gloom fn EVTS --week last", "gloom fn EVTS --date 2026-10-15"],
413
413
  keys: [key("t", "icker"), key("e", "stimates"), key("c", "alls"), key("a", "nalysts")],
414
414
  data: EARNINGS_DAYS,
@@ -416,7 +416,7 @@ export const FUNCTION_HELP: Readonly<Record<string, FunctionHelp>> = {
416
416
  docs: "ERN",
417
417
  },
418
418
  ERN: {
419
- summary: "The market's report days with implied and past moves. Alone it is the market board; with tickers, just those names and their report history.",
419
+ summary: "A company's report history with its surprises and moves, or several tickers' next reports. Alone it is the market board EVTS shows.",
420
420
  usage: ["ERN", "ERN NVDA, AAPL, MSFT"],
421
421
  keys: [key("t", "icker"), key("e", "stimates"), key("c", "alls"), key("a", "nalysts")],
422
422
  data: EARNINGS_DAYS,
@@ -1000,8 +1000,8 @@ export const FUNCTION_HELP: Readonly<Record<string, FunctionHelp>> = {
1000
1000
  bloomberg: ["CRD"],
1001
1001
  },
1002
1002
  AUCT: {
1003
- summary: "Bill, note, bond and TIPS auction results: high rate, stop-out versus average, bid-to-cover, indirect, direct and dealer takedown and size, with the auctions announced next. Searchable by benchmark (10Y) or CUSIP; history reaches back 10 years.",
1004
- usage: ["AUCT", "AUCT 10Y", "AUCT 91282CRF0"],
1003
+ summary: "Bill, note, bond and TIPS auction results: high rate (a bill's investment rate, with its discount rate), the stop-out's spread against the published average (the median from Nov 1998), bid-to-cover, indirect, direct and dealer takedown and size, with the auctions announced next. The after view ranks each auction's B/C, indirect and dealer share against its tenor's last 24 and gives the Treasury yield's move 1, 5 and 20 sessions later. Searchable by benchmark (10Y) or CUSIP; history reaches back to 1979 (--history-days all).",
1004
+ usage: ["AUCT", "AUCT 10Y", "AUCT 91282CRF0", "AUCT 7Y --history-days 3650 --view after --sort btc-pctl"],
1005
1005
  keys: [SEARCH, key("f", "ilter"), OPEN],
1006
1006
  data: same("Daily, after each auction"),
1007
1007
  bloomberg: ["AUCT"],
@@ -1351,7 +1351,7 @@ export const FUNCTION_HELP: Readonly<Record<string, FunctionHelp>> = {
1351
1351
  bloomberg: [],
1352
1352
  },
1353
1353
  LMA: {
1354
- summary: "Float, dock, swap, remove and save panes and layouts.",
1354
+ summary: "Float panes or return them to the layout, swap, remove and save panes and layouts.",
1355
1355
  usage: ["LMA", "LMA float"],
1356
1356
  keys: [],
1357
1357
  data: null,
@@ -135,16 +135,28 @@ export function float32Shortest(value: number): number | null {
135
135
  }
136
136
 
137
137
  /**
138
- * A number without binary floating-point noise (47.350000000000364, 0.0615 * 100),
139
- * as the text view drops it: twelve significant digits, whole numbers and
140
- * amounts of a billion or more as they are.
138
+ * A number without binary floating-point noise (47.350000000000364, 0.0615 * 100,
139
+ * a change of -1.8000000000000114), as the text view drops it and every export
140
+ * writes it, JSON included: twelve significant digits, and on figures of ten
141
+ * thousand or more eight decimals (a coin holding to the satoshi) as far as
142
+ * fifteen significant digits, so an amount in the trillions keeps its cents.
143
+ * Sub-penny prices, FX rates and yields keep every digit a source quotes.
144
+ * Whole numbers stay as they are.
141
145
  */
142
146
  export function exportNumber(value: number): number {
143
- if (Number.isInteger(value) || Math.abs(value) >= 1e9) return Object.is(value, -0) ? 0 : value;
144
- const rounded = float32Shortest(value) ?? Number(value.toPrecision(12));
147
+ if (!Number.isFinite(value) || Number.isInteger(value)) return Object.is(value, -0) ? 0 : value;
148
+ const magnitude = Math.floor(Math.log10(Math.abs(value)));
149
+ const rounded = float32Shortest(value) ?? (magnitude < 4
150
+ ? Number(value.toPrecision(12))
151
+ : Number(value.toFixed(Math.max(0, Math.min(8, 14 - magnitude)))));
145
152
  return Object.is(rounded, -0) ? 0 : rounded;
146
153
  }
147
154
 
155
+ /** `JSON.stringify`'s replacer for what the CLI writes as JSON: every number as `exportNumber` writes it. */
156
+ export function exportJsonValue(_key: string, value: unknown): unknown {
157
+ return typeof value === "number" ? exportNumber(value) : value;
158
+ }
159
+
148
160
  function isoInstant(time: number): string {
149
161
  return new Date(time).toISOString().replace(".000Z", "Z");
150
162
  }
@@ -706,7 +718,7 @@ export function renderReportNdjson(report: CliReportTables, freshness?: ReportFr
706
718
  const value = row[index];
707
719
  object[column] = value === undefined || value === "" ? null : value;
708
720
  });
709
- return JSON.stringify(object);
721
+ return JSON.stringify(object, exportJsonValue);
710
722
  });
711
723
  }).join("\n");
712
724
  }
package/src/cli/result.ts CHANGED
@@ -16,7 +16,15 @@ import { serializeCsv } from "../utils/csv";
16
16
  import { formatUtcTime, isEpochMilliseconds, isZonedIsoDateTime } from "../utils/utc-time";
17
17
  import { formatFreshnessLine, withSavedCopy, type ReportFreshness } from "./pane-functions/freshness";
18
18
  import { withSearchHints, type FredSeriesCheck } from "./not-a-ticker";
19
- import { renderReportCsv, renderReportNdjson, splitCsvFooter, withCsvFooter, type CliReportTables } from "./report-tables";
19
+ import {
20
+ exportJsonValue,
21
+ exportNumber,
22
+ renderReportCsv,
23
+ renderReportNdjson,
24
+ splitCsvFooter,
25
+ withCsvFooter,
26
+ type CliReportTables,
27
+ } from "./report-tables";
20
28
  import {
21
29
  EXPORT_DATING_COLUMNS,
22
30
  EXPORT_IDENTITY_COLUMNS,
@@ -383,7 +391,7 @@ function renderCsv<Row extends Record<string, unknown>>(
383
391
  const blanked = resolvedColumns.flatMap((column, index) => isNonFiniteNumber(values[index]) ? [column.header] : []);
384
392
  const datingCells = dating?.(row) ?? [];
385
393
  return [
386
- ...values.map((value) => isNonFiniteNumber(value) ? "" : value),
394
+ ...values.map((value) => isNonFiniteNumber(value) ? "" : typeof value === "number" ? exportNumber(value) : value),
387
395
  ...status ? [exportStatusText(status(row), blanked)] : [],
388
396
  ...identity?.(row) ?? [],
389
397
  ...datingAdded.map((index) => datingCells[index] ?? ""),
@@ -532,7 +540,7 @@ export function serializeCliResult<T, Row extends Record<string, unknown> = Reco
532
540
  ...(cited ? { source: exportSource(cited) } : {}),
533
541
  ...(columns?.length ? { columns } : {}),
534
542
  };
535
- return JSON.stringify(envelope, null, 2);
543
+ return JSON.stringify(envelope, exportJsonValue, 2);
536
544
  }
537
545
  const body = serializeCliRows(rest, options, renderOptions, cited);
538
546
  if (options.format !== "text" || !freshness) return body;
@@ -559,14 +567,14 @@ function serializeCliRows<T, Row extends Record<string, unknown>>(
559
567
  if (options.format === "ndjson") {
560
568
  const statusKey = ndjsonStatusKey(rows, renderOptions.columns as readonly CliResultColumn<never>[] | undefined);
561
569
  return rows.map((row) => {
562
- if (!isPlainObject(row)) return JSON.stringify(row);
570
+ if (!isPlainObject(row)) return JSON.stringify(row, exportJsonValue);
563
571
  const fields = ndjsonRow(row as Row, status, statusKey);
564
- if (!cited) return JSON.stringify(fields);
572
+ if (!cited) return JSON.stringify(fields, exportJsonValue);
565
573
  const identity = rowIdentity(row as Row, renderOptions.exportIdentity);
566
574
  // A dated export's own fields (a row's `released`) keep their values.
567
575
  const dating = renderOptions.exportDated
568
576
  ? Object.fromEntries(Object.entries(exportDatingFields(cited, identity)).filter(([key]) => !(key in fields))) : {};
569
- return JSON.stringify({ ...fields, ...exportIdentityFields(cited, identity), ...dating });
577
+ return JSON.stringify({ ...fields, ...exportIdentityFields(cited, identity), ...dating }, exportJsonValue);
570
578
  }).join("\n");
571
579
  }
572
580
  if (options.format === "csv") {
@@ -674,7 +682,7 @@ function exportNdjsonNotes<T, Row extends Record<string, unknown>>(
674
682
 
675
683
  export function serializeCliError(error: CliErrorObject, options: CliGlobalOptions): string {
676
684
  if (options.format === "json" || options.format === "ndjson") {
677
- return JSON.stringify({ ok: false, error }, null, options.format === "json" ? 2 : 0);
685
+ return JSON.stringify({ ok: false, error }, exportJsonValue, options.format === "json" ? 2 : 0);
678
686
  }
679
687
  return error.details == null ? error.message : `${error.message}\n${String(error.details)}`;
680
688
  }
package/src/cli/types.ts CHANGED
@@ -29,6 +29,8 @@ export type MarketContext = ConfigContext & {
29
29
  statementSources?: StatementReportSources;
30
30
  /** Daily FX closes (`fx --date`, converted INS values); Gloom Cloud unless a test stands in for it. */
31
31
  fxHistory?: FxHistoryClient;
32
+ /** Japan's intervention record for a yen pair's notes; Gloom Cloud unless a test stands in for it. */
33
+ fxInterventions?: () => Promise<import("../api-client/fx-interventions").FxInterventionsPayload | null>;
32
34
  };
33
35
 
34
36
  export type CliServicesContext = {
@@ -1,6 +1,7 @@
1
1
  import { memo } from "react";
2
2
  import { Box, Text, useUiCapabilities } from "../../../ui";
3
3
  import type { CompositeChartXMarker } from "./types";
4
+ import type { EventCaptionPlacement } from "./event-captions";
4
5
 
5
6
  export interface StaticChartXAxisLabel {
6
7
  label: string;
@@ -493,3 +494,24 @@ export function StaticXMarkerLabels({
493
494
  </Box>
494
495
  );
495
496
  }
497
+
498
+ /** Events' captions in the row under the axis, laid out by `layoutEventCaptions`. */
499
+ export function EventCaptions({
500
+ captions,
501
+ width,
502
+ color,
503
+ }: {
504
+ captions: readonly EventCaptionPlacement[];
505
+ width: number;
506
+ color?: string;
507
+ }) {
508
+ return (
509
+ <Box position="relative" width={width} height={1}>
510
+ {captions.map(({ id, left, text }) => (
511
+ <Box key={id} position="absolute" left={left} top={0} width={text.length} height={1} overflow="hidden" zIndex={2}>
512
+ <Text fg={color}>{text}</Text>
513
+ </Box>
514
+ ))}
515
+ </Box>
516
+ );
517
+ }
@@ -48,7 +48,8 @@ import { reuseResolvedSeriesList } from "./panel-series";
48
48
  import { consumeChartMouseEvent, type ChartMouseEvent } from "../core/pointer";
49
49
  import { useChartViewResetListener } from "../core/view-reset";
50
50
  import { useShowChartTextFallback } from "../native/use-chart-text-fallback";
51
- import { StaticXAxisLabels, StaticXMarkerLabels, StaticXMarkerOverlay } from "./axis-overlays";
51
+ import { EventCaptions, StaticXAxisLabels, StaticXMarkerLabels, StaticXMarkerOverlay } from "./axis-overlays";
52
+ import { layoutEventCaptions } from "./event-captions";
52
53
  import { formatCompositeCursorAxisDate } from "./format";
53
54
  import {
54
55
  createCompositeCursorSource,
@@ -64,7 +65,7 @@ import {
64
65
  } from "./interactions";
65
66
  import { NO_VALUE_SCALES, resolveAxisDragSpanFactor } from "./value-scale";
66
67
  import { useCompositeValueScales } from "./use-composite-value-scales";
67
- import { COMPOSITE_RIGHT_OFFSET_RATIO } from "./time-scale";
68
+ import { COMPOSITE_RIGHT_OFFSET_RATIO, projectCompositeTimestamp } from "./time-scale";
68
69
  import {
69
70
  allocateCompositePanelHeights,
70
71
  buildCompositeChartScene,
@@ -77,7 +78,9 @@ import type {
77
78
  CompositeChartColors,
78
79
  CompositeChartProps,
79
80
  CompositeChartScene,
81
+ CompositeChartEvent,
80
82
  CompositeChartXMarker,
83
+ CompositeEventGuide,
81
84
  CompositePanelScene,
82
85
  } from "./types";
83
86
 
@@ -104,6 +107,8 @@ function chartWatermarkScale(plotWidthPx: number, plotHeightPx: number): number
104
107
  }
105
108
 
106
109
  const NO_X_MARKERS: readonly CompositeChartXMarker[] = [];
110
+ const NO_EVENTS: readonly CompositeChartEvent[] = [];
111
+ const NO_PROJECTED_EVENTS: readonly { event: CompositeChartEvent; guide: CompositeEventGuide }[] = [];
107
112
  const subscribeToNothing = () => () => {};
108
113
  const holdsNothing = () => false;
109
114
 
@@ -207,6 +212,8 @@ function ThemedCompositeChart({
207
212
  panelRules = !navigable,
208
213
  formatAxisValue,
209
214
  xAxis,
215
+ events,
216
+ mergeEventCaptions,
210
217
  remoteKind,
211
218
  allowHistoricalBackfill = false,
212
219
  axisWidth = 9,
@@ -336,8 +343,16 @@ function ThemedCompositeChart({
336
343
  // The pane's range control asks for this when its selected range is chosen again.
337
344
  useChartViewResetListener(resetView, interactive);
338
345
  const timeAxisRows = showTimeAxis ? 1 : 0;
339
- const xMarkers = xAxis?.markers ?? NO_X_MARKERS;
340
- const xMarkerRows = xMarkers.some((marker) => marker.label) ? 1 : 0;
346
+ const axisMarkers = xAxis?.markers ?? NO_X_MARKERS;
347
+ // Events in the view; their captions' row is kept whenever the chart has any, so panning never moves the plot.
348
+ const viewStart = effectiveViewport?.start.getTime() ?? null;
349
+ const viewEnd = effectiveViewport?.end.getTime() ?? null;
350
+ const timedEvents = !xAxis && events?.length ? events : NO_EVENTS;
351
+ const eventsInView = useMemo(() => (
352
+ timedEvents.length === 0 || viewStart === null || viewEnd === null ? NO_EVENTS
353
+ : timedEvents.filter((event) => event.time <= viewEnd && (event.endTime ?? event.time) >= viewStart)
354
+ ), [timedEvents, viewEnd, viewStart]);
355
+ const xMarkerRows = axisMarkers.some((marker) => marker.label) || timedEvents.some((event) => event.captions?.length) ? 1 : 0;
341
356
  const panelCount = new Set(panelSeries.map((entry) => entry.panelId)).size;
342
357
  // One legend line, or up to a few when its entries cannot share one and each
343
358
  // panel keeps a readable plot: the legend says how many it needs while no
@@ -493,18 +508,40 @@ function ThemedCompositeChart({
493
508
  1,
494
509
  Math.round(plotWidth * cellWidthPx * Math.max(1, pixelRatio)),
495
510
  );
511
+ // An event is a guide at its time on the scale the bars are drawn on, so it sits on its bar.
512
+ const projectedEvents = useMemo(() => {
513
+ if (eventsInView.length === 0 || !projectedScene) return NO_PROJECTED_EVENTS;
514
+ const projected = eventsInView.flatMap((event) => {
515
+ const ratio = projectCompositeTimestamp(projectedScene.timeScale, event.time)?.ratio;
516
+ const end = event.endTime === undefined ? undefined : projectCompositeTimestamp(projectedScene.timeScale, event.endTime)?.ratio;
517
+ if (ratio == null || event.endTime !== undefined && end == null) return [];
518
+ if (end === undefined ? ratio < 0 || ratio > 1 : end! < 0 || ratio > 1) return [];
519
+ const guide: CompositeEventGuide = { xRatio: ratio, ...(end !== undefined ? { endXRatio: end! } : {}), dotted: event.dotted === true };
520
+ return [{ event, guide }];
521
+ });
522
+ return projected.length > 0 ? projected : NO_PROJECTED_EVENTS;
523
+ }, [eventsInView, projectedScene]);
496
524
  const baseScene = useMemo<CompositeChartScene | null>(() => {
497
525
  if (!projectedScene || !layoutPanels) return null;
526
+ const eventGuides = projectedEvents.length > 0 ? projectedEvents.map(({ guide }) => guide) : null;
498
527
  const laidOut: CompositeChartScene = {
499
528
  ...projectedScene,
500
529
  width: plotWidth,
501
530
  height: layoutPanels.reduce((sum, panel) => sum + panel.height, 0),
502
- panels: layoutPanels,
531
+ panels: eventGuides ? layoutPanels.map((panel) => ({ ...panel, eventGuides })) : layoutPanels,
503
532
  // A panel with the whole plot still leaves the legend every series' value.
504
533
  ...(maximizedPanelId ? { cursorPanels: projectedScene.panels } : {}),
505
534
  };
506
535
  return downsampleCompositeChartScene(laidOut, downsampleWidth);
507
- }, [downsampleWidth, layoutPanels, maximizedPanelId, plotWidth, projectedScene]);
536
+ }, [downsampleWidth, layoutPanels, maximizedPanelId, plotWidth, projectedEvents, projectedScene]);
537
+ // The events' captions, in the row under the axis, each beside its guide.
538
+ const eventCaptions = useMemo(() => {
539
+ if (projectedEvents.length === 0) return [];
540
+ const column = (ratio: number) => Math.round(Math.min(1, Math.max(0, ratio)) * Math.max(0, plotWidth - 1));
541
+ return layoutEventCaptions(projectedEvents.map(({ event, guide }) => ({
542
+ event, from: column(guide.xRatio), to: column(guide.endXRatio ?? guide.xRatio),
543
+ })), plotWidth, mergeEventCaptions);
544
+ }, [mergeEventCaptions, plotWidth, projectedEvents]);
508
545
  // The cursor shown: the chart's own, or else the owner's.
509
546
  const currentCursorTimestamp = useCallback(
510
547
  () => (ownsCursor ? ownCursor.get() : null) ?? ownerCursorTimestamp,
@@ -1207,7 +1244,7 @@ function ThemedCompositeChart({
1207
1244
  <AsciiText text="Gloomberb" font="wordmark" scale={watermarkScale} color={resolvedColors.textDim} />
1208
1245
  </Box>
1209
1246
  ) : null}
1210
- {xMarkers.length > 0 ? (
1247
+ {axisMarkers.length > 0 ? (
1211
1248
  <Box
1212
1249
  position="absolute"
1213
1250
  left={leftPadding}
@@ -1218,7 +1255,7 @@ function ThemedCompositeChart({
1218
1255
  style={isDesktopWeb ? { ...plotInsetStyle, pointerEvents: "none" } : undefined}
1219
1256
  >
1220
1257
  <StaticXMarkerOverlay
1221
- markers={xMarkers}
1258
+ markers={axisMarkers}
1222
1259
  width={plotWidth}
1223
1260
  height={plotHeight}
1224
1261
  fallbackColor={resolvedColors.textDim}
@@ -1255,11 +1292,15 @@ function ThemedCompositeChart({
1255
1292
  {xMarkerRows > 0 ? (
1256
1293
  <Box flexDirection="row" width={totalWidth} height={1} style={isDesktopWeb ? DESKTOP_FULL_ROW : undefined}>
1257
1294
  {leftPadding > 0 ? <Box width={leftPadding} /> : null}
1258
- <StaticXMarkerLabels
1259
- markers={xMarkers}
1260
- width={plotWidth}
1261
- fallbackColor={resolvedColors.textDim}
1262
- />
1295
+ {axisMarkers.length > 0 ? (
1296
+ <StaticXMarkerLabels
1297
+ markers={axisMarkers}
1298
+ width={plotWidth}
1299
+ fallbackColor={resolvedColors.textDim}
1300
+ />
1301
+ ) : (
1302
+ <EventCaptions captions={eventCaptions} width={plotWidth} color={resolvedColors.textDim} />
1303
+ )}
1263
1304
  {rightPadding > 0 ? <Box width={rightPadding} /> : null}
1264
1305
  </Box>
1265
1306
  ) : null}
@@ -0,0 +1,109 @@
1
+ import type { CompositeChartEvent } from "./types";
2
+
3
+ /** A caption never sits further than this many cells from its guide. */
4
+ const NEAR_CELLS = 2;
5
+
6
+ /** An event in view, with the plot columns its guide (or its period) covers. */
7
+ export interface EventCaptionAnchor {
8
+ event: CompositeChartEvent;
9
+ from: number;
10
+ to: number;
11
+ }
12
+
13
+ /** A caption laid out in the row under the axis. */
14
+ export interface EventCaptionPlacement {
15
+ id: string;
16
+ left: number;
17
+ text: string;
18
+ }
19
+
20
+ interface Group {
21
+ events: CompositeChartEvent[];
22
+ from: number;
23
+ to: number;
24
+ captions: readonly string[];
25
+ /** The caption shown: an index into `captions`, longest first. */
26
+ level: number;
27
+ }
28
+
29
+ interface Placed {
30
+ group: Group;
31
+ left: number;
32
+ }
33
+
34
+ /**
35
+ * Where a caption goes: centred on its guide, inside the plot, ending at
36
+ * `limit` at the latest, and never more than two cells from its guide; null
37
+ * when it cannot.
38
+ */
39
+ function captionLeft(group: Group, text: string, width: number, limit: number): number | null {
40
+ const length = text.length;
41
+ if (length === 0 || length > width) return null;
42
+ const centred = Math.round((group.from + group.to) / 2 - (length - 1) / 2);
43
+ const left = Math.min(Math.max(0, Math.min(width - length, centred)), limit - length + 1);
44
+ if (left < 0) return null;
45
+ const right = left + length - 1;
46
+ const gap = group.to < left ? left - group.to : group.from > right ? group.from - right : 0;
47
+ return gap <= NEAR_CELLS ? left : null;
48
+ }
49
+
50
+ /** The longest caption of `group` from its level on that fits before `limit`. */
51
+ function fit(group: Group, width: number, limit: number): Placed | null {
52
+ for (let level = group.level; level < group.captions.length; level += 1) {
53
+ const left = captionLeft(group, group.captions[level]!, width, limit);
54
+ if (left !== null) return { group: { ...group, level }, left };
55
+ }
56
+ return null;
57
+ }
58
+
59
+ /**
60
+ * The events' captions in one row, newest first so the latest keeps the most
61
+ * room. Each is the longest of its captions that fits beside its guide; when
62
+ * two collide, the older one takes a shorter caption, then the newer one
63
+ * does, then the two share one caption (`merge`), and without one, or with
64
+ * no room even for that, the older is left out. A caption is never moved away
65
+ * from its guide to find room.
66
+ */
67
+ export function layoutEventCaptions(
68
+ anchors: readonly EventCaptionAnchor[],
69
+ width: number,
70
+ merge?: (events: readonly CompositeChartEvent[]) => readonly string[],
71
+ ): EventCaptionPlacement[] {
72
+ const groups = anchors
73
+ .filter((anchor) => anchor.event.captions?.length)
74
+ .map((anchor): Group => ({ events: [anchor.event], from: anchor.from, to: anchor.to, captions: anchor.event.captions!, level: 0 }))
75
+ .sort((left, right) => left.from - right.from || left.to - right.to);
76
+ const placed: Placed[] = [];
77
+ // The last column free for a caption left of those placed, a blank cell between two.
78
+ const limit = () => (placed.length > 0 ? placed.at(-1)!.left - 2 : width - 1);
79
+ for (let index = groups.length - 1; index >= 0; index -= 1) {
80
+ const group = groups[index]!;
81
+ for (;;) {
82
+ const own = fit(group, width, limit());
83
+ if (own) {
84
+ placed.push(own);
85
+ break;
86
+ }
87
+ const right = placed.at(-1);
88
+ if (!right) break;
89
+ if (right.group.level < right.group.captions.length - 1) {
90
+ placed.pop();
91
+ const shorter = fit({ ...right.group, level: right.group.level + 1 }, width, limit());
92
+ placed.push(shorter ?? right);
93
+ if (shorter) continue;
94
+ }
95
+ if (merge) {
96
+ placed.pop();
97
+ const events = [...group.events, ...right.group.events];
98
+ const shared = fit({ events, from: group.from, to: Math.max(group.to, right.group.to), captions: merge(events), level: 0 }, width, limit());
99
+ placed.push(shared ?? right);
100
+ }
101
+ break;
102
+ }
103
+ }
104
+ return placed.reverse().map(({ group, left }) => ({
105
+ id: group.events.map((event) => event.id).join("+"),
106
+ left,
107
+ text: group.captions[group.level]!,
108
+ }));
109
+ }
@@ -0,0 +1,74 @@
1
+ import { fillRect, parseHex } from "../native/raster/primitives";
2
+ import { clamp } from "../../../utils/math";
3
+ import type { CompositeEventGuide } from "./types";
4
+
5
+ const GUIDE_OPACITY = 0.55;
6
+ /** A period's span, as faint as extended hours' shading. */
7
+ const SPAN_OPACITY = 0.08;
8
+ const DOT_PIXELS = 3;
9
+ const GAP_PIXELS = 3;
10
+ /** The text plot's guide, and a dotted one: glyphs no candle, cursor or session break draws. */
11
+ const EVENT_GUIDE_CHAR = "╎";
12
+ const DOTTED_EVENT_GUIDE_CHAR = "┆";
13
+
14
+ /** The guide's edges inside the plot: its own x, or a period's first and last. */
15
+ function edges(guide: CompositeEventGuide): number[] {
16
+ const ratios = guide.endXRatio === undefined ? [guide.xRatio] : [guide.xRatio, guide.endXRatio];
17
+ return ratios.filter((ratio) => ratio >= 0 && ratio <= 1);
18
+ }
19
+
20
+ /**
21
+ * Dated events' guides in a panel's bitmap, painted before the marks so a bar
22
+ * on the event's day still reads across its own guide: one pixel wide on the
23
+ * bar's centre, dotted for an event whose day is not known yet. A period is
24
+ * shaded from its first day to its last, a guide at each end.
25
+ */
26
+ export function paintEventGuides(
27
+ data: Uint8Array,
28
+ width: number,
29
+ height: number,
30
+ guides: readonly CompositeEventGuide[],
31
+ color: string,
32
+ ): void {
33
+ const tint = parseHex(color);
34
+ const maxX = Math.max(width - 1, 0);
35
+ for (const guide of guides) {
36
+ if (guide.endXRatio !== undefined) {
37
+ const from = Math.round(clamp(guide.xRatio, 0, 1) * maxX), to = Math.round(clamp(guide.endXRatio, 0, 1) * maxX);
38
+ if (to > from) fillRect(data, width, height, from, 0, to, height - 1, tint, SPAN_OPACITY);
39
+ }
40
+ for (const ratio of edges(guide)) {
41
+ const x = Math.round(ratio * maxX);
42
+ if (!guide.dotted) {
43
+ fillRect(data, width, height, x, 0, x, height - 1, tint, GUIDE_OPACITY);
44
+ continue;
45
+ }
46
+ for (let y = 0; y < height; y += DOT_PIXELS + GAP_PIXELS) {
47
+ fillRect(data, width, height, x, y, x, Math.min(y + DOT_PIXELS - 1, height - 1), tint, GUIDE_OPACITY);
48
+ }
49
+ }
50
+ }
51
+ }
52
+
53
+ const open = (cell: string | undefined) => cell === undefined || cell === " " || cell === "·";
54
+
55
+ /**
56
+ * The text plot's guides, `╎`, or `┆` for an event whose day is not known
57
+ * yet (at each end of its period), in blank and grid cells only, and never
58
+ * in the cell just above or below a mark, so the day's candle keeps its high
59
+ * and low readable.
60
+ */
61
+ export function writeEventGuidesText(rows: string[][], width: number, guides: readonly CompositeEventGuide[]): void {
62
+ const maxX = Math.max(width - 1, 0);
63
+ const writes: { row: number; x: number; char: string }[] = [];
64
+ for (const guide of guides) {
65
+ const char = guide.dotted ? DOTTED_EVENT_GUIDE_CHAR : EVENT_GUIDE_CHAR;
66
+ for (const ratio of edges(guide)) {
67
+ const x = clamp(Math.round(ratio * maxX), 0, maxX);
68
+ rows.forEach((row, index) => {
69
+ if (open(row[x]) && open(rows[index - 1]?.[x]) && open(rows[index + 1]?.[x])) writes.push({ row: index, x, char });
70
+ });
71
+ }
72
+ }
73
+ for (const { row, x, char } of writes) rows[row]![x] = char;
74
+ }
@@ -14,6 +14,7 @@ import {
14
14
  type CompositeColumnGroupCenter,
15
15
  type CompositeColumnLayout,
16
16
  } from "./column-layout";
17
+ import { paintEventGuides } from "./event-guides";
17
18
  import { compositeGridRatios } from "./format";
18
19
  import { projectCompositeValue } from "./scene";
19
20
  import { paintVolumeProfile } from "./volume-profile-paint";
@@ -553,6 +554,7 @@ export function renderCompositePanelBitmap(
553
554
  fillRect(data, width, height, 0, y, width - 1, y + 0.6, grid, 0.42);
554
555
  }
555
556
  if (panel.volumeProfile) paintVolumeProfile(data, width, height, panel.volumeProfile);
557
+ if (panel.eventGuides) paintEventGuides(data, width, height, panel.eventGuides, options.colors.textDim);
556
558
  // Under the bars, which read across it.
557
559
  if (panel.priorClose) {
558
560
  drawDashedLevel(data, width, height, panel.priorClose.yRatio, parseHex(options.colors.textDim),
@@ -1,4 +1,5 @@
1
1
  import { displayWidth, padTo } from "../../../utils/format";
2
+ import { writeEventGuidesText } from "./event-guides";
2
3
  import { compositeAxisTicks, compositeGridRatios, type CompositeAxisValueFormatter } from "./format";
3
4
  import { resolveCompositeObservationWidth } from "./rasterizer";
4
5
  import { buildCompositeColumnLayout, type CompositeColumnLayout } from "./column-layout";
@@ -336,6 +337,7 @@ export function renderCompositePanelText(
336
337
 
337
338
  if (panel.volumeProfile) writeVolumeProfileText(rows, plotWidth, panel.volumeProfile);
338
339
  if (panel.extendedHours) writeSessionBreaksText(rows, plotWidth, panel.extendedHours);
340
+ if (panel.eventGuides) writeEventGuidesText(rows, plotWidth, panel.eventGuides);
339
341
 
340
342
  // Blank cells only, so the dashed level reads as if it ran under the marks.
341
343
  if (panel.lastPrice) {