@gloom-sh/terminal 0.20.10 → 0.20.12

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 (324) hide show
  1. package/package.json +2 -1
  2. package/patches/@opentui%2Fcore@0.3.2.patch +16 -0
  3. package/src/api-client/awards.ts +16 -0
  4. package/src/api-client/central-bank-rates.ts +5 -0
  5. package/src/api-client/data.ts +55 -2
  6. package/src/api-client/index.ts +18 -1
  7. package/src/api-client/request.ts +86 -3
  8. package/src/api-client/socket-connection.ts +366 -0
  9. package/src/api-client/socket-features.ts +75 -0
  10. package/src/api-client/socket-frames.ts +161 -0
  11. package/src/api-client/socket-listeners.ts +207 -0
  12. package/src/api-client/socket-quotes.ts +332 -0
  13. package/src/api-client/socket.ts +168 -983
  14. package/src/api-client/supply-chain-graph.ts +4 -2
  15. package/src/api-client/supply-chain.ts +8 -0
  16. package/src/api-client/types/econ.ts +10 -7
  17. package/src/api-client/types/filings-and-calls.ts +8 -0
  18. package/src/app/global-shortcuts.ts +2 -1
  19. package/src/app/keybindings/actions.ts +19 -0
  20. package/src/app/pane-runtime/index.tsx +18 -3
  21. package/src/app/pane-runtime/layout-placement.ts +63 -0
  22. package/src/app/pane-runtime/ticker-open-runtime.ts +10 -2
  23. package/src/brokers/signed-in/adapter.ts +19 -5
  24. package/src/brokers/signed-in/client.ts +13 -1
  25. package/src/brokers/signed-in/sign-in-dialog.tsx +33 -9
  26. package/src/capabilities/chart-series.ts +4 -1
  27. package/src/cli/board-coins.ts +10 -1
  28. package/src/cli/commands/crypto-hints.ts +3 -2
  29. package/src/cli/commands/fred-series.ts +0 -54
  30. package/src/cli/commands/market.ts +209 -31
  31. package/src/cli/commands/overview.ts +47 -14
  32. package/src/cli/commands/search.ts +37 -8
  33. package/src/cli/commands/ticker.ts +15 -4
  34. package/src/cli/desktop-pane-shot.ts +27 -2
  35. package/src/cli/fx-quote-rate.ts +1 -1
  36. package/src/cli/glossary.ts +14 -5
  37. package/src/cli/history-catalog-series.ts +85 -0
  38. package/src/cli/index.ts +1 -1
  39. package/src/cli/list-progress.ts +45 -0
  40. package/src/cli/listing-arg.ts +71 -7
  41. package/src/cli/name-entries.ts +8 -4
  42. package/src/cli/not-a-ticker.ts +2 -2
  43. package/src/cli/pane-functions/freshness.ts +50 -3
  44. package/src/cli/pane-functions/index.ts +7 -4
  45. package/src/cli/pane-functions/market-session.ts +66 -14
  46. package/src/cli/pane-functions/options.ts +5 -0
  47. package/src/cli/pane-functions/resolver.ts +9 -2
  48. package/src/cli/pane-functions/screenshot-assessment.ts +28 -3
  49. package/src/cli/pane-functions/screenshot-types.ts +6 -0
  50. package/src/cli/quote-answer.ts +49 -10
  51. package/src/cli/quote-list-reads.ts +87 -0
  52. package/src/cli/report-tables.ts +70 -13
  53. package/src/cli/result.ts +24 -2
  54. package/src/cli/symbol-list.ts +31 -4
  55. package/src/cli/terminal-code-hints.ts +83 -0
  56. package/src/cli/ticker-resolution.ts +2 -1
  57. package/src/cli/treasury-yields.ts +5 -0
  58. package/src/components/chart/native/kitty/manager.ts +2 -0
  59. package/src/components/chart/native/surface/manager.ts +211 -11
  60. package/src/components/command-bar/action-runtime.ts +2 -0
  61. package/src/components/command-bar/panel/index.tsx +2 -13
  62. package/src/components/command-bar/panel/layout.ts +1 -7
  63. package/src/components/command-bar/panel/runtime.ts +0 -1
  64. package/src/components/command-bar/panel/types.ts +0 -2
  65. package/src/components/command-bar/routing/launch-request.ts +2 -1
  66. package/src/components/command-bar/routing/navigation-state.ts +4 -2
  67. package/src/components/command-bar/workflow/types.ts +6 -0
  68. package/src/components/data-table/column-menu.tsx +89 -0
  69. package/src/components/data-table/sort-menu.tsx +9 -2
  70. package/src/components/data-table/view.tsx +33 -6
  71. package/src/components/form-modal/content.tsx +10 -0
  72. package/src/components/index.ts +1 -1
  73. package/src/components/layout/detached-pane-shell.tsx +3 -0
  74. package/src/components/layout/double-escape-close.ts +34 -3
  75. package/src/components/layout/floating-pane.tsx +10 -4
  76. package/src/components/layout/pane/cycle-order.ts +66 -2
  77. package/src/components/layout/pane/footer/index.tsx +25 -11
  78. package/src/components/layout/pane/footer/model.ts +62 -20
  79. package/src/components/layout/pane/header.tsx +140 -31
  80. package/src/components/layout/pane/sidebar.tsx +138 -20
  81. package/src/components/layout/pane/status-footer.ts +3 -1
  82. package/src/components/layout/shell/active-drag.ts +18 -13
  83. package/src/components/layout/shell/drag/magnets.ts +34 -18
  84. package/src/components/layout/shell/drag/runtime.ts +5 -0
  85. package/src/components/layout/shell/index.tsx +25 -0
  86. package/src/components/layout/shell/menu.ts +9 -0
  87. package/src/components/layout/shell/pane/actions.ts +36 -0
  88. package/src/components/layout/shell/pane/management-shortcuts.ts +27 -3
  89. package/src/components/layout/shell/pane-occlusion.ts +40 -0
  90. package/src/components/layout/shell/shortcuts.ts +17 -1
  91. package/src/components/layout/shell/terminal-pointer-runtime.ts +39 -6
  92. package/src/components/layout/shell/window-mode/index.ts +5 -16
  93. package/src/components/layout/shell/window-mode/overlays.tsx +3 -1
  94. package/src/components/market-board/index.tsx +14 -5
  95. package/src/components/metric-treemap/index.tsx +3 -1
  96. package/src/components/ticker/list-table-view.tsx +5 -0
  97. package/src/components/ui/button.tsx +48 -4
  98. package/src/components/ui/data-table/column-order.ts +180 -0
  99. package/src/components/ui/data-table/index.tsx +12 -1
  100. package/src/components/ui/data-table/opentui/index.tsx +291 -32
  101. package/src/components/ui/data-table/opentui/model.ts +43 -4
  102. package/src/components/ui/data-table/types.ts +56 -0
  103. package/src/components/ui/data-table/use-column-order.ts +135 -0
  104. package/src/components/ui/index.ts +1 -1
  105. package/src/components/ui/inline-quick-add.tsx +19 -3
  106. package/src/components/ui/list-view.tsx +11 -5
  107. package/src/components/ui/query-bar.tsx +16 -1
  108. package/src/components/ui/selection-fill.ts +39 -0
  109. package/src/components/ui/table-layout.ts +120 -0
  110. package/src/core/state/app/layout-reducer.ts +2 -1
  111. package/src/core/state/app/pane-choices.ts +68 -0
  112. package/src/core/state/app/state.ts +14 -6
  113. package/src/core/state/app/types.ts +8 -0
  114. package/src/docs/snapshot.json +3 -2
  115. package/src/i18n/es.ts +2 -0
  116. package/src/i18n/ja.ts +2 -0
  117. package/src/i18n/ko.ts +2 -0
  118. package/src/i18n/zh-cn.ts +2 -0
  119. package/src/i18n/zh-tw.ts +2 -0
  120. package/src/layout/pane-manager/dock-tree.ts +19 -0
  121. package/src/layout/pane-manager/index.ts +3 -0
  122. package/src/market-data/coordinator/index.ts +4 -3
  123. package/src/market-data/coordinator/quotes.ts +12 -4
  124. package/src/market-data/market/freshness.ts +33 -0
  125. package/src/market-data/market/status.ts +5 -1
  126. package/src/market-data/quotes/contributions.ts +10 -0
  127. package/src/market-data/quotes/freshness.ts +31 -0
  128. package/src/market-data/quotes/live-valuation.ts +32 -5
  129. package/src/market-data/quotes/regular-session-valuation.ts +1 -1
  130. package/src/market-data/quotes/resolution.ts +4 -0
  131. package/src/market-data/quotes/time.ts +0 -14
  132. package/src/plugins/builtin/account-management/index.tsx +1 -0
  133. package/src/plugins/builtin/awards/detail.tsx +12 -4
  134. package/src/plugins/builtin/awards/headless.ts +29 -8
  135. package/src/plugins/builtin/awards/model.ts +36 -2
  136. package/src/plugins/builtin/awards/pane.tsx +7 -4
  137. package/src/plugins/builtin/broker-manager/detail.tsx +5 -3
  138. package/src/plugins/builtin/broker-manager/index.tsx +7 -6
  139. package/src/plugins/builtin/broker-manager/model.ts +15 -6
  140. package/src/plugins/builtin/broker-manager/pane-actions.tsx +11 -4
  141. package/src/plugins/builtin/broker-manager/sign-in-end.ts +50 -19
  142. package/src/plugins/builtin/broker-manager/table.ts +10 -4
  143. package/src/plugins/builtin/broker-trading/index.tsx +1 -1
  144. package/src/plugins/builtin/central-bank-rates/headless.ts +6 -6
  145. package/src/plugins/builtin/central-bank-rates/index.tsx +1 -1
  146. package/src/plugins/builtin/central-bank-rates/model.ts +21 -3
  147. package/src/plugins/builtin/central-bank-rates/pane.tsx +15 -5
  148. package/src/plugins/builtin/chart-composer/headless.ts +5 -1
  149. package/src/plugins/builtin/chart-composer/pane.tsx +1 -0
  150. package/src/plugins/builtin/chat/content/handle-prompt.tsx +4 -0
  151. package/src/plugins/builtin/chat/controller/realtime.ts +17 -1
  152. package/src/plugins/builtin/chat/message/terminal.tsx +4 -1
  153. package/src/plugins/builtin/chat/sidebar.tsx +35 -19
  154. package/src/plugins/builtin/cloud/askg/pane.tsx +4 -0
  155. package/src/plugins/builtin/cloud/askg/tool-timeline.tsx +2 -0
  156. package/src/plugins/builtin/cloud/plugin.tsx +1 -0
  157. package/src/plugins/builtin/cloud/team/module.tsx +1 -0
  158. package/src/plugins/builtin/cloud/thesis/detail.tsx +9 -4
  159. package/src/plugins/builtin/commodity-balances/pane.tsx +13 -5
  160. package/src/plugins/builtin/company-kpis/model.ts +3 -3
  161. package/src/plugins/builtin/connections/index.ts +1 -0
  162. package/src/plugins/builtin/credit-boards/cdx-pane.tsx +9 -5
  163. package/src/plugins/builtin/credit-boards/client.ts +5 -0
  164. package/src/plugins/builtin/credit-boards/headless.ts +1 -6
  165. package/src/plugins/builtin/credit-boards/model.ts +0 -6
  166. package/src/plugins/builtin/credit-boards/series.ts +19 -8
  167. package/src/plugins/builtin/credit-boards/sovr-pane.tsx +9 -5
  168. package/src/plugins/builtin/crypto-etf-flows/headless.ts +23 -13
  169. package/src/plugins/builtin/crypto-etf-flows/pane.tsx +8 -3
  170. package/src/plugins/builtin/debt-maturities/headless.ts +16 -7
  171. package/src/plugins/builtin/debt-maturities/model.ts +9 -15
  172. package/src/plugins/builtin/debt-maturities/pane.tsx +9 -10
  173. package/src/plugins/builtin/earnings/board-model.ts +33 -4
  174. package/src/plugins/builtin/earnings/board.tsx +15 -3
  175. package/src/plugins/builtin/earnings/calendar.tsx +10 -6
  176. package/src/plugins/builtin/earnings/client.ts +0 -9
  177. package/src/plugins/builtin/earnings/headless.ts +10 -7
  178. package/src/plugins/builtin/earnings/history.tsx +21 -14
  179. package/src/plugins/builtin/earnings-calls/data.ts +24 -4
  180. package/src/plugins/builtin/earnings-calls/format.ts +23 -5
  181. package/src/plugins/builtin/earnings-calls/headless.ts +23 -3
  182. package/src/plugins/builtin/earnings-calls/index.tsx +1 -0
  183. package/src/plugins/builtin/earnings-calls/model.ts +11 -1
  184. package/src/plugins/builtin/earnings-calls/pane.tsx +2 -5
  185. package/src/plugins/builtin/econ/calendar-model.ts +27 -0
  186. package/src/plugins/builtin/econ/fred-catalog.ts +3 -0
  187. package/src/plugins/builtin/econ/index.tsx +9 -2
  188. package/src/plugins/builtin/econ-statistics/headless.ts +3 -1
  189. package/src/plugins/builtin/econ-statistics/index.tsx +1 -1
  190. package/src/plugins/builtin/equity-screener/live.ts +74 -18
  191. package/src/plugins/builtin/equity-screener/model.ts +19 -4
  192. package/src/plugins/builtin/equity-screener/pane.tsx +19 -14
  193. package/src/plugins/builtin/equity-screener/refresh-anchor.ts +45 -0
  194. package/src/plugins/builtin/equity-screener/results.ts +22 -2
  195. package/src/plugins/builtin/equity-screener/screen-check.ts +9 -3
  196. package/src/plugins/builtin/fear-greed/headless.ts +16 -13
  197. package/src/plugins/builtin/fear-greed/pane.tsx +12 -4
  198. package/src/plugins/builtin/filing-events/index.tsx +1 -0
  199. package/src/plugins/builtin/futures/index.tsx +15 -1
  200. package/src/plugins/builtin/futures/table.tsx +1 -1
  201. package/src/plugins/builtin/fx-matrix/index.tsx +32 -19
  202. package/src/plugins/builtin/holders/pane.tsx +30 -20
  203. package/src/plugins/builtin/insider/table.tsx +10 -7
  204. package/src/plugins/builtin/insider/tickers.tsx +1 -1
  205. package/src/plugins/builtin/iv-history/events.ts +5 -0
  206. package/src/plugins/builtin/iv-history/headless.ts +15 -9
  207. package/src/plugins/builtin/jobs/index.tsx +1 -0
  208. package/src/plugins/builtin/kelly-sizer/sections.tsx +2 -0
  209. package/src/plugins/builtin/macro-day/headless.ts +15 -6
  210. package/src/plugins/builtin/macro-day/model.ts +1 -1
  211. package/src/plugins/builtin/macro-day/releases.ts +25 -16
  212. package/src/plugins/builtin/market-movers/index.tsx +20 -8
  213. package/src/plugins/builtin/market-movers/model.ts +5 -0
  214. package/src/plugins/builtin/market-movers/session-body.tsx +2 -1
  215. package/src/plugins/builtin/money-markets/headless.ts +12 -2
  216. package/src/plugins/builtin/money-markets/pane.tsx +10 -1
  217. package/src/plugins/builtin/options/view.tsx +3 -0
  218. package/src/plugins/builtin/options-positioning/pane.tsx +1 -1
  219. package/src/plugins/builtin/options-scenario/pane.tsx +2 -1
  220. package/src/plugins/builtin/perps/cascade-tabs.tsx +2 -1
  221. package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +4 -31
  222. package/src/plugins/builtin/portfolio-list/pane/index.tsx +19 -1
  223. package/src/plugins/builtin/portfolio-list/quick-add/index.tsx +22 -8
  224. package/src/plugins/builtin/portfolio-list/summary/index.tsx +6 -8
  225. package/src/plugins/builtin/portfolio-list/table.tsx +15 -1
  226. package/src/plugins/builtin/rate-path/pane.tsx +2 -0
  227. package/src/plugins/builtin/realized-vol/headless.ts +28 -2
  228. package/src/plugins/builtin/revenue-breakdown/pane.tsx +2 -0
  229. package/src/plugins/builtin/reverse-dcf/pane.tsx +2 -1
  230. package/src/plugins/builtin/risk-factors/index.tsx +1 -0
  231. package/src/plugins/builtin/seasonality/pane.tsx +2 -1
  232. package/src/plugins/builtin/shared/source-footer.ts +70 -0
  233. package/src/plugins/builtin/short-interest/publications-pane.tsx +5 -1
  234. package/src/plugins/builtin/short-volume/pane.tsx +5 -1
  235. package/src/plugins/builtin/social-mentions/outliers.tsx +10 -1
  236. package/src/plugins/builtin/social-mentions/pane.tsx +7 -0
  237. package/src/plugins/builtin/supply-chain/client.ts +3 -1
  238. package/src/plugins/builtin/supply-chain/flow.tsx +25 -8
  239. package/src/plugins/builtin/supply-chain/graph-client.ts +1 -1
  240. package/src/plugins/builtin/supply-chain/graph-evidence.ts +1 -1
  241. package/src/plugins/builtin/supply-chain/graph-model.ts +12 -1
  242. package/src/plugins/builtin/supply-chain/graph-pane.tsx +9 -8
  243. package/src/plugins/builtin/supply-chain/graph.tsx +12 -6
  244. package/src/plugins/builtin/supply-chain/headless.ts +13 -7
  245. package/src/plugins/builtin/supply-chain/model.ts +68 -11
  246. package/src/plugins/builtin/supply-chain/pane.tsx +9 -6
  247. package/src/plugins/builtin/supply-chain/row-evidence.tsx +5 -5
  248. package/src/plugins/builtin/thirteenf/pane.tsx +2 -0
  249. package/src/plugins/builtin/ticker-detail/financials/model.ts +28 -6
  250. package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +26 -9
  251. package/src/plugins/builtin/ticker-detail/financials/tab.tsx +58 -35
  252. package/src/plugins/builtin/ticker-detail/overview/components.tsx +14 -1
  253. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +2 -0
  254. package/src/plugins/builtin/ticker-detail/pane.tsx +48 -24
  255. package/src/plugins/builtin/ticker-detail/quote-footer.ts +5 -0
  256. package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +6 -3
  257. package/src/plugins/builtin/treasury-auctions/after.ts +50 -23
  258. package/src/plugins/builtin/treasury-auctions/cache.ts +23 -5
  259. package/src/plugins/builtin/treasury-auctions/headless.ts +226 -37
  260. package/src/plugins/builtin/treasury-auctions/hk-headless.ts +11 -5
  261. package/src/plugins/builtin/treasury-auctions/hk-view.tsx +27 -25
  262. package/src/plugins/builtin/treasury-auctions/hk.ts +60 -8
  263. package/src/plugins/builtin/treasury-auctions/index.tsx +3 -0
  264. package/src/plugins/builtin/treasury-auctions/keys.ts +27 -0
  265. package/src/plugins/builtin/treasury-auctions/like.ts +137 -0
  266. package/src/plugins/builtin/treasury-auctions/model.ts +100 -22
  267. package/src/plugins/builtin/treasury-auctions/pane.tsx +39 -11
  268. package/src/plugins/builtin/vol-surface/heat-grid.tsx +6 -3
  269. package/src/plugins/builtin/vol-surface/pane.tsx +7 -3
  270. package/src/plugins/builtin/world-indices/index.tsx +5 -1
  271. package/src/plugins/builtin/yield-curve/index.tsx +2 -1
  272. package/src/plugins/runtime/index.tsx +1 -0
  273. package/src/plugins/runtime/state.ts +20 -0
  274. package/src/portfolio/column-values.ts +8 -2
  275. package/src/public/__snapshots__/public-api.test.ts.snap +5 -0
  276. package/src/public/react.ts +7 -0
  277. package/src/react/auto-refresh.ts +29 -0
  278. package/src/renderers/browser/deeplink-bridge.ts +24 -3
  279. package/src/renderers/dom/data-table/column-drag.ts +147 -0
  280. package/src/renderers/dom/data-table/index.tsx +22 -0
  281. package/src/renderers/dom/data-table/row.tsx +27 -5
  282. package/src/renderers/dom/desktop/query-bar.tsx +229 -60
  283. package/src/renderers/dom/host/overflow-fade-px.ts +2 -0
  284. package/src/renderers/dom/host/overflow-fade.ts +1 -2
  285. package/src/renderers/dom/styles.css +47 -5
  286. package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +2 -1
  287. package/src/renderers/opentui/chart-surface.tsx +1 -0
  288. package/src/renderers/opentui/frame-hits.ts +33 -0
  289. package/src/renderers/opentui/host.tsx +2 -0
  290. package/src/renderers/opentui/native-surface.ts +14 -21
  291. package/src/renderers/opentui/test-utils.tsx +3 -0
  292. package/src/series/types.ts +2 -0
  293. package/src/sources/gloomberb-cloud/fred-attribution.ts +86 -0
  294. package/src/sources/gloomberb-cloud/index.ts +25 -1
  295. package/src/sources/gloomberb-cloud/normalizers.ts +22 -3
  296. package/src/sources/provider-errors.ts +64 -1
  297. package/src/sources/provider-router/batches.ts +19 -0
  298. package/src/sources/provider-router/index.ts +7 -1
  299. package/src/state/app/context/index.tsx +46 -1
  300. package/src/state/pane-unsent-work.ts +47 -0
  301. package/src/test-support/app-store.ts +24 -1
  302. package/src/test-support/shell-pane-keys.tsx +5 -0
  303. package/src/test-support/telemetry-guard.ts +83 -0
  304. package/src/test-support/test-env.ts +12 -0
  305. package/src/theme/colors.ts +17 -1
  306. package/src/theme/ui-tokens.ts +50 -1
  307. package/src/tickers/listing-venues.ts +11 -1
  308. package/src/tickers/search/japanese-names.json +1 -0
  309. package/src/tickers/search/japanese-names.ts +152 -0
  310. package/src/tickers/terminal-codes.ts +55 -6
  311. package/src/time-series/base-series.ts +3 -0
  312. package/src/time-series/live-quotes.ts +3 -9
  313. package/src/types/data-provider.ts +6 -0
  314. package/src/types/financials.ts +11 -0
  315. package/src/types/plugin-contributions.ts +7 -0
  316. package/src/types/plugin-panes.ts +7 -0
  317. package/src/ui/host.tsx +24 -0
  318. package/src/ui/pointer-drag.ts +11 -2
  319. package/src/utils/double-escape-close.ts +42 -0
  320. package/src/utils/fundamentals.ts +14 -3
  321. package/src/utils/fx-status.ts +30 -7
  322. package/src/utils/network-failure.ts +23 -0
  323. package/src/utils/share-multiples.cases.json +780 -2
  324. package/src/utils/share-multiples.ts +154 -24
@@ -12,19 +12,21 @@ import { ageFooterSegment } from "../../../components/layout/pane/footer";
12
12
  import { staticSeries } from "../../../components/chart/static/series";
13
13
  import { usePaneRefreshKey } from "../../../components/data-table/table-pane";
14
14
  import { useAsyncResource, useAutoRefresh, usePluginPaneState, useUpdatedAgo } from "../../../public/react";
15
+ import { useUtcDay } from "../../../react/auto-refresh";
16
+ import { reportFooterSegment } from "../shared/source-footer";
17
+ import { earningsCalendarHeadless } from "./headless";
15
18
  import { colors } from "../../../theme/colors";
16
19
  import { useLiveStreamingSetting } from "../../../state/hooks/live-streaming";
17
20
  import { useAssetData } from "../../runtime";
18
21
  import { isBoardRowLoading, useQuoteBoard } from "../shared/use-quote-board";
19
- import { newYorkToday, reportMove } from "./board-model";
22
+ import { historyListing, newYorkToday, reportMove } from "./board-model";
20
23
  import { usePlanAccess } from "../../../api-client/plan-access";
21
24
  import { useResearchCloudSession } from "../shared/research-cloud-session";
22
- import { cachedEarningsHistory, hasEarningsHistory, loadEarningsHistory, noHistoryAbroad } from "./client";
25
+ import { cachedEarningsHistory, loadEarningsHistory, noHistoryAbroad } from "./client";
23
26
  import { loadEarningsCalendar } from "./data/cache";
24
27
  import { chartAxis, chartPoints, chartRows, historyFigures, historyRows, type HistoryRow } from "./history-model";
25
28
  import { historyColumns, renderHistoryCell, type HistoryColumn, type LiveMove } from "./history-table";
26
29
  import { loadNoEarningsText } from "./no-earnings";
27
- import { listingAbroadVenue } from "../../../utils/sec";
28
30
 
29
31
  const barDate = (row: HistoryRow) => (row.implied != null || row.move != null ? new Date(`${row.date}T00:00:00Z`) : null);
30
32
 
@@ -41,11 +43,9 @@ export function EarningsHistoryView({ symbol, width, height, focused, registrati
41
43
  registrationId: string;
42
44
  }) {
43
45
  const dataProvider = useAssetData();
44
- // Past reports are the US board's, where SAN is not SAN:EPA's company, and a Hong Kong listing's own (its results
45
- // announcements, in their currency): any other listing abroad shows its next report alone.
46
- const venueAbroad = listingAbroadVenue(symbol);
47
- const abroad = !hasEarningsHistory(venueAbroad);
48
- const ownAbroad = venueAbroad != null && !abroad;
46
+ // Past reports are a US listing's and a Hong Kong listing's own, read by its key however it was typed (0700.HK is
47
+ // 0700:HKEX): any other listing abroad shows its next report alone.
48
+ const { listing, abroad, ownAbroad } = historyListing(symbol);
49
49
  // A Hong Kong listing's announcement figures come with Pro, as KPIS has them: what Gloom Cloud answers differs by
50
50
  // plan, so it is kept per session and plan.
51
51
  const access = usePlanAccess();
@@ -53,11 +53,11 @@ export function EarningsHistoryView({ symbol, width, height, focused, registrati
53
53
  const accessKey = ownAbroad ? `${session.requestKey}:${access.hasProAccess ? "pro" : "free"}` : undefined;
54
54
  const loader = useCallback(
55
55
  (force: boolean) => (abroad ? Promise.resolve(null)
56
- : ownAbroad ? loadEarningsHistory(symbol, force, undefined, accessKey).catch(noHistoryAbroad)
57
- : loadEarningsHistory(symbol, force)),
58
- [abroad, accessKey, ownAbroad, symbol],
56
+ : ownAbroad ? loadEarningsHistory(listing, force, undefined, accessKey).catch(noHistoryAbroad)
57
+ : loadEarningsHistory(listing, force)),
58
+ [abroad, accessKey, listing, ownAbroad],
59
59
  );
60
- const resource = useAsyncResource(loader, { initialData: () => (abroad ? null : cachedEarningsHistory(symbol, accessKey)) });
60
+ const resource = useAsyncResource(loader, { initialData: () => (abroad ? null : cachedEarningsHistory(listing, accessKey)) });
61
61
  // Past the stored calendar's horizon, and for listings it does not carry, the per-ticker calendar has the next date.
62
62
  const upcomingLoader = useCallback(
63
63
  (force: boolean) => loadEarningsCalendar(dataProvider, [symbol], { force }).then((result) => result.events[0] ?? null),
@@ -115,6 +115,14 @@ export function EarningsHistoryView({ symbol, width, height, focused, registrati
115
115
  // A coin's history fails (it is no US ticker), which says nothing once its type has answered.
116
116
  const historyError = noEarnings.loading || noEarnings.data ? null : resource.error;
117
117
  const updatedAgo = useUpdatedAgo(resource.updatedAt);
118
+ const utcDay = useUtcDay();
119
+ // Its source and when the history was read, as `fn ERN` ends; how long ago it loaded goes first on a narrow row.
120
+ const footerInfo = useMemo(() => abroad
121
+ ? [{ id: "us-listings", parts: [{ text: "past reports: US and Hong Kong listings only", tone: "muted" as const }] }]
122
+ : payload ? [
123
+ reportFooterSegment(earningsCalendarHeadless, { rows: [], metadata: { asOf: payload.asOf } }),
124
+ ...(updatedAgo ? [ageFooterSegment(updatedAgo)] : []),
125
+ ] : [], [abroad, payload, updatedAgo, utcDay]);
118
126
  useAutoRefresh(resource.updatedAt, resource.load);
119
127
  usePaneRefreshKey(() => { resource.reload(); upcoming.reload(); }, { focused });
120
128
  usePaneStatusFooter({
@@ -122,8 +130,7 @@ export function EarningsHistoryView({ symbol, width, height, focused, registrati
122
130
  loading: resource.loading,
123
131
  error: historyError,
124
132
  stale: !!resource.data?.stale,
125
- info: abroad ? [{ id: "us-listings", parts: [{ text: "past reports: US and Hong Kong listings only", tone: "muted" as const }] }]
126
- : payload && updatedAgo ? [ageFooterSegment(updatedAgo)] : [],
133
+ info: footerInfo,
127
134
  });
128
135
 
129
136
  return (
@@ -53,7 +53,11 @@ export interface EarningsCallsResult {
53
53
  errorStatus?: number;
54
54
  /** The server has just started looking for this company's calls. */
55
55
  pending?: boolean;
56
- /** The symbol is not one the SEC knows, so there is nothing to look for. */
56
+ /**
57
+ * The symbol is not one the SEC knows, so there is nothing to look for. Never
58
+ * set for a listing abroad, which the server answers by its stored calls:
59
+ * C38U:SGX with none yet is a company whose calls are not yet available.
60
+ */
57
61
  unknownTicker?: boolean;
58
62
  /** The company's home line the calls are read from, when not the listing asked. */
59
63
  companyFrom?: CompanyFrom | null;
@@ -172,16 +176,32 @@ function listKey(ticker: string | null, abroad: ListingAbroad | null, limit: num
172
176
  return offset > 0 ? JSON.stringify([identity, limit, offset]) : JSON.stringify([identity, limit]);
173
177
  }
174
178
 
179
+ /** A listing code without the zeros a venue pads it with: 0016 and 16 are one Hong Kong listing. */
180
+ const listingCode = (symbol: string) => symbol.trim().toUpperCase().replace(/^0+(?=\d)/, "");
181
+
182
+ /**
183
+ * A call filed under the listing's own key (0016:HKEX) is the listing's,
184
+ * whatever short name the exchange gives the company there: "SHK PPT" is Sun
185
+ * Hung Kai Properties, "HKEX" Hong Kong Exchanges and Clearing.
186
+ */
187
+ function filedUnderListing(call: CloudEarningsCallPayload, abroad: ListingAbroad): boolean {
188
+ const separator = call.ticker.lastIndexOf(":");
189
+ if (separator < 0) return false;
190
+ return listingCode(call.ticker.slice(0, separator)) === listingCode(abroad.symbol)
191
+ && call.ticker.slice(separator + 1).trim().toUpperCase() === abroad.exchange.toUpperCase();
192
+ }
193
+
175
194
  /**
176
195
  * A server that predates venue-aware lookups ignores the venue and lists the
177
196
  * calls of the US company with the same symbol: AI in Paris would show C3.ai.
178
197
  * Those calls are another company's, so they are dropped, and without the
179
- * listing's company they cannot be told apart.
198
+ * listing's company they cannot be told apart. A call filed under the
199
+ * listing's own key is never such a call.
180
200
  */
181
201
  function listingCalls(calls: CloudEarningsCallPayload[], abroad: ListingAbroad | null): CloudEarningsCallPayload[] {
182
202
  if (!abroad) return calls;
183
203
  const name = abroad.name;
184
- return name ? calls.filter((call) => !areDifferentCompanies(name, call.companyName)) : [];
204
+ return calls.filter((call) => filedUnderListing(call, abroad) || (!!name && !areDifferentCompanies(name, call.companyName)));
185
205
  }
186
206
 
187
207
  type EarningsCallsLoadOptions = IssuerListingParams & { force?: boolean; limit?: number; offset?: number };
@@ -231,7 +251,7 @@ export async function loadEarningsCallsWithClient(
231
251
  const value = {
232
252
  calls,
233
253
  pending: payload.pending === true,
234
- unknownTicker: payload.unknownTicker === true,
254
+ unknownTicker: payload.unknownTicker === true && !abroad,
235
255
  ...(companyFrom ? { companyFrom } : {}),
236
256
  };
237
257
  // A list with calls still being produced changes by the minute, so it
@@ -1,17 +1,35 @@
1
1
  import type { CloudEarningsCallPayload } from "../../../api-client";
2
2
  import { formatShortDate } from "../../../utils/datetime-format";
3
3
 
4
- /** "FQ4 26" — fiscal period, compact enough for a table column. */
4
+ /**
5
+ * "FQ4 26", "H1 26" or "FY 26": the fiscal period, compact enough for a table
6
+ * column. A half year's results have no quarter, as a year's do, and are told
7
+ * apart by `fiscalHalf` (SHKP's interim and annual results calls of FY2026).
8
+ */
5
9
  function formatPeriod(
6
10
  fiscalYear: number | null,
7
11
  fiscalQuarter: number | null,
12
+ fiscalHalf?: number | null,
8
13
  ): string {
9
14
  if (!fiscalQuarter && !fiscalYear) return "—";
10
- const quarter = fiscalQuarter ? `FQ${fiscalQuarter}` : "FY";
15
+ const quarter = fiscalQuarter ? `FQ${fiscalQuarter}` : fiscalHalf ? `H${fiscalHalf}` : "FY";
11
16
  const year = fiscalYear ? ` ${String(fiscalYear).slice(-2)}` : "";
12
17
  return `${quarter}${year}`;
13
18
  }
14
19
 
20
+ /** The FQ column of `fn CALLS`: the quarter, or `H1` for a half year's results. */
21
+ export function fiscalQuarterText(call: { fiscalQuarter: number | null; fiscalHalf?: number | null }): string | number | null {
22
+ return call.fiscalQuarter ?? (call.fiscalHalf ? `H${call.fiscalHalf}` : null);
23
+ }
24
+
25
+ /**
26
+ * What a company with no call yet reads, in the pane and `fn CALLS`: not yet
27
+ * available, never an error or a gap in coverage.
28
+ */
29
+ export function noCallsText(ticker: string): { title: string; message: string } {
30
+ return { title: `Earnings calls for ${ticker} are not yet available.`, message: "Calls appear once the company's investor site or filings list a webcast." };
31
+ }
32
+
15
33
  export function formatCallDate(value: string | null): string {
16
34
  return formatShortDate(value, { day: "2-digit", year: "2-digit", fallback: "\u2014" });
17
35
  }
@@ -38,7 +56,7 @@ export function formatTimestamp(seconds: number): string {
38
56
 
39
57
  type NamedCall = Pick<
40
58
  CloudEarningsCallPayload,
41
- "ticker" | "fiscalYear" | "fiscalQuarter" | "eventKind" | "eventLabel"
59
+ "ticker" | "fiscalYear" | "fiscalQuarter" | "fiscalHalf" | "eventKind" | "eventLabel"
42
60
  >;
43
61
 
44
62
  /** An event that is not an earnings call (a deal call, an investor day), shown by its label and never as a quarter. */
@@ -60,13 +78,13 @@ const SHORT_EVENT_LABELS: Record<string, string> = {
60
78
  export function callPeriod(call: Omit<NamedCall, "ticker">): string {
61
79
  const label = eventLabelOf(call);
62
80
  if (label) return SHORT_EVENT_LABELS[label] ?? label;
63
- return formatPeriod(call.fiscalYear, call.fiscalQuarter);
81
+ return formatPeriod(call.fiscalYear, call.fiscalQuarter, call.fiscalHalf);
64
82
  }
65
83
 
66
84
  /** Title for the detail stack: names the call so the body need not repeat it. */
67
85
  export function callTitle(call: NamedCall): string {
68
86
  const label = eventLabelOf(call);
69
87
  if (label) return `${call.ticker} ${label}`;
70
- const period = formatPeriod(call.fiscalYear, call.fiscalQuarter);
88
+ const period = formatPeriod(call.fiscalYear, call.fiscalQuarter, call.fiscalHalf);
71
89
  return period === "—" ? call.ticker : `${call.ticker} ${period}`;
72
90
  }
@@ -6,6 +6,7 @@ import type {
6
6
  HeadlessPaneContext,
7
7
  HeadlessPaneDefinition,
8
8
  HeadlessPaneLoadArgs,
9
+ HeadlessPaneRow,
9
10
  HeadlessRowsResult,
10
11
  } from "../../../types/plugin";
11
12
  import { explainRefusal } from "../shared/cloud-denied";
@@ -23,7 +24,7 @@ import {
23
24
  type UpcomingCallsResult,
24
25
  type UpcomingDays,
25
26
  } from "./data";
26
- import { callPeriod, eventLabelOf } from "./format";
27
+ import { callPeriod, eventLabelOf, fiscalQuarterText, noCallsText } from "./format";
27
28
  import type { MarketDay } from "../earnings/board-model";
28
29
  import {
29
30
  calendarDays,
@@ -56,9 +57,11 @@ const optionalErrors = (error: string | null) => error ? [error] : undefined;
56
57
  const CALL_COLUMNS = [
57
58
  { key: "ticker", header: "Ticker" },
58
59
  { key: "company", header: "Company" },
59
- { key: "callAt", header: "Call date" },
60
+ // A call known by its day alone prints the day, never a midnight it was not held at.
61
+ { key: "callAt", header: "Call date", textFormat: (value: unknown, row: HeadlessPaneRow) => callDateText(value, row.timeKnown !== false) },
60
62
  { key: "fiscalYear", header: "FY", align: "right" as const },
61
- { key: "fiscalQuarter", header: "FQ", align: "right" as const },
63
+ // A half year's results read H1, never a blank quarter beside the year's.
64
+ { key: "fiscalQuarter", header: "FQ", align: "right" as const, textFormat: (value: unknown, row: HeadlessPaneRow) => String(fiscalQuarterText({ fiscalQuarter: value as number | null, fiscalHalf: row.fiscalHalf as number | undefined }) ?? "—") },
62
65
  { key: "event", header: "Event" },
63
66
  { key: "status", header: "Status" },
64
67
  { key: "durationSeconds", header: "Seconds", align: "right" as const },
@@ -122,6 +125,14 @@ function explainDenied(ticker: string | null, context: HeadlessPaneContext) {
122
125
  return async (error: unknown): Promise<never> => { throw await explainRefusal(error, callsLockNote, { symbol: ticker, context }); };
123
126
  }
124
127
 
128
+ /** "2026-10-27 07:45 UTC" for a call whose start is known, "2026-09-10" for one known by its day. */
129
+ function callDateText(value: unknown, timeKnown: boolean): string {
130
+ const at = typeof value === "string" ? Date.parse(value) : Number.NaN;
131
+ if (!Number.isFinite(at)) return "—";
132
+ const iso = new Date(at).toISOString();
133
+ return timeKnown ? `${iso.slice(0, 16).replace("T", " ")} UTC` : iso.slice(0, 10);
134
+ }
135
+
125
136
  function callRow(call: CloudEarningsCallPayload, now: number) {
126
137
  const upcoming = isUpcomingCall(call, now);
127
138
  return {
@@ -129,8 +140,10 @@ function callRow(call: CloudEarningsCallPayload, now: number) {
129
140
  ticker: call.ticker,
130
141
  company: call.companyName,
131
142
  callAt: call.callAt,
143
+ timeKnown: callTimeKnown(call),
132
144
  fiscalYear: call.fiscalYear,
133
145
  fiscalQuarter: call.fiscalQuarter,
146
+ ...(call.fiscalHalf ? { fiscalHalf: call.fiscalHalf } : {}),
134
147
  // A deal call, a conference, an investor day: not a quarter's earnings call.
135
148
  event: eventLabelOf(call),
136
149
  status: call.hasTranscript ? "transcribed" : callStatusLabel(call, now) || call.status,
@@ -170,11 +183,15 @@ function projectEarningsCallsHeadless(
170
183
  const ordered = next ? [next, ...matching.filter((call) => call !== next)] : matching;
171
184
  const rows = ordered.slice(0, limit).map((call) => callRow(call, now));
172
185
  const sourceLimit = result.sourceLimit ?? 200;
186
+ // A company with no call yet says so, as the pane does; a US symbol the SEC does not know is not one.
187
+ const ticker = typeof args.argument === "string" ? args.argument : null;
188
+ const none = ticker && !result.calls.length && !result.pending && !result.unknownTicker ? noCallsText(ticker) : null;
173
189
  const sourceLimitReached = result.sourceLimitReached ?? result.calls.length >= sourceLimit;
174
190
 
175
191
  return {
176
192
  columns: CALL_COLUMNS,
177
193
  rows,
194
+ ...(none ? { empty: `${none.title} ${none.message}` } : {}),
178
195
  ...(next ? { textRows: rows.filter((row) => row.id !== next.id) } : {}),
179
196
  errors: optionalErrors(unansweredRefreshError(result)),
180
197
  ...(sourceLimitReached || result.pending ? { complete: false } : {}),
@@ -243,6 +260,7 @@ function transcriptResult(
243
260
  company: transcript.companyName,
244
261
  fiscalYear: transcript.fiscalYear,
245
262
  fiscalQuarter: transcript.fiscalQuarter,
263
+ ...(transcript.fiscalHalf ? { fiscalHalf: transcript.fiscalHalf } : {}),
246
264
  event: eventLabelOf(transcript),
247
265
  // A call held in another language: the text is an English translation, its original under --section original.
248
266
  translatedFrom: language,
@@ -290,6 +308,7 @@ function projectCalendar(
290
308
  event: eventLabelOf(call),
291
309
  fiscalYear: call.fiscalYear,
292
310
  fiscalQuarter: call.fiscalQuarter,
311
+ ...(call.fiscalHalf ? { fiscalHalf: call.fiscalHalf } : {}),
293
312
  in: calendarAway(call, now),
294
313
  status: call.hasTranscript ? "transcribed" : callStatusLabel(call, now) || call.status,
295
314
  hasTranscript: call.hasTranscript,
@@ -469,6 +488,7 @@ export function createEarningsCallsHeadless(
469
488
  const ahead = findCallForQuarter(calls.calls, quarter);
470
489
  if (ahead) throw new Error(`${ticker}'s ${quarter} call is still to come. ${nextCallNotice(ahead, now)}`);
471
490
  if (calls.unknownTicker) throw new Error(`${ticker} is not a known listed company.`);
491
+ if (!calls.calls.length && !calls.pending) throw new Error(noCallsText(ticker).title);
472
492
  if (calls.pending) throw new Error(`Earnings call discovery for ${ticker} is still pending.`);
473
493
  if (calls.sourceLimitReached ?? calls.calls.length >= (calls.sourceLimit ?? 200)) {
474
494
  throw new Error(`No ${quarter} earnings call found among the latest ${calls.sourceLimit ?? 200} loaded calls for ${ticker}; earlier calls may exist.`);
@@ -23,6 +23,7 @@ export const earningsCallsModule: PluginModule = {
23
23
  order: 34,
24
24
  component: EarningsCallsPane,
25
25
  instruments: ["equity"],
26
+ proOnly: true,
26
27
  });
27
28
  },
28
29
 
@@ -295,10 +295,20 @@ export function findCallForQuarter(
295
295
  )) ?? null;
296
296
  }
297
297
 
298
+ // A half year's results: "H1 26", "1H26", "26H1".
299
+ const half = token.match(/^(?:H([12])(\d{2}|\d{4})?|([12])H(\d{2}|\d{4})?|(\d{2}|\d{4})H([12]))$/);
300
+ if (half) {
301
+ const which = Number(half[1] ?? half[3] ?? half[6]);
302
+ const year = half[2] ?? half[4] ?? half[5];
303
+ return sorted.find((call) => call.fiscalHalf === which && sameYear(call.fiscalYear, year ? Number(year) : null)) ?? null;
304
+ }
305
+
306
+ // A year's call, never its half's (SHKP's interim and annual results calls share FY2026), even when the half is all
307
+ // the year has so far: H1-2026 asks for that one.
298
308
  const fiscalYear = token.match(/^(?:FY)?(\d{2}|\d{4})$/);
299
309
  if (fiscalYear) {
300
310
  const year = Number(fiscalYear[1]);
301
- return sorted.find((call) => sameYear(call.fiscalYear, year)) ?? null;
311
+ return sorted.find((call) => sameYear(call.fiscalYear, year) && !call.fiscalHalf) ?? null;
302
312
  }
303
313
 
304
314
  return null;
@@ -51,7 +51,7 @@ import {
51
51
  import { isPermanentClientError } from "../../../api-client/errors";
52
52
  import { savedCopyFooterInfo } from "../../../components/layout/pane/footer";
53
53
  import { STALE_SEGMENT } from "../../../components/layout/pane/status-footer";
54
- import { callPeriod, callTitle, eventLabelOf, formatCallDate, formatDuration, formatSentiment } from "./format";
54
+ import { callPeriod, callTitle, eventLabelOf, formatCallDate, formatDuration, formatSentiment, noCallsText } from "./format";
55
55
  import { findCallForQuarter, findInLines, MIN_FIND_LENGTH, originalIsMachineTranscript, translatedFrom, turnParagraphs } from "./model";
56
56
  import { READER_TABS, TranscriptView, type ReaderTab, type TranscriptPlayback } from "./transcript-view";
57
57
  import { PLAYBACK_RATES, SEEK_STEP_SECONDS, useCallPlayback } from "./use-call-playback";
@@ -1012,10 +1012,7 @@ function CallsListView({
1012
1012
  return listPending ? (
1013
1013
  <PaneStatusBody loading align="center" loadingLabel={`Looking for ${ticker}'s earnings calls...`} />
1014
1014
  ) : (
1015
- <EmptyState
1016
- title={`No earnings calls found for ${ticker}.`}
1017
- message="Calls appear here once the company's investor site or filings list a webcast."
1018
- />
1015
+ <EmptyState {...noCallsText(ticker)} />
1019
1016
  );
1020
1017
  }
1021
1018
 
@@ -605,6 +605,33 @@ export function countriesWithoutEvents(filter: CountryFilter, events: ReadonlyAr
605
605
  return filterCountries(filter).filter((country) => !listed.has(country));
606
606
  }
607
607
 
608
+ /**
609
+ * The countries the calendar covers: those of the currencies its release feed
610
+ * lists (the euro area's members under EU), the banks whose decisions and the
611
+ * statistics offices whose CPI releases Gloom Cloud keeps, and Hong Kong's and
612
+ * Singapore's government bond auctions.
613
+ */
614
+ const CALENDAR_COUNTRIES: ReadonlySet<string> = new Set([
615
+ "US", "EU", ...Object.values(EURO_AREA_MEMBERS), "GB", "JP", "CN", "CA", "AU", "NZ", "CH",
616
+ "IN", "ID", "KR", "BR", "MX", "RU", "TR", "ZA", "NO", "SE", "HK", "SG",
617
+ ]);
618
+
619
+ /**
620
+ * Countries the filter names that the calendar does not cover (EG, NG, AR):
621
+ * none it knows of, and none any row of the loaded calendar is for, so no
622
+ * release of theirs would show however long the window.
623
+ */
624
+ export function countriesNotInCalendar(filter: CountryFilter, events: ReadonlyArray<Pick<EconEvent, "country" | "event">>): string[] {
625
+ const listed = new Set(countriesWithoutEvents(filter, events));
626
+ return filterCountries(filter).filter((country) => listed.has(country) && !CALENDAR_COUNTRIES.has(country));
627
+ }
628
+
629
+ /** "EG is not in the calendar", or EG, NG and AR are (`countriesNotInCalendar`). */
630
+ export function notInCalendarMessage(countries: readonly string[]): string {
631
+ const named = countries.length > 1 ? `${countries.slice(0, -1).join(", ")} and ${countries.at(-1)}` : countries.join("");
632
+ return `${named} ${countries.length > 1 ? "are" : "is"} not in the calendar.`;
633
+ }
634
+
608
635
  /**
609
636
  * "No scheduled releases for MX in this window", or for MX or ZA; with the
610
637
  * day the listing ends, where it does ("; releases are listed through 2026-11-20").
@@ -28,6 +28,9 @@ const GROUPS: ReadonlyArray<{ group: string; rows: readonly FredRow[] }> = [
28
28
  ["DFII10", "10Y TIPS real yield", "%", "daily", ["treasury", "real yield"]],
29
29
  ["T10Y2Y", "10Y minus 2Y Treasury spread", "%", "daily", ["treasury", "curve", "2s10s"]],
30
30
  ["T10Y3M", "10Y minus 3M Treasury spread", "%", "daily", ["treasury", "curve"]],
31
+ // The Federal Reserve Board's Kim-Wright estimates, a week or so behind.
32
+ ...Array.from({ length: 10 }, (_, index): FredRow =>
33
+ [`THREEFYTP${index + 1}`, `${index + 1}Y Treasury term premium (Kim-Wright)`, "%", "daily", ["treasury", "term premium", "Kim-Wright"]]),
31
34
  ["SOFR", "SOFR", "%", "daily", ["secured overnight financing rate", "money markets"]],
32
35
  ["SORA", "SORA (Singapore overnight rate average)", "%", "daily", ["SGD", "Singapore", "MAS", "overnight", "money markets"]],
33
36
  ["OBFR", "Overnight bank funding rate", "%", "daily", ["OBFR", "money markets"]],
@@ -56,7 +56,9 @@ import {
56
56
  matchesCountry,
57
57
  matchesImpact,
58
58
  NO_CONSENSUS_NOTE,
59
+ countriesNotInCalendar,
59
60
  noScheduledReleasesMessage,
61
+ notInCalendarMessage,
60
62
  noTimeNote as noTimeNoteText,
61
63
  parseCountryFilter,
62
64
  listingEnd,
@@ -322,11 +324,16 @@ function EconCalendarPane({ focused, width, height }: PaneProps) {
322
324
  const separatorBg = blendHex(colors.bg, colors.border, 0.3);
323
325
  const staleness = fetchedAt ? formatStaleness(fetchedAt, now) : "";
324
326
  // The calendar has events and the filters hid them all: say which, with the way back.
325
- // Countries named one by one with nothing in the calendar: a quiet window there, said plainly.
327
+ // Countries named one by one with nothing in the calendar: a quiet window there, or one the calendar does not cover
328
+ // (EG, NG), said plainly.
326
329
  const unscheduled = useMemo(() => countriesWithoutEvents(countryFilter, events), [countryFilter, events]);
330
+ const absent = useMemo(() => countriesNotInCalendar(countryFilter, events), [countryFilter, events]);
331
+ const quiet = unscheduled.filter((code) => !absent.includes(code));
327
332
  const filterEmptyTitle = events.length === 0 ? null
328
333
  : unscheduled.length > 0 && unscheduled.length === countryFilter.split(",").length
329
- ? noScheduledReleasesMessage(unscheduled, releasesThrough ? shortDayLabel(dayStart(releasesThrough)) : null).replace(/\.$/, "")
334
+ ? [absent.length > 0 ? notInCalendarMessage(absent) : null,
335
+ quiet.length > 0 ? noScheduledReleasesMessage(quiet, releasesThrough ? shortDayLabel(dayStart(releasesThrough)) : null) : null]
336
+ .filter(Boolean).join(" ").replace(/\.$/, "")
330
337
  : filteredEmptyTitle(impactFilter, countryFilter);
331
338
  const emptyStateHint = !loading && !error
332
339
  ? [
@@ -261,8 +261,10 @@ export const econStatisticsHeadless: HeadlessPaneDefinition<"bundle"> = {
261
261
  const read = typeof args.argument === "string" ? readStatArg(args.argument) : null;
262
262
  const requested = read?.stat ?? null;
263
263
  if (args.argument && !requested) {
264
+ // ECST is the US's statistics; another country's policy rate is in CBR, and its published series in `fred`.
264
265
  throw new Error(
265
- `Unknown economic statistic "${String(args.argument)}". Use one of: ${STATS.map(({ id }) => id).join(", ")}.`,
266
+ `Unknown economic statistic "${String(args.argument)}". ECST covers US statistics only: ${STATS.map(({ id }) => id).join(", ")}. `
267
+ + "For other countries, policy rates are in fn CBR and published series in gloom fred --list.",
266
268
  );
267
269
  }
268
270
  const range = args.options.range as StatRangeId;
@@ -22,7 +22,7 @@ export const econStatisticsModule: PluginModule = {
22
22
  id: "econ-statistics-pane",
23
23
  paneId: ECON_STATISTICS_PANE_ID,
24
24
  label: "Economic Statistics",
25
- description: "Inflation, labour, growth, housing and rates against their own history.",
25
+ description: "US inflation, labour, growth, housing and rates against their own history.",
26
26
  keywords: [...new Set([
27
27
  "economic",
28
28
  "statistics",
@@ -6,7 +6,7 @@ import type { QueryEntry } from "../../../market-data/result-types";
6
6
  import { buildQuoteKey, resolveEntryData } from "../../../market-data/selectors";
7
7
  import type { Quote } from "../../../types/financials";
8
8
  import { isFiniteNumber } from "../../../utils/guards";
9
- import { isValuationMultiple } from "./model";
9
+ import { isValuationMultiple, screenRowId } from "./model";
10
10
 
11
11
  /**
12
12
  * A screen row with its quote laid over it: price, change, volume and market
@@ -107,32 +107,64 @@ function overlayLiveScreenRow(snapshotRow: ScreenRow, quote: Quote | null | unde
107
107
  /** The last overlay per snapshot row, so a row whose quote did not move keeps its object. */
108
108
  const liveRows = new WeakMap<ScreenRow, { quote: Quote | null; row: LiveScreenRow }>();
109
109
 
110
- function overlayRows(rows: readonly ScreenRow[], quoteOf: (key: string) => Quote | null | undefined): LiveScreenRow[] {
111
- return rows.map((row) => {
112
- const quote = quoteOf(screenRowQuoteKey(row));
113
- if (quote === undefined) return row;
114
- const cached = liveRows.get(row);
115
- if (cached && cached.quote === quote) return cached.row;
116
- const next = overlayLiveScreenRow(row, quote);
117
- liveRows.set(row, { quote, row: next });
118
- return next;
119
- });
110
+ /** Where each quote key sits in a rows array: a screen's rows are replaced as a whole, so this is read once per array. */
111
+ const rowPositions = new WeakMap<readonly ScreenRow[], Map<string, number[]>>();
112
+
113
+ function positionsByQuoteKey(rows: readonly ScreenRow[]): Map<string, number[]> {
114
+ let positions = rowPositions.get(rows);
115
+ if (!positions) {
116
+ positions = new Map();
117
+ rows.forEach((row, index) => {
118
+ const key = screenRowQuoteKey(row);
119
+ const at = positions!.get(key);
120
+ if (at) at.push(index);
121
+ else positions!.set(key, [index]);
122
+ });
123
+ rowPositions.set(rows, positions);
124
+ }
125
+ return positions;
126
+ }
127
+
128
+ /**
129
+ * The rows with their quotes laid over them. Only the rows a quote names are
130
+ * touched, so a long list costs what its quotes do, and the same array comes
131
+ * back while none of them moved a row (a tick for a row off the loaded pages,
132
+ * or one that changes none of what the row shows).
133
+ */
134
+ function overlayRows(
135
+ rows: readonly ScreenRow[],
136
+ quotes: Iterable<readonly [string, Quote | null | undefined]>,
137
+ ): readonly LiveScreenRow[] {
138
+ const positions = positionsByQuoteKey(rows);
139
+ let next: LiveScreenRow[] | null = null;
140
+ for (const [key, quote] of quotes) {
141
+ if (quote === undefined) continue;
142
+ for (const index of positions.get(key) ?? []) {
143
+ const row = rows[index]!;
144
+ let live: LiveScreenRow;
145
+ const cached = liveRows.get(row);
146
+ if (cached && cached.quote === quote) live = cached.row;
147
+ else {
148
+ live = overlayLiveScreenRow(row, quote);
149
+ liveRows.set(row, { quote, row: live });
150
+ }
151
+ if (live !== (next ?? rows)[index]) (next ??= [...rows])[index] = live;
152
+ }
153
+ }
154
+ return next ?? rows;
120
155
  }
121
156
 
122
157
  /** The pane's rows with the streamed quotes on screen laid over them. */
123
158
  export function overlayLiveScreenRows(
124
159
  rows: readonly ScreenRow[],
125
160
  entries: ReadonlyMap<string, QueryEntry<Quote>>,
126
- ): LiveScreenRow[] {
127
- return overlayRows(rows, (key) => {
128
- const entry = entries.get(key);
129
- return entry ? resolveEntryData(entry) : undefined;
130
- });
161
+ ): readonly LiveScreenRow[] {
162
+ return overlayRows(rows, Array.from(entries, ([key, entry]) => [key, resolveEntryData(entry)] as const));
131
163
  }
132
164
 
133
165
  /** Rows with quotes keyed by screenRowQuoteKey laid over them, for a report. */
134
- export function overlayScreenQuotes(rows: readonly ScreenRow[], quotes: ReadonlyMap<string, Quote>): LiveScreenRow[] {
135
- return overlayRows(rows, (key) => quotes.get(key));
166
+ export function overlayScreenQuotes(rows: readonly ScreenRow[], quotes: ReadonlyMap<string, Quote>): readonly LiveScreenRow[] {
167
+ return overlayRows(rows, quotes);
136
168
  }
137
169
 
138
170
  /** The fields a quote moves on a row (overlayLiveScreenRow). */
@@ -165,6 +197,30 @@ export function sortLiveScreenRows<T extends ScreenRow>(rows: readonly T[], sort
165
197
  .map(({ row }) => row);
166
198
  }
167
199
 
200
+ /**
201
+ * Where each row sits in the screen's order by the figures it shows
202
+ * (sortLiveScreenRows), by row id in that order. The pane takes it from
203
+ * figures sampled every few seconds, so a tick reorders nothing: the rows it
204
+ * moves are placed by it (placeLiveScreenRows), and the sort is not redone.
205
+ */
206
+ export function liveScreenPlaces(rows: readonly ScreenRow[], sort: ScreenDefinition["sort"]): ReadonlyMap<string, number> {
207
+ return new Map(sortLiveScreenRows(rows, sort).map((row, index) => [screenRowId(row), index]));
208
+ }
209
+
210
+ /** `rows` in the order of `places`; a row it does not know follows those it does, in the order it has. */
211
+ export function placeLiveScreenRows<T extends ScreenRow>(rows: readonly T[], places: ReadonlyMap<string, number>): T[] {
212
+ const placed: Array<T | undefined> = [];
213
+ const rest: T[] = [];
214
+ for (const row of rows) {
215
+ const place = places.get(screenRowId(row));
216
+ if (place === undefined || placed[place] !== undefined) rest.push(row);
217
+ else placed[place] = row;
218
+ }
219
+ const ordered: T[] = [];
220
+ for (const row of placed) if (row !== undefined) ordered.push(row);
221
+ return ordered.concat(rest);
222
+ }
223
+
168
224
  /** The extended sessions some row has a print for, in the order their columns go. */
169
225
  export function screenExtendedSessions(rows: readonly LiveScreenRow[]): ExtendedSession[] {
170
226
  return (["PRE", "POST", "OVERNIGHT"] as const).filter((session) => rows.some((row) => row.extended?.session === session));
@@ -339,8 +339,12 @@ export function screenMetricSetting(setting: unknown, fallback: NumericField): [
339
339
  * snapshot's day without one.
340
340
  */
341
341
  export function screenYtdBase(rows: readonly ScreenRow[], assembledAt?: string | null, now = Date.now()): string | null {
342
- const day = rows.map((row) => row.metrics.returnYtdPercent?.asOf?.slice(0, 10) ?? "").filter(Boolean).sort().at(-1)
343
- ?? assembledAt?.slice(0, 10);
342
+ let newest = "";
343
+ for (const row of rows) {
344
+ const day = row.metrics.returnYtdPercent?.asOf?.slice(0, 10);
345
+ if (day && day > newest) newest = day;
346
+ }
347
+ const day = newest || assembledAt?.slice(0, 10);
344
348
  return day ? yearToDateBaseLabel(day, "NYSE", now) : null;
345
349
  }
346
350
 
@@ -420,8 +424,19 @@ export function screenCurrencyEmpty(
420
424
  };
421
425
  }
422
426
 
423
- export const screenRowId = (row: Pick<ScreenRow, "symbol" | "exchange">) =>
424
- `${canonicalExchange(row.exchange)}:${row.symbol}`;
427
+ /**
428
+ * A row's id as last read: the table, the order and the lookups of a long list
429
+ * ask for it row by row on every render, and a screen's rows do not change
430
+ * between them.
431
+ */
432
+ const rowIds = new WeakMap<object, { symbol: string; exchange: string; id: string }>();
433
+ export const screenRowId = (row: Pick<ScreenRow, "symbol" | "exchange">) => {
434
+ const known = rowIds.get(row);
435
+ if (known && known.symbol === row.symbol && known.exchange === row.exchange) return known.id;
436
+ const id = `${canonicalExchange(row.exchange)}:${row.symbol}`;
437
+ rowIds.set(row, { symbol: row.symbol, exchange: row.exchange, id });
438
+ return id;
439
+ };
425
440
  export const screenLabel = (field: string) =>
426
441
  ({
427
442
  kpiArr: "Annual recurring revenue",