gloomberb 0.20.16 → 0.20.17

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 (56) hide show
  1. package/package.json +1 -1
  2. package/src/api-client/data.ts +13 -3
  3. package/src/api-client/types/econ.ts +3 -0
  4. package/src/cli/commands/fred-series.ts +3 -1
  5. package/src/cli/commands/overview.ts +65 -13
  6. package/src/cli/csv-export.ts +73 -0
  7. package/src/cli/desktop-pane-shot.ts +3 -2
  8. package/src/cli/help.ts +4 -2
  9. package/src/cli/pane-functions/headless.ts +7 -2
  10. package/src/cli/pane-functions/index.ts +2 -2
  11. package/src/cli/pane-functions/screenshot-bridge.ts +4 -2
  12. package/src/cli/report-tables.ts +17 -3
  13. package/src/cli/result.ts +3 -6
  14. package/src/components/chart/composite/legend.tsx +37 -7
  15. package/src/components/ui/data-table/display-columns.ts +4 -1
  16. package/src/components/ui/data-table/hooks.ts +2 -3
  17. package/src/components/ui/data-table/index.tsx +4 -1
  18. package/src/components/ui/data-table/types.ts +11 -4
  19. package/src/components/ui/data-table/visible-range.ts +11 -1
  20. package/src/plugins/builtin/awards/pane.tsx +6 -2
  21. package/src/plugins/builtin/chart-composer/pane.tsx +4 -1
  22. package/src/plugins/builtin/credit-conditions/series.ts +2 -2
  23. package/src/plugins/builtin/earnings/board-model.ts +12 -0
  24. package/src/plugins/builtin/earnings/board-table.ts +7 -4
  25. package/src/plugins/builtin/earnings/board.tsx +2 -2
  26. package/src/plugins/builtin/earnings/highlight.ts +1 -1
  27. package/src/plugins/builtin/econ/calendar-model.ts +2 -0
  28. package/src/plugins/builtin/econ/fred-catalog.ts +1 -256
  29. package/src/plugins/builtin/econ-statistics/cache.ts +1 -1
  30. package/src/plugins/builtin/econ-statistics/client.ts +11 -10
  31. package/src/plugins/builtin/econ-statistics/detail.tsx +1 -0
  32. package/src/plugins/builtin/econ-statistics/headless.ts +42 -6
  33. package/src/plugins/builtin/econ-statistics/index.tsx +1 -0
  34. package/src/plugins/builtin/econ-statistics/pane.tsx +7 -2
  35. package/src/plugins/builtin/econ-statistics/stats.ts +2 -1
  36. package/src/plugins/builtin/econ-statistics/view.ts +9 -3
  37. package/src/plugins/builtin/shared/fred-catalog.ts +256 -0
  38. package/src/plugins/builtin/shared/series-cache.ts +3 -0
  39. package/src/plugins/builtin/shared/series-detail-chart.tsx +3 -0
  40. package/src/plugins/builtin/short-interest/watch-pane.tsx +7 -7
  41. package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +16 -0
  42. package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +8 -4
  43. package/src/plugins/builtin/time-sales/headless.ts +4 -1
  44. package/src/plugins/builtin/time-sales/pane.tsx +2 -0
  45. package/src/plugins/builtin/time-sales/window.ts +12 -0
  46. package/src/plugins/builtin/treasury-auctions/client.ts +4 -0
  47. package/src/plugins/builtin/treasury-auctions/treasury-direct.ts +2 -0
  48. package/src/plugins/builtin/treasury-daily/client.ts +23 -11
  49. package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +2 -0
  50. package/src/sources/gloomberb-cloud/fred-publisher.ts +25 -0
  51. package/src/sources/gloomberb-cloud/fred-series.ts +1 -1
  52. package/src/time-series/base-series.ts +3 -0
  53. package/src/time-series/ice-credit.ts +1 -0
  54. package/src/time-series/types.ts +1 -0
  55. package/src/types/headless.ts +4 -2
  56. package/src/utils/throttled-fetch.ts +15 -1
@@ -106,6 +106,12 @@ function nameWords(label: string): string[] {
106
106
  return label.split(" ").filter(Boolean);
107
107
  }
108
108
 
109
+ function sharedLegendContext(series: readonly ResolvedSeries[]): string | null {
110
+ const context = series[0]?.legendContext;
111
+ return context && series.length > 1 && series.every((entry) => entry.legendContext === context
112
+ && entry.label.split(" · ")[0]!.endsWith(` ${context}`)) ? context : null;
113
+ }
114
+
109
115
  /** The shortest a legend name reads on one line: its first word whole, with one `…` for the rest ("Bab…"). */
110
116
  export function shortestLegendName(label: string): string {
111
117
  const words = nameWords(label);
@@ -303,6 +309,7 @@ export function CompositeLegend({
303
309
  const valueDates = legendValueDates(series, scene, cursorValueById);
304
310
  // A series read against the right axis while others in its panel read against the left says which is its scale.
305
311
  const leftPanels = new Set(allSeries.filter((entry) => entry.axis === "left" && !entry.hidden).map((entry) => entry.panelId));
312
+ let context: string | null = null;
306
313
  const buildEntries = (withFiscalPeriods: boolean, withAxisNotes = true) => series.map((entry) => {
307
314
  const cue = lineCues.get(entry.id) ?? null;
308
315
  const downColor = !cue && directionDownColor && seriesColorsDirection(entry) ? directionDownColor : null;
@@ -342,8 +349,11 @@ export function CompositeLegend({
342
349
  && cursorValue?.value != null && Number.isFinite(cursorValue.value)
343
350
  ? `Value ${cursorValue.value} ${entry.unit}` : "";
344
351
  const tooltip = [fullText, exactTotal, details].filter(Boolean).join(" · ");
345
- const label = entry.label;
346
- const compactLabel = withoutListingExchange(entry.compactLabel ?? label);
352
+ const metric = entry.legendContext && entry.label.split(" · ")[0]!.endsWith(` ${entry.legendContext}`) ? entry.legendContext : null;
353
+ const shortLabel = withoutListingExchange(entry.compactLabel ?? entry.label);
354
+ const compact = !context && metric && !shortLabel.endsWith(` ${metric}`) ? `${shortLabel} ${metric}` : shortLabel;
355
+ const compactLabel = context && compact.endsWith(` ${context}`) ? compact.slice(0, -context.length - 1) : compact;
356
+ const label = context ? compactLabel : entry.label;
347
357
  const labelWidth = displayWidth(label);
348
358
  const text = [label, valueText].filter(Boolean).join(" ");
349
359
  return {
@@ -354,6 +364,7 @@ export function CompositeLegend({
354
364
  markerWidth,
355
365
  label,
356
366
  compactLabel,
367
+ metric,
357
368
  text,
358
369
  width: Math.max(1, displayWidth(text)) + markerWidth,
359
370
  labelWidth,
@@ -370,9 +381,17 @@ export function CompositeLegend({
370
381
  let entries = buildEntries(true);
371
382
  type LegendEntry = (typeof entries)[number];
372
383
  const otherNames = (target: LegendEntry) => entries.filter((other) => other !== target).map((other) => other.compactLabel);
384
+ const labelParts = (target: LegendEntry, label: string) => {
385
+ const suffix = !context && target.metric && label.endsWith(` ${target.metric}`) ? ` ${target.metric}` : "";
386
+ return { name: suffix ? label.slice(0, -suffix.length) : label, suffix };
387
+ };
388
+ const cutEntryLabel = (target: LegendEntry, label: string, budget: number) => {
389
+ const { name, suffix } = labelParts(target, label);
390
+ return wholeWordsCut(name, budget - displayWidth(suffix), otherNames(target)) + suffix;
391
+ };
373
392
  const setEntryLabel = (target: LegendEntry, label: string, labelWidth: number) => {
374
393
  target.label = label;
375
- const shown = wholeWordsCut(label, labelWidth, otherNames(target));
394
+ const shown = cutEntryLabel(target, label, labelWidth);
376
395
  target.labelWidth = displayWidth(shown);
377
396
  target.text = [shown, target.valueText].filter(Boolean).join(" ");
378
397
  target.width = Math.max(1, displayWidth(target.text)) + target.markerWidth;
@@ -385,7 +404,12 @@ export function CompositeLegend({
385
404
  // line up with the query bar and tables above and below the chart.
386
405
  const inset = width > 1 ? 1 : 0;
387
406
  const leadWidth = valueDates.lead ? displayWidth(valueDates.lead) + 1 : 0;
388
- const innerWidth = Math.max(0, width - inset - leadWidth);
407
+ if (measureSeriesWidth() > width - inset - leadWidth - (accessory ? accessoryWidth ?? 14 : 0)) {
408
+ context = sharedLegendContext(series);
409
+ if (context) entries = buildEntries(true);
410
+ }
411
+ const contextWidth = context ? displayWidth(context) + 1 : 0;
412
+ const innerWidth = Math.max(0, width - inset - leadWidth - contextWidth);
389
413
  const resolvedAccessoryWidth = accessory
390
414
  ? Math.max(1, Math.min(innerWidth, Math.floor(accessoryWidth ?? 14)))
391
415
  : 0;
@@ -412,7 +436,8 @@ export function CompositeLegend({
412
436
  const key = `${apart ? "apart" : "first"}:${label}`;
413
437
  let name = known.get(key);
414
438
  if (name === undefined) {
415
- name = apart ? shortestLegendNameAmong(label, otherNames(entry)) : shortestLegendName(label);
439
+ const parts = labelParts(entry, label);
440
+ name = (apart ? shortestLegendNameAmong(parts.name, otherNames(entry)) : shortestLegendName(parts.name)) + parts.suffix;
416
441
  known.set(key, name);
417
442
  }
418
443
  return name;
@@ -446,7 +471,7 @@ export function CompositeLegend({
446
471
  Math.max(1, widthBeforeAccessory - entry.markerWidth - (entry.valueText ? displayWidth(entry.valueText) + 1 : 0)),
447
472
  );
448
473
  const wrappedWidths = entries.map((entry) => entry.markerWidth + Math.max(1, displayWidth(
449
- [wholeWordsCut(entry.compactLabel, wrappedLabelWidth(entry), otherNames(entry)), entry.valueText].filter(Boolean).join(" "),
474
+ [cutEntryLabel(entry, entry.compactLabel, wrappedLabelWidth(entry)), entry.valueText].filter(Boolean).join(" "),
450
475
  )));
451
476
  wantedRows = packLegendLines(wrappedWidths, widthBeforeAccessory).length;
452
477
  if (rows > 1) {
@@ -460,7 +485,7 @@ export function CompositeLegend({
460
485
  const widest = Math.max(...entries.map((entry) => entry.labelWidth));
461
486
  for (let cap = widest - 1; cap >= 1; cap -= 1) {
462
487
  const packed = packLegendLines(entries.map((entry) => entry.markerWidth + Math.max(1, displayWidth(
463
- [wholeWordsCut(entry.compactLabel, Math.min(cap, wrappedLabelWidth(entry)), otherNames(entry)), entry.valueText].filter(Boolean).join(" "),
488
+ [cutEntryLabel(entry, entry.compactLabel, Math.min(cap, wrappedLabelWidth(entry))), entry.valueText].filter(Boolean).join(" "),
464
489
  ))), widthBeforeAccessory);
465
490
  if (packed.length <= rows) {
466
491
  lines = packed;
@@ -707,6 +732,11 @@ export function CompositeLegend({
707
732
  <Text fg={themeColors.textMuted}>{valueDates.lead}</Text>
708
733
  </Box>
709
734
  ) : null}
735
+ {context ? (
736
+ <Box width={contextWidth} height={1} flexShrink={0} data-gloom-role="composite-chart-legend-context">
737
+ <Text fg={themeColors.textMuted}>{context}</Text>
738
+ </Box>
739
+ ) : null}
710
740
  {seriesWidth > 0 && lines ? (
711
741
  <Box flexDirection="column" width={seriesWidth} height={lineCount} flexShrink={0}>
712
742
  {lines.map((line, index) => scrollLine(line, index, index === lines!.length - 1 ? scrollRef : undefined))}
@@ -6,8 +6,11 @@ export function dataTableDisplayColumns<T, C extends DataTableColumn>(
6
6
  visibleRange?: DataTableVisibleRange | null,
7
7
  ): C[] {
8
8
  if (!props.columns.some((column) => column.omitWhenEmpty)) return props.columns;
9
+ // A row cut at the viewport's edge is not in view; a viewport shorter than a row has only the cut ones.
10
+ const inView = visibleRange && visibleRange.wholeStart !== undefined && visibleRange.wholeEnd !== undefined
11
+ && visibleRange.wholeEnd > visibleRange.wholeStart ? { start: visibleRange.wholeStart, end: visibleRange.wholeEnd } : visibleRange;
9
12
  return props.columns.filter((column) => !column.omitWhenEmpty || props.items.some((item, index) => {
10
- if (column.omitWhenEmpty === "visible" && visibleRange && (index < visibleRange.start || index >= visibleRange.end)) return false;
13
+ if (column.omitWhenEmpty === "visible" && inView && (index < inView.start || index >= inView.end)) return false;
11
14
  if (props.renderSectionHeader?.(item, index)) return false;
12
15
  const cell = props.renderCell(item, column, index, { selected: props.isSelected(item, index) });
13
16
  const text = cell.text.trim();
@@ -1,7 +1,7 @@
1
1
  import { useCallback, useRef } from "react";
2
2
  import { useAppDispatch, usePaneInstance } from "../../../state/app/context";
3
3
  import type { DataTableProps, DataTableVisibleRange } from "./types";
4
- import { resolveDataTableVisibleRange } from "./visible-range";
4
+ import { resolveDataTableVisibleRange, sameVisibleRange } from "./visible-range";
5
5
 
6
6
  /** Focuses the pane that owns the table, as every click inside it does. */
7
7
  export function useFocusOwningPane(): () => void {
@@ -37,8 +37,7 @@ export function useVisibleRangeEmitter({
37
37
  if (
38
38
  previous !== null
39
39
  && previous.key === visibleRangeKey
40
- && previous.range.start === range.start
41
- && previous.range.end === range.end
40
+ && sameVisibleRange(previous.range, range)
42
41
  ) return;
43
42
  lastVisibleRangeRef.current = { key: visibleRangeKey, range };
44
43
  onVisibleRangeChange(range);
@@ -15,6 +15,7 @@ import { headerCase } from "../header-case";
15
15
  import { figureColumnCells } from "./render-cell";
16
16
  import { useDataTableColumnOrder } from "./use-column-order";
17
17
  import { dataTableDisplayColumns } from "./display-columns";
18
+ import { sameVisibleRange } from "./visible-range";
18
19
 
19
20
  export type {
20
21
  DataTableCell,
@@ -42,7 +43,9 @@ export function DataTable<T, C extends DataTableColumn = DataTableColumn>(
42
43
  };
43
44
  const [visibleRange, setVisibleRange] = useState<DataTableVisibleRange | null>(null);
44
45
  const onVisibleRangeChange = useCallback((range: DataTableVisibleRange) => {
45
- setVisibleRange((previous) => previous?.start === range.start && previous.end === range.end ? previous : range);
46
+ // A viewport not laid out yet reports no rows: it would hide every in-view
47
+ // column for a frame, so the columns wait for a range with rows in it.
48
+ if (range.end > range.start) setVisibleRange((previous) => previous && sameVisibleRange(previous, range) ? previous : range);
46
49
  ownProps.onVisibleRangeChange?.(range);
47
50
  }, [ownProps.onVisibleRangeChange]);
48
51
  const displayColumns = useMemo(() => dataTableDisplayColumns(props, visibleRange),
@@ -30,10 +30,10 @@ export type DataTableColumn = Pick<
30
30
  /**
31
31
  * Leave this column out of the pane while every data row renders an empty
32
32
  * cell or MISSING_VALUE. Use for unavailable coverage, not a pending event
33
- * (mayBeBlank). "visible" checks just the viewport, for a chronological
34
- * history whose older rows have coverage its recent rows lack. Scrolling
35
- * restores the column when a row has a value. Reports and CSV exports keep
36
- * the column and its raw cells.
33
+ * (mayBeBlank). "visible" checks just the rows wholly in view, for a
34
+ * chronological history whose older rows have coverage its recent rows
35
+ * lack. Scrolling restores the column when a row has a value. Reports and
36
+ * CSV exports keep the column and its raw cells.
37
37
  */
38
38
  omitWhenEmpty?: boolean | "visible";
39
39
  };
@@ -163,6 +163,13 @@ export interface DataTableVisibleRange {
163
163
  start: number;
164
164
  /** Exclusive end of the visible row range. */
165
165
  end: number;
166
+ /**
167
+ * The rows wholly in view, without the buffer, where they are not
168
+ * start/end: a row the viewport cuts at an edge, drawn in part, is left
169
+ * out. A capture that ends on a whole row draws exactly these.
170
+ */
171
+ wholeStart?: number;
172
+ wholeEnd?: number;
166
173
  }
167
174
 
168
175
  export interface DataTableProps<
@@ -21,7 +21,17 @@ export function resolveDataTableVisibleRange({
21
21
  const extra = Number.isFinite(buffer) ? Math.max(0, Math.floor(buffer)) : 0;
22
22
  const start = Math.min(count, Math.floor(offset / size));
23
23
  const end = Math.min(count, Math.max(start, Math.ceil((offset + viewport) / size)));
24
- return { start: Math.max(0, start - extra), end: Math.min(count, end + extra) };
24
+ // A pixel of subpixel layout does not cut a row.
25
+ const wholeStart = Math.max(0, Math.min(count, Math.ceil(offset / size - WHOLE_ROW_TOLERANCE)));
26
+ const wholeEnd = Math.min(count, Math.max(wholeStart, Math.floor((offset + viewport) / size + WHOLE_ROW_TOLERANCE)));
27
+ const range = { start: Math.max(0, start - extra), end: Math.min(count, end + extra) };
28
+ return range.start === wholeStart && range.end === wholeEnd ? range : { ...range, wholeStart, wholeEnd };
29
+ }
30
+
31
+ const WHOLE_ROW_TOLERANCE = 0.05;
32
+
33
+ export function sameVisibleRange(a: DataTableVisibleRange, b: DataTableVisibleRange): boolean {
34
+ return a.start === b.start && a.end === b.end && a.wholeStart === b.wholeStart && a.wholeEnd === b.wholeEnd;
25
35
  }
26
36
 
27
37
  /** The first visible row, in rows, that brings `targetIndex` into view. */
@@ -56,9 +56,13 @@ const COLUMN = {
56
56
  dateBasis: { id: "dateBasis", label: "Date basis", width: 14, align: "left" },
57
57
  } satisfies Record<string, DataTableColumn>;
58
58
  // Who won, what for, from whom and how much come first, so a 1280-wide pane
59
- // shows the contract; the period and date basis follow.
59
+ // shows the contract; the period and date basis follow. The feed is newest
60
+ // first across sources, so a screen of notices without an obligation or
61
+ // ceiling (UK, EU, Japan) can sit above older awards that report one: each
62
+ // amount shows while a row in view has it.
60
63
  const FEED_COLUMNS: DataTableColumn[] = [COLUMN.date, COLUMN.recipient, COLUMN.ticker, COLUMN.title, COLUMN.agency, COLUMN.currency,
61
- COLUMN.value, COLUMN.obligated, COLUMN.ceiling, COLUMN.country, COLUMN.period, COLUMN.dateBasis];
64
+ ...[COLUMN.value, COLUMN.obligated, COLUMN.ceiling].map((column) => ({ ...column, omitWhenEmpty: "visible" as const })),
65
+ COLUMN.country, COLUMN.period, COLUMN.dateBasis];
62
66
  const EVENT_COLUMNS: DataTableColumn[] = [COLUMN.date, COLUMN.recipient, COLUMN.ticker,
63
67
  { id: "ratio", label: "% revenue", width: 11, align: "right" }, COLUMN.currency, { ...COLUMN.value, label: "Compared value" },
64
68
  { id: "revenue", label: "Annual revenue", width: 14, align: "right" }, { id: "basis", label: "Value basis", width: 13, align: "left" },
@@ -494,7 +494,8 @@ function ChartComposerSurface({
494
494
  if (authored?.source.kind === "security" && authored.source.fieldId.startsWith("valuation.")) {
495
495
  const field = getTimeSeriesField(authored.source.fieldId);
496
496
  return { ...entry, label: authored.label?.trim()
497
- || `${authored.source.instrument.symbol} ${field?.shortLabel ?? "Multiple"}` };
497
+ || `${authored.source.instrument.symbol} ${field?.shortLabel ?? "Multiple"}`,
498
+ legendContext: authored.label?.trim() ? undefined : field?.shortLabel ?? "Multiple" };
498
499
  }
499
500
  const name = nameSeries ? listings.names.get(entry.id) : undefined;
500
501
  const company = name ? shortCompanyName(name) : "";
@@ -518,6 +519,8 @@ function ChartComposerSurface({
518
519
  ...missing.map((entry): ResolvedSeries => ({
519
520
  id: entry.id,
520
521
  label: chartSeriesLabel(entry),
522
+ legendContext: entry.label?.trim() || entry.source.kind !== "security" ? undefined
523
+ : getTimeSeriesField(entry.source.fieldId)?.seriesLabel ?? getTimeSeriesField(entry.source.fieldId)?.shortLabel,
521
524
  color: entry.color ?? colors.textDim,
522
525
  unit: "",
523
526
  unitGroup: "unknown",
@@ -1,6 +1,6 @@
1
1
  import { fredSeriesUrl } from "../../../sources/gloomberb-cloud/fred-series";
2
2
  import type { SeriesDefinition } from "../../../series/types";
3
- import { ICE_CREDIT_SERIES, ICE_HISTORY_LIMIT_NOTICE } from "../../../time-series/ice-credit";
3
+ import { ICE_CREDIT_PUBLISHER, ICE_CREDIT_SERIES, ICE_HISTORY_LIMIT_NOTICE } from "../../../time-series/ice-credit";
4
4
 
5
5
  /** Corporate bond option-adjusted spreads by rating and region, and the effective yields of the US indexes. */
6
6
  export const CREDIT_SPREAD_SERIES: readonly SeriesDefinition[] = ICE_CREDIT_SERIES.map((series) => ({
@@ -11,7 +11,7 @@ export const CREDIT_SPREAD_SERIES: readonly SeriesDefinition[] = ICE_CREDIT_SERI
11
11
  frequency: "daily",
12
12
  group: "Credit",
13
13
  tags: [series.measure, ...series.tags, "corporate bonds"],
14
- publisher: "FRED",
14
+ publisher: ICE_CREDIT_PUBLISHER,
15
15
  // A fixed note on every ICE series. G and CRD read the same sentence from each series' FRED notes instead, so there it lapses if FRED lifts the limit.
16
16
  limitation: ICE_HISTORY_LIMIT_NOTICE,
17
17
  url: fredSeriesUrl(series.seriesId),
@@ -39,6 +39,8 @@ export interface BoardReport {
39
39
  revenueEstimate: number | null;
40
40
  impliedMove: number | null;
41
41
  averageMove: number | null;
42
+ /** The move on a report already out: the close after it over the close before, signed. Null until both closes are in. */
43
+ realizedMove: number | null;
42
44
  owned: Ownership | null;
43
45
  /** ISO currency of the EPS and sales figures; null when the report has none. The market cap is always dollars. */
44
46
  currency?: string | null;
@@ -156,6 +158,7 @@ export function boardReport(report: EarningsCalendarReport, owned: ReadonlyMap<s
156
158
  revenueEstimate: report.revenueEstimate,
157
159
  impliedMove: report.implied?.move ?? null,
158
160
  averageMove: report.averageReports >= MIN_AVERAGE_REPORTS ? report.averageMove : null,
161
+ realizedMove: report.realized?.move ?? null,
159
162
  owned: owned.get(report.symbol) ?? null,
160
163
  // The board's US reports are in dollars; a listing abroad's say their own.
161
164
  currency: report.currency ?? "USD",
@@ -248,6 +251,7 @@ export function fallbackReport(event: EarningsEvent, owned: ReadonlyMap<string,
248
251
  revenueEstimate: dollars("revenueEstimate"),
249
252
  impliedMove: null,
250
253
  averageMove: null,
254
+ realizedMove: null,
251
255
  owned: owned.get(event.symbol) ?? null,
252
256
  currency: epsEstimate != null || dollars("revenueEstimate") != null ? "USD" : null,
253
257
  };
@@ -274,6 +278,14 @@ export function reportMove(report: Pick<BoardReport, "date" | "dateStatus" | "ti
274
278
  return percent != null && Number.isFinite(percent) ? percent / 100 : null;
275
279
  }
276
280
 
281
+ /**
282
+ * The MOVE a board row shows: the move so far on a report out today
283
+ * (reportMove), else the move across a report already out (`realizedMove`).
284
+ */
285
+ export function boardMove(report: BoardReport, quote: Quote | null | undefined, today: string): number | null {
286
+ return reportMove(report, quote, today) ?? report.realizedMove;
287
+ }
288
+
277
289
  function compare(left: BoardReport, right: BoardReport, sort: BoardSort): number {
278
290
  const value = (report: BoardReport) =>
279
291
  sort.column === "cap" ? report.marketCap : sort.column === "implied" ? report.impliedMove
@@ -27,10 +27,13 @@ const ALL_COLUMNS: BoardColumn[] = [
27
27
  { id: "name", label: "NAME", width: NAME_MIN_WIDTH, align: "left" },
28
28
  { id: "when", label: "WHEN", width: 7, align: "left" },
29
29
  { id: "status", label: "STATUS", width: 9, align: "left" },
30
- { id: "implied", label: "IMPLIED", width: 7, align: "right" },
30
+ // The implied move, the move on the report and their average are left out
31
+ // while no report in view has one: small caps list no options and too few
32
+ // reports to average, and a move is only measured on the day a report is out.
33
+ { id: "implied", label: "IMPLIED", width: 7, align: "right", omitWhenEmpty: "visible" },
31
34
  // The move, the actual EPS and its surprise come with the report: an upcoming one has none.
32
- { id: "move", label: "MOVE", width: 7, align: "right", mayBeBlank: true },
33
- { id: "average", label: "AVG MOVE", width: 8, align: "right" },
35
+ { id: "move", label: "MOVE", width: 7, align: "right", mayBeBlank: true, omitWhenEmpty: "visible" },
36
+ { id: "average", label: "AVG MOVE", width: 8, align: "right", omitWhenEmpty: "visible" },
34
37
  // The currency of the EPS and sales figures, on a board with a listing abroad's (CNY for Tencent).
35
38
  { id: "ccy", label: "CCY", width: 3, align: "left" },
36
39
  { id: "epsEstimate", label: "EPS EST", width: 7, align: "right" },
@@ -120,7 +123,7 @@ export function renderBoardSection(row: BoardRow) {
120
123
  export interface BoardCellContext {
121
124
  /** Whether the STATUS column is on screen; without it the WHEN cell says which reports are out. */
122
125
  statusShown: boolean;
123
- /** The move on a report out today (reportMove); "loading" while its quote is. */
126
+ /** The move on the report (boardMove): so far for one out today, across it for one out before; "loading" while today's quote is. */
124
127
  move: (report: BoardReport) => number | "loading" | null;
125
128
  /** The desktop and the web lead each name with the company's logo; the terminal draws none. */
126
129
  logos?: boolean;
@@ -41,7 +41,7 @@ import {
41
41
  newYorkToday,
42
42
  ownershipBySymbol,
43
43
  relativeDays,
44
- reportMove,
44
+ boardMove,
45
45
  type BoardReport,
46
46
  type BoardRow,
47
47
  type BoardSort,
@@ -302,7 +302,7 @@ export function EarningsBoard({ focused, width, height, scopedSymbols, highlight
302
302
  logos,
303
303
  move: (report) => {
304
304
  const state = quotesRef.current.get(report.symbol);
305
- const move = reportMove(report, state?.quote, today);
305
+ const move = boardMove(report, state?.quote, today);
306
306
  return move == null && report.dateStatus === "reported" && report.date === today && isBoardRowLoading(state) ? "loading" : move;
307
307
  },
308
308
  };
@@ -32,7 +32,7 @@ export async function loadEarningsHighlight(symbol: string, today: string, provi
32
32
  marketCap: source?.marketCap ?? null,
33
33
  epsEstimate: row.epsEstimate, epsAnalysts: row.epsAnalysts, epsActual: row.epsActual,
34
34
  provisional: row.provisional, epsBasis: row.epsBasis, epsSurprise: row.epsSurprise,
35
- revenueEstimate: row.revenueEstimate, impliedMove: row.implied, averageMove: null,
35
+ revenueEstimate: row.revenueEstimate, impliedMove: row.implied, averageMove: null, realizedMove: row.move,
36
36
  owned: null, currency: row.currency ?? "USD",
37
37
  },
38
38
  stale: (history.status === "fulfilled" && !!history.value?.stale) || (upcoming.status === "fulfilled" && upcoming.value.stale),
@@ -458,6 +458,8 @@ const POLICY_DECISION_TITLES: Readonly<Record<string, string>> = {
458
458
  * `usda` every row the U.S. Department of Agriculture publishes.
459
459
  */
460
460
  export function matchesEventSearch(event: Pick<EconEvent, "country" | "event" | "actual" | "forecast" | "prior" | "source">, query: string): boolean {
461
+ const alternatives = query.split(/\s+OR\s+/i);
462
+ if (alternatives.length > 1) return alternatives.some((alternative) => alternative.trim() && matchesEventSearch(event, alternative));
461
463
  const words = query.split(/\s+/).map(compactName).filter(Boolean);
462
464
  if (words.length === 0) return true;
463
465
  const names = eventSearchNames(event);