@gloom-sh/terminal 0.20.20 → 0.20.21

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 (365) hide show
  1. package/package.json +3 -1
  2. package/src/api-client/data.ts +1 -1
  3. package/src/api-client/equity-screener.ts +17 -0
  4. package/src/api-client/futures-curve.ts +5 -0
  5. package/src/api-client/market-discovery.ts +8 -0
  6. package/src/api-client/members.ts +2 -0
  7. package/src/api-client/paths.ts +3 -0
  8. package/src/api-client/perps.ts +20 -0
  9. package/src/api-client/request.ts +53 -7
  10. package/src/api-client/types/filings-and-calls.ts +2 -0
  11. package/src/app/pane-runtime/plugin-bindings.ts +6 -4
  12. package/src/app/pro-welcome/model.ts +15 -11
  13. package/src/app/pro-welcome/row.tsx +3 -3
  14. package/src/app/pro-welcome/use-pro-welcome.ts +2 -2
  15. package/src/app/runtime/startup.ts +3 -2
  16. package/src/app.tsx +3 -2
  17. package/src/capabilities/asset-data-inputs.ts +5 -0
  18. package/src/capabilities/factories.ts +8 -3
  19. package/src/capabilities/registry.ts +1 -0
  20. package/src/capabilities/types.ts +1 -0
  21. package/src/cli/commands/market.ts +68 -35
  22. package/src/cli/commands/options-chain.ts +2 -2
  23. package/src/cli/commands/overview.ts +10 -9
  24. package/src/cli/commands/ticker.ts +19 -4
  25. package/src/cli/desktop-pane-shot.ts +11 -3
  26. package/src/cli/export-source.ts +35 -2
  27. package/src/cli/glossary.ts +3 -2
  28. package/src/cli/helpers.ts +2 -1
  29. package/src/cli/history-demergers.ts +41 -10
  30. package/src/cli/history-rows.ts +3 -1
  31. package/src/cli/known-gaps.ts +21 -7
  32. package/src/cli/listing-arg.ts +22 -11
  33. package/src/cli/pane-functions/capabilities.ts +4 -9
  34. package/src/cli/pane-functions/catalog-snapshot.json +29 -29
  35. package/src/cli/pane-functions/catalog.ts +1 -18
  36. package/src/cli/pane-functions/data.ts +8 -4
  37. package/src/cli/pane-functions/financial-ratio-shot.ts +20 -5
  38. package/src/cli/pane-functions/freshness.ts +57 -12
  39. package/src/cli/pane-functions/function-help.ts +2 -2
  40. package/src/cli/pane-functions/headless.ts +6 -0
  41. package/src/cli/pane-functions/index.ts +11 -4
  42. package/src/cli/pane-functions/market-session.ts +25 -0
  43. package/src/cli/pane-functions/report-notices.ts +10 -0
  44. package/src/cli/pane-functions/resolver.ts +75 -3
  45. package/src/cli/pane-functions/screenshot-bridge.ts +1 -0
  46. package/src/cli/pane-functions/screenshot-data-evidence.ts +1 -0
  47. package/src/cli/pane-functions/screenshot-payload.ts +38 -5
  48. package/src/cli/pane-functions/screenshot-render.ts +20 -7
  49. package/src/cli/perpetual-contract.ts +14 -1
  50. package/src/cli/report-tables.ts +11 -2
  51. package/src/cli/result.ts +6 -1
  52. package/src/components/chart-table/layout.ts +8 -4
  53. package/src/components/command-bar/list/model.ts +2 -0
  54. package/src/components/command-bar/pane-templates/items.ts +5 -25
  55. package/src/components/command-bar/panel/index.tsx +7 -4
  56. package/src/components/command-bar/routes/root/provider-search.ts +4 -4
  57. package/src/components/command-bar/routes/root/results.ts +6 -2
  58. package/src/components/command-bar/routes/ticker-search/results.ts +19 -0
  59. package/src/components/command-bar/routes/ticker-search/route.ts +3 -3
  60. package/src/components/command-bar/routes/ticker-search/title.ts +23 -0
  61. package/src/components/command-bar/routing/list-state.ts +17 -5
  62. package/src/components/command-bar/selection-runtime.ts +3 -2
  63. package/src/components/command-bar/surface/index.tsx +2 -0
  64. package/src/components/command-bar/workflow/alert.ts +6 -4
  65. package/src/components/command-bar/workflow/collection-actions.ts +2 -1
  66. package/src/components/layout/pane/footer/index.tsx +1 -0
  67. package/src/components/layout/pane/footer/model.ts +20 -7
  68. package/src/components/layout/pane/title.ts +11 -2
  69. package/src/components/price-selector-dialog.tsx +8 -4
  70. package/src/components/ticker/badge/list.tsx +4 -3
  71. package/src/components/ticker/list-table-view.tsx +12 -1
  72. package/src/components/ui/query-bar.tsx +20 -14
  73. package/src/data/cached-query.ts +20 -4
  74. package/src/data/news-pane-snapshots.ts +2 -1
  75. package/src/data/plugin-cache.ts +5 -1
  76. package/src/data/saved-copies.ts +68 -2
  77. package/src/docs/snapshot.json +65 -14
  78. package/src/docs/topics.ts +11 -9
  79. package/src/i18n/es.ts +1 -0
  80. package/src/i18n/ja.ts +1 -0
  81. package/src/i18n/ko.ts +1 -0
  82. package/src/i18n/zh-cn.ts +1 -0
  83. package/src/i18n/zh-tw.ts +1 -0
  84. package/src/market-data/coordinator/index.ts +25 -5
  85. package/src/market-data/depositary-pair.ts +27 -10
  86. package/src/market-data/futures-roll-returns.ts +54 -7
  87. package/src/market-data/fx-closes.ts +14 -0
  88. package/src/market-data/market/futures-product-hours.ts +113 -0
  89. package/src/market-data/market/futures-week.ts +2 -0
  90. package/src/market-data/market/globex-day.ts +9 -2
  91. package/src/market-data/market/status.ts +32 -25
  92. package/src/market-data/market/venue-session.ts +18 -0
  93. package/src/market-data/options-alternatives.ts +49 -7
  94. package/src/market-data/perpetual-open-interest.ts +41 -0
  95. package/src/market-data/quotes/contributions.ts +4 -2
  96. package/src/market-data/quotes/export-identity.ts +11 -3
  97. package/src/market-data/quotes/freshness.ts +3 -2
  98. package/src/market-data/quotes/resolution.ts +9 -2
  99. package/src/market-data/quotes/tick-range.ts +22 -1
  100. package/src/market-data/quotes/time.ts +34 -4
  101. package/src/market-data/split-terms.ts +3 -2
  102. package/src/news/aggregator.ts +1 -0
  103. package/src/news/news-model.ts +12 -2
  104. package/src/news/types.ts +15 -0
  105. package/src/plugins/builtin/alerts/alert-engine.ts +2 -0
  106. package/src/plugins/builtin/alerts/cli-forms.ts +3 -2
  107. package/src/plugins/builtin/alerts/cli-move.ts +5 -2
  108. package/src/plugins/builtin/alerts/cli.ts +50 -25
  109. package/src/plugins/builtin/alerts/command.ts +51 -3
  110. package/src/plugins/builtin/alerts/event-rows.ts +1 -1
  111. package/src/plugins/builtin/alerts/events-pane.tsx +1 -1
  112. package/src/plugins/builtin/alerts/format.ts +67 -8
  113. package/src/plugins/builtin/alerts/headless.ts +22 -6
  114. package/src/plugins/builtin/alerts/index.tsx +26 -25
  115. package/src/plugins/builtin/alerts/move-checks.ts +1 -0
  116. package/src/plugins/builtin/alerts/pane.tsx +15 -6
  117. package/src/plugins/builtin/alerts/pro-rules.ts +9 -4
  118. package/src/plugins/builtin/alerts/quotes.ts +10 -5
  119. package/src/plugins/builtin/alerts/session.ts +28 -0
  120. package/src/plugins/builtin/alerts/types.ts +1 -0
  121. package/src/plugins/builtin/analytics/pane-model.ts +2 -1
  122. package/src/plugins/builtin/analytics/risk-model.ts +2 -2
  123. package/src/plugins/builtin/attention/headless.ts +2 -2
  124. package/src/plugins/builtin/attention/model.ts +7 -2
  125. package/src/plugins/builtin/attention/pane.tsx +2 -1
  126. package/src/plugins/builtin/awards/headless.ts +1 -1
  127. package/src/plugins/builtin/broker-trading/ticket.tsx +13 -5
  128. package/src/plugins/builtin/buildout/detail/company.tsx +0 -1
  129. package/src/plugins/builtin/buildout/detail/ui.tsx +7 -5
  130. package/src/plugins/builtin/buildout/model/normalizers.ts +0 -1
  131. package/src/plugins/builtin/buildout/model/types.ts +0 -1
  132. package/src/plugins/builtin/buildout/pane/index.tsx +9 -0
  133. package/src/plugins/builtin/buildout/pane/status.tsx +11 -0
  134. package/src/plugins/builtin/catalysts/headless.ts +1 -1
  135. package/src/plugins/builtin/chart-composer/headless.ts +14 -6
  136. package/src/plugins/builtin/chart-composer/pane.tsx +2 -1
  137. package/src/plugins/builtin/chart-composer/session-history.ts +14 -2
  138. package/src/plugins/builtin/chat/controller/index.ts +5 -3
  139. package/src/plugins/builtin/chat/controller/session-runtime.ts +18 -8
  140. package/src/plugins/builtin/chat/index.tsx +1 -1
  141. package/src/plugins/builtin/cloud/auth-actions.tsx +4 -2
  142. package/src/plugins/builtin/cloud/mcp-connect/dialog.tsx +4 -1
  143. package/src/plugins/builtin/cloud/thesis/ticker-tab.tsx +2 -1
  144. package/src/plugins/builtin/company-attention/headless.ts +2 -1
  145. package/src/plugins/builtin/company-kpis/headless.ts +1 -1
  146. package/src/plugins/builtin/correlation/headless.ts +3 -3
  147. package/src/plugins/builtin/correlation/history.ts +1 -0
  148. package/src/plugins/builtin/correlation/index.tsx +7 -5
  149. package/src/plugins/builtin/correlation/matrix/selection.ts +21 -3
  150. package/src/plugins/builtin/correlation/relationship/model.ts +5 -0
  151. package/src/plugins/builtin/correlation/relationship/pane.tsx +3 -2
  152. package/src/plugins/builtin/correlation/relationship/view-model.ts +3 -2
  153. package/src/plugins/builtin/credit-documents/headless.ts +1 -1
  154. package/src/plugins/builtin/dividend-yield/client.ts +81 -10
  155. package/src/plugins/builtin/dividend-yield/headless.ts +21 -10
  156. package/src/plugins/builtin/dividend-yield/model.ts +1 -1
  157. package/src/plugins/builtin/dividend-yield/pane.tsx +9 -5
  158. package/src/plugins/builtin/dividend-yield/ranking.ts +15 -5
  159. package/src/plugins/builtin/dividend-yield/reference-price.ts +3 -0
  160. package/src/plugins/builtin/dividend-yield/types.ts +12 -0
  161. package/src/plugins/builtin/dividend-yield/view.ts +30 -7
  162. package/src/plugins/builtin/doe/headless.ts +1 -1
  163. package/src/plugins/builtin/doe/pane.tsx +16 -7
  164. package/src/plugins/builtin/earnings-calls/data.ts +8 -5
  165. package/src/plugins/builtin/earnings-ripple/headless.ts +1 -1
  166. package/src/plugins/builtin/econ/calendar-model.ts +1 -1
  167. package/src/plugins/builtin/econ/index.tsx +26 -18
  168. package/src/plugins/builtin/equity-screener/client.ts +1 -1
  169. package/src/plugins/builtin/equity-screener/headless.ts +149 -31
  170. package/src/plugins/builtin/equity-screener/live.ts +23 -5
  171. package/src/plugins/builtin/equity-screener/model.ts +27 -12
  172. package/src/plugins/builtin/equity-screener/pane.tsx +5 -5
  173. package/src/plugins/builtin/exposure/headless.ts +1 -1
  174. package/src/plugins/builtin/exposure/holdings.ts +2 -2
  175. package/src/plugins/builtin/futures/index.tsx +29 -1
  176. package/src/plugins/builtin/futures/model.ts +93 -10
  177. package/src/plugins/builtin/futures/returns.ts +54 -1
  178. package/src/plugins/builtin/futures/table.tsx +14 -2
  179. package/src/plugins/builtin/futures/use-front-returns.ts +20 -3
  180. package/src/plugins/builtin/futures-curve/client.ts +1 -1
  181. package/src/plugins/builtin/futures-curve/headless.ts +9 -3
  182. package/src/plugins/builtin/futures-curve/model.ts +19 -5
  183. package/src/plugins/builtin/futures-curve/pane.tsx +12 -6
  184. package/src/plugins/builtin/gpu/headless.ts +1 -1
  185. package/src/plugins/builtin/gpu/model.ts +1 -1
  186. package/src/plugins/builtin/help/function-index.ts +16 -8
  187. package/src/plugins/builtin/help/functions-table.tsx +6 -4
  188. package/src/plugins/builtin/help/shortcut-model.ts +7 -2
  189. package/src/plugins/builtin/holders/headless.ts +16 -5
  190. package/src/plugins/builtin/holders/pane.tsx +43 -5
  191. package/src/plugins/builtin/insider/client.ts +118 -11
  192. package/src/plugins/builtin/insider/filing-stories.ts +36 -20
  193. package/src/plugins/builtin/insider/issuer.ts +5 -2
  194. package/src/plugins/builtin/iv-history/headless.ts +2 -0
  195. package/src/plugins/builtin/macro-day/client.ts +2 -3
  196. package/src/plugins/builtin/macro-day/comparison.ts +58 -0
  197. package/src/plugins/builtin/macro-day/headless.ts +47 -3
  198. package/src/plugins/builtin/macro-day/index.tsx +32 -9
  199. package/src/plugins/builtin/macro-day/model.ts +1 -1
  200. package/src/plugins/builtin/macro-day/pane.tsx +99 -12
  201. package/src/plugins/builtin/market-heatmap/index.tsx +2 -2
  202. package/src/plugins/builtin/market-movers/footer.ts +29 -3
  203. package/src/plugins/builtin/market-movers/headless.ts +12 -5
  204. package/src/plugins/builtin/market-movers/index.tsx +3 -3
  205. package/src/plugins/builtin/market-movers/session-body.tsx +6 -3
  206. package/src/plugins/builtin/market-valuation/detail.tsx +3 -3
  207. package/src/plugins/builtin/market-valuation/headless.ts +6 -6
  208. package/src/plugins/builtin/market-valuation/pane.tsx +2 -3
  209. package/src/plugins/builtin/market-valuation/view.ts +6 -8
  210. package/src/plugins/builtin/members/client.ts +9 -2
  211. package/src/plugins/builtin/members/headless.ts +8 -10
  212. package/src/plugins/builtin/members/model.ts +29 -17
  213. package/src/plugins/builtin/members/pane.tsx +10 -12
  214. package/src/plugins/builtin/money-markets/headless.ts +1 -1
  215. package/src/plugins/builtin/news/headless.ts +4 -0
  216. package/src/plugins/builtin/news/index.tsx +3 -1
  217. package/src/plugins/builtin/news/wire/industry-pane.tsx +2 -1
  218. package/src/plugins/builtin/news/wire/news/preset-pane.tsx +1 -1
  219. package/src/plugins/builtin/news/wire/persisted-articles.ts +8 -4
  220. package/src/plugins/builtin/notes/headless.ts +7 -0
  221. package/src/plugins/builtin/notes/index.tsx +1 -1
  222. package/src/plugins/builtin/notes/quick-notes-pane.tsx +18 -2
  223. package/src/plugins/builtin/options/view.tsx +7 -6
  224. package/src/plugins/builtin/options-positioning/headless.ts +4 -4
  225. package/src/plugins/builtin/options-positioning/pane.tsx +7 -3
  226. package/src/plugins/builtin/options-scenario/client.ts +20 -4
  227. package/src/plugins/builtin/options-scenario/headless.ts +1 -1
  228. package/src/plugins/builtin/pe-band/client.ts +5 -9
  229. package/src/plugins/builtin/pe-band/headless.ts +11 -13
  230. package/src/plugins/builtin/pe-band/model.ts +39 -60
  231. package/src/plugins/builtin/pe-band/pane.tsx +14 -15
  232. package/src/plugins/builtin/perps/equity-row.tsx +3 -1
  233. package/src/plugins/builtin/perps/freshness.ts +16 -9
  234. package/src/plugins/builtin/perps/headless.ts +4 -1
  235. package/src/plugins/builtin/perps/markets-section.tsx +16 -10
  236. package/src/plugins/builtin/perps/model.ts +33 -2
  237. package/src/plugins/builtin/perps/pane.tsx +3 -2
  238. package/src/plugins/builtin/perps/status-line.ts +12 -3
  239. package/src/plugins/builtin/perps/venue-markets.ts +38 -0
  240. package/src/plugins/builtin/plugin-marketplace/pane.tsx +4 -3
  241. package/src/plugins/builtin/portfolio-list/cell-version.ts +1 -1
  242. package/src/plugins/builtin/portfolio-list/cli/render.ts +46 -7
  243. package/src/plugins/builtin/portfolio-list/headless.ts +31 -8
  244. package/src/plugins/builtin/portfolio-list/settings.ts +3 -0
  245. package/src/plugins/builtin/portfolio-list/table.tsx +7 -1
  246. package/src/plugins/builtin/power/headless.ts +1 -1
  247. package/src/plugins/builtin/realized-vol/headless.ts +1 -1
  248. package/src/plugins/builtin/research/corporate-actions-pane.tsx +27 -13
  249. package/src/plugins/builtin/scanner/feed.ts +7 -4
  250. package/src/plugins/builtin/scanner/flow-pane.tsx +8 -4
  251. package/src/plugins/builtin/scanner/headless.ts +57 -26
  252. package/src/plugins/builtin/scanner/hilo-pane.tsx +6 -3
  253. package/src/plugins/builtin/scanner/lock-note.ts +3 -2
  254. package/src/plugins/builtin/scanner/us-session.ts +9 -0
  255. package/src/plugins/builtin/seasonality/client.ts +46 -10
  256. package/src/plugins/builtin/seasonality/headless.ts +29 -11
  257. package/src/plugins/builtin/seasonality/model.ts +101 -24
  258. package/src/plugins/builtin/seasonality/pane.tsx +10 -6
  259. package/src/plugins/builtin/sec/filing-content.ts +13 -0
  260. package/src/plugins/builtin/sec/index.tsx +16 -11
  261. package/src/plugins/builtin/sectors/client.ts +27 -5
  262. package/src/plugins/builtin/sectors/headless.ts +2 -1
  263. package/src/plugins/builtin/sectors/index.tsx +22 -10
  264. package/src/plugins/builtin/shared/cloud-resource.ts +3 -3
  265. package/src/plugins/builtin/shared/extended-print.ts +38 -0
  266. package/src/plugins/builtin/shared/pro-feature-wall.tsx +1 -1
  267. package/src/plugins/builtin/shared/report-freshness.ts +7 -3
  268. package/src/plugins/builtin/shared/scanner-capture.ts +16 -3
  269. package/src/plugins/builtin/shared/ticker-company.ts +17 -8
  270. package/src/plugins/builtin/shared/use-quote-board.ts +11 -4
  271. package/src/plugins/builtin/social-mentions/client.ts +7 -3
  272. package/src/plugins/builtin/social-mentions/outliers.tsx +9 -2
  273. package/src/plugins/builtin/thirteenf/api.ts +24 -3
  274. package/src/plugins/builtin/thirteenf/data.ts +21 -8
  275. package/src/plugins/builtin/thirteenf/headless.ts +7 -3
  276. package/src/plugins/builtin/thirteenf/signals-pane.tsx +10 -3
  277. package/src/plugins/builtin/thirteenf/signals.ts +22 -1
  278. package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +4 -2
  279. package/src/plugins/builtin/ticker-detail/financials/model.ts +7 -0
  280. package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +15 -6
  281. package/src/plugins/builtin/ticker-detail/financials/ratios.ts +5 -4
  282. package/src/plugins/builtin/ticker-detail/financials/tab.tsx +14 -5
  283. package/src/plugins/builtin/ticker-detail/headless.ts +32 -26
  284. package/src/plugins/builtin/ticker-detail/index.tsx +1 -1
  285. package/src/plugins/builtin/ticker-detail/overview/components.tsx +8 -3
  286. package/src/plugins/builtin/ticker-detail/overview/model.ts +28 -5
  287. package/src/plugins/builtin/ticker-detail/overview/pane.tsx +14 -1
  288. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +9 -8
  289. package/src/plugins/builtin/ticker-detail/pane.tsx +16 -9
  290. package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +41 -23
  291. package/src/plugins/builtin/ticker-detail/quote-monitor/rows.ts +30 -13
  292. package/src/plugins/builtin/ticker-detail/settings.ts +9 -2
  293. package/src/plugins/builtin/time-sales/headless.ts +49 -13
  294. package/src/plugins/builtin/time-sales/model.ts +2 -2
  295. package/src/plugins/builtin/time-sales/window.ts +84 -10
  296. package/src/plugins/builtin/vol-surface/charts.tsx +4 -2
  297. package/src/plugins/builtin/vol-surface/events.ts +12 -5
  298. package/src/plugins/builtin/vol-surface/headless.ts +1 -1
  299. package/src/plugins/builtin/vol-surface/pane.tsx +15 -7
  300. package/src/plugins/builtin/world-indices/footer.ts +1 -1
  301. package/src/plugins/builtin/world-venue-map/chokepoint-report.ts +3 -1
  302. package/src/plugins/builtin/world-venue-map/headless.ts +27 -13
  303. package/src/plugins/builtin/yield-curve/client.ts +3 -1
  304. package/src/plugins/duplicates.ts +60 -0
  305. package/src/plugins/loader.ts +12 -3
  306. package/src/plugins/marketplace/model.ts +10 -1
  307. package/src/portfolio/column-values.ts +52 -5
  308. package/src/react/async-resource.ts +8 -7
  309. package/src/renderers/browser/bundled-plugins.ts +2 -1
  310. package/src/renderers/dom/build-assets.ts +20 -0
  311. package/src/renderers/dom/data-table/index.tsx +36 -2
  312. package/src/renderers/dom/es2023-array-methods.ts +57 -0
  313. package/src/renderers/dom/host/surface-fit.ts +64 -13
  314. package/src/renderers/dom/styles.css +6 -1
  315. package/src/renderers/electrobun/bun/external-plugins.ts +16 -6
  316. package/src/renderers/electrobun/shared/protocol.ts +2 -0
  317. package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +31 -7
  318. package/src/renderers/electrobun/view/cli-pane-shot-frame.tsx +15 -8
  319. package/src/renderers/electrobun/view/external-plugins.ts +1 -0
  320. package/src/renderers/electrobun/view/remote/asset-data-client.ts +1 -0
  321. package/src/series/types.ts +1 -0
  322. package/src/sources/gloomberb-cloud/fred-attribution.ts +6 -5
  323. package/src/sources/gloomberb-cloud/index.ts +42 -5
  324. package/src/sources/gloomberb-cloud/news.ts +15 -2
  325. package/src/sources/gloomberb-cloud/normalizers.ts +9 -0
  326. package/src/sources/history-result.ts +2 -1
  327. package/src/sources/history-retention.ts +14 -2
  328. package/src/sources/listing-symbols.ts +1 -1
  329. package/src/sources/provider-router/cache.ts +32 -3
  330. package/src/sources/provider-router/cached-routes.ts +25 -0
  331. package/src/sources/provider-router/connection-health.ts +1 -0
  332. package/src/sources/provider-router/history.ts +2 -2
  333. package/src/sources/provider-router/index.ts +14 -0
  334. package/src/sources/provider-router/sec-filings-page.ts +25 -0
  335. package/src/sources/sec-edgar/content.ts +67 -36
  336. package/src/tickers/listing-fate.ts +28 -0
  337. package/src/tickers/search/home-listing.ts +3 -0
  338. package/src/tickers/search/index-root-lead.ts +40 -0
  339. package/src/tickers/terminal-codes.ts +7 -4
  340. package/src/time-series/base-series.ts +17 -8
  341. package/src/time-series/fundamentals/historical-valuation.ts +2 -2
  342. package/src/time-series/fundamentals/series.ts +15 -12
  343. package/src/time-series/history-acquisition.ts +2 -0
  344. package/src/time-series/market.ts +3 -1
  345. package/src/time-series/price-comparison.ts +3 -1
  346. package/src/time-series/resolve-context.ts +8 -0
  347. package/src/time-series/resolve.ts +50 -10
  348. package/src/time-series/types.ts +1 -0
  349. package/src/time-series/use-chart-resolution.ts +2 -2
  350. package/src/time-series/valuation-currency.ts +40 -12
  351. package/src/types/data-provider.ts +30 -1
  352. package/src/types/financials.ts +23 -0
  353. package/src/types/headless.ts +23 -0
  354. package/src/types/instrument.ts +1 -0
  355. package/src/utils/crypto-pair.ts +16 -0
  356. package/src/utils/exchange-announcements.ts +2 -1
  357. package/src/utils/exchange-notation.generated.ts +58 -1
  358. package/src/utils/exchanges.ts +43 -1
  359. package/src/utils/format.ts +37 -2
  360. package/src/utils/function-search.ts +38 -0
  361. package/src/utils/fuzzy-search.ts +10 -6
  362. package/src/utils/option-choice.ts +15 -0
  363. package/src/utils/price-history.ts +15 -1
  364. package/src/utils/reason-codes.ts +6 -3
  365. package/src/utils/trailing-dividend.ts +241 -28
@@ -8,12 +8,16 @@ import { instrumentFromTicker } from "../../../market-data/request-types";
8
8
  import { usePaneSettingValue, usePluginPaneState } from "../../../public/react";
9
9
  import { useAsyncResource } from "../../../react/async-resource";
10
10
  import { useCloudDisplayScope } from "../../../api-client/plan-access";
11
+ import { usePaneInstance } from "../../../state/app/context";
12
+ import { parsePublicTickerKey } from "../../../utils/exchanges";
11
13
  import { useAutoRefresh } from "../../../react/auto-refresh";
12
14
  import { shownPriceColor } from "../../../theme/colors";
13
15
  import { useThemeColors } from "../../../theme/theme-context";
14
16
  import type { PaneProps } from "../../../types/plugin";
15
17
  import { Box } from "../../../ui";
16
18
  import { loadMacroDayEarnings, loadMacroDayHistory, loadMacroReleases, macroDayEarningsNotice } from "./client";
19
+ import { compareMacroDays, loadMacroDayTarget, MACRO_DAY_DAILY_BASIS, macroDayComparisonHeader, macroDayKey,
20
+ projectMacroDayTargets, type MacroDayComparisonRow } from "./comparison";
17
21
  import {
18
22
  formatMacroDayMove, macroDayEventLabel, macroDayEventNote, macroDayMoveDecimals, macroDayStats, matchesSurprise, macroFigureGapNotices,
19
23
  macroSurpriseBasisLabel, macroSurpriseExclusionNote, macroSurpriseOf, projectMacroDays, type MacroDayEvent,
@@ -109,12 +113,101 @@ function figures(model: MacroDayModel, release: string): StatItem[] {
109
113
  ];
110
114
  }
111
115
 
112
- export function MacroDayPane({ width, height, focused }: PaneProps) {
113
- const colors = useThemeColors();
114
- const { symbol, ticker, error: identityError } = usePaneTicker();
116
+ function useMacroDayFilters() {
115
117
  const [lookback, setLookback] = usePaneSettingValue("lookbackYears", "5");
116
118
  const [release, setRelease] = usePluginPaneState("release", "all");
117
119
  const [surprise, setSurprise] = usePluginPaneState<MacroSurprise | "all">("surprise", "all");
120
+ return { lookback, setLookback, release, setRelease, surprise, setSurprise };
121
+ }
122
+
123
+ function MacroDayQuery({ width, filters }: { width: number; filters: ReturnType<typeof useMacroDayFilters> }) {
124
+ const { release, setRelease, surprise, setSurprise, lookback, setLookback } = filters;
125
+ return <QueryBar width={width} filters={[
126
+ { id: "release", label: "Release", value: release, options: RELEASE_OPTIONS, onChange: setRelease, inline: true },
127
+ { id: "surprise", label: "Surprise", value: surprise, options: SURPRISE_OPTIONS, onChange: (value) => setSurprise(value as MacroSurprise | "all") },
128
+ { id: "lookback", label: "Lookback", value: String(lookback), options: LOOKBACK_OPTIONS, onChange: setLookback },
129
+ ]} />;
130
+ }
131
+
132
+ export function MacroDayPane(props: PaneProps) {
133
+ const symbols = usePaneInstance()?.params?.symbols;
134
+ return symbols ? <MacroDayComparisonPane key={symbols} {...props} list={symbols} /> : <SingleMacroDayPane {...props} />;
135
+ }
136
+
137
+ function MacroDayComparisonPane({ width, height, focused, list }: PaneProps & { list: string }) {
138
+ const colors = useThemeColors();
139
+ const filters = useMacroDayFilters();
140
+ const { lookback, release, surprise } = filters;
141
+ const [selectedRow, setSelectedRow] = usePluginPaneState<string | null>("selectedRow", null);
142
+ const scope = useCloudDisplayScope();
143
+ const controller = useRef<AbortController | null>(null);
144
+ const loader = useCallback(async (forceRefresh: boolean) => {
145
+ controller.current?.abort();
146
+ controller.current = new AbortController();
147
+ const { signal } = controller.current;
148
+ const [releases, targets] = await Promise.all([loadMacroReleases({ force: forceRefresh }), Promise.all(list.split(",").map((symbol) =>
149
+ loadMacroDayTarget(symbol, () => parsePublicTickerKey(symbol), { signal, forceRefresh })))]);
150
+ if (targets.every((target) => !target.history.length && target.error)) throw new Error(targets[0]!.error!);
151
+ return { releases, targets };
152
+ }, [list]);
153
+ const history = useAsyncResource(scope ? loader : null, { savedCopy: scope ? { key: ["macro-day-compare", scope, list] } : null,
154
+ shouldSave: (answer) => answer.targets.every((target) => !target.stale && !target.error) });
155
+ useEffect(() => () => controller.current?.abort(), [loader]);
156
+ useAutoRefresh(history.updatedAt, history.load);
157
+ usePaneRefreshKey(() => history.reload(), { focused });
158
+
159
+ const models = useMemo(() => history.data ? projectMacroDayTargets(history.data.targets, history.data.releases, Number(lookback) || 5) : [], [history.data, lookback]);
160
+ const scoped = useMemo(() => compareMacroDays(models).filter((event) => release === "all" || event.kind === release), [models, release]);
161
+ const rows = useMemo(() => scoped.filter((event) => matchesSurprise(event, surprise)), [scoped, surprise]);
162
+ const columns = useMemo<DataTableColumn[]>(() => [
163
+ { ...DATE, width: 10 }, { id: "release", label: "Release", width: 12, align: "left" },
164
+ ...models.map((model) => ({ id: model.symbol, label: macroDayComparisonHeader(model),
165
+ width: Math.max(8, displayWidth(macroDayComparisonHeader(model))), align: "right" as const })),
166
+ ...figureColumns(rows),
167
+ ], [models, rows]);
168
+ const hasEarnings = rows.some((day) => [...day.moves.values()].some((move) => move.earnings));
169
+ const usesNextSession = rows.some((day) => [...day.moves.values()].some((move) => move.session !== day.date));
170
+ usePaneNoticeFooter({ registrationId: "macro-day-comparison-notices", focused, notices: [
171
+ ...(usesNextSession ? ["Where the market was shut, the move uses the next available session."] : []),
172
+ ...(hasEarnings ? ["* Also an earnings reaction session for this instrument."] : []),
173
+ ...[history.data && staleMacroReleasesNotice(history.data.releases), macroSurpriseExclusionNote(scoped, surprise)]
174
+ .filter((note): note is string => !!note),
175
+ ...(history.data?.targets.flatMap(({ symbol, error, earningsNotice }) => [error, earningsNotice]
176
+ .flatMap((notice) => notice ? [`${symbol}: ${notice}`] : [])) ?? []),
177
+ ...macroFigureGapNotices(rows),
178
+ ] });
179
+ const stale = history.data?.targets.some((target) => target.stale);
180
+ usePaneFooter("macro-day-comparison", () => ({ info: [
181
+ ...(stale ? [{ id: "stale", parts: [{ text: "stale history", tone: "warning" as const }] }] : []),
182
+ { id: "basis", parts: [{ text: "daily close-to-close", tone: "muted" as const }] },
183
+ ] }), [stale]);
184
+ const renderCell = (event: MacroDayComparisonRow, column: DataTableColumn): DataTableCell => {
185
+ if (column.id === "date") return { text: event.date };
186
+ if (column.id === "release") return { text: macroDayEventLabel(event) };
187
+ if (column.id === "actual" || column.id === "forecast" || column.id === "prior") return { text: event.figures?.[column.id] ?? "" };
188
+ if (column.id === "surprise") return { text: macroSurpriseText(event) };
189
+ const move = event.moves.get(column.id);
190
+ const basis = models.find((model) => model.symbol === column.id)?.basis ?? "return";
191
+ return move ? { text: `${formatMacroDayMove(move.move, basis, { unit: false })}${move.earnings ? "*" : ""}`, value: move.move * 100,
192
+ color: shownPriceColor(move.move * 100, macroDayMoveDecimals(basis), colors) } : { text: MISSING_VALUE };
193
+ };
194
+ return <Box width={width} height={height} flexDirection="column" overflow="hidden">
195
+ <MacroDayQuery width={width} filters={filters} />
196
+ <PaneStatusBody subject="macro-day moves" loading={history.loading && !history.data} error={!history.data ? history.error : null}>
197
+ {history.data ? <DataTableView<MacroDayComparisonRow> focused={focused} columns={columns} items={rows} rootWidth={width} rootHeight={height - 1}
198
+ getItemKey={macroDayKey} emptyStateTitle="No matching release days." sortColumnId={null} sortDirection="desc" selectedTextOverridesCellColor
199
+ selection={{ kind: "id", selectedId: selectedRow, getId: macroDayKey, onChange: setSelectedRow }}
200
+ getExportMetadata={() => [["basis", MACRO_DAY_DAILY_BASIS], ["units", models.map(macroDayComparisonHeader).join(", ")]]}
201
+ renderCell={renderCell} /> : null}
202
+ </PaneStatusBody>
203
+ </Box>;
204
+ }
205
+
206
+ function SingleMacroDayPane({ width, height, focused }: PaneProps) {
207
+ const colors = useThemeColors();
208
+ const { symbol, ticker, error: identityError } = usePaneTicker();
209
+ const filters = useMacroDayFilters();
210
+ const { lookback, release, surprise } = filters;
118
211
  const [selectedRow, setSelectedRow] = usePluginPaneState<string | null>("selectedRow", null);
119
212
  const instrument = instrumentFromTicker(ticker, symbol);
120
213
  const instrumentKey = JSON.stringify(instrument);
@@ -182,21 +275,15 @@ export function MacroDayPane({ width, height, focused }: PaneProps) {
182
275
  // A figure wraps only into rows the table's least leaves, so the pane never spills.
183
276
  const statMaxLines = height - 1 - 4;
184
277
  const contentHeight = Math.max(4, height - 1 - statGridRows(stats, width, undefined, { maxLines: statMaxLines }));
185
- const key = (event: MacroDayEvent) => `${event.kind}:${event.date}`;
186
-
187
278
  return <Box width={width} height={height} flexDirection="column" overflow="hidden">
188
- <QueryBar width={width} filters={[
189
- { id: "release", label: "Release", value: release, options: RELEASE_OPTIONS, onChange: setRelease, inline: true },
190
- { id: "surprise", label: "Surprise", value: surprise, options: SURPRISE_OPTIONS, onChange: (value) => setSurprise(value as MacroSurprise | "all") },
191
- { id: "lookback", label: "Lookback", value: String(lookback), options: LOOKBACK_OPTIONS, onChange: setLookback },
192
- ]} />
279
+ <MacroDayQuery width={width} filters={filters} />
193
280
  {!symbol ? <EmptyState title="Select a ticker." /> : <PaneStatusBody subject="macro-day moves" loading={history.loading && !model}
194
281
  error={!model ? history.error ?? identityError ?? null : null} empty={!!model && !model.events.length}>
195
282
  {model ? <>
196
283
  <StatGrid items={stats} width={width} maxLines={statMaxLines} />
197
284
  <DataTableView<MacroDayEvent> focused={focused} columns={columns} items={rows} rootWidth={width} rootHeight={contentHeight}
198
- getItemKey={key} emptyStateTitle={surprise === "all" ? "No release days." : `No ${MACRO_SURPRISE_LABELS[surprise].toLowerCase()} prints.`} sortColumnId={null} sortDirection="desc" selectedTextOverridesCellColor
199
- selection={{ kind: "id", selectedId: selectedRow, getId: key, onChange: (id) => setSelectedRow(id) }}
285
+ getItemKey={macroDayKey} emptyStateTitle={surprise === "all" ? "No release days." : `No ${MACRO_SURPRISE_LABELS[surprise].toLowerCase()} prints.`} sortColumnId={null} sortDirection="desc" selectedTextOverridesCellColor
286
+ selection={{ kind: "id", selectedId: selectedRow, getId: macroDayKey, onChange: setSelectedRow }}
200
287
  getExportMetadata={() => [["symbol", model.symbol], ["from", model.start ?? ""], ["to", model.asOf ?? ""],
201
288
  ["units", model.basis === "yield" ? "percentage points of yield, close to close on the release day"
202
289
  : "percent, close to close on the release day"]]}
@@ -357,7 +357,7 @@ function MarketHeatmapPane({ focused, width, height }: PaneProps) {
357
357
  const loadUniverse = useMemo(() => isRemoteHeatmapUniverse(activeUniverse)
358
358
  ? (forceRefresh: boolean) => fetchMarketHeatmap(activeUniverse, { count: requestCount, forceRefresh })
359
359
  : null, [activeUniverse, requestCount, scope]);
360
- const { data: currentBoard, loading, error, reload } = useAsyncResource(loadUniverse, {
360
+ const { data: currentBoard, loading, error, reload, savedAt } = useAsyncResource(loadUniverse, {
361
361
  savedCopy: scope ? { key: ["market-heatmap", scope, activeUniverse, requestCount] } : null,
362
362
  });
363
363
  const previousBoard = useRef<{ scope: string | null; board: MarketHeatmapBoard } | null>(null);
@@ -636,7 +636,7 @@ function MarketHeatmapPane({ focused, width, height }: PaneProps) {
636
636
 
637
637
  // Ages the last check that succeeded, not the snapshot, which the server can
638
638
  // hand back unchanged long after it was put together.
639
- const checked = useUpdatedAgo(shownBoard?.checkedAt ?? null);
639
+ const checked = useUpdatedAgo(savedAt === null ? shownBoard?.checkedAt ?? null : null);
640
640
  // The snapshot carries sizes and every name the stream does not: a minute on the server, a quarter of one real-time.
641
641
  useAutoRefresh(board?.checkedAt ?? null, reload, { intervalMs: heatmapCheckIntervalMs(board) });
642
642
 
@@ -2,12 +2,38 @@ import type { PaneFooterSegment } from "../../../components";
2
2
  import { observationFooterSegment, timestampFooterSegment } from "../../../components/layout/pane/footer/freshness";
3
3
  import { shownPriceColor } from "../../../theme/colors";
4
4
  import { formatPercentRaw } from "../../../utils/format";
5
+ import { formatUtcDayTime } from "../../../utils/utc-time";
6
+ import { shownSessionDay } from "../../../market-data/market/venue-session";
5
7
  import { INDEX_SHORT } from "./model";
6
8
  import type { MarketSummaryQuote } from "./screener";
7
9
 
8
- export function moverFreshnessFooter(asOf: number | string | null | undefined, checkedAt: number | null): PaneFooterSegment[] {
9
- const observation = observationFooterSegment(asOf)
10
- ?? { id: "as-of", parts: [{ text: "observation time unavailable", tone: "muted" as const }] };
10
+ /** The calendar the lists are of: the US listing venues share one. */
11
+ export const US_LIST_VENUE = "NYSE";
12
+ /** The part of the session a session list is of, named once that part is over. */
13
+ export const SESSION_PART: Partial<Record<string, "pre-market" | "after-hours">> = { premarket: "pre-market", afterhours: "after-hours" };
14
+
15
+ /**
16
+ * `Fri 20 Nov close`, or `Fri 20 Nov pre-market` for a list of a part of the
17
+ * session that has ended: the session a list read at `asOf` shows once the US
18
+ * market has shut (`shownSessionDay`), as `fn MOST` dates it. Null while the
19
+ * market trades, when the list's own time is its date.
20
+ */
21
+ export function shownListSession(
22
+ asOf: number | string | null | undefined,
23
+ now: number,
24
+ list: { session?: string | null; part?: "pre-market" | "after-hours" } = {},
25
+ ): string | null {
26
+ const at = typeof asOf === "number" ? asOf : typeof asOf === "string" ? Date.parse(asOf) : Number.NaN;
27
+ const shown = shownSessionDay(US_LIST_VENUE, at, now);
28
+ if (!shown) return null;
29
+ const day = list.session && /^\d{4}-\d{2}-\d{2}$/.test(list.session) && list.session <= shown ? list.session : shown;
30
+ return `${formatUtcDayTime({ time: Date.parse(`${day}T00:00:00Z`), dateOnly: true }, now)} ${list.part ?? "close"}`;
31
+ }
32
+
33
+ /** The list's date (`shownSession` once the market has shut, else when it was read) and when it was last checked. */
34
+ export function moverFreshnessFooter(asOf: number | string | null | undefined, checkedAt: number | null, shownSession: string | null = null): PaneFooterSegment[] {
35
+ const observation = shownSession ? { id: "as-of", parts: [{ text: shownSession, tone: "muted" as const }] }
36
+ : observationFooterSegment(asOf) ?? { id: "as-of", parts: [{ text: "observation time unavailable", tone: "muted" as const }] };
11
37
  const checked = timestampFooterSegment("checked-at", "checked", checkedAt);
12
38
  return [observation, ...(checked ? [checked] : [])];
13
39
  }
@@ -16,6 +16,7 @@ import type { HeadlessPaneColumn } from "../../../types/headless";
16
16
  import { isSessionTab, resolveSide } from "./session";
17
17
  import { hasPartialFloat, minFloatShares, normalizeMinFloat, PARTIAL_FLOAT_NOTE } from "./min-float";
18
18
  import { savedCopyMark } from "../../../data/saved-copies";
19
+ import { SESSION_PART, US_LIST_VENUE } from "./footer";
19
20
 
20
21
  const rowPrice = (value: unknown, row: Record<string, unknown>) => formatMoverPrice(typeof value === "number" ? value : null, typeof row.currency === "string" ? row.currency : "", moverReferencePrice(row as unknown as MarketMoverRow));
21
22
 
@@ -162,8 +163,12 @@ export function createMarketMoversHeadless(
162
163
  })),
163
164
  ...(hasPartialFloat(payload.items) ? { notes: [PARTIAL_FLOAT_NOTE] } : {}),
164
165
  metadata: { list: tab, side, session: payload.session, phase: payload.phase, asOf: payload.asOf, stale: payload.stale === true, minFloat },
165
- // A Pro account's list is the live board; the free one says it is delayed.
166
- ...(payload.access === "delayed" ? {} : { freshness: { status: "live" as const } }),
166
+ // A Pro account's list is the live board; the free one says it is delayed. Once its session is over, the
167
+ // list is dated by that session, `US trading day Fri 20 Nov 2026 pre-market`, not by when it was read.
168
+ freshness: {
169
+ ...(payload.access === "delayed" ? {} : { status: "live" as const }),
170
+ ...(payload.phase === "closed" ? { sessionList: { exchange: US_LIST_VENUE, ...(payload.session ? { session: payload.session } : {}), ...(SESSION_PART[tab] ? { part: SESSION_PART[tab] } : {}) } } : {}),
171
+ },
167
172
  };
168
173
  }
169
174
  // Trending carries no float, so a minimum does not apply to it.
@@ -202,11 +207,13 @@ export function createMarketMoversHeadless(
202
207
  // A list served from a saved copy ends with when it was saved.
203
208
  metadata: { ...savedCopyMark(result), list: tab, source: result.source, stale: result.stale, rankedBy, minFloat: floatFiltered ? minFloat : null },
204
209
  // A Pro account's Gainers, Losers and Most Active are the real-time lists. The footer is the list's own time,
205
- // which a Most Active row read from the day's stored snapshot (dated midnight) would otherwise set.
206
- ...(result.source === "cloud" || result.asOf != null ? { freshness: {
210
+ // which a Most Active row read from the day's stored snapshot (dated midnight) would otherwise set. Once the
211
+ // market has shut it is the session the list shows, `US trading day Fri 20 Nov 2026 close`, as HM's is.
212
+ freshness: {
207
213
  ...(result.source === "cloud" ? { status: "live" as const } : {}),
208
214
  ...(result.asOf != null ? { asOf: result.asOf } : {}),
209
- } } : {}),
215
+ sessionList: { exchange: US_LIST_VENUE },
216
+ },
210
217
  };
211
218
  },
212
219
  };
@@ -46,7 +46,7 @@ import {
46
46
  type TabId,
47
47
  } from "./model";
48
48
  import { loadMarketMoverTab, marketMoverQuoteError } from "./client";
49
- import { moverFreshnessFooter, summaryFooterSegments } from "./footer";
49
+ import { moverFreshnessFooter, shownListSession, summaryFooterSegments } from "./footer";
50
50
  import { isSessionTab, resolveActiveTab, usSessionAt, type UsSession } from "./session";
51
51
  import { SessionMoversBody } from "./session-body";
52
52
  import { ANY_FLOAT, minFloatEmptyTitle, minFloatFilter, minFloatShares, partialFloatFooter } from "./min-float";
@@ -273,7 +273,7 @@ function ScreenerMoversBody({ activeTab, hasProAccess, focused, width, summaryQu
273
273
  info: [
274
274
  ...(loadError ? [{ id: "load-error", parts: [{ text: loadError, tone: "warning" as const }] }] : []),
275
275
  ...(quoteDelay ? [quoteDelay] : []),
276
- ...(data ? moverFreshnessFooter(data.asOf, savedAt == null ? updatedAt : null) : []),
276
+ ...(data ? moverFreshnessFooter(data.asOf, savedAt == null ? updatedAt : null, shownListSession(data.asOf, freshnessNow)) : []),
277
277
  ...(loading ? [{ id: "loading", parts: [{ text: "loading", tone: "muted" as const }] }] : []),
278
278
  ...(feedStatus && !(delayed && feedStatus === "live") ? [{
279
279
  id: "feed",
@@ -284,7 +284,7 @@ function ScreenerMoversBody({ activeTab, hasProAccess, focused, width, summaryQu
284
284
  ...partialFloatFooter(columns.some((column) => column.id === "floatShares"), rows),
285
285
  ...summaryFooterSegments(summaryQuotes),
286
286
  ],
287
- }), [columns, data, delayed, feedStatus, loadError, loading, stale, quoteDelay, rows, savedAt, summaryQuotes, updatedAt]);
287
+ }), [columns, data, delayed, feedStatus, freshnessNow, loadError, loading, stale, quoteDelay, rows, savedAt, summaryQuotes, updatedAt]);
288
288
 
289
289
  return (
290
290
  <DataTableView<MarketMoverRow, MarketMoverColumn>
@@ -24,7 +24,7 @@ import { usePluginPaneState, usePluginTickerActions } from "../../runtime";
24
24
  import { ProWall, SignInWall } from "../cloud/auth-actions";
25
25
  import { loadSessionMovers, SessionMoversAccessError } from "./client";
26
26
  import { ANY_FLOAT, minFloatEmptyTitle, minFloatFilter, minFloatShares, partialFloatFooter } from "./min-float";
27
- import { moverFreshnessFooter, summaryFooterSegments } from "./footer";
27
+ import { moverFreshnessFooter, SESSION_PART, shownListSession, summaryFooterSegments } from "./footer";
28
28
  import type { MarketSummaryQuote } from "./screener";
29
29
  import { isProOnlyTab } from "./model";
30
30
  import {
@@ -166,13 +166,16 @@ function SessionMoversTable({ view, session, focused, width, summaryQuotes, live
166
166
  setSelectedId(rows[0] ? rowKey(rows[0]) : null);
167
167
  }, [rows, selectedId]);
168
168
 
169
- const sessionLabel = payload ? earlierSessionLabel(payload.session, session) : null;
169
+ // A list whose session is over is dated by it (`Fri 20 Nov pre-market`), which also names an earlier session's day.
170
+ const shownSession = payload?.phase === "closed"
171
+ ? shownListSession(payload.asOf, freshnessNow, { session: payload.session, ...(SESSION_PART[view] ? { part: SESSION_PART[view] } : {}) }) : null;
172
+ const sessionLabel = payload && !shownSession ? earlierSessionLabel(payload.session, session) : null;
170
173
  const quoteDelay = useListDelayFooter(delayed ? payload.delayMinutes ?? CLOUD_QUOTE_DELAY_MINUTES : null, "movers-delay");
171
174
  usePaneFooter("market-movers", () => ({
172
175
  info: [
173
176
  ...(loadError ? [{ id: "load-error", parts: [{ text: loadError, tone: "warning" as const }] }] : []),
174
177
  ...(quoteDelay ? [quoteDelay] : []),
175
- ...(payload ? moverFreshnessFooter(payload.asOf, savedAt == null ? updatedAt : null) : []),
178
+ ...(payload ? moverFreshnessFooter(payload.asOf, savedAt == null ? updatedAt : null, shownSession) : []),
176
179
  ...(sessionLabel ? [{ id: "session", parts: [{ text: sessionLabel, tone: "muted" as const }] }] : []),
177
180
  ...(loading ? [{ id: "loading", parts: [{ text: "loading", tone: "muted" as const }] }] : []),
178
181
  ...(feedStatus ? [{
@@ -5,7 +5,7 @@ import { MISSING_VALUE, formatNumber } from "../../../utils/format";
5
5
  import { historySpanStat, sinceLabel } from "../shared/history-span";
6
6
  import { SeriesDetailChart } from "../shared/series-detail-chart";
7
7
  import { valuationAxis, zoneSeriesFor } from "./chart-projection";
8
- import { readingPeriodEnd, type IndicatorViewModel } from "./view";
8
+ import { readingPeriodLabel, type IndicatorViewModel } from "./view";
9
9
  import { ZoneColorScale } from "./zone-scale";
10
10
 
11
11
  function formatTrillions(billions: number): string {
@@ -49,8 +49,8 @@ export function IndicatorDetail({
49
49
  : []),
50
50
  { id: "year-ago", label: "1Y ago", value: view.ratioOneYearAgo == null ? MISSING_VALUE : indicator.formatValue(view.ratioOneYearAgo) },
51
51
  // The whole history's, whatever the range the chart shows.
52
- { id: "ath", label: sinceLabel("High", view.historyStart), value: indicator.formatValue(view.allTimeHigh.ratio), detail: readingPeriodEnd(view.allTimeHigh.date, view.periodicity) },
53
- { id: "atl", label: sinceLabel("Low", view.historyStart), value: indicator.formatValue(view.allTimeLow.ratio), detail: readingPeriodEnd(view.allTimeLow.date, view.periodicity) },
52
+ { id: "ath", label: sinceLabel("High", view.historyStart), value: indicator.formatValue(view.allTimeHigh.ratio), detail: readingPeriodLabel(view.allTimeHigh.date, view.periodicity) },
53
+ { id: "atl", label: sinceLabel("Low", view.historyStart), value: indicator.formatValue(view.allTimeLow.ratio), detail: readingPeriodLabel(view.allTimeLow.date, view.periodicity) },
54
54
  // A range longer than the history shows all of it, from where it starts.
55
55
  ...[historySpanStat(view.span)].filter((item): item is StatItem => item !== null),
56
56
  ], [indicator, levels, view]);
@@ -14,7 +14,7 @@ import { createCloudSourceDeps } from "./sources";
14
14
  import { historyStartNotice, sinceLabel } from "../shared/history-span";
15
15
  import { formatSigma } from "../shared/trend";
16
16
  import {
17
- readingPeriodEnd,
17
+ readingPeriodLabel,
18
18
  selectValuationViews,
19
19
  type IndicatorViewModel,
20
20
  type ValuationBundle,
@@ -46,14 +46,14 @@ function detailEntries(view: IndicatorViewModel): HeadlessPaneEntry[] {
46
46
  {
47
47
  label: sinceLabel("High", view.historyStart),
48
48
  value: { value: view.allTimeHigh.ratio, date: view.allTimeHigh.date },
49
- formatted: `${format(view.allTimeHigh.ratio)} ${readingPeriodEnd(view.allTimeHigh.date, view.periodicity)}`,
49
+ formatted: `${format(view.allTimeHigh.ratio)} ${readingPeriodLabel(view.allTimeHigh.date, view.periodicity)}`,
50
50
  },
51
51
  {
52
52
  label: sinceLabel("Low", view.historyStart),
53
53
  value: { value: view.allTimeLow.ratio, date: view.allTimeLow.date },
54
- formatted: `${format(view.allTimeLow.ratio)} ${readingPeriodEnd(view.allTimeLow.date, view.periodicity)}`,
54
+ formatted: `${format(view.allTimeLow.ratio)} ${readingPeriodLabel(view.allTimeLow.date, view.periodicity)}`,
55
55
  },
56
- { label: "As of", value: view.asOf, formatted: readingPeriodEnd(view.asOf, view.periodicity) },
56
+ { label: "As of", value: view.asOf, formatted: readingPeriodLabel(view.asOf, view.periodicity) },
57
57
  ];
58
58
  }
59
59
 
@@ -116,7 +116,7 @@ function projectValuationHeadlessBundle(
116
116
  },
117
117
  // The day the reading's period ends, as FA dates its columns; the row keeps the period's first day.
118
118
  { key: "asOf", header: "As of", format: (value, row) => typeof value === "string"
119
- ? readingPeriodEnd(value, row.periodicity as IndicatorViewModel["periodicity"] | undefined) : MISSING_VALUE },
119
+ ? readingPeriodLabel(value, row.periodicity as IndicatorViewModel["periodicity"] | undefined) : MISSING_VALUE },
120
120
  ],
121
121
  rows,
122
122
  },
@@ -127,7 +127,7 @@ function projectValuationHeadlessBundle(
127
127
  errors: bundle.errors,
128
128
  // The status line counts the stale readings; each is named here, with the period it is of.
129
129
  ...(rows.some((row) => row.stale) ? {
130
- notes: rows.filter((row) => row.stale).map((row) => `${row.indicator} is stale: its latest reading is as of ${readingPeriodEnd(row.asOf, row.periodicity)}, older than its release schedule allows.`),
130
+ notes: rows.filter((row) => row.stale).map((row) => `${row.indicator} is stale: its latest reading is as of ${readingPeriodLabel(row.asOf, row.periodicity)}, older than its release schedule allows.`),
131
131
  } : {}),
132
132
  metadata: {
133
133
  fetchedAt: bundle.fetchedAt,
@@ -22,7 +22,7 @@ import { INDICATORS } from "./indicators";
22
22
  import { RANGE_OPTIONS, VALUATION_DEFAULTS } from "./settings";
23
23
  import { formatSigma } from "../shared/trend";
24
24
  import {
25
- readingPeriodEnd,
25
+ readingPeriodLabel,
26
26
  selectValuationViews,
27
27
  type IndicatorViewModel
28
28
  } from "./view";
@@ -161,8 +161,7 @@ export function MarketValuationPane({ focused, width, height }: PaneProps) {
161
161
  const footerInfo = useMemo<PaneFooterSegment[]>(() => {
162
162
  if (!selectedView) return [];
163
163
  const info: PaneFooterSegment[] = [
164
- // The day the reading's period ends, as FA dates a period.
165
- { id: "as-of", parts: [{ text: `as of ${readingPeriodEnd(selectedView.asOf, selectedView.periodicity)}`, tone: "muted" }] },
164
+ { id: "as-of", parts: [{ text: `as of ${readingPeriodLabel(selectedView.asOf, selectedView.periodicity)}`, tone: "muted" }] },
166
165
  ...(width >= 80 ? [DELAYED_SEGMENT] : []),
167
166
  ];
168
167
  if (selectedView.observationStale) {
@@ -153,16 +153,14 @@ export function selectValuationViews(
153
153
  return bundle.builds.map((build) => projectView(build, range));
154
154
  }
155
155
 
156
- /** Months a period of each periodicity runs. */
157
- const PERIOD_MONTHS = { monthly: 1, quarterly: 3, annual: 12 } as const;
156
+ const observationMonth = new Intl.DateTimeFormat("en-US", { month: "short", year: "numeric", timeZone: "UTC" });
158
157
 
159
- /**
160
- * A reading's as-of as FA dates a period, by the day it ends: a quarterly series dated 2026-04-01 (the start of Q2,
161
- * as FRED dates it) is as of 2026-06-30. A reading dated by its own day stays as it is.
162
- */
163
- export function readingPeriodEnd(date: string, periodicity: keyof typeof PERIOD_MONTHS | null | undefined): string {
158
+ export function readingPeriodLabel(date: string, periodicity: IndicatorViewModel["periodicity"] | undefined): string {
164
159
  if (!periodicity || !/^\d{4}-\d{2}-\d{2}/.test(date)) return date;
165
160
  const start = new Date(`${date.slice(0, 10)}T00:00:00Z`);
166
161
  if (!Number.isFinite(start.getTime())) return date;
167
- return new Date(Date.UTC(start.getUTCFullYear(), start.getUTCMonth() + PERIOD_MONTHS[periodicity], 0)).toISOString().slice(0, 10);
162
+ const year = start.getUTCFullYear();
163
+ if (periodicity === "monthly") return observationMonth.format(start);
164
+ if (periodicity === "quarterly") return `Q${Math.floor(start.getUTCMonth() / 3) + 1} ${year}`;
165
+ return String(year);
168
166
  }
@@ -62,8 +62,15 @@ function validateStockFunds(data: StockFundsPayload) {
62
62
  export const fetchFunds = (client: Client = apiClient) => fetchPayload(() => client.getMemberFunds(), validateFunds);
63
63
  /** The ETFs holding a stock; a server without the lookup says so instead of a bare 404. */
64
64
  export async function fetchStockFunds(symbol: string, client: Pick<typeof apiClient, "getStockFunds"> = apiClient) {
65
- try { return validateStockFunds(await client.getStockFunds(symbol)); } catch (error) {
66
- throw unavailableOnServer(error, "Funds holding a stock are not available on this server yet.");
65
+ const international = symbol.includes(":");
66
+ const notAvailable = "Funds holding this listing are not available on this server yet.";
67
+ try {
68
+ const data = validateStockFunds(await client.getStockFunds(symbol));
69
+ if (international && !data.symbol.includes(":")) throw new ApiRequestError(notAvailable, 404);
70
+ return data;
71
+ } catch (error) {
72
+ throw international ? unavailableOnServer(error, notAvailable, [400, 404])
73
+ : unavailableOnServer(error, "Funds holding a stock are not available on this server yet.");
67
74
  }
68
75
  }
69
76
  export const cachedStockFunds = (symbol: string) => cachedCloudResource(stockFundsCache, symbol, validateStockFunds);
@@ -4,7 +4,7 @@ import type { HeadlessRowsResult } from "../../../types/headless";
4
4
  import { fetchBreadth, fetchChanges, fetchFunds, fetchMembers, fetchStockFunds, FundNotCoveredError } from "./client";
5
5
  import type { FundMembersPayload } from "../../../api-client/members";
6
6
  import { canonicalFund, changeReason, coverageText, decimal, DEFAULT_SORT, fundName, fundSource, holdingsCaveats, holdingsSourceText, memberRows, membersFeed,
7
- noStockFundsMessage, percent, stockFundAsOf, stockFundsNotices, usListingInput } from "./model";
7
+ noStockFundsMessage, percent, stockFundAsOf, stockFundsNotices, stockHoldingLabel, stockListingInput } from "./model";
8
8
  const columns: HeadlessPaneColumn[] = [
9
9
  { key: "symbol", header: "Ticker" }, { key: "name", header: "Name" },
10
10
  { key: "weight", header: "Weight %", align: "right", format: (value) => value == null ? MISSING_VALUE : decimal(Number(value) * 100) },
@@ -31,25 +31,22 @@ function holdingsBasis(data: Pick<FundMembersPayload, "asOf" | "basis" | "filedO
31
31
  * of ("as of 30 Jun 2026 (N-PORT, filed 26 Aug)"). CSV and JSON rows carry the dates and link apart too.
32
32
  */
33
33
  async function stockFunds(input: string, client: Parameters<typeof fetchStockFunds>[1]): Promise<HeadlessRowsResult> {
34
- const symbol = usListingInput(input);
35
- if (!symbol) {
36
- return { freshness: { status: "not-a-feed", basis: "fund holdings" }, rows: [], columns: [],
37
- empty: "Funds are looked through by US ticker: name the US listing (an ADR such as INFY or TSM)." };
38
- }
34
+ const symbol = stockListingInput(input);
39
35
  const data = await fetchStockFunds(symbol, client);
40
- const none = noStockFundsMessage(symbol);
36
+ const none = noStockFundsMessage(data.symbol);
41
37
  return { freshness: { status: "not-a-feed", basis: "fund holdings" },
42
38
  rows: data.funds.map((row) => ({ ...row, weight: row.weight === null ? null : row.weight * 100, holdings: stockFundAsOf(row),
43
- filedOn: row.filedOn ?? null, sourceUrl: row.sourceUrl ?? null })),
39
+ ...(row.holdingType ? { shareClass: stockHoldingLabel(row) } : {}), filedOn: row.filedOn ?? null, sourceUrl: row.sourceUrl ?? null })),
44
40
  columns: [{ key: "ticker", header: "Fund" }, { key: "name", header: "Name" },
41
+ ...(data.funds.some((row) => row.holdingType) ? [{ key: "shareClass", header: "Share class" }] : []),
45
42
  { key: "weight", header: "Weight %", align: "right", format: (value) => decimal(value as number | null) },
46
43
  { key: "holdings", header: "Holdings" }, exported("asOf", "Holdings as of"), exported("filedOn", "Filed"), exported("sourceUrl", "Source link")],
47
- empty: `${none.title} ${none.message}`,
44
+ empty: [none.title, none.message].filter(Boolean).join(" "),
48
45
  metadata: { symbol: data.symbol, coverage: data.coverage, notices: stockFundsNotices(data) } };
49
46
  }
50
47
 
51
48
  export const membersHeadless: HeadlessPaneDefinition<"rows"> = {
52
- shape: "rows", argument: { kind: "free-text", optional: true, placeholder: "fund or stock", description: "Covered fund or index alias for its holdings, a US stock for the funds holding it; omit for the fund list." },
49
+ shape: "rows", argument: { kind: "free-text", optional: true, placeholder: "fund or stock", description: "Covered fund or index alias for its holdings, a stock (NVDA or 0700:HKEX) for the funds holding it; omit for the fund list." },
53
50
  options: [{ key: "tab", type: "enum", values: [{ value: "members" }, { value: "movers" }, { value: "changes" }, { value: "breadth" }], defaultValue: "members", description: "Members, movers, changes or daily breadth." }],
54
51
  discovery: { aliases: ["MEMB", "MRR", "IMOV"], limitations: ["ETF holdings, with file dates.", "Thematic funds from SEC N-PORT reports, two to four months old.", "A stock's ETFs: the covered funds, then every other US ETF from its latest SEC N-PORT report, up to nine months old.", "Member prices are real-time with Pro and fifteen minutes delayed otherwise; partial 1D coverage.", "Nasdaq-100 is not covered.", "Breadth history uses current members (survivorship bias)."] },
55
52
  describe: (args) => args.rawArgument ? `MEMB ${args.rawArgument}` : "Index and ETF members",
@@ -59,6 +56,7 @@ export const membersHeadless: HeadlessPaneDefinition<"rows"> = {
59
56
  rows: (await fetchFunds(context.apiClient)).funds.map((fund) => ({ ...fund, name: fundName(fund), source: fundSource(fund), filedOn: fund.filedOn ?? null })),
60
57
  columns: [{ key: "ticker", header: "Fund" }, { key: "name", header: "Index or theme" }, { key: "asOf", header: "Holdings as of" }, { key: "source", header: "Source" },
61
58
  exported("filedOn", "Filed")] };
59
+ if (stockListingInput(input).includes(":")) return stockFunds(input, context.apiClient);
62
60
  const fund = canonicalFund(input);
63
61
  // A symbol the covered list does not hold is a stock to look the funds through for, whatever the tab.
64
62
  const covered = await fetchFunds(context.apiClient).then((payload) => payload.funds, () => {
@@ -4,7 +4,9 @@ import type { DataTableColumn } from "../../../components";
4
4
  import { buildSectionedRows, type SectionedRow } from "../../../components/data-table/sections";
5
5
  import { getTableWidth } from "../../../components/ui/table-layout";
6
6
  import { isRegularSessionTime, latestRegularSessionClose } from "../../../market-data/market/freshness";
7
- import { isUsListingExchange } from "../../../utils/exchanges";
7
+ import { listingSuffixExchange, listingSuffixVenue } from "../../../sources/listing-symbols";
8
+ import { isUsOtcVenue, parsePublicTickerKey } from "../../../utils/exchanges";
9
+ import { listingAbroadVenue, nonUsSecListingVenue } from "../../../utils/sec";
8
10
  import { compareSortValues, type SortPreference } from "../../../utils/sort-values";
9
11
  import { rankTickerMatches } from "../../../utils/ticker-match-order";
10
12
  import { closeLabel } from "../themes/model";
@@ -12,8 +14,8 @@ export type MembersTab = "members" | "movers" | "changes" | "breadth";
12
14
  export const TABS = [{ value: "members", label: "Members" }, { value: "movers", label: "Movers" }, { value: "changes", label: "Changes" }, { value: "breadth", label: "Breadth" }];
13
15
  export const isTab = (value: unknown): value is MembersTab => TABS.some((tab) => tab.value === value);
14
16
  const COVERED = [{ ticker: "IVV", name: "S&P 500" }, { ticker: "IJH", name: "S&P 400" }, { ticker: "IJR", name: "S&P 600" }, { ticker: "IWM", name: "Russell 2000" }, { ticker: "IWB", name: "Russell 1000" }];
15
- /** Symbols the app reads as a covered fund before asking the server, which knows its own aliases too. */
16
- const LOCAL_ALIASES: Record<string, string> = { SPX: "IVV", "^SPX": "IVV", SPY: "IVV", "^GSPC": "IVV", "^MID": "IJH", SP400: "IJH", "^SP400": "IJH", "^SML": "IJR", SP600: "IJR", "^SP600": "IJR", RUT: "IWM", "^RUT": "IWM", RUI: "IWB", "^RUI": "IWB" };
17
+ /** Symbols the app reads as a covered fund before asking the server, which knows its own aliases too. SPY is a fund of its own, with its own holdings. */
18
+ const LOCAL_ALIASES: Record<string, string> = { SPX: "IVV", "^SPX": "IVV", "^GSPC": "IVV", "^MID": "IJH", SP400: "IJH", "^SP400": "IJH", "^SML": "IJR", SP600: "IJR", "^SP600": "IJR", RUT: "IWM", "^RUT": "IWM", RUI: "IWB", "^RUI": "IWB" };
17
19
  const requestedSymbol = (input: string) => input.split(":")[0]!.trim().toUpperCase();
18
20
  export function canonicalFund(input: string) { const symbol = requestedSymbol(input); return LOCAL_ALIASES[symbol] ?? symbol; }
19
21
  /** The covered fund the user asked for, by ticker or by an alias such as SPX, or undefined when it is not covered. */
@@ -65,7 +67,7 @@ export function holdingsBasisText(data: { asOf: string; basis?: "daily" | "nport
65
67
  // A narrow footer: "N-PORT 31 Jul 2026, filed 22 Sep".
66
68
  return short ? `N-PORT ${dayMonth(data.asOf, true)}${filed}` : `holdings as of ${dayMonth(data.asOf, true)} (N-PORT${filed})`;
67
69
  }
68
- /** "S&P 500, IVV holdings as of 2026-10-08 (for SPY)": the holdings file the members come from. */
70
+ /** "S&P 500, IVV holdings as of 2026-10-08 (for SPX)": the holdings file the members come from. */
69
71
  export function holdingsSourceText(input: string, data: Pick<FundMembersPayload, "fund" | "asOf" | "basis" | "filedOn">) {
70
72
  const requested = requestedSymbol(input);
71
73
  const forRequested = requested && requested !== data.fund.ticker ? ` (for ${requested})` : "";
@@ -91,8 +93,10 @@ const count = (value: number, noun = "") => `${value.toLocaleString("en-US")}${n
91
93
  */
92
94
  export function stockFundsNotices(data: StockFundsPayload) {
93
95
  const total = data.coverage.daily + data.coverage.nport;
96
+ const holders = new Set(data.funds.map((row) => row.ticker)).size;
97
+ const position = data.funds.some((row) => row.holdingType === "adr") ? `shares or ADRs for ${data.symbol}` : data.symbol;
94
98
  return [
95
- `${count(data.funds.length)} of ${count(total)} ETFs looked through hold ${data.symbol}: ${count(data.coverage.daily, "covered fund")} from daily holdings files, ${count(data.coverage.nport)} from their latest SEC N-PORT reports.`,
99
+ `${count(holders)} of ${count(total)} ETFs looked through hold ${position}: ${count(data.coverage.daily, "covered fund")} from daily holdings files, ${count(data.coverage.nport)} from their latest SEC N-PORT reports.`,
96
100
  ...(data.funds.some((row) => row.basis === "nport") ? ["N-PORT holdings are a quarter's report, filed up to 60 days after the date they are as of."] : []),
97
101
  ];
98
102
  }
@@ -101,16 +105,17 @@ export function fundSource(fund: { basis?: "daily" | "nport"; filedOn?: string |
101
105
  if (fund.basis !== "nport") return "Daily file";
102
106
  return fund.filedOn ? `N-PORT, filed ${dayMonth(fund.filedOn, true)}` : "N-PORT";
103
107
  }
104
- /**
105
- * The US ticker a look-through asks for (NVDA, BRK.B), from a bare symbol or a US listing; null for a listing abroad
106
- * (INFY:NSE), whose code is not the ticker the funds' holdings carry.
107
- */
108
- export function usListingInput(input: string): string | null {
109
- const [symbol, exchange] = input.trim().toUpperCase().split(":");
110
- return symbol && (!exchange || isUsListingExchange(exchange)) ? symbol : null;
108
+ export function stockListingInput(input: string, venue?: string): string {
109
+ const { symbol, exchange } = parsePublicTickerKey(input);
110
+ const abroad = exchange ? nonUsSecListingVenue(input) : venue ? listingAbroadVenue(`${symbol}:${venue}`) : null;
111
+ if (abroad && !isUsOtcVenue(abroad)) return `${listingSuffixVenue(symbol, abroad)?.symbol ?? symbol}:${abroad}`;
112
+ const suffixed = exchange || venue ? null : listingSuffixVenue(symbol, /^\d/.test(symbol) ? listingSuffixExchange(symbol) : undefined);
113
+ return suffixed ? `${suffixed.symbol}:${suffixed.exchange}` : symbol;
111
114
  }
112
115
  /** No ETF looked through holds the symbol: it may be a fund MEMB does not cover, so the fund facts are named too. */
113
116
  export function noStockFundsMessage(input: string, surface: "report" | "pane" = "report") {
117
+ const listing = stockListingInput(input);
118
+ if (listing.includes(":")) return { title: `No ETF looked through holds ${listing}.`, message: "" };
114
119
  const symbol = requestedSymbol(input);
115
120
  return { title: `No ETF looked through holds ${symbol}.`,
116
121
  message: surface === "pane" ? `If ${symbol} is a fund, MEMB does not cover it: its fund facts are in ETF ${symbol}. MEMB with no fund lists the funds it covers.`
@@ -131,6 +136,8 @@ export function fundName(fund: { name: string; plainName?: string }) {
131
136
  return fund.plainName ?? fund.name;
132
137
  }
133
138
  export function membersTitle(input: string, stock = false) {
139
+ const listing = stockListingInput(input);
140
+ if (stock && listing.includes(":")) return `Funds holding ${listing}`;
134
141
  const requested = input.split(":")[0]!.trim().toUpperCase();
135
142
  const fund = canonicalFund(requested);
136
143
  const definition = COVERED.find((item) => item.ticker === fund);
@@ -177,12 +184,17 @@ export function memberColumns(width: number, movers = false): DataTableColumn[]
177
184
  column("changePercent", "1D", compact ? 8 : 9), ...(!movers ? [column("return1WPercent", "1W", 9), column("return1MPercent", "1M", 9), column("returnYtdPercent", "YTD", 9), column("sector", "Sector", 22, "left")] : [])], width,
178
185
  ["sector", "shares", "returnYtdPercent", "return1MPercent", "return1WPercent", "price", "name"]);
179
186
  }
180
- /** The ETFs holding a stock, in two sections: the covered funds on daily holdings files, then those read from N-PORT reports, each by weight as the server orders them. */
187
+ export function stockHoldingLabel(row: StockFund): string | undefined {
188
+ if (row.holdingType === "ordinary") return "Ordinary shares";
189
+ if (row.holdingType === "adr") return row.receiptTicker ? `ADR (${row.receiptTicker})` : "ADR";
190
+ }
181
191
  export function stockFundRows(rows: readonly StockFund[]): SectionedRow<StockFund>[] {
182
- return buildSectionedRows([
183
- { label: "Daily holdings files", items: rows.filter((row) => row.basis === "daily") },
184
- { label: "SEC N-PORT reports", items: rows.filter((row) => row.basis === "nport") },
185
- ], (row) => row.ticker);
192
+ const groups = [...new Set(rows.map(stockHoldingLabel))].sort((left, right) =>
193
+ Number(left !== "Ordinary shares") - Number(right !== "Ordinary shares") || (left ?? "").localeCompare(right ?? ""));
194
+ return buildSectionedRows(groups.flatMap((group) => [
195
+ { label: group ? `${group} · Daily holdings files` : "Daily holdings files", items: rows.filter((row) => stockHoldingLabel(row) === group && row.basis === "daily") },
196
+ { label: group ? `${group} · SEC N-PORT reports` : "SEC N-PORT reports", items: rows.filter((row) => stockHoldingLabel(row) === group && row.basis === "nport") },
197
+ ]), (row) => row.holdingType ? `${row.ticker}:${row.holdingType}:${row.receiptTicker ?? ""}` : row.ticker);
186
198
  }
187
199
  /** Whether a stock's fund table has room for each row's whole "as of 30 Jun 2026 (N-PORT, filed 26 Aug)". */
188
200
  export const stockFundAsOfFits = (width: number) => width >= 96;