@gloom-sh/terminal 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
@@ -1,4 +1,5 @@
1
1
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
2
+ import { apiClient } from "../../../api-client";
2
3
  import { Box, Text, type InputRenderable, type TextareaRenderable } from "../../../ui";
3
4
  import { useShortcut } from "../../../react/input";
4
5
  import { isPlainKey } from "../../../utils/keyboard";
@@ -17,7 +18,15 @@ import {
17
18
  generateNoteId,
18
19
  type QuickNoteEntry,
19
20
  } from "./model";
20
- import { chooseNoteOwner, ownerColor, ownerLabel, resolveNoteConflict, useNoteTeams } from "./owner";
21
+ import {
22
+ chooseNoteOwner,
23
+ mayDeleteNote,
24
+ NOT_YOUR_NOTE,
25
+ ownerColor,
26
+ ownerLabel,
27
+ resolveNoteConflict,
28
+ useNoteTeams,
29
+ } from "./owner";
21
30
  import { NoteConflictError, type NoteOwner, noteOwnerKey, type NotesStoreRegistry } from "./store";
22
31
  import { useSyncedText } from "./text-state";
23
32
 
@@ -63,6 +72,10 @@ export function createQuickNotesPane(registry: NotesStoreRegistry) {
63
72
  const unreadableIndexRef = useRef(new Set<string>());
64
73
  const [indexError, setIndexError] = useState<{ message: string; owners: NoteOwner[] } | null>(null);
65
74
  const activeTab = tabs.find((tab) => tab.id === activeTabId);
75
+ // Closing a tab deletes its note, which a teammate's team note refuses.
76
+ const mayDelete = useCallback((tab: OwnedQuickNote) => (
77
+ mayDeleteNote(tab, teams, apiClient.getCurrentUser()?.id ?? null)
78
+ ), [teams]);
66
79
 
67
80
  const saveQuickNotesIndex = useCallback((entries: OwnedQuickNote[]) => {
68
81
  // Each owner keeps its own index; a title change only touches that store.
@@ -296,6 +309,10 @@ export function createQuickNotesPane(registry: NotesStoreRegistry) {
296
309
 
297
310
  const requestRemoveTab = useCallback(async (id: string) => {
298
311
  const tab = tabs.find((entry) => entry.id === id);
312
+ if (tab && !mayDelete(tab)) {
313
+ notify({ body: NOT_YOUR_NOTE, type: "info" });
314
+ return;
315
+ }
299
316
  const store = storeFor(tab?.owner ?? { kind: "user" });
300
317
  const text = id === activeTabId
301
318
  ? readActiveNoteText()
@@ -317,7 +334,7 @@ export function createQuickNotesPane(registry: NotesStoreRegistry) {
317
334
  }
318
335
 
319
336
  removeTab(id);
320
- }, [activeTabId, dialog, readActiveNoteText, removeTab, storeFor, tabs]);
337
+ }, [activeTabId, dialog, mayDelete, notify, readActiveNoteText, removeTab, storeFor, tabs]);
321
338
 
322
339
  const startRename = useCallback(() => {
323
340
  if (!activeTab) return;
@@ -404,7 +421,8 @@ export function createQuickNotesPane(registry: NotesStoreRegistry) {
404
421
 
405
422
  // Deleting the only note when it is empty just swaps in another empty one,
406
423
  // and a note that failed to load reads as empty, so it would go unconfirmed.
407
- const canDelete = !!activeTabId && !readError && (tabs.length > 1 || noteText.trim().length > 0);
424
+ const canDelete = !!activeTabId && !readError && (tabs.length > 1 || noteText.trim().length > 0)
425
+ && (!activeTab || mayDelete(activeTab));
408
426
 
409
427
  usePaneFooter("quick-notes", () => ({
410
428
  info: footerWarning
@@ -426,7 +444,7 @@ export function createQuickNotesPane(registry: NotesStoreRegistry) {
426
444
  label: tab.owner.kind === "team" ? `${ownerLabel(tab.owner, teams)} ${tab.title}` : tab.title,
427
445
  value: tab.id,
428
446
  ...(tab.owner.kind === "team" ? { fg: ownerColor(tab.owner, teams) } : {}),
429
- onClose: tabs.length > 1 ? (id: string) => { void requestRemoveTab(id); } : undefined,
447
+ onClose: tabs.length > 1 && mayDelete(tab) ? (id: string) => { void requestRemoveTab(id); } : undefined,
430
448
  onDoubleClick: startRenameTab,
431
449
  }));
432
450
  const selectTab = (id: string) => {
@@ -240,7 +240,12 @@ export class CloudNotesStore implements NotesStore {
240
240
  return [...index.values()]
241
241
  .filter((summary) => summary.kind === "quick")
242
242
  .sort((a, b) => a.createdAt.localeCompare(b.createdAt))
243
- .map((summary) => ({ id: summary.key, title: summary.title ?? "Note", updatedAt: Date.parse(summary.updatedAt) || undefined }));
243
+ .map((summary) => ({
244
+ id: summary.key,
245
+ title: summary.title ?? "Note",
246
+ updatedAt: Date.parse(summary.updatedAt) || undefined,
247
+ ...(summary.createdBy !== undefined ? { createdBy: summary.createdBy } : {}),
248
+ }));
244
249
  }
245
250
 
246
251
  /**
@@ -411,7 +411,9 @@ export function PerpsPane({ width, height, focused, marketAction }: Pick<PanePro
411
411
  }, [assetOnly, carried, compareAsset, marketTab, setSearch, setCompareAsset, setTab]);
412
412
  const openMarket = useCallback((row: PerpBoardRow, next: PerpTab = openingTab(row.marketId, access.hasProAccess)) => { setSearch(row.marketId); setTab(next); }, [setSearch, setTab, access.hasProAccess]);
413
413
  const openMarketId = useCallback((marketId: string) => { setSearch(marketId); setTab(openingTab(marketId, access.hasProAccess)); }, [setSearch, setTab, access.hasProAccess]);
414
- const { strip, rows: tabRows } = usePaneTabs({ tabs: PERP_TABS.map((value) => ({ value, label: label(value) })), activeValue: tab, onSelect: selectTab, focused, dense: true });
414
+ // Kept between board updates, so the tab strip skips the renders they give the pane.
415
+ const tabItems = useMemo(() => PERP_TABS.map((value) => ({ value, label: label(value) })), []);
416
+ const { strip, rows: tabRows } = usePaneTabs({ tabs: tabItems, activeValue: tab, onSelect: selectTab, focused, dense: true });
415
417
  const refreshMarket = useCallback(() => { void resource.reload(); }, [resource.reload]);
416
418
  useAutoRefresh(resource.updatedAt, resource.load, { intervalMs: 60_000 });
417
419
  usePaneRefreshKey(refreshMarket, { focused: focused && marketTab && !querySearch.active && (tab !== "history" || !active) });
@@ -237,6 +237,23 @@ export function retryNotice(ctx: CliCommandContext): (count: number, waitMs: num
237
237
  };
238
238
  }
239
239
 
240
+ /** A list this long says how far its lookup has got, so a long add never looks stuck. */
241
+ const PROGRESS_FROM = 50;
242
+ const PROGRESS_EVERY_MS = 5_000;
243
+
244
+ /**
245
+ * Lines on standard error while a long add looks its symbols up: "Looked up
246
+ * 120 of 300 symbols." every few seconds, and nothing for a short list.
247
+ */
248
+ export function progressNotice(ctx: CliCommandContext, now = () => Date.now()): (looked: number, total: number) => void {
249
+ let last = now();
250
+ return (looked, total) => {
251
+ if (ctx.cliOptions.quiet || total < PROGRESS_FROM || looked >= total || now() - last < PROGRESS_EVERY_MS) return;
252
+ last = now();
253
+ console.error(cliStyles.muted(`Looked up ${looked} of ${total} symbols.`));
254
+ };
255
+ }
256
+
240
257
  /**
241
258
  * The symbols an add or remove was given, failing the command when there are
242
259
  * none or the file cannot be read. An add reads a typed company's name with
@@ -74,7 +74,7 @@ import {
74
74
  requirePortfolio,
75
75
  takeCollectionName,
76
76
  } from "./shared";
77
- import { addOneSymbol, addSymbols, FILE_OPTION, printSymbolRows, removeSymbols, requireSymbolList, retryNotice, shellWord, SYMBOL_LIST_HELP } from "./bulk-symbols";
77
+ import { addOneSymbol, addSymbols, FILE_OPTION, printSymbolRows, progressNotice, removeSymbols, requireSymbolList, retryNotice, shellWord, SYMBOL_LIST_HELP } from "./bulk-symbols";
78
78
  import { readNameEntries } from "../../../../cli/name-entries";
79
79
  import { DRIP_DEFAULT_YEARS, DRIP_MAX_YEARS, parseDripYears, parseWithholding } from "../income";
80
80
 
@@ -263,6 +263,7 @@ async function addToPortfolioCommand(args: string[], file: string | undefined, e
263
263
  suggest: true,
264
264
  dryRun,
265
265
  onRetry: retryNotice(ctx),
266
+ onProgress: progressNotice(ctx),
266
267
  retry,
267
268
  add: (ticker) => addTickerToPortfolio(ticker, portfolio.id),
268
269
  });
@@ -22,7 +22,7 @@ import {
22
22
  } from "../../../../portfolio/mutations";
23
23
  import { showCollection } from "./render";
24
24
  import { listingFields, misplacedSymbolList, refuseDryRun, takeCollectionName } from "./shared";
25
- import { addOneSymbol, addSymbols, FILE_OPTION, printSymbolRows, removeSymbols, requireSymbolList, retryNotice, shellWord, SYMBOL_LIST_HELP } from "./bulk-symbols";
25
+ import { addOneSymbol, addSymbols, FILE_OPTION, printSymbolRows, progressNotice, removeSymbols, requireSymbolList, retryNotice, shellWord, SYMBOL_LIST_HELP } from "./bulk-symbols";
26
26
  import { readNameEntries } from "../../../../cli/name-entries";
27
27
  import { CLI_COMMAND_GROUPS } from "../../../../cli/help";
28
28
 
@@ -123,6 +123,7 @@ async function addToWatchlistCommand(args: string[], file: string | undefined, e
123
123
  store: market.store,
124
124
  dataProvider: market.dataProvider,
125
125
  onRetry: retryNotice(ctx),
126
+ onProgress: progressNotice(ctx),
126
127
  retry,
127
128
  suggest: true,
128
129
  dryRun,
@@ -55,7 +55,7 @@ export function PortfolioCashMarginDrawer({
55
55
  <Text fg={colors.textDim}>{" qty "}</Text>
56
56
  <Text fg={colors.text}>{padTo(formatMarketQuantity(balance.quantity, { isCashBalance: true, maxWidth: 14 }), 14, "right")}</Text>
57
57
  <Text fg={colors.textDim}>{" value "}</Text>
58
- <Text fg={colors.text}>{padTo(balance.baseValue != null ? formatCompact(balance.baseValue) : "—", 10, "right")}</Text>
58
+ <Text fg={colors.text}>{padTo(balance.baseValue != null ? formatCompact(balance.baseValue, { fixedDecimals: true }) : "—", 10, "right")}</Text>
59
59
  </Box>
60
60
  ))
61
61
  )}
@@ -1,4 +1,4 @@
1
- import type { RateMeeting } from "../../../api-client/rates";
1
+ import type { RateMeeting, RatePathPayload } from "../../../api-client/rates";
2
2
  import type { HeadlessPaneColumn, HeadlessPaneDefinition } from "../../../types/plugin";
3
3
  import { fetchRatePath } from "./client";
4
4
  import { meetingMoves, moveOddsText, movesPriced, movesText, rateText } from "./model";
@@ -25,8 +25,9 @@ const probabilities = (value: unknown) => {
25
25
  : outcomes.map((outcome) => `${outcome.targetMidpoint.toFixed(3)}% ${(outcome.probability * 100).toFixed(0)}%`).join(" / ");
26
26
  };
27
27
 
28
+ const STALE_COLUMN: HeadlessPaneColumn = { key: "stale", header: "Data stale", stackPriority: 2, format: yesNo };
28
29
  // A narrow terminal leaves out the sample count, status, percentile and quote time (the closing line has it),
29
- // then moves the staleness and month under each row.
30
+ // then moves the month under each row.
30
31
  const contractColumns: HeadlessPaneColumn[] = [
31
32
  { key: "symbol", header: "Symbol", shrink: false }, { key: "month", header: "Month", shrink: false, stackPriority: 1 },
32
33
  { key: "price", header: "Price", align: "right", format: (value) => finiteOrNull(value)?.toFixed(3) ?? "--" },
@@ -34,8 +35,17 @@ const contractColumns: HeadlessPaneColumn[] = [
34
35
  { key: "percentile", header: "Pctl 1Y", align: "right", stackPriority: 4, stackRows: 0, format: pctl },
35
36
  { key: "samples", header: "Samples", align: "right", stackPriority: 6, stackRows: 0 },
36
37
  { key: "asOf", header: "As of UTC", shrink: false, stackPriority: 3, stackRows: 0, format: timestamp },
37
- { key: "status", header: "Status", stackPriority: 5, stackRows: 0 }, { key: "stale", header: "Data stale", stackPriority: 2, format: yesNo },
38
+ { key: "status", header: "Status", stackPriority: 5, stackRows: 0 }, STALE_COLUMN,
38
39
  ];
40
+ /** The text says once which rows are stale, under the tables (`staleNote`), not "no" on every row; JSON keeps the column. */
41
+ const textColumns = (columns: HeadlessPaneColumn[]) => columns.filter((column) => column.key !== "stale");
42
+
43
+ /** "Stale: Effective fed funds rate, ZQX26.CBT.", naming each row whose figure is stale; null when none is. */
44
+ function staleNote(data: Pick<RatePathPayload, "current" | "fedFunds" | "sofr">): string | null {
45
+ const stale = [...Object.entries(data.current).filter(([, metric]) => metric.stale).map(([name]) => policyLabel(name)),
46
+ ...[...data.fedFunds, ...data.sofr].filter((contract) => contract.stale && contract.status !== "unavailable").map((contract) => contract.symbol)];
47
+ return stale.length ? `Stale: ${stale.join(", ")}.` : null;
48
+ }
39
49
 
40
50
  /**
41
51
  * How far the fed funds and SOFR futures quotes are held back. The rate-path
@@ -60,14 +70,17 @@ export const ratePathHeadless: HeadlessPaneDefinition<"bundle"> = {
60
70
  // (FRED) keep their own date and stale flag in their table, and the meetings are read from the contracts.
61
71
  const contracts = [...data.fedFunds, ...data.sofr].filter((contract) => contract.status !== "unavailable")
62
72
  .map(({ asOf, stale }) => ({ asOf, stale }));
73
+ const policyColumns: HeadlessPaneColumn[] = [
74
+ { key: "name", header: "Name", minWidth: 18, format: policyLabel }, { key: "value", header: "Value", align: "right", format: rate },
75
+ { key: "asOf", header: "As of", shrink: false }, { key: "percentile", header: "Pctl 1Y", align: "right", stackPriority: 1, format: pctl },
76
+ { key: "samples", header: "Samples", align: "right", stackPriority: 2, stackRows: 0 }, { key: "stale", header: "Data stale", format: yesNo },
77
+ ];
78
+ const stale = staleNote(data);
63
79
  return {
64
80
  freshness: { observedKey: "asOf", observations: contracts },
65
81
  sections: [
66
- { title: "Current policy", columns: [
67
- { key: "name", header: "Name", minWidth: 18, format: policyLabel }, { key: "value", header: "Value", align: "right", format: rate },
68
- { key: "asOf", header: "As of", shrink: false }, { key: "percentile", header: "Pctl 1Y", align: "right", stackPriority: 1, format: pctl },
69
- { key: "samples", header: "Samples", align: "right", stackPriority: 2, stackRows: 0 }, { key: "stale", header: "Data stale", format: yesNo },
70
- ], rows: Object.entries(data.current).map(([name, metric]) => ({ name, ...metric })) },
82
+ { title: "Current policy", columns: policyColumns, textColumns: textColumns(policyColumns),
83
+ rows: Object.entries(data.current).map(([name, metric]) => ({ name, ...metric })) },
71
84
  // A narrow terminal keeps the moves and change, prints the probabilities of the next two meetings
72
85
  // under their rows, and leaves out the rest; a reason a meeting has no rate stays under its row.
73
86
  { title: "FOMC meetings", columns: [
@@ -83,9 +96,10 @@ export const ratePathHeadless: HeadlessPaneDefinition<"bundle"> = {
83
96
  { key: "probabilities", header: "Probabilities", shrink: false, stackPriority: 4, stackRows: 2, format: probabilities },
84
97
  { key: "method", header: "Method", stackPriority: 9, stackRows: 0 }, { key: "reason", header: "Reason", stackPriority: 10 },
85
98
  ], rows: data.meetings.map((meeting) => ({ ...meeting, moves: movesPriced(meeting), moveOdds: moves.get(meeting.date) ?? null })) },
86
- { title: "Fed funds contracts", columns: contractColumns, rows: data.fedFunds.map((contract) => ({ ...contract })) },
87
- { title: "SOFR contracts", columns: contractColumns, rows: data.sofr.map((contract) => ({ ...contract })) },
99
+ { title: "Fed funds contracts", columns: contractColumns, textColumns: textColumns(contractColumns), rows: data.fedFunds.map((contract) => ({ ...contract })) },
100
+ { title: "SOFR contracts", columns: contractColumns, textColumns: textColumns(contractColumns), rows: data.sofr.map((contract) => ({ ...contract })) },
88
101
  ],
102
+ ...(stale ? { notes: [stale] } : {}),
89
103
  errors: data.gaps,
90
104
  metadata: { ...data, probabilityBasis: data.probabilityAssumption, units: "percent", complete: data.status === "available" },
91
105
  };
@@ -141,15 +141,20 @@ export function matchEarningsSecFiling(row: { status: string; date: string; date
141
141
  return best?.filing ?? null;
142
142
  }
143
143
 
144
- /** Share the currency label; EE marks any unstated currencies separately. */
145
- function sharedMetricCurrency(rows: readonly EventRow[], allowUnstated = false): string | undefined {
146
- const currencies = new Set<string | undefined>();
144
+ /**
145
+ * The one currency every stated EPS and revenue amount is in, named once above
146
+ * the table (EVT and EE alike). An amount whose source stated no currency is
147
+ * marked `?` beside it rather than counted, so it never reads as that currency;
148
+ * amounts in several currencies keep their own codes.
149
+ */
150
+ function sharedMetricCurrency(rows: readonly EventRow[]): string | undefined {
151
+ const currencies = new Set<string>();
147
152
  for (const row of rows) {
148
153
  for (const [value, currency] of [
149
154
  [row.qEps, row.epsCurrency], [row.annualEps, row.epsCurrency],
150
155
  [row.qRevenue, row.revenueCurrency], [row.annualRevenue, row.revenueCurrency],
151
156
  ] as const) {
152
- if (value != null && Number.isFinite(value) && (currency || !allowUnstated)) currencies.add(currency || undefined);
157
+ if (value != null && Number.isFinite(value) && currency) currencies.add(currency);
153
158
  }
154
159
  }
155
160
  const [only] = currencies;
@@ -169,15 +174,14 @@ export function buildEventColumns(width: number, unit?: string, variant: "corpor
169
174
  { id: "detail", label: "DETAIL", width: 9, align: "left", flexGrow: 1 },
170
175
  ], width, ["detail", "growth", "revenue"]);
171
176
  }
172
- const withUnit = (label: string) => unit ? `${label} ${unit}` : label;
173
177
  const columns: EventColumn[] = [
174
178
  { id: "date", label: "DATE", width: 10, align: "left" },
175
179
  { id: "status", label: "EVENT", width: 8, align: "left" },
176
180
  { id: "period", label: "PERIOD", width: 12, align: "left" },
177
- { id: "qEps", label: withUnit("Q EPS"), width: 12, align: "right" },
178
- { id: "qRevenue", label: withUnit("Q REV"), width: 12, align: "right" },
179
- { id: "annualEps", label: withUnit("ANN EPS"), width: 12, align: "right" },
180
- { id: "annualRevenue", label: withUnit("ANN REV"), width: 12, align: "right" },
181
+ { id: "qEps", label: "Q EPS", width: 12, align: "right" },
182
+ { id: "qRevenue", label: "Q REV", width: 12, align: "right" },
183
+ { id: "annualEps", label: "ANN EPS", width: 12, align: "right" },
184
+ { id: "annualRevenue", label: "ANN REV", width: 12, align: "right" },
181
185
  { id: "value", label: "VALUE", width: 11, align: "right" },
182
186
  { id: "detail", label: "DETAIL", width: 9, align: "left", flexGrow: 1 },
183
187
  ];
@@ -498,7 +502,7 @@ export function CorporateActionsView({
498
502
  ? allRows.filter((row) => EARNINGS_STATUSES.has(row.status))
499
503
  : allRows
500
504
  ), [allRows, variant]);
501
- const unit = useMemo(() => sharedMetricCurrency(rows, variant === "earnings-estimates"), [rows, variant]);
505
+ const unit = useMemo(() => sharedMetricCurrency(rows), [rows]);
502
506
  const hasUnstatedCurrency = rows.some((row) =>
503
507
  ((row.qEps != null || row.annualEps != null) && !row.epsCurrency)
504
508
  || ((row.qRevenue != null || row.annualRevenue != null) && !row.revenueCurrency));
@@ -618,6 +622,11 @@ export function CorporateActionsView({
618
622
  row: EventRow,
619
623
  column: EventColumn,
620
624
  ): DataTableCell => {
625
+ // Bare under the currency named above the table, with its own code otherwise, `?` when its source stated none.
626
+ const metric = (value: number | undefined, currency: string | undefined, kind: "eps" | "revenue"): DataTableCell => {
627
+ const text = formatEventMetric(value, unit ? undefined : currency, kind);
628
+ return { text: value != null && !currency ? `${text} ?` : text, value: unit && currency ? value : undefined, color: colors.textDim };
629
+ };
621
630
  switch (column.id) {
622
631
  case "date":
623
632
  return { text: row.date, color: colors.textDim };
@@ -626,26 +635,21 @@ export function CorporateActionsView({
626
635
  case "period":
627
636
  return { text: row.period, color: colors.textDim };
628
637
  case "eps":
629
- case "revenue": {
630
- const eps = column.id === "eps";
631
- const value = eps ? row.qEps ?? row.annualEps : row.qRevenue ?? row.annualRevenue;
632
- const currency = eps ? row.epsCurrency : row.revenueCurrency;
633
- const text = formatEventMetric(value, unit ? undefined : currency, eps ? "eps" : "revenue");
634
- return { text: value != null && !currency ? `${text} ?` : text,
635
- value: unit && currency ? value : undefined, color: colors.textDim };
636
- }
638
+ return metric(row.qEps ?? row.annualEps, row.epsCurrency, "eps");
639
+ case "revenue":
640
+ return metric(row.qRevenue ?? row.annualRevenue, row.revenueCurrency, "revenue");
637
641
  case "surprise":
638
642
  return { text: row.status === "Earnings" ? row.value : "-", value: row.surprisePercent, color: row.status === "Earnings" ? toneColor(row.tone) : colors.textDim };
639
643
  case "growth":
640
644
  return { text: row.estimateGrowthMetric && row.value !== "-" ? `${row.value} ${row.estimateGrowthMetric === "eps" ? "EPS" : "rev"}` : "-", color: row.estimateGrowthMetric ? toneColor(row.tone) : colors.textDim };
641
645
  case "qEps":
642
- return { text: formatEventMetric(row.qEps, unit ? undefined : row.epsCurrency, "eps"), color: colors.textDim };
646
+ return metric(row.qEps, row.epsCurrency, "eps");
643
647
  case "qRevenue":
644
- return { text: formatEventMetric(row.qRevenue, unit ? undefined : row.revenueCurrency, "revenue"), color: colors.textDim };
648
+ return metric(row.qRevenue, row.revenueCurrency, "revenue");
645
649
  case "annualEps":
646
- return { text: formatEventMetric(row.annualEps, unit ? undefined : row.epsCurrency, "eps"), color: colors.textDim };
650
+ return metric(row.annualEps, row.epsCurrency, "eps");
647
651
  case "annualRevenue":
648
- return { text: formatEventMetric(row.annualRevenue, unit ? undefined : row.revenueCurrency, "revenue"), color: colors.textDim };
652
+ return metric(row.annualRevenue, row.revenueCurrency, "revenue");
649
653
  case "value":
650
654
  return { text: row.value, color: toneColor(row.tone) };
651
655
  case "detail":
@@ -694,7 +698,7 @@ export function CorporateActionsView({
694
698
  rootWidth={width}
695
699
  rootHeight={height}
696
700
  rootBefore={<ChartTableHeader width={width} height={height} tableRows={rows.length} tableColumns={columns}
697
- query={variant === "earnings-estimates" && currencyMeta ? <QueryBar width={width} meta={currencyMeta} /> : undefined} />}
701
+ query={currencyMeta ? <QueryBar width={width} meta={currencyMeta} /> : undefined} />}
698
702
  onRootKeyDown={handleKeyDown}
699
703
  columns={columns}
700
704
  items={rows}
@@ -702,10 +706,10 @@ export function CorporateActionsView({
702
706
  sortDirection="desc"
703
707
  getItemKey={eventRowKey}
704
708
  renderCell={renderCell}
705
- getExportMetadata={variant === "earnings-estimates" ? () => [
709
+ getExportMetadata={() => [
706
710
  ...(unit ? [["Currency", unit]] : []),
707
711
  ...(hasUnstatedCurrency ? [["?", "Currency unstated"]] : []),
708
- ] : undefined}
712
+ ]}
709
713
  selectedTextOverridesCellColor
710
714
  getRowBackgroundColor={rowBackground}
711
715
  emptyStateTitle={loading
@@ -14,6 +14,7 @@ import {
14
14
  formatPercentRaw,
15
15
  } from "../../../utils/format";
16
16
  import { computeTTM } from "../ticker-detail/financials/aggregation";
17
+ import { classifyInstrumentType } from "../../../tickers/instrument-kind";
17
18
  import { declaredDividends } from "../../../utils/declared-dividends";
18
19
  import { fundamentalsEpsCurrency, SERVED_TRAILING_EPS } from "../../../utils/fundamentals";
19
20
  import {
@@ -180,10 +181,16 @@ function estimateValue(pair: EstimatePair): string {
180
181
  */
181
182
  export type EventFinancials = Pick<TickerFinancials, "quarterlyStatements" | "financialCurrency"> & {
182
183
  fundamentals?: Pick<NonNullable<TickerFinancials["fundamentals"]>, "eps" | "epsCurrency" | "financialCurrency" | "marketCapCurrency" | "trailingEpsSource"> | null;
183
- /** The listing's currency, which says whether an unlabelled EPS can be in the statements' (fundamentalsCurrency). */
184
- quote?: Pick<NonNullable<TickerFinancials["quote"]>, "currency"> | null;
184
+ /** The listing's currency, which says whether an unlabelled EPS can be in the statements' (fundamentalsCurrency), and its type. */
185
+ quote?: Pick<NonNullable<TickerFinancials["quote"]>, "currency" | "instrumentType"> | null;
186
+ quoteMetadata?: Pick<NonNullable<TickerFinancials["quoteMetadata"]>, "instrumentType"> | null;
185
187
  };
186
188
 
189
+ /** A fund (an ETF, a closed-end fund) reports no earnings: a feed's EPS rows for one are another company's or noise. */
190
+ function isFundListing(financials: EventFinancials | null): boolean {
191
+ return [financials?.quote?.instrumentType, financials?.quoteMetadata?.instrumentType].some((type) => classifyInstrumentType(type) === "fund");
192
+ }
193
+
187
194
  /**
188
195
  * The four reported rows behind the latest four statement quarters, summed, only when every one is on the adjusted
189
196
  * basis and in one currency. Quarters of different or unknown bases never add up to anything.
@@ -325,7 +332,7 @@ export function buildEventRows(
325
332
  ): EventRow[] {
326
333
  const rows: EventRow[] = [];
327
334
  const quarterlyStatements = sortedQuarterlyStatements(financials);
328
- const earnings = data?.earnings ?? [];
335
+ const earnings = isFundListing(financials) ? [] : data?.earnings ?? [];
329
336
  const ttm = ttmRow(quarterlyStatements, earnings, financials);
330
337
  if (ttm) rows.push(ttm);
331
338
 
@@ -12,6 +12,10 @@ import { buildEventRows, eventSourceNotice, CORPORATE_ACTION_COVERAGE } from "./
12
12
  import { EVENT_COLUMNS, loadEventSources } from "./event-sources";
13
13
  import { REPORTED_DATA } from "../shared/report-freshness";
14
14
  import { EPS_BASIS_NOTE } from "../shared/earnings-report";
15
+ import { loadNoQuoteLastTraded, noQuoteLastTradeNote, otherListingProfile } from "../../../tickers/listing-fate";
16
+ import { isUsSymbolVenue } from "../../../tickers/ticker-changes";
17
+ import { parsePublicTickerKey } from "../../../utils/exchanges";
18
+ import type { EventStatus } from "./event-model";
15
19
 
16
20
  interface EventHeadlessData {
17
21
  actions: CorporateActionsData | null;
@@ -23,6 +27,9 @@ interface EventHeadlessData {
23
27
  financialsError?: string | null;
24
28
  }
25
29
 
30
+ /** The rows drawn from the research served under a symbol (its reports and estimates), not from its own corporate actions. */
31
+ const RESEARCH_EVENTS: ReadonlySet<EventStatus> = new Set(["Earnings", "Q Est", "FY Est", "TTM"]);
32
+
26
33
  export interface EventsHeadlessDependencies {
27
34
  load(
28
35
  args: HeadlessPaneLoadArgs,
@@ -65,9 +72,20 @@ export function createEventsHeadless(
65
72
  const errors = [notice?.failed ? notice.text : null,
66
73
  data.financialsError ? `Financial statements unavailable: ${data.financialsError}` : null,
67
74
  ].filter((error): error is string => !!error);
75
+ // A symbol with no quote whose listing stopped trading says when it last traded. The issuer's own events after
76
+ // that stay (a cash-out, a liquidating distribution); only where the research served under the symbol is shown
77
+ // to be another listing's (STPP: a fund abroad's profile) are the reports and estimates after it dropped.
78
+ const lastTrade = data.financials?.quote ? null : await loadNoQuoteLastTraded({ symbol }, ctx.marketData);
79
+ const other = lastTrade ? otherListingProfile(data.financials?.profile, { usLine: isUsSymbolVenue(parsePublicTickerKey(symbol).exchange) }) : null;
80
+ const rows = buildEventRows(data.actions, data.estimates, data.financials, data.currency);
81
+ const own = lastTrade && other
82
+ ? rows.filter((row) => !RESEARCH_EVENTS.has(row.status) || row.date.slice(0, 10) <= lastTrade.date) : rows;
83
+ const hidden = rows.length - own.length;
84
+ const ended = lastTrade ? `${noQuoteLastTradeNote(symbol, lastTrade)}.${hidden > 0
85
+ ? ` ${hidden} later ${hidden === 1 ? "report is" : "reports are"} another listing's (${other}), not shown.` : ""}` : null;
68
86
  return {
69
- rows: buildEventRows(data.actions, data.estimates, data.financials, data.currency)
70
- .map((row) => ({ ...row })),
87
+ rows: own.map((row) => ({ ...row })),
88
+ ...(ended ? { notes: [ended] } : {}),
71
89
  errors: errors.length > 0 ? errors : undefined,
72
90
  metadata: { symbol, currency: data.currency, coverage: data.actions?.coverage,
73
91
  coverageNote: CORPORATE_ACTION_COVERAGE, epsBasis: EPS_BASIS_NOTE,
@@ -7,7 +7,7 @@ import { createPluginCache } from "../../../data/plugin-cache";
7
7
  import type { HeadlessPaneEntry } from "../../../types/plugin";
8
8
  import { errorMessage } from "../../../utils/errors";
9
9
  import { formatCompact } from "../../../utils/format";
10
- import { bondClassText, bondFigures } from "../../../market-data/bond-funds";
10
+ import { bondClassText, bondFigures, DV01_FROM_DURATION, durationDv01PerShare, formatDv01PerShare } from "../../../market-data/bond-funds";
11
11
  import { readFundFacts, validateFundFacts } from "../../../market-data/fund-facts";
12
12
  import { cachedCloudResource, loadCloudResource, unavailableOnServer } from "../shared/cloud-resource";
13
13
 
@@ -242,6 +242,8 @@ export function fundFactItems(facts: FundFactsPayload): StatItem[] {
242
242
  for (const figure of facts.bond ? bondFigures(facts.bond) : []) {
243
243
  items.push(cell(figure.key, figure.label, figure.text, { detail: figure.date, marked: facts.stale }));
244
244
  }
245
+ const dv01 = fundDv01(facts);
246
+ if (dv01) items.push(cell("dv01", "DV01", formatDv01PerShare(dv01.value), { detail: DV01_FROM_DURATION, marked: facts.stale }));
245
247
  // A metal trust's metal in trust, in tonnes as the market quotes it and ounces as the trust counts it, then its day's change.
246
248
  const metal = facts.metalHoldings;
247
249
  if (metal) {
@@ -267,6 +269,18 @@ export function fundFactItems(facts: FundFactsPayload): StatItem[] {
267
269
  return items;
268
270
  }
269
271
 
272
+ /**
273
+ * A bond fund's DV01 per share, derived from its duration at the closing
274
+ * price (NAV without one), with the price it was read at.
275
+ */
276
+ function fundDv01(facts: FundFactsPayload): { value: number; price: string } | null {
277
+ const price = facts.closingPrice ?? facts.nav;
278
+ const value = durationDv01PerShare(price?.value, facts.bond);
279
+ if (value == null || !price) return null;
280
+ const date = price.asOf ? ` ${price.asOf}` : "";
281
+ return { value, price: facts.closingPrice ? `closing price${date}` : `NAV${date}` };
282
+ }
283
+
270
284
  /** A DES figure: `warn` when it is older than it looks, which DES draws in the warning colour. */
271
285
  interface FundFactOverviewField {
272
286
  label: string;
@@ -373,6 +387,8 @@ export function fundFactEntries(facts: FundFactsPayload): HeadlessPaneEntry[] {
373
387
  add(keys[figure.key], figure.key === "secYield" ? "30-day SEC yield" : figure.label, figure.value,
374
388
  provenance(figure.text, figure.date, figure.source), figure.key === "duration" ? "years" : "%");
375
389
  }
390
+ const dv01 = fundDv01(facts);
391
+ if (dv01) add("dv01PerShare", "DV01", dv01.value, provenance(formatDv01PerShare(dv01.value), DV01_FROM_DURATION, dv01.price), "USD per bp");
376
392
  }
377
393
  if (facts.sponsor) add("sponsor", "Sponsor", facts.sponsor.value, facts.sponsor.value);
378
394
  if (facts.inception) add("inception", "Inception", facts.inception.value, facts.inception.value);
@@ -637,7 +637,7 @@ export const secModule: PluginModule = {
637
637
  label: "Fund Facts",
638
638
  description: "A US-listed fund's fee, NAV, premium or discount, net assets, sponsor, inception and index, a leveraged or inverse fund's daily objective, then the fund's own SEC filings: prospectus updates, shareholder reports, N-CEN and N-PORT.",
639
639
  keywords: ["etf", "fund", "expense ratio", "fee", "nav", "premium", "discount", "aum", "net assets", "n-1a", "485bpos", "497", "n-csr", "n-cen", "n-port", "prospectus",
640
- "leveraged", "inverse", "daily objective", "daily-reset", "decay"],
640
+ "leveraged", "inverse", "daily objective", "daily-reset", "decay", "bond fund", "duration", "dv01", "hedge ratio", "steepener"],
641
641
  shortcut: "ETF",
642
642
  viewKey: "etf",
643
643
  canCreate: (_context, options) => !options?.ticker || mayBeUsEquityOrFundTicker(options.ticker),
@@ -53,6 +53,7 @@ export const SERIES_INVENTORY: readonly SeriesInventoryEntry[] = [
53
53
  { module: "credit-conditions", chart: "Corporate bond spreads by rating", series: ["fred:BAML*"] },
54
54
  { module: "credit-boards", chart: "Index CDS (CDX, iTraxx) and sovereign 5Y CDS", series: ["cdx:*", "sovereign-cds:*"] },
55
55
  { module: "cds", chart: "A company's 5Y CDS spread", series: ["cds:*"] },
56
+ { module: "trace-bonds", chart: "A bond's daily closing price since it was kept", notInCatalog: "not-yet", reason: "Daily and dated per CUSIP, kept only for the bonds Pro accounts looked up; none is registered for the composer yet." },
56
57
  { module: "credit-documents", chart: "Principal due by year", notInCatalog: "not-a-time-series", reason: "A maturity schedule, not a history." },
57
58
  { module: "debt-maturities", chart: "A company's principal and the share due soon, across annual filings", series: ["debt-maturities:*"] },
58
59
  { module: "debt-maturities", chart: "A company's maturity wall", notInCatalog: "not-a-time-series", reason: "A schedule by maturity year from one filing; its total and near-term shares across filings are in the catalog." },
@@ -54,8 +54,13 @@ export function epsBasisShort(basis: EarningsEpsBasis | null): string {
54
54
  return basis === "gaap" ? "GAAP" : basis === "adjusted" ? "adj" : "?";
55
55
  }
56
56
 
57
- /** A reported row's detail names its basis as ERN's Basis column does, unknown included. */
58
- const BASIS_TEXT: Record<EpsBasisName, string> = { GAAP: "GAAP", adjusted: "adj", unknown: "unknown" };
57
+ /**
58
+ * A reported row's detail names a known basis as ERN's Basis column does. An
59
+ * unknown one says nothing a reader can use in a sentence ("unknown, +0.07 vs
60
+ * est"), so the detail leaves it out; the row's `epsBasis`, its drilldown and
61
+ * ERN's column still say it.
62
+ */
63
+ const BASIS_TEXT: Record<EpsBasisName, string> = { GAAP: "GAAP", adjusted: "adj", unknown: "" };
59
64
 
60
65
  type EarningsRecord = CorporateActionsData["earnings"][number];
61
66