gloomberb 0.20.13 → 0.20.16

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 (275) 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/index.ts +54 -0
  10. package/src/api-client/install-experiments.ts +8 -7
  11. package/src/api-client/money-markets.ts +7 -0
  12. package/src/api-client/paths.ts +2 -1
  13. package/src/api-client/product-waitlist.ts +63 -0
  14. package/src/api-client/request.ts +16 -4
  15. package/src/api-client/types/billing.ts +45 -0
  16. package/src/api-client/yearly-plan.ts +132 -0
  17. package/src/app/global-shortcuts.ts +5 -3
  18. package/src/app/pane-runtime/index.tsx +2 -2
  19. package/src/app/pane-runtime/plugin-bindings.ts +3 -1
  20. package/src/app/pane-runtime/ticker-open-runtime.ts +6 -1
  21. package/src/app/since-last-visit/keys.ts +26 -0
  22. package/src/app/since-last-visit/model.ts +266 -0
  23. package/src/app/since-last-visit/strip.tsx +193 -0
  24. package/src/app/since-last-visit/use-since-last-visit.ts +289 -0
  25. package/src/app/since-last-visit/visit-tracker.ts +191 -0
  26. package/src/app.tsx +15 -0
  27. package/src/architecture/floating-promise-allowlist.json +0 -1
  28. package/src/brokers/signed-in/sign-in-dialog.tsx +38 -38
  29. package/src/cli/commands/market.ts +103 -27
  30. package/src/cli/commands/overview.ts +18 -4
  31. package/src/cli/commands/system.ts +29 -1
  32. package/src/cli/commands/ticker.ts +12 -5
  33. package/src/cli/desktop-pane-shot-api-policy.ts +4 -1
  34. package/src/cli/desktop-pane-shot-browser.ts +2 -1
  35. package/src/cli/desktop-pane-shot-view.ts +3 -7
  36. package/src/cli/desktop-pane-shot.ts +26 -28
  37. package/src/cli/errors.ts +3 -1
  38. package/src/cli/freshness.ts +7 -2
  39. package/src/cli/glossary.ts +10 -5
  40. package/src/cli/help.ts +1 -0
  41. package/src/cli/helpers.ts +8 -16
  42. package/src/cli/history-export.ts +4 -0
  43. package/src/cli/history-rows.ts +24 -0
  44. package/src/cli/index.ts +4 -0
  45. package/src/cli/known-gaps.ts +2 -2
  46. package/src/cli/listing-arg.ts +79 -11
  47. package/src/cli/not-a-ticker.ts +4 -0
  48. package/src/cli/options.ts +29 -1
  49. package/src/cli/pane-functions/catalog.ts +70 -12
  50. package/src/cli/pane-functions/function-help.ts +1 -1
  51. package/src/cli/pane-functions/headless.ts +68 -3
  52. package/src/cli/pane-functions/index.ts +2 -2
  53. package/src/cli/pane-functions/options.ts +7 -0
  54. package/src/cli/pane-functions/resolver.ts +104 -15
  55. package/src/cli/pane-functions/screenshot-payload.ts +3 -0
  56. package/src/cli/report-tables.ts +20 -5
  57. package/src/cli/result.ts +22 -4
  58. package/src/cli/shot-temp-dir.ts +30 -0
  59. package/src/cli/suffixed-listing-rows.ts +11 -0
  60. package/src/cli/symbol-args.ts +5 -3
  61. package/src/cli/symbol-list.ts +23 -10
  62. package/src/cli/symbol-rows.ts +135 -3
  63. package/src/cli/treasury-yields.ts +15 -1
  64. package/src/components/chart/composite/composite-chart.tsx +3 -3
  65. package/src/components/chart/composite/format.ts +2 -1
  66. package/src/components/chart/composite/panel-surface/axis-markers.ts +133 -0
  67. package/src/components/chart/composite/panel-surface/level-labels.tsx +78 -0
  68. package/src/components/chart/composite/panel-surface/overlays.ts +108 -0
  69. package/src/components/chart/composite/panel-surface/pan-coast.ts +54 -0
  70. package/src/components/chart/composite/panel-surface/panel-cursor.tsx +138 -0
  71. package/src/components/chart/composite/panel-surface/panel-levels.ts +47 -0
  72. package/src/components/chart/composite/panel-surface/plot-gestures.ts +403 -0
  73. package/src/components/chart/composite/panel-surface/plot-pointer.ts +65 -0
  74. package/src/components/chart/composite/panel-surface/plot-wheel.ts +102 -0
  75. package/src/components/chart/composite/panel-surface/pointer.ts +12 -0
  76. package/src/components/chart/composite/panel-surface/props.ts +79 -0
  77. package/src/components/chart/composite/panel-surface/tool-readout.ts +151 -0
  78. package/src/components/chart/composite/panel-surface/value-axis-gestures.ts +152 -0
  79. package/src/components/chart/composite/panel-surface.tsx +81 -1177
  80. package/src/components/command-bar/commands/collection-list.ts +1 -0
  81. package/src/components/command-bar/commands/direct/index.ts +31 -8
  82. package/src/components/command-bar/commands/registry.ts +7 -0
  83. package/src/components/command-bar/routes/root/command-items.ts +8 -0
  84. package/src/components/command-bar/routes/root/results.ts +19 -2
  85. package/src/components/command-bar/routes/root/runtime.ts +3 -2
  86. package/src/components/command-bar/routes/root/selection.ts +3 -2
  87. package/src/components/command-bar/routes/root/shortcuts.ts +15 -0
  88. package/src/components/company-logo.tsx +10 -3
  89. package/src/components/data-table/sections.ts +6 -1
  90. package/src/components/layout/pane/title.ts +16 -6
  91. package/src/components/layout/shell/index.tsx +5 -1
  92. package/src/components/layout/shell/ticker-link-menu.ts +12 -9
  93. package/src/components/pane-settings-dialog/tui.tsx +6 -3
  94. package/src/components/pane-settings-dialog.tsx +2 -1
  95. package/src/components/pane-template-wizard.tsx +2 -0
  96. package/src/components/ticker/badge/format.ts +12 -3
  97. package/src/components/ticker/badge/index.tsx +9 -3
  98. package/src/components/ticker/list-table-view.tsx +119 -17
  99. package/src/components/ui/choice-dialog.tsx +1 -1
  100. package/src/components/ui/confirm-dialog.tsx +3 -2
  101. package/src/components/ui/data-table/display-columns.ts +16 -0
  102. package/src/components/ui/data-table/index.tsx +40 -9
  103. package/src/components/ui/data-table/types.ts +14 -0
  104. package/src/components/ui/frame.tsx +7 -3
  105. package/src/components/ui/icon.tsx +4 -2
  106. package/src/components/ui/list-view.tsx +8 -0
  107. package/src/components/ui/number-prompt-dialog.tsx +2 -1
  108. package/src/components/use-pane-notice-footer.tsx +3 -1
  109. package/src/core/state/app/layout-reducer.ts +3 -1
  110. package/src/core/state/app/layout.ts +2 -2
  111. package/src/data/config/layout.ts +14 -0
  112. package/src/data/config/store/normalize.ts +11 -1
  113. package/src/docs/snapshot.json +2 -2
  114. package/src/i18n/es.ts +39 -0
  115. package/src/i18n/ja.ts +39 -0
  116. package/src/i18n/ko.ts +39 -0
  117. package/src/i18n/zh-cn.ts +39 -0
  118. package/src/i18n/zh-tw.ts +39 -0
  119. package/src/layout/pane-follow.ts +141 -4
  120. package/src/layout/pane-layout-move.ts +10 -7
  121. package/src/layout/ticker-navigation.ts +13 -19
  122. package/src/layout/ticker-retarget.ts +3 -2
  123. package/src/market-data/market/format.ts +35 -1
  124. package/src/market-data/market/index-level.ts +19 -0
  125. package/src/market-data/quotes/contributions.ts +13 -0
  126. package/src/market-data/quotes/export-identity.ts +36 -1
  127. package/src/market-data/quotes/resolution.ts +16 -0
  128. package/src/plugins/builtin/account-management/keyboard.ts +14 -0
  129. package/src/plugins/builtin/account-management/model.ts +2 -0
  130. package/src/plugins/builtin/account-management/pane.tsx +79 -7
  131. package/src/plugins/builtin/account-management/password-dialog.tsx +2 -2
  132. package/src/plugins/builtin/account-management/payment-recovery-row.tsx +97 -0
  133. package/src/plugins/builtin/account-management/yearly-plan-row.tsx +359 -0
  134. package/src/plugins/builtin/analytics/risk-client.ts +12 -2
  135. package/src/plugins/builtin/analytics/risk-headless.ts +66 -6
  136. package/src/plugins/builtin/analytics/risk-math.ts +23 -6
  137. package/src/plugins/builtin/analytics/risk-model.ts +20 -9
  138. package/src/plugins/builtin/analytics/risk-pane.tsx +2 -2
  139. package/src/plugins/builtin/awards/pane.tsx +6 -8
  140. package/src/plugins/builtin/changelog/index.tsx +6 -44
  141. package/src/plugins/builtin/changelog/versions.ts +17 -68
  142. package/src/plugins/builtin/chart-composer/catalog-inventory.ts +5 -2
  143. package/src/plugins/builtin/chart-composer/editor.tsx +1 -0
  144. package/src/plugins/builtin/chart-composer/pane.tsx +1 -1
  145. package/src/plugins/builtin/chart-composer/quick-add.tsx +4 -1
  146. package/src/plugins/builtin/chart-composer/series-catalog.ts +17 -1
  147. package/src/plugins/builtin/cloud/askg/executor.ts +2 -1
  148. package/src/plugins/builtin/cloud/askg/sources.ts +2 -1
  149. package/src/plugins/builtin/cloud/plugin.tsx +2 -0
  150. package/src/plugins/builtin/cloud/thesis/module.tsx +2 -0
  151. package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +6 -2
  152. package/src/plugins/builtin/cpi/headless.ts +6 -1
  153. package/src/plugins/builtin/cpi/model.ts +17 -0
  154. package/src/plugins/builtin/cpi/pane.tsx +4 -2
  155. package/src/plugins/builtin/crypto-board/client.ts +6 -1
  156. package/src/plugins/builtin/crypto-board/headless.ts +10 -2
  157. package/src/plugins/builtin/crypto-board/model.ts +89 -11
  158. package/src/plugins/builtin/crypto-board/pane.tsx +20 -5
  159. package/src/plugins/builtin/debt-maturities/model.ts +1 -1
  160. package/src/plugins/builtin/dividend-yield/client.ts +24 -2
  161. package/src/plugins/builtin/dividend-yield/headless.ts +4 -2
  162. package/src/plugins/builtin/dividend-yield/ranking.ts +2 -1
  163. package/src/plugins/builtin/dividend-yield/view.ts +5 -1
  164. package/src/plugins/builtin/earnings/board-table.ts +1 -1
  165. package/src/plugins/builtin/earnings/board.tsx +36 -16
  166. package/src/plugins/builtin/earnings/highlight.ts +47 -0
  167. package/src/plugins/builtin/earnings/history-table.ts +9 -1
  168. package/src/plugins/builtin/earnings/index.tsx +1 -1
  169. package/src/plugins/builtin/earnings-calls/pane.tsx +2 -2
  170. package/src/plugins/builtin/earnings-ripple/index.tsx +2 -0
  171. package/src/plugins/builtin/econ/calendar-model.ts +17 -1
  172. package/src/plugins/builtin/econ/fred-catalog.ts +33 -4
  173. package/src/plugins/builtin/econ-statistics/headless.ts +21 -0
  174. package/src/plugins/builtin/estimate-revisions/model.ts +1 -1
  175. package/src/plugins/builtin/exposure/index.tsx +1 -1
  176. package/src/plugins/builtin/macro-day/headless.ts +21 -10
  177. package/src/plugins/builtin/macro-day/model.ts +42 -3
  178. package/src/plugins/builtin/macro-day/pane.tsx +26 -8
  179. package/src/plugins/builtin/macro-day/releases.ts +24 -1
  180. package/src/plugins/builtin/market-valuation/detail.tsx +3 -3
  181. package/src/plugins/builtin/market-valuation/headless.ts +11 -4
  182. package/src/plugins/builtin/market-valuation/pane.tsx +3 -1
  183. package/src/plugins/builtin/market-valuation/view.ts +14 -0
  184. package/src/plugins/builtin/money-markets/client.ts +4 -1
  185. package/src/plugins/builtin/money-markets/headless.ts +15 -4
  186. package/src/plugins/builtin/money-markets/index.tsx +1 -1
  187. package/src/plugins/builtin/money-markets/pane.tsx +7 -1
  188. package/src/plugins/builtin/news/wire/news/detail-view.tsx +20 -8
  189. package/src/plugins/builtin/pe-band/pane.tsx +1 -1
  190. package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +4 -2
  191. package/src/plugins/builtin/portfolio-list/cli/period-report.ts +61 -11
  192. package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +11 -3
  193. package/src/plugins/builtin/portfolio-list/cli/render.ts +8 -1
  194. package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +178 -17
  195. package/src/plugins/builtin/portfolio-list/headless.ts +33 -6
  196. package/src/plugins/builtin/portfolio-list/pane/groups.tsx +220 -0
  197. package/src/plugins/builtin/portfolio-list/pane/index.tsx +95 -18
  198. package/src/plugins/builtin/portfolio-list/pane/period-pnl.ts +24 -6
  199. package/src/plugins/builtin/portfolio-list/period-pnl.ts +16 -1
  200. package/src/plugins/builtin/portfolio-list/summary/index.tsx +4 -1
  201. package/src/plugins/builtin/portfolio-list/summary/totals.ts +6 -4
  202. package/src/plugins/builtin/portfolio-list/table.tsx +38 -16
  203. package/src/plugins/builtin/research/corporate-actions-pane.tsx +4 -2
  204. package/src/plugins/builtin/research/relative-valuation-headless.ts +15 -5
  205. package/src/plugins/builtin/research/relative-valuation-model.ts +7 -1
  206. package/src/plugins/builtin/research/relative-valuation-pane.tsx +7 -4
  207. package/src/plugins/builtin/shared/cloud-upgrade.ts +4 -2
  208. package/src/plugins/builtin/shared/cpi-year-gap.ts +67 -0
  209. package/src/plugins/builtin/shared/headless-options.ts +1 -1
  210. package/src/plugins/builtin/social-mentions/model.ts +2 -2
  211. package/src/plugins/builtin/thirteenf/pane.tsx +1 -1
  212. package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +45 -2
  213. package/src/plugins/builtin/ticker-detail/financials/model.ts +51 -16
  214. package/src/plugins/builtin/ticker-detail/financials/nopat.ts +16 -0
  215. package/src/plugins/builtin/ticker-detail/financials/ratios.ts +44 -13
  216. package/src/plugins/builtin/ticker-detail/financials/schema.ts +33 -2
  217. package/src/plugins/builtin/ticker-detail/financials/tab.tsx +4 -2
  218. package/src/plugins/builtin/ticker-detail/headless-schema.ts +30 -4
  219. package/src/plugins/builtin/ticker-detail/headless.ts +280 -35
  220. package/src/plugins/builtin/ticker-detail/overview/components.tsx +4 -5
  221. package/src/plugins/builtin/ticker-detail/overview/model.ts +9 -2
  222. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +10 -2
  223. package/src/plugins/builtin/ticker-detail/pharma-signals/eligibility.ts +32 -0
  224. package/src/plugins/builtin/ticker-detail/pharma-signals/tab.tsx +162 -0
  225. package/src/plugins/builtin/ticker-detail/pharma-signals/waitlist.ts +126 -0
  226. package/src/plugins/builtin/ticker-detail/research-groups.ts +6 -4
  227. package/src/plugins/builtin/ticker-detail/research-tabs.ts +11 -0
  228. package/src/portfolio/collection-name.ts +2 -1
  229. package/src/portfolio/column-values.ts +34 -12
  230. package/src/portfolio/listed-symbol.ts +4 -2
  231. package/src/portfolio/period-pnl.ts +51 -1
  232. package/src/portfolio/suffixed-listings.ts +3 -1
  233. package/src/portfolio/watchlist-groups.ts +212 -0
  234. package/src/react/ticker-source.ts +3 -1
  235. package/src/renderers/dom/dialog-host.tsx +5 -5
  236. package/src/renderers/dom/styles.css +7 -0
  237. package/src/renderers/electrobun/view/remote/capability-invoker.ts +1 -1
  238. package/src/renderers/opentui/dialog-host.tsx +3 -4
  239. package/src/sources/gloomberb-cloud/normalizers.ts +5 -0
  240. package/src/sources/provider-router/history.ts +5 -2
  241. package/src/state/app/bootstrap.ts +11 -0
  242. package/src/state/app/context/index.tsx +6 -0
  243. package/src/sync/collections-contributor.ts +5 -2
  244. package/src/sync/config-merge.ts +10 -2
  245. package/src/sync/sanitize.ts +28 -0
  246. package/src/telemetry/usage-counts.ts +17 -0
  247. package/src/test-support/plugin-persistence.ts +12 -0
  248. package/src/tickers/company-name-listing.ts +4 -3
  249. package/src/tickers/company-name.ts +19 -1
  250. package/src/tickers/instrument-coverage.ts +27 -0
  251. package/src/tickers/search/home-listing.ts +38 -1
  252. package/src/tickers/search/index.ts +3 -2
  253. package/src/tickers/search/ranking.ts +21 -2
  254. package/src/time-series/base-series.ts +4 -0
  255. package/src/time-series/chart-seed.ts +1 -1
  256. package/src/time-series/financial-period-coverage.ts +4 -12
  257. package/src/time-series/parsed-history-cache.ts +1 -1
  258. package/src/time-series/resolve.ts +1 -1
  259. package/src/time-series/types.ts +5 -2
  260. package/src/time-series/use-chart-resolution.ts +6 -1
  261. package/src/types/config.ts +32 -0
  262. package/src/types/financials.ts +13 -0
  263. package/src/types/headless.ts +7 -0
  264. package/src/types/plugin-context.ts +5 -0
  265. package/src/types/ticker.ts +14 -0
  266. package/src/ui/ascii-font.ts +1 -4
  267. package/src/ui/dialog-stack.ts +17 -0
  268. package/src/ui/dialog.tsx +6 -2
  269. package/src/utils/async-deadline.ts +2 -2
  270. package/src/utils/crypto-pair.ts +9 -0
  271. package/src/utils/csv.ts +44 -5
  272. package/src/utils/exchanges.ts +13 -0
  273. package/src/utils/financial-statements.ts +60 -3
  274. package/src/utils/futures-generic.ts +17 -0
  275. package/src/utils/trailing-dividend.ts +13 -3
@@ -0,0 +1,47 @@
1
+ import type { DataProvider } from "../../../types/data-provider";
2
+ import { boardKey, historyListing, type BoardReport } from "./board-model";
3
+ import { loadEarningsHistory, noHistoryAbroad } from "./client";
4
+ import { loadEarningsCalendar } from "./data/cache";
5
+ import { historyRows } from "./history-model";
6
+
7
+ interface EarningsHighlight {
8
+ report: BoardReport;
9
+ stale: boolean;
10
+ refreshError: string | null;
11
+ }
12
+
13
+ export async function loadEarningsHighlight(symbol: string, today: string, provider: DataProvider | null, force: boolean, accessKey: string): Promise<EarningsHighlight | null> {
14
+ const { listing, abroad, ownAbroad } = historyListing(symbol);
15
+ const [history, upcoming] = await Promise.allSettled([
16
+ abroad ? Promise.resolve(null)
17
+ : ownAbroad ? loadEarningsHistory(listing, force, undefined, accessKey).catch(noHistoryAbroad)
18
+ : loadEarningsHistory(listing, force),
19
+ loadEarningsCalendar(provider, [symbol], { force }),
20
+ ]);
21
+ const payload = history.status === "fulfilled" ? history.value?.payload ?? null : null;
22
+ const event = upcoming.status === "fulfilled" ? upcoming.value.events[0] ?? null : null;
23
+ const rows = historyRows(payload, today, event, { abroad: ownAbroad });
24
+ const row = rows.find((candidate) => candidate.upcoming) ?? rows[0];
25
+ if (row) {
26
+ const key = boardKey(symbol);
27
+ const source = payload?.reports.find((report) => report.date === row.date);
28
+ return {
29
+ report: {
30
+ key: `${key}:${row.date}`, symbol: key, name: payload?.name ?? event?.name ?? key,
31
+ date: row.date, timing: row.timing, expectedTiming: row.expectedTiming, dateStatus: row.dateStatus,
32
+ marketCap: source?.marketCap ?? null,
33
+ epsEstimate: row.epsEstimate, epsAnalysts: row.epsAnalysts, epsActual: row.epsActual,
34
+ provisional: row.provisional, epsBasis: row.epsBasis, epsSurprise: row.epsSurprise,
35
+ revenueEstimate: row.revenueEstimate, impliedMove: row.implied, averageMove: null,
36
+ owned: null, currency: row.currency ?? "USD",
37
+ },
38
+ stale: (history.status === "fulfilled" && !!history.value?.stale) || (upcoming.status === "fulfilled" && upcoming.value.stale),
39
+ refreshError: history.status === "rejected" ? (history.reason instanceof Error ? history.reason.message : String(history.reason))
40
+ : history.value?.refreshError ?? (upcoming.status === "rejected" ? (upcoming.reason instanceof Error ? upcoming.reason.message : String(upcoming.reason)) : upcoming.value.refreshError) ?? null,
41
+ };
42
+ }
43
+ if (history.status === "rejected") throw history.reason;
44
+ if (upcoming.status === "rejected") throw upcoming.reason;
45
+ if (upcoming.value.refreshError) throw new Error(upcoming.value.refreshError);
46
+ return null;
47
+ }
@@ -22,7 +22,7 @@ const ALL_COLUMNS: HistoryColumn[] = [
22
22
  { id: "epsEstimate", label: "EPS EST", width: 7, align: "right" },
23
23
  { id: "analysts", label: "ESTS", width: 4, align: "right" },
24
24
  { id: "epsActual", label: "EPS ACT", width: 7, align: "right" },
25
- { id: "basis", label: "BASIS", width: 5, align: "left" },
25
+ { id: "basis", label: "BASIS", width: 5, align: "left", mayBeBlank: true },
26
26
  { id: "epsSurprise", label: "EPS SURP", width: 8, align: "right" },
27
27
  { id: "revenueEstimate", label: "SALES EST", width: 9, align: "right" },
28
28
  { id: "revenueActual", label: "SALES ACT", width: 9, align: "right" },
@@ -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 => {
@@ -139,7 +139,7 @@ export const earningsModule: PluginModule = {
139
139
  id: "earnings-board-pane",
140
140
  paneId: "earnings-calendar",
141
141
  label: "Earnings Days",
142
- description: "The market board: report days by week or day, with implied and past moves; a ticker highlights its row.",
142
+ description: "The market board: report days by week or day, with implied and past moves; a ticker opens its report day and selects its row.",
143
143
  keywords: ["evts", "events", "earnings calendar", "earnings season", "reporting today"],
144
144
  // Bloomberg's calendar: the market board always, never one company's history.
145
145
  shortcut: { prefix: "EVTS", argPlaceholder: "ticker", argKind: "ticker", argOptional: true },
@@ -1010,7 +1010,7 @@ function CallsListView({
1010
1010
  // for the company, or it has nothing to search for.
1011
1011
  if (ticker && calls.length === 0) {
1012
1012
  return listPending ? (
1013
- <PaneStatusBody loading align="center" loadingLabel={`Looking for ${ticker}'s earnings calls...`} />
1013
+ <PaneStatusBody empty align="center" emptyTitle={`Looking for ${ticker}'s earnings calls...`} />
1014
1014
  ) : (
1015
1015
  <EmptyState {...noCallsText(ticker)} />
1016
1016
  );
@@ -1026,7 +1026,7 @@ function CallsListView({
1026
1026
  ) : selected && selectedUpcoming ? (
1027
1027
  <UpcomingCallState call={selected} now={now} />
1028
1028
  ) : selected && !selectedTranscript && (producing || (!selected.hasTranscript && !transcriptError)) ? (
1029
- <PaneStatusBody loading loadingLabel="Producing the transcript. This usually takes two to three minutes." />
1029
+ <PaneStatusBody empty emptyTitle="Transcript not ready yet." emptyMessage="Producing the transcript. This usually takes two to three minutes." />
1030
1030
  ) : (
1031
1031
 
1032
1032
  // The reader gets its own find field: a transcript runs to thousands of
@@ -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
 
@@ -50,7 +50,7 @@ export const PERIOD_COLUMNS: DataTableColumn[] = [
50
50
  { id: "percentile", label: "PCTL 1Y", width: 9, align: "right" },
51
51
  { id: "change", label: "CHANGE %", width: 11, align: "right" },
52
52
  { id: "breadth", label: "UP/DN 30D", width: 12, align: "right" },
53
- { id: "range", label: "HI-LO", width: 11, align: "right" },
53
+ { id: "range", label: "HI-LO", width: 11, align: "right", omitWhenEmpty: true },
54
54
  { id: "asOf", label: "AS OF", width: 12, align: "left", flexGrow: 1 },
55
55
  ];
56
56
  export function sortPeriods(
@@ -14,7 +14,7 @@ function sourceInput(arg: string, context: PaneTemplateContext): string {
14
14
  const source = SOURCE.exec(arg.trim());
15
15
  if (!source) return arg;
16
16
  const prefix = source[1]!.toUpperCase();
17
- const match = findNamedCollection(prefix === "PORT" ? context.config.portfolios : context.config.watchlists, source[2]);
17
+ const match = findNamedCollection<{ id: string; name: string }>(prefix === "PORT" ? context.config.portfolios : context.config.watchlists, source[2]);
18
18
  return match ? `${prefix}:${match.id}` : arg;
19
19
  }
20
20
 
@@ -3,8 +3,8 @@ import type { HeadlessPaneDefinition } from "../../../types/plugin";
3
3
  import { resolveHeadlessInstrument } from "../shared/headless-market-data";
4
4
  import { loadMacroDayEarnings, loadMacroDayHistory, loadMacroDaySeriesHistory, loadMacroReleases, macroDayEarningsNotice, type MacroDayEarnings } from "./client";
5
5
  import { fredSeriesArgument } from "../../../series/fred-argument";
6
- import { formatMacroDayMove, macroDayEventLabel, macroDayReleaseName, macroDayStats, macroFigureGapNotices, matchesSurprise, projectMacroDays, type MacroDayEvent,
7
- type MacroDayStats } from "./model";
6
+ import { formatMacroDayMove, macroDayEventLabel, macroDayReleaseName, macroDayStats, macroFigureGapNotices, macroSurpriseBasisLabel,
7
+ macroSurpriseExclusionNote, macroSurpriseOf, matchesSurprise, projectMacroDays, type MacroDayEvent, type MacroDayStats } from "./model";
8
8
  import { MACRO_EVENT_KINDS, MACRO_EVENT_LABELS, MACRO_RELEASE_SOURCES, MACRO_SURPRISE_LABELS, MACRO_SURPRISES, staleMacroReleasesNotice,
9
9
  US_MACRO_EVENT_KINDS, type MacroEventKind, type MacroReleaseFigures, type MacroSurprise } from "./releases";
10
10
 
@@ -27,7 +27,8 @@ export const macroDayHeadless: HeadlessPaneDefinition<"bundle"> = {
27
27
  "US listings, or a FRED series (FRED:T10Y2Y, whose moves in a rate or spread read in bp); close-to-close on the release day.",
28
28
  "Published CPI, jobs and FOMC days, and from Gloom Cloud Brazil's IPCA days, the ECB's decision days (every Governing Council monetary policy meeting) and the BoJ's (each monetary policy meeting's Tokyo day, from 2026); sessions after the list's last covered day (releasesThrough) are left out.",
29
29
  "Actual, forecast and prior for the days Gloom Cloud has them (the US headlines from its kept economic calendar, under either feed's title; an FOMC day's are the federal funds target range and whether it held or moved, an ECB day's the deposit facility rate, a BoJ day's its policy rate; IPCA from the central bank's SGS series); --surprise keeps the days that came in hot, cool or in line with the forecast.",
30
- "A CPI day the calendar lists without its year-on-year actual takes one computed from the CPI index against a year earlier, labelled computed.",
30
+ "A CPI day the calendar lists without its year-on-year actual takes one computed from the CPI index against a year earlier, labelled computed; where none can be (October 2026, as the October 2025 index was never published), its surprise is read from core CPI m/m, else CPI m/m, and named so (hot (core m/m)).",
31
+ "With --surprise, the notes say how many days in scope were left out because their surprise cannot be read (no actual, or no forecast).",
31
32
  "A release day without figures says why: before the kept calendar starts, or listed without them.",
32
33
  "A release day that is also the reaction session of the company's own earnings report is marked earnings and left out of the release averages and the normal day.",
33
34
  ] },
@@ -63,7 +64,11 @@ export const macroDayHeadless: HeadlessPaneDefinition<"bundle"> = {
63
64
  const header = (label: string) => yieldMoves ? `${label} bp` : label;
64
65
  const release = String(args.options.release ?? "all");
65
66
  const surprise = String(args.options.surprise ?? "all") as MacroSurprise | "all";
66
- const events = model.events.filter((event) => (release === "all" || event.kind === release) && matchesSurprise(event, surprise));
67
+ const scoped = model.events.filter((event) => release === "all" || event.kind === release);
68
+ const events = scoped.filter((event) => matchesSurprise(event, surprise));
69
+ // A surprise filter says how many days it could not read, and the notes below say why for them too.
70
+ const unread = surprise === "all" ? [] : scoped.filter((event) => macroSurpriseOf(event.figures) == null);
71
+ const excluded = macroSurpriseExclusionNote(scoped, surprise);
67
72
  // The days the filter keeps get a row of their own: how the name moved on hot CPI days.
68
73
  const selected = surprise === "all" ? [] : [row(`${MACRO_SURPRISE_LABELS[surprise]} ${release === "all" ? "release"
69
74
  : MACRO_EVENT_LABELS[release as MacroEventKind]}`, macroDayStats(events, model.normal.meanAbs))];
@@ -74,8 +79,9 @@ export const macroDayHeadless: HeadlessPaneDefinition<"bundle"> = {
74
79
  const beforeCalendar = (event: MacroDayEvent) => predates(event) && !event.figures;
75
80
  const noForecast = (event: MacroDayEvent) => predates(event) && !!event.figures && event.figures.forecast == null;
76
81
  /** "CPI and Jobs days": the kinds of the listed days `pick` takes, in the order the summary lists them. */
82
+ const noted = [...events, ...unread];
77
83
  const daysOf = (pick: (event: MacroDayEvent) => boolean) => {
78
- const labels = model.kinds.filter((kind) => events.some((event) => event.kind === kind && pick(event))).map((kind) => MACRO_EVENT_LABELS[kind]);
84
+ const labels = model.kinds.filter((kind) => noted.some((event) => event.kind === kind && pick(event))).map((kind) => MACRO_EVENT_LABELS[kind]);
79
85
  return `${labels.length > 1 ? `${labels.slice(0, -1).join(", ")} and ${labels.at(-1)}` : labels[0]} days`;
80
86
  };
81
87
  // A release Gloom Cloud alone lists (IPCA, the ECB, the BoJ) is summed up on its own: "Any release" is then the US ones'.
@@ -83,9 +89,10 @@ export const macroDayHeadless: HeadlessPaneDefinition<"bundle"> = {
83
89
  const missing = (event: MacroDayEvent) => event.figures ? null : event.figuresMissing
84
90
  ?? (beforeCalendar(event) ? `before ${figuresFrom}, when Gloom Cloud's economic calendar starts` : null);
85
91
  const figureNotes = [
86
- ...(events.some(beforeCalendar) ? [`${daysOf(beforeCalendar)} before ${figuresFrom} have no actual, forecast or prior: Gloom Cloud's economic calendar starts then.`] : []),
87
- ...(events.some(noForecast) ? [`Forecasts start ${figuresFrom}, with Gloom Cloud's economic calendar: ${daysOf(noForecast)} before it have an actual and prior, no forecast or surprise.`] : []),
88
- ...macroFigureGapNotices(events),
92
+ ...(excluded ? [excluded] : []),
93
+ ...(noted.some(beforeCalendar) ? [`${daysOf(beforeCalendar)} before ${figuresFrom} have no actual, forecast or prior: Gloom Cloud's economic calendar starts then.`] : []),
94
+ ...(noted.some(noForecast) ? [`Forecasts start ${figuresFrom}, with Gloom Cloud's economic calendar: ${daysOf(noForecast)} before it have an actual and prior, no forecast or surprise.`] : []),
95
+ ...macroFigureGapNotices(noted.toSorted((left, right) => right.date.localeCompare(left.date) || left.kind.localeCompare(right.kind))),
89
96
  ];
90
97
  return {
91
98
  sections: [
@@ -102,13 +109,17 @@ export const macroDayHeadless: HeadlessPaneDefinition<"bundle"> = {
102
109
  { key: "actual", header: "Actual", textFormat: (value, row) => typeof value !== "string" ? MISSING_VALUE
103
110
  : row.actualComputed === true ? `${value} (computed)` : value },
104
111
  { key: "forecast", header: "Forecast" }, { key: "prior", header: "Prior" },
105
- { key: "surprise", header: "Surprise" },
112
+ // A surprise read from another print than the headline's names it: hot (core m/m).
113
+ { key: "surprise", header: "Surprise", textFormat: (value, row) => typeof value !== "string" ? MISSING_VALUE
114
+ : typeof row.surpriseBasis === "string" ? `${value} (${row.surpriseBasis})` : value },
106
115
  { key: "session", header: "Session" }, { key: "move", header: header("Move"), format: move }, { key: "multiple", header: "vs normal", format: multiple }],
107
116
  rows: events.map((day) => {
108
117
  const { figures, figuresMissing: _gap, ...event } = day;
109
118
  const why = missing(day);
110
119
  return { ...event, event: macroDayReleaseName(day), actual: figures?.actual ?? null,
111
- forecast: figures?.forecast ?? null, prior: figures?.prior ?? null, surprise: figures?.surprise ?? null,
120
+ forecast: figures?.forecast ?? null, prior: figures?.prior ?? null, surprise: macroSurpriseOf(figures),
121
+ ...(macroSurpriseBasisLabel(figures) ? { surpriseBasis: macroSurpriseBasisLabel(figures),
122
+ surpriseBasisActual: figures!.surpriseBasis!.actual, surpriseBasisForecast: figures!.surpriseBasis!.forecast } : {}),
112
123
  ...(figures ? { headline: figures.event } : {}), ...(figures?.decision ? { decision: figures.decision } : {}),
113
124
  ...(figures?.computed ? { actualComputed: true, actualBasis: figures.computed } : {}),
114
125
  ...(figures?.actualMissing ? { actualMissing: figures.actualMissing } : {}),
@@ -119,9 +119,45 @@ export const macroFigureGapNotices = (events: readonly Pick<MacroDayEvent, "kind
119
119
  const label = `${event.date} ${MACRO_EVENT_LABELS[event.kind]}`;
120
120
  if (!event.figures) return event.figuresMissing ? [`${label} has no figures: ${event.figuresMissing}.`] : [];
121
121
  if (event.figures.computed) return [`${label} actual is ${event.figures.computed}.`];
122
- return event.figures.actualMissing ? [`${label} has no actual: ${event.figures.actualMissing}.`] : [];
122
+ // The print its surprise is read from instead, with its own figures.
123
+ const basis = macroSurpriseBasisLabel(event.figures) != null ? event.figures.surpriseBasis : null;
124
+ const read = basis ? ` Surprise read from ${basis.basis}: ${basis.actual} vs ${basis.forecast} forecast.` : "";
125
+ return event.figures.actualMissing ? [`${label} has no actual: ${event.figures.actualMissing}.${read}`]
126
+ : basis ? [`${label} has no actual.${read}`] : [];
123
127
  });
124
128
 
129
+ /**
130
+ * Whether a day's print came in hot, cool or in line: its headline against
131
+ * the consensus, or where the headline has no actual (a CPI day with no y/y)
132
+ * the print the surprise is read from instead (core m/m, else m/m). Null
133
+ * when neither can say.
134
+ */
135
+ export const macroSurpriseOf = (figures: Pick<MacroReleaseFigures, "surprise" | "surpriseBasis"> | null | undefined): MacroSurprise | null =>
136
+ figures?.surprise ?? figures?.surpriseBasis?.surprise ?? null;
137
+
138
+ /** The print a surprise was read from when it is not the headline's, as a cell names it: `core m/m`; null for the headline's own. */
139
+ export const macroSurpriseBasisLabel = (figures: Pick<MacroReleaseFigures, "surprise" | "surpriseBasis"> | null | undefined): string | null =>
140
+ figures?.surprise == null && figures?.surpriseBasis ? figures.surpriseBasis.basis : null;
141
+
142
+ /**
143
+ * What a surprise filter leaves out, for the days in scope: those whose
144
+ * surprise cannot be read, "3 prints excluded: no actual." (or no forecast,
145
+ * for a print with no consensus). Null when the filter keeps every day it can
146
+ * read, and with no filter.
147
+ */
148
+ export function macroSurpriseExclusionNote(events: readonly Pick<MacroDayEvent, "figures">[], surprise: MacroSurprise | "all"): string | null {
149
+ if (surprise === "all") return null;
150
+ const unread = events.filter((event) => macroSurpriseOf(event.figures) == null);
151
+ if (!unread.length) return null;
152
+ const noActual = unread.filter((event) => !event.figures?.actual).length;
153
+ const noForecast = unread.filter((event) => event.figures?.actual && !event.figures.forecast).length;
154
+ const unavailable = unread.length - noActual - noForecast;
155
+ const reasons = ([[noActual, "no actual"], [noForecast, "no forecast"], [unavailable, "surprise unavailable"]] as const)
156
+ .filter(([count]) => count > 0);
157
+ const prints = `${unread.length} print${unread.length === 1 ? "" : "s"} excluded`;
158
+ return `${prints}: ${reasons.map(([count, reason]) => reasons.length > 1 ? `${count} ${reason}` : reason).join(", ")}.`;
159
+ }
160
+
125
161
  /** What a row adds to its release's name: a policy decision's move, and the earnings marker. */
126
162
  export const macroDayEventNote = (event: Pick<MacroDayEvent, "earnings" | "figures">) =>
127
163
  [event.figures?.decision, event.earnings ? "(earnings)" : null].filter(Boolean).join(" ");
@@ -141,9 +177,12 @@ export function macroDayStats(events: readonly MacroDayEvent[], normalAbs: numbe
141
177
  return stats(events.filter((event) => !event.earnings).map((event) => event.move), normalAbs);
142
178
  }
143
179
 
144
- /** Whether a release day's print matches a surprise filter; `all` matches every day, figures or not. */
180
+ /**
181
+ * Whether a release day's print matches a surprise filter (`macroSurpriseOf`, the m/m print's where the headline has
182
+ * no actual); `all` matches every day, figures or not.
183
+ */
145
184
  export const matchesSurprise = (event: Pick<MacroDayEvent, "figures">, surprise: MacroSurprise | "all") =>
146
- surprise === "all" || event.figures?.surprise === surprise;
185
+ surprise === "all" || macroSurpriseOf(event.figures) === surprise;
147
186
 
148
187
  function stats(moves: number[], normalAbs: number | null): MacroDayStats {
149
188
  if (!moves.length) return { count: 0, meanAbs: null, mean: null, hitRate: null, multiple: null };
@@ -15,7 +15,7 @@ import { Box } from "../../../ui";
15
15
  import { loadMacroDayEarnings, loadMacroDayHistory, loadMacroReleases, macroDayEarningsNotice } from "./client";
16
16
  import {
17
17
  formatMacroDayMove, macroDayEventLabel, macroDayEventNote, macroDayMoveDecimals, macroDayStats, matchesSurprise, macroFigureGapNotices,
18
- projectMacroDays, type MacroDayEvent,
18
+ macroSurpriseBasisLabel, macroSurpriseExclusionNote, macroSurpriseOf, projectMacroDays, type MacroDayEvent,
19
19
  type MacroDayModel, type MacroDayMoveBasis,
20
20
  } from "./model";
21
21
  import { MACRO_EVENT_KINDS, MACRO_EVENT_LABELS, MACRO_SURPRISE_LABELS, MACRO_SURPRISES, staleMacroReleasesNotice, type MacroEventKind,
@@ -36,11 +36,24 @@ const moveColumns = (basis: MacroDayMoveBasis): DataTableColumn[] => [
36
36
  /** What each release came out with, under the labels the economic calendar gives them. */
37
37
  const FIGURES = [["actual", "Actual"], ["forecast", "Forecast"], ["prior", "Prior"]] as const;
38
38
 
39
- /** The figure columns, shown once any listed day has figures, each as wide as its header and its widest value. */
39
+ /**
40
+ * Whether the print came in hot, cool or in line, in words, so it never rests on the Actual's colour alone; a
41
+ * surprise read from another print than the headline's names it: "Hot (core m/m)".
42
+ */
43
+ export function macroSurpriseText(event: Pick<MacroDayEvent, "figures">): string {
44
+ const surprise = macroSurpriseOf(event.figures);
45
+ if (!surprise) return "";
46
+ const basis = macroSurpriseBasisLabel(event.figures);
47
+ return basis ? `${MACRO_SURPRISE_LABELS[surprise]} (${basis})` : MACRO_SURPRISE_LABELS[surprise];
48
+ }
49
+
50
+ /** The figure columns, shown once any listed day has figures, each as wide as its header and its widest value; Surprise after them. */
40
51
  function figureColumns(rows: readonly MacroDayEvent[]): DataTableColumn[] {
41
52
  if (!rows.some((event) => event.figures)) return [];
42
- return FIGURES.map(([id, label]) => ({ id, label, align: "right", width: tableColumnWidth({ label,
43
- width: Math.max(6, ...rows.map((event) => displayWidth(event.figures?.[id] ?? ""))) }) }));
53
+ return [...FIGURES.map(([id, label]): DataTableColumn => ({ id, label, align: "right", width: tableColumnWidth({ label,
54
+ width: Math.max(6, ...rows.map((event) => displayWidth(event.figures?.[id] ?? ""))) }) })),
55
+ { id: "surprise", label: "Surprise", align: "left", width: tableColumnWidth({ label: "Surprise",
56
+ width: Math.max(...rows.map((event) => displayWidth(macroSurpriseText(event)))) }) }];
44
57
  }
45
58
 
46
59
  /**
@@ -123,16 +136,20 @@ export function MacroDayPane({ width, height, focused }: PaneProps) {
123
136
  [history.data, lookback, symbol]);
124
137
  const releasesNotice = history.data ? staleMacroReleasesNotice(history.data.releases) : null;
125
138
  const earningsNotice = history.data ? macroDayEarningsNotice(history.data.earnings) : null;
126
- const rows = useMemo(() => model ? model.events.filter((event) => (release === "all" || event.kind === release)
127
- && matchesSurprise(event, surprise)) : [], [model, release, surprise]);
139
+ const scoped = useMemo(() => model ? model.events.filter((event) => release === "all" || event.kind === release) : [], [model, release]);
140
+ const rows = useMemo(() => scoped.filter((event) => matchesSurprise(event, surprise)), [scoped, surprise]);
141
+ // A surprise filter says how many days in scope it could not read: "3 prints excluded: no actual."
142
+ const excluded = useMemo(() => macroSurpriseExclusionNote(scoped, surprise), [scoped, surprise]);
128
143
  const stats = useMemo(() => !model?.events.length ? [] : surprise === "all" ? figures(model, release) : surpriseFigures(model, rows),
129
144
  [model, release, surprise, rows]);
130
145
  const columns = useMemo(() => columnsFor(release, rows, model?.basis), [model?.basis, release, rows]);
131
146
 
132
147
  // A covered release day the calendar left without figures says why; days before the calendar are the docs' to explain.
133
- const figureGaps = useMemo(() => macroFigureGapNotices(rows), [rows]);
148
+ // Why a listed day, or one the filter left out, has no actual.
149
+ const figureGaps = useMemo(() => macroFigureGapNotices(surprise === "all" ? rows : scoped.filter((event) => matchesSurprise(event, surprise)
150
+ || macroSurpriseOf(event.figures) == null)), [rows, scoped, surprise]);
134
151
  usePaneNoticeFooter({ registrationId: "macro-day-notices", focused,
135
- notices: [...new Set([identityError, history.error, history.data?.error, releasesNotice, earningsNotice, ...figureGaps]
152
+ notices: [...new Set([identityError, history.error, history.data?.error, releasesNotice, earningsNotice, excluded, ...figureGaps]
136
153
  .filter((value): value is string => !!value))] });
137
154
  usePaneFooter("macro-day", () => ({ info: [
138
155
  ...(history.loading ? [{ id: "loading", parts: [{ text: "loading history", tone: "muted" as const }] }] : []),
@@ -147,6 +164,7 @@ export function MacroDayPane({ width, height, focused }: PaneProps) {
147
164
  if (column.id === "actual") return { text: event.figures?.actual ?? "", color: event.figures?.surprise === "hot" ? colors.positive
148
165
  : event.figures?.surprise === "cool" ? colors.negative : undefined };
149
166
  if (column.id === "forecast") return { text: event.figures?.forecast ?? "" };
167
+ if (column.id === "surprise") return { text: macroSurpriseText(event) };
150
168
  if (column.id === "prior") return { text: event.figures?.prior ?? "" };
151
169
  if (column.id === "move") {
152
170
  const basis = model?.basis ?? "return";
@@ -62,6 +62,19 @@ export interface MacroReleaseFigures {
62
62
  computed?: string;
63
63
  /** Why a day with a consensus or a prior has no actual, where it cannot be computed either. */
64
64
  actualMissing?: string;
65
+ /**
66
+ * Where the headline has no actual (a CPI day without its y/y), the print its surprise is read from instead:
67
+ * core m/m, else m/m, against its own consensus. `surprise` stays the headline's own, null.
68
+ */
69
+ surpriseBasis?: MacroSurpriseBasis;
70
+ }
71
+
72
+ /** The print a day's surprise is read from when its headline has none: `core m/m`, 0.3% against 0.2%, hot. */
73
+ interface MacroSurpriseBasis {
74
+ basis: string;
75
+ actual: string;
76
+ forecast: string;
77
+ surprise: MacroSurprise;
65
78
  }
66
79
 
67
80
  export interface MacroRelease {
@@ -106,8 +119,18 @@ function servedFigures(value: unknown): MacroReleaseFigures | undefined {
106
119
  const decision = text(figures?.decision);
107
120
  const computed = text(figures?.computed);
108
121
  const actualMissing = text(figures?.actualMissing);
122
+ const surpriseBasis = servedSurpriseBasis(figures?.surpriseBasis);
109
123
  return { event, actual: text(figures?.actual), forecast: text(figures?.forecast), prior: text(figures?.prior), surprise,
110
- ...(decision ? { decision } : {}), ...(computed ? { computed } : {}), ...(actualMissing ? { actualMissing } : {}) };
124
+ ...(decision ? { decision } : {}), ...(computed ? { computed } : {}), ...(actualMissing ? { actualMissing } : {}),
125
+ ...(surpriseBasis ? { surpriseBasis } : {}) };
126
+ }
127
+
128
+ /** The print a surprise is read from as served, or undefined when it breaks the contract. */
129
+ function servedSurpriseBasis(value: unknown): MacroSurpriseBasis | undefined {
130
+ const served = value as Partial<Record<keyof MacroSurpriseBasis, unknown>> | null;
131
+ const basis = text(served?.basis), actual = text(served?.actual), forecast = text(served?.forecast);
132
+ const surprise = MACRO_SURPRISES.find((candidate) => candidate === served?.surprise);
133
+ return basis && actual && forecast && surprise ? { basis, actual, forecast, surprise } : undefined;
111
134
  }
112
135
 
113
136
  /**
@@ -5,7 +5,7 @@ import { MISSING_VALUE, formatNumber } from "../../../utils/format";
5
5
  import { historySpanStat, sinceLabel } from "../shared/history-span";
6
6
  import { SeriesDetailChart } from "../shared/series-detail-chart";
7
7
  import { valuationAxis, zoneSeriesFor } from "./chart-projection";
8
- import type { IndicatorViewModel } from "./view";
8
+ import { readingPeriodEnd, type IndicatorViewModel } from "./view";
9
9
  import { ZoneColorScale } from "./zone-scale";
10
10
 
11
11
  function formatTrillions(billions: number): string {
@@ -49,8 +49,8 @@ export function IndicatorDetail({
49
49
  : []),
50
50
  { id: "year-ago", label: "1Y ago", value: view.ratioOneYearAgo == null ? MISSING_VALUE : indicator.formatValue(view.ratioOneYearAgo) },
51
51
  // The whole history's, whatever the range the chart shows.
52
- { id: "ath", label: sinceLabel("High", view.historyStart), value: indicator.formatValue(view.allTimeHigh.ratio), detail: view.allTimeHigh.date },
53
- { id: "atl", label: sinceLabel("Low", view.historyStart), value: indicator.formatValue(view.allTimeLow.ratio), detail: view.allTimeLow.date },
52
+ { id: "ath", label: sinceLabel("High", view.historyStart), value: indicator.formatValue(view.allTimeHigh.ratio), detail: readingPeriodEnd(view.allTimeHigh.date, view.periodicity) },
53
+ { id: "atl", label: sinceLabel("Low", view.historyStart), value: indicator.formatValue(view.allTimeLow.ratio), detail: readingPeriodEnd(view.allTimeLow.date, view.periodicity) },
54
54
  // A range longer than the history shows all of it, from where it starts.
55
55
  ...[historySpanStat(view.span)].filter((item): item is StatItem => item !== null),
56
56
  ], [indicator, levels, view]);
@@ -14,6 +14,7 @@ import { createCloudSourceDeps } from "./sources";
14
14
  import { historyStartNotice, sinceLabel } from "../shared/history-span";
15
15
  import { formatSigma } from "../shared/trend";
16
16
  import {
17
+ readingPeriodEnd,
17
18
  selectValuationViews,
18
19
  type IndicatorViewModel,
19
20
  type ValuationBundle,
@@ -45,14 +46,14 @@ function detailEntries(view: IndicatorViewModel): HeadlessPaneEntry[] {
45
46
  {
46
47
  label: sinceLabel("High", view.historyStart),
47
48
  value: { value: view.allTimeHigh.ratio, date: view.allTimeHigh.date },
48
- formatted: `${format(view.allTimeHigh.ratio)} ${view.allTimeHigh.date}`,
49
+ formatted: `${format(view.allTimeHigh.ratio)} ${readingPeriodEnd(view.allTimeHigh.date, view.periodicity)}`,
49
50
  },
50
51
  {
51
52
  label: sinceLabel("Low", view.historyStart),
52
53
  value: { value: view.allTimeLow.ratio, date: view.allTimeLow.date },
53
- formatted: `${format(view.allTimeLow.ratio)} ${view.allTimeLow.date}`,
54
+ formatted: `${format(view.allTimeLow.ratio)} ${readingPeriodEnd(view.allTimeLow.date, view.periodicity)}`,
54
55
  },
55
- { label: "As of", value: view.asOf },
56
+ { label: "As of", value: view.asOf, formatted: readingPeriodEnd(view.asOf, view.periodicity) },
56
57
  ];
57
58
  }
58
59
 
@@ -113,7 +114,9 @@ function projectValuationHeadlessBundle(
113
114
  align: "right",
114
115
  format: (value) => formatSigma(value == null ? null : Number(value)),
115
116
  },
116
- { key: "asOf", header: "As of" },
117
+ // The day the reading's period ends, as FA dates its columns; the row keeps the period's first day.
118
+ { key: "asOf", header: "As of", format: (value, row) => typeof value === "string"
119
+ ? readingPeriodEnd(value, row.periodicity as IndicatorViewModel["periodicity"] | undefined) : MISSING_VALUE },
117
120
  ],
118
121
  rows,
119
122
  },
@@ -122,6 +125,10 @@ function projectValuationHeadlessBundle(
122
125
  : []),
123
126
  ],
124
127
  errors: bundle.errors,
128
+ // The status line counts the stale readings; each is named here, with the period it is of.
129
+ ...(rows.some((row) => row.stale) ? {
130
+ notes: rows.filter((row) => row.stale).map((row) => `${row.indicator} is stale: its latest reading is as of ${readingPeriodEnd(row.asOf, row.periodicity)}, older than its release schedule allows.`),
131
+ } : {}),
125
132
  metadata: {
126
133
  fetchedAt: bundle.fetchedAt,
127
134
  sources: bundle.sources,
@@ -20,6 +20,7 @@ import { INDICATORS } from "./indicators";
20
20
  import { RANGE_OPTIONS, VALUATION_DEFAULTS } from "./settings";
21
21
  import { formatSigma } from "../shared/trend";
22
22
  import {
23
+ readingPeriodEnd,
23
24
  selectValuationViews,
24
25
  type IndicatorViewModel
25
26
  } from "./view";
@@ -148,7 +149,8 @@ export function MarketValuationPane({ focused, width, height }: PaneProps) {
148
149
  const footerInfo = useMemo<PaneFooterSegment[]>(() => {
149
150
  if (!selectedView) return [];
150
151
  const info: PaneFooterSegment[] = [
151
- { id: "as-of", parts: [{ text: `as of ${selectedView.asOf}`, tone: "muted" }] },
152
+ // The day the reading's period ends, as FA dates a period.
153
+ { id: "as-of", parts: [{ text: `as of ${readingPeriodEnd(selectedView.asOf, selectedView.periodicity)}`, tone: "muted" }] },
152
154
  ...(width >= 80 ? [DELAYED_SEGMENT] : []),
153
155
  ];
154
156
  if (selectedView.observationStale) {