@gloom-sh/terminal 0.20.17 → 0.20.19

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 (453) hide show
  1. package/package.json +3 -1
  2. package/src/account/auth-dialog.tsx +19 -1
  3. package/src/account/billing.ts +2 -1
  4. package/src/account/heard-from-question.tsx +235 -0
  5. package/src/account/heard-from.ts +97 -0
  6. package/src/api-client/cot.ts +5 -6
  7. package/src/api-client/data.ts +14 -3
  8. package/src/api-client/heard-from.ts +72 -0
  9. package/src/api-client/index.ts +64 -6
  10. package/src/api-client/mna.ts +18 -0
  11. package/src/api-client/request.ts +162 -40
  12. package/src/api-client/supply-chain.ts +9 -0
  13. package/src/api-client/types/billing.ts +35 -1
  14. package/src/api-client/types/news.ts +45 -0
  15. package/src/api-client/types/world-venues.ts +9 -0
  16. package/src/app/global-shortcuts.ts +5 -3
  17. package/src/app/pro-welcome/keys.ts +27 -0
  18. package/src/app/pro-welcome/model.ts +158 -0
  19. package/src/app/pro-welcome/row.tsx +176 -0
  20. package/src/app/pro-welcome/use-pro-welcome.ts +156 -0
  21. package/src/app/runtime/external-profile-changes.ts +135 -0
  22. package/src/app.tsx +37 -4
  23. package/src/architecture/core-builtin-allowlist.json +1 -1
  24. package/src/architecture/floating-promise-allowlist.json +1 -2
  25. package/src/architecture/shortcut-labels-allowlist.json +1 -0
  26. package/src/cli/alert-listing.ts +98 -0
  27. package/src/cli/commands/market.ts +191 -39
  28. package/src/cli/commands/overview.ts +7 -1
  29. package/src/cli/commands/plugins.ts +3 -2
  30. package/src/cli/commands/search.ts +30 -6
  31. package/src/cli/commands/ticker.ts +13 -6
  32. package/src/cli/context.ts +24 -5
  33. package/src/cli/csv-export.ts +2 -1
  34. package/src/cli/desktop-pane-shot-browser.ts +3 -1
  35. package/src/cli/desktop-pane-shot-view.ts +0 -1
  36. package/src/cli/desktop-pane-shot.ts +276 -52
  37. package/src/cli/errors.ts +3 -9
  38. package/src/cli/exit-codes.ts +1 -1
  39. package/src/cli/glossary.ts +65 -11
  40. package/src/cli/help.ts +1 -1
  41. package/src/cli/history-demergers.ts +117 -0
  42. package/src/cli/history-rows.ts +8 -4
  43. package/src/cli/index.ts +2 -1
  44. package/src/cli/known-gaps.ts +16 -0
  45. package/src/cli/known-us-stocks.ts +18 -0
  46. package/src/cli/listing-arg.ts +192 -38
  47. package/src/cli/pane-functions/catalog-snapshot-build.ts +83 -0
  48. package/src/cli/pane-functions/catalog-snapshot.json +877 -0
  49. package/src/cli/pane-functions/catalog-snapshot.ts +62 -0
  50. package/src/cli/pane-functions/catalog.ts +50 -16
  51. package/src/cli/pane-functions/data.ts +16 -4
  52. package/src/cli/pane-functions/dom.ts +54 -8
  53. package/src/cli/pane-functions/freshness.ts +39 -4
  54. package/src/cli/pane-functions/function-help.ts +3 -3
  55. package/src/cli/pane-functions/headless.ts +9 -1
  56. package/src/cli/pane-functions/index.ts +175 -50
  57. package/src/cli/pane-functions/report-notices.ts +10 -0
  58. package/src/cli/pane-functions/resolver.ts +11 -7
  59. package/src/cli/pane-functions/screenshot-assessment.ts +38 -10
  60. package/src/cli/pane-functions/screenshot-data-evidence.ts +7 -15
  61. package/src/cli/pane-functions/screenshot-payload.ts +36 -1
  62. package/src/cli/pane-functions/screenshot-render.ts +24 -9
  63. package/src/cli/pane-functions/screenshot-types.ts +9 -0
  64. package/src/cli/quote-answer.ts +33 -17
  65. package/src/cli/registry.ts +22 -2
  66. package/src/cli/result.ts +22 -4
  67. package/src/cli/scroll-truncation.ts +7 -2
  68. package/src/cli/series-search.ts +45 -6
  69. package/src/cli/shot-temp-dir.ts +4 -9
  70. package/src/cli/ticker-resolution.ts +1 -1
  71. package/src/cli/unreachable.ts +21 -0
  72. package/src/components/chart/composite/drawing-store.ts +11 -7
  73. package/src/components/chart/composite/format.ts +1 -0
  74. package/src/components/chart/composite/legend.tsx +48 -20
  75. package/src/components/chart/composite/panel-surface/panel-cursor.tsx +3 -3
  76. package/src/components/chart/composite/panel-surface/plot-gestures.ts +9 -2
  77. package/src/components/chart/composite/panel-surface.tsx +1 -1
  78. package/src/components/chart/composite/price-axis-labels.tsx +7 -5
  79. package/src/components/chart/composite/tools.ts +164 -39
  80. package/src/components/chart-table/header.tsx +11 -2
  81. package/src/components/chart-table/layout.ts +16 -17
  82. package/src/components/command-bar/pane-templates/items.ts +17 -1
  83. package/src/components/command-bar/routes/root/provider-search.ts +10 -1
  84. package/src/components/command-bar/routes/root/results.ts +34 -2
  85. package/src/components/command-bar/routes/root/runtime.ts +19 -4
  86. package/src/components/command-bar/routes/ticker-search/results.ts +5 -0
  87. package/src/components/command-bar/routes/ticker-search/route.ts +5 -0
  88. package/src/components/command-bar/selection-runtime.ts +29 -5
  89. package/src/components/command-bar/surface/index.tsx +4 -1
  90. package/src/components/command-bar/workflow/alert.ts +32 -13
  91. package/src/components/data-table/view.tsx +15 -2
  92. package/src/components/form-modal/content.tsx +9 -4
  93. package/src/components/index.ts +1 -1
  94. package/src/components/layout/header.tsx +9 -5
  95. package/src/components/layout/pane/capture-status.ts +6 -0
  96. package/src/components/layout/pane/footer/index.tsx +2 -0
  97. package/src/components/layout/pane/footer/model.ts +123 -17
  98. package/src/components/layout/pane/header.tsx +16 -2
  99. package/src/components/layout/pane/status-footer.ts +24 -0
  100. package/src/components/market-board/index.tsx +4 -2
  101. package/src/components/onboarding/onboarding-frame.tsx +6 -2
  102. package/src/components/onboarding/onboarding-keyboard.ts +7 -1
  103. package/src/components/onboarding/onboarding-wizard.tsx +3 -1
  104. package/src/components/onboarding/portfolio-step/positions-panel.tsx +24 -15
  105. package/src/components/onboarding/setup-cards.ts +36 -0
  106. package/src/components/onboarding/use-onboarding-progress.ts +22 -1
  107. package/src/components/onboarding/wizard-account.ts +6 -1
  108. package/src/components/onboarding/wizard-model.ts +32 -6
  109. package/src/components/onboarding/wizard-positions.ts +1 -1
  110. package/src/components/price-performance.tsx +26 -8
  111. package/src/components/reader/article-reader.tsx +12 -5
  112. package/src/components/sign-in-gate.tsx +3 -1
  113. package/src/components/toggle-list.tsx +6 -8
  114. package/src/components/ui/confirm-dialog.tsx +47 -7
  115. package/src/components/ui/data-table/opentui/index.tsx +7 -0
  116. package/src/components/ui/data-table/types.ts +8 -0
  117. package/src/components/ui/display.tsx +17 -2
  118. package/src/components/ui/index.ts +1 -1
  119. package/src/components/ui/stat-grid.tsx +4 -0
  120. package/src/components/ui/status.tsx +13 -1
  121. package/src/components/ui/table-layout.ts +34 -2
  122. package/src/components/use-pane-notice-footer.tsx +16 -3
  123. package/src/data/config/store/index.ts +31 -0
  124. package/src/data/config/store/node.ts +61 -11
  125. package/src/data/config/store/normalize.ts +4 -6
  126. package/src/data/config/store/shared-file.ts +309 -0
  127. package/src/data/profile-merge.ts +299 -0
  128. package/src/data/sqlite/checkpointer.ts +11 -1
  129. package/src/data/sqlite/database.ts +1 -1
  130. package/src/data/ticker-repository.ts +134 -10
  131. package/src/data/ticker-store.ts +67 -0
  132. package/src/data/ticker-writes.ts +5 -0
  133. package/src/i18n/es.ts +27 -0
  134. package/src/i18n/ja.ts +27 -0
  135. package/src/i18n/ko.ts +27 -0
  136. package/src/i18n/zh-cn.ts +27 -0
  137. package/src/i18n/zh-tw.ts +27 -0
  138. package/src/layout-marketplace/gallery-desktop.tsx +2 -2
  139. package/src/market-data/ah-pair.ts +122 -0
  140. package/src/market-data/coordinator/entries.ts +6 -4
  141. package/src/market-data/coordinator/index.ts +14 -3
  142. package/src/market-data/depositary-pair.ts +6 -2
  143. package/src/market-data/futures-board.ts +36 -29
  144. package/src/market-data/futures-contract.ts +37 -1
  145. package/src/market-data/hooks.tsx +33 -2
  146. package/src/market-data/market/change-basis.ts +11 -1
  147. package/src/market-data/market/header-market.ts +11 -0
  148. package/src/market-data/market/status.ts +40 -4
  149. package/src/market-data/performance.ts +127 -32
  150. package/src/market-data/quotes/time.ts +5 -2
  151. package/src/market-data/split-terms.ts +28 -0
  152. package/src/news/types.ts +28 -0
  153. package/src/notifications/app-badge.ts +2 -3
  154. package/src/notifications/app-notifier.ts +5 -0
  155. package/src/plugins/builtin/account-management/footer.ts +1 -1
  156. package/src/plugins/builtin/account-management/keyboard.ts +4 -0
  157. package/src/plugins/builtin/account-management/model.ts +1 -0
  158. package/src/plugins/builtin/account-management/pane.tsx +75 -7
  159. package/src/plugins/builtin/account-management/payment-recovery-row.tsx +12 -5
  160. package/src/plugins/builtin/account-management/pro-cancel.tsx +197 -0
  161. package/src/plugins/builtin/account-management/trial-cancel.ts +1 -1
  162. package/src/plugins/builtin/alerts/cli-move.ts +2 -2
  163. package/src/plugins/builtin/alerts/cli.ts +101 -48
  164. package/src/plugins/builtin/alerts/command.ts +39 -9
  165. package/src/plugins/builtin/alerts/constants.ts +10 -0
  166. package/src/plugins/builtin/alerts/earnings-listing.ts +20 -0
  167. package/src/plugins/builtin/alerts/event-rows.ts +9 -3
  168. package/src/plugins/builtin/alerts/events-pane.tsx +16 -10
  169. package/src/plugins/builtin/alerts/format.ts +24 -8
  170. package/src/plugins/builtin/alerts/headless.ts +12 -6
  171. package/src/plugins/builtin/alerts/index.tsx +97 -16
  172. package/src/plugins/builtin/alerts/move-checks.ts +7 -0
  173. package/src/plugins/builtin/alerts/option-contract.ts +197 -0
  174. package/src/plugins/builtin/alerts/pane.tsx +1 -1
  175. package/src/plugins/builtin/alerts/price.ts +30 -5
  176. package/src/plugins/builtin/alerts/pro-rules.ts +62 -0
  177. package/src/plugins/builtin/alerts/quotes.ts +26 -2
  178. package/src/plugins/builtin/alerts/research-builder.ts +5 -10
  179. package/src/plugins/builtin/alerts/scheduled.ts +6 -1
  180. package/src/plugins/builtin/alerts/types.ts +7 -0
  181. package/src/plugins/builtin/analytics/account-returns.ts +1 -1
  182. package/src/plugins/builtin/analytics/manual-value.ts +61 -0
  183. package/src/plugins/builtin/analytics/pane-model.ts +2 -2
  184. package/src/plugins/builtin/analytics/risk-book.ts +7 -7
  185. package/src/plugins/builtin/analytics/risk-client.ts +27 -14
  186. package/src/plugins/builtin/analytics/risk-headless.ts +13 -8
  187. package/src/plugins/builtin/analytics/risk-model.ts +92 -4
  188. package/src/plugins/builtin/analytics/risk-pane.tsx +85 -38
  189. package/src/plugins/builtin/awards/pane.tsx +1 -1
  190. package/src/plugins/builtin/broker-trading/orders.tsx +2 -2
  191. package/src/plugins/builtin/buildout/company/pane.tsx +4 -14
  192. package/src/plugins/builtin/catalysts/model.ts +2 -1
  193. package/src/plugins/builtin/central-bank-rates/model.ts +8 -2
  194. package/src/plugins/builtin/central-bank-rates/pane.tsx +5 -3
  195. package/src/plugins/builtin/chart-composer/chart-spec.ts +5 -0
  196. package/src/plugins/builtin/chart-composer/cli-options.ts +9 -5
  197. package/src/plugins/builtin/chart-composer/data-catalog-pane.tsx +2 -6
  198. package/src/plugins/builtin/chart-composer/headless-schema.ts +14 -10
  199. package/src/plugins/builtin/chart-composer/headless.ts +2 -0
  200. package/src/plugins/builtin/chart-composer/index.tsx +17 -5
  201. package/src/plugins/builtin/chart-composer/pane.tsx +19 -6
  202. package/src/plugins/builtin/chart-composer/viewport-labels.ts +2 -17
  203. package/src/plugins/builtin/chat/controller/notifications.ts +1 -0
  204. package/src/plugins/builtin/chat/index.tsx +0 -1
  205. package/src/plugins/builtin/cloud/auth-actions.tsx +11 -6
  206. package/src/plugins/builtin/cloud/company-picker.tsx +5 -3
  207. package/src/plugins/builtin/cloud/upgrade-command.ts +1 -1
  208. package/src/plugins/builtin/commodities-energy/index.tsx +1 -1
  209. package/src/plugins/builtin/company-kpis/headless.ts +10 -5
  210. package/src/plugins/builtin/company-kpis/latest.ts +45 -0
  211. package/src/plugins/builtin/company-kpis/model.ts +57 -15
  212. package/src/plugins/builtin/company-kpis/pane.tsx +22 -8
  213. package/src/plugins/builtin/composite/alt-data.ts +20 -0
  214. package/src/plugins/builtin/composite/application.ts +14 -0
  215. package/src/plugins/builtin/composite/broker.ts +12 -0
  216. package/src/plugins/builtin/composite/credit.ts +33 -0
  217. package/src/plugins/builtin/composite/crypto.ts +10 -0
  218. package/src/plugins/builtin/composite/earnings.ts +12 -0
  219. package/src/plugins/builtin/composite/filings.ts +13 -0
  220. package/src/plugins/builtin/composite/futures-commodities.ts +23 -0
  221. package/src/plugins/builtin/composite/global-markets.ts +12 -0
  222. package/src/plugins/builtin/composite/options-volatility.ts +23 -0
  223. package/src/plugins/builtin/composite/ownership.ts +23 -0
  224. package/src/plugins/builtin/composite/portfolio.ts +10 -0
  225. package/src/plugins/builtin/composite/quant.ts +15 -0
  226. package/src/plugins/builtin/composite/rates-macro.ts +30 -0
  227. package/src/plugins/builtin/composite/screeners.ts +11 -0
  228. package/src/plugins/builtin/composite/shared.ts +11 -0
  229. package/src/plugins/builtin/composite/ticker-core.ts +36 -0
  230. package/src/plugins/builtin/congress-trades/headless.ts +31 -3
  231. package/src/plugins/builtin/congress-trades/model.ts +9 -5
  232. package/src/plugins/builtin/correlation/index.tsx +13 -17
  233. package/src/plugins/builtin/correlation/matrix/model.ts +18 -0
  234. package/src/plugins/builtin/cot/client.ts +2 -3
  235. package/src/plugins/builtin/cot/headless.ts +16 -16
  236. package/src/plugins/builtin/cot/index.tsx +6 -6
  237. package/src/plugins/builtin/cot/model.ts +25 -5
  238. package/src/plugins/builtin/cot/pane.tsx +11 -6
  239. package/src/plugins/builtin/cot/series.ts +11 -8
  240. package/src/plugins/builtin/cpi/model.ts +15 -4
  241. package/src/plugins/builtin/cpi/pane.tsx +29 -7
  242. package/src/plugins/builtin/dividend-yield/client.ts +57 -16
  243. package/src/plugins/builtin/dividend-yield/headless.ts +17 -11
  244. package/src/plugins/builtin/dividend-yield/model.ts +4 -3
  245. package/src/plugins/builtin/dividend-yield/pane.tsx +22 -18
  246. package/src/plugins/builtin/dividend-yield/ranking.ts +1 -1
  247. package/src/plugins/builtin/dividend-yield/types.ts +4 -0
  248. package/src/plugins/builtin/dividend-yield/view.ts +23 -12
  249. package/src/plugins/builtin/doe/model.ts +30 -0
  250. package/src/plugins/builtin/doe/pane.tsx +8 -2
  251. package/src/plugins/builtin/earnings/board-table.ts +9 -4
  252. package/src/plugins/builtin/earnings/fiscal-quarter.ts +39 -0
  253. package/src/plugins/builtin/earnings/headless.ts +16 -6
  254. package/src/plugins/builtin/earnings/history-model.ts +6 -4
  255. package/src/plugins/builtin/earnings/history-table.ts +7 -4
  256. package/src/plugins/builtin/earnings-calls/calendar.tsx +4 -3
  257. package/src/plugins/builtin/earnings-calls/pane.tsx +8 -2
  258. package/src/plugins/builtin/earnings-ripple/pane.tsx +2 -2
  259. package/src/plugins/builtin/econ/calendar-model.ts +16 -0
  260. package/src/plugins/builtin/econ/index.tsx +7 -2
  261. package/src/plugins/builtin/equity-screener/headless.ts +4 -1
  262. package/src/plugins/builtin/equity-screener/model.ts +7 -6
  263. package/src/plugins/builtin/estimate-revisions/headless.ts +1 -1
  264. package/src/plugins/builtin/exposure/model.ts +10 -0
  265. package/src/plugins/builtin/exposure/pane.tsx +10 -3
  266. package/src/plugins/builtin/futures/model.ts +14 -1
  267. package/src/plugins/builtin/futures/series.ts +1 -8
  268. package/src/plugins/builtin/fx-matrix/amount.ts +15 -1
  269. package/src/plugins/builtin/fx-matrix/headless.ts +12 -6
  270. package/src/plugins/builtin/fx-matrix/index.tsx +25 -7
  271. package/src/plugins/builtin/fx-matrix/settings.ts +9 -4
  272. package/src/plugins/builtin/insider/detail.tsx +36 -7
  273. package/src/plugins/builtin/insider/filing-stories.ts +110 -0
  274. package/src/plugins/builtin/insider/headless.ts +37 -2
  275. package/src/plugins/builtin/insider/index.tsx +79 -10
  276. package/src/plugins/builtin/insider/model.ts +43 -5
  277. package/src/plugins/builtin/ipo-calendar/client.ts +11 -1
  278. package/src/plugins/builtin/ipo-calendar/model.ts +3 -7
  279. package/src/plugins/builtin/jobs/headless.ts +2 -1
  280. package/src/plugins/builtin/jobs/model.ts +6 -0
  281. package/src/plugins/builtin/jobs/pane.tsx +8 -3
  282. package/src/plugins/builtin/kelly-sizer/pane.tsx +9 -4
  283. package/src/plugins/builtin/market-valuation/pane.tsx +22 -10
  284. package/src/plugins/builtin/mna/detail.tsx +67 -6
  285. package/src/plugins/builtin/mna/headless.ts +128 -13
  286. package/src/plugins/builtin/mna/model.ts +219 -16
  287. package/src/plugins/builtin/mna/pane.tsx +34 -6
  288. package/src/plugins/builtin/money-markets/model.ts +14 -5
  289. package/src/plugins/builtin/money-markets/pane.tsx +4 -3
  290. package/src/plugins/builtin/news/wire/news/detail-view.tsx +118 -10
  291. package/src/plugins/builtin/news/wire/news/footer.ts +3 -8
  292. package/src/plugins/builtin/news/wire/news/story-evidence.ts +178 -0
  293. package/src/plugins/builtin/options/analytics.ts +1 -1
  294. package/src/plugins/builtin/options/view.tsx +18 -11
  295. package/src/plugins/builtin/options-positioning/model.ts +11 -0
  296. package/src/plugins/builtin/options-positioning/pane.tsx +22 -1
  297. package/src/plugins/builtin/options-scenario/client.ts +49 -8
  298. package/src/plugins/builtin/options-scenario/csp-screen-pane.tsx +22 -6
  299. package/src/plugins/builtin/options-scenario/csp-screen.ts +39 -12
  300. package/src/plugins/builtin/options-scenario/headless.ts +7 -3
  301. package/src/plugins/builtin/options-scenario/model.ts +33 -2
  302. package/src/plugins/builtin/options-scenario/pane.tsx +3 -4
  303. package/src/plugins/builtin/options-scenario/strategy-screen.ts +7 -5
  304. package/src/plugins/builtin/pe-band/client.ts +13 -1
  305. package/src/plugins/builtin/pe-band/headless.ts +2 -2
  306. package/src/plugins/builtin/pe-band/model.ts +63 -10
  307. package/src/plugins/builtin/pe-band/pane.tsx +5 -5
  308. package/src/plugins/builtin/perps/cascade.ts +4 -3
  309. package/src/plugins/builtin/perps/markets-section.tsx +5 -2
  310. package/src/plugins/builtin/perps/model.ts +4 -3
  311. package/src/plugins/builtin/portfolio-list/allocation-rows.ts +26 -7
  312. package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +66 -13
  313. package/src/plugins/builtin/portfolio-list/cli/render.ts +76 -33
  314. package/src/plugins/builtin/portfolio-list/headless.ts +69 -22
  315. package/src/plugins/builtin/portfolio-list/pane/data.ts +3 -3
  316. package/src/plugins/builtin/portfolio-list/pane/index.tsx +29 -14
  317. package/src/plugins/builtin/portfolio-list/summary/index.tsx +2 -2
  318. package/src/plugins/builtin/portfolio-list/table.tsx +3 -2
  319. package/src/plugins/builtin/relative-rotation/pane.tsx +2 -3
  320. package/src/plugins/builtin/research/corporate-actions-pane.tsx +33 -14
  321. package/src/plugins/builtin/research/event-model.ts +43 -19
  322. package/src/plugins/builtin/research/headless.ts +8 -1
  323. package/src/plugins/builtin/research/relative-valuation-pane.tsx +19 -17
  324. package/src/plugins/builtin/research-search/index.tsx +3 -1
  325. package/src/plugins/builtin/scanner/denied.tsx +16 -4
  326. package/src/plugins/builtin/scanner/flow-pane.tsx +1 -1
  327. package/src/plugins/builtin/scanner/hilo-pane.tsx +1 -1
  328. package/src/plugins/builtin/sec/filing-display.tsx +14 -2
  329. package/src/plugins/builtin/sec/headless.ts +42 -4
  330. package/src/plugins/builtin/sec/index.tsx +21 -1
  331. package/src/plugins/builtin/sectors/index.tsx +6 -9
  332. package/src/plugins/builtin/sectors/sector-model.ts +1 -1
  333. package/src/plugins/builtin/shared/cloud-upgrade.ts +1 -1
  334. package/src/plugins/builtin/shared/earnings-report.ts +49 -5
  335. package/src/plugins/builtin/shared/options-pro-copy.ts +34 -0
  336. package/src/plugins/builtin/shared/report-freshness.ts +2 -3
  337. package/src/plugins/builtin/shared/statement-currency.ts +23 -0
  338. package/src/plugins/builtin/shared/ticker-surface.ts +1 -1
  339. package/src/plugins/builtin/supply-chain/client.ts +34 -9
  340. package/src/plugins/builtin/supply-chain/evidence.ts +3 -2
  341. package/src/plugins/builtin/supply-chain/flow.tsx +4 -3
  342. package/src/plugins/builtin/supply-chain/graph-model.ts +14 -7
  343. package/src/plugins/builtin/supply-chain/graph-pane.tsx +3 -1
  344. package/src/plugins/builtin/supply-chain/graph.tsx +6 -3
  345. package/src/plugins/builtin/supply-chain/headless.ts +19 -4
  346. package/src/plugins/builtin/supply-chain/model.ts +50 -6
  347. package/src/plugins/builtin/supply-chain/pane.tsx +79 -18
  348. package/src/plugins/builtin/themes/headless.ts +4 -4
  349. package/src/plugins/builtin/themes/model.ts +11 -8
  350. package/src/plugins/builtin/themes/pane.tsx +2 -2
  351. package/src/plugins/builtin/ticker-detail/adr-pair/ah.ts +62 -0
  352. package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +119 -20
  353. package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +51 -1
  354. package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +25 -14
  355. package/src/plugins/builtin/ticker-detail/financials/model.ts +22 -32
  356. package/src/plugins/builtin/ticker-detail/financials/tab.tsx +7 -9
  357. package/src/plugins/builtin/ticker-detail/headless-schema.ts +2 -0
  358. package/src/plugins/builtin/ticker-detail/headless.ts +28 -12
  359. package/src/plugins/builtin/ticker-detail/overview/board-lot.ts +21 -0
  360. package/src/plugins/builtin/ticker-detail/overview/model.ts +28 -2
  361. package/src/plugins/builtin/ticker-detail/overview/pane.tsx +8 -0
  362. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +68 -13
  363. package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +9 -2
  364. package/src/plugins/builtin/ticker-detail/quote-monitor/index.tsx +5 -2
  365. package/src/plugins/builtin/volatility/model.ts +17 -0
  366. package/src/plugins/builtin/volatility/pane.tsx +16 -7
  367. package/src/plugins/builtin/world-indices/index.tsx +2 -0
  368. package/src/plugins/builtin/world-indices/table.tsx +15 -0
  369. package/src/plugins/builtin/world-venue-map/evidence.ts +3 -2
  370. package/src/plugins/builtin/world-venue-map/headless.ts +32 -18
  371. package/src/plugins/builtin/world-venue-map/index.ts +19 -6
  372. package/src/plugins/builtin/world-venue-map/layered-pane.tsx +9 -5
  373. package/src/plugins/builtin/world-venue-map/layers.ts +33 -11
  374. package/src/plugins/builtin/world-venue-map/map.tsx +12 -0
  375. package/src/plugins/builtin/world-venue-map/model.ts +6 -1
  376. package/src/plugins/builtin/world-venue-map/pane.tsx +35 -6
  377. package/src/plugins/builtin/world-venue-map/place.ts +119 -0
  378. package/src/plugins/builtin/world-venue-map/venue-header.tsx +5 -3
  379. package/src/plugins/catalog-browser.ts +10 -1
  380. package/src/plugins/catalog-data.ts +20 -0
  381. package/src/plugins/catalog-lazy.ts +51 -0
  382. package/src/plugins/catalog-ui.ts +16 -18
  383. package/src/plugins/host-smoke.ts +5 -2
  384. package/src/portfolio/allocation.ts +79 -19
  385. package/src/portfolio/cash-balances.ts +76 -0
  386. package/src/portfolio/mutations.ts +43 -8
  387. package/src/public/__snapshots__/public-api.test.ts.snap +1 -0
  388. package/src/renderers/browser/activity.ts +16 -0
  389. package/src/renderers/browser/app-badge-host.ts +14 -0
  390. package/src/renderers/browser/main.tsx +5 -0
  391. package/src/renderers/browser/notifications.ts +103 -0
  392. package/src/renderers/browser/ui-host.tsx +4 -0
  393. package/src/renderers/desktop/window-layouts.ts +14 -0
  394. package/src/renderers/dom/data-table/index.tsx +27 -4
  395. package/src/renderers/dom/data-table/row.tsx +2 -0
  396. package/src/renderers/dom/host/tabs.tsx +57 -8
  397. package/src/renderers/dom/styles.css +13 -5
  398. package/src/renderers/electrobun/bun/desktop/backend-requests.ts +4 -0
  399. package/src/renderers/electrobun/bun/desktop/backend.ts +22 -1
  400. package/src/renderers/electrobun/bun/window/native-min-size.ts +6 -1
  401. package/src/renderers/electrobun/shared/protocol.ts +4 -0
  402. package/src/renderers/electrobun/view/cli-pane-shot-frame.tsx +50 -12
  403. package/src/renderers/electrobun/view/http-fetch.ts +3 -2
  404. package/src/renderers/electrobun/view/remote/ticker-repository.ts +10 -0
  405. package/src/series/standalone-catalog.ts +5 -4
  406. package/src/series/standalone.ts +13 -7
  407. package/src/sources/gloomberb-cloud/index.ts +22 -9
  408. package/src/sources/gloomberb-cloud/news.ts +35 -0
  409. package/src/sources/gloomberb-cloud/perpetuals.ts +60 -3
  410. package/src/sources/provider-errors.ts +34 -7
  411. package/src/sources/provider-router/financials.ts +20 -13
  412. package/src/sources/provider-router/history.ts +32 -6
  413. package/src/sources/provider-router/index.ts +4 -0
  414. package/src/sources/provider-router/search.ts +1 -0
  415. package/src/sync/collections-contributor.ts +3 -1
  416. package/src/sync/config-merge.ts +10 -1
  417. package/src/sync/sanitize.ts +26 -2
  418. package/src/tickers/company-name-listing.ts +16 -2
  419. package/src/tickers/listing-fate.ts +12 -8
  420. package/src/tickers/renamed-listings.ts +43 -10
  421. package/src/tickers/search/home-listing.ts +28 -0
  422. package/src/tickers/search/index.ts +19 -7
  423. package/src/tickers/terminal-codes.ts +11 -1
  424. package/src/time-series/base-series.ts +39 -6
  425. package/src/time-series/chart-seed.ts +2 -2
  426. package/src/time-series/history-quality.ts +4 -1
  427. package/src/time-series/hooks.ts +2 -0
  428. package/src/time-series/price-comparison.ts +17 -23
  429. package/src/time-series/reporting.ts +1 -1
  430. package/src/time-series/resolution.ts +13 -0
  431. package/src/time-series/resolve-context.ts +6 -0
  432. package/src/time-series/resolve.ts +42 -3
  433. package/src/time-series/spec.ts +2 -2
  434. package/src/time-series/types.ts +3 -2
  435. package/src/types/data-provider.ts +11 -0
  436. package/src/types/financials.ts +48 -4
  437. package/src/types/headless.ts +1 -0
  438. package/src/types/issuer-listings.ts +2 -0
  439. package/src/types/plugin-notifications.ts +3 -0
  440. package/src/types/price-history.ts +6 -4
  441. package/src/types/ticker.ts +10 -2
  442. package/src/ui/host.tsx +2 -0
  443. package/src/utils/cli-output.ts +1 -1
  444. package/src/utils/declared-dividends.ts +13 -1
  445. package/src/utils/dividend-cash.ts +5 -1
  446. package/src/utils/exchange-announcements.ts +7 -2
  447. package/src/utils/forward-dividend.ts +4 -3
  448. package/src/utils/fundamentals.ts +40 -0
  449. package/src/utils/network-failure.ts +2 -0
  450. package/src/utils/price-history-integrity.ts +9 -1
  451. package/src/utils/remove-folder.ts +37 -0
  452. package/src/utils/trailing-dividend.ts +1 -1
  453. package/src/plugins/builtin/composite-plugins.ts +0 -285
@@ -1,3 +1,4 @@
1
+ import { splitShareTerms } from "../../market-data/split-terms";
1
2
  import { logFailure } from "../../utils/log-failure";
2
3
  import { isTransientFailure } from "../../api-client/errors";
3
4
  import { normalizeTickerSymbol } from "../../tickers/search/ranking";
@@ -14,20 +15,25 @@ import { shortStoryId } from "../../news/story-id";
14
15
  import type {
15
16
  AnalystResearchData,
16
17
  CorporateActionsData,
18
+ DemergerAction,
17
19
  HolderData,
18
20
  OptionsChain,
19
21
  PricePoint,
20
22
  Quote,
23
+ SplitAction,
21
24
  TickerFinancials,
22
25
  } from "../../types/financials";
23
26
  import { currencyPriceMinDigits, formatMarketPrice, formatMarketPriceWithCurrency, nearParCoinPriceDigits, penceFigure, quoteFormatOptions, withCurrencyMinorDigits } from "../../market-data/market/format";
24
27
  import { INDEX_POINTS_EXPORT_UNIT, indexBarVolume, isIndexLevel, reportedQuoteVolume, YIELD_INDEX_EXPORT_UNIT } from "../../market-data/market/index-level";
25
- import { changeBasisJson, changeBasisLabel, changeBasisNote, futuresQuoteFromSettle, printPredatesChangeBasis, quoteChangeBasis, quotePreviousCloseDate, quoteSettleText } from "../../market-data/market/change-basis";
28
+ import { changeBasisJson, changeBasisLabel, changeBasisNote, closeDayLabel, futuresQuoteFromSettle, printPredatesChangeBasis, quoteChangeBasis, quotePreviousCloseDate, quoteSettleText } from "../../market-data/market/change-basis";
29
+ import { asOfClock } from "../../market-data/quotes/time";
26
30
  import {
27
31
  EXTENDED_SESSION_LABELS,
32
+ extendedPrintTime,
28
33
  getExtendedSessionDisplay,
29
34
  getQuoteSessionFields,
30
35
  getRegularSessionDisplay,
36
+ headlineCloseDate,
31
37
  quoteHeadlineTime,
32
38
  quoteSessionLabel,
33
39
  quoteSessionStateLabel,
@@ -78,6 +84,7 @@ import { createBaseConverter } from "../base-converter";
78
84
  import { loadStatementFilings } from "../statement-filings";
79
85
  import { loadBankFigures } from "../bank-section";
80
86
  import { latestFinancialPeriod } from "../../utils/latest-financial-period";
87
+ import { commandWord } from "../../utils/shell-word";
81
88
  import type { FuturesContractTermsPayload } from "../../api-client/futures-curve";
82
89
  import { currencyCodeLabel, currencyUnitLabel, resolveCurrencyUnit } from "../../utils/currency-units";
83
90
  import { fxRateDigits, quotedFxPair } from "../../utils/currency-pair";
@@ -121,11 +128,11 @@ import { apiClient } from "../../api-client";
121
128
  import { CLOUD_QUOTE_DELAY_MINUTES } from "../../api-client/plan-rules";
122
129
  import type { ExchangeAnnouncementsPayload } from "../../api-client/exchange-announcements";
123
130
  import {
124
- exchangeAnnouncementsPage, exchangeAnnouncementsPublisher, isRoutineReturn, listsExchangeAnnouncements, type ExchangeAnnouncementsPage,
131
+ listingAnnouncementsPage, exchangeAnnouncementsPublisher, isRoutineReturn, listsExchangeAnnouncements, type ExchangeAnnouncementsPage,
125
132
  } from "../../utils/exchange-announcements";
126
133
  import { dailyFxLeg, fxCloseOnDate, fxCloseOnOrBefore, loadDailyFxCloses, type FxCloseReading } from "../../market-data/fx-closes";
127
134
  import { zonedDateTimeParts } from "../../utils/zoned-date-time";
128
- import { declaredDividends } from "../../utils/declared-dividends";
135
+ import { declaredDividendCash, declaredDividends } from "../../utils/declared-dividends";
129
136
  import {
130
137
  DEFAULT_LEAPS_CRITERIA, LEAPS_EXTRA_COLUMNS, LEAPS_USAGE, parseLeapsCriteria, runLeapsScreen, takeLeapsOptions,
131
138
  } from "./options-leaps";
@@ -141,6 +148,7 @@ import {
141
148
  import { historyCoverageNotice, WindowBeforeFirstBarError } from "../../sources/history-coverage";
142
149
  import { fetchHistoryResult } from "../../sources/history-result";
143
150
  import { settleWithin } from "../../utils/async-deadline";
151
+ import { demergerRuns, demergerSuccessor, hasPriceBreak, historyDemergerNote, withDemergerFlags } from "../history-demergers";
144
152
  import type { FxInterventionsPayload } from "../../api-client/fx-interventions";
145
153
  import {
146
154
  fxInterventionLatestNote, fxInterventionPair, fxInterventionWindowNote, loadFxInterventions, type FxInterventionPair,
@@ -285,6 +293,7 @@ import {
285
293
  failUnchosenListing,
286
294
  futureByWordLine,
287
295
  loadBareVenues,
296
+ isMovedSymbolFailure,
288
297
  loadForListing,
289
298
  ownedCodeNotes,
290
299
  loadListingQuote,
@@ -331,7 +340,7 @@ import { secRegistrantMismatchMessage, SecRegistrantMismatchError, areDifferentC
331
340
  import { isCryptoPairSymbol, isRoundTheClockCoin } from "../../utils/crypto-pair";
332
341
  import { canonicalExchange, isUsListingExchange } from "../../utils/exchanges";
333
342
  import { listingSuffixVenue } from "../../sources/listing-symbols";
334
- import { resolveTickerInstrumentKind } from "../../tickers/instrument-kind";
343
+ import { classifyInstrumentType, resolveTickerInstrumentKind } from "../../tickers/instrument-kind";
335
344
  import {
336
345
  describeFormerIssuer, describeTickerChange, movedAwayChange, startTickerChangeLookup, tickerChangeLine, type FormerIssuer, type TickerChange,
337
346
  } from "../../tickers/ticker-changes";
@@ -692,9 +701,10 @@ function extendedColumn(session: ExtendedSession) {
692
701
  header: EXTENDED_SESSION_LABELS[session],
693
702
  align: "right" as const,
694
703
  value: (row: QuoteRow) => row.extendedSession === session ? exportFigure(row.rawExtendedPrice) : null,
704
+ // Beside a close, the print says when it was observed (`$161.72 +4.02% 00:10 UTC`), Updated dating the close.
695
705
  format: (_value: unknown, row: QuoteRow) => (
696
706
  row.extendedSession === session && row.extendedPrice
697
- ? [price(row), formatChangePercentCell(row.extendedChangePercent)].join(" ").trim()
707
+ ? [price(row), formatChangePercentCell(row.extendedChangePercent), row.extendedAt ? cliStyles.muted(row.extendedAt) : ""].join(" ").trim()
698
708
  : ""
699
709
  ),
700
710
  };
@@ -949,6 +959,10 @@ function quoteRows(results: QuoteCliRecord[], now = Date.now()) {
949
959
  const per = display.price != null ? futuresPricePer(result.futuresContract, quote?.currency) : "";
950
960
  const previousClose = display.price != null && display.change != null ? display.price - display.change : quote?.previousClose;
951
961
  const last = price(display.price);
962
+ // A completed session's close shown beside a later extended print: two prices, two times.
963
+ const closeDate = extended && !result.futuresContract && !quote?.nominalPrice && !quote?.dailyClose ? headlineCloseDate(quote) : null;
964
+ const printedAt = closeDate ? extendedPrintTime(quote) : null;
965
+ const closeBesidePrint = closeDate && printedAt != null ? { date: closeDate, printedAt } : null;
952
966
  return {
953
967
  symbol: quoteRowSymbol(result),
954
968
  name: quote?.name || result.listing?.name || "",
@@ -981,9 +995,11 @@ function quoteRows(results: QuoteCliRecord[], now = Date.now()) {
981
995
  dayRange: quote?.low != null && quote.high != null
982
996
  ? indexPoints ? `${price(quote.low)}-${price(quote.high)}` : formatPriceRange(quote.low, quote.high, quote.currency, options, "-")
983
997
  : "",
984
- // An index's 0 is volume nobody counts, and its level has no currency.
998
+ // An index's 0 is volume nobody counts.
985
999
  volume: reportedQuoteVolume(quote),
986
- currency: indexPoints ? "" : quote?.currency ?? "",
1000
+ // The currency the service gives, an index's too (^MERV's ARS, ^N225's JPY), whether the row is current or
1001
+ // stale: its level stays in points, and the export's currency_or_unit says so.
1002
+ currency: quote?.currency ?? "",
987
1003
  providerId: quote?.providerId ?? "",
988
1004
  source: quote?.dataSource ?? quote?.providerId ?? "",
989
1005
  feed: quoteFeedState(quote, now),
@@ -1000,6 +1016,9 @@ function quoteRows(results: QuoteCliRecord[], now = Date.now()) {
1000
1016
  ...quote?.nominalPrice ? { nominalLabel: nominalSessionLabel(quote) ?? undefined } : {},
1001
1017
  // A price with no live quote behind it, the close of the latest daily bar, names that session.
1002
1018
  ...quote?.dailyClose ? { nominalLabel: dailyCloseSessionLabel(quote) ?? undefined } : {},
1019
+ // Last as a completed session's close beside an extended print: Updated names the close's day (Tue 17 Nov
1020
+ // close), the print its own time, so neither price reads as the other's. JSON keeps updatedAt as it was.
1021
+ ...closeBesidePrint ? { nominalLabel: closeDayLabel(closeBesidePrint.date, now), extendedAt: asOfClock(Math.min(closeBesidePrint.printedAt, now), now) } : {},
1003
1022
  };
1004
1023
  });
1005
1024
  }
@@ -1107,6 +1126,13 @@ function cleanDecimal(value: number | undefined): string {
1107
1126
  return value == null || !Number.isFinite(value) ? "" : String(Number(value.toFixed(6)));
1108
1127
  }
1109
1128
 
1129
+ /** "commercial vehicles into TMCV:NSE (Tata Motors Limited), 1 share per share, listed 2025-11-12". */
1130
+ function demergerDetail(event: DemergerAction): string {
1131
+ return [`${event.business ? `${event.business} ` : ""}into ${demergerSuccessor(event)}`,
1132
+ event.ratio ? `${cleanDecimal(event.ratio)} share per share` : null,
1133
+ event.successor.listedOn ? `listed ${event.successor.listedOn}` : "not yet listed"].filter(Boolean).join(", ");
1134
+ }
1135
+
1110
1136
  function corporateActionRows(data: CorporateActionsData) {
1111
1137
  const currency = /^[A-Z]{3}$/.test(data.currency ?? "") ? data.currency! : null;
1112
1138
  // EPS is in the reporting currency, which can differ from the listing's dividends (Tencent: CNY vs HKD).
@@ -1147,16 +1173,27 @@ function corporateActionRows(data: CorporateActionsData) {
1147
1173
  detail: currency ? formatDistributionAmount(event.amount, currency) : cleanDecimal(event.amount),
1148
1174
  })),
1149
1175
  // Declared and unpaid, at its ex-date beside the paid rows, never one of them.
1150
- ...declaredDividends(data).map((event) => ({
1151
- type: "dividend",
1152
- date: event.exDate,
1153
- detail: `declared ${event.special ? "special " : ""}${currency ? formatDistributionAmount(event.amount, currency) : cleanDecimal(event.amount)}`
1154
- + (event.payDate ? `, payable ${event.payDate}` : ""),
1155
- })),
1176
+ ...declaredDividends(data).map((event) => {
1177
+ const cash = declaredDividendCash(event, currency);
1178
+ return {
1179
+ type: "dividend",
1180
+ date: event.exDate,
1181
+ detail: `declared ${event.special ? "special " : ""}${currency || event.cashEstimate ? cash.amount : cleanDecimal(event.amount)}${cash.estimate ? `, ${cash.estimate}` : ""}`
1182
+ + (event.payDate ? `, payable ${event.payDate}` : ""),
1183
+ ...(event.cashEstimate ? { cashEstimate: event.cashEstimate } : {}),
1184
+ };
1185
+ }),
1186
+ // In share terms where the factor states them (11-for-10, 1 new share for every 10 held), else as its source writes it.
1156
1187
  ...data.splits.map((event) => ({
1157
1188
  type: "split",
1158
1189
  date: event.date,
1159
- detail: event.description ?? `${event.fromFactor ?? ""}:${event.toFactor ?? ""}`,
1190
+ detail: splitShareTerms(event) ?? event.description ?? `${event.toFactor ?? ""}:${event.fromFactor ?? ""}`,
1191
+ })),
1192
+ // A business demerged out of the listing: its price fell by that business's value on the day, no market move.
1193
+ ...(data.demergers ?? []).map((event) => ({
1194
+ type: "demerger",
1195
+ date: event.exDate,
1196
+ detail: demergerDetail(event),
1160
1197
  })),
1161
1198
  ].sort((left, right) => right.date.localeCompare(left.date));
1162
1199
  }
@@ -1247,11 +1284,11 @@ async function runQuote(rawArgs: string[], ctx: Parameters<CliCommandDef["execut
1247
1284
  }
1248
1285
  // With several symbols, --exchange is for the ones that name no exchange of their own, and one that names no
1249
1286
  // listing (EQT:NYSE:US) is named in a line while the others are quoted.
1250
- // A word that names a company is read once its quote says no listing trades as it (answerQuote).
1287
+ // A word that names a company, and a code no source quotes, are read once its quote says no listing trades as it (answerQuote).
1251
1288
  const resolvedListings = await Promise.all(symbols.filter((symbol) => !notASymbolError(symbol)).map(async (symbol) => {
1252
- if (symbols.length === 1) return { symbol, listing: await requireCliListing(symbol, exchange, market, ctx, { companyWord: false }) };
1289
+ if (symbols.length === 1) return { symbol, listing: await requireCliListing(symbol, exchange, market, ctx, { companyWord: false, listingAbroad: false }) };
1253
1290
  try {
1254
- return { symbol, listing: await resolveCliListing(symbol, exchange, market, { ownExchangeWins: true, companyWord: false }) };
1291
+ return { symbol, listing: await resolveCliListing(symbol, exchange, market, { ownExchangeWins: true, companyWord: false, listingAbroad: false }) };
1255
1292
  } catch (error) {
1256
1293
  if (error instanceof ListingArgError) return { symbol, error };
1257
1294
  throw error;
@@ -1477,12 +1514,12 @@ async function runQuote(rawArgs: string[], ctx: Parameters<CliCommandDef["execut
1477
1514
  ),
1478
1515
  }, {
1479
1516
  rows: quoteRows,
1480
- // An index row's Cur is blank, its level having no currency; the export names what it is in instead.
1517
+ // An index row's Cur is the index's currency, but its level is in points (or a yield in percent): the export names that.
1481
1518
  exportIdentity: (row) => ({
1482
1519
  symbolOrSeries: row.symbol,
1483
1520
  // A pair's rate is its quote currency per base: JPY per USD, as `history` and `fx` export it.
1484
- currencyOrUnit: (row.currency && pairExportUnit(row.symbol, row.currency))
1485
- || row.currency || (row.yieldIndex ? YIELD_INDEX_EXPORT_UNIT : isIndexLevel(row.instrumentType) ? INDEX_POINTS_EXPORT_UNIT : null),
1521
+ currencyOrUnit: isIndexLevel(row.instrumentType) ? row.yieldIndex ? YIELD_INDEX_EXPORT_UNIT : INDEX_POINTS_EXPORT_UNIT
1522
+ : (row.currency && pairExportUnit(row.symbol, row.currency)) || row.currency || (row.yieldIndex ? YIELD_INDEX_EXPORT_UNIT : null),
1486
1523
  // Each row as of its own price (^TNX's 19:59 beside ^VIX's 21:15), as Updated says; a row with none is blank.
1487
1524
  asOf: row.updatedAt || null,
1488
1525
  // Beside a coin priced by one exchange's own trade, which is cited to that exchange, each row names its own.
@@ -1773,6 +1810,23 @@ function financialsOptionHint(flag: string, args: readonly string[]): string | n
1773
1810
  + `or gloom fn FA ${symbol} --period quarterly (the statements).`;
1774
1811
  }
1775
1812
 
1813
+ /**
1814
+ * What `financials` says when it has no fiscal year to list, in place of a
1815
+ * bare "No results.": a listing with quarters but no full year reported
1816
+ * (O8A:FWB2) names its latest quarter and the command that lists them, as
1817
+ * `financials --quarterly` points to it; one whose years carry only balance
1818
+ * sheet figures points at those; one with nothing says so.
1819
+ */
1820
+ function noFiscalYearsNote(key: string, financials: Pick<TickerFinancials, "annualStatements" | "quarterlyStatements">): string {
1821
+ const symbol = commandWord(key);
1822
+ if (financials.annualStatements.length > 0) {
1823
+ return `No fiscal-year revenue, income or EPS on record for ${key}. Its balance sheets: gloom fn FA ${symbol} --statement balance`;
1824
+ }
1825
+ const quarter = latestFinancialPeriod(financials.quarterlyStatements, (row) => row.date)?.date;
1826
+ if (!quarter) return `No fiscal-year or quarterly statements on record for ${key}.`;
1827
+ return `No fiscal-year statements on record for ${key}; its quarterly statements run to ${quarter}: gloom fn FA ${symbol} --period quarterly`;
1828
+ }
1829
+
1776
1830
  function historyOptionHint(flag: string, args: readonly string[]): string | null {
1777
1831
  if (DATE_WINDOW_OPTIONS.has(flag)) {
1778
1832
  return `history takes dates as --from and --to (or --start and --end), each a year or a date (--from 2007 --to 2009), or a --range: ${HISTORY_RANGES.join(", ")}.`;
@@ -1874,6 +1928,8 @@ interface ListingHistory {
1874
1928
  fx?: HistoryConversion;
1875
1929
  /** A catalog series (`CAP:bond-yield:jp-10y`) read beside listings: its values are in `close`, and are no price. */
1876
1930
  catalogSeries?: true;
1931
+ /** The bars a business was demerged out of the listing at (flag `demerger`): a drawdown is measured within the runs between them. */
1932
+ demergers?: Array<{ date: string; action: DemergerAction }>;
1877
1933
  }
1878
1934
 
1879
1935
  /**
@@ -2162,7 +2218,10 @@ async function loadListingHistory(
2162
2218
  const identity = listingIdentity(listing, quote);
2163
2219
  // Without a quote currency, the listing metadata research reads (as `ticker` does) may still state it.
2164
2220
  const listed = quote?.currency ? quote : await market.dataProvider.getQuoteMetadata?.(symbol, exchange).catch(logFailure("cli.commands-market", "Read quote metadata for history failed", null));
2165
- const unit = historyUnit(listing.key, listed ?? quote, await priceUnit);
2221
+ // With neither, the currency the listing was saved with from search (TMPV on NSE trades in INR) still names the unit.
2222
+ const savedCurrency = listing.saved?.metadata.currency?.trim();
2223
+ const unit = historyUnit(listing.key, listed?.currency || quote?.currency || !savedCurrency ? listed ?? quote
2224
+ : { ...listed ?? quote ?? {}, currency: savedCurrency }, await priceUnit);
2166
2225
  const mostTraded = /=F$/i.test(listing.symbol) && (await futuresTerms)?.roll?.mostTraded === true;
2167
2226
  const traded = {
2168
2227
  listing: listing.key, exchange: quote?.listingExchangeName || exchange || undefined, instrumentType: quote?.instrumentType,
@@ -2191,7 +2250,15 @@ async function loadListingHistory(
2191
2250
  const forming = formingPeriodBar(served, venue);
2192
2251
  // A complete one is dated by the day its last session closed, the day its close is from.
2193
2252
  const closedDay = forming ? null : closedPeriodBarDay(served, venue);
2194
- const data = forming?.rows ?? served;
2253
+ // A close that falls a fifth or more below the one before can be a business demerged out of the listing (TMPV's
2254
+ // commercial vehicles on 2025-10-14): its corporate actions say, and that bar is flagged rather than read as a crash.
2255
+ // One read of the listing's corporate actions serves both, asked only for a share or a fund.
2256
+ const actions = shareActionsReader(market, listing, instrumentType);
2257
+ const demerged = await listingDemergerFlags(forming?.rows ?? served, actions);
2258
+ const data = demerged.rows;
2259
+ // NFLX's bars across its 10-for-1 split are in post-split shares, as META's FB-era bars say they were FB's. A long
2260
+ // list skips the read, as it skips the other lookups.
2261
+ const splitNote = lookups ? historySplitNote(listing.symbol, data, await actions.splits()) : null;
2195
2262
  const interval = data[0]?.interval ?? null;
2196
2263
  // Intraday bars print in UTC, as the charts and time and sales label them, not the host zone.
2197
2264
  const intraday = data.some((row) => row.date.length > 10);
@@ -2253,15 +2320,71 @@ async function loadListingHistory(
2253
2320
  historyVenueVolumeNote(data) ?? [],
2254
2321
  // NG=F's rows are November's to the 23rd and December's from the 26th: each roll named, and thin bars said.
2255
2322
  historyRollNote(listing.symbol, data, { mostTraded }) ?? [], historyThinNote(data) ?? [],
2323
+ historyDemergerNote(data, demerged.breaks, historyPrice(historyPriceDecimals(data, listing.saved?.metadata.assetCategory, priceDivisor))) ?? [],
2324
+ splitNote ?? [],
2256
2325
  historyBarStatusNote(forming ? served : data, { tradingDay: venueTradingDay(venue, Date.now()) }) ?? [],
2257
2326
  await interventionWindowNote(interventions, interventionPair, data) ?? [],
2258
2327
  ].flat();
2259
2328
  return {
2260
2329
  listing, identity, unit, data, resolution, interval, intraday, volume, freshness, notes, mostTraded,
2261
2330
  decimals: historyPriceDecimals(data, listing.saved?.metadata.assetCategory, priceDivisor),
2331
+ ...demerged.breaks.length > 0 ? { demergers: demerged.breaks } : {},
2262
2332
  };
2263
2333
  }
2264
2334
 
2335
+ /** How long a history waits for the corporate actions it reads beside a price break; the bars are served without them after. */
2336
+ const DEMERGER_READ_WAIT_MS = 3_000;
2337
+
2338
+ /**
2339
+ * A listing's corporate actions, read at most once and only for a share or a fund: a future, a pair or an index has
2340
+ * no business to split or demerge. `splits` reads them for the bars' splits; `demergers` only once a close has fallen
2341
+ * a fifth or more (hasPriceBreak). Fails soft, and waits no longer than DEMERGER_READ_WAIT_MS.
2342
+ */
2343
+ function shareActionsReader(market: MarketContext, listing: CliListing, instrumentType: string | undefined) {
2344
+ const kind = classifyInstrumentType(instrumentType ?? "");
2345
+ const share = (kind === "equity" || kind === "fund" || !instrumentType)
2346
+ && !isFuturesInstrument(listing.symbol, instrumentType ?? null) && !isCurrencyPairListing(listing.symbol, listing.request.exchange)
2347
+ && typeof market.dataProvider.getCorporateActions === "function";
2348
+ let read: Promise<CorporateActionsData | null> | null = null;
2349
+ const actions = () => read ??= settleWithin(Promise.resolve().then(() => market.dataProvider.getCorporateActions!(listing.request.symbol, listing.request.exchange))
2350
+ .catch(logFailure("cli.commands-market", "Read corporate actions for a history failed", null)), DEMERGER_READ_WAIT_MS)
2351
+ .then((value) => value ?? null);
2352
+ return {
2353
+ share,
2354
+ splits: async (): Promise<SplitAction[]> => share ? (await actions())?.splits ?? [] : [],
2355
+ demergers: async (): Promise<DemergerAction[]> => share ? (await actions())?.demergers ?? [] : [],
2356
+ };
2357
+ }
2358
+
2359
+ /** A share's bars with the bar each demerger falls in flagged (withDemergerFlags), read only when a close falls a fifth or more below the one before. */
2360
+ async function listingDemergerFlags(
2361
+ rows: HistoryRow[],
2362
+ actions: ReturnType<typeof shareActionsReader>,
2363
+ ): Promise<{ rows: HistoryRow[]; breaks: Array<{ date: string; action: DemergerAction }> }> {
2364
+ if (!actions.share || !hasPriceBreak(rows)) return { rows, breaks: [] };
2365
+ return withDemergerFlags(rows, await actions.demergers());
2366
+ }
2367
+
2368
+ /**
2369
+ * "Splits in range: NFLX 10-for-1 on 2025-11-17; bars before it are split-adjusted.": the splits that took effect
2370
+ * after the first bar shown and by the last, which the bars run across in post-split shares. Null with none, or for
2371
+ * a factor no share count states (a spinoff's price adjustment, which the demerger note covers).
2372
+ */
2373
+ function historySplitNote(symbol: string, rows: readonly HistoryRow[], splits: readonly SplitAction[]): string | null {
2374
+ const first = rows[0]?.date.slice(0, 10);
2375
+ const last = rows.at(-1)?.date.slice(0, 10);
2376
+ if (!first || !last || first === last) return null;
2377
+ const inside = splits
2378
+ .filter((split) => /^\d{4}-\d{2}-\d{2}/.test(split.date) && split.date.slice(0, 10) > first && split.date.slice(0, 10) <= last)
2379
+ .sort((left, right) => left.date.localeCompare(right.date))
2380
+ .flatMap((split) => {
2381
+ const terms = splitShareTerms(split);
2382
+ return terms ? [`${terms.split(",")[0]} on ${split.date.slice(0, 10)}`] : [];
2383
+ });
2384
+ if (inside.length === 0) return null;
2385
+ return `Splits in range: ${symbol} ${inside.join(" and ")}; bars before ${inside.length === 1 ? "it" : "each"} are split-adjusted.`;
2386
+ }
2387
+
2265
2388
  /**
2266
2389
  * A bare symbol with no quote whose US listing stopped trading is that
2267
2390
  * listing's history: a source can answer the bare symbol with a listing
@@ -2465,13 +2588,19 @@ async function runHistory(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
2465
2588
  const closes = (interval === "1wk" || interval === "1mo"
2466
2589
  ? data.map((row) => ({ ...row, date: barCloseSession(interval, row.date, identity.exchange || undefined, Date.now()) }))
2467
2590
  : data).filter((row) => !row.flag?.split(",").includes(CLOSE_COPIED_FLAG));
2468
- const contractDrawdown = historyContractDrawdown(closes, yieldUnits ? "yield" : "return");
2591
+ // Nor from a close that held a business the listing demerged to one that did not (TMPV before 2025-10-14): split
2592
+ // before each bar flagged `demerger`, whatever date its close is given, and named by the demerger's own day.
2593
+ const demergedOn = history.demergers?.map((entry) => entry.action.exDate) ?? [];
2594
+ const contractDrawdown = demergedOn.length > 0
2595
+ ? deepestRunDrawdown(demergerRuns(closes).map((run) => historyContractDrawdown(run, yieldUnits ? "yield" : "return")))
2596
+ : historyContractDrawdown(closes, yieldUnits ? "yield" : "return");
2469
2597
  // A window's last week can close after the dates asked for (--to 2003, a week ending Fri 2 Jan 2004): measured to its end.
2470
2598
  const until = ask.window?.to;
2471
2599
  const drawdown = contractDrawdown ? measuredUntil(contractDrawdown.drawdown, until) : null;
2472
2600
  const rose = yieldUnits ? maxRunUp(closes) : null;
2473
2601
  const runUp = rose && measuredUntil(rose, until);
2474
- const moveText = interval ? { basis: `${BAR_INTERVAL_LABELS[interval]} closes${contractDrawdown?.contract ? `, ${contractDrawdown.contract}` : ""}`, price,
2602
+ const across = demergedOn.length > 0 ? `, not across the ${demergedOn.join(" and ")} ${demergedOn.length === 1 ? "demerger" : "demergers"}` : "";
2603
+ const moveText = interval ? { basis: `${BAR_INTERVAL_LABELS[interval]} closes${contractDrawdown?.contract ? `, ${contractDrawdown.contract}` : ""}${across}`, price,
2475
2604
  date: (text: string) => intraday ? formatUtcTime(text) : text.slice(0, 10) } : null;
2476
2605
  ctx.printResult({
2477
2606
  data,
@@ -2490,6 +2619,7 @@ async function runHistory(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
2490
2619
  unbrokenFrom: historyUnbrokenFrom(data) ?? data[0]?.date ?? null,
2491
2620
  bars: data.length,
2492
2621
  maxDrawdown: drawdown && contractDrawdown?.contract ? { ...drawdown, contract: contractDrawdown.contract } : drawdown,
2622
+ ...(history.demergers ? { demergers: history.demergers.map(({ date, action }) => ({ bar: date, ...action })) } : {}),
2493
2623
  ...(runUp ? { maxRunUp: runUp } : {}),
2494
2624
  asOf: freshness?.asOf ?? null,
2495
2625
  ...(history.fx ? { converted: history.fx } : {}),
@@ -2514,6 +2644,12 @@ async function runHistory(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
2514
2644
  });
2515
2645
  }
2516
2646
 
2647
+ /** The deepest of the drawdowns measured within each run between demergers. */
2648
+ function deepestRunDrawdown(runs: ReadonlyArray<ReturnType<typeof historyContractDrawdown>>): ReturnType<typeof historyContractDrawdown> {
2649
+ const depth = (entry: NonNullable<ReturnType<typeof historyContractDrawdown>>) => entry.drawdown.bp ?? entry.drawdown.drawdown;
2650
+ return runs.reduce<ReturnType<typeof historyContractDrawdown>>((deepest, run) => run && (!deepest || depth(run) < depth(deepest)) ? run : deepest, null);
2651
+ }
2652
+
2517
2653
  /** The window from `years` back to today. */
2518
2654
  function yearsBackWindow(years: number): PriceWindow | null {
2519
2655
  const from = new Date();
@@ -2759,7 +2895,7 @@ async function runHistoryList(
2759
2895
  // A catalog series is no listing: it is read as a series below.
2760
2896
  if (catalogSeriesId(symbol)) return { typed: symbol, listing: null, error: null };
2761
2897
  try {
2762
- const listing = await resolveCliListing(symbol, exchange, market, { ownExchangeWins: true, companyWord: lookups && typedList });
2898
+ const listing = await resolveCliListing(symbol, exchange, market, { ownExchangeWins: true, companyWord: lookups && typedList, listingAbroad: lookups });
2763
2899
  return { typed: symbol, listing };
2764
2900
  } catch (error) {
2765
2901
  return { typed: symbol, listing: null, error };
@@ -2992,9 +3128,15 @@ async function runFinancials(rawArgs: string[], ctx: Parameters<CliCommandDef["e
2992
3128
  await withMarketData(ctx, async (market) => {
2993
3129
  const listing = await requireCliListing(raw, exchangeOption, market, ctx);
2994
3130
  const venues = loadBareVenues(listing, market);
2995
- const loaded = await loadForListing(listing, market, ctx, () => market.dataProvider.getTickerFinancials(
3131
+ // The statements carry the listing's quote: what says whether the line can have moved, with no read of its own.
3132
+ const read = market.dataProvider.getTickerFinancials(
2996
3133
  listing.request.symbol, listing.request.exchange, { cacheMode: ctx.cliOptions.refresh ? "refresh" : "default" },
2997
- ), undefined, { command: commandName, noun: commandName === "valuation" ? "valuation data" : commandName });
3134
+ );
3135
+ const loaded = await loadForListing(listing, market, ctx, () => read, undefined,
3136
+ { command: commandName, noun: commandName === "valuation" ? "valuation data" : commandName, quote: read.then((found) => found.quote ?? null, () => {
3137
+ // Intentional ignore: this is the same read loadForListing awaits as the command's load, which reports its failure.
3138
+ return null;
3139
+ }) });
2998
3140
  // A converted TTM block at the rate `fx` reports, as `ticker` shows it; only the US dollar legs are read.
2999
3141
  // A withdrawn EV's bridge converts a balance sheet in another currency at our close on its date (withBalanceSheetRate).
3000
3142
  const financials = view === "statements" ? loaded
@@ -3086,11 +3228,14 @@ async function runFinancials(rawArgs: string[], ctx: Parameters<CliCommandDef["e
3086
3228
  const older = await hasOlderStatements(() => market.dataProvider.getTickerFinancials(listing.request.symbol, listing.request.exchange,
3087
3229
  { statementHistory: "extended" }), "annual", dates);
3088
3230
  const historyNotes = [...stale ? [stale] : [], ...filled ? [filled] : [], ...statementHistoryNotes("annual", dates, listing.key, older)];
3231
+ // No year to list says why, and where its quarters are, rather than "No results.".
3232
+ const empty = rows.length === 0 ? noFiscalYearsNote(listing.key, financials) : null;
3233
+ const notes = empty ? [...historyNotes, empty] : historyNotes;
3089
3234
  // NDJSON keeps the raw statement rows it always wrote; CSV gets the table and its closing lines.
3090
3235
  const tables = tabular
3091
3236
  ? selectTables({
3092
3237
  tables: [exportRowsTable("Annual statements", STATEMENT_COLUMNS, rows)],
3093
- footer: reportFooterLines({ freshness, notes: historyNotes }),
3238
+ footer: reportFooterLines({ freshness, notes }),
3094
3239
  })
3095
3240
  : undefined;
3096
3241
  ctx.printResult({
@@ -3102,7 +3247,7 @@ async function runFinancials(rawArgs: string[], ctx: Parameters<CliCommandDef["e
3102
3247
  quarterlyStatements: financials.quarterlyStatements.length,
3103
3248
  fundamentals: exportedFundamentals(financials.fundamentals),
3104
3249
  profile: financials.profile,
3105
- ...(historyNotes.length > 0 ? { notes: historyNotes } : {}),
3250
+ ...(notes.length > 0 ? { notes } : {}),
3106
3251
  },
3107
3252
  freshness,
3108
3253
  ...(choice.length > 0 ? { warnings: choice } : {}),
@@ -3110,7 +3255,9 @@ async function runFinancials(rawArgs: string[], ctx: Parameters<CliCommandDef["e
3110
3255
  heading: listingHeading(identity),
3111
3256
  rows: () => rows,
3112
3257
  columns: STATEMENT_COLUMNS,
3113
- ...(historyNotes.length > 0 ? { footnote: historyNotes.join("\n"), exportNotes: historyNotes } : {}),
3258
+ ...(empty ? { empty } : {}),
3259
+ ...(historyNotes.length > 0 ? { footnote: historyNotes.join("\n") } : {}),
3260
+ ...(notes.length > 0 ? { exportNotes: notes } : {}),
3114
3261
  ...(tables && ctx.cliOptions.format === "csv" ? { tables } : {}),
3115
3262
  // Annual statements in the company's reporting currency.
3116
3263
  exportIdentity: { symbolOrSeries: listing.key, currencyOrUnit: rows.find((row) => row.currency)?.currency ?? null, interval: "annual" },
@@ -3465,7 +3612,7 @@ async function runFilings(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
3465
3612
  const quotePromise = loadListingQuote(market.dataProvider, listing);
3466
3613
  const identity = nonUsSecListingVenue(symbol, exchange) ? listingIdentity(listing, await quotePromise) : null;
3467
3614
  // Where a listing abroad publishes its announcements, whatever the SEC holds for it.
3468
- const page = identity ? exchangeAnnouncementsPage(identity.symbol, identity.exchange) : null;
3615
+ const page = identity ? listingAnnouncementsPage(identity.symbol, identity.exchange) : null;
3469
3616
  const pageLine = page ? `${page.name}: ${page.url}` : null;
3470
3617
  try {
3471
3618
  const context = identity?.name ? { listingName: identity.name } : undefined;
@@ -3478,7 +3625,7 @@ async function runFilings(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
3478
3625
  hidden = shown.hidden;
3479
3626
  return shown.filings;
3480
3627
  }),
3481
- (found) => found.length === 0),
3628
+ (found) => found.length === 0, { command: form ? `filings --form ${form}` : "filings", noun: "SEC filings", quote: quotePromise }),
3482
3629
  quotePromise,
3483
3630
  ]);
3484
3631
  const hiddenNote = hidden ? hiddenFilingsNote(hidden) : null;
@@ -3706,7 +3853,8 @@ async function printBeneficialOwners(
3706
3853
  const abroad = nonUsSecListingVenue(symbol, exchange) ? listingIdentity(listing, await quotePromise) : null;
3707
3854
  const request = { form: beneficialRouteForm(form), history, listing: { exchange, name: abroad?.name ?? undefined } };
3708
3855
  const [payload, holders, quote, financials] = await Promise.all([
3709
- loadForListing(listing, market, ctx, () => fetchBeneficialOwners(symbol, request)),
3856
+ loadForListing(listing, market, ctx, () => fetchBeneficialOwners(symbol, request), undefined,
3857
+ { command: `holders --form ${form}${history ? " --history" : ""}`, noun: "beneficial owners", quote: quotePromise }),
3710
3858
  market.dataProvider.getHolders?.(symbol, exchange).catch(logFailure("cli.commands-market", "Read company holders failed", null)) ?? null,
3711
3859
  quotePromise,
3712
3860
  // Today's share count, which the filed percents are set against.
@@ -3790,8 +3938,10 @@ async function runHolders(
3790
3938
  listing, market, ctx,
3791
3939
  () => market.dataProvider.getHolders(listing.request.symbol, listing.request.exchange),
3792
3940
  (found) => found.holders.length === 0,
3793
- { command: commandName, noun: "holder data" },
3941
+ { command: commandName, noun: "holder data", quote: quoted },
3794
3942
  ).catch(async (error: unknown) => {
3943
+ // A symbol whose company moved names its new symbol, as every command does.
3944
+ if (isMovedSymbolFailure(error)) throw error;
3795
3945
  // A fund has no ownership breakdown, and a listing may have no holders on record: say so
3796
3946
  // (and what reads a fund) rather than the source's NO_DATA.
3797
3947
  const none = await noHoldersAnswer(listing.key, listing.request.exchange, error, await quoted, apiClient);
@@ -3923,13 +4073,14 @@ async function runAnalyst(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
3923
4073
  await withMarketData(ctx, async (market) => {
3924
4074
  const listing = await requireCliListing(raw, exchangeOption, market, ctx);
3925
4075
  const venues = loadBareVenues(listing, market);
4076
+ const quoted = loadListingQuote(market.dataProvider, listing);
3926
4077
  const [data, quote] = await Promise.all([
3927
4078
  loadForListing(
3928
4079
  // A listing no analyst covers loads as research with nothing in it, said below rather than failed.
3929
4080
  listing, market, ctx, () => loadAnalystResearch(market.dataProvider, listing.request.symbol, listing.request.exchange),
3930
- undefined, { command: "analyst", noun: "analyst research" },
4081
+ undefined, { command: "analyst", noun: "analyst research", quote: quoted },
3931
4082
  ),
3932
- loadListingQuote(market.dataProvider, listing),
4083
+ quoted,
3933
4084
  ]);
3934
4085
  const identity = listingIdentity(listing, quote);
3935
4086
  const choice = await listingChoiceNotes(listing, market, quote, venues);
@@ -3980,12 +4131,13 @@ async function runEvents(rawArgs: string[], ctx: Parameters<CliCommandDef["execu
3980
4131
  // The earnings rows are resolved against the calendar `earnings` reads, so the next report is the same in both.
3981
4132
  const calendar = market.dataProvider.getEarningsCalendar?.([listing.key])
3982
4133
  .catch(logFailure("cli.commands-market", "Read the earnings calendar for events failed", [] as EarningsEvent[]));
4134
+ const quoted = loadListingQuote(market.dataProvider, listing);
3983
4135
  const [recorded, quote, events] = await Promise.all([
3984
4136
  loadForListing(
3985
4137
  listing, market, ctx, () => market.dataProvider.getCorporateActions(listing.request.symbol, listing.request.exchange),
3986
- undefined, { command: "events", noun: "corporate events" },
4138
+ undefined, { command: "events", noun: "corporate events", quote: quoted },
3987
4139
  ),
3988
- loadListingQuote(market.dataProvider, listing),
4140
+ quoted,
3989
4141
  calendar,
3990
4142
  ]);
3991
4143
  const data = withResolvedEarnings(recorded, calendarEventOf(events, listing.key), newYorkDay());
@@ -4701,7 +4853,7 @@ async function runEarnings(rawArgs: string[], ctx: Parameters<CliCommandDef["exe
4701
4853
  await withCliServices(ctx, async (services) => {
4702
4854
  const symbols = await readSymbols(entries, services.dataProvider);
4703
4855
  const listings = await Promise.all(symbols.map((symbol) => requireCliListing(
4704
- symbol, exchangeOption, services, ctx, { ownExchangeWins: symbols.length > 1, companyWord: symbols.length <= MAX_CHOICE_LOOKUPS },
4856
+ symbol, exchangeOption, services, ctx, { ownExchangeWins: symbols.length > 1, companyWord: symbols.length <= MAX_CHOICE_LOOKUPS, listingAbroad: symbols.length <= MAX_CHOICE_LOOKUPS },
4705
4857
  )));
4706
4858
  const keys = listings.map((listing) => listing.key);
4707
4859
  // Each bare symbol's venues cost a search, so a long list (a portfolio check, not a lookup) names none.
@@ -108,6 +108,7 @@ import {
108
108
  } from "./fred-series";
109
109
  import { fredProvenance, fredPublicationTime, notOnFredSource } from "../../sources/gloomberb-cloud/fred-attribution";
110
110
  import { followsUsBondMarket, usBondMarketClosedNote } from "../../market-data/us-bond-market";
111
+ import { commandWord } from "../../utils/shell-word";
111
112
 
112
113
  /** The Actual of a release its publisher could not compute; the notes say why. */
113
114
  const NOT_PUBLISHED_TEXT = "not published";
@@ -1091,10 +1092,15 @@ async function runCorrelation(rawArgs: string[], ctx: Parameters<CliCommandDef["
1091
1092
  const right = rightListing!.key;
1092
1093
  // Same daily-return model as the CORR pane: price levels of two trending
1093
1094
  // assets correlate spuriously, often with the opposite sign.
1095
+ // Each symbol's quote, read once: whether its line can have moved, and where its daily close is taken below.
1096
+ const quotes = new Map([leftListing!, rightListing!].map((listing) => [listing, loadListingQuote(services.dataProvider, listing)] as const));
1094
1097
  const loadSeries = async (listing: CliListing) => {
1098
+ // A symbol whose company moved is asked again under its new symbol, the other one kept.
1099
+ const retry = (key: string) => `gloom correlation ${listing === leftListing ? `${key} ${commandWord(right)}` : `${commandWord(left)} ${key}`}`;
1095
1100
  const bars = await loadForListing(
1096
1101
  listing, services, ctx,
1097
1102
  () => loadCorrelationHistory(services.dataProvider, listing.request.symbol, listing.request.exchange, "1Y"),
1103
+ undefined, { command: "correlation", noun: "history", retry, quote: quotes.get(listing)! },
1098
1104
  );
1099
1105
  return { ...buildCorrelationSeries(listing.key, bars), bars: bars.length };
1100
1106
  };
@@ -1109,7 +1115,7 @@ async function runCorrelation(rawArgs: string[], ctx: Parameters<CliCommandDef["
1109
1115
  .map((series) => series.rollNote ? `${series.symbol}: ${series.rollNote}` : null),
1110
1116
  ].filter((note) => note != null);
1111
1117
  // A bare symbol names no exchange; its quote says where it lists, which sets when its daily close is taken.
1112
- const [leftQuote, rightQuote] = await Promise.all([leftListing!, rightListing!].map((listing) => loadListingQuote(services.dataProvider, listing)));
1118
+ const [leftQuote, rightQuote] = await Promise.all([leftListing!, rightListing!].map((listing) => quotes.get(listing)!));
1113
1119
  const sessionNote = mixedSessionCloseNote(
1114
1120
  { symbol: leftListing!.symbol, exchange: listingIdentity(leftListing!, leftQuote).exchange, label: left },
1115
1121
  { symbol: rightListing!.symbol, exchange: listingIdentity(rightListing!, rightQuote).exchange, label: right },
@@ -1,5 +1,5 @@
1
1
  import { basename, join, resolve } from "path";
2
- import { existsSync, lstatSync, readFileSync, rmSync } from "fs";
2
+ import { existsSync, lstatSync, readFileSync } from "fs";
3
3
  import {
4
4
  DEPRECATED_HOST_EXPORTS,
5
5
  REMOVED_HOST_EXPORTS,
@@ -31,6 +31,7 @@ import {
31
31
  } from "../../plugins/installer";
32
32
  import { isReservedBuiltinPluginId } from "../../plugins/ownership";
33
33
  import { pluginFromModule, pluginSupportsTarget } from "../../plugins/plugin-export";
34
+ import { removeFolder } from "../../utils/remove-folder";
34
35
  import { formatVersion, requiredGloomberb } from "../../utils/semver";
35
36
  import { ALL_PLUGIN_TARGETS, type GloomPlugin, type PluginTarget } from "../../types/plugin";
36
37
  import {
@@ -311,7 +312,7 @@ async function doctorPlugin(nameOrPath: string): Promise<PluginDoctorReport> {
311
312
  const result = await bundleExternalPlugin(candidate, outDir, { define: { "process.env.NODE_ENV": "\"production\"" } });
312
313
  const size = Math.round(Bun.file(result.outputPath).size / 1024);
313
314
  add("browser-build", "ok", `${basename(browserEntry ?? entryFile)} compiles for the desktop view (${size}KB)`);
314
- rmSync(outDir, { recursive: true, force: true });
315
+ await removeFolder(outDir);
315
316
  } catch (error) {
316
317
  const message = error instanceof Error ? error.message : String(error);
317
318
  add("browser-build", "fail", `Desktop build failed: ${message.split("\n")[0]}. Ship an index.browser.ts without node:* imports, or set targets to ["cli", "tui"].`);