@gloom-sh/terminal 0.20.8 → 0.20.10

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 (165) hide show
  1. package/package.json +1 -1
  2. package/src/api-client/auth.ts +6 -0
  3. package/src/api-client/data.ts +1 -0
  4. package/src/api-client/earnings.ts +15 -0
  5. package/src/api-client/futures-curve.ts +5 -1
  6. package/src/api-client/index.ts +14 -3
  7. package/src/api-client/types/account.ts +10 -0
  8. package/src/api-client/types/billing.ts +10 -0
  9. package/src/api-client/types/econ.ts +19 -7
  10. package/src/api-client/types/market.ts +7 -0
  11. package/src/api-client/types/screener.ts +2 -0
  12. package/src/cli/commands/market.ts +18 -8
  13. package/src/cli/commands/overview.ts +28 -7
  14. package/src/cli/commands/ticker.ts +40 -15
  15. package/src/cli/desktop-pane-shot.ts +39 -0
  16. package/src/cli/errors.ts +20 -3
  17. package/src/cli/fx-pair.ts +11 -2
  18. package/src/cli/history-rows.ts +34 -3
  19. package/src/cli/index.ts +1 -1
  20. package/src/cli/listing-arg.ts +51 -13
  21. package/src/cli/pane-functions/data.ts +3 -2
  22. package/src/cli/pane-functions/headless.ts +5 -2
  23. package/src/cli/pane-functions/index.ts +1 -0
  24. package/src/cli/pane-functions/resolver.ts +2 -1
  25. package/src/cli/pane-functions/screenshot-assessment.ts +73 -5
  26. package/src/cli/pane-functions/screenshot-types.ts +4 -0
  27. package/src/cli/symbol-cells.ts +6 -0
  28. package/src/cli/symbol-list.ts +14 -6
  29. package/src/cli/symbol-rows.ts +12 -5
  30. package/src/components/chart/composite/chart-layout.ts +7 -4
  31. package/src/components/chart/composite/composite-chart.tsx +6 -16
  32. package/src/components/chart/composite/toolbar.tsx +258 -82
  33. package/src/components/chart/composite/use-composite-chart-keyboard.ts +5 -6
  34. package/src/components/command-bar/list/model.ts +13 -0
  35. package/src/components/command-bar/routes/ticker-search/actions.ts +2 -0
  36. package/src/components/command-bar/routes/ticker-search/results.ts +15 -8
  37. package/src/components/command-bar/surface/index.tsx +10 -5
  38. package/src/components/command-bar/workflow/alert.ts +21 -7
  39. package/src/components/data-table/table-pane.ts +3 -1
  40. package/src/components/layout/pane/footer/model.ts +26 -1
  41. package/src/components/metric-treemap/heat-surface.tsx +2 -1
  42. package/src/components/metric-treemap/index.tsx +3 -2
  43. package/src/components/ui/confirm-dialog.tsx +253 -7
  44. package/src/components/ui/data-table/index.tsx +1 -1
  45. package/src/components/ui/data-table/types.ts +7 -0
  46. package/src/components/ui/list-view.tsx +4 -3
  47. package/src/components/ui/page-stack-view.tsx +24 -6
  48. package/src/components/ui/status.tsx +9 -6
  49. package/src/docs/snapshot.json +36 -0
  50. package/src/i18n/es.ts +12 -0
  51. package/src/i18n/ja.ts +12 -0
  52. package/src/i18n/ko.ts +12 -0
  53. package/src/i18n/zh-cn.ts +12 -0
  54. package/src/i18n/zh-tw.ts +12 -0
  55. package/src/market-data/futures-roll-returns.ts +226 -0
  56. package/src/market-data/fx-closes.ts +14 -2
  57. package/src/market-data/market/change-basis.ts +35 -1
  58. package/src/market-data/market/session-close-note.ts +41 -4
  59. package/src/market-data/market/status.ts +37 -0
  60. package/src/market-data/performance.ts +4 -1
  61. package/src/market-data/quotes/listing-enterprise-value.ts +8 -4
  62. package/src/market-data/quotes/live-valuation.ts +25 -2
  63. package/src/market-data/realized-volatility.ts +3 -0
  64. package/src/market-data/us-bond-market.ts +115 -0
  65. package/src/plugins/builtin/account-management/invite-row.tsx +54 -0
  66. package/src/plugins/builtin/account-management/keyboard.ts +3 -0
  67. package/src/plugins/builtin/account-management/model.ts +1 -0
  68. package/src/plugins/builtin/account-management/pane.tsx +51 -5
  69. package/src/plugins/builtin/account-management/trial-cancel.ts +32 -7
  70. package/src/plugins/builtin/backtest/client.ts +9 -2
  71. package/src/plugins/builtin/backtest/pane.tsx +1 -1
  72. package/src/plugins/builtin/backtest/report.ts +22 -6
  73. package/src/plugins/builtin/backtest/window.ts +17 -9
  74. package/src/plugins/builtin/cloud/askg/pane-session.ts +94 -0
  75. package/src/plugins/builtin/cloud/askg/pane.tsx +40 -83
  76. package/src/plugins/builtin/congress-trades/pane.tsx +8 -2
  77. package/src/plugins/builtin/correlation/compute.ts +4 -3
  78. package/src/plugins/builtin/correlation/headless.ts +6 -2
  79. package/src/plugins/builtin/correlation/index.tsx +7 -3
  80. package/src/plugins/builtin/correlation/matrix/model.ts +15 -1
  81. package/src/plugins/builtin/correlation/relationship/model.ts +15 -1
  82. package/src/plugins/builtin/correlation/relationship/pane.tsx +4 -2
  83. package/src/plugins/builtin/earnings/board-model.ts +33 -0
  84. package/src/plugins/builtin/earnings/board-table.ts +50 -11
  85. package/src/plugins/builtin/earnings/board.tsx +29 -13
  86. package/src/plugins/builtin/earnings/calendar.tsx +15 -3
  87. package/src/plugins/builtin/earnings/client.ts +4 -1
  88. package/src/plugins/builtin/earnings/headless.ts +27 -14
  89. package/src/plugins/builtin/econ/calendar-source.ts +3 -0
  90. package/src/plugins/builtin/futures-curve/headless.ts +4 -1
  91. package/src/plugins/builtin/futures-curve/model.ts +24 -0
  92. package/src/plugins/builtin/help/index.tsx +1 -1
  93. package/src/plugins/builtin/ipo-calendar/model.ts +3 -3
  94. package/src/plugins/builtin/iv-history/headless.ts +12 -10
  95. package/src/plugins/builtin/kelly-sizer/headless.ts +2 -2
  96. package/src/plugins/builtin/kelly-sizer/history.ts +10 -3
  97. package/src/plugins/builtin/kelly-sizer/pane.tsx +2 -2
  98. package/src/plugins/builtin/kelly-sizer/sections.tsx +1 -1
  99. package/src/plugins/builtin/macro-day/headless.ts +15 -5
  100. package/src/plugins/builtin/macro-day/model.ts +17 -4
  101. package/src/plugins/builtin/macro-day/releases.ts +36 -15
  102. package/src/plugins/builtin/market-halts/model.ts +3 -2
  103. package/src/plugins/builtin/market-movers/headless.ts +2 -1
  104. package/src/plugins/builtin/market-movers/index.tsx +3 -2
  105. package/src/plugins/builtin/market-movers/model.ts +75 -22
  106. package/src/plugins/builtin/market-movers/screener.ts +2 -1
  107. package/src/plugins/builtin/market-movers/table.ts +7 -5
  108. package/src/plugins/builtin/pe-band/model.ts +4 -0
  109. package/src/plugins/builtin/portfolio-list/cell-version.ts +4 -4
  110. package/src/plugins/builtin/portfolio-list/cli/render.ts +9 -4
  111. package/src/plugins/builtin/portfolio-list/pane/index.tsx +2 -1
  112. package/src/plugins/builtin/portfolio-list/summary/index.tsx +24 -7
  113. package/src/plugins/builtin/portfolio-list/summary/totals.ts +40 -11
  114. package/src/plugins/builtin/portfolio-list/table.tsx +13 -1
  115. package/src/plugins/builtin/realized-vol/headless.ts +11 -6
  116. package/src/plugins/builtin/realized-vol/model.ts +14 -6
  117. package/src/plugins/builtin/realized-vol/pane.tsx +2 -1
  118. package/src/plugins/builtin/realized-vol/settings.ts +2 -1
  119. package/src/plugins/builtin/research/analyst-headless.ts +9 -1
  120. package/src/plugins/builtin/research/analyst-pane.tsx +10 -4
  121. package/src/plugins/builtin/research/client.ts +25 -1
  122. package/src/plugins/builtin/research/corporate-actions-pane.tsx +2 -1
  123. package/src/plugins/builtin/research/event-model.ts +3 -13
  124. package/src/plugins/builtin/research/event-sources.ts +3 -1
  125. package/src/plugins/builtin/seasonality/client.ts +66 -17
  126. package/src/plugins/builtin/seasonality/headless.ts +7 -2
  127. package/src/plugins/builtin/seasonality/model.ts +12 -3
  128. package/src/plugins/builtin/seasonality/pane.tsx +4 -2
  129. package/src/plugins/builtin/shared/use-quote-board.ts +28 -6
  130. package/src/plugins/builtin/short-interest/headless.ts +2 -0
  131. package/src/plugins/builtin/short-interest/publications-headless.ts +2 -0
  132. package/src/plugins/builtin/short-interest/watch-headless.ts +1 -0
  133. package/src/plugins/builtin/yield-curve/headless.ts +5 -1
  134. package/src/plugins/builtin/yield-curve/index.tsx +5 -0
  135. package/src/portfolio/column-values.ts +47 -14
  136. package/src/portfolio/return-metrics.ts +4 -2
  137. package/src/renderers/dom/desktop/controls.tsx +1 -1
  138. package/src/renderers/dom/host/image-surface.tsx +19 -9
  139. package/src/renderers/dom/host/input.tsx +4 -0
  140. package/src/renderers/dom/styles.css +7 -4
  141. package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +23 -1
  142. package/src/renderers/opentui/box-width.ts +30 -0
  143. package/src/sources/gloomberb-cloud/normalizers.ts +2 -0
  144. package/src/sources/provider-errors.ts +12 -0
  145. package/src/sources/provider-router/index.ts +12 -4
  146. package/src/state/pane-session.ts +145 -0
  147. package/src/tickers/search/home-listing.ts +44 -1
  148. package/src/tickers/search/index.ts +5 -2
  149. package/src/tickers/search/ranking.ts +7 -7
  150. package/src/tickers/us-listing.ts +11 -5
  151. package/src/time-series/base-series.ts +7 -1
  152. package/src/time-series/fundamentals/current-valuation.ts +8 -0
  153. package/src/time-series/fundamentals/series.ts +6 -0
  154. package/src/time-series/resolve.ts +1 -0
  155. package/src/types/financials.ts +36 -3
  156. package/src/types/headless.ts +15 -0
  157. package/src/ui/host.tsx +2 -0
  158. package/src/utils/exchanges.ts +13 -8
  159. package/src/utils/fundamentals.ts +49 -8
  160. package/src/utils/price-earnings.ts +17 -10
  161. package/src/utils/price-history-integrity.ts +15 -0
  162. package/src/utils/reason-codes.ts +79 -0
  163. package/src/utils/share-multiples.cases.json +889 -0
  164. package/src/utils/share-multiples.ts +254 -0
  165. package/src/utils/untrusted-text.ts +11 -0
@@ -26,7 +26,7 @@ export const seasonalityHeadless: HeadlessPaneDefinition<"bundle"> = {
26
26
  const weekdays = args.options.tab === "weekdays";
27
27
  const history = await loadSeasonalityHistory({ instrument, cadence: weekdays ? "daily" : "monthly", signal: ctx.signal }, ctx.marketData);
28
28
  ctx.signal.throwIfAborted();
29
- const common = { errors: history.error ? [history.error] : [] };
29
+ const common = { errors: history.error ? [history.error] : [], ...(history.rollNote ? { notes: [history.rollNote] } : {}) };
30
30
  if (weekdays) {
31
31
  const model = projectWeekdays(history.history, { symbol: instrument.symbol, exchange: instrument.exchange, fetchedAt: history.fetchedAt });
32
32
  const present = model.start != null;
@@ -47,7 +47,11 @@ export const seasonalityHeadless: HeadlessPaneDefinition<"bundle"> = {
47
47
  fetchedAt: history.fetchedAt, methodology: "docs/research-data.md#seasonality" },
48
48
  };
49
49
  }
50
- const model = projectSeasonality(history.history, { symbol: instrument.symbol, lookbackYears: Number(args.options.lookbackYears) || 10 });
50
+ const lookbackYears = Number(args.options.lookbackYears) || 10;
51
+ const model = projectSeasonality(history.history, { symbol: instrument.symbol, lookbackYears });
52
+ // A lookback past the first month on record says where the years it covers start.
53
+ const coverage = model.historyStart
54
+ ? `History starts ${model.historyStart}, so the ${lookbackYears}-year lookback covers ${model.years.length} calendar year${model.years.length === 1 ? "" : "s"}` : null;
51
55
  // Monthly bars are dated by their month's first day, which is no close while the month runs.
52
56
  const bar = model.asOf?.toISOString().slice(0, 10);
53
57
  // The venue whose sessions say whether the month still runs: the key's, or for a bare symbol its quote's.
@@ -66,6 +70,7 @@ export const seasonalityHeadless: HeadlessPaneDefinition<"bundle"> = {
66
70
  complete: !history.stale && !history.error && model.years.length > 0,
67
71
  unavailableSymbols: model.years.length ? [] : [instrument.symbol],
68
72
  ...common,
73
+ ...(coverage ? { notes: [...common.notes ?? [], coverage] } : {}),
69
74
  ...(forming ? { freshness: { periodToDate: forming } } : closed ? { freshness: { asOf: closed } } : {}),
70
75
  metadata: { unit: "decimal return, local-price close to close", asOf: model.asOf?.toISOString() ?? null, stale: history.stale,
71
76
  fetchedAt: history.fetchedAt, averagePath: model.averagePath, methodology: "docs/research-data.md#seasonality" },
@@ -40,6 +40,12 @@ export interface SeasonalityModel {
40
40
  /** Mean of the completed years' paths at each month-end every one of them reached. */
41
41
  averagePath: SeasonalityPathPoint[];
42
42
  asOf: Date | null;
43
+ /**
44
+ * The first month on record ("2000-08") when the lookback reaches before
45
+ * it: a 30-year lookback on NG=F, whose history starts in 2000, covers the
46
+ * years since. Null when the history covers every year asked for.
47
+ */
48
+ historyStart: string | null;
43
49
  }
44
50
 
45
51
  const monthKey = (year: number, month: number) => year * 12 + month;
@@ -79,7 +85,7 @@ export function projectSeasonality(history: readonly PricePoint[], options: { sy
79
85
  const points = medianGapDays(sorted) >= 5 && medianGapDays(sorted) <= 9
80
86
  ? sorted.map((point) => ({ ...point, date: new Date(point.date.getTime() + 4 * DAY_MS) })) : sorted;
81
87
  const last = points.at(-1);
82
- if (!last) return { symbol: options.symbol, years: [], months: [], paths: [], averagePath: [], asOf: null };
88
+ if (!last) return { symbol: options.symbol, years: [], months: [], paths: [], averagePath: [], asOf: null, historyStart: null };
83
89
 
84
90
  const monthEnd = new Map<number, number>();
85
91
  for (const point of points) monthEnd.set(monthKey(point.date.getUTCFullYear(), point.date.getUTCMonth()), point.close);
@@ -89,7 +95,10 @@ export function projectSeasonality(history: readonly PricePoint[], options: { sy
89
95
  // bars are stamped at the month's start, so their date cannot say more.
90
96
  const complete = last.date.getUTCMonth() === 11;
91
97
  const runningMonthKey = complete ? null : monthKey(lastYear, last.date.getUTCMonth());
92
- const firstYear = Math.max(points[0]!.date.getUTCFullYear(), lastYear - Math.max(1, options.lookbackYears) + 1);
98
+ const askedFirstYear = lastYear - Math.max(1, options.lookbackYears) + 1;
99
+ const firstYear = Math.max(points[0]!.date.getUTCFullYear(), askedFirstYear);
100
+ // The asked-for first year's January needs the December before it.
101
+ const historyStart = points[0]!.date.getTime() >= Date.UTC(askedFirstYear, 0, 1) ? points[0]!.date.toISOString().slice(0, 7) : null;
93
102
  const years: SeasonalityYear[] = [];
94
103
  const paths: SeasonalityModel["paths"] = [];
95
104
  /** Per completed year, return since the prior year-end at each month-end. */
@@ -124,7 +133,7 @@ export function projectSeasonality(history: readonly PricePoint[], options: { sy
124
133
  return values.every((value) => value != null) ? [{ date: overlayMonthEnd(month), value: mean(values as number[])! }] : [];
125
134
  })] : [];
126
135
 
127
- return { symbol: options.symbol, years, months, paths, averagePath, asOf: last.date };
136
+ return { symbol: options.symbol, years, months, paths, averagePath, asOf: last.date, historyStart };
128
137
  }
129
138
 
130
139
  /** Monday first; a Saturday or Sunday row appears only for a venue that trades then. */
@@ -177,8 +177,10 @@ export function SeasonalityPane({ width, height, focused }: PaneProps) {
177
177
 
178
178
  usePaneNoticeFooter({ registrationId: "seasonality-notices", focused,
179
179
  notices: [...new Set([identityError, history.error, history.data?.error].filter((value): value is string => !!value))] });
180
- const closes = model?.asOf ? `monthly closes to ${model.asOf.toISOString().slice(0, 7)}`
181
- : weekdayModel?.start ? `daily closes ${weekdayModel.start} to ${weekdayModel.asOf}` : null;
180
+ const rolls = history.data?.rollNote ? ` · ${history.data.rollNote}` : "";
181
+ // From the first month on record when the lookback reaches before it.
182
+ const closes = model?.asOf ? `monthly closes ${model.historyStart ? `${model.historyStart} ` : ""}to ${model.asOf.toISOString().slice(0, 7)}${rolls}`
183
+ : weekdayModel?.start ? `daily closes ${weekdayModel.start} to ${weekdayModel.asOf}${rolls}` : null;
182
184
  usePaneFooter("seasonality", () => ({ info: [
183
185
  ...(history.loading ? [{ id: "loading", parts: [{ text: "loading history", tone: "muted" as const }] }] : []),
184
186
  ...(history.data?.stale ? [{ id: "stale", parts: [{ text: "stale history", tone: "warning" as const }] }] : []),
@@ -100,18 +100,32 @@ function isFlaggedStale(quote: Quote): boolean {
100
100
  return quote.stale === true && !quote.delisting;
101
101
  }
102
102
 
103
+ /**
104
+ * What a load hands the board for a symbol. `interim`: the batch's dated
105
+ * price for a symbol it left to be asked for alone, shown meanwhile only on
106
+ * a row that has no quote yet (mergeQuotes).
107
+ */
108
+ type LoadedQuoteState = BoardQuoteState & { interim?: true };
109
+ type LoadedQuoteMap = Map<string, LoadedQuoteState>;
110
+
103
111
  /**
104
112
  * A failed refresh must not blank a board that was showing prices a second
105
113
  * ago: keep the last good quote and mark it stale instead. A load that
106
114
  * brings only a price flagged stale shows the newer of it and the last one,
107
- * marked stale too.
115
+ * marked stale too. An interim price fills only a row with no quote, which
116
+ * stays loading until its own read answers; a row that has one keeps it as
117
+ * it is, so a background top-up never marks it loading or stale.
108
118
  */
109
- function mergeQuotes(previous: BoardQuoteMap, loaded: BoardQuoteMap): BoardQuoteMap {
119
+ function mergeQuotes(previous: BoardQuoteMap, loaded: LoadedQuoteMap): BoardQuoteMap {
110
120
  const next: BoardQuoteMap = new Map(previous);
111
121
  const now = Date.now();
112
122
  for (const [symbol, state] of loaded) {
113
- const current = state.quote && !isFlaggedStale(state.quote) ? state.quote : null;
114
123
  const kept = previous.get(symbol)?.quote ?? null;
124
+ if (state.interim) {
125
+ if (!kept) next.set(symbol, { ...(previous.get(symbol) ?? EMPTY_STATE), quote: state.quote, loading: true, stale: true });
126
+ continue;
127
+ }
128
+ const current = state.quote && !isFlaggedStale(state.quote) ? state.quote : null;
115
129
  const retained = current ?? (state.quote && (state.quote.lastUpdated ?? 0) >= (kept?.lastUpdated ?? 0) ? state.quote : kept);
116
130
  next.set(symbol, {
117
131
  quote: retained,
@@ -197,7 +211,7 @@ async function requestBoardQuotes(
197
211
  dataProvider: NonNullable<ReturnType<typeof useAssetData>>,
198
212
  subset: readonly string[],
199
213
  forceRefresh: boolean,
200
- apply: (loaded: BoardQuoteMap) => void,
214
+ apply: (loaded: LoadedQuoteMap) => void,
201
215
  timeoutMs?: number,
202
216
  ): Promise<void> {
203
217
  const askAlone = async (symbol: string, context: MarketDataRequestContext | undefined, fallback: Quote | null = null) => {
@@ -215,7 +229,7 @@ async function requestBoardQuotes(
215
229
  if (dataProvider.getQuotesBatch) {
216
230
  const applyBatch = async (results: QuoteBatchResult[]) => {
217
231
  const bySymbol = new Map(results.map((result) => [result.target.symbol, result]));
218
- const answered: BoardQuoteMap = new Map();
232
+ const answered: LoadedQuoteMap = new Map();
219
233
  const followUps: QuoteBatchResult[] = [];
220
234
  for (const symbol of subset) {
221
235
  const result = bySymbol.get(symbol);
@@ -230,6 +244,14 @@ async function requestBoardQuotes(
230
244
  stale: false,
231
245
  });
232
246
  }
247
+ // A symbol asked for again alone shows the batch's dated quote meanwhile on a row with none (a cold board), so
248
+ // what reads its quote (a future's contract month, which FUT's returns read the contract's history by) starts
249
+ // now rather than after a round trip. A row that has a quote keeps it (mergeQuotes).
250
+ for (const result of followUps) {
251
+ if (finitePrice(result.quote ?? null)) {
252
+ answered.set(result.target.symbol, { quote: result.quote!, loading: true, error: null, stale: true, interim: true });
253
+ }
254
+ }
233
255
  if (answered.size > 0) apply(answered);
234
256
  await Promise.all(followUps.map((result) => askAlone(result.target.symbol, { cacheMode: result.followUp }, result.quote)));
235
257
  };
@@ -388,7 +410,7 @@ export function useQuoteBoard(symbols: string[], options: QuoteBoardOptions = {}
388
410
  */
389
411
  const refreshInBatches = useCallback((subset: readonly string[], forceRefresh: boolean, gen: number) => {
390
412
  if (!dataProvider) return;
391
- const apply = (loaded: BoardQuoteMap) => {
413
+ const apply = (loaded: LoadedQuoteMap) => {
392
414
  if (fetchGenRef.current !== gen) return;
393
415
  setSnapshots((prev) => mergeQuotes(prev, loaded));
394
416
  };
@@ -84,6 +84,8 @@ export function createShortInterestHeadless(
84
84
  ],
85
85
  },
86
86
  usListingsOnly: "FINRA short interest",
87
+ // FINRA's settlements count OTC securities' shares short too: 0700.HK is offered TCEHY.
88
+ usListingsOtc: true,
87
89
  options: [
88
90
  {
89
91
  key: "order",
@@ -9,6 +9,8 @@ export function publicationHeadless(kind: PublicationKind): HeadlessPaneDefiniti
9
9
  shape: "bundle", options: [],
10
10
  argument: { kind: "ticker", description: "US equity ticker.", placeholder: "ticker" },
11
11
  usListingsOnly: fails ? "SEC fails to deliver" : "FINRA weekly off-exchange volume",
12
+ // Both report OTC securities: a receipt over the counter (TCEHY) has its fails and its weekly volume.
13
+ usListingsOtc: true,
12
14
  freshness: { source: fails ? "SEC" : "FINRA", status: "not-a-feed", basis: fails ? "settlement-date outstanding fails" : "published off-exchange volume",
13
15
  schedule: fails ? "published twice monthly" : "published weekly with a delay", observedKey: "date", oldest: null },
14
16
  discovery: {
@@ -14,6 +14,7 @@ export const shortWatchHeadless: HeadlessPaneDefinition<"rows"> = {
14
14
  freshness: { source: "FINRA", status: "not-a-feed", basis: "twice-monthly settlement", observedKey: "settlementDate", maxAgeMinutes: 30 * 24 * 60 },
15
15
  argument: { kind: "symbol-list", maximum: SHORT_WATCH_LIMIT, description: "US tickers; the pane defaults to your portfolios and watchlists." },
16
16
  usListingsOnly: "FINRA short interest",
17
+ usListingsOtc: true,
17
18
  failsWithoutData: true,
18
19
  options: [],
19
20
  describe: "Short squeeze watch",
@@ -17,6 +17,7 @@ import { fetchSwapCurve, loadSavedCurve, loadSavedWorldRows } from "./client";
17
17
  import { savedCopyMark } from "../../../data/saved-copies";
18
18
  import { formatSwapBp, selectedSwapTenor } from "./swaps-model";
19
19
  import { logFailure } from "../../../utils/log-failure";
20
+ import { usBondMarketClosedNote } from "../../../market-data/us-bond-market";
20
21
 
21
22
  const percent = (value: unknown) => value == null ? "-" : `${Number(value).toFixed(2)}%`;
22
23
  /** A move already in basis points: `+3bp`, `-1bp`, `0bp`. */
@@ -237,6 +238,9 @@ export function createYieldCurveHeadless(
237
238
  : data.seriesSource ? data.seriesSource
238
239
  : data.seriesSource === null ? "FRED" : CURVE_PUBLISHERS[curve];
239
240
  const cutoff = curveCutoff(curve);
241
+ // A US curve asked for a day the bond market was shut says so, and which day it shows (Veterans Day shows the day before).
242
+ const closed = requestedDate && session && CURVE_MARKETS[curve] === "US" ? usBondMarketClosedNote(requestedDate, session) : null;
243
+ const notes = [...(ranked ? [RANK_NOTE] : []), ...(closed ? [closed] : [])];
240
244
  return {
241
245
  // A stored curve cites its publisher. FRED's fallback cites info.source, not that publisher.
242
246
  // A Treasury curve names when in the day it was taken, beside its date.
@@ -244,7 +248,7 @@ export function createYieldCurveHeadless(
244
248
  ...(cutoff ? { schedule: cutoff } : {}),
245
249
  ...(requestedDate ? { basis: "historical curve" } : { basis: "daily curve", cadence: "daily" }) },
246
250
  ...(comparePoints ? { columns: compareColumns(compareAsOf) } : ranked ? { columns: RANKED_COLUMNS } : {}),
247
- ...(ranked ? { notes: [RANK_NOTE] } : {}),
251
+ ...(notes.length ? { notes } : {}),
248
252
  // The spreads the pane shows over its table, each with its day move and where it sits in the last year.
249
253
  ...(spreads.length ? { textSections: [{ title: "Spreads", entries: spreads.map((figure) => {
250
254
  const text = curveSpreadText(figure);
@@ -40,6 +40,7 @@ import { SwapsTab } from "./swaps";
40
40
  import {
41
41
  cachedCurve, cachedWorldRows, curveViewCache, loadSavedCurve, loadSavedWorldRows, swapCurveCache, worldCurvesCache,
42
42
  } from "./client";
43
+ import { usBondMarketClosedNote } from "../../../market-data/us-bond-market";
43
44
 
44
45
  type GcTab = "curve" | "world" | "swaps";
45
46
  const TABS = [{ label: "Curve", value: "curve" }, { label: "World", value: "world" }, { label: "Swaps", value: "swaps" }];
@@ -260,9 +261,13 @@ function CurveTab({ curve, onCurveChange, focused, width, height }: {
260
261
  // Both look-backs share one request per tenor, so they usually fail together.
261
262
  const lookbackFailures = [...new Set((fredLookbacks ?? []).flatMap((lookback) => lookback.points ? [] : [lookback.error]))]
262
263
  .map((message) => `${andList((fredLookbacks ?? []).filter((lookback) => lookback.error === message).map((lookback) => lookback.id))} look-back unavailable: ${message}`);
264
+ // A Treasury curve asked for a day the bond market was shut (Veterans Day) says so, and which day it shows.
265
+ const closedDay = requestedDate && asOf && (curve === "us" || curve === "us-real" || curve === "us-breakeven")
266
+ ? usBondMarketClosedNote(requestedDate, asOf) : null;
263
267
  usePaneNoticeFooter({
264
268
  registrationId: "yield-curve:notices",
265
269
  notices: [
270
+ closedDay ? `${closedDay}.` : null,
266
271
  !asOf && points.some((point) => point.yield != null) ? "The tenors carry mixed or unknown observation dates, so the curve is not one session." : null,
267
272
  missingTenors.length ? `Unavailable tenors: ${missingTenors.join(", ")}.` : null,
268
273
  points.some((point) => point.stale) ? "Some tenors are cached values because their refresh failed." : null,
@@ -25,6 +25,8 @@ import {
25
25
  type MarketFormatOptions,
26
26
  } from "../market-data/market/format";
27
27
  import {
28
+ EXTENDED_SESSION_MARKS,
29
+ extendedPrintSession,
28
30
  getActiveQuoteDisplay,
29
31
  getCompletedRegularSessionDisplay,
30
32
  getExtendedSessionDisplay,
@@ -33,6 +35,7 @@ import {
33
35
  marketStateDot,
34
36
  quoteDotMarketState,
35
37
  type ActiveQuoteDisplay,
38
+ type SessionPriceDisplay,
36
39
  } from "../market-data/market/status";
37
40
  import { formatOptionTicker } from "../utils/options";
38
41
  import { distributionHistory, forwardYieldMayHaveLapsed, lapsedDividend } from "../utils/forward-dividend";
@@ -119,7 +122,12 @@ export interface ColumnContext {
119
122
  fxDayMoves?: ReadonlyMap<string, number>;
120
123
  /** Clock for quote age (per second while shown) and day-based columns. */
121
124
  now: number;
122
- /** What market values, P&L, weights and the day's move are priced at; the latest print when absent. */
125
+ /**
126
+ * What market values, P&L, weights and the day's move are priced at, and
127
+ * LAST, CHG and CHG% show with it (rowHeadlineDisplay). Absent, as in a
128
+ * list that values nothing (a watchlist), the values are at the latest print
129
+ * and LAST is the regular session's, as `quote` heads it.
130
+ */
123
131
  valuationBasis?: PortfolioValuationBasis;
124
132
  /**
125
133
  * What a portfolio's weights divide by (allocationWeightBase): its priced
@@ -344,15 +352,15 @@ function tradedQuoteDisplay(
344
352
  }
345
353
 
346
354
  /**
347
- * LAST, CHG and CHG% once the regular session is over, and in the pre-market
348
- * while the quote carries the last session's close and move: that close and its
349
- * move, frozen, because the EXT% column carries the extended print measured
350
- * from that close. Until the close, and wherever no close is reported (a
351
- * pre-market quote without it, venues without extended hours), the traded price
352
- * as above.
353
- * Valuation columns (DAY P&L, MKT VAL, weight, P&L) keep the latest print,
354
- * unless the pane values at the regular close, which is this headline.
355
- * A watchlist's Avg Day averages this CHG%.
355
+ * The regular session's price and move, as `quote` heads Last: once the
356
+ * session is over, and in the pre-market while the quote carries the last
357
+ * session's close and move, that close and its move, frozen, because the EXT%
358
+ * column carries the extended print measured from that close. Until the close,
359
+ * and wherever no close is reported (a pre-market quote without it, venues
360
+ * without extended hours), the traded price as above. A watchlist's LAST and
361
+ * CHG% (its Avg Day averages this CHG%), and a book's valued at the regular
362
+ * close, which is this price; a book valued at the latest print shows that
363
+ * print instead (rowHeadlineDisplay).
356
364
  */
357
365
  export function headlineQuoteDisplay(
358
366
  traded: ActiveQuoteDisplay | null,
@@ -361,6 +369,26 @@ export function headlineQuoteDisplay(
361
369
  return traded ? getCompletedRegularSessionDisplay(quote) ?? traded : null;
362
370
  }
363
371
 
372
+ /**
373
+ * LAST, CHG and CHG% of a row: the price its figures use, so LAST times the
374
+ * shares is MKT VAL and CHG times them is DAY. In a book valued at the latest
375
+ * print, that print and its move from the close DAY measures from, naming its
376
+ * session when it is a pre-market, after-hours or overnight trade (`AH
377
+ * 158.78`); an option shows its trade, valued at its mark. A book at the
378
+ * regular close, and a list that values nothing (no `valuationBasis`, a
379
+ * watchlist), show the regular session as `quote` heads it
380
+ * (headlineQuoteDisplay), with the extended print in EXT%.
381
+ */
382
+ function rowHeadlineDisplay(
383
+ traded: ActiveQuoteDisplay | null,
384
+ quote: TickerFinancials["quote"],
385
+ ctx: Pick<ColumnContext, "valuationBasis">,
386
+ ): SessionPriceDisplay | null {
387
+ if (ctx.valuationBasis !== "latest-print" || !traded) return headlineQuoteDisplay(traded, quote);
388
+ const session = extendedPrintSession(quote, traded.price);
389
+ return session ? { ...traded, session } : traded;
390
+ }
391
+
364
392
  /** CHG% as shown: the headline's, else the quote's own when no position price is usable. */
365
393
  function headlineChangePercent(
366
394
  headline: ActiveQuoteDisplay | null,
@@ -546,7 +574,7 @@ export function getColumnValue(
546
574
  const liveQuote = getPortfolioQuoteDisplay(positionMetrics, quote);
547
575
  const activeQuote = getPortfolioValuationDisplay(positionMetrics, quote, ctx.valuationBasis, futures?.settlement);
548
576
  const displayQuote = tradedQuoteDisplay(positionMetrics, liveQuote, quote);
549
- const headlineQuote = settledHeadline(positionMetrics, ctx, futures) ?? headlineQuoteDisplay(displayQuote, quote);
577
+ const headlineQuote: SessionPriceDisplay | null = settledHeadline(positionMetrics, ctx, futures) ?? rowHeadlineDisplay(displayQuote, quote, ctx);
550
578
  const { positionCurrency, totalShares, totalCost, totalCostUnits, totalPriceUnits, multiplierHint, brokerMarkPrice } = positionMetrics;
551
579
 
552
580
  const toBaseQuote = (value: number) =>
@@ -598,8 +626,13 @@ export function getColumnValue(
598
626
  return { text: compactText(ticker.metadata.industry || financials?.profile?.industry) };
599
627
  case "tags":
600
628
  return { text: ticker.metadata.tags.length > 0 ? ticker.metadata.tags.join(",") : "—" };
601
- case "price":
602
- return resolvePortfolioPriceValue(headlineQuote, brokerMarkPrice, headlineQuote ? currentQuoteOptions : markOptions, col.width, quote?.marketState);
629
+ case "price": {
630
+ const cell = resolvePortfolioPriceValue(headlineQuote, brokerMarkPrice, headlineQuote ? currentQuoteOptions : markOptions, col.width, quote?.marketState);
631
+ // An extended-hours print says which session it is from, before it so the digits stay aligned: AH 158.78.
632
+ // The table widens the column to fit; an export keeps the price.
633
+ const session = headlineQuote?.session;
634
+ return session ? { ...cell, text: `${EXTENDED_SESSION_MARKS[session]} ${cell.text}`, value: headlineQuote.price } : cell;
635
+ }
603
636
  case "change":
604
637
  if (!headlineQuote) return { text: "—" };
605
638
  // A listing that no longer trades has no day's move: its last session's is years old.
@@ -832,7 +865,7 @@ export function getSortValue(
832
865
  const liveQuote = getPortfolioQuoteDisplay(positionMetrics, quote);
833
866
  const activeQuote = getPortfolioValuationDisplay(positionMetrics, quote, ctx.valuationBasis, futures?.settlement);
834
867
  const displayQuote = tradedQuoteDisplay(positionMetrics, liveQuote, quote);
835
- const headlineQuote = settledHeadline(positionMetrics, ctx, futures) ?? headlineQuoteDisplay(displayQuote, quote);
868
+ const headlineQuote = settledHeadline(positionMetrics, ctx, futures) ?? rowHeadlineDisplay(displayQuote, quote, ctx);
836
869
  const { positionCurrency, totalShares, totalCost, totalCostUnits, totalPriceUnits, brokerMarkPrice } = positionMetrics;
837
870
 
838
871
  const toBaseQuote = (value: number) =>
@@ -3,7 +3,7 @@ import type { TickerRecord } from "../types/ticker";
3
3
  import type { BrokerAccount } from "../types/trading";
4
4
  import { isDepositaryReceiptCategory, normalizeAssetCategory } from "../utils/asset-category";
5
5
  import { getPricePointTimestamp } from "../utils/price-history";
6
- import { mergePriceHistoryIntegrity, pricePointIntegrity, type PriceHistoryIntegrity } from "../utils/price-history-integrity";
6
+ import { mergePriceHistoryIntegrity, pricePointCloseCopied, pricePointIntegrity, type PriceHistoryIntegrity } from "../utils/price-history-integrity";
7
7
 
8
8
  export interface DatedReturn {
9
9
  startDateKey: string;
@@ -107,7 +107,9 @@ export function resolveDatedReturns(history: PricePoint[]): ReturnHistoryResult
107
107
  const byTimestamp = new Map<number, PricePoint>();
108
108
  for (const point of history) {
109
109
  const timestamp = getPricePointTimestamp(point);
110
- if (Number.isFinite(timestamp)) byTimestamp.set(timestamp, point);
110
+ // A pair's close its source copied from the open, which nothing rebuilt, is no day's close: the return runs across
111
+ // it from the close before, as across a holiday.
112
+ if (Number.isFinite(timestamp) && !pricePointCloseCopied(point)) byTimestamp.set(timestamp, point);
111
113
  }
112
114
  const reported = [...byTimestamp].map(([timestamp, point]) => ({ timestamp, point }));
113
115
  const issues = reported.map(({ point }) => pricePointIntegrity(point))
@@ -689,7 +689,7 @@ export function WebPageStackView({
689
689
  <WebIcon name="back" size={11} />
690
690
  <span className="gloom-qb-text">{backLabel}</span>
691
691
  </button>
692
- {detailTitle ? <div className="gloom-stack-title">{detailTitle}</div> : <div style={{ flex: 1 }} />}
692
+ {detailTitle ? <div className="gloom-stack-title" title={detailTitle}>{detailTitle}</div> : <div style={{ flex: 1 }} />}
693
693
  {backHint ? <span className="gloom-stack-hint">{backHint}</span> : null}
694
694
  </div>
695
695
  )}
@@ -1,5 +1,5 @@
1
1
  /** @jsxImportSource react */
2
- import { useState, type CSSProperties, type ReactNode } from "react";
2
+ import { useLayoutEffect, useRef, useState, type CSSProperties, type ReactNode } from "react";
3
3
  import type { ImageSurfaceProps } from "../../../ui/host";
4
4
  import { cleanDomProps, commonStyle } from "./style";
5
5
 
@@ -11,8 +11,6 @@ type ImageStatus = "loading" | "loaded" | "failed";
11
11
  * empty box while it asks again.
12
12
  */
13
13
  const failedImages = new Set<string>();
14
- /** Images that loaded this session: a row scrolled back into view draws its picture on its first frame, not its stand-in. */
15
- const loadedImages = new Set<string>();
16
14
  const IMAGES_KEPT = 2_000;
17
15
 
18
16
  function remember(images: Set<string>, src: string): void {
@@ -20,9 +18,17 @@ function remember(images: Set<string>, src: string): void {
20
18
  images.add(src);
21
19
  }
22
20
 
21
+ /**
22
+ * Every new image element starts loading, even for a picture that loaded
23
+ * before: what counts is whether this element has it to draw. One the
24
+ * browser still holds is complete at once, so a row scrolled back into view
25
+ * draws it on its first frame (see the layout effect); one it has to fetch
26
+ * again keeps the stand-in until it arrives. A loaded status carried over
27
+ * from another element drew the white plate behind an image not yet there,
28
+ * a blank white square in the desktop app for as long as the fetch took.
29
+ */
23
30
  function initialStatus(src: string): ImageStatus {
24
- if (failedImages.has(src)) return "failed";
25
- return loadedImages.has(src) ? "loaded" : "loading";
31
+ return failedImages.has(src) ? "failed" : "loading";
26
32
  }
27
33
 
28
34
  /**
@@ -37,6 +43,12 @@ export function WebImageSurface({ children, src, alt = "", objectFit = "contain"
37
43
  // Keyed by the address it describes, so a row that takes another logo starts that one's own load.
38
44
  const [known, setKnown] = useState<{ src: string; status: ImageStatus }>(() => ({ src: imageSrc, status: initialStatus(imageSrc) }));
39
45
  const status = known.src === imageSrc ? known.status : initialStatus(imageSrc);
46
+ const imageRef = useRef<HTMLImageElement | null>(null);
47
+ // Before the frame is painted: a picture the browser already holds is drawn at once, not after its stand-in.
48
+ useLayoutEffect(() => {
49
+ const image = imageRef.current;
50
+ if (status === "loading" && image?.complete && image.naturalWidth > 0) setKnown({ src: imageSrc, status: "loaded" });
51
+ }, [imageSrc, status]);
40
52
  const baseStyle = commonStyle(props);
41
53
  const waiting = fallbackWhileLoading && status === "loading";
42
54
  return (
@@ -53,13 +65,11 @@ export function WebImageSurface({ children, src, alt = "", objectFit = "contain"
53
65
  <>
54
66
  <img
55
67
  key={imageSrc}
68
+ ref={imageRef}
56
69
  src={imageSrc}
57
70
  alt={alt}
58
71
  draggable={false}
59
- onLoad={() => {
60
- remember(loadedImages, imageSrc);
61
- setKnown({ src: imageSrc, status: "loaded" });
62
- }}
72
+ onLoad={() => setKnown({ src: imageSrc, status: "loaded" })}
63
73
  onError={() => {
64
74
  remember(failedImages, imageSrc);
65
75
  setKnown({ src: imageSrc, status: "failed" });
@@ -328,6 +328,10 @@ function useWebEditable<T extends HTMLInputElement | HTMLTextAreaElement>(
328
328
  setCursorOffset: applyCursorOffset,
329
329
  focus: () => elementRef.current?.focus(),
330
330
  blur: () => elementRef.current?.blur(),
331
+ get focused() {
332
+ const element = elementRef.current;
333
+ return element != null && element.ownerDocument.activeElement === element;
334
+ },
331
335
  };
332
336
 
333
337
  const elementProps = {
@@ -1320,8 +1320,8 @@ html[data-gloom-screenshot="true"] [data-gloom-role="chart-watermark"] {
1320
1320
 
1321
1321
 
1322
1322
  /* Detail header of a list/detail stack: the same band as the query bar, so
1323
- Back and the item title read as the pane's toolbar. Grows when a long title
1324
- wraps rather than hiding it. */
1323
+ Back and the item title read as the pane's toolbar. The title stays on one
1324
+ line at any width and ends in an ellipsis; the full title is its tooltip. */
1325
1325
  .gloom-stack-bar {
1326
1326
  --qb-hairline: var(--gloom-hairline);
1327
1327
  --qb-fill: var(--gloom-hover-fill);
@@ -1360,7 +1360,9 @@ html[data-gloom-screenshot="true"] [data-gloom-role="chart-watermark"] {
1360
1360
  line-height: var(--cell-h);
1361
1361
  font-weight: var(--gloom-weight-bold);
1362
1362
  color: var(--gloom-text-bright);
1363
- overflow-wrap: break-word;
1363
+ overflow: hidden;
1364
+ text-overflow: ellipsis;
1365
+ white-space: nowrap;
1364
1366
  }
1365
1367
  .gloom-stack-hint { flex: none; align-self: center; padding: 0 var(--gloom-space-sm); color: var(--gloom-text-muted); white-space: nowrap; }
1366
1368
  /* Back and the title when a detail's query bar has taken the stack header. */
@@ -1399,7 +1401,8 @@ html[data-gloom-screenshot="true"] [data-gloom-role="chart-watermark"] {
1399
1401
  [data-gloom-role="pane-header-tabs"] [data-gloom-role="tab-label"],
1400
1402
  [data-gloom-role="pane-stack-tabs"] [data-gloom-role="tab-label"],
1401
1403
  .gloom-qb-title,
1402
- .gloom-qb-meta {
1404
+ .gloom-qb-meta,
1405
+ .gloom-stack-title {
1403
1406
  padding-block: var(--gloom-space-xs);
1404
1407
  margin-block: calc(-1 * var(--gloom-space-xs));
1405
1408
  }
@@ -24,6 +24,7 @@ import {
24
24
  } from "../../../cli/desktop-pane-shot-routes";
25
25
  import { openShotApiSocket, type ShotApiSocketSend } from "./cli-pane-shot-socket";
26
26
  import { instrumentFromTicker } from "../../../market-data/request-types";
27
+ import { buildQuoteKey, instrumentFromQuoteTarget } from "../../../market-data/selectors";
27
28
  import type { RendererHost } from "../../../ui/host";
28
29
  import { DomHostProviders } from "../../dom/dom-host-providers";
29
30
  import { webUiHost } from "./ui-host";
@@ -328,6 +329,8 @@ function waitForShotReadiness(): () => void {
328
329
 
329
330
  function createShotDataProvider(payload: DesktopPaneShotPayload): DataProvider {
330
331
  const cloudProvider = createGloomberbCloudProvider();
332
+ // The instruments a stream subscription has had its one frame for.
333
+ const streamedQuotes = new Set<string>();
331
334
  const bridge: Partial<DataProvider> = {
332
335
  id: payload.marketDataProviderId ?? cloudProvider.id,
333
336
  getQuote: (symbol, exchange, context) => requestShotMarketData<Quote>("getQuote", [symbol, exchange, context]),
@@ -371,7 +374,26 @@ function createShotDataProvider(payload: DesktopPaneShotPayload): DataProvider {
371
374
  getSecFilingDocuments: (filing) => requestShotMarketData<SecFilingDocument[]>("getSecFilingDocuments", [filing]),
372
375
  getSecFilingContent: (filing) => requestShotMarketData<string | null>("getSecFilingContent", [filing]),
373
376
  getEarningsCalendar: (symbols) => requestShotMarketData<EarningsEvent[]>("getEarningsCalendar", [symbols]).then(reviveEarningsEvents),
374
- subscribeQuotes: () => () => {},
377
+ subscribeQuotes: (targets, onQuote) => {
378
+ // A capture has no stream. Each target gets the quote a poll reads, once,
379
+ // so a pane that streams its rows (Market Movers with live on) shows them
380
+ // as its user sees them, not as its list alone draws them.
381
+ const fresh = targets.filter((target) => {
382
+ const key = buildQuoteKey(instrumentFromQuoteTarget(target));
383
+ if (streamedQuotes.has(key)) return false;
384
+ streamedQuotes.add(key);
385
+ return true;
386
+ });
387
+ if (fresh.length > 0) {
388
+ void requestShotMarketData<QuoteBatchResult[]>("getQuotesBatch", [fresh, {}])
389
+ .then((results) => results.forEach((result, index) => {
390
+ const target = fresh[index];
391
+ if (target && result?.quote) onQuote(target, result.quote);
392
+ }))
393
+ .catch(logFailure("desktop-pane-shot", "Could not load the quotes a pane streams for a screenshot"));
394
+ }
395
+ return () => {};
396
+ },
375
397
  };
376
398
  const fallback = new Proxy(cloudProvider, {
377
399
  get(target, property) {
@@ -0,0 +1,30 @@
1
+ import type { BoxRenderable as NativeBoxRenderable } from "@opentui/core";
2
+ import type { BoxRenderable } from "../../ui/host";
3
+
4
+ /**
5
+ * Calls `listener` with a box's laid-out width in cells, now if it has one and
6
+ * after every layout that changes it. For text that has to be cut to the room
7
+ * a flex row gives it, which only the layout knows. Returns the unsubscribe.
8
+ */
9
+ export function observeBoxWidth(
10
+ box: BoxRenderable | null,
11
+ listener: (width: number) => void,
12
+ ): (() => void) | undefined {
13
+ const native = box as NativeBoxRenderable | null;
14
+ if (!native) return;
15
+ const report = () => {
16
+ const width = native.width;
17
+ if (typeof width === "number" && width > 0) listener(width);
18
+ };
19
+ report();
20
+ // Computed layout invokes onSizeChange; keep whoever else listens.
21
+ const previous = native.onSizeChange;
22
+ const handleSizeChange = () => {
23
+ previous?.call(native);
24
+ report();
25
+ };
26
+ native.onSizeChange = handleSizeChange;
27
+ return () => {
28
+ if (native.onSizeChange === handleSizeChange) native.onSizeChange = previous;
29
+ };
30
+ }
@@ -284,6 +284,8 @@ export function mapPricePoint(
284
284
  ...(typeof point.rescaled === "number" && Number.isFinite(point.rescaled) && point.rescaled > 0 && point.rescaled !== 1
285
285
  ? { rescaled: point.rescaled } : {}),
286
286
  ...(typeof point.contract === "string" && FUTURES_CONTRACT_CODE.test(point.contract) ? { contract: point.contract } : {}),
287
+ ...(point.closeRebuilt === true ? { closeRebuilt: true } : {}),
288
+ ...(point.closeCopied === true ? { closeCopied: true } : {}),
287
289
  };
288
290
  }
289
291
 
@@ -195,6 +195,18 @@ export function isNoSourceAnswer(error: unknown): boolean {
195
195
  return error instanceof Error && !(error instanceof ProviderBusyError) && isNoProviderMessage(error.message);
196
196
  }
197
197
 
198
+ /**
199
+ * A source that answered it has nothing for a listing it knows: a miss that
200
+ * does not say the symbol is unknown, or one that crossed the desktop or
201
+ * screenshot bridge, which carries only its message, the service's bare
202
+ * NO_DATA. A source that failed, and a symbol no source knows, are not.
203
+ */
204
+ export function isNoDataAnswer(error: unknown): boolean {
205
+ if (error instanceof Error && error.message.trim() === "NO_DATA") return true;
206
+ return isProviderMiss(error) && !error.notFound && !/^(?:NOT_FOUND|BAD_MAPPING)$/.test(error.message.trim())
207
+ && notATickerSymbol(error.message) === null;
208
+ }
209
+
198
210
  export function shouldLogProviderError(error: unknown): boolean {
199
211
  if (isProviderMiss(error)) return false;
200
212
  const message = error instanceof Error ? error.message : String(error);