@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
@@ -16,6 +16,7 @@ import { useThemeColors } from "../../../theme/theme-context";
16
16
  import type { ResolvedSeries } from "../../../time-series/types";
17
17
  import type { PaneProps } from "../../../types/plugin";
18
18
  import { Box } from "../../../ui";
19
+ import { formatWeekdayDay } from "../../../utils/datetime-format";
19
20
  import { cachedSeasonalityHistory, loadSeasonalityHistory } from "./client";
20
21
  import { type DailyReturnStat, MONTH_LABELS, OVERLAY_YEAR, projectSeasonality, projectWeekdays, type SeasonalityModel,
21
22
  TURN_OF_MONTH_LABELS, type WeekdayModel } from "./model";
@@ -131,11 +132,13 @@ function monthStats(model: SeasonalityModel): StatItem[] {
131
132
  const month = model.asOf.getUTCMonth();
132
133
  const stat = model.months[month]!;
133
134
  const current = model.years[0]!;
135
+ // The close the year to date runs to: a running month's bar holds the latest price or a close days old, and says neither.
136
+ const through = model.closeDay ? `to ${formatWeekdayDay(model.closeDay, { timeZone: "UTC" })} close` : undefined;
134
137
  return [
135
138
  { id: "month-avg", label: `${MONTH_LABELS[month]} avg`, value: pct(stat.mean), tone: tone(stat.mean) },
136
139
  { id: "month-hit", label: `${MONTH_LABELS[month]} up`, value: stat.count ? `${Math.round(stat.hitRate! * 100)}%` : MISSING_VALUE,
137
140
  detail: stat.count ? `${Math.round(stat.hitRate! * stat.count)} of ${stat.count} yrs` : undefined },
138
- ...(current.partial ? [{ id: "ytd", label: `${current.year} YTD`, value: pct(current.total), tone: tone(current.total) }] : []),
141
+ ...(current.partial ? [{ id: "ytd", label: `${current.year} YTD`, value: pct(current.total), tone: tone(current.total), detail: through }] : []),
139
142
  ];
140
143
  }
141
144
 
@@ -169,7 +172,8 @@ export function SeasonalityPane({ width, height, focused }: PaneProps) {
169
172
 
170
173
  const lookbackYears = Number(lookback) || 10;
171
174
  const model = useMemo(() => history.data && cadence === "monthly"
172
- ? projectSeasonality(history.data.history, { symbol: symbol ?? "", lookbackYears }) : null, [history.data, cadence, lookbackYears, symbol]);
175
+ ? projectSeasonality(history.data.history, { symbol: symbol ?? "", lookbackYears, lastClose: history.data.lastClose }) : null,
176
+ [history.data, cadence, lookbackYears, symbol]);
173
177
  // Daily closes are served for five years, so Weekdays counts all of them and has no lookback.
174
178
  const weekdayModel = useMemo(() => history.data && cadence === "daily"
175
179
  ? projectWeekdays(history.data.history, { symbol: symbol ?? "", exchange, fetchedAt: history.data.fetchedAt }) : null,
@@ -177,13 +181,13 @@ export function SeasonalityPane({ width, height, focused }: PaneProps) {
177
181
  const rows = useMemo(() => model ? tableRows(model) : [], [model]);
178
182
  const dailyRows = useMemo(() => weekdayModel ? weekdayRows(weekdayModel) : [], [weekdayModel]);
179
183
  const series = useMemo(() => model ? overlaySeries(model, colors) : [], [model, colors]);
180
- const runningMonth = model?.years[0]?.partial && model.asOf ? model.asOf.getUTCMonth() : null;
184
+ const runningMonth = model?.runningMonth ?? null;
181
185
 
182
186
  usePaneNoticeFooter({ registrationId: "seasonality-notices", focused,
183
187
  notices: [...new Set([identityError, history.error, history.data?.error].filter((value): value is string => !!value))] });
184
188
  const rolls = history.data?.rollNote ? ` · ${history.data.rollNote}` : "";
185
- // From the first month on record when the lookback reaches before it.
186
- const closes = model?.asOf ? `monthly closes ${model.historyStart ? `${model.historyStart} ` : ""}to ${model.asOf.toISOString().slice(0, 7)}${rolls}`
189
+ // From the first month on record when the lookback reaches before it, to the session the newest month runs to, as Weekdays names its last.
190
+ const closes = model?.asOf ? `monthly closes ${model.historyStart ? `${model.historyStart} ` : ""}to ${model.closeDay ?? model.asOf.toISOString().slice(0, 7)}${rolls}`
187
191
  : weekdayModel?.start ? `daily closes ${weekdayModel.start} to ${weekdayModel.asOf}${rolls}` : null;
188
192
  usePaneFooter("seasonality", () => ({ info: [
189
193
  ...(history.loading ? [{ id: "loading", parts: [{ text: "loading history", tone: "muted" as const }] }] : []),
@@ -228,7 +232,7 @@ export function SeasonalityPane({ width, height, focused }: PaneProps) {
228
232
  : <DataTableView<Row> focused={focused} columns={COLUMNS} columnReorder={false} items={rows} rootWidth={width} rootHeight={contentHeight}
229
233
  getItemKey={(row) => row.id} emptyStateTitle="No monthly returns." sortColumnId={null} sortDirection="desc"
230
234
  selection={{ kind: "id", selectedId: selectedRow, getId: (row) => row.id, onChange: (id) => setSelectedRow(id) }}
231
- getExportMetadata={() => [["symbol", model.symbol], ["as of", model.asOf?.toISOString()], ["units", "percent, local-price close to close"]]}
235
+ getExportMetadata={() => [["symbol", model.symbol], ["as of", model.closeDay ?? model.asOf?.toISOString()], ["units", "percent, local-price close to close"]]}
232
236
  renderCell={(row, column) => renderCell(row, column, runningMonth)} />}
233
237
  </> : null}
234
238
  </PaneStatusBody>}
@@ -2,6 +2,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
2
2
  import { useSecFilingContent } from "../../../market-data/hooks";
3
3
  import { getSharedMarketDataCoordinator, resolveEntryValue } from "../../../market-data/coordinator";
4
4
  import type { QueryEntry } from "../../../market-data/result-types";
5
+ import { filingContentPreview } from "../../../sources/sec-edgar/content";
5
6
  import type { SecFilingDocument, SecFilingItem } from "../../../types/data-provider";
6
7
  import { logFailure } from "../../../utils/log-failure";
7
8
  import { documentContentTarget, isInlineExhibitDocument } from "./filing-documents";
@@ -42,6 +43,18 @@ export function buildInlineFilingContentTargets(
42
43
  .map((document) => documentContentTarget(filing, document));
43
44
  }
44
45
 
46
+ export function buildFilingContentPreviews(
47
+ targets: readonly SecFilingItem[],
48
+ rawContents: ReadonlyMap<string, string | null>,
49
+ ): Map<string, string | null> {
50
+ const previews = new Map<string, string | null>();
51
+ for (const target of targets) {
52
+ const key = target.accessionNumber;
53
+ if (rawContents.has(key)) previews.set(key, filingContentPreview(rawContents.get(key), target));
54
+ }
55
+ return previews;
56
+ }
57
+
45
58
  /** Filings whose content is read at once: the queue's head and the next ones read ahead. */
46
59
  const CONTENT_READS_AT_ONCE = 4;
47
60
 
@@ -21,7 +21,7 @@ import type { ThemeColors } from "../../../theme/colors";
21
21
  import { useThemeColors } from "../../../theme/theme-context";
22
22
  import { useOpenDescription } from "../shared/open-description";
23
23
  import { toneColor } from "../shared/research-cells";
24
- import { parsePublicTickerKey, publicTickerKey } from "../../../utils/exchanges";
24
+ import { displayTickerKey, parsePublicTickerKey, publicTickerKey } from "../../../utils/exchanges";
25
25
  import { fundFactsAbroadKey, hasFundFactsAbroad, mayBeFundViewTicker, mayBeSecEquityListing, mayBeUsEquityOrFundTicker, mayBeUsEquityTicker, noSecReportsNotice, nonUsSecListingVenue, secFilingItemCodes, US_FUND_FACTS_ONLY } from "../../../utils/sec";
26
26
  import { fundAbroadProfile, venueAbroad, type FundAbroadProfile } from "./fund-abroad";
27
27
  import { listingAnnouncementsPage, type ExchangeAnnouncementsPage } from "../../../utils/exchange-announcements";
@@ -43,6 +43,7 @@ import {
43
43
  filingPreviewTruncated,
44
44
  } from "./filing-documents";
45
45
  import {
46
+ buildFilingContentPreviews,
46
47
  buildInlineFilingContentTargets,
47
48
  useSecFilingContentCache,
48
49
  } from "./filing-content";
@@ -103,7 +104,7 @@ function buildDetailBodyWithDocuments({
103
104
  documents,
104
105
  documentsLoading,
105
106
  documentsError,
106
- contentCache,
107
+ previews,
107
108
  contentErrors,
108
109
  primaryContent,
109
110
  }: {
@@ -112,7 +113,7 @@ function buildDetailBodyWithDocuments({
112
113
  documentsLoading: boolean;
113
114
  documentsError: string | null;
114
115
  contentErrors: Map<string, string>;
115
- contentCache: Map<string, string | null>;
116
+ previews: Map<string, string | null>;
116
117
  primaryContent: string;
117
118
  }): string {
118
119
  const lines: string[] = [];
@@ -135,8 +136,8 @@ function buildDetailBodyWithDocuments({
135
136
  lines.push("", "Inline Exhibits");
136
137
  for (const document of exhibits) {
137
138
  const key = documentContentKey(filing, document);
138
- const hasContent = contentCache.has(key);
139
- const content = contentCache.get(key);
139
+ const hasContent = previews.has(key);
140
+ const content = previews.get(key);
140
141
  lines.push("", documentHeading(document));
141
142
  lines.push(contentErrors.has(key) && !content
142
143
  ? `Exhibit content unavailable: ${contentErrors.get(key)}`
@@ -177,6 +178,7 @@ function toFeedItems(
177
178
  loadingDocuments: boolean,
178
179
  documentsError: string | null,
179
180
  contentErrors: Map<string, string>,
181
+ previews: Map<string, string | null>,
180
182
  /** The stories that report the open filing, a Form 4, each a fact that opens it. */
181
183
  openStories: { accession: string; stories: readonly FilingStory[]; open: (story: FilingStory) => void } | null = null,
182
184
  ): FeedDataTableItem[] {
@@ -189,7 +191,8 @@ function toFeedItems(
189
191
  const hasFetchedContent = contentCache.has(filing.accessionNumber);
190
192
  const fetchedContent = contentCache.get(filing.accessionNumber);
191
193
  const isOwnership = OWNERSHIP_FORMS.has(filing.form.trim());
192
- const fallbackBody = hasFetchedContent && !loadingContent && !fetchedContent
194
+ const preview = previews.get(filing.accessionNumber);
195
+ const fallbackBody = hasFetchedContent && !loadingContent && !preview
193
196
  ? `${buildDetailBody(filing)}\n\nReadable filing content was not available for this document.`
194
197
  : buildDetailBody(filing);
195
198
 
@@ -205,14 +208,14 @@ function toFeedItems(
205
208
  ? "Loading filing content..."
206
209
  : contentErrors.has(filing.accessionNumber) && !fetchedContent
207
210
  ? `Filing content unavailable: ${contentErrors.get(filing.accessionNumber)}`
208
- : form4Detail ?? fetchedContent ?? fallbackBody;
211
+ : form4Detail ?? preview ?? fallbackBody;
209
212
  const detailBody = selected
210
213
  ? buildDetailBodyWithDocuments({
211
214
  filing,
212
215
  documents: selectedDocuments,
213
216
  documentsLoading: loadingDocuments,
214
217
  documentsError,
215
- contentCache,
218
+ previews,
216
219
  contentErrors,
217
220
  primaryContent: primaryDetailBody,
218
221
  })
@@ -258,7 +261,7 @@ function toFeedItems(
258
261
  ...(acceptedAt ? [`SEC-reported acceptance ${acceptedAt}`] : []),
259
262
  `Accession ${filing.accessionNumber}`,
260
263
  ...(secFilingItemCodes(filing.items) ? [`Items ${secFilingItemCodes(filing.items)}`] : []),
261
- ...(filingPreviewTruncated(filing, selected ? selectedDocuments : [], contentCache)
264
+ ...(selected && filingPreviewTruncated(filing, selectedDocuments, previews)
262
265
  ? ["Preview truncated. Open the SEC filing for the complete documents and terms."] : []),
263
266
  ],
264
267
  detailBody,
@@ -439,6 +442,7 @@ function SecView({ width, height, focused, paneType }: { width: number; height:
439
442
  scopeKey: `${ticker?.metadata.ticker ?? "none"}:${ticker?.metadata.exchange ?? ""}:${eligibleTicker}`,
440
443
  targets: contentTargets,
441
444
  });
445
+ const previews = useMemo(() => buildFilingContentPreviews(viewedTargets, contentCache), [viewedTargets, contentCache]);
442
446
  const loadingContent = !!openFiling && (!contentCache.has(openFiling.accessionNumber) || loadingKey === openFiling.accessionNumber);
443
447
  const activeContentError = [openFiling, ...buildInlineFilingContentTargets(openFiling, openDocuments)]
444
448
  .filter((target): target is SecFilingItem => !!target)
@@ -610,10 +614,10 @@ function SecView({ width, height, focused, paneType }: { width: number; height:
610
614
  const listing = { symbol: parsePublicTickerKey(ticker.metadata.ticker).symbol, exchange: equityAbroad, name: ticker.metadata.name ?? null };
611
615
  return <NoSecReportsNotice notice={noSecReportsNotice(listing)} announcements={announcements} />;
612
616
  }
613
- return renderFilingNotice(`No recent SEC filings for ${ticker.metadata.ticker}.`);
617
+ return renderFilingNotice(`No recent SEC filings for ${displayTickerKey(ticker.metadata.ticker)}.`);
614
618
  }
615
619
  const symbol = ticker.metadata.ticker;
616
- const fundEmptyTitle = error ? t("SEC filings unavailable.") : tf("No fund filings for {symbol}.", { symbol });
620
+ const fundEmptyTitle = error ? t("SEC filings unavailable.") : tf("No fund filings for {symbol}.", { symbol: displayTickerKey(symbol) });
617
621
  // A trust (IBIT, GLD) files 10-Ks and 10-Qs, not fund forms.
618
622
  const fundEmptyHint = error ?? (issuerFilings.length > 0 ? tf("Its other filings: SEC {symbol}.", { symbol }) : undefined);
619
623
  if (forms && (facts?.covered || facts?.note) && formFilings.length === 0 && !error) {
@@ -645,6 +649,7 @@ function SecView({ width, height, focused, paneType }: { width: number; height:
645
649
  loadingDocuments,
646
650
  documentsError,
647
651
  contentErrors,
652
+ previews,
648
653
  storyLinks,
649
654
  )}
650
655
  selectedIdx={selectedIdx}
@@ -1,6 +1,7 @@
1
1
  import type { DataProvider } from "../../../types/data-provider";
2
2
  import type { PricePoint, Quote } from "../../../types/financials";
3
3
  import { logFailure } from "../../../utils/log-failure";
4
+ import { savedCopyAt } from "../../../data/saved-copies";
4
5
  import type { SectorDef } from "./sector-data";
5
6
  import { getCompletedRegularSessionDisplay, getRegularSessionDisplay } from "../../../market-data/market/status";
6
7
  import {
@@ -20,6 +21,11 @@ export interface SectorRowOutcome {
20
21
  row: Partial<SectorRow> | null;
21
22
  }
22
23
 
24
+ interface SectorLoadedRow extends SectorRowOutcome {
25
+ checked: boolean;
26
+ savedAt: number | null;
27
+ }
28
+
23
29
  /**
24
30
  * The year of daily bars each fund's returns are read from, by fund. A load
25
31
  * given one asks only for the funds it lacks and adds what it reads, so a
@@ -30,12 +36,13 @@ export type SectorHistories = Map<string, PricePoint[]>;
30
36
  export async function loadSectorRows(
31
37
  sectors: readonly SectorDef[],
32
38
  provider: DataProvider,
33
- options: { histories?: SectorHistories } = {},
34
- ): Promise<SectorRowOutcome[]> {
39
+ options: { histories?: SectorHistories; revalidate?: boolean } = {},
40
+ ): Promise<SectorLoadedRow[]> {
35
41
  const quotes = new Map<string, Quote | null>();
36
42
  if (provider.getQuotesBatch) {
37
43
  const results = await provider.getQuotesBatch(
38
44
  sectors.map((sector) => ({ symbol: sector.etf, exchange: "" })),
45
+ options.revalidate ? { revalidate: true } : undefined,
39
46
  ).catch(logFailure("sectors", "Sector quote batch failed", []));
40
47
  for (const result of results) quotes.set(result.target.symbol, result.quote ?? null);
41
48
  }
@@ -43,7 +50,7 @@ export async function loadSectorRows(
43
50
  // history close. Retry only the missing instruments through the normal route.
44
51
  await Promise.all(sectors.filter((sector) => !quotes.get(sector.etf)).map(async (sector) => {
45
52
  try {
46
- quotes.set(sector.etf, await provider.getQuote(sector.etf, ""));
53
+ quotes.set(sector.etf, await provider.getQuote(sector.etf, "", options.revalidate ? { cacheMode: "refresh" } : undefined));
47
54
  } catch {
48
55
  quotes.set(sector.etf, null);
49
56
  }
@@ -52,8 +59,17 @@ export async function loadSectorRows(
52
59
  const histories: SectorHistories = options.histories ?? new Map();
53
60
  // Funds whose history this load reads; a stored one is not asked again, nor for its boundary buffer.
54
61
  const read = new Set(sectors.filter((sector) => !histories.get(sector.etf)?.length).map((sector) => sector.etf));
62
+ const savedHistories = new Map<string, number>();
55
63
  await Promise.all([...read].map(async (etf) => {
56
- histories.set(etf, await provider.getPriceHistory(etf, "", "1Y").catch(logFailure("sectors", "Sector price history failed", [])));
64
+ try {
65
+ const result = provider.getPriceHistoryWithMetadata
66
+ ? await provider.getPriceHistoryWithMetadata(etf, "", "1Y") : null;
67
+ const savedAt = savedCopyAt(result);
68
+ if (savedAt != null) savedHistories.set(etf, savedAt);
69
+ histories.set(etf, result?.points ?? await provider.getPriceHistory(etf, "", "1Y"));
70
+ } catch (error) {
71
+ histories.set(etf, logFailure("sectors", "Sector price history failed", [] as PricePoint[])(error));
72
+ }
57
73
  }));
58
74
  // The quotes as sent carry any pre-market or after-hours print, for its own column.
59
75
  const sentQuotes = new Map(quotes);
@@ -78,7 +94,11 @@ export async function loadSectorRows(
78
94
  const outcomes = await Promise.all(sectors.map(async (sector) => {
79
95
  let history: PricePoint[] = histories.get(sector.etf) ?? [];
80
96
  const quote = quotes.get(sector.etf) ?? null;
81
- if (!quote && history.length === 0) return { etf: sector.etf, row: null };
97
+ const savedTimes = [savedCopyAt(sentQuotes.get(sector.etf)), savedHistories.get(sector.etf)]
98
+ .filter((at): at is number => at != null);
99
+ const savedAt = savedTimes.length ? Math.min(...savedTimes) : null;
100
+ const checked = !!quote && savedAt == null && history.length > 0;
101
+ if (!quote && history.length === 0) return { etf: sector.etf, row: null, checked, savedAt };
82
102
  // Price and 1D are the regular session, as `ticker` reads them: after the close
83
103
  // its close and move, with an extended print in its own column.
84
104
  const headline = getRegularSessionDisplay(quote);
@@ -116,6 +136,8 @@ export async function loadSectorRows(
116
136
  const year = computeTrailingReturn(history, "1Y", price, asOfDate);
117
137
  return {
118
138
  etf: sector.etf,
139
+ checked,
140
+ savedAt,
119
141
  row: {
120
142
  price,
121
143
  quoteUnavailable: price == null,
@@ -85,7 +85,8 @@ export function createSectorsHeadless(
85
85
  return {
86
86
  shape: "rows",
87
87
  // Dated by each ETF's quote; the shared session date is the returns' end, not an observation.
88
- freshness: { observedKey: "quoteUpdatedAt" },
88
+ // Once the US market has shut, the board is the session it shows, `US trading day Fri 20 Nov 2026 close`, as MOST's and HM's are.
89
+ freshness: { observedKey: "quoteUpdatedAt", sessionList: { exchange: "NYSE" } },
89
90
  argument: { kind: "none" },
90
91
  options: [{
91
92
  key: "collection",
@@ -2,6 +2,8 @@ import { useCallback, useEffect, useMemo, useRef, useState, type ReactNode } fro
2
2
  import { Box } from "../../../ui";
3
3
  import { DataTableView, usePaneFooter, usePaneTabs, type DataTableCell, type DataTableKeyEvent, type DataTableVisibleRange } from "../../../components";
4
4
  import { handleRefreshKey, loadingErrorFooterInfo } from "../../../components/data-table/table-pane";
5
+ import { ageFooterSegment, savedCopyFooterInfo } from "../../../components/layout/pane/footer";
6
+ import { connectionHealth, recoversDataRequests } from "../../../core/connection-health";
5
7
  import type { PaneProps } from "../../../types/plugin";
6
8
  import type { PluginModule } from "../plugin-module";
7
9
  import { useAppSelector, usePaneInstance, usePaneSettingValue } from "../../../state/app/context";
@@ -156,6 +158,7 @@ function EtfBoard({ collectionId, focused, width, height, rootBefore }: EtfBoard
156
158
  /** The history the last full load read, for the funds it was read for, which quote refreshes reuse. */
157
159
  const historiesRef = useRef<{ funds: string; loadedAt: number; histories: SectorHistories } | null>(null);
158
160
  const [loadError, setLoadError] = useState<string | null>(null);
161
+ const [fallback, setFallback] = useState<{ collectionId: SectorCollectionId; savedAt: number | null } | null>(null);
159
162
 
160
163
  const rows = useMemo(
161
164
  () => normalizeRowsForCollection(rowsByCollection, activeCollection.id, activeItems),
@@ -217,6 +220,8 @@ function EtfBoard({ collectionId, focused, width, height, rootBefore }: EtfBoard
217
220
  [extendedSessionsKey, width],
218
221
  );
219
222
  const lastRefreshMs = lastRefreshByCollection[activeCollection.id] ?? null;
223
+ const refreshFailed = fallback?.collectionId === activeCollection.id;
224
+ const savedAt = refreshFailed ? fallback.savedAt ?? lastRefreshMs : null;
220
225
  const loading = rows.some((row) => row.loading);
221
226
  /**
222
227
  * A full load marks every row loading and replaces it. A background one,
@@ -251,20 +256,23 @@ function EtfBoard({ collectionId, focused, width, height, rootBefore }: EtfBoard
251
256
 
252
257
  if (!background) updateRows((rows) => rows.map((row) => ({ ...row, loading: true })));
253
258
 
254
- loadSectorRows(sectorDefs, dataProvider, { histories }).then((outcomes) => {
259
+ loadSectorRows(sectorDefs, dataProvider, { histories, revalidate: true }).then((outcomes) => {
255
260
  if (fetchGenRef.current !== gen) return;
256
- if (!reuse) historiesRef.current = { funds, loadedAt: Date.now(), histories };
261
+ const checked = outcomes.length > 0 && outcomes.every((outcome) => outcome.checked);
262
+ if (checked && !reuse) historiesRef.current = { funds, loadedAt: Date.now(), histories };
257
263
  const loadedByEtf = new Map(outcomes.map((outcome) => [outcome.etf, outcome.row]));
258
- updateRows((rows) => applySectorReload(rows, loadedByEtf, background));
264
+ updateRows((rows) => clearLoading(applySectorReload(rows, loadedByEtf, background || !checked && rows.some((row) => row.returnAsOfDate))));
259
265
 
260
266
  const loadedCount = outcomes.filter((outcome) => outcome.row).length;
261
267
  setLoadError(loadedCount === 0 ? "Sector data unavailable" : null);
262
- // A refresh that returned nothing must not claim the board is current.
263
- if (loadedCount === 0) return;
268
+ const savedTimes = outcomes.flatMap((outcome) => outcome.savedAt == null ? [] : [outcome.savedAt]);
269
+ setFallback(checked ? null : { collectionId, savedAt: savedTimes.length ? Math.min(...savedTimes) : null });
270
+ if (!checked) return;
264
271
  setLastRefreshByCollection((prev) => ({ ...prev, [collectionId]: Date.now() }));
265
272
  }).catch(() => {
266
273
  if (fetchGenRef.current !== gen) return;
267
274
  setLoadError("Sector data unavailable");
275
+ setFallback({ collectionId, savedAt: null });
268
276
  if (!background) updateRows(clearLoading);
269
277
  });
270
278
  }, [activeCollection.id, activeItems, dataProvider, researchIntervalMinutes, setLastRefreshByCollection, setRowsByCollection]);
@@ -275,7 +283,10 @@ function EtfBoard({ collectionId, focused, width, height, rootBefore }: EtfBoard
275
283
  fetchAll();
276
284
  }, [fetchAll]);
277
285
 
278
- const fallbackRefresh = !feedCoversBoard || loadError != null;
286
+ useEffect(() => connectionHealth.subscribeRecovery((sourceId) => {
287
+ if (refreshFailed && recoversDataRequests(sourceId)) refreshInBackground();
288
+ }), [refreshFailed, refreshInBackground]);
289
+ const fallbackRefresh = !feedCoversBoard || refreshFailed || loadError != null;
279
290
  useAutoRefresh(lastRefreshMs, refreshInBackground, { intervalMs: fallbackRefresh ? SECTOR_FALLBACK_REFRESH_MS : null });
280
291
 
281
292
  useEffect(() => {
@@ -350,7 +361,7 @@ function EtfBoard({ collectionId, focused, width, height, rootBefore }: EtfBoard
350
361
  }
351
362
  }, []);
352
363
 
353
- const updatedAgo = useUpdatedAgo(lastRefreshMs);
364
+ const updatedAgo = useUpdatedAgo(refreshFailed ? null : lastRefreshMs);
354
365
  const returnAsOfDate = rows.map((row) => row.returnAsOfDate).filter((date): date is string => !!date).sort().at(-1);
355
366
  // A row with a value the source could not supply says so on that row: its
356
367
  // ETF in the warning colour, and the reason under the table while it is
@@ -359,18 +370,19 @@ function EtfBoard({ collectionId, focused, width, height, rootBefore }: EtfBoard
359
370
  // Signed out or free, the ETFs' quotes are delayed ones.
360
371
  const quoteDelay = useQuoteDelayFooter(rows.map((row) => (row.loading ? null : { dataSource: row.quoteDataSource })), "sectors-delay");
361
372
  usePaneFooter("sectors", () => {
362
- const info = loadingErrorFooterInfo(loading, loadError);
373
+ const info = loadingErrorFooterInfo(loading, savedAt == null ? loadError ?? (refreshFailed ? "Couldn't refresh sectors" : null) : null);
363
374
  if (returnAsOfDate) info.push({ id: "return-as-of", parts: [{ text: `returns as of ${returnAsOfDate}`, tone: "muted" }] });
364
- if (updatedAgo) info.push({ id: "updated", parts: [{ text: `checked ${updatedAgo}`, tone: "muted" }] });
365
375
  // Keep the leading current failure readable when the pane is narrow; separate
366
376
  // flex children would each shrink it to a few characters beside routine status.
367
377
  return { info: [
378
+ ...savedCopyFooterInfo([savedAt]),
368
379
  ...(info.length > 0 ? [{ id: "status", parts: info.flatMap((segment, index) => [
369
380
  ...(index > 0 ? [{ text: "·", tone: "muted" as const }] : []), ...segment.parts,
370
381
  ]) }] : []),
382
+ ...(updatedAgo ? [ageFooterSegment(updatedAgo, { verb: "checked" })] : []),
371
383
  ...(quoteDelay ? [quoteDelay] : []),
372
384
  ] };
373
- }, [loadError, loading, quoteDelay, returnAsOfDate, updatedAgo]);
385
+ }, [loadError, loading, quoteDelay, refreshFailed, returnAsOfDate, savedAt, updatedAgo]);
374
386
 
375
387
  return (
376
388
  <DataTableView<SectorRow, SectorColumn>
@@ -3,7 +3,7 @@ import { ApiRequestError } from "../../../api-client/errors";
3
3
  import { cloudDisplayScope } from "../../../api-client/plan-access";
4
4
  import { createMissingRouteLatch } from "../../../api-client/coalesce";
5
5
  import { savedCopyForTransientFailure, type PluginCacheResult } from "../../../data/plugin-cache";
6
- import { markSavedCopy } from "../../../data/saved-copies";
6
+ import { markSavedCopy, stampRetrievedAt } from "../../../data/saved-copies";
7
7
 
8
8
  interface CloudCache<T> {
9
9
  get(key: string, options?: { allowExpired?: boolean }): PluginCacheResult<T> | null;
@@ -37,7 +37,7 @@ export function cachedCloudResource<T>(
37
37
  if (!cached) return null;
38
38
  try {
39
39
  const result = { payload: validate(cached.data), stale: false, refreshError: null };
40
- return cached.fromEarlierRun || cached.stale ? markSavedCopy(result, cached.fetchedAt) : result;
40
+ return cached.fromEarlierRun || cached.stale ? markSavedCopy(result, cached.fetchedAt) : stampRetrievedAt(result, cached.fetchedAt);
41
41
  } catch (error) {
42
42
  return logFailure("shared.cloud-resource", "Validate cached cloud payload failed", null)(error);
43
43
  }
@@ -78,7 +78,7 @@ export async function loadCloudResource<T>(
78
78
  payload: validate(result.data), stale: result.stale, refreshError: result.refreshError ?? null,
79
79
  ...(saved ? { savedAt: result.fetchedAt } : {}),
80
80
  };
81
- return saved ? markSavedCopy(answer, result.fetchedAt) : answer;
81
+ return saved ? markSavedCopy(answer, result.fetchedAt) : stampRetrievedAt(answer, result.fetchedAt);
82
82
  }
83
83
 
84
84
  /**
@@ -0,0 +1,38 @@
1
+ import type { HeadlessPaneColumn, HeadlessPaneRow } from "../../../types/headless";
2
+ import { EXTENDED_SESSION_LABELS, type ExtendedSession } from "../../../market-data/market/status";
3
+ import { asOfClock } from "../../../market-data/quotes/time";
4
+ import { MISSING_VALUE } from "../../../utils/format";
5
+
6
+ /**
7
+ * When a report row's pre-market, after-hours or overnight print was observed
8
+ * (`extendedUpdatedAt`, epoch ms), as a card dates it: `Sat 00:34 UTC`. Empty
9
+ * without one. The row's own as-of is its close's once the session is over.
10
+ */
11
+ function extendedPrintTimeText(row: HeadlessPaneRow): string {
12
+ const time = row.extendedUpdatedAt;
13
+ return typeof time === "number" && Number.isFinite(time) && time > 0 ? asOfClock(Math.min(time, Date.now())) : "";
14
+ }
15
+
16
+ /**
17
+ * An extended print column's text with its time after the figures
18
+ * (`$70.60 +1.35% Sat 00:34 UTC`), as `quote` prints it; `figures` is what the
19
+ * column draws for the print alone.
20
+ */
21
+ export function withExtendedPrintTime(figures: string, row: HeadlessPaneRow): string {
22
+ return [figures, extendedPrintTimeText(row)].filter(Boolean).join(" ");
23
+ }
24
+
25
+ /**
26
+ * When each row's extended print was observed, as `quote --csv`'s `After Hours
27
+ * Updated` dates it: XYZ:NYSE's close at 21:00 UTC, its after-hours print at
28
+ * 00:34 UTC. Exported last, so a column read by position stays where it was;
29
+ * a text report says the time beside the print instead.
30
+ */
31
+ export function extendedPrintTimeColumn(session: ExtendedSession): HeadlessPaneColumn {
32
+ return {
33
+ key: "extendedUpdatedAt", header: `${EXTENDED_SESSION_LABELS[session]} Updated`, exportLast: true,
34
+ format: (value, row) => row.extendedSession === session && typeof value === "number" && Number.isFinite(value) && value > 0
35
+ ? new Date(value).toISOString()
36
+ : MISSING_VALUE,
37
+ };
38
+ }
@@ -46,7 +46,7 @@ export function useProFeatureWall(copy: ProFeatureWallCopy, size: { width: numbe
46
46
  const gated = !options.preview;
47
47
  let wall: ReactNode = null;
48
48
  if ((gated && !access.signedIn) || refused === 401) {
49
- wall = <SignInWall placement={`${copy.placement.replace(/-wall$/, "")}-signin`} {...size} symbol={symbol} exchange={exchange} action={copy.action} />;
49
+ wall = <SignInWall placement={`${copy.placement.replace(/-wall$/, "")}-signin`} {...size} symbol={symbol} exchange={exchange} action={copy.action} pro />;
50
50
  } else if ((gated && !access.emailVerified) || refused === 403) {
51
51
  wall = <SignInWall placement={`${copy.placement.replace(/-wall$/, "")}-signin`} {...size} symbol={symbol} exchange={exchange} action={copy.action} needsVerification />;
52
52
  } else if ((gated && !access.hasProAccess) || refused === 402) {
@@ -5,6 +5,7 @@ import { isQuoteBeforeLatestSession, isQuoteStaleForCurrentSession } from "../..
5
5
  import { quoteFeedDelayMinutes, readIndexSession } from "../../../market-data/market/freshness";
6
6
  import { quoteHeadlineTime } from "../../../market-data/market/status";
7
7
  import { indexLevelMarketState } from "../../../market-data/market/index-level";
8
+ import { isOutsideFuturesProductHours } from "../../../market-data/market/futures-product-hours";
8
9
  import { barSizeFromGap, medianBarGap } from "../../../time-series/bar-spacing";
9
10
  import { apiClient } from "../../../api-client";
10
11
  import { CLOUD_NEWS_DELAY_HOURS, hasProAccess, type PlanAccessUser } from "../../../api-client/plan-rules";
@@ -131,8 +132,10 @@ export function quoteFreshnessFields(
131
132
  ...(quote.nominalPrice ? { nominal: true as const } : {}),
132
133
  ...(delayMinutes != null ? { delayMinutes } : {}),
133
134
  ...(exchange && session ? { sessionExchange: exchange } : {}),
134
- // An index's final close reads as a close, not after hours.
135
- ...(quote.marketState && session ? { marketState: indexLevelMarketState(quote) } : {}),
135
+ // An index's final close reads as a close, not after hours; a grain or a soft outside its own hours, as closed.
136
+ ...(quote.marketState && session
137
+ ? { marketState: isOutsideFuturesProductHours(quote, now) ? "CLOSED" as const : indexLevelMarketState(quote) }
138
+ : {}),
136
139
  ...(sessionCalendar && session ? { sessionCalendar } : {}),
137
140
  };
138
141
  }
@@ -145,9 +148,10 @@ export function quoteFreshnessFields(
145
148
  * for (`asOfDate`), not by the older last trade. A board publishes one per
146
149
  * quote it shows, so `fn` and `shot` date it as `quote` dates the same quotes.
147
150
  */
148
- export function quoteObservation(quote: Quote, now = Date.now()): QuoteFreshnessFields & { updatedAt: number; asOfDate?: string } {
151
+ export function quoteObservation(quote: Quote, now = Date.now()): QuoteFreshnessFields & { quoteSymbol: string; updatedAt: number; asOfDate?: string } {
149
152
  return {
150
153
  ...quoteFreshnessFields(quote, now),
154
+ quoteSymbol: quote.symbol,
151
155
  updatedAt: quoteHeadlineTime(quote),
152
156
  ...(quote.nominalPrice ? { asOfDate: quote.nominalPrice.session } : {}),
153
157
  };
@@ -1,5 +1,6 @@
1
1
  import { createContext } from "react";
2
2
  import type { apiClient, ScannerFeedEvent, ScannerKind } from "../../../api-client";
3
+ import { venueSessionNow } from "../../../market-data/market/venue-session";
3
4
 
4
5
  // The panes that read a scanner feed, and the shot capture that reads it for
5
6
  // them. Core (the CLI's `shot` and its page) imports this, not the scanner
@@ -14,6 +15,16 @@ export const LIVE_SCAN_TEMPLATE_ID = "scanner-live-pane";
14
15
  export const SCANNER_PANE_KINDS: Readonly<Record<string, ScannerKind>> = { [HILO_PANE_ID]: "hilo", [FLOW_PANE_ID]: "flow" };
15
16
 
16
17
  export type ScannerClient = Pick<typeof apiClient, "subscribeScanner">;
18
+
19
+ /**
20
+ * Whether US equities are shut at `now` by the exchange calendar: a weekend, a holiday, or the night between the
21
+ * 20:00 New York close of after-hours and the 04:00 pre-market. The scanners have no session to scan then, so HILO and
22
+ * FLOW answer as a closed session whatever a scanner still holding the last one says.
23
+ */
24
+ export function usScannerSessionClosed(now: number): boolean {
25
+ const phase = venueSessionNow("NYSE", now)?.phase;
26
+ return phase === "closed" || phase === "holiday";
27
+ }
17
28
  /** Where a scanner pane gets its feed; absent, the shared cloud socket. */
18
29
  export const ScannerClientContext = createContext<ScannerClient | null>(null);
19
30
 
@@ -53,14 +64,16 @@ const SCANNER_LABELS: Record<ScannerKind, string> = {
53
64
  * the deadline, since a scanner warming up can pass through a stale row on its
54
65
  * way to live. With `acceptStarting`, so is a starting one, for a report that
55
66
  * says the scanner is starting rather than failing; a screenshot keeps failing
56
- * on one, as it would only picture an empty pane.
67
+ * on one, as it would only picture an empty pane. With `closed`, the market is
68
+ * known shut and nothing better is coming: the first answer is taken, whatever
69
+ * it is.
57
70
  */
58
71
  export function captureScannerEvent(
59
72
  client: ScannerClient,
60
73
  scanner: ScannerKind,
61
74
  signal: AbortSignal,
62
75
  timeoutMs = SCANNER_SNAPSHOT_TIMEOUT_MS,
63
- { acceptStarting = false }: { acceptStarting?: boolean } = {},
76
+ { acceptStarting = false, closed = false }: { acceptStarting?: boolean; closed?: boolean } = {},
64
77
  ): Promise<ScannerFeedEvent> {
65
78
  const label = SCANNER_LABELS[scanner];
66
79
  return new Promise((resolve, reject) => {
@@ -86,7 +99,7 @@ export function captureScannerEvent(
86
99
  }), timeoutMs);
87
100
  signal.addEventListener("abort", onAbort, { once: true });
88
101
  unsubscribe = client.subscribeScanner(scanner, (event: ScannerFeedEvent) => {
89
- if (event.type === "denied") {
102
+ if (event.type === "denied" || closed) {
90
103
  finish(() => resolve(event));
91
104
  return;
92
105
  }
@@ -4,15 +4,24 @@ import type { DataProvider } from "../../../types/data-provider";
4
4
  import type { CompanyProfile } from "../../../types/financials";
5
5
  import { shortCompanyName } from "../../../tickers/company-name";
6
6
  import { classifyInstrumentKind } from "../../../tickers/search/ranking";
7
+ import { canonicalExchange, isKnownExchangeCode, parsePublicTickerKey } from "../../../utils/exchanges";
7
8
  import { logFailure } from "../../../utils/log-failure";
8
9
 
9
10
  /**
10
11
  * A search typed as a ticker (`TRIAL VKTX`, `FDA AZN`): one to five letters,
11
- * with a share class. Registries know companies by name, so a symbol no record
12
- * mentions is looked up as its company.
12
+ * with a share class, and the venue it lists on when written as the app writes
13
+ * a listing (`FDA AZN:LSE`, `BRK.B:NYSE`). Registries know companies by name,
14
+ * so a symbol no record mentions is looked up as its company.
13
15
  */
14
16
  export function looksLikeTicker(term: string): boolean {
15
- return /^[A-Za-z]{1,5}(?:[.-][A-Za-z])?$/.test(term.trim());
17
+ const match = /^([A-Za-z]{1,5}(?:[.-][A-Za-z])?)(?::([A-Za-z]{2,8}))?$/.exec(term.trim());
18
+ return !!match && (!match[2] || isKnownExchangeCode(canonicalExchange(match[2])));
19
+ }
20
+
21
+ /** The listing a ticker search names: `AZN:LSE` is AZN on LSE, `AZN` the symbol alone. */
22
+ function tickerListing(ticker: string): { symbol: string; exchange: string } {
23
+ const { symbol, exchange } = parsePublicTickerKey(ticker.trim().toUpperCase());
24
+ return { symbol, exchange: exchange ?? "" };
16
25
  }
17
26
 
18
27
  /**
@@ -23,9 +32,9 @@ export function looksLikeTicker(term: string): boolean {
23
32
  * timed out) rejects: it says nothing about the company.
24
33
  */
25
34
  export async function tickerCompanyName(dataProvider: Pick<DataProvider, "getQuote"> | null, ticker: string): Promise<string | null> {
26
- const symbol = ticker.trim().toUpperCase();
35
+ const { symbol, exchange } = tickerListing(ticker);
27
36
  if (!dataProvider || !symbol) return null;
28
- const quote = await dataProvider.getQuote(symbol).catch((error: unknown) => {
37
+ const quote = await (exchange ? dataProvider.getQuote(symbol, exchange) : dataProvider.getQuote(symbol)).catch((error: unknown) => {
29
38
  if (isNoSourceAnswer(error)) return null;
30
39
  throw error;
31
40
  });
@@ -79,15 +88,15 @@ async function tickerListedCompany(
79
88
  dataProvider: Pick<DataProvider, "getQuote" | "getTickerFinancials"> | null,
80
89
  ticker: string,
81
90
  ): Promise<ListedCompany | null> {
82
- const symbol = ticker.trim().toUpperCase();
91
+ const { symbol, exchange } = tickerListing(ticker);
83
92
  if (!dataProvider || !symbol) return null;
84
93
  const [quote, financials] = await Promise.all([
85
- dataProvider.getQuote(symbol).catch((error: unknown) => {
94
+ (exchange ? dataProvider.getQuote(symbol, exchange) : dataProvider.getQuote(symbol)).catch((error: unknown) => {
86
95
  if (isNoSourceAnswer(error)) return null;
87
96
  throw error;
88
97
  }),
89
98
  // What it does is a detail: a profile that could not be read leaves the name to tell.
90
- Promise.resolve().then(() => dataProvider.getTickerFinancials(symbol, "")).catch(logFailure("ticker-company", `Read ${symbol}'s profile failed`, null)),
99
+ Promise.resolve().then(() => dataProvider.getTickerFinancials(symbol, exchange)).catch(logFailure("ticker-company", `Read ${symbol}'s profile failed`, null)),
91
100
  ]);
92
101
  const legalName = quote?.name?.trim();
93
102
  const kind = classifyInstrumentKind(quote?.instrumentType);