@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
@@ -17,7 +17,7 @@ import { useSearchFocusUp } from "../../../components/input-search-bar";
17
17
  import { useMembersMenu, type MemberList } from "../shared/members-menu";
18
18
  import { cachedChanges, cachedFunds, cachedMembers, cachedStockFunds, loadChanges, loadFunds, loadMembers, loadStockFunds } from "./client";
19
19
  import { canonicalFund, changeColumns, changeLabel, changeReason, coverageText, coveredFund, decimal, DEFAULT_SORT, holdingsBasisText, holdingsCaveats, isTab, memberColumns, memberRows,
20
- membersFeed, membersTitle, noStockFundsMessage, percent, stockFundAsOf, stockFundAsOfFits, stockFundColumns, stockFundRows, TABS, usListingInput,
20
+ membersFeed, membersTitle, noStockFundsMessage, percent, stockFundAsOf, stockFundAsOfFits, stockFundColumns, stockFundRows, stockListingInput, TABS,
21
21
  type MembersTab } from "./model";
22
22
 
23
23
  type ViewProps = Pick<PaneProps, "width" | "height" | "focused"> & { fund: string; active: boolean };
@@ -222,7 +222,7 @@ function StockFunds({ symbol, width, height, focused }: ListProps & { symbol: st
222
222
  if (column.id === "weight") return { text: row.weight == null ? MISSING_VALUE : decimal(row.weight * 100), value: row.weight == null ? null : row.weight * 100 };
223
223
  return { text: stockFundAsOf(row, !stockFundAsOfFits(width)), color: colors.textMuted };
224
224
  }, [colors, width]);
225
- const none = noStockFundsMessage(symbol, "pane");
225
+ const none = noStockFundsMessage(data?.symbol ?? symbol, "pane");
226
226
  return <PaneStatusBody subject="funds holding the stock" loading={!data && resource.loading} error={!data ? resource.error : null}
227
227
  empty={!!data && !data.funds.length} emptyTitle={none.title} emptyMessage={none.message}>
228
228
  {data && !!data.funds.length && <DataTableView<SectionedRow<StockFund>> items={rows} columns={stockFundColumns(width)} rootWidth={width} rootHeight={height} focused={focused}
@@ -232,29 +232,27 @@ function StockFunds({ symbol, width, height, focused }: ListProps & { symbol: st
232
232
  renderCell={renderCell} selectedTextOverridesCellColor emptyStateTitle={none.title} />}
233
233
  </PaneStatusBody>;
234
234
  }
235
- type FundPaneProps = ListProps & { fund: string; requested: string; funds: MemberFundsPayload["funds"] | undefined };
235
+ type FundPaneProps = ListProps & { fund: string; listing: string; funds: MemberFundsPayload["funds"] | undefined };
236
236
  /**
237
237
  * The covered list is the server's, so a fund it adds opens without an app update. A symbol it does not hold is a
238
238
  * stock, and the pane lists the covered funds holding it. A list that cannot be read leaves the fund's own load to
239
239
  * report the failure.
240
240
  */
241
- function CoveredFund({ fund, requested, funds, ...props }: FundPaneProps) {
242
- if (funds?.length && !coveredFund(funds, fund)) {
243
- const symbol = usListingInput(requested);
244
- if (!symbol) return <PaneStatusBody empty emptyTitle={`${requested.toUpperCase()} is not a US listing.`}
245
- emptyMessage="Funds are looked through by US ticker: name the US listing, such as an ADR (INFY, TSM)." />;
246
- return <StockFunds key={symbol} symbol={symbol} {...props} />;
241
+ function CoveredFund({ fund, listing, funds, ...props }: FundPaneProps) {
242
+ if (listing.includes(":") || funds?.length && !coveredFund(funds, fund)) {
243
+ return <StockFunds key={listing} symbol={listing} {...props} />;
247
244
  }
248
245
  return <FundView key={fund} fund={fund} {...props} />;
249
246
  }
250
247
  export function MembersPane(props: PaneProps) {
251
- const { symbol } = usePaneTickerIdentity();
248
+ const { symbol, ticker } = usePaneTickerIdentity();
252
249
  const [chosen, choose] = usePluginPaneState("fund", "");
253
250
  const requested = symbol ?? chosen;
251
+ const listing = stockListingInput(requested, ticker?.metadata.exchange);
254
252
  const fund = canonicalFund(requested);
255
253
  const resource = useAsyncResource(loadFunds, { initialData: cachedFunds });
256
254
  const funds = resource.data?.payload.funds;
257
- usePaneTitle(membersTitle(requested, !!fund && !!funds?.length && !coveredFund(funds, fund)));
255
+ usePaneTitle(listing.includes(":") ? membersTitle(listing, true) : membersTitle(requested, !!fund && !!funds?.length && !coveredFund(funds, fund)));
258
256
  if (!fund) return <FundPicker {...props} choose={choose} />;
259
- return <CoveredFund fund={fund} requested={requested} funds={funds} {...props} />;
257
+ return <CoveredFund fund={fund} listing={listing} funds={funds} {...props} />;
260
258
  }
@@ -32,7 +32,7 @@ export const moneyMarketsHeadless: HeadlessPaneDefinition<"bundle"> = {
32
32
  shape: "bundle", argument: { kind: "none" },
33
33
  freshness: FRED_FRESHNESS,
34
34
  options: [{ key: "tab", type: "enum", description: "Money-market view: US rates, bills or liquidity, or Hong Kong's Exchange Fund Bill yields.",
35
- values: MONEY_MARKET_TABS.map(({ value }) => ({ value })), defaultValue: "rates" }],
35
+ values: MONEY_MARKET_TABS.map(({ value, label }) => ({ value, label })), defaultValue: "rates" }],
36
36
  describe: (args) => isHongKongTab(args.options.tab) ? "Hong Kong money markets" : "US money markets",
37
37
  async load(args, ctx) {
38
38
  const hongKong = isHongKongTab(args.options.tab);
@@ -55,7 +55,11 @@ const defaultDependencies: NewsHeadlessDependencies = {
55
55
  function newsRow(article: NewsArticle) {
56
56
  return {
57
57
  id: article.id,
58
+ // Its first publication; the service's other times for it kept beside it, as sent.
58
59
  publishedAt: article.publishedAt.toISOString(),
60
+ lastPublishedAt: article.times?.lastPublishedAt ?? null,
61
+ firstSeenAt: article.times?.firstSeenAt ?? null,
62
+ lastSeenAt: article.times?.lastSeenAt ?? null,
59
63
  source: article.source,
60
64
  headline: article.title,
61
65
  summary: article.summary ?? null,
@@ -26,6 +26,7 @@ import { createTickerSurfacePaneTemplate } from "../shared/ticker-surface";
26
26
  import { tickerNewsHeadless } from "./headless";
27
27
  import { usePaneTickerIdentity } from "../../../state/hooks/pane-ticker";
28
28
  import { TICKER_NEWS_TAB_ID, TICKER_NEWS_TEMPLATE_ID, tickerNewsQuery, tickerNewsStateKeys } from "./ticker-news";
29
+ import { displayTickerKey } from "../../../utils/exchanges";
29
30
 
30
31
  const DEFAULT_SORT: NewsSortPreference = { columnId: "time", direction: "desc" };
31
32
 
@@ -47,6 +48,7 @@ function TickerNewsView({ width, height, focused }: { width: number; height: num
47
48
  const loaded = usePersistedNewsArticles(
48
49
  `articles:${instrument?.symbol ?? "none"}:${instrument?.exchange ?? ""}`,
49
50
  newsState.articles,
51
+ newsState.phase === "error",
50
52
  );
51
53
  const news = useNewsMuteFilter(loaded, newsMutesApplyToFeed(newsQuery?.feed));
52
54
  const search = useNewsListSearch(news, "ticker-news", symbol);
@@ -124,7 +126,7 @@ function TickerNewsView({ width, height, focused }: { width: number; height: num
124
126
  loadedCount: loaded.length,
125
127
  unmutedCount: news.length,
126
128
  fallback: {
127
- title: `No news for ${ticker.metadata.ticker}`,
129
+ title: `No news for ${displayTickerKey(ticker.metadata.ticker)}`,
128
130
  hint: "Stories appear as sources publish them.",
129
131
  },
130
132
  });
@@ -57,8 +57,9 @@ function useIndustryArticles(entry: NewsIndustryCode | null): IndustryArticles {
57
57
  const topicArticles = usePersistedNewsArticles(
58
58
  `industry:topic:${entry?.topic ?? "none"}:articles`,
59
59
  topicState.articles,
60
+ topicState.phase === "error",
60
61
  );
61
- const allArticles = usePersistedNewsArticles("industry:sector:all:articles", sectorState.articles);
62
+ const allArticles = usePersistedNewsArticles("industry:sector:all:articles", sectorState.articles, sectorState.phase === "error");
62
63
  const sector = entry?.sector;
63
64
  const sectorArticles = useMemo(() => (
64
65
  sector
@@ -164,7 +164,7 @@ export function NewsPresetPane({
164
164
  ? parseNewsFeedSettings(storedFeeds, storedDisabledIds).error
165
165
  : undefined, [query.feed, storedFeeds, storedDisabledIds]);
166
166
  const newsState = useNewsArticles(query);
167
- const persisted = usePersistedNewsArticles(`${paneKey}:articles`, newsState.articles);
167
+ const persisted = usePersistedNewsArticles(`${paneKey}:articles`, newsState.articles, newsState.phase === "error");
168
168
  const articles = useNewsMuteFilter(persisted, newsMutesApplyToFeed(query.feed));
169
169
  const { scrollRef, onBodyScrollActivity } = useNewsTableLoadMore(query, newsState);
170
170
  // The aggregator opens a query in "loading", so the first paint is a loading
@@ -5,6 +5,8 @@ import { usePaneInstance } from "../../../../state/app/context";
5
5
  import type { MarketNewsItem, NewsStoryItem } from "../../../../types/news-source";
6
6
  import { usePluginPaneState } from "../../../runtime";
7
7
  import { usePluginRenderContext } from "../../../runtime/context";
8
+ import { useSavedCopyFooter } from "../../../../components/layout/pane/footer/registration";
9
+ import { retrievedAtOf } from "../../../../data/saved-copies";
8
10
 
9
11
  const MAX_PERSISTED_ARTICLES = 200;
10
12
  const EMPTY_PERSISTED_ARTICLES: PersistedNewsArticle[] = [];
@@ -116,22 +118,24 @@ function serializeArticles(articles: MarketNewsItem[]): PersistedNewsArticle[] {
116
118
 
117
119
  const subscribeToSession = (listener: () => void) => apiClient.subscribeCurrentUser(listener);
118
120
 
119
- export function usePersistedNewsArticles(key: string, articles: MarketNewsItem[]): MarketNewsItem[] {
121
+ export function usePersistedNewsArticles(key: string, articles: MarketNewsItem[], refreshFailed = false): MarketNewsItem[] {
120
122
  const { pluginId, runtime } = usePluginRenderContext();
121
123
  const pane = usePaneInstance();
122
124
  const scope = useSyncExternalStore(subscribeToSession, cloudNewsSnapshotScope, cloudNewsSnapshotScope);
123
125
  const snapshots = runtime.newsPaneSnapshots;
124
126
  const storageKey = `${key}:v2`;
125
127
  const cached = useMemo(() => {
126
- if (articles.length || !pane) return [];
127
- return restoreArticles(snapshots?.read<PersistedNewsArticle>(pane, pluginId, storageKey, scope) ?? []);
128
+ if (articles.length || !pane) return null;
129
+ const saved = snapshots?.read<PersistedNewsArticle>(pane, pluginId, storageKey, scope);
130
+ return saved ? { articles: restoreArticles(saved), fetchedAt: retrievedAtOf(saved) } : null;
128
131
  }, [articles, pane, pluginId, scope, snapshots, storageKey]);
132
+ useSavedCopyFooter(refreshFailed && cached?.articles.length ? cached.fetchedAt : null, false);
129
133
  useEffect(() => {
130
134
  if (articles.length && pane && scope != null) {
131
135
  snapshots?.write(pane, pluginId, storageKey, scope, serializeArticles(articles));
132
136
  }
133
137
  }, [articles, pane, pluginId, scope, snapshots, storageKey]);
134
- return articles.length ? articles : cached;
138
+ return articles.length ? articles : cached?.articles ?? [];
135
139
  }
136
140
 
137
141
  export function usePersistedStory(articles: MarketNewsItem[]): MarketNewsItem[] {
@@ -73,6 +73,13 @@ export const notesHeadless = {
73
73
  { key: "text", header: "Text", textHeader: "First line", shrink: true, textFormat: (value) => firstLine(typeof value === "string" ? value : "") },
74
74
  ],
75
75
  discovery: { screenshotReadiness: "ready" },
76
+ async shotState(_args, load) {
77
+ if (apiClient.getSessionToken()) return {};
78
+ const { rows } = await load();
79
+ return { settings: { localNotesSnapshot: rows.flatMap(({ id, title, updated, text }) =>
80
+ typeof id === "string" && typeof title === "string" && typeof text === "string"
81
+ ? [{ id, title, updatedAt: typeof updated === "string" ? Date.parse(updated) : undefined, text }] : []) } };
82
+ },
76
83
  async load(_args, context) {
77
84
  const { store, offline } = await personalStore(context);
78
85
  const index = [...await store.loadQuickNotesIndex()].sort((a, b) => (b.updatedAt ?? 0) - (a.updatedAt ?? 0));
@@ -32,7 +32,7 @@ export const notesPlugin: GloomPlugin = {
32
32
  // First signed-in launch: the .md files on disk go up, then stay on disk
33
33
  // as the export format. Older cloud copies never overwrite newer files.
34
34
  const migrate = async () => {
35
- if (migrating || !apiClient.isVerified() || notesMigratedAt(ctx.persistence)) return;
35
+ if (ctx.runtime === "command" || migrating || !apiClient.isVerified() || notesMigratedAt(ctx.persistence)) return;
36
36
  const cloud = registry.cloud({ kind: "user" });
37
37
  if (!cloud) return;
38
38
  migrating = true;
@@ -2,6 +2,8 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
2
2
  import { apiClient } from "../../../api-client";
3
3
  import { Box, Text, type InputRenderable, type TextareaRenderable } from "../../../ui";
4
4
  import { useShortcut } from "../../../react/input";
5
+ import { useRemoteUiNode } from "../../../remote/semantic-tree";
6
+ import { usePaneInstance } from "../../../state/app/context";
5
7
  import { isPlainKey } from "../../../utils/keyboard";
6
8
  import type { PaneProps } from "../../../types/plugin";
7
9
  import { colors } from "../../../theme/colors";
@@ -27,7 +29,7 @@ import {
27
29
  resolveNoteConflict,
28
30
  useNoteTeams,
29
31
  } from "./owner";
30
- import { NoteConflictError, type NoteOwner, noteOwnerKey, type NotesStoreRegistry } from "./store";
32
+ import { NoteConflictError, type NoteOwner, noteOwnerKey, type NotesStore, type NotesStoreRegistry } from "./store";
31
33
  import { useSyncedText } from "./text-state";
32
34
 
33
35
  const notesLog = debugLog.createLogger("notes");
@@ -37,11 +39,24 @@ interface OwnedQuickNote extends QuickNoteEntry {
37
39
  owner: NoteOwner;
38
40
  }
39
41
 
42
+ function snapshotStore(notes: Array<QuickNoteEntry & { text: string }>): NotesStore {
43
+ return {
44
+ owner: { kind: "user" }, readOnly: true,
45
+ load: async (id) => notes.find((note) => note.id === id)?.text ?? "",
46
+ loadQuickNotesIndex: async () => notes.map(({ text: _text, ...entry }) => entry),
47
+ list: async () => notes.map(({ id, text, updatedAt }) => ({ key: id, text, updatedAt: updatedAt ?? 0 })),
48
+ quickNoteKey: (id) => id,
49
+ save: async () => {}, delete: async () => {}, saveQuickNotesIndex: async () => {},
50
+ };
51
+ }
52
+
40
53
  export function createQuickNotesPane(registry: NotesStoreRegistry) {
41
54
  return function QuickNotesPane({ focused, width }: PaneProps) {
42
55
  const dialog = useDialog();
43
56
  const { notify } = usePluginAppActions();
44
57
  const teams = useNoteTeams();
58
+ const captured = usePaneInstance()?.settings?.localNotesSnapshot as Array<QuickNoteEntry & { text: string }> | undefined;
59
+ const capturedStore = useMemo(() => captured ? snapshotStore(captured) : null, [captured]);
45
60
  const teamKey = teams.map((team) => team.id).join(",");
46
61
  const owners = useMemo<NoteOwner[]>(
47
62
  () => [{ kind: "user" }, ...teams.map((team) => ({ kind: "team" as const, teamId: team.id }))],
@@ -49,7 +64,7 @@ export function createQuickNotesPane(registry: NotesStoreRegistry) {
49
64
  // eslint-disable-next-line react-hooks/exhaustive-deps
50
65
  [teamKey],
51
66
  );
52
- const storeFor = useCallback((owner: NoteOwner) => registry.forOwner(owner), []);
67
+ const storeFor = useCallback((owner: NoteOwner) => owner.kind === "user" && capturedStore ? capturedStore : registry.forOwner(owner), [capturedStore]);
53
68
  const tabOwner = useCallback((tabId: string | null, list: readonly OwnedQuickNote[]): NoteOwner => (
54
69
  list.find((tab) => tab.id === tabId)?.owner ?? { kind: "user" }
55
70
  ), []);
@@ -72,6 +87,7 @@ export function createQuickNotesPane(registry: NotesStoreRegistry) {
72
87
  const unreadableIndexRef = useRef(new Set<string>());
73
88
  const [indexError, setIndexError] = useState<{ message: string; owners: NoteOwner[] } | null>(null);
74
89
  const activeTab = tabs.find((tab) => tab.id === activeTabId);
90
+ useRemoteUiNode(activeTab && noteText.trim() ? { role: "report-note", label: "Quick note" } : null);
75
91
  // Closing a tab deletes its note, which a teammate's team note refuses.
76
92
  const mayDelete = useCallback((tab: OwnedQuickNote) => (
77
93
  mayDeleteNote(tab, teams, apiClient.getCurrentUser()?.id ?? null)
@@ -13,7 +13,7 @@ import {
13
13
  expiryIsoDate, findListedExpiry, formatDaysToExpiry, daysToExpiry, isLiveOptionExpiry, missingExpiryMessage, missingExpiryText, optionExpiryVenue,
14
14
  readOptionExpiration,
15
15
  } from "../../../utils/option-expiry";
16
- import { canonicalTickerKey } from "../../../utils/exchanges";
16
+ import { canonicalTickerKey, displayTickerKey } from "../../../utils/exchanges";
17
17
  import {
18
18
  COIN_OPTIONS_HINT, coinOptionsAlternativesText, isCoinWithoutOptions, isOptionsUnavailableError, listedOptionsAlternative,
19
19
  optionsUnavailableDetails, optionsUnavailableHint, optionsUnavailableTitle,
@@ -412,9 +412,9 @@ export function OptionsView({ width, height, focused, nestedInTabs = false, ivRa
412
412
  role: "report-failure",
413
413
  label: "Options not served",
414
414
  getMetadata: () => ({
415
- message: optionsUnavailableTitle(effectiveTicker),
415
+ message: optionsUnavailableTitle(effectiveTicker, effectiveExchange),
416
416
  details: isCoinWithoutOptions(effectiveTicker) ? coinOptionsAlternativesText("fn OMON")
417
- : optionsUnavailableDetails(effectiveTicker, (symbol) => `gloom fn OMON ${symbol}`),
417
+ : optionsUnavailableDetails(effectiveTicker, (symbol) => `gloom fn OMON ${symbol}`, effectiveExchange),
418
418
  }),
419
419
  } : null);
420
420
 
@@ -1002,11 +1002,12 @@ export function OptionsView({ width, height, focused, nestedInTabs = false, ivRa
1002
1002
  }
1003
1003
  if (error && !chain && isOptionsUnavailableError(error)) {
1004
1004
  // A future, commodity or FX pair with no chain of its own: the listed fund whose options stand in, and OSA on it.
1005
+ // A listing whose venue lists options (0700 on HKEX): that Gloom does not serve them, and what it does serve.
1005
1006
  const alternative = listedOptionsAlternative(effectiveTicker);
1006
1007
  return (
1007
1008
  <EmptyState
1008
- title={optionsUnavailableTitle(effectiveTicker)}
1009
- hint={optionsUnavailableHint(effectiveTicker)}
1009
+ title={optionsUnavailableTitle(effectiveTicker, effectiveExchange)}
1010
+ hint={optionsUnavailableHint(effectiveTicker, effectiveExchange)}
1010
1011
  actions={alternative ? <>
1011
1012
  <Button label={`${alternative.symbol} options`} onPress={() => createPaneFromTemplate("options-pane", { symbol: alternative.symbol })} />
1012
1013
  <Button label={`OSA ${alternative.symbol}`} onPress={() => createPaneFromTemplate("options-scenario-pane", { symbol: alternative.symbol })} />
@@ -1016,7 +1017,7 @@ export function OptionsView({ width, height, focused, nestedInTabs = false, ivRa
1016
1017
  }
1017
1018
  if (error && !chain) return <EmptyState title="Options chain unavailable." message={error} />;
1018
1019
  if (!chain || expirationDates.length === 0) {
1019
- return <EmptyState title={`No options available for ${effectiveTicker}.`} />;
1020
+ return <EmptyState title={`No options available for ${displayTickerKey(effectiveTicker)}.`} />;
1020
1021
  }
1021
1022
 
1022
1023
  const positionContracts = isOpt && parsed
@@ -83,7 +83,7 @@ function summary(openInterest: OpenInterestPayload, dealer: GammaPayload | null)
83
83
  { label: "Spot", value: spot, formatted: formatPositioningSpot(spot, spotAsOf, venue, spotBasis) },
84
84
  ...(dealer && gammaTimes ? [{ label: "Gamma at", value: dealer.gammaAsOf ?? null, formatted: gammaTimes }]
85
85
  : dealer ? [{ label: "Quotes as of", value: dealer.quotesAsOf, formatted: time(dealer.quotesAsOf) }] : []),
86
- { label: "Open interest as of", value: oiAsOf ?? openInterest.oiDate, formatted: oiAsOf ? `${time(oiAsOf)}, live` : openInterest.oiDate ?? MISSING_VALUE },
86
+ { label: "Open interest as of", value: oiAsOf ?? openInterest.oiDate, formatted: oiAsOf ? time(oiAsOf) : openInterest.oiDate ?? MISSING_VALUE },
87
87
  ...(contract ? [{ label: "Contract", value: contract, formatted: `${contract.size} ${contract.unit}; OI counts ${contract.unit}` }] : []),
88
88
  ...(settles ? [{ label: "Expiries settle", value: settles, formatted: `${settles}, the day each expiry names` }] : []),
89
89
  ];
@@ -130,11 +130,11 @@ export const optionsPositioningHeadless = (initialTab: PositioningTab): Headless
130
130
  "Open interest is about two sessions old; the Expiries heading names its date.",
131
131
  "Dealer gamma assumes dealers are long every call and short every put.",
132
132
  "NDX and RUT index options are not covered; use QQQ and IWM.",
133
- "BTC-USD and ETH-USD are Deribit's options: open interest is live and counted in coins, and expiries settle at 08:00 UTC.",
133
+ "BTC-USD and ETH-USD are Deribit's options: open interest is Deribit's own, dated to the minute, and counted in coins, and expiries settle at 08:00 UTC.",
134
134
  ],
135
135
  },
136
136
  options: [
137
- { key: "tab", type: "enum", values: POSITIONING_TABS.map((tab) => ({ value: tab.value })), defaultValue: initialTab,
137
+ { key: "tab", type: "enum", values: POSITIONING_TABS, defaultValue: initialTab,
138
138
  settingKey: "tab", description: "View the pane opens on: strikes, expiries or gex" },
139
139
  // `--expiration` too, as options and OVDV spell it.
140
140
  { key: "expiry", aliases: ["expiration"], type: "string", settingKey: "expiry", placeholder: OPTION_EXPIRATION_PLACEHOLDER, example: "--expiry 2027-01-15",
@@ -183,7 +183,7 @@ export const optionsPositioningHeadless = (initialTab: PositioningTab): Headless
183
183
  // Each expiry's walls, from the all-expiries gamma; absent from older servers.
184
184
  const expiryWalls = allExpiries instanceof Error ? null : wallsByExpiry(allExpiries);
185
185
  const settles = openInterest.expiries.some((row) => settlementTime(row.expiresAt));
186
- const oiStamp = openInterest.venue && openInterest.oiAsOf ? `${time(openInterest.oiAsOf)}, live` : openInterest.oiDate ?? MISSING_VALUE;
186
+ const oiStamp = openInterest.venue && openInterest.oiAsOf ? time(openInterest.oiAsOf) : openInterest.oiDate ?? MISSING_VALUE;
187
187
  const gammaShown = dealer instanceof Error || !dealer.total ? null : dealer;
188
188
  const scope = dealer instanceof Error ? null : dealer.expiry ? expiryLabel(dealer.expiry) : "all expiries";
189
189
  const walls = gammaShown ? gammaWalls(gammaShown.strikes) : null;
@@ -46,7 +46,9 @@ import { isPlainKey } from "../../../utils/keyboard";
46
46
  import { nextHeaderSort, type SortDirection } from "../../../utils/sort-values";
47
47
  import { useCloudAccessFooter } from "../shared/cloud-upgrade";
48
48
  import { useCloudDisplayScope } from "../../../api-client/plan-access";
49
- import { COIN_OPTIONS_HINT, isCoinWithoutOptions, optionsUnavailableTitle } from "../../../market-data/options-alternatives";
49
+ import {
50
+ COIN_OPTIONS_HINT, isCoinWithoutOptions, optionsUnavailableHint, optionsUnavailableTitle, unservedOptionsVenue,
51
+ } from "../../../market-data/options-alternatives";
50
52
  import {
51
53
  loadGamma,
52
54
  loadOpenInterest,
@@ -199,6 +201,8 @@ export function OptionsPositioningPane(props: PaneProps) {
199
201
  const { symbol } = usePaneTickerIdentity();
200
202
  // A coin nothing lists options on (SOL-USD) says which coins have them, before any request.
201
203
  if (symbol && isCoinWithoutOptions(symbol)) return <EmptyState title={optionsUnavailableTitle(parsePublicTickerKey(symbol).symbol)} hint={COIN_OPTIONS_HINT} />;
204
+ // So does a listing whose venue lists options Gloom does not serve (0700 on HKEX), never "no listed options".
205
+ if (symbol && unservedOptionsVenue(symbol)) return <EmptyState title={optionsUnavailableTitle(symbol)} hint={optionsUnavailableHint(symbol)} />;
202
206
  // A new underlying starts over rather than relabelling the last one's data.
203
207
  return symbol ? <OptionsPositioningView key={symbol} {...props} symbol={symbol} />
204
208
  : <EmptyState title="Choose an option underlying." />;
@@ -326,8 +330,8 @@ function OptionsPositioningView({ width, height, focused, symbol }: PaneProps &
326
330
  ...(savedAt != null ? [savedCopyFooterSegment("saved-copy", savedAt)] : []),
327
331
  ...(accessSegment ? [accessSegment] : []),
328
332
  ...(venue ? [{ id: "venue", parts: [{ text: venue, tone: "muted" as const }] }] : []),
329
- // A venue that publishes open interest live (Deribit) says when it was read.
330
- ...(venue && data?.oiAsOf ? [{ id: "oi-date", parts: [{ text: `OI live ${data.oiAsOf.slice(11, 16)} UTC`, tone: "muted" as const }] }]
333
+ // A venue that publishes open interest by the minute (Deribit) says when it was read.
334
+ ...(venue && data?.oiAsOf ? [{ id: "oi-date", parts: [{ text: `OI as of ${data.oiAsOf.slice(11, 16)} UTC`, tone: "muted" as const }] }]
331
335
  : data?.oiDate ? [{ id: "oi-date", parts: [{ text: `OI as of ${shortDate(data.oiDate)}`, tone: "muted" as const }] }] : []),
332
336
  ...(changes && tab !== "gex" ? [{ id: "oi-change", parts: [{ text: `chg since ${shortDate(data!.previousOiDate!)}`, tone: "muted" as const }] }] : []),
333
337
  ], [accessSegment, changes, data?.oiAsOf, data?.oiDate, data?.previousOiDate, savedAt, tab, venue]);
@@ -18,6 +18,7 @@ import { loadModelDividendYield, type ModelDividendYield } from "../../../market
18
18
  import { abortable, abortError } from "../../../utils/async-deadline";
19
19
  import { extendedSession, modelSpotStamp, modelSpotStampVariants, type OptionModelSpot } from "../options/model-spot";
20
20
  import { errorMessage } from "../../../utils/errors";
21
+ import { optionsUnavailableTitle, unservedOptionsVenue } from "../../../market-data/options-alternatives";
21
22
  import { isTransientFailure } from "../../../api-client/errors";
22
23
  import { isTransientSourceFailure, serviceDidNotAnswerMessage } from "../../../sources/provider-errors";
23
24
  import { DATA_SERVICE_UNREACHABLE_MESSAGE, isNetworkFailure } from "../../../utils/network-failure";
@@ -178,8 +179,8 @@ export async function loadScenarioMarket(
178
179
  }
179
180
  // A read that failed says why: a service that did not answer is asked again, a chain none lists is not.
180
181
  const chainUnavailable = !missingExpiry && (!chain || chainEntry?.error)
181
- ? chainReadFailure(symbol, chainRejection, chainEntry, chain != null) : undefined;
182
- if (chainUnavailable && chainUnavailable !== `No options chain is listed for ${symbol}.`) {
182
+ ? chainReadFailure(symbol, request.instrument.exchange, chainRejection, chainEntry, chain != null) : undefined;
183
+ if (chainUnavailable && chainUnavailable !== noChainListed(symbol, request.instrument.exchange)) {
183
184
  // The router's "No options provider available" of a read that timed out reads as no chain at all.
184
185
  for (let index = warnings.length - 1; index >= 0; index -= 1) if (warnings[index]!.startsWith("Options chain: ")) warnings.splice(index, 1);
185
186
  warnings.push(chainUnavailable);
@@ -215,7 +216,13 @@ export async function loadScenarioMarket(
215
216
  * a chain an earlier read left, which only a failure worth retrying explains.
216
217
  * Undefined when the read did not fail.
217
218
  */
218
- function chainReadFailure(symbol: string, rejection: unknown, entry: QueryEntry<OptionsChain> | null, kept: boolean): string | undefined {
219
+ function chainReadFailure(
220
+ symbol: string,
221
+ exchange: string | undefined,
222
+ rejection: unknown,
223
+ entry: QueryEntry<OptionsChain> | null,
224
+ kept: boolean,
225
+ ): string | undefined {
219
226
  if (rejection === undefined && !entry?.error) return undefined;
220
227
  const what = `the ${symbol} options chain`;
221
228
  const message = rejection !== undefined ? errorMessage(rejection) : entry!.error!.message;
@@ -226,7 +233,16 @@ function chainReadFailure(symbol: string, rejection: unknown, entry: QueryEntry<
226
233
  if (/\btry again\b/i.test(message)) return message;
227
234
  const transient = rejection !== undefined ? isTransientFailure(rejection) || isTransientSourceFailure(rejection) : entryFailedTransiently(entry);
228
235
  if (transient) return serviceDidNotAnswerMessage(what);
229
- return kept ? undefined : `No options chain is listed for ${symbol}.`;
236
+ return kept ? undefined : noChainListed(symbol, exchange);
237
+ }
238
+
239
+ /**
240
+ * What a read that found no chain says: none is listed, or for a listing on a
241
+ * venue abroad that lists options (0700 on HKEX), that Gloom does not serve
242
+ * them, never that none is listed.
243
+ */
244
+ function noChainListed(symbol: string, exchange: string | undefined): string {
245
+ return unservedOptionsVenue(symbol, exchange) ? optionsUnavailableTitle(symbol, exchange) : `No options chain is listed for ${symbol}.`;
230
246
  }
231
247
 
232
248
  /** What a strategy seed says when the market holds no current chain to seed it from. */
@@ -55,7 +55,7 @@ export const optionsScenarioHeadless: HeadlessPaneDefinition<"bundle"> = {
55
55
  + "a call against the shares they cover: net premium, floor, cap and breakevens of the hedged position.",
56
56
  discovery: { screenshotReadiness: "ready", limitations: ["European scenario values do not model early assignment or exercise."] },
57
57
  options: [
58
- { key: "tab", type: "enum", values: ["payoff", "grid", "legs"].map((value) => ({ value })), defaultValue: "payoff",
58
+ { key: "tab", type: "enum", values: [{ value: "payoff" }, { value: "grid", label: "P&L grid" }, { value: "legs" }], defaultValue: "payoff",
59
59
  description: "Initial view", pluginState: { pluginId: "ticker-research", key: "activeTabId" } },
60
60
  { key: "legs", type: "string", description: "Semicolon-separated side,strike,YYYY-MM-DD,signed quantity,entry price per share,IV percent[,multiplier]" },
61
61
  { key: "strategy", type: "enum", values: SCENARIO_STRATEGIES.map((value) => ({ value })),
@@ -1,7 +1,6 @@
1
1
  import { apiClient } from "../../../api-client";
2
2
  import { getSharedMarketDataCoordinator, MarketDataCoordinator, resolveEntryValue } from "../../../market-data/coordinator";
3
- import { fxLegForCurrency } from "../../../market-data/coordinator/fx-legs";
4
- import { dailyFxCloses, FxHistoryError, type FxCloses } from "../../../market-data/fx-closes";
3
+ import { dailyFxCloses, dailyFxLeg, FxHistoryError, type FxCloses } from "../../../market-data/fx-closes";
5
4
  import type { InstrumentRef } from "../../../market-data/request-types";
6
5
  import type { ManualChartResolution } from "../../../time-series/resolution";
7
6
  import type { DataProvider } from "../../../types/data-provider";
@@ -29,7 +28,7 @@ export interface PeBandInputs {
29
28
  historyError: string | null;
30
29
  /** Report dates for US listings; empty for the rest and when the earnings history is unavailable. */
31
30
  reports: ReportDate[];
32
- /** Daily FX closes for each currency a dollar-priced listing reports its EPS in. */
31
+ /** Daily USD legs for the reporting and listing currencies. */
33
32
  fx: Map<string, FxCloses>;
34
33
  /** Why a currency's FX closes are missing; its EPS then stays unconverted. */
35
34
  fxError: string | null;
@@ -62,14 +61,11 @@ async function loadFxCloses(financials: TickerFinancials, client: ReportClient,
62
61
  Promise<{ fx: Map<string, FxCloses>; error: string | null }> {
63
62
  const fx = new Map<string, FxCloses>();
64
63
  const errors: string[] = [];
65
- const rows = [...financials.annualStatements, ...financials.quarterlyStatements];
66
- await Promise.all(epsFxCurrencies(financials).map(async (currency) => {
67
- const leg = fxLegForCurrency(currency)!;
68
- const oldest = rows.filter((row) => row.currency?.trim().toUpperCase() === currency && Number.isFinite(Date.parse(row.date)))
69
- .reduce((min, row) => Math.min(min, Date.parse(row.date)), now.getTime());
64
+ await Promise.all([...epsFxCurrencies(financials, [])].map(async ([currency, since]) => {
65
+ const leg = dailyFxLeg(currency)!;
70
66
  try {
71
67
  const response = await client.getCloudHistory(leg.instrument.symbol, leg.instrument.exchange ?? "", {
72
- interval: "1day", startDate: new Date(oldest - FX_LEAD_DAYS * 86_400_000).toISOString().slice(0, 10),
68
+ interval: "1day", startDate: new Date(Date.parse(since) - FX_LEAD_DAYS * 86_400_000).toISOString().slice(0, 10),
73
69
  endDate: now.toISOString().slice(0, 10), outputsize: FX_MAX_ROWS,
74
70
  }, signal ? { signal } : undefined);
75
71
  fx.set(currency, dailyFxCloses(response, leg, now, FX_MAX_ROWS));
@@ -3,7 +3,7 @@ import { MarketDataCoordinator } from "../../../market-data/coordinator";
3
3
  import type { HeadlessPaneDefinition } from "../../../types/plugin";
4
4
  import { resolveHeadlessInstrument } from "../shared/headless-market-data";
5
5
  import { loadPeBandInputs } from "./client";
6
- import { formatPerShare, fxPairQuote, projectPeBand } from "./model";
6
+ import { formatEpsFx, formatPerShare, projectPeBand } from "./model";
7
7
  import { DAILY_CLOSES } from "../shared/report-freshness";
8
8
 
9
9
  const multiple = (value: unknown) => typeof value === "number" ? `${value.toFixed(1)}x` : MISSING_VALUE;
@@ -15,7 +15,7 @@ export const peBandHeadless: HeadlessPaneDefinition<"bundle"> = {
15
15
  freshness: { ...DAILY_CLOSES, basis: "daily closes and reported EPS" },
16
16
  describe: (args) => `PEB ${args.symbols[0] ?? ""}`,
17
17
  discovery: { screenshotReadiness: "live-dom", limitations: [
18
- "Weekly closes; each EPS figure is priced at the close of the day it became known where daily closes reach. EPS reported in another currency than a dollar price is converted at daily FX closes; other currency pairs are not computed.",
18
+ "Weekly closes; each EPS figure is priced at the close of the day it became known where daily closes reach. EPS is converted to the listing currency at the period-end FX close.",
19
19
  ] },
20
20
  options: [
21
21
  { key: "lookbackYears", type: "integer", minimum: 0, maximum: 30, defaultValue: 10, description: "Years of history; 0 for all on record" },
@@ -29,12 +29,10 @@ export const peBandHeadless: HeadlessPaneDefinition<"bundle"> = {
29
29
  fx: inputs.fx, fxError: inputs.fxError, daily: inputs.daily });
30
30
  const current = model.current;
31
31
  const conversion = model.conversion;
32
- const pairQuote = (rate: number) => {
33
- const quote = fxPairQuote(conversion!.currency, rate);
34
- return `${quote.pair} ${quote.value.toPrecision(5)}`;
35
- };
32
+ const showFx = !!conversion || model.rows.some((row) => row.fx);
33
+ const pairQuote = (from: string, rate: number) => formatEpsFx(from, model.currency!, rate);
36
34
  const reported = current?.step?.eps != null && conversion && current.step.currency === conversion.currency
37
- ? `, from ${conversion.currency} ${amount(current.step.eps)} at ${pairQuote(conversion.latest.rate)} (${conversion.latest.date} close)` : "";
35
+ ? `, from ${conversion.currency} ${amount(current.step.eps)} at ${pairQuote(conversion.currency, conversion.latest.rate)} (${conversion.latest.date} close)` : "";
38
36
  return {
39
37
  sections: [
40
38
  { title: "P/E band", columns: [{ key: "label", header: "" }, { key: "value", header: "Value" }], rows: [
@@ -44,25 +42,25 @@ export const peBandHeadless: HeadlessPaneDefinition<"bundle"> = {
44
42
  { label: "P/E low, median, high", value: model.range ? `${multiple(model.range.min)}, ${multiple(model.range.median)}, ${multiple(model.range.max)}` : MISSING_VALUE },
45
43
  { label: "Price", value: `${amount(current?.price)} ${model.currency ?? ""}`.trim() },
46
44
  { label: "Trailing EPS", value: current?.step
47
- ? `${amount(current.eps)} (${current.step.basis === "annual" ? "FY" : "TTM"} ${current.step.periodEnd})${reported}` : MISSING_VALUE },
45
+ ? `${amount(current.eps)}${conversion ? ` ${model.currency}` : ""} (${current.step.basis === "annual" ? "FY" : "TTM"} ${current.step.periodEnd})${reported}` : MISSING_VALUE },
48
46
  ] },
49
47
  { title: "Price at each multiple", columns: [{ key: "multiple", header: "Multiple", format: multiple }, { key: "price", header: "Price", format: amount }],
50
48
  rows: model.multiples.map((value) => ({ multiple: value, price: current?.eps != null && current.eps > 0 ? value * current.eps : null })) },
51
49
  { title: "Trailing EPS", columns: [{ key: "periodEnd", header: "Period end" }, { key: "basis", header: "Basis" },
52
- { key: "knownAt", header: "Known" }, { key: "eps", header: conversion ? "EPS reported" : "EPS", format: amount },
53
- ...(conversion ? [{ key: "currency", header: "Currency" }, { key: "fx", header: "FX close" }] : []),
50
+ { key: "knownAt", header: "Known" }, { key: "eps", header: showFx ? "EPS reported" : "EPS", format: amount },
51
+ ...(showFx ? [{ key: "currency", header: "Currency" }, { key: "fx", header: "FX close" }] : []),
54
52
  { key: "yoy", header: "YoY", format: percent }, { key: "price", header: "Price", format: amount }, { key: "pe", header: "P/E", format: multiple }],
55
53
  rows: model.rows.map((row) => ({ periodEnd: row.periodEnd, basis: row.basis === "annual" ? "FY" : "TTM",
56
54
  knownAt: row.dated ? row.knownAt.toISOString().slice(0, 10) : "period end", eps: row.eps,
57
- ...(conversion ? { currency: row.currency, fx: row.fx ? `${pairQuote(row.fx.rate)} (${row.fx.date})` : row.currency === model.currency ? "" : MISSING_VALUE } : {}),
55
+ ...(showFx ? { currency: row.currency, fx: row.fx && row.currency ? `${pairQuote(row.currency, row.fx.rate)} (${row.fx.date})` : MISSING_VALUE } : {}),
58
56
  yoy: row.yoy, price: row.price, pe: row.pe })) },
59
57
  ],
60
58
  complete: !inputs.stale && !inputs.error && !inputs.historyError && !model.error,
61
59
  unavailableSymbols: current?.pe != null ? [] : [instrument.symbol],
62
60
  errors: [inputs.error, inputs.historyError, model.error, model.notice].filter((value): value is string => !!value),
63
61
  metadata: { currency: model.currency, lookbackYears,
64
- epsConversion: conversion ? { from: conversion.currency, to: model.currency, usdPerUnit: conversion.latest.rate, latestClose: conversion.latest.date,
65
- basis: "daily FX close on or before each date: a week's bar date for the band, the publication date for each table row, the latest completed close for the current P/E" } : null,
62
+ epsConversion: conversion ? { from: conversion.currency, to: model.currency, rate: conversion.latest.rate, closeDate: conversion.latest.date,
63
+ basis: "daily FX close on or before the EPS period end" } : null,
66
64
  sampleStart: model.sample?.start.toISOString().slice(0, 10) ?? null, sampleWeeks: model.sample?.weeks ?? 0, multiples: model.multiples, undatedEpsPeriods: model.undated, unavailableTtmSums: model.unavailable,
67
65
  stale: inputs.stale, fetchedAt: inputs.fetchedAt, methodology: "docs/research-data.md#pe-band" },
68
66
  };