gloomberb 0.19.4 → 0.19.5

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 (128) hide show
  1. package/package.json +3 -1
  2. package/src/cli/commands/command-utils.ts +4 -0
  3. package/src/cli/commands/market.ts +119 -27
  4. package/src/cli/commands/search.ts +1 -1
  5. package/src/cli/commands/ticker.ts +10 -6
  6. package/src/cli/currency-name-hint.ts +60 -0
  7. package/src/cli/history-rows.ts +18 -1
  8. package/src/cli/known-gaps.ts +17 -2
  9. package/src/cli/not-a-ticker.ts +5 -3
  10. package/src/cli/pane-functions/catalog.ts +9 -1
  11. package/src/cli/pane-functions/headless.ts +7 -3
  12. package/src/cli/pane-functions/market-session.ts +6 -7
  13. package/src/cli/series-search.ts +4 -5
  14. package/src/components/chart/composite/panel-bitmap.ts +28 -2
  15. package/src/components/chart/composite/time-axis.ts +17 -2
  16. package/src/components/layout/shell/active-drag.ts +38 -7
  17. package/src/components/layout/shell/drag/magnets.ts +106 -0
  18. package/src/components/layout/window-controls.tsx +96 -35
  19. package/src/components/layout/window-fullscreen.ts +20 -0
  20. package/src/components/quote-flash.ts +36 -32
  21. package/src/market-data/coordinator/events.ts +17 -1
  22. package/src/market-data/frame-scheduler.ts +47 -10
  23. package/src/market-data/frame-wake.ts +74 -0
  24. package/src/market-data/futures-board.ts +7 -6
  25. package/src/market-data/hooks.tsx +12 -3
  26. package/src/market-data/performance.ts +78 -9
  27. package/src/market-data/request-types.ts +6 -3
  28. package/src/plugins/builtin/alerts/cli.ts +2 -1
  29. package/src/plugins/builtin/analytics/risk-evidence.ts +1 -0
  30. package/src/plugins/builtin/attention/evidence.ts +1 -1
  31. package/src/plugins/builtin/awards/client.ts +1 -1
  32. package/src/plugins/builtin/awards/evidence.ts +1 -1
  33. package/src/plugins/builtin/awards/pane.tsx +2 -1
  34. package/src/plugins/builtin/bond-calculator/math.ts +1 -1
  35. package/src/plugins/builtin/broker-manager/footer.ts +3 -2
  36. package/src/plugins/builtin/broker-manager/index.tsx +2 -1
  37. package/src/plugins/builtin/broker-manager/keyboard.ts +2 -1
  38. package/src/plugins/builtin/catalysts/evidence.ts +1 -1
  39. package/src/plugins/builtin/catalysts/pane.tsx +2 -1
  40. package/src/plugins/builtin/chart-composer/headless.ts +40 -1
  41. package/src/plugins/builtin/cloud-tweets/table.tsx +3 -2
  42. package/src/plugins/builtin/comment-letters/client.ts +2 -1
  43. package/src/plugins/builtin/company-kpis/client.ts +1 -1
  44. package/src/plugins/builtin/company-kpis/pane.tsx +2 -1
  45. package/src/plugins/builtin/company-kpis/screenshot-evidence.ts +3 -2
  46. package/src/plugins/builtin/cot/headless.ts +9 -3
  47. package/src/plugins/builtin/cot/model.ts +44 -3
  48. package/src/plugins/builtin/credit-documents/client.ts +1 -1
  49. package/src/plugins/builtin/credit-documents/evidence.ts +1 -1
  50. package/src/plugins/builtin/credit-documents/pane.tsx +2 -1
  51. package/src/plugins/builtin/earnings-calls/pane.tsx +1 -1
  52. package/src/plugins/builtin/earnings-ripple/index.tsx +6 -1
  53. package/src/plugins/builtin/econ/calendar-model.ts +2 -0
  54. package/src/plugins/builtin/econ/fred-catalog.ts +5 -5
  55. package/src/plugins/builtin/econ/print-watch.ts +3 -1
  56. package/src/plugins/builtin/futures/series.ts +16 -1
  57. package/src/plugins/builtin/fx-matrix/headless.ts +4 -2
  58. package/src/plugins/builtin/fx-matrix/index.tsx +37 -3
  59. package/src/plugins/builtin/fx-matrix/pairs.ts +15 -0
  60. package/src/plugins/builtin/gpu/headless.ts +2 -1
  61. package/src/plugins/builtin/help/function-card.tsx +2 -1
  62. package/src/plugins/builtin/help/index.tsx +2 -1
  63. package/src/plugins/builtin/insider/display.ts +45 -6
  64. package/src/plugins/builtin/ipo-calendar/model.ts +2 -0
  65. package/src/plugins/builtin/iv-history/client.ts +2 -1
  66. package/src/plugins/builtin/iv-history/headless.ts +2 -1
  67. package/src/plugins/builtin/jobs/pages.ts +4 -4
  68. package/src/plugins/builtin/kelly-sizer/headless.ts +2 -1
  69. package/src/plugins/builtin/market-heatmap/index.tsx +2 -1
  70. package/src/plugins/builtin/members/client.ts +1 -1
  71. package/src/plugins/builtin/mna/distress/client.ts +1 -0
  72. package/src/plugins/builtin/mna/pane.tsx +4 -1
  73. package/src/plugins/builtin/options/market-reference.ts +1 -1
  74. package/src/plugins/builtin/options/open-interest-as-of.ts +3 -1
  75. package/src/plugins/builtin/options/view.tsx +2 -1
  76. package/src/plugins/builtin/options-calculator/evidence.ts +1 -1
  77. package/src/plugins/builtin/options-scenario/csp-screen-pane.tsx +1 -1
  78. package/src/plugins/builtin/options-scenario/csp-screen.ts +8 -4
  79. package/src/plugins/builtin/options-scenario/csp.ts +28 -9
  80. package/src/plugins/builtin/options-scenario/evidence.ts +5 -4
  81. package/src/plugins/builtin/options-scenario/pane.tsx +2 -1
  82. package/src/plugins/builtin/perps/client.ts +1 -1
  83. package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +2 -1
  84. package/src/plugins/builtin/portfolio-list/pane/index.tsx +7 -3
  85. package/src/plugins/builtin/portfolio-list/use-throttled-memo.ts +10 -19
  86. package/src/plugins/builtin/research/analyst-model.ts +1 -0
  87. package/src/plugins/builtin/research/equity-diagnostic-pane.tsx +2 -1
  88. package/src/plugins/builtin/research/index.tsx +1 -0
  89. package/src/plugins/builtin/research/relative-valuation-currency.ts +1 -1
  90. package/src/plugins/builtin/research/relative-valuation-peers.ts +2 -1
  91. package/src/plugins/builtin/research-search/command-bar-search.ts +3 -1
  92. package/src/plugins/builtin/research-search/snippet.ts +1 -0
  93. package/src/plugins/builtin/revenue-breakdown/client.ts +3 -2
  94. package/src/plugins/builtin/seasonality/headless.ts +2 -1
  95. package/src/plugins/builtin/sec/command-bar-search.ts +3 -2
  96. package/src/plugins/builtin/sec/index.tsx +7 -4
  97. package/src/plugins/builtin/sec/row-summaries.ts +28 -12
  98. package/src/plugins/builtin/short-interest/watch-client.ts +2 -1
  99. package/src/plugins/builtin/social-mentions/client.ts +2 -1
  100. package/src/plugins/builtin/supply-chain/client.ts +1 -1
  101. package/src/plugins/builtin/supply-chain/evidence.ts +1 -1
  102. package/src/plugins/builtin/supply-chain/graph-pane.tsx +2 -1
  103. package/src/plugins/builtin/supply-chain/pane.tsx +2 -1
  104. package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +1 -1
  105. package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +24 -4
  106. package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +1 -1
  107. package/src/plugins/builtin/time-sales/client.ts +1 -0
  108. package/src/plugins/builtin/vol-surface/client.ts +2 -1
  109. package/src/plugins/builtin/yield-curve/headless.ts +3 -1
  110. package/src/portfolio/column-values.ts +76 -10
  111. package/src/renderers/dom/host/box.tsx +204 -176
  112. package/src/renderers/dom/host/style.ts +49 -20
  113. package/src/renderers/dom/host/text.tsx +3 -2
  114. package/src/renderers/electrobun/bun/desktop/backend.ts +2 -0
  115. package/src/renderers/electrobun/bun/desktop/host-requests.ts +25 -1
  116. package/src/renderers/electrobun/bun/desktop/relaunch.ts +9 -1
  117. package/src/renderers/electrobun/bun/desktop/windows-script.ts +9 -6
  118. package/src/renderers/electrobun/bun/window/windows-native.ts +26 -1
  119. package/src/renderers/electrobun/shared/protocol.ts +6 -0
  120. package/src/renderers/electrobun/view/ui-host.tsx +7 -0
  121. package/src/renderers/electrobun/view/window-fullscreen.ts +10 -3
  122. package/src/sources/provider-router/index.ts +7 -1
  123. package/src/time-series/price-units.ts +11 -0
  124. package/src/ui/host.tsx +2 -0
  125. package/src/utils/currency-names.ts +20 -0
  126. package/src/utils/currency-pair.ts +6 -0
  127. package/src/utils/exchange-rate-snapshot.ts +20 -2
  128. package/src/utils/fx-market-hours.ts +43 -0
@@ -37,7 +37,7 @@ import { futuresSessionOpenMinute } from "../../../market-data/market/trading-se
37
37
  import { isAlwaysOpenExchange, isRegularSessionTime } from "../../../market-data/market/freshness";
38
38
  import { isRoundTheClockCoin } from "../../../utils/crypto-pair";
39
39
  import { isCurrencyPairListing } from "../../../utils/fx-market-hours";
40
- import { cleanFloat32Price } from "../../../cli/history-rows";
40
+ import { cleanFloat32Price, historyPriceDecimals } from "../../../cli/history-rows";
41
41
  import { parseChartSpec } from "./chart-spec";
42
42
  import { paneSchemas } from "./headless-schema";
43
43
  import { barHistoryFreshness, DAILY_CLOSES, REPORTED_DATA } from "../shared/report-freshness";
@@ -533,6 +533,43 @@ function tradedBars(series: HeadlessSeries): HeadlessSeries {
533
533
  };
534
534
  }
535
535
 
536
+ /** The significant digits an exported bar price keeps however few decimals its series needs, as `formatSignificant` shows a small value. */
537
+ const PRICE_SIGNIFICANT_FLOOR = 4;
538
+
539
+ /**
540
+ * A chart's bars at the series' own precision: each price the decimal the
541
+ * feed's float stands for (113.045, not 113.044998), then all of them to the
542
+ * decimals nine in ten need (historyPriceDecimals), so a bar from a finer
543
+ * source reads as the rest do: USDJPY=X's 154.19901 among three-decimal bars
544
+ * is 154.199. A price those decimals would leave with fewer than four
545
+ * significant digits keeps four, so a reverse-split penny stock adjusted up to
546
+ * 50,000 still writes its 0.00421875 as 0.004219, never 0. A `value` that is
547
+ * no close (a transform) keeps its digits.
548
+ */
549
+ function barsAtSeriesPrecision(series: HeadlessSeries): HeadlessSeries {
550
+ if (!series.points.some((point) => point.close != null)) return series;
551
+ const valueIsClose = series.points.every((point) => point.value == null || point.value === point.close);
552
+ const clean = (price: number | null | undefined) => price == null || !Number.isFinite(price) ? price : cleanFloat32Price(price);
553
+ const decimals = historyPriceDecimals(series.points.map((point) => ({
554
+ open: clean(point.open) ?? null, high: clean(point.high) ?? null, low: clean(point.low) ?? null, close: clean(point.close) ?? null,
555
+ })));
556
+ const round = (price: number | null | undefined) => {
557
+ const cleaned = clean(price);
558
+ if (cleaned == null || !Number.isFinite(cleaned) || cleaned === 0) return cleaned;
559
+ const floorDecimals = PRICE_SIGNIFICANT_FLOOR - 1 - Math.floor(Math.log10(Math.abs(cleaned)));
560
+ return floorDecimals > decimals ? Number(cleaned.toPrecision(PRICE_SIGNIFICANT_FLOOR)) : Number(cleaned.toFixed(decimals));
561
+ };
562
+ return {
563
+ ...series,
564
+ points: series.points.map((point) => {
565
+ const bar = { ...point };
566
+ for (const field of ["open", "high", "low", "close"] as const) if (point[field] !== undefined) bar[field] = round(point[field]);
567
+ if (point.value != null && valueIsClose) bar.value = bar.close;
568
+ return bar;
569
+ }),
570
+ };
571
+ }
572
+
536
573
  /** What a chart series was asked as: a listing as typed (`USDZAR=X`, `SAN:EPA`), a FRED series by its ID. */
537
574
  function askedSymbol(source: ChartSeriesSource): string {
538
575
  switch (source.kind) {
@@ -830,6 +867,8 @@ export function chartHeadless(template: keyof typeof paneSchemas): HeadlessPaneD
830
867
  const interval = servedInterval(series as HeadlessSeries & Pick<ResolvedSeries, "historyResolution" | "barSize" | "nativeFrequency">);
831
868
  return { ...series, ...(symbol ? { symbol } : {}), ...(interval ? { interval } : {}) };
832
869
  });
870
+ // GIP keeps each intraday print as traded (a sub-penny 86.3775); a chart's bars read at the series' precision.
871
+ if (template !== "graph-intraday-price-pane") model.series = model.series.map(barsAtSeriesPrecision);
833
872
  if (template === "graph-intraday-price-pane") {
834
873
  model.series = model.series.map(tradedBars);
835
874
  const regular = regularSessionNotice(intradayHistories.map((window) => ({ ...window, exchange: listingExchange(window.symbol, window.exchange) })));
@@ -49,6 +49,7 @@ import {
49
49
  } from "./model";
50
50
  import { useAutoRefresh } from "../../../react/auto-refresh";
51
51
  import { usePaneStatusLinkFooter } from "../../../components/layout/pane/status-footer";
52
+ import { logFailure } from "../../../utils/log-failure";
52
53
 
53
54
  function isAuthError(error: string | null): boolean {
54
55
  return !!error && /unauthorized|verification/i.test(error);
@@ -301,7 +302,7 @@ function useTweetSearchData(
301
302
  });
302
303
  })
303
304
  // The tweets on screen are still the answer; the next cycle tries again.
304
- .catch(() => {});
305
+ .catch(logFailure("cloud-tweets.table", "Refresh latest tweets failed"));
305
306
  }, [enabled, load, requestKey]);
306
307
  const fetchedAt = state.data ? cachedTweetResult(requestKey)?.fetchedAt ?? null : null;
307
308
  useAutoRefresh(fetchedAt, refreshLatest, { intervalMs: TWEET_REFRESH_MS });
@@ -378,7 +379,7 @@ export function TweetSearchTable({
378
379
  content: (ctx: PromptContext<string>) => (
379
380
  <ChoiceDialog {...ctx} title="Open from this tweet" choices={selectedLinks.map(tweetLinkChoice)} />
380
381
  ),
381
- }).catch(() => undefined);
382
+ }).catch(logFailure("cloud-tweets.table", "Open tweet links prompt failed"));
382
383
  const link = choice === undefined ? undefined : selectedLinks[Number(choice)];
383
384
  if (!link) return;
384
385
  if (link.kind === "ticker") openTicker(link.symbol);
@@ -9,6 +9,7 @@ import type {
9
9
  CommentLetterIssuer,
10
10
  CommentLetterPage,
11
11
  } from "./types";
12
+ import { logFailure } from "../../../utils/log-failure";
12
13
 
13
14
  const EFTS_URL = "https://efts.sec.gov/LATEST/search-index";
14
15
  const FETCH_TIMEOUT_MS = 15_000;
@@ -324,7 +325,7 @@ export function createCommentLettersLoader(
324
325
  }
325
326
  const company = issuer ? await issuer : null;
326
327
  if (company && offset === 0) {
327
- const listed = await loadIssuerFilings(company.ticker, force).catch(() => null);
328
+ const listed = await loadIssuerFilings(company.ticker, force).catch(logFailure("comment-letters.client", "Load issuer filings for comment letters failed", null));
328
329
  issuerFromCloud = !!listed?.complete;
329
330
  if (listed?.complete) {
330
331
  const rows = listed.filings
@@ -31,7 +31,7 @@ function validPeriod(period: KpiPeriod): boolean {
31
31
  }
32
32
  function validEvidence(evidence: KpiEvidence): boolean {
33
33
  let safeUrl = false;
34
- try { safeUrl = ["https:", "http:"].includes(new URL(evidence.url).protocol); } catch { /* Invalid evidence cannot be opened. */ }
34
+ try { safeUrl = ["https:", "http:"].includes(new URL(evidence.url).protocol); } catch { /* Intentional ignore: evidence without a web link cannot be opened, so it fails validation. */ }
35
35
  return !!evidence && text(evidence.id) && text(evidence.documentId) && text(evidence.sourceId)
36
36
  && sourceKinds.includes(evidence.sourceKind) && safeUrl && text(evidence.title) && instant(evidence.publishedAt)
37
37
  && text(evidence.country) && text(evidence.language) && text(evidence.quote) && evidence.quote.trim().length > 0
@@ -27,6 +27,7 @@ import { allGuidance, allObservations, basisLabel, changeText, changeTone, compa
27
27
  import { PriceSparkline } from "../../../components/price-sparkline/view";
28
28
  import type { PricePoint } from "../../../types/financials";
29
29
  import { toneColor, withoutQuietColumns } from "../shared/research-cells";
30
+ import { logFailure } from "../../../utils/log-failure";
30
31
 
31
32
  /** A locked placeholder, or with `note` the line above them saying what free shows and what Pro adds. */
32
33
  type Item = { id: string; row: CompanyRow } | { id: string; row: null; note?: string };
@@ -92,7 +93,7 @@ function CompanyView({ symbol, exchange, name, mode, width, height, focused }: P
92
93
  const accessKey = `${session.requestKey}:${access.hasProAccess ? "full" : "preview"}`;
93
94
  const openUpgrade = useCloudUpgradeAction(mode === "kpis" ? "kpis" : "guide");
94
95
  const [snapshotSetting] = usePaneSettingValue<CompanyDataset | null>("companySnapshot", null);
95
- const snapshot = useMemo(() => { try { return snapshotSetting ? validateCompanyData(snapshotSetting) : null; } catch { return null; } }, [snapshotSetting]);
96
+ const snapshot = useMemo(() => { try { return snapshotSetting ? validateCompanyData(snapshotSetting) : null; } catch (error) { return logFailure("company-kpis.pane", "Validate company disclosures snapshot failed", null)(error); } }, [snapshotSetting]);
96
97
  const loader = useCallback((force: boolean) => snapshot ? Promise.resolve({ payload: snapshot, stale: false, refreshError: null })
97
98
  : loadCompanyData(mode, symbol!, accessKey, force, { exchange, name }), [mode, symbol, exchange, name, accessKey, snapshot]);
98
99
  const resource = useAsyncResource(symbol ? loader : null, { initialData: () => symbol ? cachedCompanyData(mode, symbol, accessKey, { exchange, name }) : null, clearOnError: isAccessDenied });
@@ -6,6 +6,7 @@ import { isRecord } from "../../../utils/guards";
6
6
  import { resolveIssuerListing } from "../shared/headless-market-data";
7
7
  import { companyQuery, fetchCompanyData, validateCompanyData, type CompanyDataset, type CompanyMode } from "./client";
8
8
  import { allGuidance, allObservations } from "./model";
9
+ import { logFailure } from "../../../utils/log-failure";
9
10
 
10
11
  interface Evidence { kind: "company-disclosures"; version: 1; complete: boolean; plottedValueCount: number; payload: CompanyDataset; mode: CompanyMode; tab: string; rowIds: string[]; }
11
12
  export function useCompanyEvidence(payload: CompanyDataset | null, mode: CompanyMode, tab: string, rowIds: string[]) {
@@ -20,7 +21,7 @@ function screenshotEvidence(mode: CompanyMode): PaneScreenshotEvidenceHook<Evide
20
21
  const symbol = resolved.createOptions?.symbol ?? resolved.createOptions?.arg;
21
22
  if (!symbol) throw new Error("A company disclosure screenshot requires a ticker");
22
23
  // A bare symbol takes the saved listing's venue, as the pane does.
23
- const saved = parsePublicTickerKey(symbol).exchange ? null : await context.store.loadTicker(symbol).catch(() => null);
24
+ const saved = parsePublicTickerKey(symbol).exchange ? null : await context.store.loadTicker(symbol).catch(logFailure("company-kpis.screenshot-evidence", "Load saved ticker for disclosure capture failed", null));
24
25
  const listing = await resolveIssuerListing(symbol, saved?.metadata.exchange, context.dataProvider);
25
26
  const payload = await fetchCompanyData(mode, symbol, companyQuery(resolved.options), apiClient, listing);
26
27
  // Keyed by the requested ticker: a listing abroad is answered under its bare symbol.
@@ -34,7 +35,7 @@ function screenshotEvidence(mode: CompanyMode): PaneScreenshotEvidenceHook<Evide
34
35
  const rows = "series" in payload ? allObservations(payload) : allGuidance(payload);
35
36
  if (value.plottedValueCount !== value.rowIds.length || value.rowIds.some((id) => !rows.some((row) => row.id === id))) return null;
36
37
  return value as unknown as Evidence;
37
- } catch { return null; }
38
+ } catch { /* Intentional ignore: invalid captured observations are rejected as evidence by returning null. */ return null; }
38
39
  },
39
40
  mismatches(evidence, { resolved, payload }) {
40
41
  const snapshot = payload.config.layout.instances.find((entry) => entry.instanceId === payload.paneId)?.settings?.companySnapshot;
@@ -1,7 +1,7 @@
1
1
  import type { CotClass, CotClassSummary, CotContractPayload, CotHistoryPoint } from "../../../api-client/cot";
2
2
  import type { HeadlessPaneColumn, HeadlessPaneDefinition } from "../../../types/plugin";
3
3
  import { fetchCotBoard, fetchCotContract } from "./client";
4
- import { COT_CLASSES, COT_FAMILIES, COT_MAJOR_CODES, COT_POSITIONS, COT_SCOPES, cotClass, cotContractCode, cotContractUnitText, cotFamily, cotInteger, cotMarketName, cotPositions, cotPositionsText, cotProxyFor, cotProxyNote, cotScope, cotUnknownMarketMessage } from "./model";
4
+ import { COT_CLASSES, COT_FAMILIES, COT_MAJOR_CODES, COT_POSITIONS, COT_SCOPES, cotClass, cotContractCode, cotContractUnitText, cotFamily, cotInteger, cotMarketName, cotPositions, cotPositionsText, cotProxyFor, cotProxyNote, cotReleaseTime, cotScope, cotUnknownMarketMessage } from "./model";
5
5
  import { COMMODITIES_VIEW_STATE } from "../commodities-energy/view-state";
6
6
  import { REPORT_ROWS } from "../shared/headless-options";
7
7
 
@@ -12,6 +12,12 @@ const signed = (value: unknown) => cotInteger(typeof value === "number" ? value
12
12
  const percent = (value: unknown) => typeof value === "number" ? `${value > 0 ? "+" : ""}${value.toFixed(1)}%` : "--";
13
13
  const rank = (value: unknown) => typeof value === "number" ? value.toFixed(0) : "--";
14
14
 
15
+ /** The report's release, by the CFTC's schedule, for an export's publication time; nothing outside the schedule. */
16
+ function cotReleased(asOf: string | null) {
17
+ const publishedAt = cotReleaseTime(asOf);
18
+ return publishedAt ? { freshness: { publishedAt } } : {};
19
+ }
20
+
15
21
  /** The pane's columns: percentiles as their rank value, net share of open interest to one decimal. */
16
22
  function cotPositionRow(row: CotClassSummary) {
17
23
  return { long: row.long, short: row.short, spreading: row.spreading, net: row.net,
@@ -83,7 +89,7 @@ export const cotHeadless: HeadlessPaneDefinition<"bundle"> = {
83
89
  ...Object.fromEntries(row.positions.map((position) => [`${camelClass(position.id)}Net`, position.net])) })) }],
84
90
  // "jet fuel" reads heating oil's positions, and says so.
85
91
  ...(proxy ? { notes: [cotProxyNote(proxy)] } : {}),
86
- errors: data.gaps, metadata: { ...data, complete: data.status === "available" } };
92
+ errors: data.gaps, metadata: { ...data, complete: data.status === "available" }, ...cotReleased(data.asOf) };
87
93
  }
88
94
  const traderClass = cotClass(family, args.options.traderClass);
89
95
  if (args.options.traderClass && traderClass !== args.options.traderClass) throw new Error("Trader class does not belong to this report family");
@@ -94,6 +100,6 @@ export const cotHeadless: HeadlessPaneDefinition<"bundle"> = {
94
100
  columns: [{ key: "marketName", header: "Market" }, { key: "contractCode", header: "Code" }, ...POSITION_COLUMNS,
95
101
  { key: "openInterest", header: "Open interest", align: "right", format: count }, { key: "reportDate", header: "As of" }],
96
102
  rows: rows.map((row) => ({ contractCode: row.contractCode, marketName: cotMarketName(row.marketName), reportDate: row.reportDate, openInterest: row.openInterest, ...cotPositionRow(row.position) })) }],
97
- errors: data.gaps, metadata: { ...data, scope, complete: data.status === "available" } };
103
+ errors: data.gaps, metadata: { ...data, scope, complete: data.status === "available" }, ...cotReleased(data.asOf) };
98
104
  },
99
105
  };
@@ -6,6 +6,7 @@ import { formatMarketPriceWithCurrency, formatPriceObservation } from "../../../
6
6
  import { futuresPricePer } from "../../../market-data/futures-contract";
7
7
  import { unitCurrencyToken } from "../../../time-series/price-units";
8
8
  import { cleanFloat32Price } from "../../../cli/history-rows";
9
+ import { zonedWallClockToUtcMs } from "../../../utils/zoned-date-time";
9
10
  import { cryptoPairCoin, isFuturesSymbol } from "../shared/crypto-pair";
10
11
  import {
11
12
  bestNameMatch, FUTURES_CONTRACTS, futuresBoardContract, futuresBoardContractForTicker, futuresContractByCode, futuresContractByName, type FuturesContract,
@@ -139,6 +140,14 @@ export type CotScope = typeof COT_SCOPES[number]["value"];
139
140
  export function cotScope(value: unknown): CotScope { return value === "all" ? "all" : "major"; }
140
141
 
141
142
  const rootAlias = (input: string) => ROOTS[input === "VIX" ? "VX" : input]?.code ?? null;
143
+ /** The CME currency futures by their currency's ISO code, as a reader of FX types them: JPY is 6J, the yen. */
144
+ const CURRENCY_FUTURES: Readonly<Record<string, string>> = {
145
+ EUR: "6E=F", JPY: "6J=F", GBP: "6B=F", CAD: "6C=F", AUD: "6A=F", CHF: "6S=F", MXN: "6M=F",
146
+ };
147
+ const currencyFuture = (input: string) => {
148
+ const symbol = CURRENCY_FUTURES[input];
149
+ return symbol ? Object.entries(PRICE_OVERLAYS).find(([, row]) => row.priceSymbol === symbol)?.[0] ?? null : null;
150
+ };
142
151
  const marketCode = (input: string) => /^[0-9A-Z]{5}[0-9A-Z+]$/.test(input) ? input : null;
143
152
  /**
144
153
  * The FUT board row a typed argument names, by code, symbol or commodity name
@@ -154,7 +163,8 @@ function typedMarket(value: string): { board: FuturesContract } | { root: string
154
163
  /**
155
164
  * A CFTC code, root or commodity name typed as an argument or stored in a
156
165
  * pane: every alias, crypto included, every FUT board root the CFTC reports,
157
- * and the names FUT finds them by (cocoa, coffee, sugar, gold, crude). A typed
166
+ * the names FUT finds them by (cocoa, coffee, sugar, gold, crude), and a
167
+ * currency's ISO code for its CME future (JPY, CHF, EUR). A typed
158
168
  * root is always the future, so ZM here is soybean meal, never Zoom. A CFTC
159
169
  * code is tried after the names, as one could be spelled with six letters
160
170
  * (COFFEE, COPPER).
@@ -162,7 +172,7 @@ function typedMarket(value: string): { board: FuturesContract } | { root: string
162
172
  export function cotContractCode(value: unknown): string | null {
163
173
  if (typeof value !== "string") return null;
164
174
  const input = value.trim().toUpperCase().replace(/=F$/, "");
165
- const alias = rootAlias(input);
175
+ const alias = rootAlias(input) ?? currencyFuture(input);
166
176
  if (alias) return alias;
167
177
  const market = typedMarket(value);
168
178
  if (market && "root" in market) return ROOTS[market.root]!.code;
@@ -199,7 +209,7 @@ export function cotProxyNote(proxy: { subject: string; root: string }): string {
199
209
  /** The markets the unknown-market hint names, by the code and the word a newcomer knows them by. */
200
210
  const SUGGESTED_MARKETS: ReadonlyArray<readonly [string, string]> = [
201
211
  ["ES", "S&P 500"], ["CL", "crude oil"], ["NG", "natural gas"], ["GC", "gold"], ["HG", "copper"],
202
- ["ZC", "corn"], ["CC", "cocoa"], ["KC", "coffee"], ["SB", "sugar"], ["ZN", "10-year note"],
212
+ ["ZC", "corn"], ["CC", "cocoa"], ["KC", "coffee"], ["SB", "sugar"], ["ZN", "10-year note"], ["JPY", "yen"],
203
213
  ];
204
214
  /**
205
215
  * What a market `cotContractCode` does not know is told: a FUT board row the
@@ -230,6 +240,37 @@ export function cotContractCodeForTicker(ticker: unknown): string | null {
230
240
  const board = futuresBoardContractForTicker(ticker);
231
241
  return rootAlias(input) ?? (board ? boardMarketCode(board) : null) ?? marketCode(input);
232
242
  }
243
+ /**
244
+ * The CFTC's published release schedule (cftc.gov, Commitments of Traders,
245
+ * Release Schedule, read 2026-11-01): 3:30 p.m. Eastern on the Friday after
246
+ * the Tuesday the positions are as of, or the day a federal holiday moved that
247
+ * Friday's release to. Years it has not published, and 2027 with its move to
248
+ * two releases a week, are left out rather than guessed.
249
+ */
250
+ const COT_SCHEDULED_YEARS: ReadonlySet<number> = new Set([2026]);
251
+ const COT_DELAYED_RELEASES: Readonly<Record<string, string>> = {
252
+ "2026-01-02": "2026-01-05", "2026-06-19": "2026-06-22", "2026-07-03": "2026-07-06",
253
+ "2026-11-13": "2026-11-16", "2026-11-27": "2026-11-30", "2026-12-25": "2026-12-28",
254
+ };
255
+ const DAY_MS = 86_400_000;
256
+ /**
257
+ * When the CFTC released the report of positions as of `reportDate`, an ISO
258
+ * instant, by its schedule (`COT_SCHEDULED_YEARS`). Null for a date that is
259
+ * no Tuesday or a release outside the schedule, which an export then says was
260
+ * not published.
261
+ */
262
+ export function cotReleaseTime(reportDate: string | null | undefined): string | null {
263
+ const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(reportDate ?? "");
264
+ if (!match) return null;
265
+ const tuesday = Date.UTC(Number(match[1]), Number(match[2]) - 1, Number(match[3]));
266
+ if (new Date(tuesday).getUTCDay() !== 2) return null;
267
+ const friday = new Date(tuesday + 3 * DAY_MS).toISOString().slice(0, 10);
268
+ const day = COT_DELAYED_RELEASES[friday] ?? friday;
269
+ const [year, month, date] = day.split("-").map(Number) as [number, number, number];
270
+ if (!COT_SCHEDULED_YEARS.has(year)) return null;
271
+ return new Date(zonedWallClockToUtcMs("America/New_York", year, month, date, 15, 30, 0)).toISOString();
272
+ }
273
+
233
274
  /** The futures root a CFTC code belongs to, for titles readers recognize: a verified alias, else its FUT board root. */
234
275
  export function cotRoot(code: string): string | null {
235
276
  return Object.entries(ROOTS).find(([, row]) => row.code === code)?.[0]
@@ -22,7 +22,7 @@ const currency = (value: unknown) => value === null || (text(value) && /^[A-Z]{3
22
22
  const day = (value: unknown): value is string => text(value) && /^\d{4}-\d{2}-\d{2}$/.test(value) && Number.isFinite(Date.parse(value)) && new Date(value).toISOString().slice(0, 10) === value;
23
23
  const nullableDay = (value: unknown) => value === null || day(value);
24
24
  const strings = (value: unknown): value is string[] => Array.isArray(value) && value.every(text);
25
- const url = (value: unknown) => { try { return text(value) && ["https:", "http:"].includes(new URL(value).protocol); } catch { return false; } };
25
+ const url = (value: unknown) => { try { return text(value) && ["https:", "http:"].includes(new URL(value).protocol); } catch { /* Intentional ignore: malformed URLs fail this web link field validator. */ return false; } };
26
26
  const unique = (rows: readonly { id: string }[]) => new Set(rows.map((row) => row.id)).size === rows.length;
27
27
  function fact(row: CreditFact): boolean {
28
28
  return !!row && [row.id, row.instrumentId, row.documentId, row.field, row.instrumentName, row.factKey, row.form, row.language].every(text)
@@ -45,7 +45,7 @@ export const creditScreenshotEvidence: PaneScreenshotEvidenceHook<CreditEvidence
45
45
  const eligible = new Set(value.tab === "capital" ? payload.instruments.map((row) => row.id) : value.tab === "covenants" ? payload.covenants.map((row) => row.id) : value.tab === "screen" ? (screen?.rows ?? []).map(screenRowId) : payload.maturities.flatMap((row) => row.instruments.map((instrument) => `${row.year}:${instrument.id}`)));
46
46
  if (new Set(value.rowIds).size !== value.rowIds.length || value.rowIds.some((id) => !eligible.has(id as string))) return null;
47
47
  return value as unknown as CreditEvidence;
48
- } catch { return null; }
48
+ } catch { /* Intentional ignore: invalid captured observations are rejected as evidence by returning null. */ return null; }
49
49
  },
50
50
  mismatches(evidence, { resolved, payload }) {
51
51
  const settings = payload.config.layout.instances.find((entry) => entry.instanceId === payload.paneId)?.settings;
@@ -20,6 +20,7 @@ import { CreditInstrumentDetail } from "./detail";
20
20
  import { useCreditEvidence } from "./evidence";
21
21
  import { HeadroomGauge } from "./gauge";
22
22
  import { capitalCell, capitalColumns, capitalFigures, comparatorSymbol, covenantColumns, covenantFact, covenantReason, covenantUsage, CREDIT_EMPTY_TITLE, creditEmptyCause, CREDIT_TABS, creditAmount, covenantNumber, creditCurrencies, creditMaturityRows, creditPercent, creditTab, fieldLabel, headroomTone, instrumentOutstanding, isClosed, maturityAxis, maturityColumns, maturitySeries, maturityShares, NO_VALUE, screenColumns, screenRowId, screenSignal, sentence } from "./model";
23
+ import { logFailure } from "../../../utils/log-failure";
23
24
 
24
25
  type Row = { numbers?: Record<string, number | null>; id: string; values: Record<string, string>; instrumentId?: string; covenant?: CreditHeadroom; screen?: CreditScreenRow; year?: number; locked?: boolean; closed?: boolean };
25
26
  const rowId = (row: Row) => row.id;
@@ -54,7 +55,7 @@ function CreditView({ symbol, width, height, focused, accessKey, needsVerificati
54
55
  const [snapshotSetting] = usePaneSettingValue<CreditDocumentsPayload | null>("creditSnapshot", null);
55
56
  const [screenSnapshot] = usePaneSettingValue<CreditScreenPayload | null>("creditScreenSnapshot", null);
56
57
  const [instrumentSnapshot] = usePaneSettingValue<CreditInstrument | null>("creditInstrumentSnapshot", null);
57
- const snapshot = useMemo(() => { try { return snapshotSetting ? validateCreditDocuments(snapshotSetting, symbol ? creditIssuerSymbol(symbol) : undefined) : null; } catch { return null; } }, [snapshotSetting, symbol]);
58
+ const snapshot = useMemo(() => { try { return snapshotSetting ? validateCreditDocuments(snapshotSetting, symbol ? creditIssuerSymbol(symbol) : undefined) : null; } catch (error) { return logFailure("credit-documents.pane", "Validate credit documents snapshot failed", null)(error); } }, [snapshotSetting, symbol]);
58
59
  const loader = useCallback((force: boolean) => snapshot ? Promise.resolve({ payload: snapshot, stale: false, refreshError: null }) : loadCredit(symbol!, accessKey, force), [symbol, accessKey, snapshot]);
59
60
  const resource = useAsyncResource(symbol ? loader : null, { initialData: () => symbol ? cachedCredit(symbol, accessKey) : null, clearOnError: isAccessDenied });
60
61
  const data = resource.data?.payload ?? null;
@@ -647,7 +647,7 @@ function CallsListView({
647
647
  // which is a deliberate act reserved for Enter.
648
648
  const prefetchTranscript = useCallback((call: CloudEarningsCallPayload) => {
649
649
  if (!call.hasTranscript || !access.emailVerified || !access.hasProAccess) return;
650
- void loadTranscript(call.id).catch(() => {});
650
+ void loadTranscript(call.id).catch(() => { /* Intentional ignore: a warm-up that fails is loaded again, and its failure shown, when the call opens. */ });
651
651
  }, [access.emailVerified, access.hasProAccess]);
652
652
 
653
653
  // A published transcript is immutable, so it loads once per call. Opening
@@ -2,8 +2,13 @@ import type { PluginModule } from "../plugin-module";
2
2
  import { formatTickerListInput, parseTickerListInput } from "../../../tickers/list";
3
3
  import { earningsRippleHeadless } from "./headless";
4
4
 
5
+ /**
6
+ * The tickers a typed argument names. A list the command bar refuses (more than
7
+ * ten) throws its message rather than opening the pane on the person's holdings.
8
+ * `fn` and `shot` pass their own list as `symbols` and never get here.
9
+ */
5
10
  function namedSymbols(arg: string | undefined): string[] {
6
- try { return arg?.trim() ? parseTickerListInput(arg) : []; } catch { return []; }
11
+ return arg?.trim() ? parseTickerListInput(arg) : [];
7
12
  }
8
13
 
9
14
  export const earningsRippleModule: PluginModule = {
@@ -320,6 +320,7 @@ function isCountryCode(code: string): boolean {
320
320
  try {
321
321
  regionNames = new Intl.DisplayNames(["en"], { type: "region", fallback: "none" });
322
322
  } catch {
323
+ // Intentional ignore: a runtime without region names accepts any two-letter code instead.
323
324
  regionNames = null;
324
325
  }
325
326
  }
@@ -328,6 +329,7 @@ function isCountryCode(code: string): boolean {
328
329
  // ZZ is CLDR's "Unknown Region".
329
330
  return code !== "ZZ" && regionNames.of(code) !== undefined;
330
331
  } catch {
332
+ // Intentional ignore: a code the runtime's region names reject is no country code.
331
333
  return false;
332
334
  }
333
335
  }
@@ -141,18 +141,18 @@ const GROUPS: ReadonlyArray<{ group: string; rows: readonly FredRow[] }> = [
141
141
  {
142
142
  group: "FX",
143
143
  rows: [
144
- ["DEXUSEU", "Euro (USD per EUR)", "USD", "daily", ["EURUSD", "EUR"]],
145
- ["DEXUSUK", "British pound (USD per GBP)", "USD", "daily", ["GBPUSD", "GBP", "sterling"]],
144
+ ["DEXUSEU", "Euro (USD per EUR)", "USD", "daily", ["EURUSD", "EUR", "euro"]],
145
+ ["DEXUSUK", "British pound (USD per GBP)", "USD", "daily", ["GBPUSD", "GBP", "sterling", "pound"]],
146
146
  ["DEXUSAL", "Australian dollar (USD per AUD)", "USD", "daily", ["AUDUSD", "AUD"]],
147
147
  ["DEXUSNZ", "New Zealand dollar (USD per NZD)", "USD", "daily", ["NZDUSD", "NZD"]],
148
- ["DEXJPUS", "Japanese yen (JPY per USD)", "JPY", "daily", ["USDJPY", "JPY"]],
149
- ["DEXCHUS", "Chinese yuan (CNY per USD)", "CNY", "daily", ["USDCNY", "CNY", "renminbi"]],
148
+ ["DEXJPUS", "Japanese yen (JPY per USD)", "JPY", "daily", ["USDJPY", "JPY", "yen"]],
149
+ ["DEXCHUS", "Chinese yuan (CNY per USD)", "CNY", "daily", ["USDCNY", "CNY", "renminbi", "yuan"]],
150
150
  ["DEXINUS", "Indian rupee (INR per USD)", "INR", "daily", ["USDINR", "INR"]],
151
151
  ["DEXBZUS", "Brazilian real (BRL per USD)", "BRL", "daily", ["USDBRL", "BRL"]],
152
152
  ["DEXMXUS", "Mexican peso (MXN per USD)", "MXN", "daily", ["USDMXN", "MXN"]],
153
153
  ["DEXKOUS", "South Korean won (KRW per USD)", "KRW", "daily", ["USDKRW", "KRW"]],
154
154
  ["DEXCAUS", "Canadian dollar (CAD per USD)", "CAD", "daily", ["USDCAD", "CAD"]],
155
- ["DEXSZUS", "Swiss franc (CHF per USD)", "CHF", "daily", ["USDCHF", "CHF"]],
155
+ ["DEXSZUS", "Swiss franc (CHF per USD)", "CHF", "daily", ["USDCHF", "CHF", "franc", "swiss franc"]],
156
156
  ["DEXTAUS", "Taiwan dollar (TWD per USD)", "TWD", "daily", ["USDTWD", "TWD"]],
157
157
  ["DEXHKUS", "Hong Kong dollar (HKD per USD)", "HKD", "daily", ["USDHKD", "HKD"]],
158
158
  ["DEXSIUS", "Singapore dollar (SGD per USD)", "SGD", "daily", ["USDSGD", "SGD"]],
@@ -11,6 +11,7 @@ import {
11
11
  type EconCalendarCacheEntry,
12
12
  } from "./calendar-model";
13
13
  import type { EconEvent } from "./types";
14
+ import { logFailure } from "../../../utils/log-failure";
14
15
 
15
16
  /** The ECO setting that turns the print toast on. Off until the user turns it on, as breaking news is. */
16
17
  export const ECON_PRINT_NOTIFICATIONS_ENABLED_KEY = "econPrintNotificationsEnabled";
@@ -172,8 +173,9 @@ export function startHighImpactPrintWatch(
172
173
  try {
173
174
  // A due print is asked for past the cache; otherwise a fresh cache answers without a request.
174
175
  observe(await deps.load(due), before);
175
- } catch {
176
+ } catch (error) {
176
177
  // The next ask follows the same schedule.
178
+ logFailure("econ.print-watch", "Load calendar for print watch failed")(error);
177
179
  } finally {
178
180
  running = false;
179
181
  }
@@ -22,6 +22,21 @@ function futuresSeriesUnit(contract: FuturesContract): string {
22
22
  return "USD";
23
23
  }
24
24
 
25
+ /**
26
+ * Words a contract is looked for by that its name does not hold: a currency
27
+ * future by its currency's code and name (`yen`, `JPY` for 6J), and the safe
28
+ * havens, gold, the yen and the franc.
29
+ */
30
+ const CONTRACT_TAGS: Readonly<Record<string, readonly string[]>> = {
31
+ GC: ["safe haven"],
32
+ "6E": ["EUR", "euro"],
33
+ "6J": ["JPY", "yen", "safe haven"],
34
+ "6B": ["GBP", "pound", "sterling"],
35
+ "6A": ["AUD", "aussie"],
36
+ "6C": ["CAD", "loonie"],
37
+ "6S": ["CHF", "franc", "swiss franc", "safe haven"],
38
+ };
39
+
25
40
  /** Each continuous front-month contract on the futures board, as `FUT:ES`. */
26
41
  const FRONT_MONTH_SERIES: readonly SeriesDefinition[] = FUTURES_CONTRACTS.map((contract) => ({
27
42
  id: `fut:${contract.code}`,
@@ -29,7 +44,7 @@ const FRONT_MONTH_SERIES: readonly SeriesDefinition[] = FUTURES_CONTRACTS.map((c
29
44
  unit: futuresSeriesUnit(contract),
30
45
  frequency: "daily",
31
46
  group: "Futures",
32
- tags: [contract.code, FUTURES_SECTOR_LABELS[contract.sector], "futures", "front month"],
47
+ tags: [contract.code, FUTURES_SECTOR_LABELS[contract.sector], "futures", "front month", ...CONTRACT_TAGS[contract.code] ?? []],
33
48
  expression: `FUT:${contract.code}`,
34
49
  }));
35
50
 
@@ -7,7 +7,7 @@ import { servedFromSavedCopy } from "../../../data/saved-copies";
7
7
  import { fxPairObservation, fxRateObservations } from "../shared/fx-rate-freshness";
8
8
  import { loadFxBoard, type FxLegReading } from "./client";
9
9
  import { crossMovePercent } from "./direction";
10
- import { formatRate, resolveCurrencies, type FxCurrency } from "./pairs";
10
+ import { FX_CURRENCY_KEYWORDS, formatRate, resolveCurrencies, type FxCurrency } from "./pairs";
11
11
  import { FX_MATRIX_REPORT_OPTIONS, fxMatrixReportNotices } from "./settings";
12
12
 
13
13
  const iso = (time: number | null | undefined) => time != null && Number.isFinite(time) ? new Date(time).toISOString() : null;
@@ -143,7 +143,9 @@ export const fxMatrixHeadless: HeadlessPaneDefinition<"rows"> = {
143
143
  freshness: { source: "Gloom Cloud" },
144
144
  describe: (args) => `FX Cross Rates | ${resolveCurrencies(args.options.currencies).join(" ")}`,
145
145
  discovery: {
146
- intents: ["fx", "forex", "currency", "cross rates", "exchange rates"],
146
+ // A currency's code or name finds the board (`catalog yen`, `catalog chf`), and so do the safe havens it
147
+ // carries, the yen and the franc. Searched, never listed: the catalog's Keywords line stays short.
148
+ intents: ["fx", "forex", "currency", "cross rates", "exchange rates", "safe haven", ...FX_CURRENCY_KEYWORDS],
147
149
  limitations: ["Indicative crosses through USD legs, whose observation times can differ."],
148
150
  screenshotReadiness: "live-dom",
149
151
  },
@@ -9,6 +9,8 @@ import {
9
9
  type PaneFooterSegment,
10
10
  } from "../../../components";
11
11
  import { handleRefreshKey } from "../../../components/data-table/table-pane";
12
+ import { createDataTableCsv } from "../../../components/data-table/export";
13
+ import { dropColumnsToFit } from "../../../components/ui/table-layout";
12
14
  import { ageFooterSegment, savedCopyFooterSegment } from "../../../components/layout/pane/footer";
13
15
  import { CountryFlag } from "../../../components/ui/country-flag";
14
16
  import { getSharedMarketDataCoordinator } from "../../../market-data/coordinator";
@@ -46,6 +48,31 @@ const RATE_COLUMN_WIDTH = 10;
46
48
  /** Snapshot rates reload at this pace while the feed is not carrying every leg. */
47
49
  const FX_FALLBACK_REFRESH_MS = 60_000;
48
50
 
51
+ /**
52
+ * The board's columns for a pane `width` cells wide: whole currency columns
53
+ * give way from the right until the rest fit (`dropColumnsToFit`), the first
54
+ * currency always kept. A board with more rows than `height` holds keeps a
55
+ * cell for its scrollbar.
56
+ */
57
+ function fxMatrixColumnsToFit<C extends DataTableColumn>(
58
+ columns: readonly C[], currencies: readonly string[], width: number, height: number,
59
+ ): C[] {
60
+ const scrollbar = currencies.length + 1 > height ? 1 : 0;
61
+ return dropColumnsToFit(columns, Math.floor(width) - scrollbar, currencies.slice(1).reverse());
62
+ }
63
+
64
+ /** "1 column hidden" in the footer, the codes in its title, for a pane too narrow for every currency. */
65
+ export function fxHiddenColumnsSegment(hidden: readonly string[]): PaneFooterSegment {
66
+ const count = hidden.length;
67
+ return {
68
+ id: "hidden-columns",
69
+ // A capture keeps it, as a picture cannot scroll to the columns it left out.
70
+ capture: true,
71
+ title: `${hidden.join(", ")} ${count === 1 ? "is" : "are"} not shown as ${count === 1 ? "a column" : "columns"}: widen the pane`,
72
+ parts: [{ text: `${count} ${count === 1 ? "column" : "columns"} hidden`, tone: "muted" }],
73
+ };
74
+ }
75
+
49
76
  function FxMatrixPane({ focused, width, height }: PaneProps) {
50
77
  const dataProvider = useAssetData();
51
78
  const flagged = useUiCapabilities().nativePaneChrome === true;
@@ -181,7 +208,7 @@ function FxMatrixPane({ focused, width, height }: PaneProps) {
181
208
  intervalMs: allLegsLive ? null : FX_FALLBACK_REFRESH_MS,
182
209
  });
183
210
 
184
- const columns = useMemo<DataTableColumn[]>(() => [
211
+ const allColumns = useMemo<DataTableColumn[]>(() => [
185
212
  { id: "base", label: "", width: flagged ? FLAGGED_BASE_COLUMN_WIDTH : BASE_COLUMN_WIDTH, align: "left" },
186
213
  ...currencies.map((currency) => ({
187
214
  id: currency,
@@ -191,6 +218,10 @@ function FxMatrixPane({ focused, width, height }: PaneProps) {
191
218
  headerLeading: flagged ? CURRENCY_FLAGS.get(currency) : undefined,
192
219
  })),
193
220
  ], [currencies, flagged]);
221
+ // A pane too narrow for every currency drops whole columns from the right, never cutting a rate at its edge, and
222
+ // the footer says how many (a capture keeps it): each one's rates still read along its row. The first stays.
223
+ const columns = useMemo(() => fxMatrixColumnsToFit(allColumns, currencies, width, height), [allColumns, currencies, height, width]);
224
+ const hiddenCurrencies = currencies.length - (columns.length - 1);
194
225
 
195
226
  const renderCell = useCallback((
196
227
  row: FxCurrency,
@@ -240,13 +271,13 @@ function FxMatrixPane({ focused, width, height }: PaneProps) {
240
271
  const updatedAgo = useUpdatedAgo(status.latestFetchedAt || null);
241
272
 
242
273
  usePaneFooter(FX_MATRIX_PANE_ID, () => {
243
- const info: PaneFooterSegment[] = [];
274
+ const info: PaneFooterSegment[] = hiddenCurrencies > 0 ? [fxHiddenColumnsSegment(currencies.slice(columns.length - 1))] : [];
244
275
  if (status.loading > 0) info.push({ id: "loading", parts: [{ text: "loading", tone: "muted" }] });
245
276
  if (statusText) info.push({ id: "rates", parts: [{ text: statusText, tone: status.stale || status.unknownTime || status.unavailable ? "warning" : "muted" }] });
246
277
  if (savedAt != null) info.push(savedCopyFooterSegment("updated", savedAt));
247
278
  else if (updatedAgo) info.push(ageFooterSegment(updatedAgo, { verb: "fetched" }));
248
279
  return { info };
249
- }, [savedAt, status.loading, statusText, updatedAgo]);
280
+ }, [columns.length, currencies, hiddenCurrencies, savedAt, status.loading, statusText, updatedAgo]);
250
281
 
251
282
  return (
252
283
  <DataTableView<FxCurrency>
@@ -263,6 +294,9 @@ function FxMatrixPane({ focused, width, height }: PaneProps) {
263
294
  freezeFirstColumn
264
295
  getExportMetadata={() => createFxExportMetadata(currencies, rates,
265
296
  (currency) => rateEntries.get(currency))}
297
+ // An export carries every currency, the columns a narrow pane leaves out too.
298
+ exportCsv={() => createDataTableCsv({ columns: allColumns, items: dataProvider ? currencies : [], renderCell,
299
+ getExportMetadata: () => createFxExportMetadata(currencies, rates, (currency) => rateEntries.get(currency)) })}
266
300
  items={dataProvider ? currencies : []}
267
301
  sortColumnId={null}
268
302
  sortDirection="asc"
@@ -1,3 +1,5 @@
1
+ import { WORD_CURRENCY_CODES } from "../../../utils/currency-names";
2
+
1
3
  /** The default board, in its default order. */
2
4
  export const MAJOR_CURRENCIES = ["USD", "EUR", "GBP", "JPY", "CHF", "CAD", "AUD", "NZD"] as const;
3
5
 
@@ -15,6 +17,19 @@ export const FX_CURRENCIES = [
15
17
  ] as const;
16
18
  export type FxCurrency = typeof FX_CURRENCIES[number];
17
19
 
20
+ /**
21
+ * The words a reader looks for the board by: the codes it carries (but those
22
+ * that are English words) and the names of its currencies, so `catalog yen`,
23
+ * `catalog chf` and `catalog "swiss franc"` find it. "cad" is a word too, yet
24
+ * in a market catalog it is the loonie far more often than not, so it still
25
+ * finds the board; only the fx line waits for CAD in capitals.
26
+ */
27
+ export const FX_CURRENCY_KEYWORDS: readonly string[] = [
28
+ ...FX_CURRENCIES.filter((code) => code === "CAD" || !WORD_CURRENCY_CODES.has(code)).map((code) => code.toLowerCase()),
29
+ "dollar", "euro", "yen", "pound", "sterling", "franc", "swiss franc", "loonie", "aussie", "kiwi", "yuan", "renminbi",
30
+ "krona", "krone", "won", "rupee", "rupiah", "ringgit", "baht", "peso", "rand", "lira", "zloty", "forint", "koruna", "shekel",
31
+ ];
32
+
18
33
  /** The flag each currency wears on the desktop and web; the euro is the EU's, not one member's. */
19
34
  export const CURRENCY_FLAG_REGIONS: Record<FxCurrency, string> = {
20
35
  USD: "US", EUR: "EU", GBP: "GB", JPY: "JP", CHF: "CH", CAD: "CA", AUD: "AU", NZD: "NZ",
@@ -9,6 +9,7 @@ import {
9
9
  import { quoteFreshnessFields } from "../shared/report-freshness";
10
10
  import { countOf, freePreviewNote } from "../shared/free-preview";
11
11
  import { getRegularSessionDisplay } from "../../../market-data/market/status";
12
+ import { logFailure } from "../../../utils/log-failure";
12
13
 
13
14
  const observationRow = (row: GpuObservation) => ({ gpu: gpuLabel(row), source: gpuSource(row), basis: gpuBasisLabel(row.basis),
14
15
  price: row.pricePerGpuHr, availability: row.availability, observedAt: row.observedAt, effectiveAt: row.effectiveAt, provenance: row.provenance ?? "live", provenanceLabel: gpuProvenanceLabel(row, true),
@@ -98,7 +99,7 @@ export const gpuHeadless: HeadlessPaneDefinition<"bundle"> = {
98
99
  const related = gpuEquityRows(rows, selected, !!board.access?.locked);
99
100
  const histories = await loadGpuEquityHistory(ctx.marketData);
100
101
  const equities = await Promise.all(related.map(async (row) => {
101
- const quote = await ctx.marketData.getQuote(row.symbol, row.exchange).catch(() => null);
102
+ const quote = await ctx.marketData.getQuote(row.symbol, row.exchange).catch(logFailure("gpu.headless", "Load GPU equity quote failed", null));
102
103
  const history = histories.find((entry) => entry.symbol === row.symbol);
103
104
  // The regular session's last and move, as the pane's board shows them.
104
105
  const headline = getRegularSessionDisplay(quote);
@@ -27,6 +27,7 @@ import { Box, Text, TextAttributes, useRendererHost } from "../../../ui";
27
27
  import { useDialog, useDialogKeyboard, type AlertContext } from "../../../ui/dialog";
28
28
  import { getSharedRegistry } from "../../registry";
29
29
  import type { HelpFunction } from "./function-index";
30
+ import { logFailure } from "../../../utils/log-failure";
30
31
 
31
32
  export type FunctionHelpRequest =
32
33
  /** `inAppDocs: false` where DOCS cannot open (a popped-out window). */
@@ -209,7 +210,7 @@ export function useFunctionHelpHost({ closeCommandBar }: { closeCommandBar: () =
209
210
  content: (context: AlertContext) => (
210
211
  <FunctionHelpCard {...context} fn={request.fn} width={width} compact={compact} inAppDocs={request.inAppDocs !== false} />
211
212
  ),
212
- }).catch(() => {}).finally(() => {
213
+ }).catch(logFailure("help.function-card", "Open function help card failed")).finally(() => {
213
214
  openRef.current = false;
214
215
  });
215
216
  };