@gloom-sh/terminal 0.20.5 → 0.20.6

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 (127) hide show
  1. package/README.md +1 -1
  2. package/README.zh-CN.md +1 -1
  3. package/package.json +2 -1
  4. package/src/api-client/data.ts +10 -2
  5. package/src/api-client/hk-tenders.ts +59 -0
  6. package/src/api-client/index.ts +1 -0
  7. package/src/api-client/types/econ.ts +20 -2
  8. package/src/app.tsx +18 -13
  9. package/src/architecture/floating-promise-allowlist.json +313 -0
  10. package/src/cli/commands/market.ts +164 -40
  11. package/src/cli/commands/news-search.ts +22 -7
  12. package/src/cli/commands/overview.ts +12 -6
  13. package/src/cli/commands/ticker.ts +3 -1
  14. package/src/cli/early-command.ts +2 -0
  15. package/src/cli/errors.ts +10 -1
  16. package/src/cli/fx-forward.ts +76 -12
  17. package/src/cli/fx-pair.ts +1 -1
  18. package/src/cli/fx-quote-rate.ts +23 -0
  19. package/src/cli/help.ts +1 -0
  20. package/src/cli/index-roots.ts +5 -4
  21. package/src/cli/index.ts +40 -3
  22. package/src/cli/known-gaps.ts +11 -8
  23. package/src/cli/listing-arg.ts +6 -4
  24. package/src/cli/options.ts +52 -3
  25. package/src/cli/output-file.ts +5 -3
  26. package/src/cli/pane-functions/catalog.ts +15 -0
  27. package/src/cli/pane-functions/function-help.ts +4 -4
  28. package/src/cli/pane-functions/headless.ts +9 -4
  29. package/src/cli/pane-functions/index.ts +6 -4
  30. package/src/cli/pane-functions/resolver.ts +2 -2
  31. package/src/cli/result.ts +21 -2
  32. package/src/cli/spreadsheet-hint.ts +7 -3
  33. package/src/cli/treasury-yields.ts +5 -3
  34. package/src/components/chart/composite/legend.tsx +40 -2
  35. package/src/components/command-bar/workflow/tickers.ts +2 -2
  36. package/src/components/data-table/view.tsx +9 -2
  37. package/src/components/ui/data-table/opentui/index.tsx +11 -4
  38. package/src/components/ui/data-table/opentui/model.ts +8 -6
  39. package/src/components/ui/data-table/types.ts +6 -1
  40. package/src/components/ui/table-layout.ts +38 -1
  41. package/src/docs/snapshot.json +3 -3
  42. package/src/market-data/market/change-basis.ts +9 -5
  43. package/src/market-data/market/dated-previous-close.ts +57 -6
  44. package/src/market-data/quotes/contributions.ts +2 -0
  45. package/src/market-data/quotes/listing-enterprise-value.ts +50 -0
  46. package/src/plugins/builtin/alerts/metric-data.ts +15 -2
  47. package/src/plugins/builtin/backtest/headless.ts +1 -1
  48. package/src/plugins/builtin/cds/model.ts +0 -6
  49. package/src/plugins/builtin/chart-composer/formula.ts +16 -3
  50. package/src/plugins/builtin/chart-composer/headless-schema.ts +2 -0
  51. package/src/plugins/builtin/chart-composer/headless.ts +2 -1
  52. package/src/plugins/builtin/chart-composer/presets.ts +1 -0
  53. package/src/plugins/builtin/cloud/askg/pane.tsx +55 -13
  54. package/src/plugins/builtin/credit-boards/cdx-pane.tsx +20 -7
  55. package/src/plugins/builtin/credit-boards/client.ts +8 -0
  56. package/src/plugins/builtin/credit-boards/headless.ts +4 -1
  57. package/src/plugins/builtin/credit-boards/model.ts +58 -4
  58. package/src/plugins/builtin/credit-boards/series.ts +63 -6
  59. package/src/plugins/builtin/credit-boards/sovr-pane.tsx +3 -2
  60. package/src/plugins/builtin/credit-conditions/headless.ts +24 -6
  61. package/src/plugins/builtin/credit-conditions/index.tsx +1 -1
  62. package/src/plugins/builtin/credit-conditions/model.ts +12 -6
  63. package/src/plugins/builtin/credit-conditions/series.ts +2 -1
  64. package/src/plugins/builtin/econ/calendar-model.ts +41 -7
  65. package/src/plugins/builtin/econ/calendar-source.ts +7 -1
  66. package/src/plugins/builtin/econ/index.tsx +41 -8
  67. package/src/plugins/builtin/econ/types.ts +3 -0
  68. package/src/plugins/builtin/fixed-income/index.tsx +2 -0
  69. package/src/plugins/builtin/fx-matrix/index.tsx +44 -14
  70. package/src/plugins/builtin/help/keybindings-editor.tsx +6 -2
  71. package/src/plugins/builtin/portfolio-list/cli/render.ts +20 -3
  72. package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +5 -1
  73. package/src/plugins/builtin/research/headless-schema.ts +4 -3
  74. package/src/plugins/builtin/research/relative-valuation-columns.ts +145 -47
  75. package/src/plugins/builtin/research/relative-valuation-currency.ts +31 -0
  76. package/src/plugins/builtin/research/relative-valuation-headless.ts +25 -8
  77. package/src/plugins/builtin/research/relative-valuation-model.ts +40 -9
  78. package/src/plugins/builtin/research/relative-valuation-pane.tsx +3 -2
  79. package/src/plugins/builtin/research/relative-valuation-peers.ts +2 -2
  80. package/src/plugins/builtin/thirteenf/api.ts +47 -4
  81. package/src/plugins/builtin/ticker-detail/data-panes/historical-prices.tsx +8 -7
  82. package/src/plugins/builtin/ticker-detail/data-panes/history-bars.ts +8 -5
  83. package/src/plugins/builtin/ticker-detail/financials/model.ts +6 -2
  84. package/src/plugins/builtin/ticker-detail/financials/tab.tsx +1 -1
  85. package/src/plugins/builtin/ticker-detail/headless.ts +6 -4
  86. package/src/plugins/builtin/treasury-auctions/cache.ts +36 -2
  87. package/src/plugins/builtin/treasury-auctions/headless.ts +42 -4
  88. package/src/plugins/builtin/treasury-auctions/hk-headless.ts +126 -0
  89. package/src/plugins/builtin/treasury-auctions/hk-view.tsx +347 -0
  90. package/src/plugins/builtin/treasury-auctions/hk.ts +363 -0
  91. package/src/plugins/builtin/treasury-auctions/index.tsx +14 -1
  92. package/src/plugins/builtin/treasury-auctions/model.ts +16 -8
  93. package/src/plugins/builtin/treasury-auctions/pane.tsx +45 -21
  94. package/src/portfolio/collection-name.ts +22 -0
  95. package/src/renderers/dom/data-table/frozen-column.ts +3 -1
  96. package/src/renderers/dom/data-table/index.tsx +27 -9
  97. package/src/renderers/dom/data-table/row.tsx +2 -0
  98. package/src/renderers/electrobun/bun/desktop/backend.ts +27 -24
  99. package/src/renderers/electrobun/bun/desktop/detached-windows.ts +3 -3
  100. package/src/renderers/electrobun/bun/desktop/snapshot-commit.ts +77 -0
  101. package/src/renderers/electrobun/shared/protocol.ts +4 -0
  102. package/src/renderers/electrobun/view/backend-rpc.ts +3 -0
  103. package/src/renderers/electrobun/view/desktop/window/bridge.ts +3 -0
  104. package/src/sources/gloomberb-cloud/normalizers.ts +9 -5
  105. package/src/sources/provider-router/cache.ts +3 -1
  106. package/src/sync/controller.ts +17 -2
  107. package/src/sync/other-window-tabs.ts +32 -1
  108. package/src/sync/react.ts +4 -4
  109. package/src/time-series/bar-spacing.ts +33 -0
  110. package/src/time-series/base-series.ts +21 -3
  111. package/src/time-series/chart-bounds.ts +31 -0
  112. package/src/time-series/field-catalog.ts +17 -0
  113. package/src/time-series/fundamentals.ts +143 -11
  114. package/src/time-series/ice-credit.ts +32 -6
  115. package/src/time-series/resolve.ts +9 -5
  116. package/src/time-series/session-bar.ts +78 -9
  117. package/src/time-series/studies/formula.ts +53 -10
  118. package/src/time-series/studies/pair.ts +18 -7
  119. package/src/time-series/studies/units.ts +49 -2
  120. package/src/time-series/types.ts +12 -0
  121. package/src/types/desktop-window.ts +2 -0
  122. package/src/types/financials.ts +6 -0
  123. package/src/types/headless.ts +8 -0
  124. package/src/utils/cli-output.ts +6 -3
  125. package/src/utils/ebitda.ts +128 -0
  126. package/src/utils/format.ts +1 -1
  127. package/src/utils/shell-word.ts +13 -0
@@ -9,6 +9,24 @@ import {
9
9
  } from "./client";
10
10
  import { creditRegion, creditSeriesIn, type CreditConditionRow } from "./model";
11
11
 
12
+ const REGION_VALUES = [
13
+ { value: "all" },
14
+ { value: "us", aliases: ["usa", "united states", "america"] },
15
+ { value: "euro", aliases: ["eu", "eur", "europe", "eurozone", "euro area", "ea"] },
16
+ { value: "em", aliases: ["emerging", "emerging markets", "emerging market", "ems"] },
17
+ { value: "asia", aliases: ["asian", "apac", "asia pacific", "asia em"] },
18
+ ];
19
+
20
+ const regionToken = (text: string) => text.toLowerCase().replace(/[^a-z]/g, "");
21
+
22
+ /** A region as typed (`Asia`, `emerging markets`), as the option's value. */
23
+ function regionValue(text: string): string {
24
+ const token = regionToken(text);
25
+ const found = REGION_VALUES.find((region) => [region.value, ...region.aliases ?? []].some((name) => regionToken(name) === token));
26
+ if (!found) throw new Error(`Invalid --region value "${text}". Use one or more of: ${REGION_VALUES.map(({ value }) => value).join(", ")}.`);
27
+ return found.value;
28
+ }
29
+
12
30
  const COLUMNS = [
13
31
  { key: "label", header: "Index" },
14
32
  { key: "seriesId", header: "FRED series" },
@@ -43,14 +61,14 @@ function createCreditConditionsHeadless(
43
61
  argument: { kind: "none" },
44
62
  options: [{
45
63
  key: "region",
46
- description: "Indexes to list. FRED publishes euro high yield but no euro investment grade spread.",
64
+ description: "Indexes to list, one region or several as a comma list. em is the emerging markets corporate indexes, Asia's among them; "
65
+ + "FRED publishes euro high yield but no euro investment grade spread.",
47
66
  type: "enum",
48
- values: [
49
- { value: "all" },
50
- { value: "us", aliases: ["usa", "united states", "america"] },
51
- { value: "euro", aliases: ["eu", "eur", "europe", "eurozone", "euro area", "ea"] },
52
- ],
67
+ list: true,
68
+ values: REGION_VALUES,
53
69
  defaultValue: "all",
70
+ example: "--region asia,us",
71
+ normalize: (value) => value.split(",").map((part) => part.trim()).filter(Boolean).map((part) => regionValue(part)).join(","),
54
72
  }],
55
73
  columns: COLUMNS,
56
74
  describe: "Credit Spreads",
@@ -154,7 +154,7 @@ export const creditConditionsModule: PluginModule = {
154
154
  id: "credit-conditions-pane",
155
155
  paneId: "credit-conditions",
156
156
  label: "Credit Spreads",
157
- description: "ICE BofA option-adjusted spreads from FRED: US investment grade and high yield by rating, and euro high yield.",
157
+ description: "ICE BofA option-adjusted spreads from FRED: US investment grade and high yield by rating, euro high yield, and emerging markets and Asia corporates.",
158
158
  keywords: ["credit", "spread", "oas", "corporate", "high yield", "investment grade", "macro", "euro", "europe", "bb", "ccc", "rating"],
159
159
  shortcut: { prefix: "CRD" },
160
160
  headless: creditConditionsHeadless,
@@ -5,19 +5,25 @@ import { ICE_SPREAD_SERIES, type IceCreditSeries } from "../../../time-series/ic
5
5
 
6
6
  export type CreditSeriesDefinition = Pick<IceCreditSeries, "seriesId" | "label" | "region">;
7
7
 
8
- /** US investment grade and high yield by rating, then euro high yield. */
8
+ /** US investment grade and high yield by rating, euro high yield, then emerging markets corporates by grade and region. */
9
9
  export const CREDIT_SERIES: readonly CreditSeriesDefinition[] = ICE_SPREAD_SERIES
10
10
  .map(({ seriesId, label, region }) => ({ seriesId, label, region }));
11
11
 
12
- const CREDIT_REGIONS = ["all", "us", "euro"] as const;
12
+ const CREDIT_REGIONS = ["all", "us", "euro", "em", "asia"] as const;
13
13
  type CreditRegion = typeof CREDIT_REGIONS[number];
14
14
 
15
- export function creditRegion(value: unknown): CreditRegion {
16
- return CREDIT_REGIONS.includes(value as CreditRegion) ? value as CreditRegion : "all";
15
+ /** The regions to list, from a setting or `--region` (one, or a comma list such as `asia,us`); every one when none is known. */
16
+ export function creditRegion(value: unknown): readonly CreditRegion[] {
17
+ const regions = typeof value === "string"
18
+ ? [...new Set(value.split(",").map((part) => part.trim().toLowerCase()))].filter((part): part is CreditRegion => CREDIT_REGIONS.includes(part as CreditRegion))
19
+ : [];
20
+ return regions.length === 0 || regions.includes("all") ? ["all"] : regions;
17
21
  }
18
22
 
19
- export function creditSeriesIn(region: CreditRegion): readonly CreditSeriesDefinition[] {
20
- return region === "all" ? CREDIT_SERIES : CREDIT_SERIES.filter((series) => series.region === region);
23
+ /** The series in the regions, in the board's order: emerging markets take in Asia, its biggest region. */
24
+ export function creditSeriesIn(regions: readonly CreditRegion[]): readonly CreditSeriesDefinition[] {
25
+ if (regions.includes("all")) return CREDIT_SERIES;
26
+ return CREDIT_SERIES.filter((series) => regions.includes(series.region) || (series.region === "asia" && regions.includes("em")));
21
27
  }
22
28
 
23
29
  export interface CreditConditionRow {
@@ -6,7 +6,8 @@ import { ICE_CREDIT_SERIES, ICE_HISTORY_LIMIT_NOTICE } from "../../../time-serie
6
6
  export const CREDIT_SPREAD_SERIES: readonly SeriesDefinition[] = ICE_CREDIT_SERIES.map((series) => ({
7
7
  id: `fred:${series.seriesId}`,
8
8
  name: series.name,
9
- unit: "%",
9
+ // Spreads in bp, as G draws them; yields in percent.
10
+ unit: series.measure === "spread" ? "bp" : "%",
10
11
  frequency: "daily",
11
12
  group: "Credit",
12
13
  tags: [series.measure, ...series.tags, "corporate bonds"],
@@ -123,15 +123,41 @@ export function dayLabel(d: Date, today: Date): string {
123
123
  const MIN_DAYS_LISTED_AHEAD = 7;
124
124
 
125
125
  /**
126
- * When the calendar stops short of a week past `windowStart`, the time of its
127
- * last event; null when it reaches that far or lists nothing.
126
+ * The last UTC day the calendar lists releases for, YYYY-MM-DD, as Gloom Cloud
127
+ * says it: on the calendar from a day (`served`), or on each central bank's
128
+ * next decision it lists past the end (`listedThrough`). From a server that
129
+ * says neither, which lists nothing past the end, the day of the last event.
130
+ * Null when it lists nothing.
128
131
  */
129
- export function shortCalendarEnd(events: readonly EconEvent[], windowStart: number): Date | null {
132
+ export function listingEnd(
133
+ events: readonly Pick<EconEvent, "date" | "listedThrough">[],
134
+ served?: string | null,
135
+ ): string | null {
136
+ const said = served ?? events.find((event) => event.listedThrough)?.listedThrough;
137
+ if (said && /^\d{4}-\d{2}-\d{2}$/.test(said)) return said;
130
138
  let last: Date | null = null;
131
139
  for (const event of events) {
132
140
  if (!last || event.date.getTime() > last.getTime()) last = event.date;
133
141
  }
134
- return last && last.getTime() < windowStart + MIN_DAYS_LISTED_AHEAD * 86_400_000 ? last : null;
142
+ return last ? dateKey(last) : null;
143
+ }
144
+
145
+ /**
146
+ * When the listing (`listingEnd`) stops short of a week past `windowStart`,
147
+ * its last day; null when it reaches that far or lists nothing.
148
+ */
149
+ export function shortCalendarEnd(
150
+ events: readonly Pick<EconEvent, "date" | "listedThrough">[],
151
+ windowStart: number,
152
+ served?: string | null,
153
+ ): string | null {
154
+ const end = listingEnd(events, served);
155
+ return end && Date.parse(`${end}T00:00:00Z`) + 86_400_000 <= windowStart + MIN_DAYS_LISTED_AHEAD * 86_400_000 ? end : null;
156
+ }
157
+
158
+ /** Whether a row is a central bank's next decision Gloom Cloud lists past the end of the listing. */
159
+ export function pastReleaseListing(event: Pick<EconEvent, "pastListing">): boolean {
160
+ return event.pastListing === true;
135
161
  }
136
162
 
137
163
  /**
@@ -416,6 +442,11 @@ export function awaitsConsensus(event: Pick<EconEvent, "actual" | "forecast" | "
416
442
  /** What a dash under Forecast means on a row still to come. */
417
443
  export const NO_CONSENSUS_NOTE = `${MISSING_VALUE} forecast = no consensus yet`;
418
444
 
445
+ /** What the dash under Time means on a bank's decision whose calendar gives the day and not the time, from its note. */
446
+ export function noTimeNote(timeNote: string): string {
447
+ return `${MISSING_VALUE} time = ${timeNote.charAt(0).toLowerCase()}${timeNote.slice(1).replace(/\.$/, "")}`;
448
+ }
449
+
419
450
  /** A national euro-area release matches EU (and G7, as EU) and its own member's code. */
420
451
  export function matchesCountry(event: Pick<EconEvent, "country" | "event">, filter: CountryFilter): boolean {
421
452
  const member = euroAreaMember(event);
@@ -482,10 +513,13 @@ export function countriesWithoutEvents(filter: CountryFilter, events: ReadonlyAr
482
513
  return filterCountries(filter).filter((country) => !listed.has(country));
483
514
  }
484
515
 
485
- /** "No scheduled releases for MX in this window", or for MX or ZA. */
486
- export function noScheduledReleasesMessage(countries: readonly string[]): string {
516
+ /**
517
+ * "No scheduled releases for MX in this window", or for MX or ZA; with the
518
+ * day the listing ends, where it does ("; releases are listed through 2026-11-20").
519
+ */
520
+ export function noScheduledReleasesMessage(countries: readonly string[], listedThrough?: string | null): string {
487
521
  const named = countries.length > 1 ? `${countries.slice(0, -1).join(", ")} or ${countries.at(-1)}` : countries.join("");
488
- return `No scheduled releases for ${named} in this window.`;
522
+ return `No scheduled releases for ${named} in this window${listedThrough ? `; releases are listed through ${listedThrough}` : ""}.`;
489
523
  }
490
524
 
491
525
  /**
@@ -22,6 +22,8 @@ export type EconCalendarFrom =
22
22
  events: EconEvent[];
23
23
  /** The first UTC day the stored calendar holds; null when it holds nothing. */
24
24
  storedFrom: string | null;
25
+ /** The last UTC day the calendar lists releases for; null from a server that does not say. */
26
+ listedThrough: string | null;
25
27
  }
26
28
  | {
27
29
  events: null;
@@ -42,7 +44,11 @@ export async function fetchEconCalendarFrom(from: string): Promise<EconCalendarF
42
44
  if (!payload || !Array.isArray(payload.events) || !(payload.storedFrom === null || /^\d{4}-\d{2}-\d{2}$/.test(String(payload.storedFrom)))) {
43
45
  return { events: null, failure: "the server returned an unreadable calendar" };
44
46
  }
45
- return { events: withPercentUnits(payload.events.map(toEconEvent)), storedFrom: payload.storedFrom };
47
+ return {
48
+ events: withPercentUnits(payload.events.map(toEconEvent)),
49
+ storedFrom: payload.storedFrom,
50
+ listedThrough: typeof payload.listedThrough === "string" && /^\d{4}-\d{2}-\d{2}$/.test(payload.listedThrough) ? payload.listedThrough : null,
51
+ };
46
52
  } catch (error) {
47
53
  if (error instanceof ApiRequestError && error.status === 404) return { events: null, failure: null };
48
54
  if (isPermanentClientError(error)) throw error;
@@ -39,7 +39,6 @@ import {
39
39
  awaitsConsensus,
40
40
  calendarDisplayRows,
41
41
  CALENDAR_TIME_ZONE_LABEL,
42
- dateKey,
43
42
  dayLabel,
44
43
  econEventName,
45
44
  filteredEmptyTitle,
@@ -54,7 +53,10 @@ import {
54
53
  matchesImpact,
55
54
  NO_CONSENSUS_NOTE,
56
55
  noScheduledReleasesMessage,
56
+ noTimeNote as noTimeNoteText,
57
57
  parseCountryFilter,
58
+ listingEnd,
59
+ pastReleaseListing,
58
60
  resetEconCalendarPersistence,
59
61
  shortCalendarEnd,
60
62
  shortDayLabel,
@@ -67,6 +69,7 @@ import {
67
69
  type ImpactFilter,
68
70
  } from "./calendar-model";
69
71
  import { figureWithCurrency } from "./figures";
72
+ import { MISSING_VALUE } from "../../../utils/format";
70
73
  import { usePaneStatusFooter } from "../../../components/layout/pane/status-footer";
71
74
  import { handleRefreshKey } from "../../../components/data-table/table-pane";
72
75
  import { tableColumnWidth } from "../../../components/ui/table-layout";
@@ -80,6 +83,8 @@ const IMPACT_LABELS: Record<ImpactFilter, string> = {
80
83
  };
81
84
 
82
85
  const NO_EVENTS: EconEvent[] = [];
86
+ /** The start (UTC) of a YYYY-MM-DD day, to label it. */
87
+ const dayStart = (day: string) => new Date(`${day}T00:00:00Z`);
83
88
  const SPELLED_IMPACT = "IMPACT";
84
89
  const SPELLED_COUNTRY = "COUNTRY";
85
90
  /** Event names this wide still read; past it the headers spell themselves out. */
@@ -163,7 +168,11 @@ function EconCalendarPane({ focused, width, height }: PaneProps) {
163
168
  const todayStart = Math.floor(now / 86_400_000) * 86_400_000;
164
169
  // A calendar that stops short of a week ahead says where it stops.
165
170
  const listedEnd = shortCalendarEnd(events, todayStart);
166
- const listedAfter = listedEnd ? `No events listed after ${shortDayLabel(listedEnd)}` : null;
171
+ const listedAfter = listedEnd ? `No events listed after ${shortDayLabel(dayStart(listedEnd))}` : null;
172
+ // Past the listing's end Gloom Cloud lists each central bank's next decision: where the rows shown run past it, the
173
+ // footer says where the releases end, as the CLI does under its table.
174
+ const releasesThrough = useMemo(() => listingEnd(events), [events]);
175
+ const showsPastListing = filtered.some(pastReleaseListing);
167
176
 
168
177
  // Map from eventIdx to flat row index (for scroll tracking)
169
178
  const eventIdxToRowIdx = new Map<number, number>();
@@ -309,7 +318,8 @@ function EconCalendarPane({ focused, width, height }: PaneProps) {
309
318
  // Countries named one by one with nothing in the calendar: a quiet window there, said plainly.
310
319
  const unscheduled = useMemo(() => countriesWithoutEvents(countryFilter, events), [countryFilter, events]);
311
320
  const filterEmptyTitle = events.length === 0 ? null
312
- : unscheduled.length > 0 && unscheduled.length === countryFilter.split(",").length ? noScheduledReleasesMessage(unscheduled).replace(/\.$/, "")
321
+ : unscheduled.length > 0 && unscheduled.length === countryFilter.split(",").length
322
+ ? noScheduledReleasesMessage(unscheduled, releasesThrough ? shortDayLabel(dayStart(releasesThrough)) : null).replace(/\.$/, "")
313
323
  : filteredEmptyTitle(impactFilter, countryFilter);
314
324
  const emptyStateHint = !loading && !error
315
325
  ? [
@@ -338,6 +348,10 @@ function EconCalendarPane({ focused, width, height }: PaneProps) {
338
348
  // The dash under Forecast on the row in hand, while its consensus is not in yet.
339
349
  const focusedEvent = detailEvent ?? filtered[selectedIdx];
340
350
  const noConsensus = !!focusedEvent && awaitsConsensus(focusedEvent);
351
+ // The blank time on the row in hand, with why: a bank whose calendar gives the day and not the time.
352
+ const noTimeNote = focusedEvent && hasNoStatedTime(focusedEvent) ? noTimeNoteText(focusedEvent.timeNote!) : null;
353
+ const pastListingStatus = showsPastListing && releasesThrough && !detailEvent && !listedAfterStatus
354
+ ? `releases listed through ${shortDayLabel(dayStart(releasesThrough))}, then each bank's next decision` : null;
341
355
  const calendarStatus = useMemo<PaneFooterSegment[]>(() => [
342
356
  ...(hiddenStatus ? [{
343
357
  id: "hidden-impact",
@@ -348,19 +362,33 @@ function EconCalendarPane({ focused, width, height }: PaneProps) {
348
362
  }] : []),
349
363
  ...(nextText && !detailEvent ? [{ id: "next", parts: [{ text: nextText, tone: "muted" as const }] }] : []),
350
364
  ...(listedAfterStatus ? [{ id: "listed-after", parts: [{ text: listedAfterStatus, tone: "warning" as const }] }] : []),
365
+ ...(pastListingStatus ? [{ id: "listed-through", parts: [{ text: pastListingStatus, tone: "muted" as const }],
366
+ variants: [[{ text: `releases through ${shortDayLabel(dayStart(releasesThrough!))}`, tone: "muted" as const }]] }] : []),
351
367
  ...(showStale ? [{ id: "stale", parts: [{ text: "STALE", tone: "warning" as const }] }] : []),
352
368
  // Behind the warnings, so a narrow footer gives it up before them, and ahead of the update time, which goes first.
369
+ // The blank time first: of the row in hand's notes it is the one the row cannot say itself.
370
+ ...(noTimeNote ? [{ id: "no-time", parts: [{ text: noTimeNote, tone: "muted" as const }],
371
+ variants: [[{ text: "no time stated", tone: "muted" as const }]] }] : []),
353
372
  ...(noConsensus ? [{ id: "no-consensus", parts: [{ text: NO_CONSENSUS_NOTE, tone: "muted" as const }],
354
373
  variants: [[{ text: "no consensus yet", tone: "muted" as const }]] }] : []),
355
374
  ...(staleness ? [{ id: "updated", parts: [{ text: staleness, tone: "muted" as const }] }] : []),
356
- ], [allImpactKey, detailEvent, hiddenStatus, listedAfterStatus, nextText, noConsensus, showStale, staleness]);
375
+ ], [allImpactKey, detailEvent, hiddenStatus, listedAfterStatus, nextText, noConsensus, noTimeNote, pastListingStatus, releasesThrough, showStale, staleness]);
357
376
  // A report of the pane (`gloom fn ECO`) says it too.
358
- const listedThrough = listedEnd ? dateKey(listedEnd) : null;
377
+ const listedThrough = listedEnd;
359
378
  useRemoteUiNode(listedAfter && listedThrough ? {
360
379
  role: "report-notice",
361
380
  label: "Listed through",
362
381
  getMetadata: () => ({ text: listedAfter, key: "listedThrough", value: listedThrough }),
363
382
  } : null);
383
+ useRemoteUiNode(pastListingStatus && releasesThrough ? {
384
+ role: "report-notice",
385
+ label: "Releases listed through",
386
+ getMetadata: () => ({
387
+ text: `No releases listed after ${releasesThrough}; the rows after it are each central bank's next decision.`,
388
+ key: "releasesListedThrough",
389
+ value: releasesThrough,
390
+ }),
391
+ } : null);
364
392
  useRemoteUiNode(hiddenCount > 0 ? {
365
393
  role: "report-notice",
366
394
  label: "Lower-impact hidden",
@@ -424,10 +452,15 @@ function EconCalendarPane({ focused, width, height }: PaneProps) {
424
452
  const ev = row.event;
425
453
  switch (column.id) {
426
454
  case "time":
427
- // A bank that states no time has none here, and its detail says why; an all-day event (a plenum, an election) says so.
428
- return { text: hasNoStatedTime(ev) ? "" : isAllDayEvent(ev) ? "All day" : timeLabel(ev.date), color: colors.textMuted };
455
+ // A bank that states no time has a dash here, and the footer and its detail say why; an all-day event (a plenum,
456
+ // an election) says so.
457
+ return { text: hasNoStatedTime(ev) ? MISSING_VALUE : isAllDayEvent(ev) ? "All day" : timeLabel(ev.date), color: colors.textMuted };
429
458
  case "readerTime":
430
- return { text: hasNoReleaseTime(ev) || !readerZone ? "" : zonedClock(ev.date.getTime(), readerZone).label, color: colors.textMuted };
459
+ // The reader's clock has no time to give a bank that states none: the same dash as its time.
460
+ return {
461
+ text: !readerZone ? "" : hasNoStatedTime(ev) ? MISSING_VALUE : hasNoReleaseTime(ev) ? "" : zonedClock(ev.date.getTime(), readerZone).label,
462
+ color: colors.textMuted,
463
+ };
431
464
  case "impact": {
432
465
  const indicator = impactIndicator(ev.impact);
433
466
  return {
@@ -36,6 +36,9 @@ export interface EconEvent {
36
36
  indicatorId?: string | null;
37
37
  /** Which feed the forecast was read from (`week-feed`, `release-calendar`) and when that feed was read. */
38
38
  consensus?: { source: string; readAt: string } | null;
39
+ /** A central bank's next decision Gloom Cloud lists past the end of the listing, which ends on `listedThrough` (UTC). */
40
+ pastListing?: boolean;
41
+ listedThrough?: string;
39
42
  }
40
43
 
41
44
  /** Whether a row's time is blank because its publisher states none (a bank whose calendar gives the day only). */
@@ -25,6 +25,8 @@ export const fixedIncomeModule: PluginModule = {
25
25
  { value: "all", label: "All" },
26
26
  { value: "us", label: "US" },
27
27
  { value: "euro", label: "Euro" },
28
+ { value: "em", label: "Emerging markets" },
29
+ { value: "asia", label: "Asia" },
28
30
  ],
29
31
  },
30
32
  ...treasuryAuctionsSettings().fields,
@@ -11,6 +11,7 @@ import {
11
11
  type PaneFooterSegment,
12
12
  } from "../../../components";
13
13
  import { handleRefreshKey } from "../../../components/data-table/table-pane";
14
+ import { getTableWidth } from "../../../components/ui/table-layout";
14
15
  import { createDataTableCsv } from "../../../components/data-table/export";
15
16
  import { ageFooterSegment, savedCopyFooterSegment } from "../../../components/layout/pane/footer";
16
17
  import { CountryFlag } from "../../../components/ui/country-flag";
@@ -19,7 +20,8 @@ import { useFxRatesMap } from "../../../market-data/hooks";
19
20
  import { resolveEntryData } from "../../../market-data/selectors";
20
21
  import { useRemoteUiNode } from "../../../remote/semantic-tree";
21
22
  import { usePaneSettingValue, useUpdatePaneSettings } from "../../../state/app/context";
22
- import { colors } from "../../../theme/colors";
23
+ import { colors, shownPriceColor } from "../../../theme/colors";
24
+ import { formatPercentRaw, MISSING_VALUE } from "../../../utils/format";
23
25
  import type {
24
26
  CommandBarResultDef, CommandBarSearchProvider, GloomPluginContext, PaneProps, PaneTemplateContext, PaneTemplateCreateOptions,
25
27
  PaneTemplateInstanceConfig,
@@ -55,6 +57,10 @@ const CURRENCY_FLAGS = new Map<string, ReactNode>(
55
57
  FX_CURRENCIES.map((currency) => [currency, <CountryFlag region={CURRENCY_FLAG_REGIONS[currency]} />]),
56
58
  );
57
59
  const RATE_COLUMN_WIDTH = 10;
60
+ /** Room for `-12.34%`; the header takes what it needs. */
61
+ const MOVE_COLUMN_WIDTH = 9;
62
+ /** The currencies the day's move must fit beside: the eight majors the board opens with. */
63
+ const MOVE_FITS_BESIDE = 8;
58
64
  /** Snapshot rates reload at this pace while the feed is not carrying every leg. */
59
65
  const FX_FALLBACK_REFRESH_MS = 60_000;
60
66
 
@@ -252,17 +258,34 @@ function FxMatrixPane({ focused, width, height }: PaneProps) {
252
258
  const value = convertedAmount(currency);
253
259
  return value == null ? 1 : formatAmountFigure(value, currency).length;
254
260
  })) : 0;
255
- const allColumns = useMemo<DataTableColumn[]>(() => [
256
- { id: "base", label: "", width: flagged ? FLAGGED_BASE_COLUMN_WIDTH : BASE_COLUMN_WIDTH, align: "left" },
257
- ...amount ? [{ id: "amount", label: "Amount", width: amountWidth, align: "right" as const }] : [],
258
- ...currencies.map((currency) => ({
259
- id: currency,
260
- label: currency,
261
- width: RATE_COLUMN_WIDTH,
262
- align: "right" as const,
263
- headerLeading: flagged ? CURRENCY_FLAGS.get(currency) : undefined,
264
- })),
265
- ], [amount != null, amountWidth, currencies, flagged]);
261
+ // Each currency's value in dollars, its move on the day: the row currency against the dollar, so JPY -0.51% is the
262
+ // yen 0.51% weaker (USD/JPY up), read from its dollar pair against that pair's previous daily close (the references
263
+ // the cells' tints read). The dollar is the reference, so it has none.
264
+ const moveVsUsd = useCallback((row: string): number | null => {
265
+ if (row === "USD") return null;
266
+ const rate = rates.get(row);
267
+ const reference = directionReferences.get(row);
268
+ return rate == null || reference == null || !Number.isFinite(rate) || rate <= 0 ? null : crossMovePercent(rate, reference, 1, 1);
269
+ }, [directionReferences, rates]);
270
+ // The move is shown where it fits beside the first eight currencies; a pane with no room for both (a board saved
271
+ // at its old width) shows the currencies as it did, and one too narrow for them scrolls to the rest.
272
+ const allColumns = useMemo<DataTableColumn[]>(() => {
273
+ const columns: DataTableColumn[] = [
274
+ { id: "base", label: "", width: flagged ? FLAGGED_BASE_COLUMN_WIDTH : BASE_COLUMN_WIDTH, align: "left" },
275
+ ...amount ? [{ id: "amount", label: "Amount", width: amountWidth, align: "right" as const }] : [],
276
+ { id: "move", label: "1D in USD", width: MOVE_COLUMN_WIDTH, align: "right",
277
+ title: "Each currency's value in US dollars, its move since its dollar pair's previous daily close: JPY -0.51% is the yen 0.51% weaker against the dollar" },
278
+ ...currencies.map((currency) => ({
279
+ id: currency,
280
+ label: currency,
281
+ width: RATE_COLUMN_WIDTH,
282
+ align: "right" as const,
283
+ headerLeading: flagged ? CURRENCY_FLAGS.get(currency) : undefined,
284
+ })),
285
+ ];
286
+ const throughEighth = columns.slice(0, columns.length - Math.max(0, currencies.length - MOVE_FITS_BESIDE));
287
+ return getTableWidth(throughEighth) <= width - 1 ? columns : columns.filter((column) => column.id !== "move");
288
+ }, [amount != null, amountWidth, currencies, flagged, width]);
266
289
 
267
290
  const renderCell = useCallback((
268
291
  row: FxCurrency,
@@ -279,6 +302,12 @@ function FxMatrixPane({ focused, width, height }: PaneProps) {
279
302
  };
280
303
  }
281
304
 
305
+ if (column.id === "move") {
306
+ const move = moveVsUsd(row);
307
+ if (move == null) return { text: row !== "USD" && status.loading > 0 ? "…" : MISSING_VALUE, color: colors.textDim };
308
+ return { text: formatPercentRaw(move), value: move, color: shownPriceColor(move, 2) };
309
+ }
310
+
282
311
  if (column.id === "amount") {
283
312
  const value = convertedAmount(row);
284
313
  if (value == null) return { text: status.loading > 0 ? "…" : "—", color: colors.textDim };
@@ -311,7 +340,7 @@ function FxMatrixPane({ focused, width, height }: PaneProps) {
311
340
  ? directionTint(level, { background: colors.selected, text: colors.selectedText })
312
341
  : directionTint(level, { background: colors.bg, text: colors.text });
313
342
  return { text: formatRate(base / quote, quoteCurrency, reference), color: colors.text, backgroundColor };
314
- }, [amount?.currency, convertedAmount, directionReferences, flagged, rates, referenceRates, status.loading]);
343
+ }, [amount?.currency, convertedAmount, directionReferences, flagged, moveVsUsd, rates, referenceRates, status.loading]);
315
344
 
316
345
  const handleKeyDown = useCallback((event: DataTableKeyEvent) => handleRefreshKey(event, refresh), [refresh]);
317
346
 
@@ -469,7 +498,8 @@ export const fxMatrixModule: PluginModule = {
469
498
  component: FxMatrixPane,
470
499
  defaultPosition: "right",
471
500
  defaultMode: "floating",
472
- defaultFloatingSize: { width: 105, height: 14 },
501
+ // Room for the eight majors after the codes and the day's move in dollars; narrower, the move gives way.
502
+ defaultFloatingSize: { width: 115, height: 14 },
473
503
  tableExport: true,
474
504
  settings: fxMatrixSettings,
475
505
  },
@@ -53,6 +53,7 @@ import type { KeybindingsConfig } from "../../../types/config";
53
53
  import type { KeyboardShortcut } from "../../../types/plugin";
54
54
  import { useUiHost } from "../../../ui";
55
55
  import { isPlainKey } from "../../../utils/keyboard";
56
+ import { logFailure } from "../../../utils/log-failure";
56
57
  import { detectShortcutPlatform, getShortcutDisplayMode } from "../../../utils/shortcut-labels";
57
58
  import { getSharedRegistry } from "../../registry";
58
59
  import { usePluginAppActions } from "../../runtime";
@@ -218,8 +219,11 @@ export function KeybindingsEditor({
218
219
 
219
220
  const writeKeybindings = useCallback((next: KeybindingsConfig | undefined) => {
220
221
  dispatch({ type: "SET_KEYBINDINGS", keybindings: next });
221
- void saveConfigImmediately(updateKeybindingsConfig(stateRef.current.config, next));
222
- }, [dispatch, stateRef]);
222
+ saveConfigImmediately(updateKeybindingsConfig(stateRef.current.config, next)).catch((error: unknown) => {
223
+ logFailure("help.keybindings", "Saving keybindings failed")(error);
224
+ notify({ type: "error", body: t("Could not save your keybindings.") });
225
+ });
226
+ }, [dispatch, notify, stateRef]);
223
227
 
224
228
  const startCapture = useCallback((target: CaptureTarget) => {
225
229
  setFeedback(null);
@@ -1,6 +1,7 @@
1
1
  import { logFailure } from "../../../../utils/log-failure";
2
2
  import { createBaseConverter, type BaseConversion } from "../../../../cli/base-converter";
3
3
  import { quotedFxPair } from "../../../../utils/currency-pair";
4
+ import { commandWord } from "../../../../utils/shell-word";
4
5
  import { formatFxRate } from "../../../../cli/fx-pair";
5
6
  import { savedListingName } from "../../../../cli/listing-arg";
6
7
  import { currentListingName } from "../../../../tickers/listing-name";
@@ -87,7 +88,7 @@ import {
87
88
  } from "../../../../portfolio/allocation";
88
89
  import { findCachedPortfolioAccount } from "../cached-account";
89
90
  import { importedFromText } from "../imported-from";
90
- import { findNamedCollection } from "../../../../portfolio/collection-name";
91
+ import { findNamedCollection, watchlistMemberSymbol } from "../../../../portfolio/collection-name";
91
92
  import { isoDateToday } from "../../../../utils/calendar-date";
92
93
  import { lastTradeDate } from "../../../../tickers/listing-fate";
93
94
  import type { PriceWindow } from "../../../../utils/price-window";
@@ -194,10 +195,25 @@ export function renderCollectionOverview(config: AppConfig, tickers: TickerRecor
194
195
  ]),
195
196
  ));
196
197
  }
198
+ // Nothing in any of them: the commands that fill one, as `alerts` names the one that adds an alert.
199
+ const empty = [
200
+ ...config.portfolios.map((portfolio) => countCollectionTickers(tickers, "portfolios", portfolio.id)),
201
+ ...config.watchlists.map((watchlist) => countCollectionTickers(tickers, "watchlists", watchlist.id)),
202
+ ].every((count) => count === 0);
203
+ const adds = [
204
+ config.portfolios[0] ? collectionAddCommand("portfolio", config.portfolios[0].name) : null,
205
+ config.watchlists[0] ? collectionAddCommand("watchlist", config.watchlists[0].name) : null,
206
+ ].filter((command): command is string => command != null);
207
+ if (empty && adds.length > 0) blocks.push("", cliStyles.muted(`No tickers yet. Add some with ${adds.join(" or ")}.`));
197
208
 
198
209
  return blocks.join("\n");
199
210
  }
200
211
 
212
+ /** `gloom watchlist add Watchlist AAPL MSFT`: the command that adds tickers to a collection, its name quoted for any shell. */
213
+ export function collectionAddCommand(kind: "portfolio" | "watchlist", name: string): string {
214
+ return `gloom ${kind} add ${commandWord(name)} AAPL MSFT`;
215
+ }
216
+
201
217
  export interface ShowCollectionOptions {
202
218
  /** `--explain`: follow the report with what the terms it shows mean, as `fn <function> --explain` does. */
203
219
  explain?: boolean;
@@ -830,7 +846,7 @@ async function showCollectionWithMarketData(
830
846
 
831
847
  if (filtered.length === 0 && !structured && !hasCash) {
832
848
  console.log(cliStyles.bold(displayName));
833
- console.log(cliStyles.muted("No tickers in this collection."));
849
+ console.log(cliStyles.muted(`No tickers in this ${isPortfolio ? "portfolio" : "watchlist"}. Add some with ${collectionAddCommand(isPortfolio ? "portfolio" : "watchlist", displayName)}.`));
834
850
  if (explain) console.log(`\n${renderReportGlossary(EXPLAINED_REPORT, [])}`);
835
851
  return;
836
852
  }
@@ -1447,7 +1463,8 @@ async function valueWatchlistRows({
1447
1463
  values.push({
1448
1464
  ticker, quote, headline, extended, kind, venue, marketCap, funding, stale, lastTrade,
1449
1465
  row: {
1450
- symbol,
1466
+ // A listing abroad by its venue (ASML:AMS, 2330:TWSE), so a join on the export never meets the US line.
1467
+ symbol: watchlistMemberSymbol(ticker.metadata),
1451
1468
  ...listingColumns(ticker, quote),
1452
1469
  exchange: venue,
1453
1470
  kind,
@@ -20,7 +20,7 @@ import {
20
20
  deleteWatchlist as deleteWatchlistConfig,
21
21
  removeTickerFromWatchlist as removeWatchlistMembership,
22
22
  } from "../../../../portfolio/mutations";
23
- import { showCollection } from "./render";
23
+ import { collectionAddCommand, showCollection } from "./render";
24
24
  import { listingFields, misplacedSymbolList, refuseDryRun, takeCollectionName } from "./shared";
25
25
  import { addOneSymbol, addSymbols, FILE_OPTION, listAddLookups, printSymbolRows, progressNotice, removeSymbols, requireSymbolList, retryNotice, shellWord, SYMBOL_LIST_HELP } from "./bulk-symbols";
26
26
  import { readNameEntries } from "../../../../cli/name-entries";
@@ -209,6 +209,10 @@ async function listWatchlists(ctx: CliCommandContext) {
209
209
  String(watchlist.tickerCount),
210
210
  ]),
211
211
  ));
212
+ // Nothing in any of them: the command that fills one, as `alerts` names the one that adds an alert.
213
+ if (rows.every((watchlist) => watchlist.tickerCount === 0)) {
214
+ console.log(cliStyles.muted(`\nNo tickers yet. Add some with ${collectionAddCommand("watchlist", rows[0]!.name)}.`));
215
+ }
212
216
  });
213
217
  }
214
218
 
@@ -22,8 +22,9 @@ export const paneSchemas = {
22
22
  settingKey: "extraColumns",
23
23
  placeholder: "fields",
24
24
  description: `Report columns to add, in order: ${EXTRA_COLUMN_IDS.join(", ")}. shortInterest is FINRA short interest as a percent of float at the latest settlement, `
25
- + "nextEarnings the next report date on the earnings calendar, target the mean analyst target and the analyst count, grossMargin and evEbitda the screener's stored figures. "
26
- + "Short interest, earnings dates, gross margin and EV/EBITDA cover US listings. CSV and JSON give each cell's source and as-of. The pane keeps its own columns",
25
+ + "nextEarnings the next report date on the earnings calendar, target the mean analyst target and the analyst count, grossMargin the trailing twelve months' gross margin, "
26
+ + "evEbitda the enterprise value over trailing operating income plus D&A, as GE's EV/EBITDA ends. "
27
+ + "Short interest and earnings dates cover US listings. CSV and JSON give each cell's source and as-of. The pane keeps its own columns",
27
28
  example: "--columns shortInterest,nextEarnings,target,grossMargin,evEbitda",
28
29
  normalize: normalizeExtraColumns,
29
30
  },
@@ -32,7 +33,7 @@ export const paneSchemas = {
32
33
  type: "string",
33
34
  settingKey: "capCurrency",
34
35
  placeholder: "ISO code",
35
- description: "Show every market cap in this currency, converted at the app's FX rates; the status line names each rate and its time",
36
+ description: "Show every market cap and analyst target in this currency, converted at the app's FX rates; the status line names each rate and its time",
36
37
  example: "--currency USD",
37
38
  normalize: normalizeCapCurrency,
38
39
  },