gloomberb 0.20.2 → 0.20.3

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 (362) hide show
  1. package/README.md +1 -1
  2. package/README.zh-CN.md +1 -1
  3. package/package.json +2 -1
  4. package/src/account/auth-form.tsx +13 -8
  5. package/src/account/upgrade-dialog.tsx +1 -1
  6. package/src/api-client/central-bank-rates.ts +5 -0
  7. package/src/api-client/data.ts +17 -4
  8. package/src/api-client/debt-maturities.ts +45 -2
  9. package/src/api-client/earnings.ts +4 -2
  10. package/src/api-client/errors.ts +21 -11
  11. package/src/api-client/index.ts +1 -0
  12. package/src/api-client/paths.ts +9 -1
  13. package/src/api-client/social-mentions.ts +47 -0
  14. package/src/api-client/types/econ.ts +4 -0
  15. package/src/app.tsx +11 -1
  16. package/src/cli/command-options.ts +2 -1
  17. package/src/cli/commands/market.ts +111 -29
  18. package/src/cli/commands/options-chain.ts +23 -6
  19. package/src/cli/commands/overview.ts +13 -5
  20. package/src/cli/commands/plugins.ts +49 -18
  21. package/src/cli/commands/search.ts +25 -6
  22. package/src/cli/commands/ticker.ts +4 -2
  23. package/src/cli/fx-quote-rate.ts +49 -1
  24. package/src/cli/glossary.ts +95 -15
  25. package/src/cli/history-rows.ts +9 -25
  26. package/src/cli/index.ts +6 -38
  27. package/src/cli/known-gaps.ts +3 -3
  28. package/src/cli/listing-arg.ts +78 -18
  29. package/src/cli/name-entries.ts +3 -2
  30. package/src/cli/not-a-ticker.ts +6 -2
  31. package/src/cli/pane-functions/capabilities.ts +12 -1
  32. package/src/cli/pane-functions/function-help.ts +23 -11
  33. package/src/cli/pane-functions/headless.ts +3 -1
  34. package/src/cli/pane-functions/index.ts +32 -4
  35. package/src/cli/pane-functions/market-session.ts +8 -3
  36. package/src/cli/pane-functions/resolver.ts +18 -11
  37. package/src/cli/pane-functions/screenshot-payload.ts +36 -6
  38. package/src/cli/pane-functions/screenshot-render.ts +4 -0
  39. package/src/cli/quote-answer.ts +10 -0
  40. package/src/cli/report-tables.ts +22 -2
  41. package/src/cli/result.ts +7 -3
  42. package/src/cli/spreadsheet-hint.ts +43 -0
  43. package/src/cli/symbol-list.ts +58 -4
  44. package/src/cli/symbol-rows.ts +49 -2
  45. package/src/cli/ticker-resolution.ts +98 -5
  46. package/src/cli/unknown-command.ts +88 -0
  47. package/src/components/command-bar/assist/model.ts +6 -1
  48. package/src/components/command-bar/commands/direct/index.ts +9 -1
  49. package/src/components/command-bar/commands/registry.ts +18 -0
  50. package/src/components/command-bar/pane-actions.ts +30 -13
  51. package/src/components/command-bar/panel/index.tsx +6 -3
  52. package/src/components/command-bar/panel/prompt-binding.ts +4 -0
  53. package/src/components/command-bar/panel/types.ts +3 -0
  54. package/src/components/command-bar/routes/header-market.ts +108 -0
  55. package/src/components/command-bar/routes/root/command-items.ts +5 -0
  56. package/src/components/command-bar/routes/root/provider-search.ts +190 -32
  57. package/src/components/command-bar/routes/root/results.ts +3 -0
  58. package/src/components/command-bar/routes/root/runtime.ts +28 -5
  59. package/src/components/command-bar/routes/ticker-search/results.ts +53 -6
  60. package/src/components/command-bar/routing/list-state.ts +38 -0
  61. package/src/components/command-bar/selection-hint.ts +28 -0
  62. package/src/components/command-bar/surface/index.tsx +41 -3
  63. package/src/components/command-bar/view-model.ts +15 -0
  64. package/src/components/command-bar/workflow/tickers.ts +3 -2
  65. package/src/components/company-logo.tsx +20 -2
  66. package/src/components/data-table/export.ts +13 -8
  67. package/src/components/feedback-dialog.tsx +2 -1
  68. package/src/components/form-modal/field-row.tsx +2 -1
  69. package/src/components/input-search-bar.tsx +2 -2
  70. package/src/components/layout/double-escape-close.ts +8 -5
  71. package/src/components/layout/header.tsx +75 -44
  72. package/src/components/layout/market-summary.ts +322 -116
  73. package/src/components/layout/pane/footer/index.tsx +26 -8
  74. package/src/components/layout/pane/footer/model.ts +46 -20
  75. package/src/components/layout/pane/header.tsx +3 -2
  76. package/src/components/layout/shell/chrome.ts +15 -15
  77. package/src/components/layout/status-bar.tsx +8 -7
  78. package/src/components/layout/status-widget-space.ts +8 -0
  79. package/src/components/markdown-editor.tsx +2 -2
  80. package/src/components/onboarding/account-step/form-panel.tsx +0 -3
  81. package/src/components/onboarding/onboarding-keyboard.ts +15 -6
  82. package/src/components/onboarding/onboarding-wizard.tsx +61 -11
  83. package/src/components/onboarding/portfolio-step/broker-fields-panel.tsx +0 -1
  84. package/src/components/onboarding/portfolio-step/positions-panel.tsx +0 -2
  85. package/src/components/price-sparkline/model.ts +26 -10
  86. package/src/components/ticker/list-table-view.tsx +29 -4
  87. package/src/components/ui/button.tsx +13 -2
  88. package/src/components/ui/column-grid.tsx +18 -9
  89. package/src/components/ui/data-table/index.tsx +1 -1
  90. package/src/components/ui/data-table/opentui/index.tsx +2 -1
  91. package/src/components/ui/data-table/types.ts +18 -0
  92. package/src/components/ui/delayed-mark.tsx +3 -2
  93. package/src/components/ui/field-grid.tsx +0 -2
  94. package/src/components/ui/fields.tsx +7 -4
  95. package/src/components/ui/inline-quick-add.tsx +2 -2
  96. package/src/components/ui/key-hint-words.ts +153 -0
  97. package/src/components/ui/key-hints.tsx +73 -0
  98. package/src/components/ui/menu.tsx +3 -1
  99. package/src/components/ui/message-composer.tsx +2 -2
  100. package/src/components/ui/shortcut-hint.tsx +28 -3
  101. package/src/components/ui/tabs.tsx +7 -0
  102. package/src/components/ui/text-prompt-dialog.tsx +2 -1
  103. package/src/core/state/app/command-bar-launch.ts +3 -0
  104. package/src/data/config/store/normalize.ts +6 -0
  105. package/src/docs/snapshot.json +120 -69
  106. package/src/i18n/es.ts +24 -1
  107. package/src/i18n/ja.ts +24 -1
  108. package/src/i18n/ko.ts +24 -1
  109. package/src/i18n/zh-cn.ts +24 -1
  110. package/src/i18n/zh-tw.ts +24 -1
  111. package/src/layout/pane-manager/gridlock.ts +11 -0
  112. package/src/market-data/bars-per-year.ts +27 -9
  113. package/src/market-data/coordinator/quotes.ts +22 -3
  114. package/src/market-data/futures-board.ts +80 -0
  115. package/src/market-data/futures-contract.ts +9 -3
  116. package/src/market-data/market/change-basis.ts +2 -2
  117. package/src/market-data/market/dated-previous-close.ts +163 -47
  118. package/src/market-data/market/format.ts +14 -3
  119. package/src/market-data/market/freshness.ts +24 -7
  120. package/src/market-data/market/header-market.ts +154 -0
  121. package/src/market-data/market/index-level.ts +29 -0
  122. package/src/market-data/market/index-session-venues.ts +44 -0
  123. package/src/market-data/market/status.ts +7 -2
  124. package/src/market-data/market/venue-session.ts +72 -0
  125. package/src/market-data/model-dividend-yield.ts +23 -8
  126. package/src/market-data/options-alternatives.ts +39 -4
  127. package/src/market-data/published-apac-sessions.ts +40 -2
  128. package/src/market-data/quotes/export-identity.ts +76 -0
  129. package/src/market-data/quotes/freshness.ts +22 -0
  130. package/src/market-data/quotes/time.ts +42 -1
  131. package/src/market-data/realized-volatility.ts +11 -7
  132. package/src/market-data/tax-equivalent.ts +145 -27
  133. package/src/plugins/builtin/account-management/pane.tsx +2 -2
  134. package/src/plugins/builtin/alerts/alert-engine.ts +12 -6
  135. package/src/plugins/builtin/alerts/alert-log.ts +6 -2
  136. package/src/plugins/builtin/alerts/calendar-events.ts +74 -12
  137. package/src/plugins/builtin/alerts/cli-forms.ts +11 -1
  138. package/src/plugins/builtin/alerts/cli-move.ts +234 -0
  139. package/src/plugins/builtin/alerts/cli.ts +224 -33
  140. package/src/plugins/builtin/alerts/command.ts +33 -6
  141. package/src/plugins/builtin/alerts/event-rows.ts +18 -4
  142. package/src/plugins/builtin/alerts/events-pane.tsx +6 -2
  143. package/src/plugins/builtin/alerts/events.ts +9 -0
  144. package/src/plugins/builtin/alerts/format.ts +40 -15
  145. package/src/plugins/builtin/alerts/headless.ts +31 -18
  146. package/src/plugins/builtin/alerts/history.ts +1 -0
  147. package/src/plugins/builtin/alerts/index.tsx +86 -12
  148. package/src/plugins/builtin/alerts/live.ts +2 -1
  149. package/src/plugins/builtin/alerts/move-checks.ts +155 -0
  150. package/src/plugins/builtin/alerts/move.ts +160 -0
  151. package/src/plugins/builtin/alerts/pane.tsx +52 -22
  152. package/src/plugins/builtin/alerts/price-text.ts +62 -0
  153. package/src/plugins/builtin/alerts/price.ts +17 -0
  154. package/src/plugins/builtin/alerts/quotes.ts +84 -3
  155. package/src/plugins/builtin/alerts/scheduled-check.ts +7 -1
  156. package/src/plugins/builtin/alerts/storage.ts +20 -7
  157. package/src/plugins/builtin/alerts/types.ts +13 -0
  158. package/src/plugins/builtin/analytics/risk-client.ts +60 -39
  159. package/src/plugins/builtin/analytics/risk-episodes.ts +18 -0
  160. package/src/plugins/builtin/analytics/risk-headless.ts +20 -4
  161. package/src/plugins/builtin/analytics/risk-model.ts +68 -1
  162. package/src/plugins/builtin/analytics/risk-pane.tsx +15 -3
  163. package/src/plugins/builtin/backtest/engine.ts +4 -2
  164. package/src/plugins/builtin/backtest/window.ts +3 -1
  165. package/src/plugins/builtin/broker-manager/sign-in-end.ts +1 -1
  166. package/src/plugins/builtin/central-bank-rates/client.ts +4 -0
  167. package/src/plugins/builtin/central-bank-rates/headless.ts +1 -1
  168. package/src/plugins/builtin/central-bank-rates/model.ts +18 -8
  169. package/src/plugins/builtin/central-bank-rates/pane.tsx +6 -3
  170. package/src/plugins/builtin/chart-composer/cli-options.ts +5 -0
  171. package/src/plugins/builtin/chart-composer/headless-schema.ts +17 -1
  172. package/src/plugins/builtin/chart-composer/headless.ts +2 -0
  173. package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +9 -2
  174. package/src/plugins/builtin/crypto-board/headless.ts +82 -17
  175. package/src/plugins/builtin/crypto-board/index.tsx +24 -2
  176. package/src/plugins/builtin/crypto-board/model.ts +5 -2
  177. package/src/plugins/builtin/crypto-board/pane.tsx +4 -1
  178. package/src/plugins/builtin/debt-maturities/client.ts +111 -6
  179. package/src/plugins/builtin/debt-maturities/headless.ts +84 -1
  180. package/src/plugins/builtin/debt-maturities/model.ts +97 -14
  181. package/src/plugins/builtin/debt-maturities/pane.tsx +165 -15
  182. package/src/plugins/builtin/debt-maturities/series.ts +3 -1
  183. package/src/plugins/builtin/dividend-yield/client.ts +22 -6
  184. package/src/plugins/builtin/dividend-yield/headless.ts +113 -46
  185. package/src/plugins/builtin/dividend-yield/model.ts +5 -2
  186. package/src/plugins/builtin/dividend-yield/pane.tsx +6 -3
  187. package/src/plugins/builtin/dividend-yield/ranking-reads.ts +11 -4
  188. package/src/plugins/builtin/dividend-yield/ranking.ts +113 -18
  189. package/src/plugins/builtin/dividend-yield/types.ts +2 -0
  190. package/src/plugins/builtin/dividend-yield/view.ts +3 -0
  191. package/src/plugins/builtin/econ/calendar-model.ts +21 -3
  192. package/src/plugins/builtin/econ/detail-view.tsx +5 -3
  193. package/src/plugins/builtin/econ/figures.ts +13 -0
  194. package/src/plugins/builtin/econ/fred-catalog.ts +6 -3
  195. package/src/plugins/builtin/econ/index.tsx +5 -3
  196. package/src/plugins/builtin/econ/types.ts +5 -0
  197. package/src/plugins/builtin/equity-screener/footer.ts +45 -0
  198. package/src/plugins/builtin/equity-screener/pane.tsx +4 -18
  199. package/src/plugins/builtin/equity-screener/ticker-check.tsx +2 -1
  200. package/src/plugins/builtin/fixed-income/model.ts +1 -0
  201. package/src/plugins/builtin/futures/table.tsx +1 -1
  202. package/src/plugins/builtin/futures-curve/model.ts +3 -10
  203. package/src/plugins/builtin/help/function-card.tsx +2 -1
  204. package/src/plugins/builtin/help/function-index.ts +1 -0
  205. package/src/plugins/builtin/insider/client.ts +31 -14
  206. package/src/plugins/builtin/insider/signals-model.ts +2 -7
  207. package/src/plugins/builtin/iv-history/headless.ts +1 -2
  208. package/src/plugins/builtin/iv-history/model.ts +33 -23
  209. package/src/plugins/builtin/iv-history/screen-pane.tsx +0 -3
  210. package/src/plugins/builtin/kelly-sizer/headless.ts +64 -16
  211. package/src/plugins/builtin/kelly-sizer/history.ts +37 -28
  212. package/src/plugins/builtin/kelly-sizer/pane.tsx +43 -10
  213. package/src/plugins/builtin/kelly-sizer/sections.tsx +7 -2
  214. package/src/plugins/builtin/kelly-sizer/units.ts +29 -0
  215. package/src/plugins/builtin/news/index.tsx +7 -13
  216. package/src/plugins/builtin/news/overview-headlines.tsx +117 -0
  217. package/src/plugins/builtin/news/ticker-news.ts +35 -0
  218. package/src/plugins/builtin/news/wire/news/detail-view.tsx +8 -6
  219. package/src/plugins/builtin/news/wire/news/row.ts +49 -0
  220. package/src/plugins/builtin/news/wire/news/table.tsx +9 -20
  221. package/src/plugins/builtin/options/analytics.ts +7 -2
  222. package/src/plugins/builtin/options/live-quotes.ts +6 -1
  223. package/src/plugins/builtin/options/table.ts +3 -2
  224. package/src/plugins/builtin/options/view.tsx +11 -9
  225. package/src/plugins/builtin/options-scenario/client.ts +3 -0
  226. package/src/plugins/builtin/options-scenario/headless.ts +1 -1
  227. package/src/plugins/builtin/perps/client.ts +5 -4
  228. package/src/plugins/builtin/perps/headless.ts +134 -124
  229. package/src/plugins/builtin/perps/markets-section.tsx +2 -2
  230. package/src/plugins/builtin/perps/model.ts +8 -4
  231. package/src/plugins/builtin/perps/open-market.ts +4 -4
  232. package/src/plugins/builtin/perps/venue-markets.ts +3 -6
  233. package/src/plugins/builtin/portfolio-list/cell-version.ts +1 -0
  234. package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +34 -10
  235. package/src/plugins/builtin/portfolio-list/cli/period-report.ts +28 -2
  236. package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +7 -3
  237. package/src/plugins/builtin/portfolio-list/cli/render.ts +66 -22
  238. package/src/plugins/builtin/portfolio-list/grid.tsx +5 -3
  239. package/src/plugins/builtin/portfolio-list/pane/data.ts +34 -1
  240. package/src/plugins/builtin/portfolio-list/pane/index.tsx +6 -0
  241. package/src/plugins/builtin/portfolio-list/pane/streaming.ts +15 -6
  242. package/src/plugins/builtin/portfolio-list/quick-add/resolution.ts +19 -7
  243. package/src/plugins/builtin/portfolio-list/table.tsx +30 -4
  244. package/src/plugins/builtin/realized-vol/evidence.ts +33 -6
  245. package/src/plugins/builtin/realized-vol/fx-proxy.ts +135 -0
  246. package/src/plugins/builtin/realized-vol/headless.ts +44 -8
  247. package/src/plugins/builtin/realized-vol/model.ts +9 -5
  248. package/src/plugins/builtin/realized-vol/pane.tsx +49 -15
  249. package/src/plugins/builtin/sec/headless.ts +48 -6
  250. package/src/plugins/builtin/sec/index.tsx +6 -4
  251. package/src/plugins/builtin/sec/model.ts +4 -1
  252. package/src/plugins/builtin/shared/earnings-calendar.ts +2 -0
  253. package/src/plugins/builtin/shared/market-cap-bands.ts +12 -0
  254. package/src/plugins/builtin/shared/report-freshness.ts +3 -1
  255. package/src/plugins/builtin/shared/use-quote-board.ts +5 -3
  256. package/src/plugins/builtin/shared/volatility/options.ts +63 -2
  257. package/src/plugins/builtin/social-mentions/headless.ts +72 -3
  258. package/src/plugins/builtin/social-mentions/index.tsx +8 -4
  259. package/src/plugins/builtin/social-mentions/lock-note.ts +6 -2
  260. package/src/plugins/builtin/social-mentions/outliers-client.ts +101 -0
  261. package/src/plugins/builtin/social-mentions/outliers-model.ts +162 -0
  262. package/src/plugins/builtin/social-mentions/outliers-names.ts +51 -0
  263. package/src/plugins/builtin/social-mentions/outliers.tsx +276 -0
  264. package/src/plugins/builtin/social-mentions/pane.tsx +32 -3
  265. package/src/plugins/builtin/supply-chain/graph-pane.tsx +2 -2
  266. package/src/plugins/builtin/thirteenf/api.ts +36 -2
  267. package/src/plugins/builtin/thirteenf/data.ts +4 -1
  268. package/src/plugins/builtin/thirteenf/headless.ts +14 -6
  269. package/src/plugins/builtin/thirteenf/model.ts +56 -1
  270. package/src/plugins/builtin/thirteenf/pane.tsx +8 -8
  271. package/src/plugins/builtin/thirteenf/report-notes.ts +11 -0
  272. package/src/plugins/builtin/thirteenf/table.ts +2 -1
  273. package/src/plugins/builtin/thirteenf/types.ts +6 -0
  274. package/src/plugins/builtin/ticker-detail/data-panes/historical-prices.tsx +23 -3
  275. package/src/plugins/builtin/ticker-detail/financials/model.ts +5 -0
  276. package/src/plugins/builtin/ticker-detail/headless-schema.ts +2 -1
  277. package/src/plugins/builtin/ticker-detail/headless.ts +21 -66
  278. package/src/plugins/builtin/ticker-detail/index.tsx +5 -0
  279. package/src/plugins/builtin/ticker-detail/overview/components.tsx +13 -1
  280. package/src/plugins/builtin/ticker-detail/overview/model.ts +6 -4
  281. package/src/plugins/builtin/ticker-detail/overview/pane.tsx +15 -0
  282. package/src/plugins/builtin/ticker-detail/overview/tax-equivalent.ts +69 -0
  283. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +41 -6
  284. package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +47 -24
  285. package/src/plugins/builtin/ticker-detail/quote-monitor/export.ts +46 -0
  286. package/src/plugins/builtin/ticker-detail/quote-monitor/index.tsx +20 -1
  287. package/src/plugins/builtin/ticker-detail/quote-monitor/rows.ts +120 -0
  288. package/src/plugins/builtin/ticker-detail/research-tabs.ts +1 -5
  289. package/src/plugins/builtin/ticker-detail/settings.ts +6 -6
  290. package/src/plugins/builtin/treasury-auctions/cache.ts +85 -19
  291. package/src/plugins/builtin/treasury-auctions/index.tsx +22 -11
  292. package/src/plugins/builtin/treasury-auctions/model.ts +23 -0
  293. package/src/plugins/builtin/treasury-auctions/treasury-direct.ts +128 -0
  294. package/src/plugins/builtin/world-indices/client.ts +2 -0
  295. package/src/plugins/compat.ts +15 -0
  296. package/src/plugins/host-link.ts +6 -1
  297. package/src/plugins/installer.ts +8 -3
  298. package/src/portfolio/column-values.ts +14 -4
  299. package/src/portfolio/listed-symbol.ts +78 -0
  300. package/src/portfolio/real-return.ts +172 -0
  301. package/src/public/__snapshots__/public-api.test.ts.snap +1 -0
  302. package/src/renderers/browser/config-host.ts +56 -15
  303. package/src/renderers/browser/main.tsx +3 -1
  304. package/src/renderers/browser/ui-host.tsx +1 -0
  305. package/src/renderers/cloudflare/http-proxy.ts +1 -0
  306. package/src/renderers/dom/boot-frame.ts +2 -2
  307. package/src/renderers/dom/data-table/row.tsx +4 -1
  308. package/src/renderers/dom/desktop/controls.tsx +4 -4
  309. package/src/renderers/dom/desktop/dialog-actions.tsx +60 -41
  310. package/src/renderers/dom/dom-ui-host.tsx +3 -1
  311. package/src/renderers/dom/host/input.tsx +4 -1
  312. package/src/renderers/dom/host/tabs.tsx +10 -1
  313. package/src/renderers/dom/styles.css +33 -13
  314. package/src/renderers/electrobun/bun/desktop/app-name.ts +1 -1
  315. package/src/renderers/opentui/host.tsx +2 -1
  316. package/src/sources/gloomberb-cloud/fred-series.ts +12 -0
  317. package/src/sources/gloomberb-cloud/index.ts +31 -2
  318. package/src/sources/gloomberb-cloud/normalizers.ts +29 -3
  319. package/src/sources/provider-router/cached-routes.ts +19 -7
  320. package/src/state/pane-table-export-registry.ts +19 -6
  321. package/src/test-support/preload.ts +5 -1
  322. package/src/theme/colors.ts +9 -1
  323. package/src/theme/themes.ts +62 -15
  324. package/src/theme/tone-contrast.ts +40 -0
  325. package/src/theme/ui-tokens.ts +23 -3
  326. package/src/tickers/batched-lookups.ts +57 -8
  327. package/src/tickers/company-name-listing.ts +156 -14
  328. package/src/tickers/company-name.ts +30 -6
  329. package/src/tickers/list.ts +7 -0
  330. package/src/tickers/search/home-listing.ts +31 -9
  331. package/src/tickers/search/index.ts +13 -3
  332. package/src/tickers/search/listing-index.ts +558 -0
  333. package/src/tickers/search/major-listings.chunk.ts +10 -0
  334. package/src/tickers/search/major-listings.json +3346 -0
  335. package/src/tickers/search/ranking.ts +68 -1
  336. package/src/tickers/search/types.ts +4 -0
  337. package/src/tickers/terminal-codes.ts +26 -1
  338. package/src/time-series/calendar-month-returns.ts +47 -0
  339. package/src/time-series/currency-conversion.ts +130 -0
  340. package/src/time-series/hooks.ts +2 -0
  341. package/src/time-series/price-comparison.ts +34 -11
  342. package/src/time-series/resolve-context.ts +3 -0
  343. package/src/time-series/resolve.ts +14 -2
  344. package/src/time-series/spec.ts +1 -0
  345. package/src/time-series/studies/indicators.ts +4 -1
  346. package/src/time-series/types.ts +8 -0
  347. package/src/types/config.ts +8 -0
  348. package/src/types/data-provider.ts +28 -0
  349. package/src/types/financials.ts +20 -2
  350. package/src/types/headless.ts +12 -0
  351. package/src/ui/host.tsx +8 -0
  352. package/src/utils/datetime-format.ts +17 -3
  353. package/src/utils/display-number.ts +15 -0
  354. package/src/utils/double-escape-close.ts +61 -16
  355. package/src/utils/float32-price.ts +24 -0
  356. package/src/utils/forward-dividend.ts +81 -16
  357. package/src/utils/fx-market-hours.ts +11 -0
  358. package/src/utils/plugin-proxy-hosts.json +2 -1
  359. package/src/utils/price-history.ts +7 -6
  360. package/src/utils/report-timing.ts +62 -0
  361. package/src/utils/sec-filings.ts +32 -0
  362. package/src/utils/utc-time.ts +5 -0
@@ -15,12 +15,14 @@ import {
15
15
  type ListingVenue,
16
16
  } from "../tickers/listing-venues";
17
17
  import { findUsListingOfCompany, type UsListing } from "../tickers/us-listing";
18
- import { findListingOfCompanyName, isCompanyNameInput, marksAnotherListing, readTerminalCodeArg, serviceMarkedListing, type CompanyNameListing } from "../tickers/company-name-listing";
18
+ import {
19
+ findListingOfCompanyName, isCompanyNameInput, marksAnotherListing, readTerminalCodeArg, serviceMarkedListing, serviceMarkedOtherListing, type CompanyNameListing,
20
+ } from "../tickers/company-name-listing";
19
21
  import { movedAwayChange, startTickerChangeLookup, type MovedTickerChange } from "../tickers/ticker-changes";
20
22
  import { lineMayHaveMoved, listingChangeLine, loadListingFate, MovedSymbolError, SUCCESSOR_CHANGE_WAIT_MS, type ListingFate } from "../tickers/listing-fate";
21
23
  import { quotedListingName } from "../tickers/listing-name";
22
24
  import { cliStyles } from "../utils/cli-output";
23
- import { groupByCompany, namesDepositaryReceipt, sameCompany, sameListedName, shortCompanyName } from "../tickers/company-name";
25
+ import { companyNameExtraWords, groupByCompany, namesDepositaryReceipt, sameCompany, sameListedName, shortCompanyName } from "../tickers/company-name";
24
26
  import {
25
27
  canonicalExchange,
26
28
  exchangeCodeVenues,
@@ -42,7 +44,7 @@ import { dashedCoinPair, exchangeLineCoinListing, isSpotCommodityOrCurrencyPair,
42
44
  import { boardCoinFor, primeBoardCoins } from "./board-coins";
43
45
  import { knownGapMessage } from "./known-gaps";
44
46
  import { currencyPairSpelling } from "../utils/currency-pair";
45
- import { bareFuturesCode, futuresContractByCode } from "../market-data/futures-board";
47
+ import { bareFuturesCode, futuresContractByCode, futuresContractByWord, listedFuturesSymbol } from "../market-data/futures-board";
46
48
  import { classifyInstrumentType, kindFromListingSyntax } from "../tickers/instrument-kind";
47
49
  import type { InstrumentOfKind } from "../tickers/instrument-coverage";
48
50
  import { brokerIndexCode, brokerIndexReadAs } from "./index-roots";
@@ -54,6 +56,7 @@ import {
54
56
  isSearchOnlyVenue,
55
57
  readLondonDottedSymbol,
56
58
  readNearMissListing,
59
+ readVenueFirstListing,
57
60
  readTerminalListingCode,
58
61
  terminalCodeReadAs,
59
62
  unknownBloombergMarket,
@@ -63,6 +66,7 @@ import {
63
66
  import { listingAbroadVenue } from "../utils/sec";
64
67
  import { savedAbroadForBareSymbol, savedUsListingOf } from "../tickers/search/bare-symbol";
65
68
  import { listingSuffixCandidate, listingSuffixVenue, tickerHasListingSuffix } from "../sources/listing-symbols";
69
+ import { isCurrencyPairListing } from "../utils/fx-market-hours";
66
70
  import { coinElsewhereNote, notTheCoinNote } from "./commands/crypto-hints";
67
71
  import { fredSeriesArgument, fredSeriesNotListing } from "../series/fred-argument";
68
72
 
@@ -165,10 +169,11 @@ export function parseListingArg(
165
169
  // A pasted ticker can bring the separator or quote marks that sat beside it (`UPST;`); search would ask for them.
166
170
  const stripped = stripStrayEdges(rawArg);
167
171
  const raw = stripped.text || rawArg;
168
- // A terminal's code (WFC.N, "VOD LN", "JPM US Equity") is that listing (WFC:NYSE, VOD:LSE, JPM), and a symbol
169
- // written nearly as one is (700.HK, 6758.JP, BRK/B) its working form (0700.HK, 6758.T, BRK-B).
172
+ // A terminal's code (WFC.N, "VOD LN", "JPM US Equity") is that listing (WFC:NYSE, VOD:LSE, JPM), a symbol
173
+ // written nearly as one is (700.HK, 6758.JP, BRK/B) its working form (0700.HK, 6758.T, BRK-B), and one written
174
+ // venue first, as spreadsheets write it (TYO:7203, LON:LSEG), the symbol on that venue (7203:JPX, LSEG:LSE).
170
175
  const terminal = terminalCode === undefined ? readTerminalListingCode(raw) : terminalCode;
171
- const nearMiss = terminal ? null : readNearMissListing(raw);
176
+ const nearMiss = terminal ? null : readNearMissListing(raw) ?? (typedPerpetualListing(raw) ? null : readVenueFirstListing(raw));
172
177
  const reading = terminal ?? (nearMiss ? { typed: nearMiss.typed, key: nearMiss.symbol } : null);
173
178
  const parsed = parseCleanListingArg(reading?.key ?? raw, exchangeOption, { ownExchangeWins });
174
179
  const listing = listingSuffix ? readListingSuffix(parsed) ?? parsed : parsed;
@@ -221,6 +226,9 @@ function parseCleanListingArg(
221
226
  if (pair && !pair.ambiguous) return { symbol: pair.symbol, exchange: "", key: pair.symbol };
222
227
  const shared = isSharedExchangeCode(code) ? { sharedCode: code } : {};
223
228
  if (exchange) return { symbol: parsed.symbol, exchange, key: `${parsed.symbol}:${exchange}`, ...shared };
229
+ // A contract as CTM prints it is its listing: ETHX26 is ETHX26.CME, CLZ26 is CLZ26.NYM.
230
+ const listed = listedFuturesSymbol(parsed.symbol);
231
+ if (listed) return { symbol: listed, exchange: "", key: listed };
224
232
  // A futures board code no security uses is its future: TTF is TTF=F.
225
233
  const symbol = bareFuturesCode(parsed.symbol)?.symbol ?? parsed.symbol;
226
234
  return { symbol, exchange, key: symbol };
@@ -265,10 +273,11 @@ async function settleSharedCode(listing: ListingArg, deps: ListingDeps): Promise
265
273
  }
266
274
  const { exchange } = reading;
267
275
  const key = `${symbol}:${exchange}`;
268
- const readAs = [
269
- listing.readAs,
270
- exchange === meanings[0] ? null : `Read ${symbol}:${code} as ${key}: ${code} is ${venueChoices(meanings)}, and ${symbol} trades on ${exchange}.`,
271
- ].filter(Boolean).join(" ");
276
+ const why = exchange === meanings[0] ? "." : `: ${code} is ${venueChoices(meanings)}, and ${symbol} trades on ${exchange}.`;
277
+ // Written venue first (TSE:7203), one reading says where it went: "Read TSE:7203 as 7203:JPX: ...".
278
+ const typedAs = ` as ${symbol}:${code}.`;
279
+ const readAs = listing.readAs?.endsWith(typedAs) ? `${listing.readAs.slice(0, -typedAs.length)} as ${key}${why}`
280
+ : [listing.readAs, why === "." ? null : `Read ${symbol}:${code} as ${key}${why}`].filter(Boolean).join(" ");
272
281
  return { symbol, exchange, key, ...readAs ? { readAs } : {} };
273
282
  }
274
283
 
@@ -511,9 +520,16 @@ export async function listingChoiceNotes(
511
520
  // A bare symbol read on a company's own US line (JPM on NYSE) is what it means: companies abroad sharing the
512
521
  // letters are not named. A US receipt (SAN, Banco Santander's) may still be meant for another (Sanofi's SAN:EPA).
513
522
  if (!exchange || (isUsListingExchange(exchange) && quote.isDepositaryReceipt !== true)) return coin;
514
- const listed = await (venues ?? loadBareVenues(listing, deps) ?? []);
523
+ const [listed, marked] = await Promise.all([
524
+ venues ?? loadBareVenues(listing, deps) ?? [],
525
+ // A primary listing the service names by the word, off the venue picked: NTT is NTT, Inc. (9432 on JPX), not Warsaw's NTT.
526
+ serviceMarkedOtherListing(deps.dataProvider, listing.symbol, exchange).catch(logFailure("cli.listing-arg", "Read the listing a word names failed", null)),
527
+ ]);
515
528
  const note = listingChoiceNote(listing.symbol, { exchange, name: quote.name }, listed);
516
- return [...note ? [note] : [], ...coin];
529
+ const also = marked ? `also ${marked.symbol}:${marked.exchange} ${marked.name}` : null;
530
+ const named = quote.name?.trim() ? `${shortCompanyName(quote.name)}, ` : "";
531
+ const choice = also ? `${note ?? `${listing.symbol} = ${named}${exchangeName(exchange)}`}; ${also}` : note;
532
+ return [...choice ? [choice] : [], ...coin];
517
533
  }
518
534
 
519
535
  /**
@@ -581,8 +597,17 @@ export async function usListingsOnlyMessage(
581
597
  ): Promise<{ message: string; details: string }> {
582
598
  const quote = await loadListingQuote(deps.dataProvider, listing);
583
599
  const company = listingIdentity(listing, quote).name;
584
- const named = company ? `${shortCompanyName(company)} on ${exchangeLabel(listing.exchange)}` : exchangeLabel(listing.exchange);
585
- const us = await usListingOfCompany(listing, company, deps);
600
+ // A listing read from its vendor suffix (7203.T) or its quote has no venue typed: it is the one its quote is from.
601
+ const venue = canonicalExchange(listing.exchange || quote?.listingExchangeName || quote?.exchangeName || "");
602
+ const suffix = listing.exchange ? null : listingSuffixCandidate(listing.symbol);
603
+ const local = { symbol: suffix && canonicalExchange(suffix.exchange) === venue ? suffix.symbol : listing.symbol, exchange: venue };
604
+ // A currency pair has no listing anywhere: say what it is, never "GBP/USD on ." or the code of a venue.
605
+ if (isCurrencyPairListing(listing.symbol, venue)) {
606
+ return { message: `${what} covers US listings only, and ${listing.key} is a currency pair.`, details: "A currency pair trades over the counter, with no exchange volume to follow." };
607
+ }
608
+ const where = venue ? exchangeLabel(venue) : "";
609
+ const named = company ? `${shortCompanyName(company)}${where ? ` on ${where}` : ""}` : where || "not a US listing";
610
+ const us = await usListingOfCompany(local, company, deps);
586
611
  const owner = company ? shortCompanyName(company) : listing.key;
587
612
  const command = us ? retry(us.symbol) : null;
588
613
  return {
@@ -638,8 +663,9 @@ function retryCommand(request: Pick<ListingDataRequest, "command" | "retry">, ke
638
663
  * code a security keeps (GC, NG) when that security has no data: the future is
639
664
  * the other thing the code names. Null for any other symbol.
640
665
  */
641
- export function futuresTryLine(symbol: string, request: ListingDataRequest): string | null {
642
- const future = futuresContractByCode(symbol);
666
+ export function futuresTryLine(symbol: string, request: ListingDataRequest, { words = false }: { words?: boolean } = {}): string | null {
667
+ // With `words`, a commodity's word (BRENT, GOLD) names its future too, beside the securities that share it.
668
+ const future = futuresContractByCode(symbol) ?? (words ? futuresContractByWord(symbol) : null);
643
669
  if (!future) return null;
644
670
  const retry = retryCommand(request, future.symbol);
645
671
  return `${future.symbol} ${future.name} future${retry ? ` (try: ${retry})` : ""}`;
@@ -657,7 +683,8 @@ function describeOtherListings(
657
683
  /** Listings just asked that had none: named as having none, never offered to try. */
658
684
  without: readonly ListingVenue[] = [],
659
685
  ): OtherListingsMessage | null {
660
- const future = futuresTryLine(listing.symbol, request);
686
+ // BRENT's listings are two ETPs: Brent crude itself is the future BZ=F, offered beside them.
687
+ const future = futuresTryLine(listing.symbol, request, { words: true });
661
688
  const offered = others.filter((venue) => !without.includes(venue));
662
689
  if (offered.length === 0 && !future && without.length === 0) return null;
663
690
  const name = resolved?.name || listing.saved?.metadata.name?.trim() || "";
@@ -684,7 +711,7 @@ function describeOtherListings(
684
711
  : `${listing.symbol} resolved to ${name ? `${name} (${exchange})` : exchange}, which has no ${request.noun}.`,
685
712
  details,
686
713
  heading,
687
- listings: [...named.map((venue) => venueKey(listing.symbol, venue)), ...future ? [futuresContractByCode(listing.symbol)!.symbol] : []],
714
+ listings: [...named.map((venue) => venueKey(listing.symbol, venue)), ...future ? [(futuresContractByCode(listing.symbol) ?? futuresContractByWord(listing.symbol))!.symbol] : []],
688
715
  choices: offered.slice(0, MAX_OTHER_LISTINGS).map((venue) => ({ key: venueKey(listing.symbol, venue), name: venue.name || null })),
689
716
  choose,
690
717
  };
@@ -1447,6 +1474,39 @@ export async function serviceNamedCompany(typed: string, deps: Pick<ListingDeps,
1447
1474
  return companyListingArg(typed, found);
1448
1475
  }
1449
1476
 
1477
+ /** A word written as a company's name is (`Aeon`, `Panasonic`): a capital, then small letters, never a ticker's capitals. */
1478
+ const TITLE_CASE_WORD = /^\p{Lu}\p{Ll}[\p{L}&'’.-]*$/u;
1479
+
1480
+ /** Whether a word is written as a company's name is (`Aeon`), never as a ticker is (`AEON`, `aeon`). */
1481
+ export function isTitleCaseWord(text: string): boolean {
1482
+ return TITLE_CASE_WORD.test(text.trim());
1483
+ }
1484
+
1485
+ /**
1486
+ * A word written as a company's name (`Aeon`, not `AEON` or `aeon`) that is
1487
+ * also a ticker, read as the company named exactly that word whose home line
1488
+ * the service marks, when the ticker's company is named more than the word:
1489
+ * "Aeon" in a pasted book is Aeon Co., Ltd. (8267:JPX), not AEON Biopharma,
1490
+ * whose ticker it is ("Read "Aeon" as 8267:JPX (Aeon Co., Ltd.); the ticker
1491
+ * AEON is AEON Biopharma, Inc."). A word in capitals stays the ticker, and
1492
+ * so does one whose ticker's company bears the name (`Snap` is Snap Inc.).
1493
+ * Null otherwise, and when search names no such company or is too busy to say.
1494
+ */
1495
+ export async function titleCaseCompanyName(
1496
+ typed: string,
1497
+ ticker: { symbol: string; name: string | null | undefined },
1498
+ deps: Pick<ListingDeps, "dataProvider">,
1499
+ ): Promise<ListingArg | null> {
1500
+ const word = typed.trim();
1501
+ if (!TITLE_CASE_WORD.test(word) || companyNameExtraWords(word, ticker.name) === 0) return null;
1502
+ const found = await findOneWordCompany(word, deps);
1503
+ if (!found?.home || found.moved || companyNameExtraWords(word, found.name) !== 0) return null;
1504
+ const listing = companyListingArg(word, found);
1505
+ if (listing.key.toUpperCase() === ticker.symbol.toUpperCase()) return null;
1506
+ const owner = ticker.name?.trim().replace(/\.$/, "") || "another company";
1507
+ return { ...listing, readAs: `${listing.readAs!.replace(/\.$/, "")}; the ticker ${ticker.symbol.toUpperCase()} is ${owner}.` };
1508
+ }
1509
+
1450
1510
  /** The company `oneWordCompanyName` reads a word as, before it is read as a listing. */
1451
1511
  async function findOneWordCompany(typed: string, deps: Pick<ListingDeps, "dataProvider">): Promise<CompanyNameListing | null> {
1452
1512
  const word = typed.trim();
@@ -1,6 +1,6 @@
1
1
  import { logFailure } from "../utils/log-failure";
2
2
  import type { DataProvider } from "../types/data-provider";
3
- import { companyNameQueries, findListingOfCompanyName, isCompanyNameInput, readTerminalCodeArg } from "../tickers/company-name-listing";
3
+ import { companyNameQueries, findListingOfCompanyName, isCompanyNameInput, readTerminalCodeArg, settledTerminalCode } from "../tickers/company-name-listing";
4
4
  import { batchedListLookups } from "../tickers/batched-lookups";
5
5
  import { mapWithConcurrency } from "../utils/concurrency";
6
6
  import { isNotATickerMessage } from "./not-a-ticker";
@@ -38,7 +38,8 @@ export async function readNameEntryGroups(
38
38
  ): Promise<string[][]> {
39
39
  // A pasted list's names are searched in batches and their quotes asked together, a few entries at a time: a list
40
40
  // of hundreds of names is a few requests, never hundreds at once.
41
- const names = entries.filter((entry) => isCompanyNameInput(entry) && !unknownBloombergMarket(entry));
41
+ // A terminal's code abroad (`VOD LN`) is its listing as written: nothing searches for it as a name.
42
+ const names = entries.filter((entry) => isCompanyNameInput(entry) && !unknownBloombergMarket(entry) && !settledTerminalCode(entry));
42
43
  const full = source as DataProvider;
43
44
  const dataProvider = names.length > 1 && full.searchBatch
44
45
  ? (await batchedListLookups(full, names.map((name) => ({ searches: companyNameQueries(name), changes: null })))).dataProvider
@@ -1,3 +1,4 @@
1
+ import { futuresContractByWord } from "../market-data/futures-board";
1
2
  import { notATickerSymbol } from "../sources/provider-errors";
2
3
  import { boardCoinFor } from "./board-coins";
3
4
  import { currencyNameHint } from "./currency-name-hint";
@@ -54,8 +55,11 @@ export function withSearchHints(text: string, args: readonly string[], isFredSer
54
55
  const coin = boardCoinFor(id);
55
56
  if (coin) return `${sentence} Did you mean ${coin.symbol}${coin.name && coin.name.toUpperCase() !== coin.symbol ? ` (${coin.name})` : ""}?`;
56
57
  const tenor = treasuryYieldTenor(typed);
57
- // A currency's name (`yen`) is its rate and its pair, not a ticker search could find.
58
- return `${sentence} ${tenor ? treasuryYieldHint(tenor) : currencyNameHint(typed) ?? searchHint(typed)}`;
58
+ // A currency's name (`yen`) is its rate and its pair, not a ticker search could find; a commodity's word
59
+ // (`oil`, `brent`) is its future, which no search for the word finds first.
60
+ const future = futuresContractByWord(id);
61
+ const commodity = future ? `For ${future.name}, quote the future ${future.symbol}.` : null;
62
+ return `${sentence} ${tenor ? treasuryYieldHint(tenor) : currencyNameHint(typed) ?? commodity ?? searchHint(typed)}`;
59
63
  })
60
64
  : named;
61
65
  }
@@ -6,6 +6,7 @@ import type {
6
6
  PaneDef,
7
7
  PaneTemplateDef,
8
8
  } from "../../types/plugin";
9
+ import { spreadsheetOptionHint } from "../spreadsheet-hint";
9
10
 
10
11
  export type PaneFunctionReadiness = "ready" | "partial" | "live-dom" | "unsupported";
11
12
  type PaneFunctionScreenshotReadiness = PaneFunctionReadiness;
@@ -294,6 +295,14 @@ function normalizeOptionValue(
294
295
  return rawValue;
295
296
  }
296
297
 
298
+ /** A function's argument and options as they were typed (`^HSI,^TNX --range 1Y`), for a pointer to name the command. */
299
+ function typedFunctionArgs(argument: string | null | undefined, options: Record<string, string | true>): string[] {
300
+ return [
301
+ ...argument?.trim() ? [argument.trim()] : [],
302
+ ...Object.entries(options).flatMap(([key, value]) => value === true ? [optionFlag(key)] : [optionFlag(key), value]),
303
+ ];
304
+ }
305
+
297
306
  export function normalizeCapabilityOptions(
298
307
  capability: PaneFunctionCapability,
299
308
  options: Record<string, string | true>,
@@ -327,7 +336,9 @@ export function normalizeCapabilityOptions(
327
336
  }
328
337
  const supported = capability.options.map(({ key }) => optionFlag(key)).join(", ");
329
338
  throw new Error(
330
- `${settings.code ?? capability.id} does not support ${optionFlag(rawKey)}.${supported ? ` Supported options: ${supported}.` : " It has no options."}`,
339
+ [`${settings.code ?? capability.id} does not support ${optionFlag(rawKey)}.${supported ? ` Supported options: ${supported}.` : " It has no options."}`,
340
+ spreadsheetOptionHint(optionFlag(rawKey), `fn ${settings.code ?? capability.id}`, typedFunctionArgs(settings.argument, options))]
341
+ .filter(Boolean).join(" "),
331
342
  );
332
343
  }
333
344
  normalized[option.key] = normalizeOptionValue(option, rawValue, settings.argument);
@@ -19,6 +19,8 @@ const FUNCTION_DOCS_URL = "https://gloom.sh/docs/functions";
19
19
  export interface FunctionHelpKey {
20
20
  key: string;
21
21
  label: string;
22
+ /** The action's name, as its footer hint gives it, when the label is a whole word after a letter key. */
23
+ title?: string;
22
24
  }
23
25
 
24
26
  /** A function Free cannot fully open: Pro only, or a limited preview on Free. */
@@ -58,7 +60,7 @@ export function functionDocsUrl(code: string): string {
58
60
  return anchor ? `${FUNCTION_DOCS_URL}#${anchor}` : FUNCTION_DOCS_URL;
59
61
  }
60
62
 
61
- const key = (hotkey: string, label: string): FunctionHelpKey => ({ key: hotkey, label });
63
+ const key = (hotkey: string, label: string, title?: string): FunctionHelpKey => (title ? { key: hotkey, label, title } : { key: hotkey, label });
62
64
  const same = (value: string): FunctionFreshness => ({ free: value, pro: value });
63
65
 
64
66
  const DELAYED = "15 minutes delayed";
@@ -98,8 +100,9 @@ const CHART_KEYS = [key("s", "eries"), key("i", "ndicators"), key("b", "ars"), k
98
100
  export const FUNCTION_HELP: Readonly<Record<string, FunctionHelp>> = {
99
101
  // Research companies
100
102
  DES: {
101
- summary: "The starting point for any ticker: live quote, day and 52-week range, price chart, fundamentals, and tabs into every other research pane.",
102
- usage: ["DES NVDA"],
103
+ summary: "The starting point for any ticker: live quote, day and 52-week range, price chart, fundamentals, and tabs into every other research pane. "
104
+ + "A bond fund shows its SEC yield, yield to worst and duration beside its distribution yield; --tax-rate 40.8 adds a muni fund's tax-equivalent yield and muni/Treasury ratio.",
105
+ usage: ["DES NVDA", "DES MUB --tax-rate 40.8"],
103
106
  keys: [TABS, key(".", " go to tab")],
104
107
  data: QUOTES,
105
108
  bloomberg: ["DES"],
@@ -242,7 +245,7 @@ export const FUNCTION_HELP: Readonly<Record<string, FunctionHelp>> = {
242
245
  + "Grades: Value, Growth, Profitability, Momentum and Revisions, F to A+, each ranked within the sector, and their equal-weighted 1-5 composite labelled Top, Strong, Neutral, Weak or Bottom. "
243
246
  + "Ideas holds ready technical screens, Value, Quality and GARP, screens on the classic scores and Top grades. The pane menu saves the matches to a watchlist.",
244
247
  usage: ["EQS", "gloom fn EQS --preset golden-cross", "gloom fn EQS --preset quality", "gloom fn EQS --preset magic-formula", "gloom fn EQS --preset top-grades"],
245
- keys: [key("a", "dd criterion"), key("m", "etric"), key("t", "check ticker"), key("s", "ave screen"), key("o", "pen research")],
248
+ keys: [key("a", "dd criterion"), key("m", "etric"), key("t", "check ticker", "Check ticker"), key("s", "ave screen"), key("o", "pen research")],
246
249
  data: same("Daily snapshot, statements as filed"),
247
250
  bloomberg: ["EQS"],
248
251
  },
@@ -423,8 +426,9 @@ export const FUNCTION_HELP: Readonly<Record<string, FunctionHelp>> = {
423
426
  summary: "Cash distributions, trailing yield, the forward yield fundamentals show (the latest distribution annualized, or the declared one once announced), and payout growth. Future payments are not forecast. "
424
427
  + "For a bond fund these are distribution yields, not its SEC yield, which follows them with its date, yield to worst and duration. "
425
428
  + "--tax-rate 40.8 adds a muni fund's tax-equivalent yield, yield / (1 - (federal + state rate)) on the SEC yield (else the distribution yield), "
426
- + "and its muni/Treasury ratio against the GC tenor nearest its duration; --state-rate 13.3 --state CA counts only for a CA fund.",
427
- usage: ["DVD KO", "DVD MUB --tax-rate 40.8", "DVD CMF --tax-rate 40.8 --state-rate 13.3 --state CA"],
429
+ + "and its muni/Treasury ratio against the GC tenor nearest its duration; --state-rate 13.3 --state CA counts only for a CA fund. "
430
+ + "Several tickers rank in one table; with --tax-rate it adds yield to worst, duration, the tax-equivalent yield and the ratio.",
431
+ usage: ["DVD KO", "DVD MUB --tax-rate 40.8", "DVD CMF --tax-rate 40.8 --state-rate 13.3 --state CA", "DVD MUB VTEB SUB LQD --tax-rate 40.8"],
428
432
  keys: [STEP],
429
433
  data: same("Daily"),
430
434
  bloomberg: ["DVD"],
@@ -639,8 +643,8 @@ export const FUNCTION_HELP: Readonly<Record<string, FunctionHelp>> = {
639
643
  bloomberg: ["QR"],
640
644
  },
641
645
  BUZZ: {
642
- summary: "Daily posts on X naming the ticker's cashtag, the day's top posts and their stance.",
643
- usage: ["BUZZ TSLA"],
646
+ summary: "Daily posts on X naming the ticker's cashtag, the day's top posts and their stance. Alone it ranks the tickers by how far their posts jump above their own 30-day median, on the latest closed day or today so far, with stance and price move, filtered by posts and market cap.",
647
+ usage: ["BUZZ TSLA", "BUZZ"],
644
648
  keys: [OPEN, OPEN_SOURCE],
645
649
  data: same("Through the day"),
646
650
  bloomberg: [],
@@ -1082,8 +1086,9 @@ export const FUNCTION_HELP: Readonly<Record<string, FunctionHelp>> = {
1082
1086
  bloomberg: ["CF"],
1083
1087
  },
1084
1088
  ETF: {
1085
- summary: "A US-listed fund's facts, a leveraged or inverse fund's daily objective among them, then its own SEC filings: registration statements and prospectus updates, shareholder reports, N-CEN and N-PORT reports. Open any of them inline.",
1086
- usage: ["ETF SPY"],
1089
+ summary: "A US-listed fund's facts, a leveraged or inverse fund's daily objective and a bond fund's SEC yield, yield to worst and duration among them, then its own SEC filings: registration statements and prospectus updates, shareholder reports, N-CEN and N-PORT reports. Open any of them inline. "
1090
+ + "--tax-rate 40.8 adds a muni fund's tax-equivalent yield and muni/Treasury ratio, as DVD does.",
1091
+ usage: ["ETF SPY", "ETF MUB --tax-rate 40.8"],
1087
1092
  keys: [OPEN, OPEN_SOURCE],
1088
1093
  data: AS_FILED,
1089
1094
  bloomberg: [],
@@ -1165,7 +1170,7 @@ export const FUNCTION_HELP: Readonly<Record<string, FunctionHelp>> = {
1165
1170
  ALRT: {
1166
1171
  summary: "Your price alerts with current price, distance to target and trigger state, plus alerts on earnings, CPI and FOMC dates, filings and 13F, news keywords, analyst changes, 52-week highs and lows, unusual volume, short interest, insider and congress trades, catalysts, IV spikes, options flow and perps.",
1167
1172
  usage: ["ALRT"],
1168
- keys: [key("a", "dd alert"), key("e", "dit"), key("d", "elete"), key("m", "re-arm")],
1173
+ keys: [key("a", "dd alert"), key("e", "dit"), key("d", "elete"), key("m", "re-arm", "Re-arm")],
1169
1174
  data: QUOTES,
1170
1175
  bloomberg: ["ALRT"],
1171
1176
  },
@@ -1465,4 +1470,11 @@ export const FUNCTION_HELP: Readonly<Record<string, FunctionHelp>> = {
1465
1470
  data: null,
1466
1471
  bloomberg: [],
1467
1472
  },
1473
+ QUIT: {
1474
+ summary: "Quit Gloom from the command bar. EXIT does too; the browser app, which cannot close its tab, does not list it.",
1475
+ usage: ["QUIT"],
1476
+ keys: [],
1477
+ data: null,
1478
+ bloomberg: [],
1479
+ },
1468
1480
  };
@@ -815,7 +815,9 @@ export function headlessReportTables(
815
815
  // A line of its own period or release (a previous reading) names them rather than the section's.
816
816
  const own = (entry: HeadlessPaneEntry): ExportIdentity | undefined => {
817
817
  const identity = {
818
- ...(entry.unit?.trim() ? { currencyOrUnit: entry.unit.trim() } : {}),
818
+ // An export unit names a number's unit: a figure missing with its reason has none.
819
+ ...(entry.unit?.trim() ? { currencyOrUnit: entry.unit.trim() }
820
+ : entry.exportUnit?.trim() && typeof entry.value === "number" && Number.isFinite(entry.value) ? { currencyOrUnit: entry.exportUnit.trim() } : {}),
819
821
  ...(entry.period !== undefined ? { period: entry.period } : {}),
820
822
  ...(entry.released !== undefined ? { released: entry.released } : {}),
821
823
  ...(entry.asOf !== undefined ? { asOf: entry.asOf } : {}),
@@ -40,7 +40,7 @@ import { CLI_ERROR_CODE, failUnreachable, failWithError, isCliFailure, unreachab
40
40
  import { DATA_SERVICE_UNREACHABLE_MESSAGE, isNetworkFailure } from "../../utils/network-failure";
41
41
  import { isTickerLinkPeer } from "../../layout/ticker-navigation";
42
42
  import { knownGapMessage, commandPointer, commandPointerLeads, topicPointer } from "../known-gaps";
43
- import { selectReportTables, type CliReportTables } from "../report-tables";
43
+ import { selectReportTables, splitCsvFooter, type CliReportTables } from "../report-tables";
44
44
  import { cliOutputWritten, printCliResult, serializeCliResult, type CliErrorObject } from "../result";
45
45
  import { checkOutputPath, resolveOutputPath, writeOutputFile } from "../output-file";
46
46
  import type { CatalogCommandHit } from "../unknown-command";
@@ -319,6 +319,8 @@ export async function runPaneFunction(args: string[], ctx: CliCommandContext) {
319
319
  // A report that fails or comes back empty for an exchange the symbol is not listed on says so.
320
320
  // A report written to a file is drawn for it as it is built: no colour and no terminal width, as a redirect gets it.
321
321
  const buildReport = () => buildFunctionReport(resolved, context, parsed.arg);
322
+ // A report still loading after a few seconds (a chain the server reads cold) says so, so it never looks stuck.
323
+ const progress = progressNotice(ctx, [resolved.token, parsed.arg].filter(Boolean).join(" "), FN_PROGRESS_AFTER_MS);
322
324
  const report = await refuseMovedListing(fate, moved, () => withPersistedCloudSession(
323
325
  context,
324
326
  () => loadForListing(
@@ -328,7 +330,7 @@ export async function runPaneFunction(args: string[], ctx: CliCommandContext) {
328
330
  outputPath ? () => buildForFile(buildReport) : buildReport,
329
331
  (built) => built.data.empty || !built.data.complete,
330
332
  ),
331
- ));
333
+ )).finally(progress.stop);
332
334
  // A company's name typed where its ticker goes (`fn RDCF Palantir`) found nothing: the answer is `quote`'s,
333
335
  // "Not a ticker: PALANTIR. Did you mean PLTR (Palantir Technologies Inc.)?", not an empty report. A source that
334
336
  // could not answer for the word (a timeout) says nothing of it, but when search finds the company it is that.
@@ -374,7 +376,11 @@ export async function runPaneFunction(args: string[], ctx: CliCommandContext) {
374
376
  // A report with no data writes no file: a header alone would read as a screen that matched nothing. It fails
375
377
  // as plain --json fails, with its code and whether to retry.
376
378
  if (failure) failWithError({ ...failure, details: `Nothing was written to ${outputPath}.` });
377
- await writeOutputFile(outputPath, `${renderForFile(() => serializeCliResult(result, ctx.cliOptions, render))}\n`);
379
+ // A CSV file holds its rows alone; its closing source and note lines go to stderr, as printed CSV's do.
380
+ const written = renderForFile(() => serializeCliResult(result, ctx.cliOptions, render));
381
+ const { csv, footer } = ctx.cliOptions.format === "csv" ? splitCsvFooter(written) : { csv: written, footer: [] };
382
+ await writeOutputFile(outputPath, `${csv}\n`);
383
+ if (!ctx.cliOptions.quiet) for (const line of footer) console.error(line);
378
384
  // What was written and where; warnings go to stderr as they would beside printed rows, and JSON keeps its envelope.
379
385
  const saved = { output: outputPath, format: ctx.cliOptions.format, rows: report.data.rowCount };
380
386
  printCliResult({ data: saved, ...(warnings.length > 0 ? { warnings } : {}) },
@@ -426,6 +432,26 @@ export function emptySeriesExport(
426
432
  /** How long a capture's process may stay up after its output, for a report it stopped waiting for. */
427
433
  const STALLED_REPORT_EXIT_MS = 1_000;
428
434
 
435
+ /** A capture still going after this long says what it is doing, so it never looks stuck. */
436
+ const SHOT_PROGRESS_AFTER_MS = 3_000;
437
+ /** A report, which most often prints within this, says so only past it. */
438
+ const FN_PROGRESS_AFTER_MS = 5_000;
439
+
440
+ /**
441
+ * One line on standard error when a capture or report is slow: "Still loading
442
+ * the data for PORT izmir." while its data is read, "Still drawing PORT
443
+ * izmir." once a capture's page draws it. Nothing for a quick one, or with --quiet.
444
+ */
445
+ function progressNotice(ctx: Pick<CliCommandContext, "cliOptions">, label: string, afterMs = SHOT_PROGRESS_AFTER_MS): { drawing(): void; stop(): void } {
446
+ if (ctx.cliOptions.quiet) return { drawing: () => {}, stop: () => {} };
447
+ let drawing = false;
448
+ const timer = setTimeout(() => {
449
+ console.error(cliStyles.muted(drawing ? `Still drawing ${label}.` : `Still loading the data for ${label}.`));
450
+ }, afterMs);
451
+ (timer as { unref?: () => void }).unref?.();
452
+ return { drawing: () => { drawing = true; }, stop: () => clearTimeout(timer) };
453
+ }
454
+
429
455
  export async function runPaneScreenshot(args: string[], ctx: CliCommandContext) {
430
456
  let stalledReport = false;
431
457
  try {
@@ -455,6 +481,7 @@ async function capturePaneScreenshot(args: string[], ctx: CliCommandContext, onS
455
481
  const outputPath = parsed.outputPath
456
482
  ? resolve(process.cwd(), ensurePngExtension(parsed.outputPath))
457
483
  : defaultScreenshotPath(resolved, parsed.arg);
484
+ const progress = progressNotice(ctx, [resolved.token, parsed.arg].filter(Boolean).join(" "));
458
485
  const result = await renderDesktopShot({
459
486
  resolved,
460
487
  context,
@@ -469,7 +496,8 @@ async function capturePaneScreenshot(args: string[], ctx: CliCommandContext, onS
469
496
  fitRows: parsed.heightGiven !== true,
470
497
  options: parsed.options,
471
498
  onStalledReport,
472
- }).catch(async (error: unknown) => {
499
+ onDrawing: progress.drawing,
500
+ }).finally(progress.stop).catch(async (error: unknown) => {
473
501
  // A company's name typed where its ticker goes fails as `fn` words it, with the company search finds.
474
502
  const { quote, error: quoteError } = parsed.listing ? await loadListingQuoteAnswer(context.dataProvider, parsed.listing) : { quote: null, error: undefined };
475
503
  const stop = parsed.listing && !quote ? await notATickerStop(quoteError, parsed.listing, context) : null;
@@ -8,7 +8,7 @@ import {
8
8
  nextRegularSessionOpen,
9
9
  } from "../../market-data/market/freshness";
10
10
  import { futuresWeekendClosure } from "../../market-data/market/futures-week";
11
- import { currentFxClosureStart, isFxMarketOpen, isFxWeekClosePrint } from "../../utils/fx-market-hours";
11
+ import { currentFxClosureStart, isFxWeekClosePrint, nextFxWeekOpen } from "../../utils/fx-market-hours";
12
12
  import { zonedDateKey } from "../../utils/zoned-date-time";
13
13
  import type { ReportTime } from "../../utils/utc-time";
14
14
  import type { QuoteIndexSession } from "../../types/financials";
@@ -63,9 +63,14 @@ const US_EXCHANGE_TIME_ZONE = "America/New_York";
63
63
  function venueSession(exchange: string, marketState: string | undefined, now: number, calendar?: QuoteIndexSession): VenueSession | null {
64
64
  if (isAlwaysOpenExchange(exchange)) return { state: "always" };
65
65
  // Spot FX trades its week, Sunday 17:00 to Friday 17:00 New York, by the clock as an exchange rate's line has it.
66
- // A source's own state is not its week: Yahoo stamps a pair CLOSED from that open to London's midnight, which read
66
+ // A source's own state is not its week: a quote source stamps a pair CLOSED from that open to London's midnight, which read
67
67
  // `markets closed` beside `fx`'s `markets open` for the same pair.
68
- if (exchange === FX_VENUE) return { state: isFxMarketOpen(now) ? "open" : "closed" };
68
+ // Shut, it says when it reopens, as a futures venue's weekend does: the week's first trade, Sunday 17:00 New York.
69
+ if (exchange === FX_VENUE) {
70
+ const reopens = nextFxWeekOpen(now);
71
+ return reopens == null ? { state: "open" } : { state: "closed", timeZone: US_EXCHANGE_TIME_ZONE,
72
+ next: { date: zonedDateKey(reopens, US_EXCHANGE_TIME_ZONE), open: reopens, firstTrade: true } };
73
+ }
69
74
  const next = nextRegularSessionOpen(exchange, now);
70
75
  if (next) {
71
76
  const { timeZone } = next;
@@ -144,7 +144,7 @@ export function parsePaneFunctionArgsFor(
144
144
  args: string[],
145
145
  globalOptions: { limit?: number; tail?: number } = {},
146
146
  ): ParsedPaneFunctionArgs {
147
- const parsed = withOpeningWord(registry, withKeywordNote(registry, parsePaneFunctionArgs(args, globalOptions)));
147
+ const parsed = withKeywordNote(registry, withOpeningWord(registry, parsePaneFunctionArgs(args, globalOptions)));
148
148
  const found = parsed.target ? findPaneFunction(registry, parsed.target) : null;
149
149
  if (!found?.pane) return parsed;
150
150
  const capability = getPaneFunctionCapability(found.template, found.pane);
@@ -156,13 +156,15 @@ export function parsePaneFunctionArgsFor(
156
156
  }
157
157
 
158
158
  /**
159
- * A word that opens no function by its code but names one case of a function
160
- * (`discovery.opens`: `VX`, `vix futures`) runs that function on the case's
161
- * argument, and says so: `fn VX` is `fn CTM VIX`. A word typed with an
162
- * argument of its own keeps it.
159
+ * A word that opens no function by its code or name but names one case of a
160
+ * function (`discovery.opens`: `VX`, `vix futures`) runs that function on the
161
+ * case's argument, and says so: `fn VX` is `fn CTM VIX`, and `fn TVL` is
162
+ * `fn CRYP defi` though TVL is also one of CRYP's keywords. A word typed with
163
+ * an argument of its own keeps it.
163
164
  */
164
165
  function withOpeningWord(registry: PaneFunctionCatalog, parsed: ParsedPaneFunctionArgs): ParsedPaneFunctionArgs {
165
- if (!parsed.target || findPaneFunction(registry, parsed.target)) return parsed;
166
+ const found = parsed.target ? findPaneFunction(registry, parsed.target) : null;
167
+ if (!parsed.target || (found?.pane && namesFunction(found.template, found.pane, parsed.target))) return parsed;
166
168
  const wanted = normalizeLookupToken(parsed.target);
167
169
  for (const template of registry.paneTemplates.values()) {
168
170
  const pane = registry.panes.get(template.paneId);
@@ -185,15 +187,20 @@ function withKeywordNote(registry: PaneFunctionCatalog, parsed: ParsedPaneFuncti
185
187
  const found = parsed.target ? findPaneFunction(registry, parsed.target) : null;
186
188
  if (!found?.pane || !found.template) return parsed;
187
189
  const { template, pane } = found;
188
- const wanted = normalizeLookupToken(parsed.target);
189
- const headless = getHeadlessPaneDefinition(template, pane);
190
- const names = [template.shortcut?.prefix, ...template.shortcut?.aliases ?? [], template.id, template.label, pane.id, pane.name,
191
- headless?.discovery?.id, ...headless?.discovery?.aliases ?? []];
192
- if (names.some((name) => name && normalizeLookupToken(name) === wanted)) return parsed;
190
+ if (namesFunction(template, pane, parsed.target)) return parsed;
193
191
  const code = paneFunctionCode(template, pane);
194
192
  return { ...parsed, listingNotes: [...parsed.listingNotes ?? [], `${parsed.target} opened ${code}, ${template.label}.`] };
195
193
  }
196
194
 
195
+ /** Whether a word is the function's code, an alias or a name, rather than one of its keywords. */
196
+ function namesFunction(template: PaneTemplateDef | undefined, pane: PaneDef, word: string): boolean {
197
+ const wanted = normalizeLookupToken(word);
198
+ const headless = getHeadlessPaneDefinition(template, pane);
199
+ const names = [template?.shortcut?.prefix, ...template?.shortcut?.aliases ?? [], template?.id, template?.label, pane.id, pane.name,
200
+ headless?.discovery?.id, ...headless?.discovery?.aliases ?? []];
201
+ return names.some((name) => name && normalizeLookupToken(name) === wanted);
202
+ }
203
+
197
204
  /**
198
205
  * `fn ANR SAN --exchange EPA` is `fn ANR SAN:EPA`: a function that takes
199
206
  * tickers gets each listing as `quote` reads it (`resolveCliListing`), so
@@ -12,7 +12,10 @@ import { buildHeadlessPaneLoadArgs, loadResolvedHeadlessPaneModel, type LoadedHe
12
12
  import { resolve } from "path";
13
13
  import type { PaneRuntimeState } from "../../core/state/app/state";
14
14
  import { CHART_COMPOSER_PANE_ID, type AppConfig } from "../../types/config";
15
- import type { OptionsChain, TickerFinancials } from "../../types/financials";
15
+ import type { OptionsChain, PricePoint, TickerFinancials } from "../../types/financials";
16
+ import type { InstrumentRef } from "../../market-data/request-types";
17
+ import { fetchHistoryResult } from "../../sources/history-result";
18
+ import { calendarMonthReturnsRequest, trailingDailyClosesRequest } from "../../time-series/calendar-month-returns";
16
19
  import type { TickerRecord } from "../../types/ticker";
17
20
  import { slugifyName } from "../../utils/slugify";
18
21
  import { LIST_FINANCIALS_CONCURRENCY, mapWithConcurrency } from "../../utils/concurrency";
@@ -291,10 +294,14 @@ export async function buildDesktopShotPayload(
291
294
  ?? data.quote?.listingExchangeName
292
295
  ?? data.quote?.exchangeName
293
296
  ?? "";
294
- const fiveYearsDaily = resolved.pane.id === "realized-vol" || resolved.pane.id === "iv-history" || resolved.pane.id === "macro-day"
295
- // KELLY's History tab reads monthly returns off five years of daily closes.
296
- || resolved.pane.id === "kelly-sizer";
297
- if (fiveYearsDaily || resolved.pane.id === "iv-screen" || resolved.pane.id === "short-watch"
297
+ const fiveYearsDaily = resolved.pane.id === "realized-vol" || resolved.pane.id === "iv-history" || resolved.pane.id === "macro-day";
298
+ // KELLY's History tab reads monthly returns off the daily closes its own request names, from the month-end
299
+ // before the window, as the KELLY report does; a source with no dated history, its trailing range.
300
+ const kellyHistory = resolved.pane.id === "kelly-sizer"
301
+ ? await loadKellyShotHistory(context, entry.instrument, exchange, kellyShotYears(resolved)) : null;
302
+ if (kellyHistory) {
303
+ data = { ...data, priceHistory: kellyHistory };
304
+ } else if (fiveYearsDaily || resolved.pane.id === "kelly-sizer" || resolved.pane.id === "iv-screen" || resolved.pane.id === "short-watch"
298
305
  || resolved.pane.id === "backtest" || resolved.pane.id === OPTIONS_PANE_ID) {
299
306
  // Generic 5Y snapshots can contain weekly bars. The snapshot provider
300
307
  // treats captured history as authoritative, even for a later 1d request.
@@ -304,7 +311,8 @@ export async function buildDesktopShotPayload(
304
311
  }
305
312
  const priceHistory = await context.dataProvider.getPriceHistoryForResolution(
306
313
  entry.instrument.symbol, exchange,
307
- fiveYearsDaily ? "5Y" : resolved.pane.id === "backtest" ? "ALL" : "1Y",
314
+ resolved.pane.id === "kelly-sizer" ? trailingDailyClosesRequest(entry.instrument, kellyShotYears(resolved)).bufferRange
315
+ : fiveYearsDaily ? "5Y" : resolved.pane.id === "backtest" ? "ALL" : "1Y",
308
316
  "1d", toMarketDataContext(entry.instrument),
309
317
  );
310
318
  data = { ...data, priceHistory };
@@ -465,6 +473,28 @@ export async function buildDesktopShotPayload(
465
473
  export const COLLECTION_PANE_IDS = new Set(["portfolio-list", "analytics", "kelly-sizer", "earnings-calendar"]);
466
474
 
467
475
  /** The row saved for a listing key (0700:HKEX), under that key or bare on its venue; null when none is. */
476
+ /** KELLY's lookback: `--years` (checked against the function's bounds when read), else the function's default. */
477
+ function kellyShotYears(resolved: ResolvedPaneFunction): number {
478
+ return Number(resolved.options.years ?? findCapabilityOption(resolved.capability, "years")?.defaultValue ?? 5);
479
+ }
480
+
481
+ /**
482
+ * The daily closes KELLY's History tab asks for (`calendarMonthReturnsRequest`), from
483
+ * the month-end before its window. Captured history answers every request, so
484
+ * the trailing five years stood in for that window and gave 59 returns where
485
+ * the KELLY report reads 60. Null when the source answers no dated history:
486
+ * the trailing range is captured instead, as the pane falls back to it.
487
+ */
488
+ async function loadKellyShotHistory(
489
+ context: MarketContext, instrument: InstrumentRef, exchange: string, years: number,
490
+ ): Promise<PricePoint[] | null> {
491
+ const request = calendarMonthReturnsRequest({ symbol: instrument.symbol, exchange }, years);
492
+ const result = await fetchHistoryResult(context.dataProvider, instrument.symbol, exchange,
493
+ { kind: "detail", start: request.startDate!, end: request.endDate!, interval: request.barSize! }, toMarketDataContext(instrument))
494
+ .catch(logFailure("cli.pane-functions-screenshot-payload", "Read KELLY's dated daily closes failed", null));
495
+ return result?.points.length ? result.points : null;
496
+ }
497
+
468
498
  async function savedListing(context: MarketContext, key: string): Promise<TickerRecord | null> {
469
499
  const { symbol, exchange } = parsePublicTickerKey(key);
470
500
  const row = await context.store.loadTicker(key) ?? (exchange ? await context.store.loadTicker(symbol) : null);