@gloom-sh/terminal 0.20.11 → 0.20.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (242) hide show
  1. package/package.json +2 -1
  2. package/src/api-client/awards.ts +16 -0
  3. package/src/api-client/central-bank-rates.ts +5 -0
  4. package/src/api-client/data.ts +55 -2
  5. package/src/api-client/index.ts +18 -1
  6. package/src/api-client/request.ts +86 -3
  7. package/src/api-client/socket-connection.ts +12 -1
  8. package/src/api-client/socket.ts +21 -3
  9. package/src/api-client/supply-chain-graph.ts +4 -2
  10. package/src/api-client/supply-chain.ts +8 -0
  11. package/src/api-client/types/econ.ts +10 -7
  12. package/src/api-client/types/filings-and-calls.ts +8 -0
  13. package/src/app/global-shortcuts.ts +2 -1
  14. package/src/app/keybindings/actions.ts +19 -0
  15. package/src/app/pane-runtime/index.tsx +18 -3
  16. package/src/app/pane-runtime/layout-placement.ts +63 -0
  17. package/src/app/pane-runtime/ticker-open-runtime.ts +10 -2
  18. package/src/capabilities/chart-series.ts +4 -1
  19. package/src/cli/board-coins.ts +10 -1
  20. package/src/cli/commands/crypto-hints.ts +3 -2
  21. package/src/cli/commands/fred-series.ts +0 -54
  22. package/src/cli/commands/market.ts +209 -31
  23. package/src/cli/commands/overview.ts +47 -14
  24. package/src/cli/commands/search.ts +37 -8
  25. package/src/cli/commands/ticker.ts +15 -4
  26. package/src/cli/desktop-pane-shot.ts +27 -2
  27. package/src/cli/fx-quote-rate.ts +1 -1
  28. package/src/cli/glossary.ts +14 -5
  29. package/src/cli/history-catalog-series.ts +85 -0
  30. package/src/cli/index.ts +1 -1
  31. package/src/cli/list-progress.ts +45 -0
  32. package/src/cli/listing-arg.ts +71 -7
  33. package/src/cli/name-entries.ts +8 -4
  34. package/src/cli/not-a-ticker.ts +2 -2
  35. package/src/cli/pane-functions/freshness.ts +50 -3
  36. package/src/cli/pane-functions/index.ts +7 -4
  37. package/src/cli/pane-functions/market-session.ts +66 -14
  38. package/src/cli/pane-functions/options.ts +5 -0
  39. package/src/cli/pane-functions/resolver.ts +9 -2
  40. package/src/cli/pane-functions/screenshot-assessment.ts +28 -3
  41. package/src/cli/pane-functions/screenshot-types.ts +6 -0
  42. package/src/cli/quote-answer.ts +49 -10
  43. package/src/cli/quote-list-reads.ts +87 -0
  44. package/src/cli/report-tables.ts +70 -13
  45. package/src/cli/result.ts +24 -2
  46. package/src/cli/symbol-list.ts +31 -4
  47. package/src/cli/terminal-code-hints.ts +83 -0
  48. package/src/cli/ticker-resolution.ts +2 -1
  49. package/src/cli/treasury-yields.ts +5 -0
  50. package/src/components/command-bar/action-runtime.ts +2 -0
  51. package/src/components/command-bar/routing/launch-request.ts +2 -1
  52. package/src/components/command-bar/routing/navigation-state.ts +4 -2
  53. package/src/components/command-bar/workflow/types.ts +6 -0
  54. package/src/components/layout/detached-pane-shell.tsx +3 -0
  55. package/src/components/layout/double-escape-close.ts +34 -3
  56. package/src/components/layout/floating-pane.tsx +10 -4
  57. package/src/components/layout/pane/cycle-order.ts +66 -2
  58. package/src/components/layout/pane/header.tsx +140 -31
  59. package/src/components/layout/pane/sidebar.tsx +13 -5
  60. package/src/components/layout/pane/status-footer.ts +3 -1
  61. package/src/components/layout/shell/drag/runtime.ts +5 -0
  62. package/src/components/layout/shell/index.tsx +25 -0
  63. package/src/components/layout/shell/menu.ts +9 -0
  64. package/src/components/layout/shell/pane/actions.ts +36 -0
  65. package/src/components/layout/shell/pane/management-shortcuts.ts +27 -3
  66. package/src/components/layout/shell/pane-occlusion.ts +40 -0
  67. package/src/components/layout/shell/shortcuts.ts +17 -1
  68. package/src/components/layout/shell/terminal-pointer-runtime.ts +39 -6
  69. package/src/components/layout/shell/window-mode/index.ts +5 -16
  70. package/src/components/layout/shell/window-mode/overlays.tsx +3 -1
  71. package/src/components/market-board/index.tsx +14 -5
  72. package/src/components/metric-treemap/index.tsx +3 -1
  73. package/src/components/ui/button.tsx +48 -4
  74. package/src/components/ui/data-table/opentui/index.tsx +24 -9
  75. package/src/components/ui/data-table/types.ts +7 -0
  76. package/src/components/ui/inline-quick-add.tsx +19 -3
  77. package/src/components/ui/list-view.tsx +11 -5
  78. package/src/components/ui/query-bar.tsx +16 -1
  79. package/src/components/ui/selection-fill.ts +39 -0
  80. package/src/core/state/app/layout-reducer.ts +2 -1
  81. package/src/core/state/app/pane-choices.ts +68 -0
  82. package/src/core/state/app/state.ts +14 -6
  83. package/src/core/state/app/types.ts +8 -0
  84. package/src/layout/pane-manager/dock-tree.ts +19 -0
  85. package/src/layout/pane-manager/index.ts +3 -0
  86. package/src/market-data/market/freshness.ts +33 -0
  87. package/src/market-data/market/status.ts +5 -1
  88. package/src/market-data/quotes/contributions.ts +10 -0
  89. package/src/market-data/quotes/freshness.ts +19 -0
  90. package/src/market-data/quotes/live-valuation.ts +31 -4
  91. package/src/market-data/quotes/resolution.ts +4 -0
  92. package/src/market-data/quotes/time.ts +0 -14
  93. package/src/plugins/builtin/account-management/index.tsx +1 -0
  94. package/src/plugins/builtin/awards/detail.tsx +12 -4
  95. package/src/plugins/builtin/awards/headless.ts +29 -8
  96. package/src/plugins/builtin/awards/model.ts +36 -2
  97. package/src/plugins/builtin/awards/pane.tsx +7 -4
  98. package/src/plugins/builtin/broker-manager/index.tsx +1 -0
  99. package/src/plugins/builtin/broker-trading/index.tsx +1 -1
  100. package/src/plugins/builtin/central-bank-rates/headless.ts +6 -6
  101. package/src/plugins/builtin/central-bank-rates/index.tsx +1 -1
  102. package/src/plugins/builtin/central-bank-rates/model.ts +21 -3
  103. package/src/plugins/builtin/central-bank-rates/pane.tsx +15 -5
  104. package/src/plugins/builtin/chart-composer/headless.ts +5 -1
  105. package/src/plugins/builtin/chart-composer/pane.tsx +1 -0
  106. package/src/plugins/builtin/chat/content/handle-prompt.tsx +4 -0
  107. package/src/plugins/builtin/chat/controller/realtime.ts +17 -1
  108. package/src/plugins/builtin/chat/message/terminal.tsx +4 -1
  109. package/src/plugins/builtin/chat/sidebar.tsx +3 -4
  110. package/src/plugins/builtin/cloud/askg/pane.tsx +4 -0
  111. package/src/plugins/builtin/cloud/plugin.tsx +1 -0
  112. package/src/plugins/builtin/cloud/team/module.tsx +1 -0
  113. package/src/plugins/builtin/cloud/thesis/detail.tsx +9 -4
  114. package/src/plugins/builtin/commodity-balances/pane.tsx +13 -5
  115. package/src/plugins/builtin/company-kpis/model.ts +3 -3
  116. package/src/plugins/builtin/connections/index.ts +1 -0
  117. package/src/plugins/builtin/credit-boards/cdx-pane.tsx +9 -5
  118. package/src/plugins/builtin/credit-boards/client.ts +5 -0
  119. package/src/plugins/builtin/credit-boards/headless.ts +1 -6
  120. package/src/plugins/builtin/credit-boards/model.ts +0 -6
  121. package/src/plugins/builtin/credit-boards/series.ts +19 -8
  122. package/src/plugins/builtin/credit-boards/sovr-pane.tsx +9 -5
  123. package/src/plugins/builtin/crypto-etf-flows/headless.ts +23 -13
  124. package/src/plugins/builtin/crypto-etf-flows/pane.tsx +8 -3
  125. package/src/plugins/builtin/debt-maturities/headless.ts +16 -7
  126. package/src/plugins/builtin/debt-maturities/model.ts +9 -15
  127. package/src/plugins/builtin/debt-maturities/pane.tsx +9 -10
  128. package/src/plugins/builtin/earnings/board-model.ts +33 -4
  129. package/src/plugins/builtin/earnings/board.tsx +15 -3
  130. package/src/plugins/builtin/earnings/calendar.tsx +10 -6
  131. package/src/plugins/builtin/earnings/client.ts +0 -9
  132. package/src/plugins/builtin/earnings/headless.ts +10 -7
  133. package/src/plugins/builtin/earnings/history.tsx +21 -14
  134. package/src/plugins/builtin/earnings-calls/data.ts +24 -4
  135. package/src/plugins/builtin/earnings-calls/format.ts +23 -5
  136. package/src/plugins/builtin/earnings-calls/headless.ts +23 -3
  137. package/src/plugins/builtin/earnings-calls/index.tsx +1 -0
  138. package/src/plugins/builtin/earnings-calls/model.ts +11 -1
  139. package/src/plugins/builtin/earnings-calls/pane.tsx +2 -5
  140. package/src/plugins/builtin/econ/calendar-model.ts +27 -0
  141. package/src/plugins/builtin/econ/fred-catalog.ts +3 -0
  142. package/src/plugins/builtin/econ/index.tsx +9 -2
  143. package/src/plugins/builtin/econ-statistics/headless.ts +3 -1
  144. package/src/plugins/builtin/econ-statistics/index.tsx +1 -1
  145. package/src/plugins/builtin/fear-greed/headless.ts +16 -13
  146. package/src/plugins/builtin/fear-greed/pane.tsx +12 -4
  147. package/src/plugins/builtin/filing-events/index.tsx +1 -0
  148. package/src/plugins/builtin/fx-matrix/index.tsx +30 -19
  149. package/src/plugins/builtin/insider/table.tsx +10 -7
  150. package/src/plugins/builtin/insider/tickers.tsx +1 -1
  151. package/src/plugins/builtin/iv-history/headless.ts +9 -8
  152. package/src/plugins/builtin/jobs/index.tsx +1 -0
  153. package/src/plugins/builtin/macro-day/headless.ts +3 -3
  154. package/src/plugins/builtin/macro-day/model.ts +1 -1
  155. package/src/plugins/builtin/macro-day/releases.ts +25 -16
  156. package/src/plugins/builtin/market-movers/index.tsx +20 -8
  157. package/src/plugins/builtin/market-movers/model.ts +5 -0
  158. package/src/plugins/builtin/market-movers/session-body.tsx +2 -1
  159. package/src/plugins/builtin/money-markets/headless.ts +12 -2
  160. package/src/plugins/builtin/money-markets/pane.tsx +10 -1
  161. package/src/plugins/builtin/options/view.tsx +1 -0
  162. package/src/plugins/builtin/options-positioning/pane.tsx +1 -1
  163. package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +4 -31
  164. package/src/plugins/builtin/portfolio-list/pane/index.tsx +6 -1
  165. package/src/plugins/builtin/portfolio-list/quick-add/index.tsx +22 -8
  166. package/src/plugins/builtin/portfolio-list/summary/index.tsx +6 -8
  167. package/src/plugins/builtin/portfolio-list/table.tsx +10 -1
  168. package/src/plugins/builtin/realized-vol/headless.ts +28 -2
  169. package/src/plugins/builtin/risk-factors/index.tsx +1 -0
  170. package/src/plugins/builtin/shared/source-footer.ts +70 -0
  171. package/src/plugins/builtin/short-interest/publications-pane.tsx +5 -1
  172. package/src/plugins/builtin/short-volume/pane.tsx +5 -1
  173. package/src/plugins/builtin/social-mentions/outliers.tsx +10 -1
  174. package/src/plugins/builtin/social-mentions/pane.tsx +7 -0
  175. package/src/plugins/builtin/supply-chain/client.ts +3 -1
  176. package/src/plugins/builtin/supply-chain/flow.tsx +25 -8
  177. package/src/plugins/builtin/supply-chain/graph-client.ts +1 -1
  178. package/src/plugins/builtin/supply-chain/graph-evidence.ts +1 -1
  179. package/src/plugins/builtin/supply-chain/graph-model.ts +12 -1
  180. package/src/plugins/builtin/supply-chain/graph-pane.tsx +9 -8
  181. package/src/plugins/builtin/supply-chain/graph.tsx +12 -6
  182. package/src/plugins/builtin/supply-chain/headless.ts +13 -7
  183. package/src/plugins/builtin/supply-chain/model.ts +68 -11
  184. package/src/plugins/builtin/supply-chain/pane.tsx +9 -6
  185. package/src/plugins/builtin/supply-chain/row-evidence.tsx +5 -5
  186. package/src/plugins/builtin/ticker-detail/overview/components.tsx +14 -1
  187. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +2 -0
  188. package/src/plugins/builtin/ticker-detail/pane.tsx +48 -24
  189. package/src/plugins/builtin/ticker-detail/quote-footer.ts +5 -0
  190. package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +6 -3
  191. package/src/plugins/builtin/treasury-auctions/after.ts +50 -23
  192. package/src/plugins/builtin/treasury-auctions/cache.ts +23 -5
  193. package/src/plugins/builtin/treasury-auctions/headless.ts +226 -37
  194. package/src/plugins/builtin/treasury-auctions/hk-headless.ts +11 -5
  195. package/src/plugins/builtin/treasury-auctions/hk-view.tsx +27 -25
  196. package/src/plugins/builtin/treasury-auctions/hk.ts +60 -8
  197. package/src/plugins/builtin/treasury-auctions/index.tsx +3 -0
  198. package/src/plugins/builtin/treasury-auctions/keys.ts +27 -0
  199. package/src/plugins/builtin/treasury-auctions/like.ts +137 -0
  200. package/src/plugins/builtin/treasury-auctions/model.ts +100 -22
  201. package/src/plugins/builtin/treasury-auctions/pane.tsx +39 -11
  202. package/src/plugins/builtin/vol-surface/heat-grid.tsx +4 -2
  203. package/src/plugins/builtin/vol-surface/pane.tsx +5 -2
  204. package/src/plugins/runtime/index.tsx +1 -0
  205. package/src/plugins/runtime/state.ts +20 -0
  206. package/src/portfolio/column-values.ts +8 -2
  207. package/src/public/__snapshots__/public-api.test.ts.snap +5 -0
  208. package/src/public/react.ts +7 -0
  209. package/src/react/auto-refresh.ts +29 -0
  210. package/src/renderers/browser/deeplink-bridge.ts +24 -3
  211. package/src/renderers/dom/desktop/query-bar.tsx +229 -60
  212. package/src/renderers/dom/host/overflow-fade-px.ts +2 -0
  213. package/src/renderers/dom/host/overflow-fade.ts +1 -2
  214. package/src/renderers/dom/styles.css +25 -5
  215. package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +2 -1
  216. package/src/series/types.ts +2 -0
  217. package/src/sources/gloomberb-cloud/fred-attribution.ts +86 -0
  218. package/src/sources/gloomberb-cloud/index.ts +25 -1
  219. package/src/sources/gloomberb-cloud/normalizers.ts +22 -3
  220. package/src/sources/provider-errors.ts +64 -1
  221. package/src/sources/provider-router/batches.ts +19 -0
  222. package/src/sources/provider-router/index.ts +7 -1
  223. package/src/state/app/context/index.tsx +24 -1
  224. package/src/state/pane-unsent-work.ts +47 -0
  225. package/src/test-support/shell-pane-keys.tsx +5 -0
  226. package/src/test-support/telemetry-guard.ts +83 -0
  227. package/src/test-support/test-env.ts +12 -0
  228. package/src/theme/colors.ts +17 -1
  229. package/src/theme/ui-tokens.ts +50 -1
  230. package/src/tickers/listing-venues.ts +11 -1
  231. package/src/tickers/search/japanese-names.json +1 -0
  232. package/src/tickers/search/japanese-names.ts +152 -0
  233. package/src/tickers/terminal-codes.ts +55 -6
  234. package/src/time-series/base-series.ts +3 -0
  235. package/src/types/data-provider.ts +6 -0
  236. package/src/types/financials.ts +11 -0
  237. package/src/types/plugin-contributions.ts +7 -0
  238. package/src/types/plugin-panes.ts +7 -0
  239. package/src/ui/host.tsx +6 -0
  240. package/src/utils/double-escape-close.ts +42 -0
  241. package/src/utils/fx-status.ts +30 -7
  242. package/src/utils/network-failure.ts +23 -0
@@ -15,6 +15,7 @@ import {
15
15
  usePaneStateValue,
16
16
  usePaneTicker,
17
17
  usePaneAppConfig,
18
+ usePaneChoice,
18
19
  type AppState,
19
20
  } from "../../../state/app/context";
20
21
  import { useQuoteUpdates } from "../../../state/hooks/quote-streaming";
@@ -34,7 +35,8 @@ import { findTickerResearchGroup, groupTickerResearchTabs, tickerResearchGroupVi
34
35
  import { isRecord } from "../../../utils/guards";
35
36
  import { useLiveStreamingSetting } from "../../../state/hooks/live-streaming";
36
37
  import { useCloudAccessFooter } from "../shared/cloud-upgrade";
37
- import { CLOUD_QUOTE_DELAY_MINUTES } from "../../../api-client/plan-access";
38
+ import { CLOUD_QUOTE_DELAY_MINUTES, usePlanAccess } from "../../../api-client/plan-access";
39
+ import { shownPaneChoice } from "../../../core/state/app/pane-choices";
38
40
  import { parsePublicTickerKey, publicTickerKey } from "../../../utils/exchanges";
39
41
  import { captureAttentionAction } from "../../../telemetry/attention-counts";
40
42
  import { tickerHasListingSuffix } from "../../../sources/listing-symbols";
@@ -42,6 +44,7 @@ import { tickerQuoteFooterInfo } from "./quote-footer";
42
44
  import { ResearchTabKeysProvider, useResearchTabKeysHost } from "./research-tab-keys";
43
45
  import { ResearchTabNavigationProvider } from "./research-tab-navigation";
44
46
  import { usePluginAppActions } from "../../../public/react";
47
+ import { useUtcDay } from "../../../react/auto-refresh";
45
48
  import { resolveTickerInstrumentKind } from "../../../tickers/instrument-kind";
46
49
  import { ResearchTradeWorkspace } from "../broker-trading/dock";
47
50
 
@@ -192,25 +195,9 @@ export function TickerResearchPane({ focused, width, height }: PaneProps) {
192
195
  TICKER_RESEARCH_TAB_COMMIT_DELAY_MS,
193
196
  { commitPendingOnUnmount: true },
194
197
  );
195
- useEffect(() => {
196
- if (!focused || !ticker || getCurrentPluginTarget() !== "web") return;
197
- const url = new URL(window.location.href);
198
- if (ticker.metadata.broker_contracts?.length) {
199
- for (const key of ["ticker", "exchange", "tab"]) url.searchParams.delete(key);
200
- window.history.replaceState(window.history.state, "", url.href);
201
- return;
202
- }
203
- url.searchParams.set("ticker", ticker.metadata.ticker);
204
- // A bare ticker can name different issuers on different venues. Keep the
205
- // selected listing on reload, and replace any previous pane's venue.
206
- if (ticker.metadata.exchange && !parsePublicTickerKey(ticker.metadata.ticker).exchange && !tickerHasListingSuffix(ticker.metadata.ticker)) {
207
- url.searchParams.set("exchange", ticker.metadata.exchange);
208
- } else {
209
- url.searchParams.delete("exchange");
210
- }
211
- url.searchParams.set("tab", activeTabId);
212
- window.history.replaceState(window.history.state, "", url.href);
213
- }, [focused, ticker?.metadata.ticker, ticker?.metadata.exchange, activeTabId, ticker?.metadata.broker_contracts]);
198
+ // A tab picked in this session, by any route, as opposed to restored with the workspace.
199
+ const [tabChosen, chooseTab] = usePaneChoice("activeTabId");
200
+ const access = usePlanAccess();
214
201
  const [pluginCaptured, setPluginCaptured] = useState(false);
215
202
  useEffect(() => {
216
203
  if (focused && Number.isFinite(financials?.quote?.price) && (financials?.quote?.price ?? 0) > 0) {
@@ -240,9 +227,41 @@ export function TickerResearchPane({ focused, width, height }: PaneProps) {
240
227
  config,
241
228
  hasOptionsChain,
242
229
  });
230
+ const savedTabId = allTabs.some((tab) => tab.id === activeTabId) ? activeTabId : (allTabs[0]?.id ?? "overview");
231
+ const proOnlyTabIds = useMemo(
232
+ () => new Set(tickerResearchTabs.filter((tab) => tab.proOnly).map((tab) => tab.id)),
233
+ [tickerResearchTabs],
234
+ );
235
+ // A Pro-only tab restored for an account without Pro opens on the first
236
+ // free tab (Overview); its wall shows once the tab is picked.
243
237
  const resolvedTabId = paneSettings.hideTabs
244
238
  ? resolveLockedTabId(paneSettings, allTabs)
245
- : (allTabs.some((tab) => tab.id === activeTabId) ? activeTabId : (allTabs[0]?.id ?? "overview"));
239
+ : shownPaneChoice(savedTabId, {
240
+ chosen: tabChosen || activeTabId !== committedActiveTabId,
241
+ hasProAccess: access.hasProAccess,
242
+ proOnly: (tabId) => proOnlyTabIds.has(tabId),
243
+ fallback: allTabs.find((tab) => !proOnlyTabIds.has(tab.id))?.id ?? savedTabId,
244
+ });
245
+ // The address names the tab on screen, so a copied link opens what was seen.
246
+ useEffect(() => {
247
+ if (!focused || !ticker || getCurrentPluginTarget() !== "web") return;
248
+ const url = new URL(window.location.href);
249
+ if (ticker.metadata.broker_contracts?.length) {
250
+ for (const key of ["ticker", "exchange", "tab"]) url.searchParams.delete(key);
251
+ window.history.replaceState(window.history.state, "", url.href);
252
+ return;
253
+ }
254
+ url.searchParams.set("ticker", ticker.metadata.ticker);
255
+ // A bare ticker can name different issuers on different venues. Keep the
256
+ // selected listing on reload, and replace any previous pane's venue.
257
+ if (ticker.metadata.exchange && !parsePublicTickerKey(ticker.metadata.ticker).exchange && !tickerHasListingSuffix(ticker.metadata.ticker)) {
258
+ url.searchParams.set("exchange", ticker.metadata.exchange);
259
+ } else {
260
+ url.searchParams.delete("exchange");
261
+ }
262
+ url.searchParams.set("tab", resolvedTabId);
263
+ window.history.replaceState(window.history.state, "", url.href);
264
+ }, [focused, ticker?.metadata.ticker, ticker?.metadata.exchange, resolvedTabId, ticker?.metadata.broker_contracts]);
246
265
  // Only quote/chart views use the parent quote status. Other research tabs
247
266
  // own their data status (the options chain may have a different delay/feed).
248
267
  const quoteFooterActive = resolvedTabId === "overview" || resolvedTabId === "chart";
@@ -255,6 +274,8 @@ export function TickerResearchPane({ focused, width, height }: PaneProps) {
255
274
  segmentId: "ticker-research-access",
256
275
  shortcutScope: "ticker-research:upgrade",
257
276
  });
277
+ // The quote's time of today drops its day; the next day the footer names it.
278
+ const utcDay = useUtcDay();
258
279
  usePaneFooter(
259
280
  "ticker-research-access",
260
281
  () => quoteFooterActive ? {
@@ -263,7 +284,7 @@ export function TickerResearchPane({ focused, width, height }: PaneProps) {
263
284
  hints: cloudAccess.hint ? [cloudAccess.hint] : undefined,
264
285
  order: -1,
265
286
  } : null,
266
- [cloudAccess.hint, cloudAccess.segment, financials?.quote, quoteFooterActive, resolvedTabId, width],
287
+ [cloudAccess.hint, cloudAccess.segment, financials?.quote, quoteFooterActive, resolvedTabId, utcDay, width],
267
288
  );
268
289
 
269
290
  const visibleTabIdKey = allTabs.map((tab) => tab.id).join("\0");
@@ -276,8 +297,9 @@ export function TickerResearchPane({ focused, width, height }: PaneProps) {
276
297
  if (!requestedTabId || !requestedTabAt || requestedTabAt === consumedTabAt) return;
277
298
  if (!allTabs.some((tab) => tab.id === requestedTabId)) return;
278
299
  setConsumedTabAt(requestedTabAt);
300
+ chooseTab();
279
301
  setActiveTabId(requestedTabId);
280
- }, [consumedTabAt, requestedTabAt, requestedTabId, setActiveTabId, setConsumedTabAt, visibleTabIdKey]);
302
+ }, [chooseTab, consumedTabAt, requestedTabAt, requestedTabId, setActiveTabId, setConsumedTabAt, visibleTabIdKey]);
281
303
  // A quote tick re-renders this pane; the strips only have to re-render
282
304
  // when a tab appears, disappears, or is renamed.
283
305
  const tabItemsKey = allTabs.map((tab) => `${tab.id}:${tab.name}:${tab.order}`).join("\0");
@@ -309,8 +331,10 @@ export function TickerResearchPane({ focused, width, height }: PaneProps) {
309
331
  const action = tabId === "chart" ? "chart" : tabId === "options" ? "option_chain" : null;
310
332
  if (action) captureAttentionAction()(publicTickerKey(ticker.metadata.ticker, ticker.metadata.exchange), action);
311
333
  }
334
+ // Picking the tab the pane has saved changes no value, so say it was picked.
335
+ if (!tabChosen) chooseTab();
312
336
  setActiveTabId(tabId);
313
- }, [resolvedTabId, setActiveTabId, ticker]);
337
+ }, [chooseTab, resolvedTabId, setActiveTabId, tabChosen, ticker]);
314
338
  // A group opens on the view last chosen in it, as Fixed Income's sections do.
315
339
  const selectResearchGroup = useCallback((groupId: string) => {
316
340
  const group = groups.find((entry) => entry.id === groupId);
@@ -6,6 +6,7 @@ import { formatQuoteNavAsOf } from "../../../market-data/quotes/time";
6
6
  import { delistingLabel } from "../../../market-data/quotes/delisting";
7
7
  import type { Quote } from "../../../types/financials";
8
8
  import { displayWidth } from "../../../utils/format";
9
+ import { quoteSourceFooterSegment } from "../shared/source-footer";
9
10
 
10
11
  export function tickerQuoteFooterInfo(
11
12
  quote: Quote | undefined,
@@ -42,6 +43,10 @@ export function tickerQuoteFooterInfo(
42
43
  info.push(status);
43
44
  } else if (navAsOf) {
44
45
  info.push({ id: "ticker-research-nav", parts: [{ text: navAsOf, tone: "muted" }] });
46
+ } else if (quote) {
47
+ // Where the quote is from and when, as `quote` ends; the access clock beside it says how late the feed is.
48
+ const source = quoteSourceFooterSegment([quote], { id: "ticker-research-source" });
49
+ if (source) info.push(source);
45
50
  }
46
51
  if (access) info.push(access);
47
52
  return info;
@@ -23,6 +23,7 @@ import { isQuoteStaleForCurrentSession } from "../../../../market-data/quotes/fr
23
23
  import { delistingLabel, delistingStateLabel } from "../../../../market-data/quotes/delisting";
24
24
  import { formatQuoteNavAsOf, formatQuoteSessionAsOf } from "../../../../market-data/quotes/time";
25
25
  import { ClippedText } from "../../../../components/ui/display";
26
+ import { useSelectionFill } from "../../../../components/ui/selection-fill";
26
27
  import { useQuoteFlashDirection } from "../../../../components/quote-flash";
27
28
  import { followLiveSparklinePrice } from "../../../../components/price-sparkline/model";
28
29
  import {
@@ -163,6 +164,7 @@ export function QuoteMonitorCard({
163
164
  onOpen: (symbol: string) => void;
164
165
  }) {
165
166
  const { nativePaneChrome, cellWidthPx = 8 } = useUiCapabilities();
167
+ const selectionFill = useSelectionFill();
166
168
  const quote = resolveEntryData(quoteEntry) ?? cachedFinancials?.quote;
167
169
  const queriedPriceHistory = resolveEntryData(chartEntry);
168
170
  const barHistory = queriedPriceHistory && queriedPriceHistory.length >= 2
@@ -251,9 +253,10 @@ export function QuoteMonitorCard({
251
253
  onSelect,
252
254
  onActivate: onOpen,
253
255
  });
254
- // The terminal marks the cursor on the symbol; the desktop rings the card.
255
- const symbolFg = selected && !nativePaneChrome ? colors.selectedText : colors.textBright;
256
- const symbolBg = selected && !nativePaneChrome ? colors.selected : undefined;
256
+ // The terminal marks the cursor on the symbol, quieter while the board does
257
+ // not have the keys; the desktop rings the card.
258
+ const symbolFg = selected && !nativePaneChrome && selectionFill.lit ? colors.selectedText : colors.textBright;
259
+ const symbolBg = selected && !nativePaneChrome ? selectionFill.bg : undefined;
257
260
 
258
261
  return (
259
262
  <Box
@@ -3,7 +3,9 @@ import type { CloudCurveHistory, CloudCurveId } from "../../../api-client/yield-
3
3
  import { createTtlCache } from "../../../data/ttl-cache";
4
4
  import { toBasisPoints } from "../../../utils/basis-points";
5
5
  import { AUCTION_HISTORY_ALL, type AuctionHistoryWindow } from "./client";
6
- import { AUCTION_HISTORY_WINDOWS, auctionBenchmark, dealerPct, indirectPct, isPendingAuction, nextAuctionHistoryWindow } from "./model";
6
+ import {
7
+ AUCTION_HISTORY_WINDOWS, auctionBenchmark, dealerPct, indirectPct, isPendingAuction, nextAuctionHistoryWindow, publishesMedian, stopOutVsAvgBp,
8
+ } from "./model";
7
9
  import type { TreasuryAuction } from "./types";
8
10
 
9
11
  /**
@@ -11,11 +13,13 @@ import type { TreasuryAuction } from "./types";
11
13
  * ranked against its tenor's own recent history, and what the matching
12
14
  * constant-maturity yield did after it.
13
15
  *
14
- * - B/C, indirect and dealer share are each a percentile against the tenor's
15
- * previous 24 auctions with that figure: the share of them below it, half
16
- * the ones equal. A tenor is the security type and the benchmark it was sold
17
- * as (the 10-year note and its 9-Year 10-Month reopenings are one; a 10-year
18
- * TIPS is another). Fewer than 12 earlier auctions rank nothing.
16
+ * - Stop-out vs median, B/C, indirect and dealer share are each a percentile
17
+ * against the tenor's previous 24 auctions with that figure: the share of
18
+ * them below it, half the ones equal. A tenor is the security type and the
19
+ * benchmark it was sold as (the 10-year note and its 9-Year 10-Month
20
+ * reopenings are one; a 10-year TIPS is another). Fewer than 12 earlier
21
+ * auctions rank nothing. The stop-out ranks only against auctions on the
22
+ * same footing: the median from November 1998, the average before.
19
23
  * - The yield change is the Treasury par (CMT) yield of the auction's tenor,
20
24
  * or the TIPS real yield for a TIPS, from the auction day's close to the
21
25
  * close 1, 5 and 20 sessions later, in basis points. An FRN floats and has
@@ -29,9 +33,12 @@ const PERCENTILE_LOOKBACK = 24;
29
33
  const PERCENTILE_MIN = 12;
30
34
 
31
35
  export interface AuctionAfter {
36
+ stopOutPercentile: number | null;
32
37
  btcPercentile: number | null;
33
38
  indirectPercentile: number | null;
34
39
  dealerPercentile: number | null;
40
+ /** The moves left blank because their later close falls after the day a backtest is as of (`--like`'s asked date). */
41
+ afterAskedDate?: Array<"after1d" | "after5d" | "after20d">;
35
42
  /** The CMT yield's change, bp, 1, 5 and 20 sessions after the auction day's close. */
36
43
  after1d: number | null;
37
44
  after5d: number | null;
@@ -98,11 +105,11 @@ export function widerAfterWindow(
98
105
  }
99
106
 
100
107
  const NO_AFTER: AuctionAfter = {
101
- btcPercentile: null, indirectPercentile: null, dealerPercentile: null, after1d: null, after5d: null, after20d: null, cmt: null,
108
+ stopOutPercentile: null, btcPercentile: null, indirectPercentile: null, dealerPercentile: null, after1d: null, after5d: null, after20d: null, cmt: null,
102
109
  };
103
110
 
104
111
  /** The tenor an auction ranks within: its type and the benchmark it was sold as. */
105
- function auctionTenorKey(auction: TreasuryAuction): string | null {
112
+ export function auctionTenorKey(auction: TreasuryAuction): string | null {
106
113
  const benchmark = auctionBenchmark(auction.securityTerm);
107
114
  return benchmark ? `${auction.secType}|${benchmark.count}${benchmark.unit}` : null;
108
115
  }
@@ -116,36 +123,41 @@ function percentileOf(value: number, history: readonly number[]): number | null
116
123
  }
117
124
 
118
125
  type Metric = (auction: TreasuryAuction) => number | null;
119
- const METRICS: ReadonlyArray<[keyof Pick<AuctionAfter, "btcPercentile" | "indirectPercentile" | "dealerPercentile">, Metric]> = [
126
+ type PercentileKey = "stopOutPercentile" | "btcPercentile" | "indirectPercentile" | "dealerPercentile";
127
+ export type AuctionPercentiles = Pick<AuctionAfter, PercentileKey>;
128
+ /** Each figure ranked, and whether an earlier auction's figure is on the same footing as this one's. */
129
+ const METRICS: ReadonlyArray<[PercentileKey, Metric, ((auction: TreasuryAuction, past: TreasuryAuction) => boolean)?]> = [
130
+ ["stopOutPercentile", stopOutVsAvgBp, (auction, past) => publishesMedian(auction) === publishesMedian(past)],
120
131
  ["btcPercentile", (auction) => auction.bidToCoverRatio],
121
132
  ["indirectPercentile", indirectPct],
122
133
  ["dealerPercentile", dealerPct],
123
134
  ];
124
135
 
125
136
  /** Each completed auction's percentiles, by id, against the auctions of its tenor before it in `auctions`. */
126
- export function auctionPercentiles(auctions: readonly TreasuryAuction[]): Map<string, Pick<AuctionAfter, "btcPercentile" | "indirectPercentile" | "dealerPercentile">> {
137
+ export function auctionPercentiles(auctions: readonly TreasuryAuction[]): Map<string, AuctionPercentiles> {
127
138
  const byTenor = new Map<string, TreasuryAuction[]>();
128
139
  for (const auction of auctions) {
129
140
  const key = auctionTenorKey(auction);
130
141
  if (!key || isPendingAuction(auction)) continue;
131
142
  byTenor.set(key, [...byTenor.get(key) ?? [], auction]);
132
143
  }
133
- const ranked = new Map<string, Pick<AuctionAfter, "btcPercentile" | "indirectPercentile" | "dealerPercentile">>();
144
+ const ranked = new Map<string, AuctionPercentiles>();
134
145
  for (const group of byTenor.values()) {
135
146
  group.sort((left, right) => left.auctionDate.localeCompare(right.auctionDate) || left.id.localeCompare(right.id));
136
147
  group.forEach((auction, index) => {
137
- const entry = { btcPercentile: null, indirectPercentile: null, dealerPercentile: null } as Record<string, number | null>;
138
- for (const [key, metric] of METRICS) {
148
+ const entry: AuctionPercentiles = { stopOutPercentile: null, btcPercentile: null, indirectPercentile: null, dealerPercentile: null };
149
+ for (const [key, metric, comparable] of METRICS) {
139
150
  const value = metric(auction);
140
151
  if (value == null) continue;
141
152
  const history: number[] = [];
142
153
  for (let earlier = index - 1; earlier >= 0 && history.length < PERCENTILE_LOOKBACK; earlier--) {
154
+ if (comparable && !comparable(auction, group[earlier]!)) continue;
143
155
  const past = metric(group[earlier]!);
144
156
  if (past != null) history.push(past);
145
157
  }
146
158
  entry[key] = percentileOf(value, history);
147
159
  }
148
- ranked.set(auction.id, entry as Pick<AuctionAfter, "btcPercentile" | "indirectPercentile" | "dealerPercentile">);
160
+ ranked.set(auction.id, entry);
149
161
  });
150
162
  }
151
163
  return ranked;
@@ -178,6 +190,11 @@ export type CurveCloses = ReadonlyArray<{ date: string; value: number }>;
178
190
 
179
191
  /** The change from the auction day's close to the close `sessions` later, in bp; null when either is missing. */
180
192
  export function yieldChangeAfter(closes: CurveCloses, date: string, sessions: number): number | null {
193
+ return yieldMoveAfter(closes, date, sessions)?.change ?? null;
194
+ }
195
+
196
+ /** The change from the auction day's close to the close `sessions` later, in bp, and that later close's day. */
197
+ function yieldMoveAfter(closes: CurveCloses, date: string, sessions: number): { change: number; end: string } | null {
181
198
  let low = 0, high = closes.length;
182
199
  while (low < high) {
183
200
  const middle = (low + high) >> 1;
@@ -187,26 +204,36 @@ export function yieldChangeAfter(closes: CurveCloses, date: string, sessions: nu
187
204
  const base = closes[low];
188
205
  const later = closes[low + sessions];
189
206
  if (!base || base.date !== date || !later) return null;
190
- return toBasisPoints(later.value - base.value, 1);
207
+ return { change: toBasisPoints(later.value - base.value, 1), end: later.date };
191
208
  }
192
209
 
193
- /** The after view's figures for each auction shown, by id. */
210
+ export type AfterMove = "after1d" | "after5d" | "after20d";
211
+ const MOVE_SESSIONS: ReadonlyArray<[AfterMove, number]> = [["after1d", 1], ["after5d", 5], ["after20d", 20]];
212
+
213
+ /**
214
+ * The after view's figures for each auction shown, by id. With `knownBy` (a
215
+ * backtest as of that day) an earlier auction's move whose later close falls
216
+ * after it is blank, and named in `afterAskedDate`: it was not known on that
217
+ * day. The auction held on the day keeps its own.
218
+ */
194
219
  export function projectAuctionAfter(
195
220
  shown: readonly TreasuryAuction[],
196
221
  history: readonly TreasuryAuction[],
197
222
  curves: ReadonlyMap<string, CurveCloses>,
223
+ knownBy?: string,
198
224
  ): Map<string, AuctionAfter> {
199
225
  const percentiles = auctionPercentiles(history);
200
226
  return new Map(shown.map((auction) => {
201
227
  const cmt = cmtFor(auction);
202
228
  const closes = cmt ? curves.get(curveKey(cmt)) : undefined;
203
- const change = (sessions: number) => closes && !isPendingAuction(auction) ? yieldChangeAfter(closes, auction.auctionDate, sessions) : null;
204
- return [auction.id, {
205
- ...NO_AFTER,
206
- ...percentiles.get(auction.id),
207
- after1d: change(1), after5d: change(5), after20d: change(20),
208
- cmt: cmt ? cmtLabel(cmt) : null,
209
- }];
229
+ const figures: AuctionAfter = { ...NO_AFTER, ...percentiles.get(auction.id), cmt: cmt ? cmtLabel(cmt) : null };
230
+ const late: AfterMove[] = [];
231
+ for (const [key, sessions] of MOVE_SESSIONS) {
232
+ const move = closes && !isPendingAuction(auction) ? yieldMoveAfter(closes, auction.auctionDate, sessions) : null;
233
+ if (move && knownBy && auction.auctionDate < knownBy && move.end > knownBy) late.push(key);
234
+ else figures[key] = move?.change ?? null;
235
+ }
236
+ return [auction.id, late.length ? { ...figures, afterAskedDate: late } : figures];
210
237
  }));
211
238
  }
212
239
 
@@ -152,6 +152,23 @@ async function loadRecentBoard(
152
152
 
153
153
  /** A New York day (YYYY-MM-DD): an auction closes on it and its results come out that afternoon. */
154
154
  const newYorkDay = new Intl.DateTimeFormat("en-CA", { timeZone: "America/New_York", year: "numeric", month: "2-digit", day: "2-digit" });
155
+ const newYorkHour = new Intl.DateTimeFormat("en-US", { timeZone: "America/New_York", hour: "numeric", hourCycle: "h23" });
156
+
157
+ /**
158
+ * How long a command reuses the recent board an earlier run saved while an
159
+ * auction it lists has come due: five minutes, so a run after a run does not
160
+ * walk both sources again (about a second each), and one minute in the hour
161
+ * after 13:00 New York on an auction day, when a note or bond's results come
162
+ * out and a minute-old board may lack them.
163
+ */
164
+ const DUE_REUSE_MS = 5 * 60_000;
165
+ const RESULTS_HOUR_REUSE_MS = 60_000;
166
+
167
+ function dueReuseMs(auctions: readonly TreasuryAuction[], now: number): number {
168
+ const today = newYorkDay.format(now);
169
+ const resultsHour = Number(newYorkHour.format(now)) === 13;
170
+ return resultsHour && auctions.some((auction) => auction.auctionDate === today) ? RESULTS_HOUR_REUSE_MS : DUE_REUSE_MS;
171
+ }
155
172
 
156
173
  /** An announced auction whose day has come in the last week: its results may be out by now. */
157
174
  function comeDue(auction: TreasuryAuction, today: string, weekAgo: string): boolean {
@@ -165,9 +182,9 @@ function comeDue(auction: TreasuryAuction, today: string, weekAgo: string): bool
165
182
  * an auction announced within that hour, which the app waits as long for. A
166
183
  * command otherwise asks both sources again (saved-copy-persistence.ts), a
167
184
  * second or more each run; an auction due today is asked for until its
168
- * results are in. The app's own cache already answers from a fresh copy, and
169
- * keeps the failure of a refresh, so only a run that has read nothing yet
170
- * (a command) looks here.
185
+ * results are in, though no more often than `dueReuseMs` says. The app's own
186
+ * cache already answers from a fresh copy, and keeps the failure of a refresh,
187
+ * so only a run that has read nothing yet (a command) looks here.
171
188
  */
172
189
  function savedRecentBoard(fiscalKey: string, directKey: string | null, from: string, now = Date.now()): TreasuryAuctionsResult | null {
173
190
  if (cache.get(fiscalKey)) return null;
@@ -175,10 +192,11 @@ function savedRecentBoard(fiscalKey: string, directKey: string | null, from: str
175
192
  const direct = directKey ? directCache.get(directKey, { allowExpired: true }) : null;
176
193
  if (!fiscal || fiscal.stale || (directKey && (!direct || direct.stale))) return null;
177
194
  const auctions = mergeAuctionSources(fiscal.data, direct?.data ?? [], from);
195
+ const fetchedAt = Math.min(fiscal.fetchedAt, direct?.fetchedAt ?? Infinity);
178
196
  const today = newYorkDay.format(now);
179
197
  const weekAgo = newYorkDay.format(now - 7 * 86_400_000);
180
- if (auctions.some((auction) => comeDue(auction, today, weekAgo))) return null;
181
- return { auctions, fetchedAt: Math.min(fiscal.fetchedAt, direct?.fetchedAt ?? Infinity), stale: false };
198
+ if (auctions.some((auction) => comeDue(auction, today, weekAgo)) && now - fetchedAt >= dueReuseMs(auctions, now)) return null;
199
+ return { auctions, fetchedAt, stale: false };
182
200
  }
183
201
 
184
202
  export async function loadTreasuryAuctions(