gloomberb 0.20.13 → 0.20.14

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 (155) hide show
  1. package/package.json +2 -1
  2. package/patches/@opentui%2Fcore@0.3.2.patch +22 -4
  3. package/src/account/auth-dialog.tsx +22 -4
  4. package/src/account/auth-form.tsx +6 -1
  5. package/src/account/checkout-handoff.tsx +7 -14
  6. package/src/account/device-signin-dialog.tsx +35 -24
  7. package/src/api-client/crypto-markets.ts +10 -0
  8. package/src/api-client/errors.ts +3 -1
  9. package/src/api-client/money-markets.ts +7 -0
  10. package/src/api-client/request.ts +12 -2
  11. package/src/architecture/floating-promise-allowlist.json +0 -1
  12. package/src/brokers/signed-in/sign-in-dialog.tsx +38 -38
  13. package/src/cli/commands/market.ts +95 -23
  14. package/src/cli/commands/overview.ts +18 -4
  15. package/src/cli/errors.ts +3 -1
  16. package/src/cli/freshness.ts +7 -2
  17. package/src/cli/glossary.ts +10 -5
  18. package/src/cli/helpers.ts +8 -16
  19. package/src/cli/history-export.ts +4 -0
  20. package/src/cli/known-gaps.ts +2 -2
  21. package/src/cli/listing-arg.ts +79 -11
  22. package/src/cli/not-a-ticker.ts +4 -0
  23. package/src/cli/pane-functions/catalog.ts +29 -8
  24. package/src/cli/pane-functions/headless.ts +5 -2
  25. package/src/cli/pane-functions/options.ts +7 -0
  26. package/src/cli/pane-functions/resolver.ts +61 -15
  27. package/src/cli/result.ts +22 -4
  28. package/src/cli/symbol-args.ts +5 -3
  29. package/src/cli/symbol-list.ts +23 -10
  30. package/src/cli/symbol-rows.ts +135 -3
  31. package/src/cli/treasury-yields.ts +15 -1
  32. package/src/components/chart/composite/format.ts +2 -1
  33. package/src/components/chart/composite/panel-surface/axis-markers.ts +133 -0
  34. package/src/components/chart/composite/panel-surface/level-labels.tsx +78 -0
  35. package/src/components/chart/composite/panel-surface/overlays.ts +108 -0
  36. package/src/components/chart/composite/panel-surface/pan-coast.ts +54 -0
  37. package/src/components/chart/composite/panel-surface/panel-cursor.tsx +138 -0
  38. package/src/components/chart/composite/panel-surface/panel-levels.ts +47 -0
  39. package/src/components/chart/composite/panel-surface/plot-gestures.ts +403 -0
  40. package/src/components/chart/composite/panel-surface/plot-pointer.ts +65 -0
  41. package/src/components/chart/composite/panel-surface/plot-wheel.ts +102 -0
  42. package/src/components/chart/composite/panel-surface/pointer.ts +12 -0
  43. package/src/components/chart/composite/panel-surface/props.ts +79 -0
  44. package/src/components/chart/composite/panel-surface/tool-readout.ts +151 -0
  45. package/src/components/chart/composite/panel-surface/value-axis-gestures.ts +152 -0
  46. package/src/components/chart/composite/panel-surface.tsx +81 -1177
  47. package/src/components/command-bar/commands/collection-list.ts +1 -0
  48. package/src/components/command-bar/routes/root/results.ts +3 -2
  49. package/src/components/command-bar/routes/root/runtime.ts +3 -2
  50. package/src/components/command-bar/routes/root/selection.ts +3 -2
  51. package/src/components/command-bar/routes/root/shortcuts.ts +15 -0
  52. package/src/components/layout/pane/title.ts +10 -4
  53. package/src/components/pane-settings-dialog/tui.tsx +6 -3
  54. package/src/components/pane-settings-dialog.tsx +2 -1
  55. package/src/components/pane-template-wizard.tsx +2 -0
  56. package/src/components/ui/choice-dialog.tsx +1 -1
  57. package/src/components/ui/confirm-dialog.tsx +3 -2
  58. package/src/components/ui/frame.tsx +7 -3
  59. package/src/components/ui/icon.tsx +4 -2
  60. package/src/components/ui/list-view.tsx +8 -0
  61. package/src/components/ui/number-prompt-dialog.tsx +2 -1
  62. package/src/components/use-pane-notice-footer.tsx +3 -1
  63. package/src/docs/snapshot.json +2 -2
  64. package/src/i18n/es.ts +1 -0
  65. package/src/i18n/ja.ts +1 -0
  66. package/src/i18n/ko.ts +1 -0
  67. package/src/i18n/zh-cn.ts +1 -0
  68. package/src/i18n/zh-tw.ts +1 -0
  69. package/src/market-data/market/format.ts +35 -1
  70. package/src/market-data/quotes/contributions.ts +13 -0
  71. package/src/market-data/quotes/export-identity.ts +36 -1
  72. package/src/market-data/quotes/resolution.ts +16 -0
  73. package/src/plugins/builtin/account-management/password-dialog.tsx +2 -2
  74. package/src/plugins/builtin/analytics/risk-client.ts +12 -2
  75. package/src/plugins/builtin/analytics/risk-headless.ts +66 -6
  76. package/src/plugins/builtin/analytics/risk-math.ts +23 -6
  77. package/src/plugins/builtin/analytics/risk-model.ts +20 -9
  78. package/src/plugins/builtin/analytics/risk-pane.tsx +2 -2
  79. package/src/plugins/builtin/chart-composer/catalog-inventory.ts +5 -2
  80. package/src/plugins/builtin/chart-composer/editor.tsx +1 -0
  81. package/src/plugins/builtin/chart-composer/pane.tsx +1 -1
  82. package/src/plugins/builtin/chart-composer/quick-add.tsx +4 -1
  83. package/src/plugins/builtin/chart-composer/series-catalog.ts +17 -1
  84. package/src/plugins/builtin/cloud/plugin.tsx +2 -0
  85. package/src/plugins/builtin/cloud/thesis/module.tsx +2 -0
  86. package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +6 -2
  87. package/src/plugins/builtin/cpi/headless.ts +6 -1
  88. package/src/plugins/builtin/cpi/model.ts +17 -0
  89. package/src/plugins/builtin/cpi/pane.tsx +3 -1
  90. package/src/plugins/builtin/crypto-board/client.ts +6 -1
  91. package/src/plugins/builtin/crypto-board/headless.ts +10 -2
  92. package/src/plugins/builtin/crypto-board/model.ts +89 -11
  93. package/src/plugins/builtin/crypto-board/pane.tsx +20 -5
  94. package/src/plugins/builtin/dividend-yield/client.ts +24 -2
  95. package/src/plugins/builtin/dividend-yield/headless.ts +4 -2
  96. package/src/plugins/builtin/dividend-yield/ranking.ts +2 -1
  97. package/src/plugins/builtin/dividend-yield/view.ts +5 -1
  98. package/src/plugins/builtin/earnings/history-table.ts +8 -0
  99. package/src/plugins/builtin/earnings-ripple/index.tsx +2 -0
  100. package/src/plugins/builtin/econ/calendar-model.ts +17 -1
  101. package/src/plugins/builtin/econ/fred-catalog.ts +33 -4
  102. package/src/plugins/builtin/econ-statistics/headless.ts +21 -0
  103. package/src/plugins/builtin/macro-day/headless.ts +21 -10
  104. package/src/plugins/builtin/macro-day/model.ts +40 -3
  105. package/src/plugins/builtin/macro-day/pane.tsx +26 -8
  106. package/src/plugins/builtin/macro-day/releases.ts +24 -1
  107. package/src/plugins/builtin/money-markets/client.ts +4 -1
  108. package/src/plugins/builtin/money-markets/headless.ts +15 -4
  109. package/src/plugins/builtin/money-markets/index.tsx +1 -1
  110. package/src/plugins/builtin/money-markets/pane.tsx +7 -1
  111. package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +4 -2
  112. package/src/plugins/builtin/portfolio-list/cli/period-report.ts +61 -11
  113. package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +11 -3
  114. package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +2 -0
  115. package/src/plugins/builtin/portfolio-list/headless.ts +33 -6
  116. package/src/plugins/builtin/portfolio-list/pane/index.tsx +5 -3
  117. package/src/plugins/builtin/portfolio-list/pane/period-pnl.ts +24 -6
  118. package/src/plugins/builtin/portfolio-list/period-pnl.ts +16 -1
  119. package/src/plugins/builtin/portfolio-list/summary/index.tsx +4 -1
  120. package/src/plugins/builtin/portfolio-list/summary/totals.ts +6 -4
  121. package/src/plugins/builtin/portfolio-list/table.tsx +25 -15
  122. package/src/plugins/builtin/shared/cloud-upgrade.ts +4 -2
  123. package/src/plugins/builtin/shared/cpi-year-gap.ts +67 -0
  124. package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +45 -2
  125. package/src/plugins/builtin/ticker-detail/headless.ts +26 -1
  126. package/src/plugins/builtin/ticker-detail/overview/components.tsx +4 -5
  127. package/src/plugins/builtin/ticker-detail/overview/model.ts +4 -1
  128. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +10 -2
  129. package/src/portfolio/collection-name.ts +2 -1
  130. package/src/portfolio/column-values.ts +14 -4
  131. package/src/portfolio/listed-symbol.ts +4 -2
  132. package/src/portfolio/period-pnl.ts +51 -1
  133. package/src/renderers/dom/dialog-host.tsx +5 -5
  134. package/src/renderers/electrobun/view/remote/capability-invoker.ts +1 -1
  135. package/src/renderers/opentui/dialog-host.tsx +3 -4
  136. package/src/sources/gloomberb-cloud/normalizers.ts +5 -0
  137. package/src/sources/provider-router/history.ts +5 -2
  138. package/src/test-support/plugin-persistence.ts +12 -0
  139. package/src/tickers/company-name-listing.ts +4 -3
  140. package/src/tickers/company-name.ts +19 -1
  141. package/src/tickers/instrument-coverage.ts +27 -0
  142. package/src/tickers/search/home-listing.ts +38 -1
  143. package/src/tickers/search/index.ts +3 -2
  144. package/src/tickers/search/ranking.ts +21 -2
  145. package/src/time-series/base-series.ts +4 -0
  146. package/src/time-series/types.ts +5 -2
  147. package/src/types/financials.ts +13 -0
  148. package/src/types/headless.ts +2 -0
  149. package/src/ui/dialog-stack.ts +17 -0
  150. package/src/ui/dialog.tsx +6 -2
  151. package/src/utils/crypto-pair.ts +9 -0
  152. package/src/utils/exchanges.ts +13 -0
  153. package/src/utils/financial-statements.ts +60 -3
  154. package/src/utils/futures-generic.ts +14 -0
  155. package/src/utils/trailing-dividend.ts +13 -3
@@ -36,6 +36,8 @@ const COIN_COLUMNS: HeadlessPaneColumn[] = [
36
36
  { key: "name", header: "Name" },
37
37
  // Every coin is priced, traded and valued in US dollars: the text headers say so; an export keeps its headers.
38
38
  { key: "price", header: "Price", textHeader: "Price USD", align: "right", format: (_value, row) => String(row.priceText ?? "—") },
39
+ // Whose the price is: an exchange's own trade, the composite of several, or a composite held back.
40
+ { key: "priceVenue", header: "Venue", literalHeader: true },
39
41
  // Since 00:00 UTC, the day `quote` gives a coin (CRYPTO_CHANGE_BASIS_LABEL): the text says so, as the pane's
40
42
  // CHG% UTC does, and an export keeps the header it has always had.
41
43
  { key: "changePercent", header: "Chg %", textHeader: "Chg % UTC", align: "right", format: percent },
@@ -52,14 +54,17 @@ const COIN_COLUMNS: HeadlessPaneColumn[] = [
52
54
  * volume leave the table first.
53
55
  */
54
56
  const STABLECOIN_COLUMNS: HeadlessPaneColumn[] = [
55
- ...COIN_COLUMNS.slice(0, 4),
57
+ ...COIN_COLUMNS.slice(0, 5),
56
58
  { key: "peg", header: "Peg", literalHeader: true, format: text("pegText") },
57
59
  { key: "offPegBp", header: "Off peg", literalHeader: true, align: "right", format: (value) => formatOffPeg(number(value)) },
58
60
  { key: "low24h", header: "24h low", literalHeader: true, align: "right", format: text("low24hText") },
59
61
  { key: "low24hAt", header: "Low UTC", literalHeader: true, shrink: false, format: isoMinute, textFormat: dayTime },
62
+ // The one exchange that alone reached the low or high, or how many did: one exchange's wick is not the market's.
63
+ { key: "low24hVenue", header: "Low venue", literalHeader: true },
60
64
  { key: "high24h", header: "24h high", literalHeader: true, align: "right", format: text("high24hText") },
61
65
  { key: "high24hAt", header: "High UTC", literalHeader: true, shrink: false, format: isoMinute, textFormat: dayTime },
62
- ...COIN_COLUMNS.slice(4).map((column, index) => column.key === "marketCap"
66
+ { key: "high24hVenue", header: "High venue", literalHeader: true },
67
+ ...COIN_COLUMNS.slice(5).map((column, index) => column.key === "marketCap"
63
68
  ? column
64
69
  : { ...column, stackPriority: 4 - index, stackRows: 0 }),
65
70
  ];
@@ -400,6 +405,7 @@ export const cryptoBoardHeadless: HeadlessPaneDefinition<"rows"> = {
400
405
  circulatingSupply: row.asset.circulatingSupply,
401
406
  maxSupply: row.asset.maxSupply,
402
407
  quoteTime: row.asset.quoteTime,
408
+ priceVenue: row.priceVenueText,
403
409
  ...(kind === "stablecoin" ? {
404
410
  peg: row.peg,
405
411
  pegText: row.pegText || "—",
@@ -410,6 +416,8 @@ export const cryptoBoardHeadless: HeadlessPaneDefinition<"rows"> = {
410
416
  high24h: row.high24h,
411
417
  high24hText: row.high24hText,
412
418
  high24hAt: row.high24hAt == null ? null : new Date(row.high24hAt).toISOString(),
419
+ low24hVenue: row.low24hVenueText,
420
+ high24hVenue: row.high24hVenueText,
413
421
  supply: row.supply,
414
422
  supply7d: row.supply7d,
415
423
  supply7dPercent: row.supply7dPercent,
@@ -4,6 +4,7 @@ import type { DataTableColumn } from "../../../components";
4
4
  import { getTableWidth } from "../../../components/ui/table-layout";
5
5
  import { buildQuoteKey, resolveEntryData } from "../../../market-data/selectors";
6
6
  import { delayedFeedLagMs } from "../../../market-data/market/freshness";
7
+ import { quoteSourceName } from "../../../market-data/quotes/export-identity";
7
8
  import type { QueryEntry } from "../../../market-data/result-types";
8
9
  import type { PricePoint, Quote } from "../../../types/financials";
9
10
  import type { HeadlessPaneFreshness } from "../../../types/headless";
@@ -87,6 +88,11 @@ export interface CryptoRow extends CryptoRowSupply {
87
88
  live: boolean;
88
89
  /** The price is a quote from a delayed feed, held back from the market. A price read from the board is not. */
89
90
  delayed: boolean;
91
+ /**
92
+ * Where the price is from, as the row says it: the exchange whose own trade it is (`Coinbase`), `composite` for
93
+ * the board's price blended from several exchanges, or `15m delayed` for a composite held back.
94
+ */
95
+ priceVenueText: string;
90
96
  /** A stablecoin's peg; null for a coin, or a server that does not send it. */
91
97
  peg: CryptoPeg | null;
92
98
  /** `USD`, `EUR 1.1242` (the target in dollars), `USD yield`, `USD bond`; empty without a peg. */
@@ -101,6 +107,50 @@ export interface CryptoRow extends CryptoRowSupply {
101
107
  /** The low and high at the price's decimals. */
102
108
  low24hText: string;
103
109
  high24hText: string;
110
+ /**
111
+ * Whose the low and high are, in plain words: `Coinbase only` when it alone of the exchanges read reached it,
112
+ * `Coinbase` when it was the only one read, `2 of 3`, `both` or `all 3` when more did, `other exchange` when none
113
+ * did (the composite's wick was an exchange not read), `checking` while the server still reads them, or a dash
114
+ * when no exchange was read. `+ Kraken` when the row's own price from that exchange lay outside the range and
115
+ * widened it.
116
+ */
117
+ low24hVenueText: string;
118
+ high24hVenueText: string;
119
+ /** The row's own exchange price lay outside the composite's range and is the low or the high, as `+ Kraken` says. */
120
+ low24hWidened: boolean;
121
+ high24hWidened: boolean;
122
+ }
123
+
124
+ /** The board's price that is no one exchange's: several blended by the source. */
125
+ const COMPOSITE_PRICE_VENUE = "composite";
126
+ /** An extreme whose exchanges' own candles the server is still reading: the board's refresh brings them. */
127
+ const CHECKING_EXCHANGES = "checking";
128
+ /** An extreme none of the exchanges read reached. */
129
+ const OTHER_EXCHANGE = "other exchange";
130
+
131
+ /**
132
+ * Whose an extreme is: the exchange that alone reached it among several read (`Coinbase only`), the one read when
133
+ * only one was, how many of those read did (`2 of 3`, `both`, `all 3`), and when none did, another exchange's. An
134
+ * exchange that could not be read is not among those counted. While the server is still reading them it says so,
135
+ * never that none was read. A price newer than the range that widened it is the row's own price venue's.
136
+ */
137
+ function extremeVenueText(reached: readonly string[] | undefined, checked: readonly string[] | undefined, pending = false): string {
138
+ if (!checked?.length || !reached) return pending ? CHECKING_EXCHANGES : MISSING_VALUE;
139
+ // The composite blends exchanges not read here: an extreme none of those read reached was one of theirs.
140
+ if (reached.length === 0) return OTHER_EXCHANGE;
141
+ if (reached.length === 1) return checked.length > 1 ? `${reached[0]} only` : reached[0]!;
142
+ if (reached.length < checked.length) return `${reached.length} of ${checked.length}`;
143
+ return checked.length === 2 ? "both" : `all ${checked.length}`;
144
+ }
145
+
146
+ /**
147
+ * What a row says its price is: an exchange's own, a quote held back, the source of a live quote that names no
148
+ * exchange (Gloom Cloud), or the board's own composite.
149
+ */
150
+ function priceVenueText(quote: Quote | null, delayed: boolean): string {
151
+ if (quote?.priceVenue) return quote.priceVenue;
152
+ if (delayed) return `${delayedFeedLagMs(CRYPTO_EXCHANGE) / 60_000}m delayed`;
153
+ return quote ? quoteSourceName(quote) || MISSING_VALUE : COMPOSITE_PRICE_VENUE;
104
154
  }
105
155
 
106
156
  export const cryptoQuoteKey = (asset: Pick<CryptoMarketAsset, "symbol">) =>
@@ -195,8 +245,9 @@ function buildCryptoRow(
195
245
  const updated = isFiniteNumber(updatedAt) ? updatedAt : null;
196
246
  const minimumDecimals = asset.kind === "stablecoin" ? 4 : 2;
197
247
  const range = asset.kind === "stablecoin"
198
- ? dayRange(asset, price, updated)
199
- : { low24h: null, low24hAt: null, high24h: null, high24hAt: null };
248
+ ? dayRange(asset, price, updated, quote?.priceVenue)
249
+ : NO_DAY_RANGE;
250
+ const delayed = quote?.dataSource === "delayed";
200
251
  return {
201
252
  asset,
202
253
  id: asset.symbol,
@@ -214,7 +265,8 @@ function buildCryptoRow(
214
265
  history,
215
266
  updatedAt: updated,
216
267
  live: !!quote && quote.delivery === "stream" && quote.stale !== true,
217
- delayed: quote?.dataSource === "delayed",
268
+ delayed,
269
+ priceVenueText: priceVenueText(quote, delayed),
218
270
  peg,
219
271
  pegText: formatPegTarget(peg),
220
272
  offPegBp: offPegBasisPoints(price, peg),
@@ -260,25 +312,43 @@ export function offPegSeverity(bp: number | null): "none" | "watch" | "broken" {
260
312
  return size >= OFF_PEG_BROKEN_BP ? "broken" : size >= OFF_PEG_WATCH_BP ? "watch" : "none";
261
313
  }
262
314
 
315
+ const NO_DAY_RANGE = {
316
+ low24h: null, low24hAt: null, high24h: null, high24hAt: null,
317
+ low24hVenueText: MISSING_VALUE, high24hVenueText: MISSING_VALUE, low24hWidened: false, high24hWidened: false,
318
+ };
319
+
263
320
  /**
264
321
  * The 24-hour low and high the board reported, widened by a newer price than
265
- * it had seen, so a live tick below the low is the low, at its time.
322
+ * it had seen, so a live tick below the low is the low, at its time. An
323
+ * exchange's own price outside the range widens it whenever it traded, as the
324
+ * quote service's range does (`rangeWidened`): the composite's range never
325
+ * took that exchange's trade in. The extreme then says whose (`+ Kraken`).
266
326
  */
267
- function dayRange(asset: CryptoMarketAsset, price: number, updatedAt: number | null) {
327
+ function dayRange(asset: CryptoMarketAsset, price: number, updatedAt: number | null, priceVenue: string | undefined) {
268
328
  const range = asset.range24h;
269
- if (!range) return { low24h: null, low24hAt: null, high24h: null, high24hAt: null };
329
+ if (!range) return NO_DAY_RANGE;
270
330
  let low24h = range.low;
271
331
  let low24hAt: number | null = Date.parse(range.lowAt);
272
332
  let high24h = range.high;
273
333
  let high24hAt: number | null = Date.parse(range.highAt);
274
- const newer = updatedAt != null && updatedAt > Date.parse(range.end);
275
- if (newer && price < low24h) [low24h, low24hAt] = [price, updatedAt];
276
- if (newer && price > high24h) [high24h, high24hAt] = [price, updatedAt];
334
+ // The raw extremes stay; each says whose it is.
335
+ let low24hVenueText = extremeVenueText(range.lowVenues, range.venuesChecked, range.venuesPending === true);
336
+ let high24hVenueText = extremeVenueText(range.highVenues, range.venuesChecked, range.venuesPending === true);
337
+ const widens = !!priceVenue || (updatedAt != null && updatedAt > Date.parse(range.end));
338
+ const ownVenue = priceVenue ? `+ ${priceVenue}` : COMPOSITE_PRICE_VENUE;
339
+ const low24hWidened = widens && price < low24h;
340
+ const high24hWidened = widens && price > high24h;
341
+ if (low24hWidened) [low24h, low24hAt, low24hVenueText] = [price, updatedAt, ownVenue];
342
+ if (high24hWidened) [high24h, high24hAt, high24hVenueText] = [price, updatedAt, ownVenue];
277
343
  return {
278
344
  low24h,
279
345
  low24hAt: isFiniteNumber(low24hAt) ? low24hAt : null,
280
346
  high24h,
281
347
  high24hAt: isFiniteNumber(high24hAt) ? high24hAt : null,
348
+ low24hVenueText,
349
+ high24hVenueText,
350
+ low24hWidened: low24hWidened && !!priceVenue,
351
+ high24hWidened: high24hWidened && !!priceVenue,
282
352
  };
283
353
  }
284
354
 
@@ -393,6 +463,7 @@ type CryptoColumnId =
393
463
  | "code"
394
464
  | "name"
395
465
  | "price"
466
+ | "priceVenueText"
396
467
  | "changePercent"
397
468
  | "return7d"
398
469
  | "return30d"
@@ -404,8 +475,10 @@ type CryptoColumnId =
404
475
  | "offPegBp"
405
476
  | "low24h"
406
477
  | "low24hAt"
478
+ | "low24hVenueText"
407
479
  | "high24h"
408
480
  | "high24hAt"
481
+ | "high24hVenueText"
409
482
  | "supply"
410
483
  | "supply7dPercent"
411
484
  | "supply7d"
@@ -441,7 +514,7 @@ export function readCryptoSort(value: unknown): CryptoSortPreference {
441
514
  : DEFAULT_CRYPTO_SORT;
442
515
  }
443
516
 
444
- const TEXT_COLUMNS = new Set<CryptoColumnId>(["rank", "code", "name", "pegText"]);
517
+ const TEXT_COLUMNS = new Set<CryptoColumnId>(["rank", "code", "name", "pegText", "priceVenueText", "low24hVenueText", "high24hVenueText"]);
445
518
 
446
519
  /** Numbers open largest-first (top gainers, biggest caps); names open A-Z. */
447
520
  export function nextCryptoSort(current: CryptoSortPreference, columnId: string): CryptoSortPreference {
@@ -473,6 +546,7 @@ const COLUMN_SPECS: CryptoColumnSpec[] = [
473
546
  { id: "code", label: "COIN", width: 7, align: "left" },
474
547
  { id: "name", label: "NAME", width: 10, align: "left", optional: 1 },
475
548
  { id: "price", label: "PRICE", width: 13, align: "right" },
549
+ { id: "priceVenueText", label: "VENUE", title: "The exchange whose own trade the price is, or the composite of several", width: 11, align: "left", optional: 1.5 },
476
550
  { id: "changePercent", label: "CHG% UTC", title: "Change since 00:00 UTC", width: 8, align: "right" },
477
551
  { id: "return7d", label: "7D%", width: 8, align: "right" },
478
552
  { id: "return30d", label: "30D%", width: 8, align: "right", optional: 3 },
@@ -486,19 +560,23 @@ const COLUMN_SPECS: CryptoColumnSpec[] = [
486
560
  * A stablecoin is read by its peg: what it holds to, how far off it is, and
487
561
  * the 24-hour low and high with their times, before its returns. Narrowing,
488
562
  * the returns, the sparkline and the day change leave first, then volume, the
489
- * name and the high; the peg, the low and when it traded stay.
563
+ * name and the high, then whose the low and the price are (the footer then
564
+ * says a delay); the peg, the low and when it traded stay.
490
565
  */
491
566
  const STABLECOIN_COLUMN_SPECS: CryptoColumnSpec[] = [
492
567
  { id: "rank", label: "#", width: 3, align: "right" },
493
568
  { id: "code", label: "COIN", width: 7, align: "left" },
494
569
  { id: "name", label: "NAME", width: 10, align: "left", optional: 3 },
495
570
  { id: "price", label: "PRICE", width: 8, align: "right" },
571
+ { id: "priceVenueText", label: "VENUE", title: "The exchange whose own trade the price is, or the composite of several", width: 11, align: "left", optional: 0.4 },
496
572
  { id: "pegText", label: "PEG", width: 10, align: "left" },
497
573
  { id: "offPegBp", label: "OFF PEG", width: 8, align: "right" },
498
574
  { id: "low24h", label: "24H LOW", width: 8, align: "right" },
499
575
  { id: "low24hAt", label: "LOW UTC", width: 9, align: "left" },
576
+ { id: "low24hVenueText", label: "LOW VENUE", title: "The exchange that alone reached the low, how many of those read did, or another exchange; + an exchange whose price outside the range widened it", width: 14, align: "left", optional: 0.6 },
500
577
  { id: "high24h", label: "24H HIGH", width: 8, align: "right", optional: 1 },
501
578
  { id: "high24hAt", label: "HIGH UTC", width: 9, align: "left", optional: 2 },
579
+ { id: "high24hVenueText", label: "HIGH VENUE", title: "The exchange that alone reached the high, how many of those read did, or another exchange; + an exchange whose price outside the range widened it", width: 14, align: "left", optional: 2.5 },
502
580
  { id: "changePercent", label: "CHG% UTC", title: "Change since 00:00 UTC", width: 8, align: "right", optional: 5 },
503
581
  { id: "return7d", label: "7D%", width: 8, align: "right", optional: 6 },
504
582
  { id: "return30d", label: "30D%", width: 8, align: "right", optional: 8 },
@@ -110,6 +110,7 @@ function renderCryptoCell(row: CryptoRow, column: CryptoColumn, logos: boolean):
110
110
  text: formatCryptoPercent(value),
111
111
  color: value == null ? colors.textDim : priceColor(value),
112
112
  });
113
+ const widenedTone = (widened: boolean) => (widened ? { color: colors.warning, keepColorWhenSelected: true } : {});
113
114
  switch (column.id) {
114
115
  case "rank":
115
116
  return { text: String(row.rank), color: colors.textDim };
@@ -147,10 +148,18 @@ function renderCryptoCell(row: CryptoRow, column: CryptoColumn, logos: boolean):
147
148
  keepColorWhenSelected: severity !== "none",
148
149
  };
149
150
  }
151
+ // An extreme the row's own exchange price set, outside the composite's range, is flagged in the warning color.
150
152
  case "low24h":
151
- return { text: row.low24hText, value: row.low24h };
153
+ return { text: row.low24hText, value: row.low24h, ...widenedTone(row.low24hWidened) };
152
154
  case "high24h":
153
- return { text: row.high24hText, value: row.high24h };
155
+ return { text: row.high24hText, value: row.high24h, ...widenedTone(row.high24hWidened) };
156
+ case "priceVenueText":
157
+ // A price held back is said on its own row, in the warning color; an exchange's own or the composite is dim.
158
+ return { text: row.priceVenueText, color: row.delayed ? colors.warning : colors.textDim };
159
+ case "low24hVenueText":
160
+ return { text: row.low24hVenueText, color: row.low24hWidened ? colors.warning : colors.textDim };
161
+ case "high24hVenueText":
162
+ return { text: row.high24hVenueText, color: row.high24hWidened ? colors.warning : colors.textDim };
154
163
  case "low24hAt":
155
164
  return { text: formatDayRangeTime(row.low24hAt), value: row.low24hAt == null ? null : new Date(row.low24hAt), color: colors.textDim };
156
165
  case "high24hAt":
@@ -282,12 +291,18 @@ export function CryptoBoardPane({ width, height, focused }: PaneProps) {
282
291
  label: "Price freshness",
283
292
  getMetadata: () => ({ ...CRYPTO_BOARD_FRESHNESS, observations }),
284
293
  } : null);
285
- const statusLine = useMemo(() => observations.length
286
- ? paneStatusLine(deriveHeadlessFreshness({ shape: "rows" }, { rows: observations, freshness: CRYPTO_BOARD_FRESHNESS }, now))
287
- : null, [now, observations]);
288
294
  // Supply columns join only once there is supply to show; an outage leaves the price columns as they are.
289
295
  const hasSupply = !!supplyRows && supplyRows.size > 0;
290
296
  const columns = useMemo(() => buildCryptoColumns(width, assetKind, hasSupply), [assetKind, hasSupply, width]);
297
+ // A row held back says so in its own VENUE cell, and the footer then dates the board without claiming a delay for
298
+ // all of it. Too narrow for that column, the footer says the delay as it did.
299
+ const venueShown = columns.some((column) => column.id === "priceVenueText");
300
+ const statusLine = useMemo(() => observations.length
301
+ ? paneStatusLine(deriveHeadlessFreshness({ shape: "rows" }, {
302
+ rows: venueShown ? observations.map((row) => row.dataSource === "delayed" ? { quoteTime: row.quoteTime } : row) : observations,
303
+ freshness: CRYPTO_BOARD_FRESHNESS,
304
+ }, now))
305
+ : null, [now, observations, venueShown]);
291
306
 
292
307
  // Other is muted against the theme it is drawn on; the coins take the shared series palette, which the chart themes.
293
308
  const otherColor = useThemeColors().textMuted;
@@ -13,6 +13,8 @@ import { cashInMajorUnits } from "../../../utils/dividend-cash";
13
13
  import { lapsedDividend, monthlyHistoryEnd } from "../../../utils/forward-dividend";
14
14
  import type { DeclaredCash, DeclaredDividendAction, TickerFinancials } from "../../../types/financials";
15
15
  import { logFailure } from "../../../utils/log-failure";
16
+ import { isCryptoInstrumentType } from "../../../tickers/search/ranking";
17
+ import { isCryptoPairSymbol } from "../../../utils/crypto-pair";
16
18
 
17
19
  export const DIVIDENDS_CONNECTION_ID = "gloom-dividends";
18
20
 
@@ -180,6 +182,20 @@ export interface DividendData {
180
182
  stale?: boolean;
181
183
  priceAsOf?: string;
182
184
  priceStale?: boolean;
185
+ /**
186
+ * A crypto token: it pays no distributions, and a yield it earns (USDY's) accrues in its price, so it has no cash
187
+ * yield to show, never 0.00% (TOKEN_YIELD_NOTE).
188
+ */
189
+ token?: true;
190
+ }
191
+
192
+ /** Why a token's yields are blank: said beside them, short. */
193
+ export const TOKEN_YIELD_NOTE = "token: no payouts, any yield accrues in its price";
194
+
195
+ /** A coin or token: a crypto instrument by its quote's type, else a coin pair (USDY-USD) on the crypto venue or none. */
196
+ function isToken(symbol: string, exchange: string, instrumentType: string | undefined): boolean {
197
+ if (instrumentType) return isCryptoInstrumentType(instrumentType);
198
+ return isCryptoPairSymbol(symbol.trim().toUpperCase()) && (!exchange || exchange.toUpperCase() === "CCC");
183
199
  }
184
200
 
185
201
  export async function fetchDividendData(
@@ -236,11 +252,17 @@ export async function fetchDividendData(
236
252
  const summaryRatesComparable = !!summaryUnit.currency && summaryUnit.divisor === 1 && summaryUnit.currency === currency;
237
253
  const metricFields = actions && historyError && quoteFields ? { ...quoteFields, trailingAnnualDividendRate: null } : quoteFields;
238
254
  const declared = actions && cashCurrency ? declaredDividends(actions) : [];
239
- const metrics = buildDividendMetrics(payments, metricFields, price, { historyAvailable, summaryRatesComparable, declared });
240
- if (!historyAvailable && !historyError && metrics.trailingRate == null && metrics.forwardRate == null) {
255
+ const token = isToken(symbol, exchange, quote?.instrumentType);
256
+ const built = buildDividendMetrics(payments, metricFields, price, { historyAvailable, summaryRatesComparable, declared });
257
+ // A token's empty history is no 0.00% yield: it has none to measure.
258
+ const metrics = token && payments.length === 0
259
+ ? { ...built, trailingRate: null, forwardRate: null, trailingYield: null, forwardYield: null, forwardRateAsOf: null }
260
+ : built;
261
+ if (!historyAvailable && !historyError && metrics.trailingRate == null && metrics.forwardRate == null && !token) {
241
262
  throw new Error(`No dividend data found for ${symbol}`);
242
263
  }
243
264
  return {
265
+ ...(token && payments.length === 0 ? { token: true as const } : {}),
244
266
  payments, ...(declared.length > 0 ? { declared } : {}), ...(convertedFrom ? { convertedFrom } : {}), ...(convertedSubUnit ? { convertedSubUnit } : {}), metrics, price, currency: currency || undefined, historyAvailable,
245
267
  ...(suppliedPrice == null && price != null && quote ? dividendQuotePriceMetadata(quote) : {}),
246
268
  ...(historyError ? { historyError } : {}), ...(summaryError ? { summaryError } : {}),
@@ -4,7 +4,7 @@ import type {
4
4
  HeadlessPaneDefinition,
5
5
  HeadlessPaneLoadArgs,
6
6
  } from "../../../types/plugin";
7
- import { fetchDividendData, requestDividendHistory, statedForwardRate, type DividendData } from "./client";
7
+ import { fetchDividendData, requestDividendHistory, statedForwardRate, TOKEN_YIELD_NOTE, type DividendData } from "./client";
8
8
  import { dividendReferencePrice } from "../../../utils/trailing-dividend";
9
9
  import type { DividendPayment, GrowthPayments } from "./types";
10
10
  import {
@@ -246,7 +246,9 @@ export function projectDividendYieldHeadless(
246
246
  ...(data.stale ? [{ label: "History status", value: staleHistoryText(data.fetchedAt) }] : []),
247
247
  ...(priceStatusText ? [{ label: "Price status", value: priceStatusText }] : []),
248
248
  { label: trailingLabel, value: roundedRatio(metrics.trailingYield),
249
- formatted: metrics.trailingYield == null ? formatDividendYield(null) : `${formatDividendYield(metrics.trailingYield)} (${trailingNotes})` },
249
+ formatted: metrics.trailingYield == null
250
+ ? data.token ? `${formatDividendYield(null)} (${TOKEN_YIELD_NOTE})` : formatDividendYield(null)
251
+ : `${formatDividendYield(metrics.trailingYield)} (${trailingNotes})` },
250
252
  { label: forwardLabel, value: roundedRatio(metrics.forwardYield),
251
253
  formatted: forwardText
252
254
  ?? (metrics.forwardYield == null ? formatDividendYield(null)
@@ -1,7 +1,7 @@
1
1
  import type { HeadlessBundleResult, HeadlessPaneColumn } from "../../../types/headless";
2
2
  import { MISSING_VALUE, formatPercent } from "../../../utils/format";
3
3
  import { NOT_MEANINGFUL_TEXT } from "../../../utils/growth";
4
- import type { DividendData } from "./client";
4
+ import { TOKEN_YIELD_NOTE, type DividendData } from "./client";
5
5
  import { formatDividendYield, growthPaymentsDetail, PAYOUT_NOT_MEANINGFUL, trailingPaymentsText } from "./view";
6
6
  import type { FundBondFacts } from "../../../api-client/fund-facts";
7
7
  import { NOT_SEC_YIELD } from "../../../market-data/bond-funds";
@@ -61,6 +61,7 @@ function incompleteNote(entry: DividendRankingEntry): string | null {
61
61
  */
62
62
  function yieldBasis(entry: DividendRankingEntry): string | null {
63
63
  if (!("data" in entry)) return null;
64
+ if (entry.data.token) return TOKEN_YIELD_NOTE;
64
65
  const lapse = entry.data.metrics.lapse;
65
66
  if (lapse?.historyEnds && lapse.lastPaid) return historyEndsText(lapse.lastPaid);
66
67
  const counted = trailingPaymentsText(entry.data.metrics.trailingPayments, { cadence: true });
@@ -5,7 +5,7 @@ import { resolveCurrencyUnit } from "../../../utils/currency-units";
5
5
  import type { ProjectedChartPoint } from "../../../components/chart/core/data";
6
6
  import { calendarMonthsBefore } from "../../../utils/calendar-date";
7
7
  import { NOT_MEANINGFUL, formatPriceEarnings } from "../../../utils/price-earnings";
8
- import { LATE_GRACE_DAYS, trailingCashAt, type TrailingPayments } from "../../../utils/trailing-dividend";
8
+ import { CADENCE_GRACE_DAYS, LATE_GRACE_DAYS, trailingCashAt, type TrailingPayments } from "../../../utils/trailing-dividend";
9
9
 
10
10
  const DAY = 24 * 60 * 60 * 1000;
11
11
 
@@ -77,6 +77,10 @@ export function buildTrailingCashChartPoints(payments: DividendPayment[], now =
77
77
  const lateExpiry = expiry.getTime() + days * DAY;
78
78
  if (lateExpiry <= now.getTime()) dates.add(lateExpiry);
79
79
  }
80
+ } else {
81
+ // The cadence's look past two years ends too (inferCadence).
82
+ const cadenceExpiry = expiry.getTime() + CADENCE_GRACE_DAYS * DAY;
83
+ if (cadenceExpiry <= now.getTime()) dates.add(cadenceExpiry);
80
84
  }
81
85
  }
82
86
  }
@@ -51,6 +51,12 @@ const MOVE_COLUMNS: Partial<Record<HistoryColumnId, (row: HistoryRow) => number
51
51
  ratio: (row) => row.moveRatio,
52
52
  };
53
53
 
54
+ /**
55
+ * Columns a history can hold nothing in: an A share's reports state no time where its exchange gave none, and
56
+ * no count of estimates is served for it. One blank in every row is left out, as the sales columns are.
57
+ */
58
+ const OPTIONAL_COLUMNS: ReadonlySet<HistoryColumnId> = new Set(["when", "analysts", "epsEstimate", "epsActual", "basis", "epsSurprise"]);
59
+
54
60
  /** Amount columns that carry a listing abroad's currency after each figure ("7.22 CNY"), and the room it takes. */
55
61
  const AMOUNT_COLUMNS: ReadonlySet<HistoryColumnId> = new Set(["epsEstimate", "epsActual", "revenueEstimate", "revenueActual"]);
56
62
  const CURRENCY_WIDTH = 4;
@@ -68,6 +74,8 @@ export function historyColumns(width: number, rows: readonly HistoryRow[], optio
68
74
  const labelled = abroad || rows.some((row) => row.currency != null);
69
75
  const periods = abroad || rows.some((row) => row.periodKind !== "quarter");
70
76
  let columns = ALL_COLUMNS.filter((column) => {
77
+ if (OPTIONAL_COLUMNS.has(column.id) && rows.length > 0)
78
+ return rows.some((row) => renderHistoryCell(row, column).text !== MISSING_VALUE);
71
79
  const value = SALES_COLUMNS[column.id] ?? (labelled ? MOVE_COLUMNS[column.id] : undefined);
72
80
  return !value || rows.some((row) => value(row) != null);
73
81
  }).map((column): HistoryColumn => {
@@ -16,6 +16,8 @@ export const earningsRippleModule: PluginModule = {
16
16
  id: "earnings-ripple", name: "Earnings Ripple", icon: "E", get component(): typeof import("./pane").EarningsRipplePane { const { EarningsRipplePane } = require("./pane"); return EarningsRipplePane; },
17
17
  defaultPosition: "right", defaultMode: "floating", defaultFloatingSize: { width: 96, height: 20 },
18
18
  tableExport: true,
19
+ // Customers and suppliers are companies': a future, an index or a fund has none, and is left out before any request.
20
+ instruments: ["equity"],
19
21
  // Without named tickers it lists what is in the person's portfolios.
20
22
  personalData: (context) => (typeof context.settings.symbols === "string" && context.settings.symbols.trim() ? null : "holdings"),
21
23
  settings: { title: "Earnings Ripple Settings", fields: [
@@ -359,7 +359,23 @@ export function eventSeriesId(event: Pick<EconEvent, "country" | "event">): stri
359
359
  export function eventSearchNames(event: Pick<EconEvent, "country" | "event" | "actual" | "forecast" | "prior">): string[] {
360
360
  const series = resolveFredMapping(event.event, event.country)?.seriesId;
361
361
  const policy = POLICY_DECISION.test(event.event) ? policyRateNames(event.country) : [];
362
- return [...[event.event, econEventName(event)].map(compactName), ...series ? statNamesOf(series) : [], ...policy];
362
+ const names = [event.event, econEventName(event)];
363
+ return [...[...names, ...names.flatMap(inflationRateNames)].map(compactName), ...series ? statNamesOf(series) : [], ...policy];
364
+ }
365
+
366
+ /** A CPI change, as one feed titles it (`CPI y/y`, `Core CPI m/m`). */
367
+ const CPI_CHANGE = /\bCPI\b(?=.*(?:\b[ymq]\/[ymq]\b|\b(?:yoy|mom|qoq)\b))/i;
368
+ /** A headline or core inflation rate, as the other feed titles the same CPI change (`Inflation Rate YoY`). */
369
+ const INFLATION_RATE = /^(core )?inflation rate\b/i;
370
+
371
+ /**
372
+ * The other feed's title for a CPI change, which one feed calls `CPI y/y` and
373
+ * the other `Inflation Rate YoY`: `--search cpi` finds both, and so does
374
+ * `--search "inflation rate"`. A CPI index level (`CPI` 334.98) is no rate.
375
+ */
376
+ function inflationRateNames(name: string): string[] {
377
+ if (INFLATION_RATE.test(name)) return [name.replace(INFLATION_RATE, (_whole, core: string | undefined) => `${core ?? ""}CPI`)];
378
+ return CPI_CHANGE.test(name) ? [name.replace(/\bCPI\b/i, "Inflation Rate")] : [];
363
379
  }
364
380
 
365
381
  /** A central bank's decision or fixing, under the titles the calendar gives them. */
@@ -3,6 +3,9 @@ import type { SeriesDefinition, SeriesFrequency } from "../../../series/types";
3
3
 
4
4
  type FredRow = readonly [seriesId: string, name: string, unit: string, frequency: SeriesFrequency, tags?: readonly string[]];
5
5
 
6
+ /** What people call a Treasury bill: a t-bill, a tbill, cash parked in a money market. */
7
+ const BILL_TAGS = ["bill", "T-bill", "T-bills", "tbill", "tbills", "money markets", "money market"] as const;
8
+
6
9
  /**
7
10
  * The FRED series Gloom Cloud serves, by group, except the Treasury constant
8
11
  * maturities (UST:2Y and so on, from the yield curve) and the credit spreads
@@ -34,10 +37,10 @@ const GROUPS: ReadonlyArray<{ group: string; rows: readonly FredRow[] }> = [
34
37
  ["SOFR", "SOFR", "%", "daily", ["secured overnight financing rate", "money markets"]],
35
38
  ["SORA", "SORA (Singapore overnight rate average)", "%", "daily", ["SGD", "Singapore", "MAS", "overnight", "money markets"]],
36
39
  ["OBFR", "Overnight bank funding rate", "%", "daily", ["OBFR", "money markets"]],
37
- ["DTB4WK", "4-week Treasury bill rate", "%", "daily", ["bill", "money markets"]],
38
- ["DTB3", "3-month Treasury bill rate", "%", "daily", ["bill", "money markets"]],
39
- ["DTB6", "6-month Treasury bill rate", "%", "daily", ["bill", "money markets"]],
40
- ["DTB1YR", "1-year Treasury bill rate", "%", "daily", ["bill", "money markets"]],
40
+ ["DTB4WK", "4-week Treasury bill rate", "%", "daily", BILL_TAGS],
41
+ ["DTB3", "3-month Treasury bill rate", "%", "daily", BILL_TAGS],
42
+ ["DTB6", "6-month Treasury bill rate", "%", "daily", BILL_TAGS],
43
+ ["DTB1YR", "1-year Treasury bill rate", "%", "daily", BILL_TAGS],
41
44
  ["DCPF3M", "3-month AA financial commercial paper rate", "%", "daily", ["commercial paper", "money markets"]],
42
45
  ["DCPN3M", "3-month AA nonfinancial commercial paper rate", "%", "daily", ["commercial paper", "money markets"]],
43
46
  ["RRPONTSYD", "Overnight reverse repo at the Fed", "billion USD", "daily", ["RRP", "liquidity", "money markets"]],
@@ -225,3 +228,29 @@ export const FRED_CATALOG_SERIES: readonly SeriesDefinition[] = GROUPS.flatMap((
225
228
  expression: `FRED:${seriesId}`,
226
229
  }))
227
230
  ));
231
+
232
+ /** Spellings of a Treasury bill a person types, as the series names say it. */
233
+ const BILL_WORDS: ReadonlyArray<[RegExp, string]> = [
234
+ [/\bt-?bills?\b|\bt bills?\b|\btreasury bills?\b/g, "treasury bill"],
235
+ [/\b(\d+|three|six|one|four)[\s-]*(month|mo|m)\b/g, "$1-month"],
236
+ [/\bthree-month\b/g, "3-month"],
237
+ [/\bsix-month\b/g, "6-month"],
238
+ [/\b(\d+|four)[\s-]*(week|wk|w)\b/g, "$1-week"],
239
+ [/\bfour-week\b/g, "4-week"],
240
+ [/\b(1|one)[\s-]*(year|yr|y)\b/g, "1-year"],
241
+ ];
242
+
243
+ /**
244
+ * The served FRED series a name asks for, when one alone fits every word: `3 month t-bill` is DTB3. Null for an id
245
+ * (DTB3), for words several series fit and for none.
246
+ */
247
+ export function fredSeriesIdForName(text: string): string | null {
248
+ const normalized = BILL_WORDS.reduce((value, [pattern, replacement]) => value.replace(pattern, replacement), text.trim().toLowerCase());
249
+ const words = normalized.split(/\s+/).filter((word) => word && word !== "rate" && word !== "yield");
250
+ if (words.length < 2) return null;
251
+ const fits = FRED_CATALOG_SERIES.filter((series) => {
252
+ const name = `${series.name} ${(series.tags ?? []).join(" ")}`.toLowerCase();
253
+ return words.every((word) => name.includes(word));
254
+ });
255
+ return fits.length === 1 ? fits[0]!.id.replace(/^fred:/, "") : null;
256
+ }
@@ -14,6 +14,7 @@ import {
14
14
  unansweredErrors,
15
15
  type StatsBundle,
16
16
  } from "./client";
17
+ import { cpiNextYearGap } from "../shared/cpi-year-gap";
17
18
  import { historyStartNotice } from "../shared/history-span";
18
19
  import { formatMoveRank } from "../shared/move-rank";
19
20
  import type { StatPoint } from "../shared/stat-transform";
@@ -201,6 +202,7 @@ export function projectStatsHeadlessBundle(
201
202
  });
202
203
 
203
204
  const notice = selected ? historyStartNotice(selected.stat.label, range, selected.span) : null;
205
+ const cpiGap = cpiYearGapNote(views);
204
206
  // Treasury yields alone (fn ECST 10Y) name when in the day they are taken, as GC does; a mixed table cannot.
205
207
  const cutoffs = new Set(views.map((view) => view.stat.cutoff));
206
208
  const cutoff = cutoffs.size === 1 ? [...cutoffs][0] : undefined;
@@ -223,6 +225,7 @@ export function projectStatsHeadlessBundle(
223
225
  ...(selected?.moves.length
224
226
  ? ["A move's pctl is the share of all 1D (or 1W) moves since that year that were smaller, ties counted half; --range does not change it."]
225
227
  : []),
228
+ ...(cpiGap ? [cpiGap] : []),
226
229
  ],
227
230
  metadata: {
228
231
  fetchedAt: bundle.fetchedAt,
@@ -236,6 +239,24 @@ export function projectStatsHeadlessBundle(
236
239
  };
237
240
  }
238
241
 
242
+ /** The CPI indexes the changes over twelve months are read from: all items and core, not seasonally adjusted. */
243
+ const CPI_INDEXES: ReadonlySet<string> = new Set(["CPIAUCNS", "CPILFENS"]);
244
+
245
+ /**
246
+ * Why the CPI changes over twelve months stop a month short of the latest
247
+ * release, and the latest they have, on one line: "BLS published no October
248
+ * 2025 index, so no October 2026 y/y; CPI y/y 3.7%, Core CPI y/y 2.6% in
249
+ * September 2026." Null when they are not short for that reason.
250
+ */
251
+ function cpiYearGapNote(views: readonly StatViewModel[]): string | null {
252
+ const cpi = views.filter((view) => CPI_INDEXES.has(view.stat.seriesId) && view.stat.transform === "yoy");
253
+ const gap = cpi[0] ? cpiNextYearGap(cpi[0].latest.date) : null;
254
+ if (!gap) return null;
255
+ const latest = cpi.filter((view) => view.latest.date === cpi[0]!.latest.date)
256
+ .map((view) => `${view.stat.shortLabel} ${reportFormat(view.stat)(view.latest.value)}`);
257
+ return `${gap.reason}; ${latest.join(", ")} in ${gap.latestMonth}.`;
258
+ }
259
+
239
260
  // Each row checks its own release schedule and says when it is stale.
240
261
  const ECST_FRESHNESS = { source: "FRED", status: "not-a-feed", basis: "published statistics" } as const;
241
262