@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
@@ -4,7 +4,7 @@ import { formatNumber, formatSignificant, significantDecimals } from "../../../u
4
4
  import { logFailure } from "../../../utils/log-failure";
5
5
  import { mixedSessionCloseNote } from "../../../market-data/market/session-close-note";
6
6
  import { resolveHeadlessInstrument, loadHeadlessSymbols } from "../shared/headless-market-data";
7
- import { buildCorrelationMatrix, buildCorrelationSeries, buildGeoCorrelationSeries, pairKey, type CorrelationSeries } from "./matrix/model";
7
+ import { buildCorrelationMatrix, buildCorrelationSeries, buildGeoCorrelationSeries, correlationRollNotes, pairKey, type CorrelationSeries } from "./matrix/model";
8
8
  import { geoSeriesToken, loadGeoCorrelationHistory } from "./geo";
9
9
  import { buildRelationshipAnalysis, DEFAULT_RELATIONSHIP_SECOND_SYMBOL } from "./relationship/model";
10
10
  import { paneSchemas } from "./headless-schema";
@@ -73,9 +73,11 @@ export const correlationHeadless: HeadlessPaneDefinition<"rows"> = {
73
73
  reason: row.sampleSize < 5 ? "Insufficient shared return observations" : "Zero return variance",
74
74
  }));
75
75
  const asOf = newestReportTime(symbols.map((symbol) => bySymbol.get(symbol)?.prices.at(-1)?.dateKey));
76
+ const rollNotes = correlationRollNotes(symbols, bySymbol);
76
77
  return {
77
78
  freshness: { asOf, ...unfinishedBarFreshness([...bars.values()], asOf?.slice(0, 10)) },
78
79
  rows, unavailableSymbols,
80
+ ...(rollNotes.length ? { notes: rollNotes } : {}),
79
81
  errors: [
80
82
  ...loaded.errors,
81
83
  // A thin pair says which side is short of daily bars; a pair with enough returns and no value has no variance.
@@ -114,7 +116,8 @@ export const relationshipHeadless: HeadlessPaneDefinition<"series"> = {
114
116
  const loaded = await loadHeadlessSymbols(symbols, ctx, (symbol) => loadListedHistory(ctx, symbol, range));
115
117
  const listings = new Map(loaded.entries.map(({ symbol, data }) => [symbol, data]));
116
118
  const histories = new Map(loaded.entries.map(({ symbol, data }) => [symbol, data.points]));
117
- const analysis = buildRelationshipAnalysis(histories.get(symbols[0]!) ?? [], histories.get(symbols[1]!) ?? [], correlationWindow);
119
+ const analysis = buildRelationshipAnalysis(histories.get(symbols[0]!) ?? [], histories.get(symbols[1]!) ?? [], correlationWindow,
120
+ [symbols[0]!, symbols[1]!]);
118
121
  const [left, right] = symbols.map((symbol) => ({ symbol, ...listings.get(symbol) }));
119
122
  const sessionNote = listings.size === 2 ? mixedSessionCloseNote(left!, right!, analysis.aligned.at(-1)?.dateKey) : null;
120
123
  const unavailableSymbols = symbols.filter((symbol) => (histories.get(symbol) ?? []).filter((point) => (
@@ -147,6 +150,7 @@ export const relationshipHeadless: HeadlessPaneDefinition<"series"> = {
147
150
  freshness: unfinishedBarFreshness([...histories.values()], analysis.aligned.at(-1)?.dateKey, [...listings.values()].map(({ quotedAt }) => quotedAt)) ?? {},
148
151
  unavailableSymbols: [...new Set(unavailableSymbols)],
149
152
  errors: [...loaded.errors, ...(analysis.correlationUnavailableReason ? [analysis.correlationUnavailableReason] : [])],
153
+ ...(analysis.rollNotes.length ? { notes: analysis.rollNotes } : {}),
150
154
  metadata: {
151
155
  left: symbols[0], right: symbols[1], range, correlationWindow,
152
156
  returnAlignment: CORRELATION_RETURN_BASIS,
@@ -36,6 +36,7 @@ import {
36
36
  buildCorrelationPaneTitle,
37
37
  buildGeoCorrelationSeries,
38
38
  buildStatusSummary,
39
+ correlationRollNotes,
39
40
  type CorrelationSeries,
40
41
  getSeriesForEntry,
41
42
  pairKey,
@@ -219,12 +220,15 @@ function CorrelationMatrixPane({ focused, width, height }: PaneProps) {
219
220
  });
220
221
 
221
222
  // The ticker set and range are visible in-pane and an invalid list shows in
222
- // the body, so the footer only carries load state. `r` is global: no hint.
223
+ // the body, so the footer carries load state, and a future's rolls as GR
224
+ // says them. `r` is global: no hint.
225
+ const rollNotes = correlationRollNotes(symbols, seriesBySymbol).join(" · ");
223
226
  usePaneFooter("correlation", () => ({
224
227
  info: !settings.symbolsError && symbols.length >= 2 && statusSummary
225
- ? [{ id: "status", parts: [{ text: statusSummary, tone: "muted" as const }] }]
228
+ ? [{ id: "status", parts: [{ text: statusSummary, tone: "muted" as const }] },
229
+ ...(rollNotes ? [{ id: "rolls", parts: [{ text: rollNotes, tone: "muted" as const }] }] : [])]
226
230
  : [],
227
- }), [settings.symbolsError, statusSummary, symbols.length]);
231
+ }), [rollNotes, settings.symbolsError, statusSummary, symbols.length]);
228
232
 
229
233
  // Rows are exactly as wide as the matrix (after the one-cell inset), so the
230
234
  // zebra and hover bands stop at the last column instead of running on.
@@ -1,3 +1,4 @@
1
+ import { rollAdjustedHistory } from "../../../../market-data/futures-roll-returns";
1
2
  import { pricePointIntegrity, type PriceHistoryIntegrity } from "../../../../utils/price-history-integrity";
2
3
  import type { QueryEntry } from "../../../../market-data/result-types";
3
4
  import { colors } from "../../../../theme/colors";
@@ -24,6 +25,8 @@ export interface CorrelationSeries {
24
25
  observationCount: number;
25
26
  /** Bars left out because their prices contradict each other, kept as the source reported them. */
26
27
  integrity?: PriceHistoryIntegrity[];
28
+ /** A continuous future's returns, read within one contract at each roll: "rolls back-adjusted" (rollAdjustedHistory). */
29
+ rollNote?: string;
27
30
  loading?: boolean;
28
31
  refreshError?: string;
29
32
  fetchedAt?: number | null;
@@ -90,12 +93,15 @@ export function getSeriesForEntry(
90
93
  */
91
94
  export function buildCorrelationSeries(symbol: string, history: readonly PricePoint[]): CorrelationSeries {
92
95
  const integrity = history.flatMap((point) => { const issue = pricePointIntegrity(point); return issue ? [issue] : []; });
93
- const prices = dailyCloses(history);
96
+ // The closes are read for returns alone: a continuous future's are each one contract's.
97
+ const returns = rollAdjustedHistory(history, symbol);
98
+ const prices = dailyCloses(returns.points);
94
99
  const observationCount = Math.max(0, prices.length - 1);
95
100
  return {
96
101
  symbol, prices, observationCount,
97
102
  status: observationCount < MIN_CORRELATION_OBSERVATIONS ? "insufficient" : "ready",
98
103
  ...(integrity.length ? { integrity } : {}),
104
+ ...(returns.note ? { rollNote: returns.note } : {}),
99
105
  };
100
106
  }
101
107
 
@@ -190,6 +196,14 @@ export function buildStatusSummary(
190
196
  return parts.join(" · ");
191
197
  }
192
198
 
199
+ /** "NG=F: rolls back-adjusted" for each listed continuous future, as GR says it: the pane's footer and `fn CORR`'s notes. */
200
+ export function correlationRollNotes(symbols: readonly string[], seriesBySymbol: ReadonlyMap<string, CorrelationSeries>): string[] {
201
+ return symbols.flatMap((symbol) => {
202
+ const note = seriesBySymbol.get(symbol)?.rollNote;
203
+ return note ? [`${symbol}: ${note}`] : [];
204
+ });
205
+ }
206
+
193
207
  /**
194
208
  * The matrix already labels every symbol on both axes and the pane now carries
195
209
  * its own range control, so the title stays generic instead of repeating them.
@@ -6,6 +6,7 @@ import type { PaneSettingsDef, PaneTemplateCreateOptions } from "../../../../typ
6
6
  import type { PricePoint } from "../../../../types/financials";
7
7
  import { formatTickerListInput, parseTickerListInput } from "../../../../tickers/list";
8
8
  import { alignDailyCloses, dailyCloses, pearsonCorrelation } from "../compute";
9
+ import { rollAdjustedHistory } from "../../../../market-data/futures-roll-returns";
9
10
 
10
11
  export type RelationshipRange = Extract<TimeRange, "1M" | "3M" | "6M" | "1Y" | "5Y" | "ALL">;
11
12
 
@@ -51,6 +52,8 @@ export interface RelationshipAnalysis {
51
52
  stats: RelationshipRegressionStats | null;
52
53
  latestRatio: number | null;
53
54
  latestCorrelation: number | null;
55
+ /** A continuous future's returns read within one contract at each roll: "NG=F: rolls back-adjusted". */
56
+ rollNotes: string[];
54
57
  }
55
58
 
56
59
  function syntheticChartPoint(date: Date, value: number): ProjectedChartPoint {
@@ -148,10 +151,16 @@ function computeRelationshipRegression(returns: RelationshipReturnPoint[]): Rela
148
151
  };
149
152
  }
150
153
 
154
+ /**
155
+ * The pair's ratio from the prices as traded, and its returns, rolling
156
+ * correlation and regression from each side's returns, a continuous future's
157
+ * within one contract at each roll (rollAdjustedHistory) when `symbols` names it.
158
+ */
151
159
  export function buildRelationshipAnalysis(
152
160
  leftPoints: PricePoint[],
153
161
  rightPoints: PricePoint[],
154
162
  correlationWindow = DEFAULT_RELATIONSHIP_CORRELATION_WINDOW,
163
+ symbols?: readonly [string, string],
155
164
  ): RelationshipAnalysis {
156
165
  const issues = (points: PricePoint[]) => points.flatMap((point) => {
157
166
  const issue = pricePointIntegrity(point); return issue ? [issue] : [];
@@ -159,7 +168,11 @@ export function buildRelationshipAnalysis(
159
168
  // Bars whose prices contradict each other are gaps, as history leaves them blank (dailyCloses); kept for the export.
160
169
  const integrity = { left: issues(leftPoints), right: issues(rightPoints) };
161
170
  const aligned = alignRelationshipPrices(leftPoints, rightPoints);
162
- const returns = buildRelationshipReturns(aligned);
171
+ const [left, right] = symbols
172
+ ? [rollAdjustedHistory(leftPoints, symbols[0]), rollAdjustedHistory(rightPoints, symbols[1])]
173
+ : [{ points: leftPoints, note: null }, { points: rightPoints, note: null }];
174
+ const returns = buildRelationshipReturns(left.note || right.note ? alignRelationshipPrices(left.points, right.points) : aligned);
175
+ const rollNotes = symbols ? [[symbols[0], left.note], [symbols[1], right.note]].flatMap(([symbol, note]) => note ? [`${symbol}: ${note}`] : []) : [];
163
176
  const correlationPoints = buildRollingCorrelationPoints(returns, correlationWindow);
164
177
  const scatterPoints = returns.map((entry, index) => ({
165
178
  x: entry.rightReturn * 100,
@@ -181,6 +194,7 @@ export function buildRelationshipAnalysis(
181
194
  stats,
182
195
  latestRatio: aligned.at(-1)?.ratio ?? null,
183
196
  latestCorrelation,
197
+ rollNotes,
184
198
  ...(correlationUnavailableReason ? { correlationUnavailableReason } : {}),
185
199
  ...(integrity.left.length || integrity.right.length ? { integrity } : {}),
186
200
  };
@@ -144,7 +144,7 @@ export function RelationshipGraphPane({ focused, width, height }: PaneProps) {
144
144
  const left = data?.[0] ?? null;
145
145
  const right = data?.[1] ?? null;
146
146
  const analysis = useMemo(() => (
147
- left && right ? buildRelationshipAnalysis(left.points, right.points, correlationWindow) : null
147
+ left && right ? buildRelationshipAnalysis(left.points, right.points, correlationWindow, [left.symbol, right.symbol]) : null
148
148
  ), [correlationWindow, left, right]);
149
149
  const cycleRange = useCallback(() => setRange((current) => nextRelationshipRange(current)), [setRange]);
150
150
  const cycleWindow = useCallback(() => setCorrelationWindow((current) => nextRelationshipWindow(current)), [setCorrelationWindow]);
@@ -243,7 +243,9 @@ export function RelationshipGraphPane({ focused, width, height }: PaneProps) {
243
243
 
244
244
  // The legend reads the values at the cursor and the axis carries its date,
245
245
  // so the footer only reports loading.
246
- usePaneStatusFooter({ registrationId: "relationship-graph", loading });
246
+ const rollInfo = useMemo(() => analysis?.rollNotes.length
247
+ ? [{ id: "rolls", parts: [{ text: analysis.rollNotes.join(" · "), tone: "muted" as const }] }] : undefined, [analysis]);
248
+ usePaneStatusFooter({ registrationId: "relationship-graph", loading, ...(rollInfo ? { info: rollInfo } : {}) });
247
249
 
248
250
  if (!pair) {
249
251
  return (
@@ -6,6 +6,9 @@ import type { EarningsDateStatus, EarningsEpsBasis, Quote } from "../../../types
6
6
  import type { TickerRecord } from "../../../types/ticker";
7
7
  import { earningsDateStatus, earningsEpsBasis, isProvisionalActual } from "../shared/earnings-report";
8
8
  import { calendarReport } from "../shared/earnings-calendar";
9
+ import { listingSuffixCandidate } from "../../../sources/listing-symbols";
10
+ import { isUsListingExchange } from "../../../utils/exchanges";
11
+ import { sameHistoryListing } from "./client";
9
12
  import { shortDate, surprise, weekday } from "./format";
10
13
 
11
14
  /** A held name is in a portfolio; a watched one only in watchlists. */
@@ -36,6 +39,14 @@ export interface BoardReport {
36
39
  impliedMove: number | null;
37
40
  averageMove: number | null;
38
41
  owned: Ownership | null;
42
+ /** ISO currency of the EPS and sales figures; null when the report has none. The market cap is always dollars. */
43
+ currency?: string | null;
44
+ /**
45
+ * A listing abroad's lines on its markets, the one shown first; on a US line
46
+ * the board shows instead of its listing abroad (BABA, the day 9988:HKEX
47
+ * reports too), that listing's. Absent for other US listings.
48
+ */
49
+ listings?: readonly string[];
39
50
  }
40
51
 
41
52
  export type BoardRow =
@@ -145,9 +156,30 @@ export function boardReport(report: EarningsCalendarReport, owned: ReadonlyMap<s
145
156
  impliedMove: report.implied?.move ?? null,
146
157
  averageMove: report.averageReports >= MIN_AVERAGE_REPORTS ? report.averageMove : null,
147
158
  owned: owned.get(report.symbol) ?? null,
159
+ // The board's US reports are in dollars; a listing abroad's say their own.
160
+ currency: report.currency ?? "USD",
161
+ ...report.listings?.length ? { listings: report.listings } : {},
148
162
  };
149
163
  }
150
164
 
165
+ /** A listing as the board keys it: 0700.HK, as typed where its quote could not be read, is 0700:HKEX. */
166
+ export function boardKey(symbol: string): string {
167
+ const suffixed = listingSuffixCandidate(symbol);
168
+ return (suffixed ? `${suffixed.symbol}:${suffixed.exchange}` : symbol).toUpperCase();
169
+ }
170
+
171
+ /**
172
+ * Whether a board row is the listing named: its own line, or another of its
173
+ * company's (0939:HKEX for 601939:SSE, 9988:HKEX for BABA the day both report).
174
+ */
175
+ export function boardRowOf(entry: Pick<BoardReport, "symbol" | "listings">, named: string): boolean {
176
+ const symbol = boardKey(named);
177
+ const [bare = symbol, venue] = symbol.split(":");
178
+ // A US ticker is a US row's bare symbol, never a listing abroad's.
179
+ if (!venue || isUsListingExchange(venue)) return !entry.symbol.includes(":") && entry.symbol.toUpperCase() === bare;
180
+ return [entry.symbol, ...entry.listings ?? []].some((line) => sameHistoryListing(line, symbol));
181
+ }
182
+
151
183
  /**
152
184
  * A company the stored calendar does not carry (a listing abroad, a date past
153
185
  * its horizon) from the per-ticker calendar, read as every earnings surface
@@ -182,6 +214,7 @@ export function fallbackReport(event: EarningsEvent, owned: ReadonlyMap<string,
182
214
  impliedMove: null,
183
215
  averageMove: null,
184
216
  owned: owned.get(event.symbol) ?? null,
217
+ currency: epsEstimate != null || dollars("revenueEstimate") != null ? "USD" : null,
185
218
  };
186
219
  }
187
220
 
@@ -1,6 +1,6 @@
1
1
  import type { DataTableCell, DataTableColumn } from "../../../components";
2
2
  import { withCompanyLogo } from "../../../components/company-logo";
3
- import { TABLE_COLUMN_GAP, tableColumnWidth } from "../../../components/ui/table-layout";
3
+ import { TABLE_COLUMN_GAP, tableColumnLeadGap, tableColumnWidth } from "../../../components/ui/table-layout";
4
4
  import { colors } from "../../../theme/colors";
5
5
  import { TextAttributes } from "../../../ui";
6
6
  import { epsBasisShort, showsEpsBasis } from "../shared/earnings-report";
@@ -8,27 +8,33 @@ import type { BoardReport, BoardRow, BoardSort } from "./board-model";
8
8
  import { epsText, impliedText, moneyText, moveSize, signedPercent, TIMING_LABEL, weekday } from "./format";
9
9
 
10
10
  type BoardColumnId =
11
- | "owned" | "symbol" | "name" | "when" | "status" | "cap" | "epsEstimate" | "analysts" | "epsActual" | "basis"
11
+ | "owned" | "symbol" | "name" | "when" | "status" | "cap" | "ccy" | "epsEstimate" | "analysts" | "epsActual" | "basis"
12
12
  | "epsSurprise" | "revenueEstimate" | "implied" | "move" | "average";
13
13
 
14
14
  export type BoardColumn = DataTableColumn & { id: BoardColumnId };
15
15
 
16
16
  const NAME_MIN_WIDTH = 12;
17
+ /** TICKER fits a US ticker; a listing abroad's key is longer (0700:HKEX, 601939:SSE, 000333:SZSE). */
18
+ const SYMBOL_WIDTH = 6;
19
+ const SYMBOL_MAX_WIDTH = 11;
17
20
 
18
21
  const ALL_COLUMNS: BoardColumn[] = [
19
22
  { id: "owned", label: "", width: 1, align: "left" },
20
- { id: "symbol", label: "TICKER", width: 6, align: "left" },
23
+ { id: "symbol", label: "TICKER", width: SYMBOL_WIDTH, align: "left" },
21
24
  { id: "name", label: "NAME", width: NAME_MIN_WIDTH, align: "left" },
22
25
  { id: "when", label: "WHEN", width: 7, align: "left" },
23
26
  { id: "status", label: "STATUS", width: 9, align: "left" },
24
27
  { id: "implied", label: "IMPLIED", width: 7, align: "right" },
25
- { id: "move", label: "MOVE", width: 7, align: "right" },
28
+ // The move, the actual EPS and its surprise come with the report: an upcoming one has none.
29
+ { id: "move", label: "MOVE", width: 7, align: "right", mayBeBlank: true },
26
30
  { id: "average", label: "AVG MOVE", width: 8, align: "right" },
31
+ // The currency of the EPS and sales figures, on a board with a listing abroad's (CNY for Tencent).
32
+ { id: "ccy", label: "CCY", width: 3, align: "left" },
27
33
  { id: "epsEstimate", label: "EPS EST", width: 7, align: "right" },
28
34
  { id: "analysts", label: "ESTS", width: 4, align: "right" },
29
- { id: "epsActual", label: "EPS ACT", width: 7, align: "right" },
35
+ { id: "epsActual", label: "EPS ACT", width: 7, align: "right", mayBeBlank: true },
30
36
  { id: "basis", label: "BASIS", width: 5, align: "left" },
31
- { id: "epsSurprise", label: "EPS SURP", width: 8, align: "right" },
37
+ { id: "epsSurprise", label: "EPS SURP", width: 8, align: "right", mayBeBlank: true },
32
38
  { id: "revenueEstimate", label: "SALES EST", width: 9, align: "right" },
33
39
  { id: "cap", label: "MKT CAP", width: 8, align: "right" },
34
40
  ];
@@ -36,8 +42,9 @@ const ALL_COLUMNS: BoardColumn[] = [
36
42
  /**
37
43
  * Dropped first when narrow, the report's labels before its figures; the
38
44
  * implied move, the move on the report and their average stay beside the name.
45
+ * CCY goes only with the last figure it is the currency of.
39
46
  */
40
- const DROP_ORDER: BoardColumnId[] = ["basis", "analysts", "epsSurprise", "status", "epsActual", "cap", "revenueEstimate", "epsEstimate", "owned"];
47
+ const DROP_ORDER: BoardColumnId[] = ["basis", "analysts", "epsSurprise", "status", "epsActual", "cap", "revenueEstimate", "epsEstimate", "ccy", "owned"];
41
48
 
42
49
  /**
43
50
  * With an actual on the board the report is the news: EPS ACT, then EPS SURP,
@@ -46,9 +53,12 @@ const DROP_ORDER: BoardColumnId[] = ["basis", "analysts", "epsSurprise", "status
46
53
  * goes. Without one, those two columns would be empty, so DROP_ORDER holds.
47
54
  */
48
55
  const REPORTED_DROP_ORDER: BoardColumnId[] = [
49
- "basis", "analysts", "status", "average", "cap", "revenueEstimate", "epsSurprise", "epsActual", "epsEstimate", "owned",
56
+ "basis", "analysts", "status", "average", "cap", "revenueEstimate", "epsSurprise", "epsActual", "epsEstimate", "ccy", "owned",
50
57
  ];
51
58
 
59
+ /** The columns in the report's currency, which CCY names. */
60
+ const CURRENCY_FIGURES: BoardColumnId[] = ["epsEstimate", "epsActual", "revenueEstimate"];
61
+
52
62
  /** Header clicks sort these; the rest keep the ranking. */
53
63
  export const SORTABLE: Partial<Record<BoardColumnId, BoardSort["column"]>> = {
54
64
  symbol: "symbol", cap: "cap", implied: "implied", average: "average",
@@ -59,14 +69,41 @@ export function boardHasActuals(rows: readonly BoardRow[]): boolean {
59
69
  return rows.some((row) => row.kind === "report" && row.report.epsActual != null);
60
70
  }
61
71
 
62
- export function boardColumns(width: number, { actuals = false }: { actuals?: boolean } = {}): BoardColumn[] {
72
+ /**
73
+ * Whether a report on the board is in another currency than dollars (a
74
+ * listing abroad's): the board then shows CCY, and says its market cap is in
75
+ * dollars (boardColumns). A board of US reports looks as it always has.
76
+ */
77
+ export function boardHasCurrencies(rows: readonly BoardRow[]): boolean {
78
+ return rows.some((row) => row.kind === "report" && row.report.currency != null && row.report.currency !== "USD");
79
+ }
80
+
81
+ /** TICKER's width for the board's symbols: a US ticker's, or wide enough for the longest listing abroad's key. */
82
+ export function boardSymbolWidth(rows: readonly BoardRow[]): number {
83
+ const longest = Math.max(0, ...rows.map((row) => (row.kind === "report" ? row.report.symbol.length : 0)));
84
+ return Math.min(SYMBOL_MAX_WIDTH, Math.max(SYMBOL_WIDTH, longest));
85
+ }
86
+
87
+ export function boardColumns(
88
+ width: number,
89
+ { actuals = false, currencies = false, symbolWidth = SYMBOL_WIDTH }: { actuals?: boolean; currencies?: boolean; symbolWidth?: number } = {},
90
+ ): BoardColumn[] {
91
+ // Every column but the name, with the space a left-aligned column keeps from a right-aligned one before it (CCY after
92
+ // AVG MOVE, BASIS after EPS ACT), so the last column is never cut at the pane's edge.
63
93
  const fixed = (list: BoardColumn[]) =>
64
- list.reduce((sum, column) => sum + (column.id === "name" ? 0 : tableColumnWidth(column)) + TABLE_COLUMN_GAP, 2);
65
- let columns = ALL_COLUMNS;
94
+ list.reduce((sum, column, index) =>
95
+ sum + tableColumnLeadGap(list, index, TABLE_COLUMN_GAP) + (column.id === "name" ? 0 : tableColumnWidth(column)) + TABLE_COLUMN_GAP, 2);
96
+ // Beside figures in yuan or Hong Kong dollars, the cap says it is in dollars.
97
+ let columns = (currencies ? ALL_COLUMNS : ALL_COLUMNS.filter((column) => column.id !== "ccy")).map((column) =>
98
+ column.id === "cap" && currencies ? { ...column, label: "MKT CAP $", width: 9 }
99
+ : column.id === "symbol" ? { ...column, width: symbolWidth }
100
+ : column);
66
101
  for (const id of actuals ? REPORTED_DROP_ORDER : DROP_ORDER) {
67
102
  if (fixed(columns) + NAME_MIN_WIDTH <= width) break;
68
103
  columns = columns.filter((column) => column.id !== id);
69
104
  }
105
+ // CCY is the currency of the figures beside it; with none left it goes too.
106
+ if (!columns.some((column) => CURRENCY_FIGURES.includes(column.id))) columns = columns.filter((column) => column.id !== "ccy");
70
107
  // The name takes what the other columns leave.
71
108
  const nameWidth = Math.max(NAME_MIN_WIDTH, width - fixed(columns));
72
109
  return columns.map((column) => (column.id === "name" ? { ...column, width: nameWidth } : column));
@@ -120,6 +157,8 @@ export function renderBoardCell(row: BoardRow, column: BoardColumn, context: Boa
120
157
  return { text: report.dateStatus ?? "--", color: report.dateStatus === "projected" ? colors.textMuted : dim };
121
158
  case "cap":
122
159
  return { text: moneyText(report.marketCap), color: dim };
160
+ case "ccy":
161
+ return { text: report.currency ?? "--", color: dim };
123
162
  case "epsEstimate":
124
163
  return { text: epsText(report.epsEstimate), color: dim };
125
164
  case "analysts":
@@ -25,9 +25,12 @@ import { useAssetData, usePluginAppActions, usePluginTickerActions } from "../..
25
25
  import { earningsResultsAlertValues } from "../alerts/research-builder";
26
26
  import { cachedMembers, loadMembers } from "../members/client";
27
27
  import { isBoardRowLoading, useQuoteBoard } from "../shared/use-quote-board";
28
+ import { listingAbroadVenue } from "../../../utils/sec";
28
29
  import {
29
30
  addDays,
31
+ boardKey,
30
32
  boardReport,
33
+ boardRowOf,
31
34
  boardRows,
32
35
  fallbackReport,
33
36
  newYorkToday,
@@ -38,7 +41,7 @@ import {
38
41
  type BoardRow,
39
42
  type BoardSort,
40
43
  } from "./board-model";
41
- import { boardColumns, boardHasActuals, renderBoardCell, renderBoardSection, SORTABLE, type BoardCellContext, type BoardColumn } from "./board-table";
44
+ import { boardColumns, boardHasActuals, boardHasCurrencies, boardSymbolWidth, renderBoardCell, renderBoardSection, SORTABLE, type BoardCellContext, type BoardColumn } from "./board-table";
42
45
  import { EarningsCalendarView, CALENDAR_GROUP_ROWS, calendarSlotsPerRow } from "./calendar";
43
46
  import {
44
47
  boardRangeDays,
@@ -99,7 +102,9 @@ interface BoardData {
99
102
  * ERN without a ticker: the market's report days, largest companies first,
100
103
  * with the implied move and each company's average move. With tickers, or the
101
104
  * Names filter (Mine, a portfolio, a watchlist or a fund's holdings),
102
- * the upcoming reports of those companies instead.
105
+ * the upcoming reports of those companies instead. Every board reads the Hong
106
+ * Kong, China A and Singapore top 100's reports too, ranked by their value in
107
+ * dollars beside US companies, each with the currency of its figures (CCY).
103
108
  */
104
109
  export function EarningsBoard({ focused, width, height, scopedSymbols, highlight = null }: {
105
110
  focused: boolean;
@@ -185,13 +190,18 @@ export function EarningsBoard({ focused, width, height, scopedSymbols, highlight
185
190
  const days = useMemo(() => (market || range ? boardRangeDays(range, today) : relativeDays(today)), [market, range, today]);
186
191
  const weekOffset = boardRangeWeek(range, today);
187
192
  const week = useMemo(() => calendarWeekDates(today, weekOffset), [today, weekOffset]);
188
- // The calendar reads its week, reported days included; the table its days.
189
- const query = useMemo<EarningsCalendarQuery>(() => calendar
190
- ? { from: week[0]!, to: week.at(-1)!, perDay: market ? MARKET_PER_DAY : 0, symbols: named }
191
- : market || range
192
- ? { from: days[0]!.from, to: days.at(-1)!.to, perDay: market ? MARKET_PER_DAY : 0, symbols: named }
193
- : { from: today, to: addDays(today, HORIZON_DAYS), perDay: 0, symbols: named },
194
- [calendar, days, market, named, range, today, week]);
193
+ // EVTS 0700.HK names its listing, which the market board then keeps whatever the day's cut.
194
+ const highlightListing = market && highlight && listingAbroadVenue(boardKey(highlight)) ? boardKey(highlight) : null;
195
+ // The calendar reads its week, reported days included; the table its days. Each report says its currency
196
+ // (CCY), so every board reads the listings abroad too.
197
+ const query = useMemo<EarningsCalendarQuery>(() => {
198
+ const symbols = highlightListing && !named.includes(highlightListing) ? [...named, highlightListing] : named;
199
+ return calendar
200
+ ? { from: week[0]!, to: week.at(-1)!, perDay: market ? MARKET_PER_DAY : 0, symbols, markets: "all" }
201
+ : market || range
202
+ ? { from: days[0]!.from, to: days.at(-1)!.to, perDay: market ? MARKET_PER_DAY : 0, symbols, markets: "all" }
203
+ : { from: today, to: addDays(today, HORIZON_DAYS), perDay: 0, symbols, markets: "all" };
204
+ }, [calendar, days, highlightListing, market, named, range, today, week]);
195
205
  // A fund's read is named by the fund: its companies are known once its holdings are.
196
206
  const queryKey = fund ? `${fund.etf}|${earningsCalendarKey(query)}` : earningsCalendarKey(query);
197
207
 
@@ -208,7 +218,8 @@ export function EarningsBoard({ focused, width, height, scopedSymbols, highlight
208
218
  ]);
209
219
  if (cloud.status === "rejected" && (!perTicker || fallback.status === "rejected")) throw cloud.reason;
210
220
  const reports = cloud.status === "fulfilled" ? cloud.value.payload.reports.map((report) => boardReport(report, owned)) : [];
211
- const covered = new Set(reports.map((report) => report.symbol));
221
+ // A listing abroad named by another of its company's lines (0939.HK) is covered by its row.
222
+ const covered = new Set(reports.flatMap((report) => [report.symbol, ...report.listings ?? []]));
212
223
  const extra = fallback.status === "fulfilled"
213
224
  ? fallback.value.filter((event) => !covered.has(event.symbol)).map((event) => fallbackReport(event, owned, today))
214
225
  : [];
@@ -248,9 +259,13 @@ export function EarningsBoard({ focused, width, height, scopedSymbols, highlight
248
259
  const selected = reportRows.find((row) => row.key === selectedKey) ?? reportRows[0] ?? null;
249
260
  const open = reportRows.find((row) => row.key === openKey)?.report
250
261
  ?? (openKey ? data?.reports.find((report) => report.key === openKey) : undefined) ?? null;
251
- // A board with an actual keeps EPS ACT and EPS SURP when narrow; keyed by the flag, so the columns hold between renders.
262
+ // A board with an actual keeps EPS ACT and EPS SURP when narrow, and one with a listing abroad's report shows CCY;
263
+ // keyed by the flags, so the columns hold between renders.
252
264
  const actuals = boardHasActuals(rows);
253
- const columns = useMemo(() => boardColumns(width, { actuals }), [actuals, width]);
265
+ const currencies = boardHasCurrencies(rows);
266
+ // TICKER fits a listing abroad's key (601939:SSE) when the board has one.
267
+ const symbolWidth = boardSymbolWidth(rows);
268
+ const columns = useMemo(() => boardColumns(width, { actuals, currencies, symbolWidth }), [actuals, currencies, symbolWidth, width]);
254
269
  // The move on each report out today, beside its implied move, from the quotes every board reads.
255
270
  // Keyed by content: the rows are rebuilt on renders that change nothing, and the quote board reloads on a new list.
256
271
  const reportedKey = [...new Set(reportRows.filter((row) => row.report.dateStatus === "reported" && row.report.date === today)
@@ -292,7 +307,8 @@ export function EarningsBoard({ focused, width, height, scopedSymbols, highlight
292
307
 
293
308
  useEffect(() => {
294
309
  if (!highlight || highlighted.current === highlight) return;
295
- const row = reportRows.find((candidate) => candidate.report.symbol === highlight);
310
+ // 0700.HK as typed is the board's 0700:HKEX; 0939.HK is CCB's row under its A share.
311
+ const row = reportRows.find((candidate) => boardRowOf(candidate.report, highlight));
296
312
  if (!row) return;
297
313
  highlighted.current = highlight;
298
314
  setSelectedKey(row.key);
@@ -88,9 +88,11 @@ function locate(grid: readonly Slot[][][], key: string | null): Position | null
88
88
  /** What hovering a logo says: the company, when it reports and, once out, how it did. */
89
89
  function reportTitle(report: BoardReport): string {
90
90
  const when = report.timing ? TIMING_LABEL[report.timing] : "time not set";
91
+ // A listing abroad's figures say their currency (CNY for Tencent), as the table's CCY does.
92
+ const currency = report.currency && report.currency !== "USD" ? ` ${report.currency}` : "";
91
93
  const figures = report.epsActual != null
92
- ? `EPS ${epsText(report.epsActual)} vs ${epsText(report.epsEstimate)} est${report.epsSurprise != null ? `, ${signedPercent(report.epsSurprise)}` : ""}`
93
- : report.epsEstimate != null ? `EPS est ${epsText(report.epsEstimate)}` : null;
94
+ ? `EPS ${epsText(report.epsActual)} vs ${epsText(report.epsEstimate)} est${currency}${report.epsSurprise != null ? `, ${signedPercent(report.epsSurprise)}` : ""}`
95
+ : report.epsEstimate != null ? `EPS est ${epsText(report.epsEstimate)}${currency}` : null;
94
96
  return [`${report.symbol} · ${report.name}`, when, figures].filter(Boolean).join(" · ");
95
97
  }
96
98
 
@@ -267,6 +269,14 @@ const TILE_STYLE = {
267
269
  } as const;
268
270
  /** The logo of a calendar tile: a square near two cells tall, most of the slot's width. */
269
271
  const LOGO_STYLE = { width: "calc(var(--cell-h) * 1.75)", height: "calc(var(--cell-h) * 1.75)", flexShrink: 0 } as const;
272
+ /** The ticker under the logo is never wider than its tile: it ends in an ellipsis instead of running under the next. */
273
+ const LABEL_STYLE = { maxWidth: "100%", minWidth: 0 } as const;
274
+
275
+ /** A tile's ticker: a listing abroad's code without its venue (0700 for 0700:HKEX), which the tile's title names. */
276
+ function tileLabel(symbol: string): string {
277
+ const venue = symbol.indexOf(":");
278
+ return venue > 0 ? symbol.slice(0, venue) : symbol;
279
+ }
270
280
 
271
281
  function ReportTile({ report, selected, onPress, tileRef }: {
272
282
  report: BoardReport;
@@ -299,7 +309,9 @@ function ReportTile({ report, selected, onPress, tileRef }: {
299
309
  <Box style={LOGO_STYLE}>
300
310
  <CompanyLogoMark symbol={report.symbol} name={report.name} size="lead" />
301
311
  </Box>
302
- <ClippedText text={report.symbol} width={CALENDAR_SLOT_CELLS - 1} fg={ink} attributes={TextAttributes.BOLD} />
312
+ <Box style={LABEL_STYLE}>
313
+ <ClippedText text={tileLabel(report.symbol)} width={CALENDAR_SLOT_CELLS - 1} fg={ink} attributes={TextAttributes.BOLD} />
314
+ </Box>
303
315
  </Box>
304
316
  );
305
317
  }
@@ -32,11 +32,14 @@ export function resetEarningsCloudCaches() {
32
32
 
33
33
  const isDate = (value: unknown) => typeof value === "string" && /^\d{4}-\d{2}-\d{2}$/.test(value);
34
34
  const numberOrNull = (value: unknown) => value === null || (typeof value === "number" && Number.isFinite(value));
35
+ const currencyOrAbsent = (value: unknown) => value == null || (typeof value === "string" && /^[A-Z]{3}$/.test(value));
36
+ const linesOrAbsent = (value: unknown) => value == null || (Array.isArray(value) && value.every((line) => typeof line === "string"));
35
37
 
36
38
  function validReport(report: EarningsReport): boolean {
37
39
  return !!report && typeof report.symbol === "string" && isDate(report.date)
38
40
  && [null, "bmo", "dmh", "amc"].includes(report.timing)
39
41
  && [report.marketCap, report.epsEstimate, report.epsActual, report.revenueEstimate].every(numberOrNull)
42
+ && currencyOrAbsent(report.currency) && linesOrAbsent(report.listings)
40
43
  && (report.implied === null || (typeof report.implied === "object" && Number.isFinite(report.implied.move) && isDate(report.implied.expiry)))
41
44
  && (report.realized === null || (typeof report.realized === "object" && Number.isFinite(report.realized.move)));
42
45
  }
@@ -69,7 +72,7 @@ type HistoryClient = Pick<typeof apiClient, "getCloudEarningsHistory">;
69
72
 
70
73
  /** Names a calendar query: the cache's key, and how the board tells one week's reports from another's. */
71
74
  export const earningsCalendarKey = (query: EarningsCalendarQuery) =>
72
- `${query.from}:${query.to}:${query.perDay ?? ""}:${[...(query.symbols ?? [])].sort().join(",")}`;
75
+ `${query.from}:${query.to}:${query.perDay ?? ""}:${[...(query.symbols ?? [])].sort().join(",")}${query.markets ? `:${query.markets}` : ""}`;
73
76
 
74
77
  export async function fetchEarningsCalendar(query: EarningsCalendarQuery, client: CalendarClient = apiClient) {
75
78
  try {