gloomberb 0.19.5 → 0.20.0

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 (318) hide show
  1. package/LICENSE +0 -4
  2. package/package.json +6 -5
  3. package/patches/@opentui%2Fcore@0.3.2.patch +86 -25
  4. package/patches/electrobun-devkit@2.0.5.patch +148 -0
  5. package/src/api-client/bond-trades.ts +59 -0
  6. package/src/api-client/data.ts +21 -0
  7. package/src/api-client/equity-screener.ts +23 -0
  8. package/src/api-client/index.ts +2 -0
  9. package/src/api-client/types/account.ts +86 -0
  10. package/src/api-client/types/assist.ts +32 -0
  11. package/src/api-client/types/auth.ts +63 -0
  12. package/src/api-client/types/billing.ts +54 -0
  13. package/src/api-client/types/chat.ts +180 -0
  14. package/src/api-client/types/congress.ts +107 -0
  15. package/src/api-client/types/credit.ts +110 -0
  16. package/src/api-client/types/econ.ts +158 -0
  17. package/src/api-client/types/equity-diagnostic.ts +73 -0
  18. package/src/api-client/types/filings-and-calls.ts +350 -0
  19. package/src/api-client/types/index.ts +25 -0
  20. package/src/api-client/types/jobs.ts +147 -0
  21. package/src/api-client/types/market.ts +122 -0
  22. package/src/api-client/types/news.ts +91 -0
  23. package/src/api-client/types/notes-and-theses.ts +172 -0
  24. package/src/api-client/types/quotes.ts +28 -0
  25. package/src/api-client/types/scanners.ts +125 -0
  26. package/src/api-client/types/screener.ts +65 -0
  27. package/src/api-client/types/search.ts +107 -0
  28. package/src/api-client/types/sync.ts +14 -0
  29. package/src/api-client/types/team-collections.ts +43 -0
  30. package/src/api-client/types/team-views.ts +32 -0
  31. package/src/api-client/types/teams.ts +135 -0
  32. package/src/api-client/types/ticker-data.ts +57 -0
  33. package/src/api-client/types/tweets.ts +59 -0
  34. package/src/api-client/types/world-venues.ts +23 -0
  35. package/src/app/pane-runtime/index.tsx +2 -0
  36. package/src/app/pane-runtime/plugin-bindings.ts +10 -1
  37. package/src/app/runtime/desktop-deeplink.ts +41 -6
  38. package/src/app/star-prompt/status-line.tsx +1 -1
  39. package/src/app.tsx +64 -23
  40. package/src/architecture/ui-tokens-allowlist.json +0 -8
  41. package/src/cli/commands/market.ts +149 -10
  42. package/src/cli/commands/search.ts +21 -3
  43. package/src/cli/commands/ticker.ts +90 -36
  44. package/src/cli/desktop-pane-shot-browser.ts +69 -3
  45. package/src/cli/glossary.ts +3 -3
  46. package/src/cli/known-gaps.ts +8 -0
  47. package/src/cli/listing-arg.ts +12 -0
  48. package/src/cli/pane-functions/capabilities.ts +2 -0
  49. package/src/cli/pane-functions/catalog.ts +25 -5
  50. package/src/cli/pane-functions/function-help.ts +8 -5
  51. package/src/cli/pane-functions/headless.ts +4 -3
  52. package/src/cli/pane-functions/resolver.ts +75 -2
  53. package/src/cli/quote-answer.ts +9 -0
  54. package/src/cli/symbol-list.ts +54 -2
  55. package/src/cli/symbol-rows.ts +14 -2
  56. package/src/cli/ticker-resolution.ts +89 -20
  57. package/src/components/chart/composite/axis-overlays.tsx +60 -27
  58. package/src/components/chart/composite/composite-chart.tsx +118 -63
  59. package/src/components/chart/composite/cursor-source.ts +111 -0
  60. package/src/components/chart/composite/format.ts +168 -6
  61. package/src/components/chart/composite/legend.tsx +8 -4
  62. package/src/components/chart/composite/panel-labels.ts +20 -1
  63. package/src/components/chart/composite/panel-surface.tsx +201 -92
  64. package/src/components/chart/composite/price-axis-labels.tsx +92 -46
  65. package/src/components/chart/composite/price-series.ts +31 -8
  66. package/src/components/chart/composite/scene.ts +154 -59
  67. package/src/components/chart/composite/series-axis-tags.tsx +4 -2
  68. package/src/components/chart/composite/time-axis.ts +13 -5
  69. package/src/components/chart/composite/time-scale.ts +211 -56
  70. package/src/components/chart/composite/types.ts +11 -1
  71. package/src/components/chart/composite/use-composite-chart-keyboard.ts +43 -14
  72. package/src/components/chart/curve/curve-surface.tsx +5 -2
  73. package/src/components/chart/curve/model.ts +4 -1
  74. package/src/components/chart/native/use-bitmap-metrics.ts +81 -0
  75. package/src/components/chart/static/series.ts +3 -0
  76. package/src/components/command-bar/commands/collection-list.ts +81 -0
  77. package/src/components/command-bar/commands/direct/index.ts +6 -0
  78. package/src/components/command-bar/commands/registry.ts +8 -0
  79. package/src/components/command-bar/layout-items/current-layout.ts +22 -1
  80. package/src/components/command-bar/layout-items/focused-pane.ts +22 -1
  81. package/src/components/command-bar/pane-templates/items.ts +19 -3
  82. package/src/components/command-bar/pane-templates/workflow.ts +5 -0
  83. package/src/components/command-bar/routes/root/results.ts +23 -3
  84. package/src/components/command-bar/routes/root/selection.ts +4 -2
  85. package/src/components/command-bar/routes/root/shortcut-feedback.ts +1 -1
  86. package/src/components/command-bar/routes/root/shortcut-items.ts +3 -4
  87. package/src/components/command-bar/routes/root/shortcuts.ts +58 -14
  88. package/src/components/command-bar/routes/root/ticker-first.ts +32 -0
  89. package/src/components/command-bar/surface/environment.ts +2 -0
  90. package/src/components/command-bar/view-model.ts +7 -0
  91. package/src/components/command-bar/workflow/ops.ts +2 -1
  92. package/src/components/command-bar/workflow/tickers.ts +20 -0
  93. package/src/components/data-table/export.ts +4 -1
  94. package/src/components/layout/detached-pane-shell.tsx +10 -37
  95. package/src/components/layout/double-escape-close.ts +90 -0
  96. package/src/components/layout/header.tsx +3 -2
  97. package/src/components/layout/market-summary.ts +6 -3
  98. package/src/components/layout/pane/footer/index.tsx +2 -6
  99. package/src/components/layout/pane/footer/model.ts +6 -12
  100. package/src/components/layout/shell/active-drag.ts +53 -11
  101. package/src/components/layout/shell/drag/magnets.ts +128 -19
  102. package/src/components/layout/shell/menu.ts +15 -1
  103. package/src/components/layout/shell/pane/actions.ts +10 -2
  104. package/src/components/layout/shell/pane/management-shortcuts.ts +13 -51
  105. package/src/components/layout/shell/ticker-link-menu.ts +12 -3
  106. package/src/components/layout/status-bar.tsx +24 -78
  107. package/src/components/layout/status-widget-space.ts +5 -5
  108. package/src/components/onboarding/onboarding-keyboard.ts +5 -1
  109. package/src/components/onboarding/onboarding-wizard.tsx +15 -4
  110. package/src/components/onboarding/portfolio-step/positions-panel.tsx +9 -6
  111. package/src/components/onboarding/use-onboarding-progress.ts +20 -1
  112. package/src/components/price-sparkline/view.tsx +14 -6
  113. package/src/components/ticker/badge/index.tsx +8 -4
  114. package/src/components/ticker/badge/list.tsx +23 -7
  115. package/src/components/ui/column-grid.tsx +8 -2
  116. package/src/components/ui/data-table/index.tsx +5 -1
  117. package/src/components/ui/data-table/opentui/model.ts +4 -1
  118. package/src/components/ui/data-table/render-cell.ts +19 -0
  119. package/src/components/ui/delayed-mark.tsx +59 -7
  120. package/src/components/ui/icon.tsx +1 -8
  121. package/src/components/ui/menu.tsx +6 -1
  122. package/src/components/ui/tabs.tsx +5 -2
  123. package/src/core/state/app/layout.ts +18 -3
  124. package/src/core/state/app/state.ts +2 -0
  125. package/src/core/state/app/types.ts +5 -0
  126. package/src/data/config/layout.ts +3 -0
  127. package/src/data/config/store/normalize.ts +39 -4
  128. package/src/i18n/es.ts +13 -3
  129. package/src/i18n/ja.ts +13 -3
  130. package/src/i18n/ko.ts +13 -3
  131. package/src/i18n/zh-cn.ts +13 -3
  132. package/src/i18n/zh-tw.ts +13 -3
  133. package/src/layout/pane-manager/floating-placement.ts +7 -4
  134. package/src/layout/pane-manager/floating.ts +5 -2
  135. package/src/market-data/bond-funds.ts +19 -0
  136. package/src/market-data/futures-contract.ts +14 -3
  137. package/src/market-data/market/freshness.ts +18 -0
  138. package/src/market-data/market/status.ts +15 -2
  139. package/src/plugins/builtin/bond-calculator/headless.ts +2 -1
  140. package/src/plugins/builtin/bond-calculator/index.tsx +1 -1
  141. package/src/plugins/builtin/bond-calculator/model.ts +14 -5
  142. package/src/plugins/builtin/bond-calculator/pane.tsx +1 -1
  143. package/src/plugins/builtin/buildout/cells.tsx +25 -45
  144. package/src/plugins/builtin/buildout/detail/company.tsx +3 -3
  145. package/src/plugins/builtin/buildout/detail/index.tsx +1 -1
  146. package/src/plugins/builtin/buildout/detail/intel.tsx +4 -7
  147. package/src/plugins/builtin/buildout/detail/site.tsx +4 -4
  148. package/src/plugins/builtin/buildout/detail/ui.tsx +39 -38
  149. package/src/plugins/builtin/buildout/format.ts +23 -1
  150. package/src/plugins/builtin/buildout/model/types.ts +1 -0
  151. package/src/plugins/builtin/buildout/pane/index.tsx +2 -8
  152. package/src/plugins/builtin/buildout/table-model.ts +12 -4
  153. package/src/plugins/builtin/cds/headless.ts +1 -0
  154. package/src/plugins/builtin/cds/index.tsx +1 -1
  155. package/src/plugins/builtin/chat/content/composer.tsx +21 -27
  156. package/src/plugins/builtin/chat/content/index.tsx +31 -3
  157. package/src/plugins/builtin/chat/content/shortcuts.ts +4 -2
  158. package/src/plugins/builtin/chat/content/snapshot.ts +0 -3
  159. package/src/plugins/builtin/cloud/auth-actions.tsx +51 -23
  160. package/src/plugins/builtin/cloud/plugin.tsx +2 -0
  161. package/src/plugins/builtin/cloud/trial-offer-status-widget.tsx +3 -3
  162. package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +44 -12
  163. package/src/plugins/builtin/congress-trades/model.ts +2 -1
  164. package/src/plugins/builtin/congress-trades/pane.tsx +3 -0
  165. package/src/plugins/builtin/correlation/headless.ts +3 -2
  166. package/src/plugins/builtin/crypto-board/pane.tsx +5 -4
  167. package/src/plugins/builtin/custom-view/index.tsx +1 -1
  168. package/src/plugins/builtin/custom-view/loader.ts +85 -8
  169. package/src/plugins/builtin/custom-view/view-spec.ts +28 -0
  170. package/src/plugins/builtin/debt-maturities/headless.ts +11 -2
  171. package/src/plugins/builtin/debt-maturities/model.ts +66 -0
  172. package/src/plugins/builtin/debt-maturities/pane.tsx +23 -4
  173. package/src/plugins/builtin/earnings-ripple/pane.tsx +1 -1
  174. package/src/plugins/builtin/econ/calendar-model.ts +28 -6
  175. package/src/plugins/builtin/equity-screener/client.ts +1 -1
  176. package/src/plugins/builtin/equity-screener/criterion-editor.tsx +16 -19
  177. package/src/plugins/builtin/equity-screener/headless.ts +37 -3
  178. package/src/plugins/builtin/equity-screener/ideas.ts +67 -3
  179. package/src/plugins/builtin/equity-screener/model.ts +238 -27
  180. package/src/plugins/builtin/equity-screener/pane.tsx +88 -18
  181. package/src/plugins/builtin/equity-screener/screen-check.ts +7 -4
  182. package/src/plugins/builtin/equity-screener/watchlist.ts +33 -0
  183. package/src/plugins/builtin/executives/format.ts +5 -4
  184. package/src/plugins/builtin/executives/pane.tsx +1 -1
  185. package/src/plugins/builtin/futures-curve/client.ts +19 -0
  186. package/src/plugins/builtin/futures-curve/headless.ts +52 -13
  187. package/src/plugins/builtin/futures-curve/index.tsx +1 -1
  188. package/src/plugins/builtin/futures-curve/model.ts +77 -6
  189. package/src/plugins/builtin/futures-curve/pane.tsx +19 -3
  190. package/src/plugins/builtin/help/index.tsx +55 -1
  191. package/src/plugins/builtin/insider/model.ts +30 -2
  192. package/src/plugins/builtin/jobs/model.ts +2 -2
  193. package/src/plugins/builtin/macro-day/client.ts +41 -0
  194. package/src/plugins/builtin/macro-day/headless.ts +19 -9
  195. package/src/plugins/builtin/macro-day/model.ts +3 -1
  196. package/src/plugins/builtin/market-movers/index.tsx +4 -3
  197. package/src/plugins/builtin/mna/distress/headless.ts +1 -0
  198. package/src/plugins/builtin/mna/model.ts +2 -2
  199. package/src/plugins/builtin/notes/files.ts +2 -0
  200. package/src/plugins/builtin/notes/owner.tsx +20 -1
  201. package/src/plugins/builtin/notes/quick-notes-pane.tsx +22 -4
  202. package/src/plugins/builtin/notes/store.ts +6 -1
  203. package/src/plugins/builtin/perps/pane.tsx +3 -1
  204. package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +17 -0
  205. package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +2 -1
  206. package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +2 -1
  207. package/src/plugins/builtin/portfolio-list/header.tsx +1 -1
  208. package/src/plugins/builtin/rate-path/headless.ts +24 -10
  209. package/src/plugins/builtin/research/corporate-actions-pane.tsx +29 -25
  210. package/src/plugins/builtin/research/event-model.ts +10 -3
  211. package/src/plugins/builtin/research/events-headless.ts +20 -2
  212. package/src/plugins/builtin/sec/fund-facts.ts +17 -1
  213. package/src/plugins/builtin/sec/index.tsx +1 -1
  214. package/src/plugins/builtin/series-inventory.ts +1 -0
  215. package/src/plugins/builtin/shared/earnings-report.ts +7 -2
  216. package/src/plugins/builtin/shared/members-menu.tsx +103 -38
  217. package/src/plugins/builtin/shared/use-quote-board.ts +85 -46
  218. package/src/plugins/builtin/short-interest/headless.ts +1 -1
  219. package/src/plugins/builtin/short-interest/model.ts +15 -6
  220. package/src/plugins/builtin/short-interest/publications-model.ts +22 -1
  221. package/src/plugins/builtin/short-interest/publications-pane.tsx +13 -4
  222. package/src/plugins/builtin/short-interest/types.ts +2 -0
  223. package/src/plugins/builtin/short-interest/watch-model.ts +1 -1
  224. package/src/plugins/builtin/thirteenf/overlap-pane.tsx +3 -0
  225. package/src/plugins/builtin/thirteenf/pane.tsx +3 -0
  226. package/src/plugins/builtin/ticker-detail/overview/model.ts +5 -3
  227. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +4 -4
  228. package/src/plugins/builtin/time-sales/pane.tsx +3 -2
  229. package/src/plugins/builtin/trace-bonds/client.ts +7 -4
  230. package/src/plugins/builtin/trace-bonds/detail.tsx +198 -0
  231. package/src/plugins/builtin/trace-bonds/headless.ts +62 -4
  232. package/src/plugins/builtin/trace-bonds/history.ts +155 -0
  233. package/src/plugins/builtin/trace-bonds/index.tsx +1 -1
  234. package/src/plugins/builtin/trace-bonds/pane.tsx +64 -5
  235. package/src/plugins/builtin/volatility/client.ts +6 -1
  236. package/src/plugins/builtin/volatility/headless.ts +0 -1
  237. package/src/plugins/builtin/yield-curve/curves.ts +15 -0
  238. package/src/plugins/builtin/yield-curve/headless.ts +6 -1
  239. package/src/plugins/builtin/yield-curve/index.tsx +5 -8
  240. package/src/plugins/host-modules.ts +22 -3
  241. package/src/plugins/host-smoke.ts +6 -3
  242. package/src/plugins/installer.ts +16 -3
  243. package/src/plugins/plugin-names.ts +11 -2
  244. package/src/portfolio/collection-name.ts +19 -0
  245. package/src/remote/controller.ts +9 -2
  246. package/src/remote/schema.ts +2 -1
  247. package/src/renderers/browser/http-proxy-transport.ts +78 -8
  248. package/src/renderers/cloudflare/http-proxy.ts +73 -3
  249. package/src/renderers/cloudflare/proxy-session.ts +47 -24
  250. package/src/renderers/cloudflare/worker.ts +44 -4
  251. package/src/renderers/desktop/geometry.ts +279 -0
  252. package/src/renderers/desktop/screen-setup.ts +246 -0
  253. package/src/renderers/desktop/sequential-window-host.ts +179 -0
  254. package/src/renderers/desktop/test-utils.ts +71 -0
  255. package/src/renderers/desktop/window-controller.ts +433 -0
  256. package/src/renderers/desktop/window-host.ts +70 -0
  257. package/src/renderers/desktop/window-layouts.ts +630 -0
  258. package/src/renderers/dom/data-frames.ts +15 -4
  259. package/src/renderers/dom/desktop/icons.tsx +0 -2
  260. package/src/renderers/dom/styles.css +0 -3
  261. package/src/renderers/electrobun/bun/application-menu/click.ts +1 -0
  262. package/src/renderers/electrobun/bun/application-menu/index.ts +4 -1
  263. package/src/renderers/electrobun/bun/desktop/backend-requests.ts +19 -8
  264. package/src/renderers/electrobun/bun/desktop/backend.ts +320 -19
  265. package/src/renderers/electrobun/bun/desktop/detached-windows.ts +83 -61
  266. package/src/renderers/electrobun/bun/desktop/host-requests.ts +4 -14
  267. package/src/renderers/electrobun/bun/desktop/initialization.ts +30 -11
  268. package/src/renderers/electrobun/bun/desktop/install-records.ts +59 -0
  269. package/src/renderers/electrobun/bun/desktop/installer-folder.ts +208 -592
  270. package/src/renderers/electrobun/bun/desktop/macos-objc.ts +14 -0
  271. package/src/renderers/electrobun/bun/desktop/screen-setup-file.ts +55 -0
  272. package/src/renderers/electrobun/bun/desktop/state-broadcaster.ts +44 -8
  273. package/src/renderers/electrobun/bun/desktop/update.ts +1 -1
  274. package/src/renderers/electrobun/bun/desktop/workspace/index.ts +298 -97
  275. package/src/renderers/electrobun/bun/desktop/workspace/requests.ts +44 -6
  276. package/src/renderers/electrobun/bun/index.ts +22 -109
  277. package/src/renderers/electrobun/bun/window/create.ts +23 -3
  278. package/src/renderers/electrobun/bun/window/electrobun-window-host.ts +306 -0
  279. package/src/renderers/electrobun/bun/window/events.ts +4 -4
  280. package/src/renderers/electrobun/bun/window/focus.ts +0 -25
  281. package/src/renderers/electrobun/bun/window/frame.ts +2 -1
  282. package/src/renderers/electrobun/bun/window/native-min-size.ts +322 -0
  283. package/src/renderers/electrobun/bun/window/remembered-frame.ts +4 -82
  284. package/src/renderers/electrobun/shared/protocol.ts +44 -2
  285. package/src/renderers/electrobun/view/backend-rpc.ts +16 -1
  286. package/src/renderers/electrobun/view/desktop/window/bridge.ts +63 -3
  287. package/src/renderers/electrobun/view/main.tsx +13 -7
  288. package/src/series/fred-argument.ts +17 -0
  289. package/src/sources/gloomberb-cloud/index.ts +5 -7
  290. package/src/sources/provider-router/batches.ts +18 -3
  291. package/src/sources/provider-router/financial-routes.ts +7 -1
  292. package/src/sources/provider-router/financials.ts +18 -4
  293. package/src/state/app/context/index.tsx +16 -2
  294. package/src/state/desktop-windows.ts +63 -0
  295. package/src/sync/other-window-tabs.ts +62 -0
  296. package/src/tickers/company-name-listing.ts +23 -3
  297. package/src/tickers/listing-fate.ts +147 -1
  298. package/src/tickers/terminal-codes.ts +5 -0
  299. package/src/time-series/types.ts +6 -0
  300. package/src/types/config.ts +10 -1
  301. package/src/types/data-provider.ts +14 -0
  302. package/src/types/desktop-window.ts +71 -2
  303. package/src/types/financials.ts +19 -3
  304. package/src/types/headless.ts +21 -0
  305. package/src/types/plugin.ts +6 -0
  306. package/src/ui/index.tsx +14 -13
  307. package/src/ui/same-props.ts +58 -0
  308. package/src/utils/cli-output.ts +33 -4
  309. package/src/utils/double-escape-close.ts +38 -16
  310. package/src/utils/format.ts +30 -5
  311. package/src/utils/futures-generic.ts +12 -0
  312. package/src/utils/http-proxy-upstream.ts +6 -2
  313. package/src/utils/plugin-proxy-hosts.json +0 -4
  314. package/src/utils/plugin-proxy-hosts.ts +22 -0
  315. package/src/utils/price-earnings.ts +18 -0
  316. package/src/utils/sec-filings.ts +7 -1
  317. package/patches/electrobun@1.18.1.patch +0 -633
  318. package/src/api-client/types.ts +0 -2441
@@ -7,7 +7,7 @@ import {
7
7
  } from "../../utils/fundamentals";
8
8
  import { latestFinancialPeriod } from "../../utils/latest-financial-period";
9
9
  import { burnsCash, cashRunway, SHORT_RUNWAY_HISTORY, formatRunwayMonths, offeringNote, offeringsAfter, runwayMethod, type CashRunway, type OfferingFiling, type RunwayEstimate } from "../../utils/cash-runway";
10
- import { exportedFundamentals, formatPriceEarnings, NOT_MEANINGFUL, priceEarningsOnEarnings } from "../../utils/price-earnings";
10
+ import { exportedFundamentals, formatPriceEarnings, forwardFiscalYear, NOT_MEANINGFUL, priceEarningsOnEarnings } from "../../utils/price-earnings";
11
11
  import { describeFundamentalMarketCap, marketCapBasisNote, selectMarketCapitalization, viewMarketCapitalization, withheldMarketCap } from "../../utils/market-capitalization";
12
12
  import {
13
13
  formatCompact,
@@ -16,6 +16,7 @@ import {
16
16
  formatNumber,
17
17
  formatPercent,
18
18
  formatPercentRaw,
19
+ MISSING_VALUE,
19
20
  } from "../../utils/format";
20
21
  import { formatMarketCostWithCurrency, formatMarketPriceWithCurrency, formatMarketQuantity, quoteFormatOptions, withCurrencyMinorDigits, type MarketFormatOptions } from "../../market-data/market/format";
21
22
  import {
@@ -25,6 +26,7 @@ import {
25
26
  renderSection,
26
27
  renderStats,
27
28
  wrapText,
29
+ wrapToTerminal,
28
30
  type CliStatEntry,
29
31
  } from "../../utils/cli-output";
30
32
  import {
@@ -81,8 +83,8 @@ import {
81
83
  coinListingNotes, failIfNotTraded, failMovedSymbol, ListingArgError, listingChoiceNotes, listingFateLoader, listingIdentity, loadBareVenues,
82
84
  resolveCliListing, type CliListing, type ListingDataRequest,
83
85
  } from "../listing-arg";
84
- import { movedAwayChange } from "../../tickers/ticker-changes";
85
- import { listingChangeLine } from "../../tickers/listing-fate";
86
+ import { isUsSymbolVenue, movedAwayChange } from "../../tickers/ticker-changes";
87
+ import { listingChangeLine, loadNoQuoteLastTraded, noQuoteLastTradeNote, otherListingProfile, otherListingProfileNote } from "../../tickers/listing-fate";
86
88
  import { companyMemberships, loadCompanyMemberships, type CompanyMemberships, type ListMembership } from "../issuer-membership";
87
89
  import { isNotATickerMessage } from "../not-a-ticker";
88
90
  import { sharesOutstandingInReceipts } from "../../utils/depositary-receipt";
@@ -99,7 +101,7 @@ import { loadOfferingFilings, loadStatementFilings, resultsReleaseText, statemen
99
101
  import type { BankFiguresPayload } from "../../api-client/bank-figures";
100
102
  import { bankSection } from "../bank-section";
101
103
  import type { FundBondFacts, FundFactsPayload } from "../../api-client/fund-facts";
102
- import { bondFigures, NOT_SEC_YIELD } from "../../market-data/bond-funds";
104
+ import { bondFigures, durationDv01PerShare, formatDv01PerShare, NOT_SEC_YIELD } from "../../market-data/bond-funds";
103
105
  import { readFundFacts } from "../../market-data/fund-facts";
104
106
  import { taxEquivalentLines, type TaxEquivalentAnalysis } from "../../market-data/tax-equivalent";
105
107
  import { isRoundTheClockCoin } from "../../utils/crypto-pair";
@@ -646,7 +648,11 @@ function reportedDividendYield(
646
648
  * was last paid; a trailing one the twelve months it covers. A yield of no
647
649
  * stated basis is the figure alone.
648
650
  */
649
- function forwardYieldFigure(fundamentals: TickerFinancials["fundamentals"], distributions: DividendDistributions | null): MetricFigure {
651
+ function forwardYieldFigure(
652
+ fundamentals: TickerFinancials["fundamentals"],
653
+ distributions: DividendDistributions | null,
654
+ bond: FundBondFacts | null = null,
655
+ ): MetricFigure {
650
656
  const lapse = forwardYieldLapse(fundamentals, distributions);
651
657
  if (lapse) return { text: noCurrentDividend(lapse), value: null };
652
658
  const figure = percentFigure(reportedDividendYield(fundamentals, distributions), formatFractionPercentCell);
@@ -654,7 +660,9 @@ function forwardYieldFigure(fundamentals: TickerFinancials["fundamentals"], dist
654
660
  const basis = fundamentals.dividendYieldBasis === "forward"
655
661
  ? forwardDividendBasis(fundamentals.exDividendDate, { declared: distributions?.rows, currency: distributions?.currency })
656
662
  : fundamentals.dividendYieldBasis === "trailing" ? TRAILING_DIVIDEND_BASIS : null;
657
- return basis ? { ...figure, text: `${figure.text} (${basis})` } : figure;
663
+ // A bond fund's says first that it is not the SEC yield on the next line, which its label keeps short.
664
+ const said = [bond ? NOT_SEC_YIELD : null, basis].filter(Boolean).join("; ");
665
+ return said ? { ...figure, text: `${figure.text} (${said})` } : figure;
658
666
  }
659
667
 
660
668
  /**
@@ -673,13 +681,12 @@ export function exportedDividendFundamentals<T extends object & Pick<NonNullable
673
681
  }
674
682
 
675
683
  /**
676
- * `Dividend Yield (forward)`, or for a bond fund `Distribution Yield (forward,
677
- * not SEC yield)`: the cash it paid, annualized, which its SEC yield (the line
678
- * after it) is not.
684
+ * `Dividend Yield (forward)`, or for a bond fund `Distribution Yield
685
+ * (forward)`: the cash it paid, annualized, which its value says its SEC
686
+ * yield (the line after it) is not.
679
687
  */
680
688
  function dividendYieldLabel(basis: string | undefined, bond: FundBondFacts | null): string {
681
- if (bond) return `Distribution Yield (${basis ? `${basis}, ` : ""}${NOT_SEC_YIELD})`;
682
- return `Dividend Yield${basis ? ` (${basis})` : ""}`;
689
+ return `${bond ? "Distribution" : "Dividend"} Yield${basis ? ` (${basis})` : ""}`;
683
690
  }
684
691
 
685
692
  /** The labels a bond fund's sponsor figures print under, after its distribution yield. */
@@ -687,16 +694,21 @@ const BOND_METRIC_LABELS = { secYield: "30-Day SEC Yield", yieldToWorst: "Yield
687
694
 
688
695
  /**
689
696
  * A bond fund's 30-day SEC yield, yield to worst and duration as its sponsor
690
- * publishes them, each dated: `4.04% (as of 2026-10-15)`.
697
+ * publishes them, each dated: `4.04% (as of 2026-10-15)`, then the DV01 per
698
+ * share its duration gives at the regular session price.
691
699
  */
692
- function bondFundMetrics(bond: FundBondFacts | null): FundamentalsMetric[] {
700
+ function bondFundMetrics(bond: FundBondFacts | null, price: number | null): FundamentalsMetric[] {
693
701
  if (!bond) return [];
694
- return bondFigures(bond).map((figure) => ({
695
- label: figure.key === "duration" ? (bond.duration?.measure === "average" ? "Average Duration" : "Effective Duration") : BOND_METRIC_LABELS[figure.key],
696
- text: `${figure.text}${figure.date ? ` (as of ${figure.date})` : ""}`,
697
- value: figure.value,
698
- unit: figure.key === "duration" ? "years" : "%",
699
- }));
702
+ const dv01 = durationDv01PerShare(price, bond);
703
+ return [
704
+ ...bondFigures(bond).map((figure) => ({
705
+ label: figure.key === "duration" ? figure.label : BOND_METRIC_LABELS[figure.key],
706
+ text: `${figure.text}${figure.date ? ` (as of ${figure.date})` : ""}`,
707
+ value: figure.value,
708
+ unit: figure.key === "duration" ? "years" : "%",
709
+ })),
710
+ ...dv01 == null ? [] : [{ label: "DV01", text: `${formatDv01PerShare(dv01)} (from duration)`, value: dv01, unit: "USD per bp" }],
711
+ ];
700
712
  }
701
713
 
702
714
  /** Whether a metric is a yield line, which `valuation` keeps beside the multiples. */
@@ -750,16 +762,20 @@ function fundamentalsMetrics(
750
762
  { label: "Enterprise Value", ...enterpriseValueFigure(enterpriseValue, fundamentals) },
751
763
  // A multiple over a loss is N/M, even beside a positive one the source served from an older period.
752
764
  { label: "P/E (TTM)", ...multipleFigure(priceEarningsOnEarnings(fundamentals?.trailingPE, fundamentals?.eps)) },
753
- { label: "Forward P/E", ...multipleFigure(priceEarningsOnEarnings(fundamentals?.forwardPE, fundamentals?.forwardEps)) },
765
+ // Next fiscal year's consensus, named by its year: `Forward P/E FY27`.
766
+ {
767
+ label: forwardLabel(fundamentals),
768
+ ...multipleFigure(priceEarningsOnEarnings(fundamentals?.forwardPE, fundamentals?.forwardEps)),
769
+ },
754
770
  { label: "PEG", ...multipleFigure(fundamentals?.pegRatio) },
755
771
  // EPS (TTM) is the last four filed quarters' (filed-trailing-eps), so its twelve months can end before those of
756
772
  // the flows below, Gloom Cloud's trailing block; Gloom Cloud's EPS standing in is noted (trailingEpsSourceNote).
757
773
  { label: "EPS (TTM)", ...reportedMoney(fundamentals?.eps, fundamentals?.epsCurrency?.trim() || reportingCurrency, true, codes) },
758
774
  {
759
775
  label: dividendYieldLabel(fundamentals?.dividendYieldBasis, bond),
760
- ...forwardYieldFigure(fundamentals, distributions),
776
+ ...forwardYieldFigure(fundamentals, distributions, bond),
761
777
  },
762
- ...bondFundMetrics(bond),
778
+ ...bondFundMetrics(bond, regularSessionValuationPrice(quote)),
763
779
  { label: "Revenue (TTM)", ...reportedMoney(fundamentals?.revenue, reportingCurrency) },
764
780
  { label: "Net Income (TTM)", ...reportedMoney(fundamentals?.netIncome, reportingCurrency) },
765
781
  { label: "Operating Cash Flow (TTM)", ...reportedMoney(fundamentals?.operatingCashFlow, reportingCurrency) },
@@ -813,6 +829,22 @@ function floatAndShortInterestMetrics(
813
829
  ];
814
830
  }
815
831
 
832
+ /** Rows a company's earnings and accounts fill: a fund's report never shows them, whatever a provider sends for it. */
833
+ const STOCK_ONLY_METRICS = new Set(["Enterprise Value", "P/E (TTM)", "Forward P/E", "PEG", "EPS (TTM)", "Revenue (TTM)", "Net Income (TTM)",
834
+ "Operating Cash Flow (TTM)", "Free Cash Flow (TTM)", "Operating Margin", "Profit Margin", "Revenue Growth", "Last Quarter Growth"]);
835
+
836
+ function forwardLabel(fundamentals: TickerFinancials["fundamentals"]): string {
837
+ const year = forwardFiscalYear(fundamentals?.forwardEpsPeriodEnd);
838
+ return year ? `Forward P/E ${year}` : "Forward P/E";
839
+ }
840
+
841
+ /** A line's name without the fiscal year a forward figure names: `Forward P/E FY27` is Forward P/E. */
842
+ const metricName = (label: string) => label.replace(/ FY\d{2}$/, "");
843
+
844
+ function withoutStockRows<T extends { label: string }>(metrics: T[], fund: boolean): T[] {
845
+ return fund ? metrics.filter((metric) => !STOCK_ONLY_METRICS.has(metricName(metric.label))) : metrics;
846
+ }
847
+
816
848
  function metricLines(metrics: readonly FundamentalsMetric[]): Array<[string, string]> {
817
849
  return metrics.filter((metric) => !metric.exportOnly).map((metric) => [metric.label, metric.text]);
818
850
  }
@@ -963,13 +995,14 @@ function fundamentalsReportMetrics(snapshot: FundamentalsReportData, view: "fund
963
995
  const marketCap: MetricFigure = capitalization
964
996
  ? { text: `${formatCompact(capitalization.value)} ${capitalization.currency}`, value: capitalization.value, unit: capitalization.currency }
965
997
  : { text: "—" };
966
- const metrics = fundamentalsMetrics(quote, fundamentals, financials.profile, marketCap, computeTickerPriceReturns(financials), fundamentalsCurrency(financials),
967
- undefined, snapshot.distributions ?? null, snapshot.bondFund ?? null, snapshot.currencyCodes === true);
998
+ const metrics = withoutStockRows(fundamentalsMetrics(quote, fundamentals, financials.profile, marketCap, computeTickerPriceReturns(financials),
999
+ fundamentalsCurrency(financials), undefined, snapshot.distributions ?? null, snapshot.bondFund ?? null, snapshot.currencyCodes === true),
1000
+ resolveTickerInstrumentKind(null, financials) === "fund");
968
1001
  if (view === "fundamentals") {
969
1002
  return [...metrics, ...floatAndShortInterestMetrics(quote, fundamentals, financials.profile)]
970
1003
  .filter((metric) => metric.text !== "—");
971
1004
  }
972
- const valued = metrics.filter(({ label, text }) => (VALUATION_METRICS.has(label) || isYieldMetric(label)) && text !== "—");
1005
+ const valued = metrics.filter(({ label, text }) => (VALUATION_METRICS.has(metricName(label)) || isYieldMetric(label)) && text !== MISSING_VALUE);
973
1006
  // The share count follows the market cap it is the basis of.
974
1007
  const isShares = (label: string) => label === "Shares Outstanding" || label === "Shares Outstanding As Of";
975
1008
  const shares = valued.filter((metric) => isShares(metric.label));
@@ -988,10 +1021,11 @@ export function renderFundamentalsReport(
988
1021
  const symbol = quote?.symbol ?? financials.symbol;
989
1022
  const name = quote?.name && quote.name !== symbol ? ` ${cliStyles.bold(quote.name)}` : "";
990
1023
  const lines = [`${cliStyles.accent(symbol)}${name}`];
1024
+ const isFund = resolveTickerInstrumentKind(null, financials) === "fund";
991
1025
  const profileParts = [
992
1026
  financials.exchange ? exchangeLabel(financials.exchange) : undefined,
993
- profile?.sector ? `Sector ${profile.sector}` : undefined,
994
- profile?.industry ? `Industry ${profile.industry}` : undefined,
1027
+ !isFund && profile?.sector ? `Sector ${profile.sector}` : undefined,
1028
+ !isFund && profile?.industry ? `Industry ${profile.industry}` : undefined,
995
1029
  ].filter((part): part is string => !!part);
996
1030
  if (profileParts.length > 0) lines.push(cliStyles.muted(profileParts.join(METADATA_SEPARATOR)));
997
1031
 
@@ -1016,7 +1050,8 @@ export function renderFundamentalsReport(
1016
1050
  }
1017
1051
  appendDescription(lines, profile);
1018
1052
  }
1019
- return lines.join("\n");
1053
+ // A line wider than the terminal (a heading's venue and state, a note) wraps at it, as the stat blocks do.
1054
+ return lines.map(wrapToTerminal).join("\n");
1020
1055
  }
1021
1056
 
1022
1057
  /** What the Bank section reads from the rest of the report: the newest statement period, and the annual report form. */
@@ -1193,10 +1228,12 @@ export async function buildTickerReport({
1193
1228
  const instrumentType = instrumentTypeLabel(quote?.instrumentType?.trim()
1194
1229
  || financials.quoteMetadata?.instrumentType?.trim()
1195
1230
  || tickerFile?.metadata.assetCategory, name, { detail: true });
1231
+ // A fund has no sector or industry of its own, nor the earnings rows below.
1232
+ const isFund = resolveTickerInstrumentKind(tickerFile, financials) === "fund";
1196
1233
  const metadataParts = [
1197
1234
  instrumentType ? `Type ${instrumentType}` : undefined,
1198
- (tickerFile?.metadata.sector || profile?.sector) ? `Sector ${tickerFile?.metadata.sector || profile?.sector}` : undefined,
1199
- (tickerFile?.metadata.industry || profile?.industry) ? `Industry ${tickerFile?.metadata.industry || profile?.industry}` : undefined,
1235
+ !isFund && (tickerFile?.metadata.sector || profile?.sector) ? `Sector ${tickerFile?.metadata.sector || profile?.sector}` : undefined,
1236
+ !isFund && (tickerFile?.metadata.industry || profile?.industry) ? `Industry ${tickerFile?.metadata.industry || profile?.industry}` : undefined,
1200
1237
  ].filter((part): part is string => !!part);
1201
1238
  if (metadataParts.length > 0) {
1202
1239
  lines.push(cliStyles.muted(metadataParts.join(METADATA_SEPARATOR)));
@@ -1304,8 +1341,8 @@ export async function buildTickerReport({
1304
1341
 
1305
1342
  // A listing of the last year may have no statements yet: its IPO says how recent it is.
1306
1343
  const listing = { listedSince: ipo ? ipo.deal.listingDate ?? ipo.deal.firstDay?.session ?? null : null };
1307
- const metrics = fundamentalsMetrics(quote, priced.fundamentals, profile, { text: marketCapText }, priceReturns, fundamentalsCurrency(financials, listing),
1308
- { text: enterpriseValueText }, distributions, bondFund, codes);
1344
+ const metrics = withoutStockRows(fundamentalsMetrics(quote, priced.fundamentals, profile, { text: marketCapText }, priceReturns,
1345
+ fundamentalsCurrency(financials, listing), { text: enterpriseValueText }, distributions, bondFund, codes), isFund);
1309
1346
  const reportedCurrency = financials.financialCurrency?.trim();
1310
1347
  const statements = [...financials.annualStatements, ...financials.quarterlyStatements];
1311
1348
  const fallbackCurrency = reportedCurrency && statements.every((row) => !row.currency?.trim() || row.currency.trim() === reportedCurrency)
@@ -1384,7 +1421,8 @@ export async function buildTickerReport({
1384
1421
 
1385
1422
  await appendTickerPositions(lines, tickerFile, quote, config, toBase, rates);
1386
1423
 
1387
- return lines.join("\n");
1424
+ // A line wider than the terminal (a heading's venue and state, a note) wraps at it, as the stat blocks do.
1425
+ return lines.map(wrapToTerminal).join("\n");
1388
1426
  }
1389
1427
 
1390
1428
  function buildTickerStructuredData({
@@ -1531,6 +1569,11 @@ function depositaryPairJson(financials: TickerFinancials) {
1531
1569
  return { depositaryPair: { ...pair, side: receipt ? "receipt" : "home", text: depositaryPairText(pair, receipt) } };
1532
1570
  }
1533
1571
 
1572
+ /** The research a stopped listing shows when what came under its symbol is another listing's: its quote data alone. */
1573
+ function withoutResearch(financials: TickerFinancials): TickerFinancials {
1574
+ return { ...financials, profile: undefined, fundamentals: undefined, annualStatements: [], quarterlyStatements: [] };
1575
+ }
1576
+
1534
1577
  const QUOTE_UNAVAILABLE = "Quote unavailable.";
1535
1578
 
1536
1579
  /** Asks for the quote the report lacks once more, for the reason the data service gave when it had none. */
@@ -1676,7 +1719,17 @@ export async function ticker(symbol: string, dependencies: TickerCommandDependen
1676
1719
 
1677
1720
  // The quote is the feed in this report; without one, the fundamentals date it.
1678
1721
  const freshness = quote ? quotesFreshness([quote]) : fundamentalsFreshness(resolvedFinancials);
1679
- const quoteNote = quote ? undefined : await quoteUnavailableNote(dataProvider, requestSymbol, exchange);
1722
+ // A listing with no quote and no bar in over a month stopped trading: the line under its name says when.
1723
+ const lastTraded = quote ? null : await loadNoQuoteLastTraded({ symbol: requestSymbol, exchange }, dataProvider);
1724
+ // The profile under its symbol is another listing's only on evidence: another issuer's name, or one abroad.
1725
+ const otherProfile = lastTraded ? otherListingProfile(resolvedFinancials.profile, {
1726
+ usLine: isUsSymbolVenue(exchange),
1727
+ issuerNames: [tickerFile?.metadata.name, researchFate.change?.issuer, researchFate.formerIssuer?.name],
1728
+ }) : null;
1729
+ const quoteNote = lastTraded
1730
+ ? [`${noQuoteLastTradeNote(requestSymbol, lastTraded)}.`, otherProfile ? otherListingProfileNote(requestSymbol, otherProfile) : null]
1731
+ .filter(Boolean).join("\n")
1732
+ : quote ? undefined : await quoteUnavailableNote(dataProvider, requestSymbol, exchange);
1680
1733
  // A bare coin ticker read as another listing says where the coin is, as `quote` does: from the quote, else from the saved listing.
1681
1734
  const successor = listingChangeLine(researchFate);
1682
1735
  const choiceNotes = [
@@ -1687,8 +1740,9 @@ export async function ticker(symbol: string, dependencies: TickerCommandDependen
1687
1740
  ];
1688
1741
  const listingNote = choiceNotes.join("\n") || undefined;
1689
1742
  const memberships = await membershipsLoad;
1690
- // A converted TTM block at the rate the rest of the report converts at, the one `fx` reports.
1691
- const shownFinancials = await atReportTtmRate(resolvedFinancials, toBase);
1743
+ // A converted TTM block at the rate the rest of the report converts at, the one `fx` reports. A listing that
1744
+ // stopped trading shows none of the profile and figures another listing under its symbol was served with.
1745
+ const shownFinancials = await atReportTtmRate(otherProfile ? withoutResearch(resolvedFinancials) : resolvedFinancials, toBase);
1692
1746
  if (dependencies.printResult) {
1693
1747
  const newsNote = recentNews[0]?.searchedFor ? coinNewsFallbackNotice(requestSymbol, recentNews[0].searchedFor) : null;
1694
1748
  const warnings = [...choiceNotes, quoteNote, newsNote].filter((note): note is string => !!note);
@@ -15,6 +15,12 @@ import { logFailure } from "../utils/log-failure";
15
15
  * where other accounts could read it. Bun cannot hand a browser those pipes
16
16
  * on Windows yet, so there the browser listens on a local port for its
17
17
  * DevTools, as before, and is still told the page over the protocol.
18
+ *
19
+ * Chrome keeps its sandbox, which holds a page that goes wrong inside its
20
+ * renderer. It runs without one only where Chrome cannot have it: as root
21
+ * on Linux, which Chrome refuses, or on a Linux machine whose kernel does not
22
+ * let it build one (some containers), where Chrome says so as it fails to
23
+ * start and the capture starts it again without.
18
24
  */
19
25
 
20
26
  /** A DevTools command sent to the capture's page, and its result. */
@@ -142,7 +148,6 @@ const CHROME_ARGS = [
142
148
  // Software WebGL for GPU-drawn panes (the 3D volatility surface).
143
149
  "--use-angle=swiftshader",
144
150
  "--enable-unsafe-swiftshader",
145
- "--no-sandbox",
146
151
  "--disable-dev-shm-usage",
147
152
  "--disable-background-networking",
148
153
  "--disable-default-apps",
@@ -154,15 +159,44 @@ const CHROME_ARGS = [
154
159
  "--allow-file-access-from-files",
155
160
  ];
156
161
 
162
+ const NO_SANDBOX = "--no-sandbox";
163
+ /** What Chrome prints when it cannot start with its sandbox: run as root, or no kernel support for one. */
164
+ const SANDBOX_REFUSED = /No usable sandbox|Running as root without --no-sandbox/;
165
+ /** How much of Chrome's stderr a failed start keeps to tell why. */
166
+ const STDERR_KEPT_BYTES = 16_384;
167
+
168
+ /** Whether Chrome starts without its sandbox from the outset: as root on Linux, where it refuses one. */
169
+ export function startsWithoutSandbox(platform: NodeJS.Platform, uid: number | undefined): boolean {
170
+ return platform === "linux" && uid === 0;
171
+ }
172
+
173
+ /** Whether a Chrome that failed to start said it was for want of its sandbox. */
174
+ export function chromeSandboxRefused(stderr: string): boolean {
175
+ return SANDBOX_REFUSED.test(stderr);
176
+ }
177
+
157
178
  interface LaunchedChrome {
158
179
  connection: CdpConnection;
159
180
  stop(): Promise<void>;
181
+ /** The start of what the browser wrote to stderr, once it has exited. */
182
+ stderr(): Promise<string>;
160
183
  }
161
184
 
162
185
  /** Chrome with DevTools on fds 3 (to the browser) and 4 (from it): messages are JSON, each ended by a NUL. */
163
186
  function launchOverPipe(chrome: string, args: string[]): LaunchedChrome {
164
187
  const child = spawn(chrome, [...args, "--remote-debugging-pipe", "about:blank"], {
165
- stdio: ["ignore", "ignore", "ignore", "pipe", "pipe"],
188
+ stdio: ["ignore", "ignore", "pipe", "pipe", "pipe"],
189
+ });
190
+ // Read to the end, so a chatty browser never blocks on a full pipe; only the start is kept.
191
+ let stderrText = "";
192
+ const fromStderr = child.stderr!;
193
+ fromStderr.setEncoding("utf8");
194
+ fromStderr.on("data", (chunk: string) => {
195
+ if (stderrText.length < STDERR_KEPT_BYTES) stderrText += chunk.slice(0, STDERR_KEPT_BYTES - stderrText.length);
196
+ });
197
+ const stderrDone = new Promise<void>((resolve) => {
198
+ fromStderr.once("close", () => resolve());
199
+ fromStderr.once("error", () => resolve());
166
200
  });
167
201
  const toChrome = child.stdio[3] as Writable;
168
202
  const fromChrome = child.stdio[4] as Readable;
@@ -197,6 +231,11 @@ function launchOverPipe(chrome: string, args: string[]): LaunchedChrome {
197
231
  await exited;
198
232
  clearTimeout(timer);
199
233
  },
234
+ stderr: async () => {
235
+ await exited;
236
+ await Promise.race([stderrDone, new Promise((resolve) => setTimeout(resolve, 1_000))]);
237
+ return stderrText;
238
+ },
200
239
  };
201
240
  }
202
241
 
@@ -228,6 +267,8 @@ async function launchOverPort(chrome: string, args: string[], userDataDir: strin
228
267
  socket.close();
229
268
  await stop();
230
269
  },
270
+ // Windows gives Chrome its sandbox without kernel support to miss.
271
+ stderr: async () => "",
231
272
  };
232
273
  } catch (error) {
233
274
  await stop();
@@ -258,6 +299,8 @@ async function messageText(data: unknown): Promise<string> {
258
299
  return String(data);
259
300
  }
260
301
 
302
+ class ChromeSandboxRefusedError extends Error {}
303
+
261
304
  /**
262
305
  * Starts the capture browser with one blank page of `widthPx` by `heightPx`,
263
306
  * its profile in `userDataDir`. Nothing is loaded until `open`.
@@ -268,13 +311,36 @@ export async function launchShotBrowser(
268
311
  ): Promise<ShotBrowser> {
269
312
  await mkdir(options.userDataDir, { recursive: true });
270
313
  const args = [...CHROME_ARGS, `--user-data-dir=${options.userDataDir}`, `--window-size=${options.widthPx},${options.heightPx}`];
314
+ if (startsWithoutSandbox(process.platform, process.getuid?.())) return startShotBrowser(chrome, [...args, NO_SANDBOX], options);
315
+ try {
316
+ return await startShotBrowser(chrome, args, options);
317
+ } catch (error) {
318
+ if (!(error instanceof ChromeSandboxRefusedError)) throw error;
319
+ logFailure("cli.screenshot", "Chrome has no sandbox on this machine; capturing without it")(error);
320
+ return startShotBrowser(chrome, [...args, NO_SANDBOX], options);
321
+ }
322
+ }
323
+
324
+ async function startShotBrowser(
325
+ chrome: string,
326
+ args: string[],
327
+ options: { userDataDir: string },
328
+ ): Promise<ShotBrowser> {
271
329
  const launched = process.platform === "win32"
272
330
  ? await launchOverPort(chrome, args, options.userDataDir)
273
331
  : launchOverPipe(chrome, args);
274
332
  const { connection } = launched;
275
333
  try {
276
334
  // The first answer waits for the browser to start.
277
- await connection.send("Browser.getVersion", undefined, undefined, CHROME_START_TIMEOUT_MS);
335
+ try {
336
+ await connection.send("Browser.getVersion", undefined, undefined, CHROME_START_TIMEOUT_MS);
337
+ } catch (error) {
338
+ await launched.stop();
339
+ if (!args.includes(NO_SANDBOX) && chromeSandboxRefused(await launched.stderr())) {
340
+ throw new ChromeSandboxRefusedError("Chrome could not start with its sandbox.", { cause: error });
341
+ }
342
+ throw error;
343
+ }
278
344
  const { targetId } = await connection.send("Target.createTarget", { url: "about:blank" }) as { targetId: string };
279
345
  const { sessionId } = await connection.send("Target.attachToTarget", { targetId, flatten: true }) as { sessionId: string };
280
346
  const page: CdpPage = { send: (method, params) => connection.send(method, params, sessionId) };
@@ -605,10 +605,10 @@ export const GLOSSARY: readonly GlossaryEntry[] = [
605
605
  },
606
606
  {
607
607
  // SIW's Setup column prints these two words.
608
- term: "Crowded", aliases: ["crowded short", "crowded shorts", "crowded trade", "crowded, rising", "crowded rising", "setup"], functions: ["SIW"],
609
- shown: ["Crowded", "Crowded, rising"],
608
+ term: "Crowded", aliases: ["crowded short", "crowded shorts", "crowded trade", "crowded, rising", "crowded rising", "crowded, price rising", "px up", "setup"], functions: ["SIW"],
609
+ shown: ["Crowded", "Crowded, px up"],
610
610
  definition: "SIW's flag for a heavily shorted name: at least 10% of the float short, or five or more days to cover with at least 5% of the float short "
611
- + "(days to cover alone when the float is unknown). Crowded, rising adds a price up over the month. A fixed threshold, not a squeeze forecast.",
611
+ + "(days to cover alone when the float is unknown). Crowded, px up adds a share price up over the month (px is the price, not the short interest, which can be falling). A fixed threshold, not a squeeze forecast.",
612
612
  },
613
613
  {
614
614
  term: "Squeeze", aliases: ["short squeeze", "squeezes", "short covering"], functions: ["SIW"], shown: ["Short squeeze watch"],
@@ -209,6 +209,14 @@ const TOPIC_POINTERS: ReadonlyArray<{
209
209
  closest: ReadonlyArray<readonly [code: string, gives: string]>;
210
210
  }> = [
211
211
  BANK_FIGURES_TOPIC,
212
+ {
213
+ // CRPR's agency ratings are licensed by the agencies; the tape's grade of each bond is the nearest public read.
214
+ topic: "Agency credit ratings and rating history",
215
+ availability: "not carried (the agencies license them)",
216
+ phrases: ["crpr", "agency rating", "agency ratings", "credit rating history", "credit ratings history", "rating agency",
217
+ "rating agencies", "moody's rating", "moodys rating", "fitch rating"],
218
+ closest: [["TRACE", "each bond's grade, investment grade or high yield: gloom fn TRACE <ticker>"], ["CRD", "spreads by rating"]],
219
+ },
212
220
  {
213
221
  topic: "defense budget",
214
222
  phrases: ["defense budget", "defence budget", "defense spending", "defence spending", "dod", "department of defense",
@@ -45,6 +45,7 @@ import { bareFuturesCode, futuresContractByCode } from "../market-data/futures-b
45
45
  import { classifyInstrumentType, kindFromListingSyntax } from "../tickers/instrument-kind";
46
46
  import type { InstrumentOfKind } from "../tickers/instrument-coverage";
47
47
  import { brokerIndexCode, brokerIndexReadAs } from "./index-roots";
48
+ import { continuousAliasGeneric } from "../utils/futures-generic";
48
49
  import {
49
50
  bloombergCodeOf,
50
51
  bloombergMarketHint,
@@ -62,6 +63,7 @@ import { listingAbroadVenue } from "../utils/sec";
62
63
  import { savedAbroadForBareSymbol, savedUsListingOf } from "../tickers/search/bare-symbol";
63
64
  import { listingSuffixCandidate, listingSuffixVenue, tickerHasListingSuffix } from "../sources/listing-symbols";
64
65
  import { coinElsewhereNote, notTheCoinNote } from "./commands/crypto-hints";
66
+ import { fredSeriesArgument, fredSeriesNotListing } from "../series/fred-argument";
65
67
 
66
68
  /** The `--exchange` option of every command that takes a ticker. */
67
69
  export const EXCHANGE_OPTION = {
@@ -178,6 +180,10 @@ function parseCleanListingArg(
178
180
  // VIX.X and $VIX.X, a broker's code for an index, are its own symbol ^VIX; $VIX is read in `resolveCliListing`.
179
181
  const index = option ? null : brokerIndexCode(raw);
180
182
  if (index && !index.bare) return { symbol: index.symbol, exchange: "", key: index.symbol, readAs: brokerIndexReadAs(index) };
183
+ // VX=F, the continuous symbol VIX futures do not have, is the front generic VX1.
184
+ const generic = option ? null : continuousAliasGeneric(raw);
185
+ // It says so, as a name read as a bare symbol does: VX1 is not what was typed.
186
+ if (generic) return { symbol: generic, exchange: "", key: generic, readAs: `Read ${raw.trim().toUpperCase()} as ${generic}, the front VIX future.`, readFromName: true };
181
187
  // A perpetual's market id (binance:BZUSDT, as PERP names it) is its listing on that venue (BZUSDT:BINANCE).
182
188
  let typed = (typedPerpetualListing(raw)?.key ?? raw).trim().replace(/^\$/, "").toUpperCase();
183
189
  // `SAN:` asks which listing; with --exchange it has its answer.
@@ -1208,6 +1214,12 @@ export async function resolveCliListing(
1208
1214
  ): Promise<CliListing> {
1209
1215
  // "JPM US Equity" is Bloomberg's code for JPM; "Putnam US Equity", whose root is no US ticker, is a name.
1210
1216
  const typed = stripStrayEdges(raw).text || raw;
1217
+ // FRED:T10Y2Y is the series the catalog prints, never the symbol FRED on a venue called T10Y2Y.
1218
+ const fred = exchangeOption?.trim() ? null : fredSeriesArgument(typed);
1219
+ if (fred) {
1220
+ const { message, details } = fredSeriesNotListing(fred);
1221
+ throw new ListingArgError(message, details);
1222
+ }
1211
1223
  const read = await readTerminalCodeArg(deps.dataProvider, typed);
1212
1224
  // A company's name, an entry of a comma list (`WHR, Whirlpool Corporation`), is the listing search names for it.
1213
1225
  // A name before a legal form ("SAP SE", "SIEMENS AG") is looked up first: SE is also SIX Swiss's market code.
@@ -21,6 +21,8 @@ export interface PaneFunctionCapability {
21
21
  aliases: string[];
22
22
  /** Words that are no code but ask for this function's data: `fn` and `catalog` answer them with it. */
23
23
  suggestFor?: string[];
24
+ /** Words that open the function on one argument (`VX`: CTM VIX). */
25
+ opens?: ReadonlyArray<{ words: readonly string[]; argument: string }>;
24
26
  intents: string[];
25
27
  outputKind: string;
26
28
  reportReadiness: PaneFunctionReadiness;
@@ -1,6 +1,6 @@
1
1
  import { logFailure } from "../../utils/log-failure";
2
2
  import { commands as builtInCommands, getCommandPrefixes } from "../../components/command-bar/commands/registry";
3
- import type { PaneDef, PaneTemplateCreateOptions, PaneTemplateDef } from "../../types/plugin";
3
+ import type { HeadlessPaneDefinition, PaneDef, PaneTemplateCreateOptions, PaneTemplateDef } from "../../types/plugin";
4
4
  import type { MarketContext } from "../types";
5
5
  import {
6
6
  buildCreateOptions,
@@ -289,7 +289,7 @@ async function buildTemplateCatalogEntry(
289
289
  aliases: [...(template.shortcut?.aliases ?? [])],
290
290
  argKind: argument.kind,
291
291
  argPlaceholder: argument.placeholder,
292
- ...(headless?.argument.examples?.length ? { argExamples: headless.argument.examples } : {}),
292
+ ...argExamples(headless, context),
293
293
  ...(headless?.argument.kind === "tickers" && template.shortcut?.argKind === "ticker"
294
294
  ? { shotArgument: argumentHint({ argKind: "ticker", argPlaceholder: template.shortcut.argPlaceholder }) } : {}),
295
295
  keywords: template.keywords ?? [],
@@ -298,6 +298,20 @@ async function buildTemplateCatalogEntry(
298
298
  };
299
299
  }
300
300
 
301
+ /**
302
+ * The arguments a function's examples show past its placeholder: its own, and
303
+ * for a list of more than two symbols, a watchlist's name, which stands for
304
+ * its symbols (the reader's first watchlist).
305
+ */
306
+ function argExamples(headless: HeadlessPaneDefinition | undefined, context: MarketContext): { argExamples: readonly string[] } | null {
307
+ const own = headless?.argument.examples ?? [];
308
+ const argument = headless?.argument;
309
+ const list = (argument?.kind === "symbol-list" || argument?.kind === "tickers") && (argument.maximum == null || argument.maximum > 2);
310
+ const name = context.config.watchlists[0]?.name ?? "Watchlist";
311
+ const examples = list ? [...own, /^[\w.-]+$/.test(name) ? name : `'${name.replace(/'/g, "'\\''")}'`] : own;
312
+ return examples.length > 0 ? { argExamples: examples } : null;
313
+ }
314
+
301
315
  /**
302
316
  * The functions `gloom catalog` and search list. An unlisted one (`listed:
303
317
  * false`) is left out, and its pane is not listed in its place; `unlisted`
@@ -333,7 +347,7 @@ export async function buildPaneCatalogEntries(
333
347
  aliases,
334
348
  argKind: argument.kind,
335
349
  argPlaceholder: argument.placeholder,
336
- ...(pane.headless?.argument.examples?.length ? { argExamples: pane.headless.argument.examples } : {}),
350
+ ...argExamples(pane.headless, context),
337
351
  keywords: [],
338
352
  defaultSettings: {},
339
353
  capability: getPaneFunctionCapability(undefined, pane),
@@ -403,6 +417,7 @@ function nameAndDescriptionFields(entry: PaneCatalogEntry): string[] {
403
417
  ...entry.keywords,
404
418
  ...entry.capability.aliases,
405
419
  ...entry.capability.intents,
420
+ ...entry.capability.opens?.flatMap((opening) => opening.words) ?? [],
406
421
  ].filter((value): value is string => !!value).map((value) => value.toLowerCase());
407
422
  }
408
423
 
@@ -450,6 +465,7 @@ function scorePaneCatalogEntry(entry: PaneCatalogEntry, query: string): CatalogM
450
465
  entry.shortcut,
451
466
  ...entry.aliases,
452
467
  ...entry.capability.suggestFor ?? [],
468
+ ...entry.capability.opens?.flatMap((opening) => opening.words) ?? [],
453
469
  entry.templateId,
454
470
  entry.paneId,
455
471
  ].filter((value): value is string => !!value).map((value) => normalizeLookupToken(value));
@@ -459,7 +475,9 @@ function scorePaneCatalogEntry(entry: PaneCatalogEntry, query: string): CatalogM
459
475
  const flags = flagText(entry);
460
476
  const wholeQuery = query.toLowerCase().trim().replace(/\s+/g, " ");
461
477
  const called = identityFields(entry);
462
- const codes = [entry.token, entry.shortcut, ...entry.aliases].filter((value): value is string => !!value).map((value) => normalizeLookupToken(value));
478
+ // A word that opens one case of the function (CTM's `VX`) is typed as its code is.
479
+ const codes = [entry.token, entry.shortcut, ...entry.aliases, ...entry.capability.opens?.flatMap((opening) => opening.words) ?? []]
480
+ .filter((value): value is string => !!value).map((value) => normalizeLookupToken(value));
463
481
 
464
482
  let score = containsPhrase(`${named} ${flags}`, wholeQuery) ? 12 : 0;
465
483
  // A query that is one of the function's own keywords ("hedge" for OSA) beats one found inside a
@@ -717,7 +735,9 @@ function renderCatalogEntry(entry: PaneCatalogEntry): string {
717
735
  lines.push(...wrapCommandLine(`gloom fn ${invocation}`, width));
718
736
  for (const example of entry.argExamples ?? []) lines.push(...wrapCommandLine(`gloom fn ${entry.token} ${example}`, width));
719
737
  for (const option of capability.options) {
720
- if (option.example) lines.push(...wrapCommandLine(`gloom fn ${option.exampleWithoutArgument ? entry.token : invocation} ${option.example}`, width));
738
+ for (const example of [option.example, ...(option.examples ?? [])]) {
739
+ if (example) lines.push(...wrapCommandLine(`gloom fn ${option.exampleWithoutArgument ? entry.token : invocation} ${example}`, width));
740
+ }
721
741
  }
722
742
  }
723
743
  const shotInvocation = entry.shotArgument ? `${entry.token} ${entry.shotArgument}` : invocation;
@@ -237,8 +237,11 @@ export const FUNCTION_HELP: Readonly<Record<string, FunctionHelp>> = {
237
237
  summary: "Screen covered stocks on valuation, growth, margins, returns on capital, leverage, liquidity, volatility, technicals, float and ownership, short interest, insider activity and 13F holders, then rank the matches by any metric. "
238
238
  + "ATR% is the 14-session average true range as a percent of the last close. IV rank is a rank, not an IV percentile: 0 is the lowest 30-day implied volatility of the past 52 weeks and 100 the highest. IV percentile, IV30 change in vol points, HV20 and HV rank screen premium to sell. "
239
239
  + "Technical fields read the last completed session: RSI 14, price vs SMA 20, 50 and 200, trading days since a MACD or golden cross and since a new 20-day or 52-week high or low, and Bollinger width percentile (0 is a six-month squeeze). "
240
- + "ROIC, FCF yield, net debt / EBITDA, debt / equity and the revenue and EPS CAGRs read FA's bases, and forward growth EE's consensus; N/M where FA prints it. Ideas holds ready technical screens and Value, Quality and GARP.",
241
- usage: ["EQS", "gloom fn EQS --preset golden-cross", "gloom fn EQS --preset quality"],
240
+ + "ROIC, FCF yield, net debt / EBITDA, debt / equity and the revenue and EPS CAGRs read FA's bases, and forward growth EE's consensus; N/M where FA prints it. "
241
+ + "Classic scores: Piotroski F, Altman Z, the Graham number and Lynch fair value with their upside, Greenblatt's Magic Formula rank, the RS rating, years of profit, revenue and dividend growth, and S&P 500 and Dow membership. "
242
+ + "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
+ + "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
+ 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"],
242
245
  keys: [key("a", "dd criterion"), key("m", "etric"), key("t", "check ticker"), key("s", "ave screen"), key("o", "pen research")],
243
246
  data: same("Daily snapshot, statements as filed"),
244
247
  bloomberg: ["EQS"],
@@ -353,8 +356,8 @@ export const FUNCTION_HELP: Readonly<Record<string, FunctionHelp>> = {
353
356
  bloomberg: [],
354
357
  },
355
358
  MDAY: {
356
- summary: "Does this name care about CPI day? Its average move on CPI, jobs report and FOMC days against a normal day, the average signed move and share of up days, and the move on every release day.",
357
- usage: ["MDAY SPY"],
359
+ summary: "Does this name care about CPI day? Its average move on CPI, jobs report and FOMC days against a normal day, the average signed move and share of up days, and the move on every release day. Takes a FRED series too (FRED:T10Y2Y), whose moves in a rate or spread read in basis points.",
360
+ usage: ["MDAY SPY", "MDAY FRED:T10Y2Y"],
358
361
  keys: [],
359
362
  data: DAILY_CLOSES,
360
363
  bloomberg: [],
@@ -1039,7 +1042,7 @@ export const FUNCTION_HELP: Readonly<Record<string, FunctionHelp>> = {
1039
1042
  usage: ["CDS", "CDS F", "gloom fn CDS --sort 1m", "gloom fn CDS F --csv --section daily"],
1040
1043
  keys: [OPEN, STEP],
1041
1044
  data: same("Delayed, as trades are disseminated"),
1042
- bloomberg: ["CDS"],
1045
+ bloomberg: ["CDS", "CDSW"],
1043
1046
  },
1044
1047
  CDX: {
1045
1048
  summary: "CDX IG, HY and EM with iTraxx Main and Crossover on the run: the 5Y level, 1D, 1W and 1M moves, 1Y percentile and the day's print count. IG and iTraxx in spread, HY and EM in price. Naming an index opens the board on it, and `fn` adds its daily history. Sovereign CDS is the other tab.",