gloomberb 0.20.5 → 0.20.7

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 (185) hide show
  1. package/README.md +1 -1
  2. package/README.zh-CN.md +1 -1
  3. package/package.json +2 -1
  4. package/src/api-client/data.ts +10 -2
  5. package/src/api-client/fund-facts.ts +20 -4
  6. package/src/api-client/hk-tenders.ts +59 -0
  7. package/src/api-client/index.ts +1 -0
  8. package/src/api-client/socket.ts +4 -4
  9. package/src/api-client/types/econ.ts +20 -2
  10. package/src/app.tsx +18 -13
  11. package/src/architecture/floating-promise-allowlist.json +313 -0
  12. package/src/architecture/shortcut-labels-allowlist.json +1 -0
  13. package/src/cli/commands/market.ts +197 -57
  14. package/src/cli/commands/news-search.ts +22 -7
  15. package/src/cli/commands/overview.ts +12 -6
  16. package/src/cli/commands/search.ts +19 -3
  17. package/src/cli/commands/ticker.ts +3 -1
  18. package/src/cli/desktop-pane-shot.ts +61 -0
  19. package/src/cli/early-command.ts +2 -0
  20. package/src/cli/errors.ts +10 -1
  21. package/src/cli/fx-forward.ts +76 -12
  22. package/src/cli/fx-pair.ts +1 -1
  23. package/src/cli/fx-quote-rate.ts +23 -0
  24. package/src/cli/help.ts +1 -0
  25. package/src/cli/index-roots.ts +5 -4
  26. package/src/cli/index.ts +40 -3
  27. package/src/cli/known-gaps.ts +11 -8
  28. package/src/cli/listing-arg.ts +6 -4
  29. package/src/cli/options.ts +52 -3
  30. package/src/cli/output-file.ts +5 -3
  31. package/src/cli/pane-functions/catalog.ts +15 -0
  32. package/src/cli/pane-functions/dom.ts +4 -4
  33. package/src/cli/pane-functions/freshness.ts +38 -5
  34. package/src/cli/pane-functions/function-help.ts +4 -4
  35. package/src/cli/pane-functions/headless.ts +9 -4
  36. package/src/cli/pane-functions/index.ts +6 -4
  37. package/src/cli/pane-functions/resolver.ts +2 -2
  38. package/src/cli/pane-functions/screenshot-assessment.ts +16 -4
  39. package/src/cli/quote-answer.ts +57 -1
  40. package/src/cli/result.ts +38 -2
  41. package/src/cli/spreadsheet-hint.ts +7 -3
  42. package/src/cli/treasury-yields.ts +5 -3
  43. package/src/components/chart/composite/legend.tsx +40 -2
  44. package/src/components/command-bar/workflow/tickers.ts +2 -2
  45. package/src/components/data-table/view.tsx +9 -2
  46. package/src/components/ui/data-table/opentui/index.tsx +11 -4
  47. package/src/components/ui/data-table/opentui/model.ts +8 -6
  48. package/src/components/ui/data-table/types.ts +6 -1
  49. package/src/components/ui/table-layout.ts +38 -1
  50. package/src/docs/snapshot.json +58 -19
  51. package/src/i18n/es.ts +2 -0
  52. package/src/i18n/ja.ts +2 -0
  53. package/src/i18n/ko.ts +2 -0
  54. package/src/i18n/zh-cn.ts +2 -0
  55. package/src/i18n/zh-tw.ts +2 -0
  56. package/src/market-data/market/change-basis.ts +57 -12
  57. package/src/market-data/market/dated-previous-close.ts +184 -10
  58. package/src/market-data/market/freshness.ts +18 -6
  59. package/src/market-data/market/status.ts +9 -1
  60. package/src/market-data/published-nse-sessions.ts +16 -1
  61. package/src/market-data/quotes/contributions.ts +2 -0
  62. package/src/market-data/quotes/freshness.ts +15 -0
  63. package/src/market-data/quotes/listing-enterprise-value.ts +50 -0
  64. package/src/plugins/builtin/alerts/alert-engine.ts +15 -0
  65. package/src/plugins/builtin/alerts/cli.ts +22 -9
  66. package/src/plugins/builtin/alerts/headless.ts +1 -1
  67. package/src/plugins/builtin/alerts/index.tsx +5 -1
  68. package/src/plugins/builtin/alerts/metric-command.ts +1 -1
  69. package/src/plugins/builtin/alerts/metric-data.ts +15 -2
  70. package/src/plugins/builtin/backtest/headless.ts +1 -1
  71. package/src/plugins/builtin/cds/model.ts +0 -6
  72. package/src/plugins/builtin/chart-composer/formula.ts +16 -3
  73. package/src/plugins/builtin/chart-composer/headless-schema.ts +2 -0
  74. package/src/plugins/builtin/chart-composer/headless.ts +2 -1
  75. package/src/plugins/builtin/chart-composer/presets.ts +1 -0
  76. package/src/plugins/builtin/cloud/askg/pane.tsx +55 -13
  77. package/src/plugins/builtin/credit-boards/cdx-pane.tsx +20 -7
  78. package/src/plugins/builtin/credit-boards/client.ts +8 -0
  79. package/src/plugins/builtin/credit-boards/headless.ts +4 -1
  80. package/src/plugins/builtin/credit-boards/model.ts +58 -4
  81. package/src/plugins/builtin/credit-boards/series.ts +63 -6
  82. package/src/plugins/builtin/credit-boards/sovr-pane.tsx +3 -2
  83. package/src/plugins/builtin/credit-conditions/headless.ts +24 -6
  84. package/src/plugins/builtin/credit-conditions/index.tsx +1 -1
  85. package/src/plugins/builtin/credit-conditions/model.ts +12 -6
  86. package/src/plugins/builtin/credit-conditions/series.ts +2 -1
  87. package/src/plugins/builtin/econ/calendar-model.ts +41 -7
  88. package/src/plugins/builtin/econ/calendar-source.ts +7 -1
  89. package/src/plugins/builtin/econ/index.tsx +41 -8
  90. package/src/plugins/builtin/econ/types.ts +3 -0
  91. package/src/plugins/builtin/fixed-income/index.tsx +2 -0
  92. package/src/plugins/builtin/fx-matrix/index.tsx +44 -14
  93. package/src/plugins/builtin/help/keybindings-editor.tsx +6 -2
  94. package/src/plugins/builtin/holders/fund-holders.ts +22 -1
  95. package/src/plugins/builtin/holders/headless.ts +5 -4
  96. package/src/plugins/builtin/holders/pane.tsx +7 -3
  97. package/src/plugins/builtin/holders/report-header.ts +23 -0
  98. package/src/plugins/builtin/members/client.ts +1 -1
  99. package/src/plugins/builtin/members/headless.ts +2 -0
  100. package/src/plugins/builtin/members/model.ts +10 -8
  101. package/src/plugins/builtin/members/pane.tsx +4 -1
  102. package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +5 -2
  103. package/src/plugins/builtin/portfolio-list/cli/render.ts +86 -26
  104. package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +5 -1
  105. package/src/plugins/builtin/portfolio-list/headless.ts +2 -1
  106. package/src/plugins/builtin/portfolio-list/income.ts +46 -22
  107. package/src/plugins/builtin/portfolio-list/pane/data.ts +16 -6
  108. package/src/plugins/builtin/portfolio-list/pane/index.tsx +5 -4
  109. package/src/plugins/builtin/portfolio-list/use-throttled-ticker-order.ts +40 -3
  110. package/src/plugins/builtin/research/headless-schema.ts +4 -3
  111. package/src/plugins/builtin/research/relative-valuation-columns.ts +145 -47
  112. package/src/plugins/builtin/research/relative-valuation-currency.ts +31 -0
  113. package/src/plugins/builtin/research/relative-valuation-headless.ts +25 -8
  114. package/src/plugins/builtin/research/relative-valuation-model.ts +40 -9
  115. package/src/plugins/builtin/research/relative-valuation-pane.tsx +3 -2
  116. package/src/plugins/builtin/research/relative-valuation-peers.ts +2 -2
  117. package/src/plugins/builtin/sec/fund-facts.ts +25 -5
  118. package/src/plugins/builtin/shared/report-freshness.ts +15 -6
  119. package/src/plugins/builtin/supply-chain/model.ts +18 -6
  120. package/src/plugins/builtin/thirteenf/api.ts +47 -4
  121. package/src/plugins/builtin/ticker-detail/data-panes/historical-prices.tsx +8 -7
  122. package/src/plugins/builtin/ticker-detail/data-panes/history-bars.ts +8 -5
  123. package/src/plugins/builtin/ticker-detail/financials/model.ts +6 -2
  124. package/src/plugins/builtin/ticker-detail/financials/tab.tsx +1 -1
  125. package/src/plugins/builtin/ticker-detail/headless.ts +6 -4
  126. package/src/plugins/builtin/treasury-auctions/cache.ts +36 -2
  127. package/src/plugins/builtin/treasury-auctions/headless.ts +42 -4
  128. package/src/plugins/builtin/treasury-auctions/hk-headless.ts +126 -0
  129. package/src/plugins/builtin/treasury-auctions/hk-view.tsx +347 -0
  130. package/src/plugins/builtin/treasury-auctions/hk.ts +363 -0
  131. package/src/plugins/builtin/treasury-auctions/index.tsx +14 -1
  132. package/src/plugins/builtin/treasury-auctions/model.ts +16 -8
  133. package/src/plugins/builtin/treasury-auctions/pane.tsx +45 -21
  134. package/src/portfolio/collection-name.ts +22 -0
  135. package/src/portfolio/column-values.ts +3 -0
  136. package/src/portfolio/valuation-basis.ts +23 -1
  137. package/src/renderers/dom/data-table/frozen-column.ts +3 -1
  138. package/src/renderers/dom/data-table/index.tsx +27 -9
  139. package/src/renderers/dom/data-table/row.tsx +2 -0
  140. package/src/renderers/electrobun/bun/desktop/backend.ts +27 -24
  141. package/src/renderers/electrobun/bun/desktop/detached-windows.ts +3 -3
  142. package/src/renderers/electrobun/bun/desktop/snapshot-commit.ts +77 -0
  143. package/src/renderers/electrobun/shared/protocol.ts +4 -0
  144. package/src/renderers/electrobun/view/backend-rpc.ts +3 -0
  145. package/src/renderers/electrobun/view/desktop/window/bridge.ts +3 -0
  146. package/src/sources/gloomberb-cloud/normalizers.ts +9 -5
  147. package/src/sources/provider-router/cache.ts +3 -1
  148. package/src/state/hooks/quote-streaming.ts +14 -6
  149. package/src/sync/controller.ts +17 -2
  150. package/src/sync/other-window-tabs.ts +32 -1
  151. package/src/sync/react.ts +4 -4
  152. package/src/tickers/instrument-kind.ts +22 -1
  153. package/src/tickers/search/index.ts +5 -0
  154. package/src/tickers/terminal-codes.ts +17 -5
  155. package/src/time-series/bar-spacing.ts +33 -0
  156. package/src/time-series/base-series.ts +21 -3
  157. package/src/time-series/chart-bounds.ts +31 -0
  158. package/src/time-series/field-catalog.ts +17 -0
  159. package/src/time-series/fundamentals/current-valuation.ts +244 -0
  160. package/src/time-series/fundamentals/historical-valuation.ts +99 -0
  161. package/src/time-series/fundamentals/metric-ids.ts +61 -0
  162. package/src/time-series/fundamentals/period-points.ts +104 -0
  163. package/src/time-series/fundamentals/quarterly-ttm.ts +220 -0
  164. package/src/time-series/fundamentals/series.ts +164 -0
  165. package/src/time-series/fundamentals/source-statements.ts +177 -0
  166. package/src/time-series/fundamentals/statement-fields.ts +154 -0
  167. package/src/time-series/fundamentals/statement-merge.ts +124 -0
  168. package/src/time-series/fundamentals/statement.ts +114 -0
  169. package/src/time-series/fundamentals/valuation-multiples.ts +50 -0
  170. package/src/time-series/fundamentals.ts +18 -1275
  171. package/src/time-series/ice-credit.ts +32 -6
  172. package/src/time-series/resolve.ts +9 -5
  173. package/src/time-series/session-bar.ts +78 -9
  174. package/src/time-series/studies/formula.ts +53 -10
  175. package/src/time-series/studies/pair.ts +18 -7
  176. package/src/time-series/studies/units.ts +49 -2
  177. package/src/time-series/types.ts +12 -0
  178. package/src/types/desktop-window.ts +2 -0
  179. package/src/types/financials.ts +15 -0
  180. package/src/types/headless.ts +8 -0
  181. package/src/utils/cli-output.ts +6 -3
  182. package/src/utils/debug-log.ts +29 -0
  183. package/src/utils/ebitda.ts +128 -0
  184. package/src/utils/format.ts +1 -1
  185. package/src/utils/shell-word.ts +13 -0
@@ -10,6 +10,7 @@ import { historyStatistics } from "../../../components/chart/curve/model";
10
10
  import type { MarketBoardRow } from "../../../components/market-board";
11
11
  import type { PricePoint } from "../../../types/financials";
12
12
  import type { HeadlessPaneColumn } from "../../../types/plugin";
13
+ import { formatPercentileRank } from "../../../utils/format";
13
14
 
14
15
  const YEAR_DAYS = 365;
15
16
  /** A level older than this is not the current market. */
@@ -173,12 +174,60 @@ interface YearStatistics {
173
174
  high: number | null;
174
175
  }
175
176
 
176
- /** Where the latest level sits in its own year: midrank, with the range. */
177
- function yearStatistics(points: readonly CreditBoardPoint[], level: number | null, date: string | null): YearStatistics {
177
+ /** Where the latest level sits in its own year: midrank, with the range, and no rank from fewer than `minCount` days. */
178
+ function yearStatistics(points: readonly CreditBoardPoint[], level: number | null, date: string | null, minCount = 2): YearStatistics {
178
179
  if (level == null || !date) return { percentile: null, low: null, high: null };
179
180
  const year = historyStatistics(points.map((point) => ({ date: point.date, value: point.level })), level,
180
181
  { asOf: date, windowDays: YEAR_DAYS });
181
- return { percentile: year.count >= 2 ? year.percentile : null, low: year.min, high: year.max };
182
+ return { percentile: year.count >= minCount ? year.percentile : null, low: year.min, high: year.max };
183
+ }
184
+
185
+ /** The fewest days of spreads in its year a CDX rank is read from: a month of trading; fewer leave it blank. */
186
+ const MIN_SPREAD_RANK_POINTS = 20;
187
+
188
+ /**
189
+ * What a credit rank ranks, so it always reads high = wide: the spread a row
190
+ * quotes; HY and EM's spread equivalent, each day's on its on-the-run
191
+ * contract; or, for a price with no spread beside it (CMBX), the price
192
+ * upside down, the lowest price ranking 100.
193
+ */
194
+ type SpreadRankBasis = "spread" | "spread-eq" | "price-inverted";
195
+
196
+ export interface SpreadRank {
197
+ percentile: number | null;
198
+ basis: SpreadRankBasis;
199
+ }
200
+
201
+ /**
202
+ * Where an index's spread sits in its own year, 100 the widest. A price
203
+ * quote ranks backwards (a falling price is a widening spread), so HY and EM
204
+ * rank their spread equivalent instead, and a price without one is ranked
205
+ * from the top. A spread rank needs a month of spreads in the year
206
+ * (MIN_SPREAD_RANK_POINTS); with fewer it is blank, never read off a handful.
207
+ */
208
+ export function spreadRank(index: Pick<CdxBoardIndex, "quote" | "points" | "level" | "date" | "spreadBp">): SpreadRank {
209
+ if (index.quote === "spread") {
210
+ return { percentile: yearStatistics(index.points, index.level, index.date, MIN_SPREAD_RANK_POINTS).percentile, basis: "spread" };
211
+ }
212
+ const spreads = index.points.flatMap((point) => typeof point.spreadBp === "number" && Number.isFinite(point.spreadBp)
213
+ ? [{ ...point, level: point.spreadBp }] : []);
214
+ if (spreads.length > 0 && typeof index.spreadBp === "number") {
215
+ return { percentile: yearStatistics(spreads, index.spreadBp, index.date, MIN_SPREAD_RANK_POINTS).percentile, basis: "spread-eq" };
216
+ }
217
+ const price = yearStatistics(index.points, index.level, index.date).percentile;
218
+ return { percentile: price == null ? null : 100 - price, basis: "price-inverted" };
219
+ }
220
+
221
+ /** A spread rank as a detail line says it: `89 pctl 1Y`, and for a price ranked upside down, says so. */
222
+ export function formatSpreadRank(rank: SpreadRank): string {
223
+ const text = formatPercentileRank(rank.percentile, "1Y");
224
+ return rank.basis === "price-inverted" && rank.percentile != null ? `${text}, price inverted` : text;
225
+ }
226
+
227
+ /** The newest day a board's rows are dated, which its footer dates the board by; null with none. */
228
+ export function newestRowDate(dates: ReadonlyArray<string | null | undefined>): string | null {
229
+ return dates.reduce<string | null>((newest, date) => date && /^\d{4}-\d{2}-\d{2}/.test(date) && (!newest || date > newest)
230
+ ? date.slice(0, 10) : newest, null);
182
231
  }
183
232
 
184
233
  function daysBetween(from: string, to: string): number {
@@ -219,7 +268,10 @@ export function findSovereign<T extends { id: string; name: string }>(sovereigns
219
268
 
220
269
  export interface CdxRow extends MarketBoardRow {
221
270
  index: CdxBoardIndex;
271
+ /** The level's own year: its range, in the quote's unit. */
222
272
  year: YearStatistics;
273
+ /** The rank the board shows, high = wide whatever the quote. */
274
+ rank: SpreadRank;
223
275
  /** The latest day's standing and the moves between complete days. */
224
276
  day: CdxDay;
225
277
  /** The 1W and 1M moves as shown. */
@@ -230,6 +282,7 @@ export interface CdxRow extends MarketBoardRow {
230
282
  export function cdxRows(indexes: readonly CdxBoardIndex[], asOf: string | null, now = Date.now()): CdxRow[] {
231
283
  return indexes.map((index) => {
232
284
  const year = yearStatistics(index.points, index.level, index.date);
285
+ const rank = spreadRank(index);
233
286
  const day = cdxDay(index, now);
234
287
  return {
235
288
  id: index.id,
@@ -238,13 +291,14 @@ export function cdxRows(indexes: readonly CdxBoardIndex[], asOf: string | null,
238
291
  valueText: formatLevel(index.quote, index.level),
239
292
  change: shown(index.quote, day.change1D),
240
293
  changeText: formatMove(index.quote, day.change1D),
241
- percentile: year.percentile,
294
+ percentile: rank.percentile,
242
295
  asOf: index.date,
243
296
  history: pointHistory(index.points),
244
297
  status: index.level == null ? "unavailable" : stale(index.date, asOf) ? "stale" : day.partial ? "partial" : "available",
245
298
  adverseMove: adverseMove(index.quote),
246
299
  index,
247
300
  year,
301
+ rank,
248
302
  day,
249
303
  week: shown(index.quote, day.change1W),
250
304
  month: shown(index.quote, day.change1M),
@@ -1,7 +1,8 @@
1
- import type { CreditBoardPoint } from "../../../api-client/credit-boards";
2
- import type { SeriesDefinition, SeriesLoadResult } from "../../../series/types";
1
+ import type { CdxBoardIndex, CreditBoardPoint } from "../../../api-client/credit-boards";
2
+ import type { SeriesDefinition, SeriesLoadRequest, SeriesLoadResult, SeriesPoint } from "../../../series/types";
3
+ import { logFailure } from "../../../utils/log-failure";
3
4
  import { cachedSeriesNote } from "../shared/series-warning";
4
- import { loadCdxBoard, loadSovrBoard } from "./client";
5
+ import { loadCdxBoard, loadFullCdxHistory, loadSovrBoard } from "./client";
5
6
 
6
7
  /** The five on-the-run 5Y index contracts the CDX tab lists; IG and iTraxx quote spread, HY and EM price. */
7
8
  const INDEXES = [
@@ -37,6 +38,49 @@ function boardPoints(
37
38
  };
38
39
  }
39
40
 
41
+ /** A chart that starts within this of the board's first day is drawn from the board. */
42
+ const BOARD_SLACK_MS = 7 * 86_400_000;
43
+
44
+ type CdxSeriesResource = { stale?: boolean; refreshError?: string | null; savedAt?: number };
45
+
46
+ /** What a chart that asked for more than the board's year says when the rest did not load. */
47
+ const BOARD_YEAR_ONLY = "The full history did not load; showing the last year.";
48
+
49
+ /**
50
+ * The indexes as a chart asks for them: the board, which holds a year, or
51
+ * every day the server keeps when the chart starts before it (ALL, 5Y).
52
+ * When that read fails the board's year stands in, said with `warning`.
53
+ */
54
+ async function cdxIndexes(request: SeriesLoadRequest): Promise<{ indexes: readonly CdxBoardIndex[]; resource: CdxSeriesResource; warning?: string }> {
55
+ const resource = await loadCdxBoard();
56
+ const first = Math.min(...resource.payload.indexes.flatMap((index) => index.points.slice(0, 1).map((point) => Date.parse(`${point.date}T00:00:00Z`))));
57
+ if (!request.start || request.start.getTime() < first - BOARD_SLACK_MS) {
58
+ const full = await loadFullCdxHistory().catch(logFailure("credit-boards", "Read the full index CDS history failed", null));
59
+ if (full) return { indexes: full.indexes, resource: {} };
60
+ return { indexes: resource.payload.indexes, resource, warning: BOARD_YEAR_ONLY };
61
+ }
62
+ return { indexes: resource.payload.indexes, resource };
63
+ }
64
+
65
+ /** A CDX series' note: the board's own, or, when it stood in for the full history, that. */
66
+ function cdxSeriesNote({ resource, warning }: { resource: CdxSeriesResource; warning?: string }): Pick<SeriesLoadResult, "warning" | "savedAt"> {
67
+ const note = cachedSeriesNote(resource);
68
+ return warning ? { ...note, warning: note.warning ? `${warning} ${note.warning}` : warning } : note;
69
+ }
70
+
71
+ /**
72
+ * HY and EM's price as the spread credit desks compare (each day's on its
73
+ * on-the-run contract, ISDA standard model at the index's coupon and standard
74
+ * recovery), so HY less IG, or cash less CDX, is one formula in bp.
75
+ */
76
+ function spreadEquivalentPoints(indexes: readonly CdxBoardIndex[], code: string, name: string): SeriesPoint[] {
77
+ const row = indexes.find((entry) => entry.id === code);
78
+ if (!row) throw new Error(`${name} is not on the board right now.`);
79
+ const points = row.points.flatMap((point) => typeof point.spreadBp === "number" ? [{ date: point.date, value: point.spreadBp }] : []);
80
+ if (points.length === 0) throw new Error(`${name} has no spread equivalent from this server yet.`);
81
+ return points;
82
+ }
83
+
40
84
  export const CREDIT_BOARD_SERIES: readonly SeriesDefinition[] = [
41
85
  ...INDEXES.map((index): SeriesDefinition => ({
42
86
  id: `cdx:${index.code.toLowerCase()}`,
@@ -45,9 +89,22 @@ export const CREDIT_BOARD_SERIES: readonly SeriesDefinition[] = [
45
89
  frequency: "daily",
46
90
  group: "Credit",
47
91
  tags: ["CDS", "index CDS", index.quote, "credit default swap"],
48
- load: async () => {
49
- const resource = await loadCdxBoard();
50
- return boardPoints(resource.payload.indexes, index.code, index.name, resource);
92
+ load: async (request) => {
93
+ const read = await cdxIndexes(request);
94
+ return { ...boardPoints(read.indexes, index.code, index.name, read.resource), ...cdxSeriesNote(read) };
95
+ },
96
+ })),
97
+ ...INDEXES.filter((index) => index.quote === "price").map((index): SeriesDefinition => ({
98
+ id: `cdx:${index.code.toLowerCase()}-spread`,
99
+ name: `${index.name} spread eq`,
100
+ unit: "bp",
101
+ frequency: "daily",
102
+ group: "Credit",
103
+ tags: ["CDS", "index CDS", "spread", "spread equivalent", index.code, "credit default swap"],
104
+ description: `${index.name}'s daily price as a conventional spread: a model figure from the ISDA standard model at the index's coupon and standard recovery, on each day's on-the-run contract, not a traded spread.`,
105
+ load: async (request) => {
106
+ const read = await cdxIndexes(request);
107
+ return { points: spreadEquivalentPoints(read.indexes, index.code, `${index.name} spread eq`), ...cdxSeriesNote(read) };
51
108
  },
52
109
  })),
53
110
  ...SOVEREIGNS.map(([code, name]): SeriesDefinition => ({
@@ -21,7 +21,6 @@ import { useThemeColors } from "../../../theme/theme-context";
21
21
  import type { PaneProps } from "../../../types/plugin";
22
22
  import { formatPercentileRank } from "../../../utils/format";
23
23
  import { useAssetData, usePluginPaneState } from "../../runtime";
24
- import { formatAsOf } from "../cds/model";
25
24
  import { FIXED_INCOME_PANE_ID } from "../fixed-income/model";
26
25
  import { useCommandValue } from "../shared/command-tab";
27
26
  import { getCachedSovrBoard, loadCurrencyMoves, loadSovrBoard } from "./client";
@@ -32,6 +31,7 @@ import {
32
31
  formatCurrencyMove,
33
32
  formatLevel,
34
33
  formatMove,
34
+ newestRowDate,
35
35
  SETTLEMENT_TEXT,
36
36
  sovrRows,
37
37
  type SovrRow,
@@ -115,7 +115,8 @@ export function SovrPane({ focused, width, height }: PaneProps) {
115
115
  moves.reload();
116
116
  }, { focused, enabled: !loading });
117
117
 
118
- const asOf = formatAsOf(payload?.asOf ?? null);
118
+ // Dated by the newest day the rows carry, not when the response was put together.
119
+ const asOf = newestRowDate(payload?.sovereigns.map((sovereign) => sovereign.date) ?? []);
119
120
  const info = useMemo<PaneFooterSegment[]>(() => [
120
121
  ...(asOf ? [{ id: "as-of", parts: [{ text: `as of ${asOf}`, tone: "muted" as const }] }] : []),
121
122
  ...(payload ? [DELAYED_SEGMENT] : []),
@@ -9,6 +9,24 @@ import {
9
9
  } from "./client";
10
10
  import { creditRegion, creditSeriesIn, type CreditConditionRow } from "./model";
11
11
 
12
+ const REGION_VALUES = [
13
+ { value: "all" },
14
+ { value: "us", aliases: ["usa", "united states", "america"] },
15
+ { value: "euro", aliases: ["eu", "eur", "europe", "eurozone", "euro area", "ea"] },
16
+ { value: "em", aliases: ["emerging", "emerging markets", "emerging market", "ems"] },
17
+ { value: "asia", aliases: ["asian", "apac", "asia pacific", "asia em"] },
18
+ ];
19
+
20
+ const regionToken = (text: string) => text.toLowerCase().replace(/[^a-z]/g, "");
21
+
22
+ /** A region as typed (`Asia`, `emerging markets`), as the option's value. */
23
+ function regionValue(text: string): string {
24
+ const token = regionToken(text);
25
+ const found = REGION_VALUES.find((region) => [region.value, ...region.aliases ?? []].some((name) => regionToken(name) === token));
26
+ if (!found) throw new Error(`Invalid --region value "${text}". Use one or more of: ${REGION_VALUES.map(({ value }) => value).join(", ")}.`);
27
+ return found.value;
28
+ }
29
+
12
30
  const COLUMNS = [
13
31
  { key: "label", header: "Index" },
14
32
  { key: "seriesId", header: "FRED series" },
@@ -43,14 +61,14 @@ function createCreditConditionsHeadless(
43
61
  argument: { kind: "none" },
44
62
  options: [{
45
63
  key: "region",
46
- description: "Indexes to list. FRED publishes euro high yield but no euro investment grade spread.",
64
+ description: "Indexes to list, one region or several as a comma list. em is the emerging markets corporate indexes, Asia's among them; "
65
+ + "FRED publishes euro high yield but no euro investment grade spread.",
47
66
  type: "enum",
48
- values: [
49
- { value: "all" },
50
- { value: "us", aliases: ["usa", "united states", "america"] },
51
- { value: "euro", aliases: ["eu", "eur", "europe", "eurozone", "euro area", "ea"] },
52
- ],
67
+ list: true,
68
+ values: REGION_VALUES,
53
69
  defaultValue: "all",
70
+ example: "--region asia,us",
71
+ normalize: (value) => value.split(",").map((part) => part.trim()).filter(Boolean).map((part) => regionValue(part)).join(","),
54
72
  }],
55
73
  columns: COLUMNS,
56
74
  describe: "Credit Spreads",
@@ -154,7 +154,7 @@ export const creditConditionsModule: PluginModule = {
154
154
  id: "credit-conditions-pane",
155
155
  paneId: "credit-conditions",
156
156
  label: "Credit Spreads",
157
- description: "ICE BofA option-adjusted spreads from FRED: US investment grade and high yield by rating, and euro high yield.",
157
+ description: "ICE BofA option-adjusted spreads from FRED: US investment grade and high yield by rating, euro high yield, and emerging markets and Asia corporates.",
158
158
  keywords: ["credit", "spread", "oas", "corporate", "high yield", "investment grade", "macro", "euro", "europe", "bb", "ccc", "rating"],
159
159
  shortcut: { prefix: "CRD" },
160
160
  headless: creditConditionsHeadless,
@@ -5,19 +5,25 @@ import { ICE_SPREAD_SERIES, type IceCreditSeries } from "../../../time-series/ic
5
5
 
6
6
  export type CreditSeriesDefinition = Pick<IceCreditSeries, "seriesId" | "label" | "region">;
7
7
 
8
- /** US investment grade and high yield by rating, then euro high yield. */
8
+ /** US investment grade and high yield by rating, euro high yield, then emerging markets corporates by grade and region. */
9
9
  export const CREDIT_SERIES: readonly CreditSeriesDefinition[] = ICE_SPREAD_SERIES
10
10
  .map(({ seriesId, label, region }) => ({ seriesId, label, region }));
11
11
 
12
- const CREDIT_REGIONS = ["all", "us", "euro"] as const;
12
+ const CREDIT_REGIONS = ["all", "us", "euro", "em", "asia"] as const;
13
13
  type CreditRegion = typeof CREDIT_REGIONS[number];
14
14
 
15
- export function creditRegion(value: unknown): CreditRegion {
16
- return CREDIT_REGIONS.includes(value as CreditRegion) ? value as CreditRegion : "all";
15
+ /** The regions to list, from a setting or `--region` (one, or a comma list such as `asia,us`); every one when none is known. */
16
+ export function creditRegion(value: unknown): readonly CreditRegion[] {
17
+ const regions = typeof value === "string"
18
+ ? [...new Set(value.split(",").map((part) => part.trim().toLowerCase()))].filter((part): part is CreditRegion => CREDIT_REGIONS.includes(part as CreditRegion))
19
+ : [];
20
+ return regions.length === 0 || regions.includes("all") ? ["all"] : regions;
17
21
  }
18
22
 
19
- export function creditSeriesIn(region: CreditRegion): readonly CreditSeriesDefinition[] {
20
- return region === "all" ? CREDIT_SERIES : CREDIT_SERIES.filter((series) => series.region === region);
23
+ /** The series in the regions, in the board's order: emerging markets take in Asia, its biggest region. */
24
+ export function creditSeriesIn(regions: readonly CreditRegion[]): readonly CreditSeriesDefinition[] {
25
+ if (regions.includes("all")) return CREDIT_SERIES;
26
+ return CREDIT_SERIES.filter((series) => regions.includes(series.region) || (series.region === "asia" && regions.includes("em")));
21
27
  }
22
28
 
23
29
  export interface CreditConditionRow {
@@ -6,7 +6,8 @@ import { ICE_CREDIT_SERIES, ICE_HISTORY_LIMIT_NOTICE } from "../../../time-serie
6
6
  export const CREDIT_SPREAD_SERIES: readonly SeriesDefinition[] = ICE_CREDIT_SERIES.map((series) => ({
7
7
  id: `fred:${series.seriesId}`,
8
8
  name: series.name,
9
- unit: "%",
9
+ // Spreads in bp, as G draws them; yields in percent.
10
+ unit: series.measure === "spread" ? "bp" : "%",
10
11
  frequency: "daily",
11
12
  group: "Credit",
12
13
  tags: [series.measure, ...series.tags, "corporate bonds"],
@@ -123,15 +123,41 @@ export function dayLabel(d: Date, today: Date): string {
123
123
  const MIN_DAYS_LISTED_AHEAD = 7;
124
124
 
125
125
  /**
126
- * When the calendar stops short of a week past `windowStart`, the time of its
127
- * last event; null when it reaches that far or lists nothing.
126
+ * The last UTC day the calendar lists releases for, YYYY-MM-DD, as Gloom Cloud
127
+ * says it: on the calendar from a day (`served`), or on each central bank's
128
+ * next decision it lists past the end (`listedThrough`). From a server that
129
+ * says neither, which lists nothing past the end, the day of the last event.
130
+ * Null when it lists nothing.
128
131
  */
129
- export function shortCalendarEnd(events: readonly EconEvent[], windowStart: number): Date | null {
132
+ export function listingEnd(
133
+ events: readonly Pick<EconEvent, "date" | "listedThrough">[],
134
+ served?: string | null,
135
+ ): string | null {
136
+ const said = served ?? events.find((event) => event.listedThrough)?.listedThrough;
137
+ if (said && /^\d{4}-\d{2}-\d{2}$/.test(said)) return said;
130
138
  let last: Date | null = null;
131
139
  for (const event of events) {
132
140
  if (!last || event.date.getTime() > last.getTime()) last = event.date;
133
141
  }
134
- return last && last.getTime() < windowStart + MIN_DAYS_LISTED_AHEAD * 86_400_000 ? last : null;
142
+ return last ? dateKey(last) : null;
143
+ }
144
+
145
+ /**
146
+ * When the listing (`listingEnd`) stops short of a week past `windowStart`,
147
+ * its last day; null when it reaches that far or lists nothing.
148
+ */
149
+ export function shortCalendarEnd(
150
+ events: readonly Pick<EconEvent, "date" | "listedThrough">[],
151
+ windowStart: number,
152
+ served?: string | null,
153
+ ): string | null {
154
+ const end = listingEnd(events, served);
155
+ return end && Date.parse(`${end}T00:00:00Z`) + 86_400_000 <= windowStart + MIN_DAYS_LISTED_AHEAD * 86_400_000 ? end : null;
156
+ }
157
+
158
+ /** Whether a row is a central bank's next decision Gloom Cloud lists past the end of the listing. */
159
+ export function pastReleaseListing(event: Pick<EconEvent, "pastListing">): boolean {
160
+ return event.pastListing === true;
135
161
  }
136
162
 
137
163
  /**
@@ -416,6 +442,11 @@ export function awaitsConsensus(event: Pick<EconEvent, "actual" | "forecast" | "
416
442
  /** What a dash under Forecast means on a row still to come. */
417
443
  export const NO_CONSENSUS_NOTE = `${MISSING_VALUE} forecast = no consensus yet`;
418
444
 
445
+ /** What the dash under Time means on a bank's decision whose calendar gives the day and not the time, from its note. */
446
+ export function noTimeNote(timeNote: string): string {
447
+ return `${MISSING_VALUE} time = ${timeNote.charAt(0).toLowerCase()}${timeNote.slice(1).replace(/\.$/, "")}`;
448
+ }
449
+
419
450
  /** A national euro-area release matches EU (and G7, as EU) and its own member's code. */
420
451
  export function matchesCountry(event: Pick<EconEvent, "country" | "event">, filter: CountryFilter): boolean {
421
452
  const member = euroAreaMember(event);
@@ -482,10 +513,13 @@ export function countriesWithoutEvents(filter: CountryFilter, events: ReadonlyAr
482
513
  return filterCountries(filter).filter((country) => !listed.has(country));
483
514
  }
484
515
 
485
- /** "No scheduled releases for MX in this window", or for MX or ZA. */
486
- export function noScheduledReleasesMessage(countries: readonly string[]): string {
516
+ /**
517
+ * "No scheduled releases for MX in this window", or for MX or ZA; with the
518
+ * day the listing ends, where it does ("; releases are listed through 2026-11-20").
519
+ */
520
+ export function noScheduledReleasesMessage(countries: readonly string[], listedThrough?: string | null): string {
487
521
  const named = countries.length > 1 ? `${countries.slice(0, -1).join(", ")} or ${countries.at(-1)}` : countries.join("");
488
- return `No scheduled releases for ${named} in this window.`;
522
+ return `No scheduled releases for ${named} in this window${listedThrough ? `; releases are listed through ${listedThrough}` : ""}.`;
489
523
  }
490
524
 
491
525
  /**
@@ -22,6 +22,8 @@ export type EconCalendarFrom =
22
22
  events: EconEvent[];
23
23
  /** The first UTC day the stored calendar holds; null when it holds nothing. */
24
24
  storedFrom: string | null;
25
+ /** The last UTC day the calendar lists releases for; null from a server that does not say. */
26
+ listedThrough: string | null;
25
27
  }
26
28
  | {
27
29
  events: null;
@@ -42,7 +44,11 @@ export async function fetchEconCalendarFrom(from: string): Promise<EconCalendarF
42
44
  if (!payload || !Array.isArray(payload.events) || !(payload.storedFrom === null || /^\d{4}-\d{2}-\d{2}$/.test(String(payload.storedFrom)))) {
43
45
  return { events: null, failure: "the server returned an unreadable calendar" };
44
46
  }
45
- return { events: withPercentUnits(payload.events.map(toEconEvent)), storedFrom: payload.storedFrom };
47
+ return {
48
+ events: withPercentUnits(payload.events.map(toEconEvent)),
49
+ storedFrom: payload.storedFrom,
50
+ listedThrough: typeof payload.listedThrough === "string" && /^\d{4}-\d{2}-\d{2}$/.test(payload.listedThrough) ? payload.listedThrough : null,
51
+ };
46
52
  } catch (error) {
47
53
  if (error instanceof ApiRequestError && error.status === 404) return { events: null, failure: null };
48
54
  if (isPermanentClientError(error)) throw error;
@@ -39,7 +39,6 @@ import {
39
39
  awaitsConsensus,
40
40
  calendarDisplayRows,
41
41
  CALENDAR_TIME_ZONE_LABEL,
42
- dateKey,
43
42
  dayLabel,
44
43
  econEventName,
45
44
  filteredEmptyTitle,
@@ -54,7 +53,10 @@ import {
54
53
  matchesImpact,
55
54
  NO_CONSENSUS_NOTE,
56
55
  noScheduledReleasesMessage,
56
+ noTimeNote as noTimeNoteText,
57
57
  parseCountryFilter,
58
+ listingEnd,
59
+ pastReleaseListing,
58
60
  resetEconCalendarPersistence,
59
61
  shortCalendarEnd,
60
62
  shortDayLabel,
@@ -67,6 +69,7 @@ import {
67
69
  type ImpactFilter,
68
70
  } from "./calendar-model";
69
71
  import { figureWithCurrency } from "./figures";
72
+ import { MISSING_VALUE } from "../../../utils/format";
70
73
  import { usePaneStatusFooter } from "../../../components/layout/pane/status-footer";
71
74
  import { handleRefreshKey } from "../../../components/data-table/table-pane";
72
75
  import { tableColumnWidth } from "../../../components/ui/table-layout";
@@ -80,6 +83,8 @@ const IMPACT_LABELS: Record<ImpactFilter, string> = {
80
83
  };
81
84
 
82
85
  const NO_EVENTS: EconEvent[] = [];
86
+ /** The start (UTC) of a YYYY-MM-DD day, to label it. */
87
+ const dayStart = (day: string) => new Date(`${day}T00:00:00Z`);
83
88
  const SPELLED_IMPACT = "IMPACT";
84
89
  const SPELLED_COUNTRY = "COUNTRY";
85
90
  /** Event names this wide still read; past it the headers spell themselves out. */
@@ -163,7 +168,11 @@ function EconCalendarPane({ focused, width, height }: PaneProps) {
163
168
  const todayStart = Math.floor(now / 86_400_000) * 86_400_000;
164
169
  // A calendar that stops short of a week ahead says where it stops.
165
170
  const listedEnd = shortCalendarEnd(events, todayStart);
166
- const listedAfter = listedEnd ? `No events listed after ${shortDayLabel(listedEnd)}` : null;
171
+ const listedAfter = listedEnd ? `No events listed after ${shortDayLabel(dayStart(listedEnd))}` : null;
172
+ // Past the listing's end Gloom Cloud lists each central bank's next decision: where the rows shown run past it, the
173
+ // footer says where the releases end, as the CLI does under its table.
174
+ const releasesThrough = useMemo(() => listingEnd(events), [events]);
175
+ const showsPastListing = filtered.some(pastReleaseListing);
167
176
 
168
177
  // Map from eventIdx to flat row index (for scroll tracking)
169
178
  const eventIdxToRowIdx = new Map<number, number>();
@@ -309,7 +318,8 @@ function EconCalendarPane({ focused, width, height }: PaneProps) {
309
318
  // Countries named one by one with nothing in the calendar: a quiet window there, said plainly.
310
319
  const unscheduled = useMemo(() => countriesWithoutEvents(countryFilter, events), [countryFilter, events]);
311
320
  const filterEmptyTitle = events.length === 0 ? null
312
- : unscheduled.length > 0 && unscheduled.length === countryFilter.split(",").length ? noScheduledReleasesMessage(unscheduled).replace(/\.$/, "")
321
+ : unscheduled.length > 0 && unscheduled.length === countryFilter.split(",").length
322
+ ? noScheduledReleasesMessage(unscheduled, releasesThrough ? shortDayLabel(dayStart(releasesThrough)) : null).replace(/\.$/, "")
313
323
  : filteredEmptyTitle(impactFilter, countryFilter);
314
324
  const emptyStateHint = !loading && !error
315
325
  ? [
@@ -338,6 +348,10 @@ function EconCalendarPane({ focused, width, height }: PaneProps) {
338
348
  // The dash under Forecast on the row in hand, while its consensus is not in yet.
339
349
  const focusedEvent = detailEvent ?? filtered[selectedIdx];
340
350
  const noConsensus = !!focusedEvent && awaitsConsensus(focusedEvent);
351
+ // The blank time on the row in hand, with why: a bank whose calendar gives the day and not the time.
352
+ const noTimeNote = focusedEvent && hasNoStatedTime(focusedEvent) ? noTimeNoteText(focusedEvent.timeNote!) : null;
353
+ const pastListingStatus = showsPastListing && releasesThrough && !detailEvent && !listedAfterStatus
354
+ ? `releases listed through ${shortDayLabel(dayStart(releasesThrough))}, then each bank's next decision` : null;
341
355
  const calendarStatus = useMemo<PaneFooterSegment[]>(() => [
342
356
  ...(hiddenStatus ? [{
343
357
  id: "hidden-impact",
@@ -348,19 +362,33 @@ function EconCalendarPane({ focused, width, height }: PaneProps) {
348
362
  }] : []),
349
363
  ...(nextText && !detailEvent ? [{ id: "next", parts: [{ text: nextText, tone: "muted" as const }] }] : []),
350
364
  ...(listedAfterStatus ? [{ id: "listed-after", parts: [{ text: listedAfterStatus, tone: "warning" as const }] }] : []),
365
+ ...(pastListingStatus ? [{ id: "listed-through", parts: [{ text: pastListingStatus, tone: "muted" as const }],
366
+ variants: [[{ text: `releases through ${shortDayLabel(dayStart(releasesThrough!))}`, tone: "muted" as const }]] }] : []),
351
367
  ...(showStale ? [{ id: "stale", parts: [{ text: "STALE", tone: "warning" as const }] }] : []),
352
368
  // Behind the warnings, so a narrow footer gives it up before them, and ahead of the update time, which goes first.
369
+ // The blank time first: of the row in hand's notes it is the one the row cannot say itself.
370
+ ...(noTimeNote ? [{ id: "no-time", parts: [{ text: noTimeNote, tone: "muted" as const }],
371
+ variants: [[{ text: "no time stated", tone: "muted" as const }]] }] : []),
353
372
  ...(noConsensus ? [{ id: "no-consensus", parts: [{ text: NO_CONSENSUS_NOTE, tone: "muted" as const }],
354
373
  variants: [[{ text: "no consensus yet", tone: "muted" as const }]] }] : []),
355
374
  ...(staleness ? [{ id: "updated", parts: [{ text: staleness, tone: "muted" as const }] }] : []),
356
- ], [allImpactKey, detailEvent, hiddenStatus, listedAfterStatus, nextText, noConsensus, showStale, staleness]);
375
+ ], [allImpactKey, detailEvent, hiddenStatus, listedAfterStatus, nextText, noConsensus, noTimeNote, pastListingStatus, releasesThrough, showStale, staleness]);
357
376
  // A report of the pane (`gloom fn ECO`) says it too.
358
- const listedThrough = listedEnd ? dateKey(listedEnd) : null;
377
+ const listedThrough = listedEnd;
359
378
  useRemoteUiNode(listedAfter && listedThrough ? {
360
379
  role: "report-notice",
361
380
  label: "Listed through",
362
381
  getMetadata: () => ({ text: listedAfter, key: "listedThrough", value: listedThrough }),
363
382
  } : null);
383
+ useRemoteUiNode(pastListingStatus && releasesThrough ? {
384
+ role: "report-notice",
385
+ label: "Releases listed through",
386
+ getMetadata: () => ({
387
+ text: `No releases listed after ${releasesThrough}; the rows after it are each central bank's next decision.`,
388
+ key: "releasesListedThrough",
389
+ value: releasesThrough,
390
+ }),
391
+ } : null);
364
392
  useRemoteUiNode(hiddenCount > 0 ? {
365
393
  role: "report-notice",
366
394
  label: "Lower-impact hidden",
@@ -424,10 +452,15 @@ function EconCalendarPane({ focused, width, height }: PaneProps) {
424
452
  const ev = row.event;
425
453
  switch (column.id) {
426
454
  case "time":
427
- // A bank that states no time has none here, and its detail says why; an all-day event (a plenum, an election) says so.
428
- return { text: hasNoStatedTime(ev) ? "" : isAllDayEvent(ev) ? "All day" : timeLabel(ev.date), color: colors.textMuted };
455
+ // A bank that states no time has a dash here, and the footer and its detail say why; an all-day event (a plenum,
456
+ // an election) says so.
457
+ return { text: hasNoStatedTime(ev) ? MISSING_VALUE : isAllDayEvent(ev) ? "All day" : timeLabel(ev.date), color: colors.textMuted };
429
458
  case "readerTime":
430
- return { text: hasNoReleaseTime(ev) || !readerZone ? "" : zonedClock(ev.date.getTime(), readerZone).label, color: colors.textMuted };
459
+ // The reader's clock has no time to give a bank that states none: the same dash as its time.
460
+ return {
461
+ text: !readerZone ? "" : hasNoStatedTime(ev) ? MISSING_VALUE : hasNoReleaseTime(ev) ? "" : zonedClock(ev.date.getTime(), readerZone).label,
462
+ color: colors.textMuted,
463
+ };
431
464
  case "impact": {
432
465
  const indicator = impactIndicator(ev.impact);
433
466
  return {
@@ -36,6 +36,9 @@ export interface EconEvent {
36
36
  indicatorId?: string | null;
37
37
  /** Which feed the forecast was read from (`week-feed`, `release-calendar`) and when that feed was read. */
38
38
  consensus?: { source: string; readAt: string } | null;
39
+ /** A central bank's next decision Gloom Cloud lists past the end of the listing, which ends on `listedThrough` (UTC). */
40
+ pastListing?: boolean;
41
+ listedThrough?: string;
39
42
  }
40
43
 
41
44
  /** Whether a row's time is blank because its publisher states none (a bank whose calendar gives the day only). */
@@ -25,6 +25,8 @@ export const fixedIncomeModule: PluginModule = {
25
25
  { value: "all", label: "All" },
26
26
  { value: "us", label: "US" },
27
27
  { value: "euro", label: "Euro" },
28
+ { value: "em", label: "Emerging markets" },
29
+ { value: "asia", label: "Asia" },
28
30
  ],
29
31
  },
30
32
  ...treasuryAuctionsSettings().fields,