@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
@@ -36,6 +36,7 @@ import { glossaryFunctionsNamed, glossaryNamesFunction, renderGlossaryEntries, t
36
36
  import { renderSeriesMatches, type SeriesMatch } from "../series-search";
37
37
  import { typoDistance } from "../../utils/typo-distance";
38
38
  import { FUNCTION_HELP } from "./function-help";
39
+ import { functionQueryTerms as queryTerms, matchesFunctionPhrase as containsPhrase } from "../../utils/function-search";
39
40
  import { ratesQuestionFunctions } from "./rates-question";
40
41
  import { tickerQuestion, type TickerQuestion } from "./ticker-question";
41
42
  import { quotedSearchCommand } from "../commands/news-search";
@@ -439,14 +440,6 @@ function namesShownTerm(entry: Pick<PaneCatalogEntry, "token" | "shortcut" | "al
439
440
  return [entry.token, entry.shortcut, ...entry.aliases].some((code) => !!code && glossaryNamesFunction(code, query));
440
441
  }
441
442
 
442
- /** The phrase starting a word of the text, so "funding rate" finds "funding rates" but "rate" is not found in "separate". */
443
- function containsPhrase(text: string, phrase: string): boolean {
444
- for (let at = text.indexOf(phrase); at >= 0; at = text.indexOf(phrase, at + 1)) {
445
- if (at === 0 || !/[a-z0-9]/.test(text[at - 1]!)) return true;
446
- }
447
- return false;
448
- }
449
-
450
443
  // A multi-word query ranks a function carrying the whole phrase in its name or keywords first, then in its
451
444
  // description, then one carrying every word in its name or description, then every word counting its flags;
452
445
  // the rest rank by how many words they match.
@@ -475,16 +468,6 @@ function phraseBand(entry: PaneCatalogEntry, phrase: string): number {
475
468
  return descriptions.some((description) => containsPhrase(description, phrase)) ? PHRASE_IN_DESCRIPTION_BAND : 0;
476
469
  }
477
470
 
478
- /** Words that join a topic without naming it: "year to date" is year and date. */
479
- const QUERY_STOP_WORDS = new Set(["a", "an", "and", "at", "by", "for", "from", "in", "is", "of", "on", "or", "the", "to", "with"]);
480
-
481
- /** The words of a query that name something; a query of only joining words keeps them. */
482
- function queryTerms(query: string): string[] {
483
- const words = query.toLowerCase().split(/\s+/).map((term) => term.trim()).filter(Boolean);
484
- const named = words.filter((word) => !QUERY_STOP_WORDS.has(word));
485
- return named.length > 0 ? named : words;
486
- }
487
-
488
471
  /** The texts that say what a function is called and does, apart from its flags, each on its own. */
489
472
  function nameAndDescriptionFields(entry: PaneCatalogEntry): string[] {
490
473
  return [
@@ -1,5 +1,5 @@
1
1
  import { logFailure } from "../../utils/log-failure";
2
- import type { TickerFinancials } from "../../types/financials";
2
+ import type { PricePoint, TickerFinancials } from "../../types/financials";
3
3
  import type { TickerRecord } from "../../types/ticker";
4
4
  export { clipPriceHistoryToRange } from "../../time-series/history-window";
5
5
  import { CHART_COMPOSER_PANE_ID, LEGACY_TICKER_DETAIL_PANE_ID } from "../../types/config";
@@ -105,21 +105,25 @@ export async function withShotPriceHistory(
105
105
  * SEAS reads monthly closes, and its Weekdays tab daily ones. Captured history
106
106
  * answers every request, so the weekly seed would stand in for them and price
107
107
  * each month at a week's close. The pane's own load fetches the shot tab's
108
- * cadence, tagged so no other cadence is answered.
108
+ * cadence, tagged so no other cadence is answered. Beside monthly closes it
109
+ * also reads a month of daily ones, which name the close the running month
110
+ * runs to: those are returned as `daily`, for the capture to answer that
111
+ * request with.
109
112
  */
110
113
  export async function withShotSeasonalityHistory(
111
114
  context: MarketContext,
112
115
  instrument: InstrumentRef,
113
116
  resolved: ResolvedPaneFunction,
114
117
  financials: TickerFinancials,
115
- ): Promise<TickerFinancials> {
118
+ ): Promise<{ financials: TickerFinancials; daily: PricePoint[] }> {
116
119
  const cadence = resolved.options.tab === "weekdays" ? "daily" : "monthly";
117
120
  const history = await loadSeasonalityHistory({ instrument, cadence, forceRefresh: context.refresh }, context.dataProvider);
118
121
  if (history.error || history.stale) {
119
122
  throw new Error(`${instrument.symbol}: ${history.error ?? `${cadence} price history is stale`}`);
120
123
  }
121
124
  // The bars as served: the pane closes a continuous future's rolls itself, from its daily bars.
122
- return { ...financials, priceHistory: history.served.points, priceHistoryResolution: history.served.resolution };
125
+ return { financials: { ...financials, priceHistory: history.served.points, priceHistoryResolution: history.served.resolution },
126
+ daily: history.served.daily ?? [] };
123
127
  }
124
128
 
125
129
  /**
@@ -1,7 +1,8 @@
1
1
  import type { TickerFinancials } from "../../types/financials";
2
+ import { apiClient } from "../../api-client";
2
3
  import type { DesktopPaneShotPayload, DesktopPaneShotRenderResult } from "../desktop-pane-shot";
3
4
  import type { ResolvedPaneFunction } from "./resolver";
4
- import { createValuationCurrencyContext } from "../../time-series/valuation-currency";
5
+ import { createValuationCurrencyContext, loadValuationFx } from "../../time-series/valuation-currency";
5
6
  import {
6
7
  resolveFinancialPeriod,
7
8
  resolveFinancialPeriodOption,
@@ -12,7 +13,9 @@ import {
12
13
  findRatioTab,
13
14
  formatRatioInput,
14
15
  formatRatioValue,
16
+ oldestRatioPeriodEnd,
15
17
  ratioPeriodEnd,
18
+ ratioStatements,
16
19
  ratioTableForFinancials,
17
20
  resolveFinancialSectionKey,
18
21
  type RatioTabDef,
@@ -49,10 +52,21 @@ export function shotFinancialPeriod(resolved: ResolvedPaneFunction, financials:
49
52
 
50
53
  interface RatioShot {
51
54
  symbol: string;
52
- financials: TickerFinancials;
53
55
  tab: RatioTabDef;
54
56
  period: FinancialPeriod;
55
57
  model: RatioTableModel;
58
+ currencies: ReturnType<typeof createValuationCurrencyContext>;
59
+ }
60
+
61
+ export async function loadShotValuationFx(resolved: ResolvedPaneFunction, financials?: TickerFinancials): Promise<DesktopPaneShotPayload["valuationFx"]> {
62
+ if (!financials || shotRatioTab(resolved)?.key !== "valuation") return;
63
+ const statements = ratioStatements(financials, shotFinancialPeriod(resolved, financials));
64
+ const since = oldestRatioPeriodEnd(statements);
65
+ if (!since) return;
66
+ const codes = createValuationCurrencyContext(financials).fxCurrencies(statements);
67
+ if (!codes.length) return;
68
+ const fx = await loadValuationFx(codes, since, apiClient);
69
+ return [...fx.values()].map((series) => ({ ...series, closes: [...series.closes] }));
56
70
  }
57
71
 
58
72
  /** The table the page computes from the captured data, with every ratio expanded. */
@@ -64,7 +78,9 @@ function ratioShot(resolved: ResolvedPaneFunction, payload: DesktopPaneShotPaylo
64
78
  // The page answers Valuation's daily request only from a daily capture.
65
79
  const history = tab.key === "valuation" && financials.priceHistoryResolution === PERIOD_END_HISTORY_RESOLUTION
66
80
  ? financials.priceHistory : null;
67
- return { symbol, financials, tab, period, model: ratioTableForFinancials(financials, tab, period, history) };
81
+ const fx = new Map(payload.valuationFx?.map((series) => [series.currency, { ...series, closes: new Map(series.closes) }]));
82
+ const currencies = createValuationCurrencyContext(financials, fx);
83
+ return { symbol, tab, period, currencies, model: ratioTableForFinancials(financials, tab, period, history, undefined, currencies) };
68
84
  }
69
85
 
70
86
  const hasRatio = ({ model }: RatioShot, index: number) => model.ratios.some((def) => (
@@ -77,9 +93,8 @@ export function financialRatioShotGap(resolved: ResolvedPaneFunction, payload: D
77
93
  if (!shot) return null;
78
94
  if (shot.tab.key === "valuation") {
79
95
  const unpriced = shot.model.periods.flatMap(({ statement, price }) => typeof price === "number" ? [] : [statement]);
80
- // A close in another currency than the statements prices nothing; the pane's footer says so.
81
96
  if (unpriced.length) {
82
- return createValuationCurrencyContext(shot.financials).warning(unpriced)
97
+ return shot.currencies.warning(unpriced, ratioPeriodEnd)
83
98
  ?? `Valuation has no period-end close for ${unpriced.map(ratioPeriodEnd).join(", ")}, so those columns read "no price".`;
84
99
  }
85
100
  }
@@ -14,6 +14,7 @@ import { isRecord } from "../../utils/guards";
14
14
  import { latestRegularSessionClose, readIndexSession, regularSessionCloseOn, sessionCalendarTimeZone } from "../../market-data/market/freshness";
15
15
  import {
16
16
  reportMarketSession,
17
+ shownSessionList,
17
18
  reportVenueMarkets,
18
19
  reportVenueSessionDates,
19
20
  type ReportMarket,
@@ -21,7 +22,7 @@ import {
21
22
  type VenueMarket,
22
23
  type VenueSessionDate,
23
24
  } from "./market-session";
24
- import { savedCopyShownAt } from "../../data/saved-copies";
25
+ import { savedCopyShownAt, servedCopiesAt } from "../../data/saved-copies";
25
26
  import { releasedText } from "../../utils/release-date";
26
27
 
27
28
  /**
@@ -66,6 +67,7 @@ export interface ReportFreshness {
66
67
  ageMinutes?: number;
67
68
  /** When only some rows are stale: how many, of the rows that say whether they are... */
68
69
  staleCount?: number;
70
+ staleSymbol?: string;
69
71
  observationCount?: number;
70
72
  /**
71
73
  * How many of those rows are at a nominal price, nothing having traded
@@ -87,6 +89,8 @@ export interface ReportFreshness {
87
89
  periodToDate?: { period: "week" | "month"; through?: string };
88
90
  /** The local date of the session close `asOf` is, when the newest observation is its venue's latest close. */
89
91
  asOfClose?: string;
92
+ /** A session list of a part of `asOfClose`'s session (declared `sessionList.part`), named in its place: `pre-market`. */
93
+ asOfSessionPart?: "pre-market" | "after-hours";
90
94
  /**
91
95
  * `asOf` is the last print of a session that has closed since, taken
92
96
  * before its close (a feed that stopped early): `last print 12:14 UTC`,
@@ -156,7 +160,8 @@ export interface ReportFreshness {
156
160
  /** Who published the figures, when the data names them. */
157
161
  publisher?: string;
158
162
  /** When the publisher released the data, an ISO instant in UTC or an ISO date, when the data states it. */
159
- publishedAt?: string;
163
+ publishedAt?: string | null;
164
+ fredUpdatedAt?: string;
160
165
  /** When this report was built. */
161
166
  retrievedAt: string;
162
167
  /**
@@ -179,9 +184,28 @@ export interface ReportFreshness {
179
184
  * reads `couldn't refresh; saved copy from 21:49 UTC` instead of live or delayed.
180
185
  */
181
186
  export function withSavedCopy<F extends ReportFreshness | undefined>(freshness: F, shown: unknown): F {
182
- if (!freshness || freshness.savedAt) return freshness;
187
+ if (!freshness || freshness.savedAt) return withServedCopies(freshness);
183
188
  const savedAt = savedCopyShownAt(shown);
184
- return savedAt == null ? freshness : { ...freshness, savedAt: new Date(savedAt).toISOString() };
189
+ return withServedCopies(savedAt == null ? freshness : { ...freshness, savedAt: new Date(savedAt).toISOString() });
190
+ }
191
+
192
+ /**
193
+ * The freshness of a report built while the command was served copies of
194
+ * datasets read earlier (`servedCopiesAt`): retrieved when the oldest of them
195
+ * was read, not when the report was built, and a saved copy when a failed
196
+ * refresh fell back to one. A report whose rows were rebuilt from such a read
197
+ * (INS's trades from a filing list) carries no mark of it, so it is dated so.
198
+ */
199
+ function withServedCopies<F extends ReportFreshness | undefined>(freshness: F): F {
200
+ if (!freshness || freshness.unreached) return freshness;
201
+ const { retrievedAt, savedAt } = servedCopiesAt();
202
+ if (retrievedAt == null) return freshness;
203
+ const built = Date.parse(freshness.retrievedAt);
204
+ return {
205
+ ...freshness,
206
+ ...(Number.isFinite(built) && retrievedAt < built ? { retrievedAt: new Date(retrievedAt).toISOString() } : {}),
207
+ ...(savedAt != null && !freshness.savedAt ? { savedAt: new Date(savedAt).toISOString() } : {}),
208
+ };
185
209
  }
186
210
 
187
211
  /** One source's newest observation: an ISO instant in UTC. */
@@ -215,6 +239,7 @@ interface FeedSignals {
215
239
  /** Rows and series that carry a `stale` flag, and the times of those that are stale... */
216
240
  flagged: number;
217
241
  staleTimes: Array<ReportTime | null>;
242
+ staleSymbol?: string;
218
243
  /** ...and how many of them are at a nominal price instead (`nominal`). */
219
244
  nominal: number;
220
245
  /** Rows that name the venue whose sessions they follow (`sessionExchange`), with their time. */
@@ -302,7 +327,10 @@ function readUnitStale(record: Record<string, unknown>, time: ReportTime | null,
302
327
  if (typeof record.stale !== "boolean") return;
303
328
  signals.flagged += 1;
304
329
  if (record.nominal === true) signals.nominal += 1;
305
- else if (record.stale) signals.staleTimes.push(time);
330
+ else if (record.stale) {
331
+ signals.staleTimes.push(time);
332
+ signals.staleSymbol = signals.staleTimes.length === 1 && typeof record.quoteSymbol === "string" ? record.quoteSymbol : undefined;
333
+ }
306
334
  }
307
335
 
308
336
  function observedTime(record: Record<string, unknown>, now: number, keys: readonly string[] = OBSERVATION_KEYS): ReportTime | null {
@@ -508,7 +536,12 @@ function readPeriodToDate(declared: HeadlessPaneFreshness["periodToDate"], now:
508
536
  return { period: declared.period, through: through?.dateOnly && through.time <= now + FUTURE_TOLERANCE_MS ? through : null };
509
537
  }
510
538
 
511
- function resolveFreshness({ declared, signals, observations, now }: FreshnessInputs): ReportFreshness {
539
+ /** A report's freshness, dated by the dataset copies the command was served where it read them (`withServedCopies`). */
540
+ function resolveFreshness(inputs: FreshnessInputs): ReportFreshness {
541
+ return withServedCopies(resolveReadFreshness(inputs));
542
+ }
543
+
544
+ function resolveReadFreshness({ declared, signals, observations, now }: FreshnessInputs): ReportFreshness {
512
545
  const sources = declaredSources(declared, now);
513
546
  // Sources date the data by their own observations, as a declared as-of does.
514
547
  const declaredAsOf = observedTime({ asOf: declared.asOf }, now, ["asOf"]) ?? newest(sources.map(({ time }) => time));
@@ -579,13 +612,18 @@ function resolveFreshness({ declared, signals, observations, now }: FreshnessInp
579
612
  }
580
613
  }
581
614
  }
582
- const { market, closeDate, closeMarket, lastPrint } = reportMarketSession(signals.sessions, now);
615
+ const rowsSession = reportMarketSession(signals.sessions, now);
616
+ // A list of one market taken once its session closed names that session, and where the market stands now.
617
+ const listed = declared.sessionList && asOf && !asOf.dateOnly ? shownSessionList(declared.sessionList, asOf.time, now) : null;
618
+ const { closeDate, closeMarket } = listed ?? rowsSession;
619
+ const market = listed?.market ?? rowsSession.market;
620
+ const lastPrint = !listed && rowsSession.lastPrint;
583
621
  const venueSessions = declared.datesEachVenue && !declaredAsOf ? reportVenueSessionDates(signals.sessions, now) : [];
584
622
  // Each market's own state and open, when they are not all one: `LSE opens 08:00 UTC · US 13:30 UTC`.
585
623
  const venueMarkets = declared.datesEachVenue ? reportVenueMarkets(signals.sessions, now) : [];
586
624
  const markets = venueMarkets.length > 0 && !sameMarketText(venueMarkets, now) ? venueMarkets : [];
587
625
  // The close wording dates the newest observation, so only when that is what `asOf` is.
588
- const asOfClose = closeDate && asOf && !declaredAsOf ? closeDate : null;
626
+ const asOfClose = closeDate && asOf && (!declaredAsOf || listed) ? closeDate : null;
589
627
  const asOfLastPrint = lastPrint && asOf && !asOf.dateOnly && !declaredAsOf;
590
628
  const tradingDayMarket = asOfClose ? closeMarket
591
629
  : asOf?.dateOnly ? declared.tradingDayMarket?.trim() || null : null;
@@ -611,6 +649,7 @@ function resolveFreshness({ declared, signals, observations, now }: FreshnessInp
611
649
  const scheduleVariants = schedule ? (declared.scheduleVariants ?? []).map((variant) => variant.trim()).filter((variant) => variant && variant !== schedule) : [];
612
650
  const publisher = declared.publisher?.trim();
613
651
  const publishedAt = parseReportTime(declared.publishedAt);
652
+ const fredUpdatedAt = parseReportTime(declared.fredUpdatedAt);
614
653
  // A figure dated by the period it covers is as of its release: September's permits
615
654
  // are dated 1 Sep and were released 20 Oct. Age, staleness and the oldest stay the observation's.
616
655
  const released = asOf?.dateOnly && !declared.dataset && !periodToDate
@@ -620,7 +659,7 @@ function resolveFreshness({ declared, signals, observations, now }: FreshnessInp
620
659
  const oldestPeriodicity = declared.oldestPeriodicity !== undefined ? declared.oldestPeriodicity
621
660
  : oldestRelease ? oldestRelease.periodicity ?? null : unitRelease?.periodicity ? null : undefined;
622
661
  // Series that each end on their own day name the oldest one's day even a day apart (`oldestAnyDay`).
623
- const namesOldest = !!asOf && !!oldestTime && (asOf.time - oldestTime.time > OLDEST_GAP_MS
662
+ const namesOldest = !listed && !!asOf && !!oldestTime && (asOf.time - oldestTime.time > OLDEST_GAP_MS
624
663
  || (declared.oldestAnyDay === true && declared.oldest != null && isoTime(oldestTime).slice(0, 10) < isoTime(asOf).slice(0, 10)));
625
664
  return {
626
665
  // A declared null source says the data has no name to give, which is left out rather than called Gloom Cloud.
@@ -638,11 +677,13 @@ function resolveFreshness({ declared, signals, observations, now }: FreshnessInp
638
677
  ...(minDelayMinutes != null && minDelayMinutes > 0 ? { minDelayMinutes } : {}),
639
678
  ...(status === "stale" && staleAt ? { ageMinutes: Math.max(0, Math.floor((now - staleAt.time) / 60_000)) } : {}),
640
679
  ...(partial ?? {}),
680
+ ...(partial && signals.staleSymbol ? { staleSymbol: signals.staleSymbol } : {}),
641
681
  ...(signals.nominal > 0 ? { nominalCount: signals.nominal, observationCount: signals.flagged } : {}),
642
682
  ...(status === "not-a-feed" && declared.basis ? { basis: declared.basis } : {}),
643
683
  ...(periodicity ? { periodicity } : {}),
644
684
  ...(periodToDate && !declaredAsOf ? { periodToDate: { period: periodToDate.period, ...(periodToDate.through ? { through: isoTime(periodToDate.through) } : {}) } } : {}),
645
685
  ...(asOfClose ? { asOfClose } : {}),
686
+ ...(asOfClose && listed?.part ? { asOfSessionPart: listed.part } : {}),
646
687
  ...(asOfLastPrint ? { asOfLastPrint: true as const } : {}),
647
688
  ...(tradingDayMarket ? { tradingDayMarket } : {}),
648
689
  ...(market ? { market } : {}),
@@ -663,7 +704,8 @@ function resolveFreshness({ declared, signals, observations, now }: FreshnessInp
663
704
  ...(schedule ? { schedule } : {}),
664
705
  ...(scheduleVariants.length > 0 ? { scheduleVariants } : {}),
665
706
  ...(publisher ? { publisher } : {}),
666
- ...(publishedAt ? { publishedAt: isoTime(publishedAt) } : {}),
707
+ ...(publishedAt ? { publishedAt: isoTime(publishedAt) } : declared.publishedAt === null ? { publishedAt: null } : {}),
708
+ ...(fredUpdatedAt ? { fredUpdatedAt: isoTime(fredUpdatedAt) } : {}),
667
709
  retrievedAt: declaredRetrieval(declared.retrievedAt, now) ?? new Date(now).toISOString(),
668
710
  };
669
711
  }
@@ -859,8 +901,9 @@ function ageText(minutes: number): string {
859
901
  * when `short`. Null when the report does not count them. One wording for a
860
902
  * report's status line, a capture's and the status a capture prints.
861
903
  */
862
- export function staleRowsText(freshness: Pick<ReportFreshness, "staleCount" | "observationCount">, short = false): string | null {
904
+ export function staleRowsText(freshness: Pick<ReportFreshness, "staleCount" | "staleSymbol" | "observationCount">, short = false): string | null {
863
905
  if (freshness.staleCount == null || freshness.observationCount == null) return null;
906
+ if (freshness.staleCount === 1 && freshness.staleSymbol) return `${freshness.staleSymbol} stale`;
864
907
  return `${short ? freshness.staleCount : `${freshness.staleCount} of ${freshness.observationCount}`} stale`;
865
908
  }
866
909
 
@@ -981,7 +1024,7 @@ function asOfText(freshness: ReportFreshness, short: boolean, local: boolean, un
981
1024
  : freshness.periodToDate ? periodToDateText(freshness.periodToDate, freshness.asOf)
982
1025
  : period ? `${periodText(freshness.asOf, period)} (${period})`
983
1026
  : freshness.asOfClose
984
- ? `${tradingDayText(freshness.asOfClose, market)} close`
1027
+ ? `${tradingDayText(freshness.asOfClose, market)} ${freshness.asOfSessionPart ?? "close"}`
985
1028
  : freshness.asOfLastPrint && time && !time.dateOnly
986
1029
  ? `last print ${undated && onRetrievalDay(new Date(time.time).toISOString(), freshness.retrievedAt)
987
1030
  ? `${new Date(time.time).toISOString().slice(11, 16)} UTC` : timeText(freshness.asOf, local)}`
@@ -1441,6 +1484,8 @@ export interface CaptureStatusLine {
1441
1484
  * `as of` dates; null when it dates nothing it can name.
1442
1485
  */
1443
1486
  dates: "data" | "quotes" | null;
1487
+ /** The view dates its data in its own footer (`rendersOwnStatus`), which the capture keeps beside the line. */
1488
+ ownStatus?: true;
1444
1489
  }
1445
1490
 
1446
1491
  /**
@@ -362,8 +362,8 @@ export const FUNCTION_HELP: Readonly<Record<string, FunctionHelp>> = {
362
362
  bloomberg: [],
363
363
  },
364
364
  MDAY: {
365
- summary: "Does this name care about CPI day? Its average move on CPI, jobs report and FOMC days against a normal day, the average signed move and share of up days, and the move on every release day. Takes a FRED series too (FRED:T10Y2Y), whose moves in a rate or spread read in basis points.",
366
- usage: ["MDAY SPY", "MDAY FRED:T10Y2Y"],
365
+ summary: "Compare up to four tickers or FRED series side by side on CPI, jobs report and central-bank release days. Daily close-to-close moves are in bp for yields or rates and % otherwise. With one ticker, compare its release-day moves to a normal day.",
366
+ usage: ["MDAY SPY", "MDAY SPY,UUP,^TNX,GLD", "MDAY FRED:T10Y2Y"],
367
367
  keys: [],
368
368
  data: DAILY_CLOSES,
369
369
  bloomberg: [],
@@ -633,9 +633,12 @@ function observationCount(series: HeadlessSeries): number {
633
633
  return series.points.filter((point) => point.value != null || point.close != null).length;
634
634
  }
635
635
 
636
+ /** The averages, and the change with what it is against: the year-ago mean and the days it is of. */
636
637
  const TRAILING_COLUMNS: HeadlessPaneColumn[] = [
637
638
  { key: "avg7", header: "7D avg", literalHeader: true, align: "right" },
638
639
  { key: "avg28", header: "28D avg", literalHeader: true, align: "right" },
640
+ { key: "yearAgoAvg28", header: "Yr-ago 28D avg", literalHeader: true, align: "right" },
641
+ { key: "yearAgoWindow", header: "Yr-ago days", literalHeader: true, shrink: false },
639
642
  { key: "vsYearAgo", header: "28D vs yr ago", literalHeader: true, align: "right" },
640
643
  ];
641
644
 
@@ -643,9 +646,12 @@ function trailingCells(trailing: HeadlessSeries["trailing"]): Record<string, str
643
646
  if (!trailing) return {};
644
647
  const mean = (value: number | null) => (value == null ? MISSING_VALUE : value.toFixed(1));
645
648
  const change = trailing.changeVsYearAgoPct;
649
+ const days = trailing.yearAgoWindow;
646
650
  return {
647
651
  avg7: mean(trailing.avg7),
648
652
  avg28: mean(trailing.avg28),
653
+ yearAgoAvg28: mean(trailing.yearAgoAvg28),
654
+ yearAgoWindow: days ? `${days.start} to ${days.end}` : MISSING_VALUE,
649
655
  vsYearAgo: change == null || !Number.isFinite(change) ? MISSING_VALUE : `${change > 0 ? "+" : ""}${change.toFixed(1)}%`,
650
656
  };
651
657
  }
@@ -25,8 +25,8 @@ import {
25
25
  type ParsedPaneFunctionArgs,
26
26
  } from "./options";
27
27
  import {
28
- applyListingArgument, findPaneFunction, parsePaneFunctionArgsFor, resolvePaneFunction, UnknownPaneFunctionError,
29
- type PluginCodeStopFinder, type ResolvedPaneFunction,
28
+ applyListingArgument, findPaneFunction, parsePaneFunctionArgsFor, resolvePaneFunction, typedFunctionCode, UnknownPaneFunctionError,
29
+ withRenamedTickers, type PluginCodeStopFinder, type ResolvedPaneFunction,
30
30
  } from "./resolver";
31
31
  import { idleCliPlugins, installedPluginCount } from "../registry";
32
32
  import { pluginSupportsTarget } from "../../plugins/plugin-export";
@@ -95,6 +95,12 @@ async function withPaneRuntime<T>(
95
95
  let parsed = await applyListingArgument(registry, context, parsePaneFunctionArgsFor(registry, args, ctx.cliOptions), settings.command);
96
96
  const resolution = { ...settings, seriesSources: () => ctx.plugins, pluginStop: pluginStopFor(ctx, context) };
97
97
  let resolved = await resolvePaneFunction(registry, context, parsed, resolution);
98
+ // A ticker whose company moved (SQ) is read as its new symbol (XYZ) before the function asks for anything.
99
+ const renamed = await withRenamedTickers(context, parsed, resolved, isTickerLinkPeer(resolved.instance, registry.panes));
100
+ if (renamed) {
101
+ parsed = renamed;
102
+ resolved = await resolvePaneFunction(registry, context, parsed, resolution);
103
+ }
98
104
  // A function that widens its argument (RV's --peers) runs, reports and captures the widened one.
99
105
  const expansion = await expandResolvedArgument(resolved, context, parsed.arg);
100
106
  if (expansion) {
@@ -468,7 +474,8 @@ export async function runPaneFunction(args: string[], ctx: CliCommandContext) {
468
474
  const fate = listing && quoteAnswer && isTickerLinkPeer(resolved.instance, registry.panes)
469
475
  ? listingFateLoader(listing, context, quoteAnswer().then((answer) => answer.quote), { successor: true })
470
476
  : null;
471
- const moved = { command: "fn", retry: (key: string) => `gloom fn ${resolved.token} ${key}` };
477
+ // The retry starts with the code typed (`fn DES SQ` suggests `gloom fn DES XYZ`, not T).
478
+ const moved = { command: "fn", retry: (key: string) => `gloom fn ${typedFunctionCode(parsed.target, resolved)} ${key}` };
472
479
  // A report that fails or comes back empty for an exchange the symbol is not listed on says so.
473
480
  // A report written to a file is drawn for it as it is built: no colour and no terminal width, as a redirect gets it.
474
481
  const buildReport = () => buildFunctionReport(resolved, context, parsed.arg, registry);
@@ -691,7 +698,7 @@ async function capturePaneScreenshot(args: string[], ctx: CliCommandContext, onS
691
698
  // A bare code several companies list asks which, as `fn` does.
692
699
  if (parsed.listing && !quote) {
693
700
  await failUnchosenListing(parsed.listing, context, ctx,
694
- { command: "shot", noun: "data", retry: (key) => `gloom shot ${resolved.token} ${key}` }, quoteError);
701
+ { command: "shot", noun: "data", retry: (key) => `gloom shot ${typedFunctionCode(parsed.target, resolved)} ${key}` }, quoteError);
695
702
  }
696
703
  const stop = parsed.listing && !quote ? await notATickerStop(quoteError, parsed.listing, context) : null;
697
704
  throw stop ? new Error(stop) : error;
@@ -10,6 +10,7 @@ import {
10
10
  nextRegularSessionOpen,
11
11
  } from "../../market-data/market/freshness";
12
12
  import { futuresWeekendClosure } from "../../market-data/market/futures-week";
13
+ import { shownSessionDay } from "../../market-data/market/venue-session";
13
14
  import { currentFxClosureStart, isFxWeekClosePrint, nextFxWeekOpen } from "../../utils/fx-market-hours";
14
15
  import { zonedDateKey } from "../../utils/zoned-date-time";
15
16
  import type { ReportTime } from "../../utils/utc-time";
@@ -360,3 +361,27 @@ export function reportMarketSession(
360
361
  closeMarket: closeDate && newest ? closeMarketOf(newest.exchange, newest.session) : null,
361
362
  };
362
363
  }
364
+
365
+ /**
366
+ * A declared session list's session (`sessionList`), once its market is
367
+ * shut: the trading day the list taken at `at` shows (`shownSessionDay`, or
368
+ * the day the list states), whose trading day that is, and where the market
369
+ * stands now. Null while the market trades, or for a list taken during a
370
+ * regular session.
371
+ */
372
+ export function shownSessionList(
373
+ list: { exchange: string; session?: string; part?: "pre-market" | "after-hours" },
374
+ at: number,
375
+ now: number,
376
+ ): { closeDate: string; closeMarket: string; market: ReportMarket | null; part?: "pre-market" | "after-hours" } | null {
377
+ const exchange = canonicalExchange(list.exchange);
378
+ const shown = exchange ? shownSessionDay(exchange, at, now) : null;
379
+ if (!shown) return null;
380
+ const stated = list.session && /^\d{4}-\d{2}-\d{2}$/.test(list.session) && list.session <= shown ? list.session : null;
381
+ return {
382
+ closeDate: stated ?? shown,
383
+ closeMarket: isUsListingExchange(exchange) ? "US" : exchange,
384
+ market: reportMarketSession([{ exchange, time: null }], now).market,
385
+ ...(list.part ? { part: list.part } : {}),
386
+ };
387
+ }
@@ -54,6 +54,16 @@ export function renderedReportFailure(semanticUi: readonly RemoteUiNodeSnapshot[
54
54
  return details ? { message, details } : { message };
55
55
  }
56
56
 
57
+ /**
58
+ * Whether the rendered view dates its data in its own footer, which the
59
+ * quotes the page loaded do not date (`own-status`): a DES research tab such
60
+ * as Ownership, whose holdings the listing's quote says nothing of. A capture
61
+ * of it keeps that footer, and its status line is never the quotes'.
62
+ */
63
+ export function rendersOwnStatus(semanticUi: readonly RemoteUiNodeSnapshot[]): boolean {
64
+ return semanticUi.some((node) => node.role === "own-status");
65
+ }
66
+
57
67
  /**
58
68
  * The load a rendered pane says failed, from the `pane-load-error` node its
59
69
  * status footer publishes (usePaneStatusFooter): the error the footer shows.
@@ -20,6 +20,8 @@ import {
20
20
  import { uncoveredInstrumentKind, uncoveredInstrumentMessage, uncoveredInstrumentsMessage } from "../../tickers/instrument-coverage";
21
21
  import { uncoveredInstrumentCommand } from "../uncovered-instrument";
22
22
  import { listingAbroadVenue } from "../../utils/sec";
23
+ import { parsePublicTickerKey } from "../../utils/exchanges";
24
+ import { movedListing, movedListingNote } from "../../tickers/listing-fate";
23
25
  import { splitSymbolArgs, stripStrayEdges } from "../symbol-args";
24
26
  import { readNameEntries } from "../name-entries";
25
27
  import { bankFigurePointer, bankWordPointer } from "../known-gaps";
@@ -276,9 +278,16 @@ export async function applyListingArgument(
276
278
  // A long list is a batch of tickers: its words cost no quote each to be read as companies' names, nor its codes
277
279
  // no source quotes to be read on their listings abroad.
278
280
  const companyWord = typed.length <= MAX_CHOICE_LOOKUPS;
279
- let listings = named ? [named] : await Promise.all(typed.map((raw) => resolveCliListing(raw, exchange, context, {
280
- ownExchangeWins: typed.length > 1, venueSuffix: true, companyWord, listingAbroad: companyWord,
281
- })));
281
+ let listings = named ? [named] : await Promise.all(typed.map((raw): Promise<CliListing> => {
282
+ const series = !exchange && headless?.fredSeriesArgument ? fredSeriesArgument(raw) : null;
283
+ if (series) {
284
+ const symbol = `FRED:${series}`;
285
+ return Promise.resolve({ symbol, key: symbol, exchange: "", saved: null, request: { symbol, exchange: "" } });
286
+ }
287
+ return resolveCliListing(raw, exchange, context, {
288
+ ownExchangeWins: typed.length > 1, venueSuffix: true, companyWord, listingAbroad: companyWord,
289
+ });
290
+ }));
282
291
  // A separator stuck to the end of a pasted list (`UPST;`) is not part of a symbol; it is named.
283
292
  const notes: string[] = takesOneTicker ? [] : stripStrayEdges(args.arg).notes;
284
293
  notes.push(...aliases.flatMap((alias) => alias ? [alias.note] : []));
@@ -363,6 +372,69 @@ export async function applyListingArgument(
363
372
  };
364
373
  }
365
374
 
375
+ /**
376
+ * `fn CSP SQ` is `fn CSP XYZ`: a ticker whose company moved (SQ became XYZ on
377
+ * 2025-01-21), with nothing new listed under it, is read as the symbol the
378
+ * company trades as now before the function asks for anything, and the report
379
+ * says so. Without this a function that reads a company's data by symbol
380
+ * answers the old one's dead end: a stale quote, no earnings, or a 13F source
381
+ * that gives up after 20 s. A pane that shows one ticker as Ticker Research
382
+ * does (`isTickerLinkPeer`), and a function that reads each symbol's fate
383
+ * itself (`readsSymbolFate`), refuse such a ticker instead and name the new
384
+ * one; a list longer than a few lookups is read as typed. Null when nothing
385
+ * moved.
386
+ */
387
+ export async function withRenamedTickers(
388
+ context: MarketContext,
389
+ args: ParsedPaneFunctionArgs,
390
+ resolved: Pick<ResolvedPaneFunction, "headless" | "template" | "instance">,
391
+ linkPeer: boolean,
392
+ ): Promise<ParsedPaneFunctionArgs | null> {
393
+ const kind = resolved.headless?.argument.kind ?? resolved.template?.shortcut?.argKind;
394
+ if (linkPeer || resolved.headless?.readsSymbolFate || !args.arg.trim()
395
+ || !(kind === "ticker" || kind === "tickers" || kind === "symbol-list" || kind === "ticker-list")) return null;
396
+ const keys = kind === "ticker" ? [args.arg.trim()] : splitSymbolArgs([args.arg]);
397
+ if (keys.length === 0 || keys.length > MAX_CHOICE_LOOKUPS) return null;
398
+ const moved = await Promise.all(keys.map((key) => {
399
+ if (resolved.headless?.fredSeriesArgument && fredSeriesArgument(key)) return null;
400
+ // One ticker is asked for as the function will ask for it (on its saved venue); a list's by key.
401
+ const { symbol, exchange } = keys.length === 1 && args.listing ? args.listing.request : parsePublicTickerKey(key);
402
+ return movedListing({ symbol, exchange: exchange ?? "" }, context.dataProvider)
403
+ .catch(logFailure("cli.pane-functions-resolver", "Read whether a ticker moved failed", null));
404
+ }));
405
+ if (!moved.some(Boolean)) return null;
406
+ const listings = await Promise.all(keys.map(async (key, index) => {
407
+ const change = moved[index];
408
+ return change ? resolveCliListing(change.tradesAs, undefined, context)
409
+ .catch(logFailure("cli.pane-functions-resolver", "Read a moved ticker's new symbol failed", null)) : null;
410
+ }));
411
+ const read = keys.map((key, index) => listings[index]?.key ?? moved[index]?.tradesAs ?? key);
412
+ // The same company typed twice (SQ,XYZ) is read once.
413
+ const arg = [...new Set(read)].join(", ");
414
+ // One moved ticker is read on its new symbol's listing, or by that symbol alone when it could not be
415
+ // resolved: never on the old symbol's listing under the new symbol.
416
+ const { listing: typed, ...rest } = args;
417
+ const listing = keys.length === 1 ? listings[0] : typed;
418
+ return {
419
+ ...rest,
420
+ arg,
421
+ ...(listing ? { listing } : {}),
422
+ listingNotes: [...args.listingNotes ?? [], ...moved.flatMap((change) => change ? [movedListingNote(change)] : [])],
423
+ };
424
+ }
425
+
426
+ /**
427
+ * The function's code as typed when it is one of the function's codes (`DES`
428
+ * for Ticker Research, whose code is T), else its own: what a command line
429
+ * the report suggests (a renamed ticker's retry) starts with.
430
+ */
431
+ export function typedFunctionCode(typed: string, resolved: Pick<ResolvedPaneFunction, "token" | "template">): string {
432
+ const word = typed.trim().toUpperCase();
433
+ const shortcut = resolved.template?.shortcut;
434
+ const codes = [shortcut?.prefix, ...shortcut?.aliases ?? []].filter((code): code is string => !!code);
435
+ return codes.some((code) => code.toUpperCase() === word) ? word : resolved.token;
436
+ }
437
+
366
438
  /**
367
439
  * A chart's series typed in quotes that is a terminal's code for one listing
368
440
  * (`fn G "VOD LN"`, `"MC FP Equity"`) is that listing, as `quote`, `history`,
@@ -102,6 +102,7 @@ const SHOT_BRIDGE_MARKET_OPERATIONS = new Set([
102
102
  "getSecFilingContent",
103
103
  "getSecFilingDocuments",
104
104
  "getSecFilings",
105
+ "getSecFilingsPage",
105
106
  ]);
106
107
 
107
108
  const SHOT_BRIDGE_HTTP_TIMEOUT_MS = 20_000;
@@ -270,6 +270,7 @@ export function shotSemanticRowCount(
270
270
  ): number {
271
271
  const evidenceHook = paneScreenshotEvidenceHook(resolved);
272
272
  if (evidenceHook) return renderedPaneEvidence(evidenceHook, semanticUi)?.plottedValueCount ?? 0;
273
+ if (resolved.pane?.id === "quick-notes") return semanticUi.filter((node) => node.role === "report-note").length;
273
274
  if (resolved.capability.id === "chart-composer") {
274
275
  const metadata = semanticUi.find((node) => (
275
276
  node.role === "chart-data" && node.metadata?.kind === "chart-composer"