gloomberb 0.19.3 → 0.19.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (226) hide show
  1. package/package.json +4 -2
  2. package/src/api-client/errors.ts +8 -0
  3. package/src/api-client/index.ts +18 -0
  4. package/src/api-client/request.ts +295 -42
  5. package/src/api-client/socket.ts +95 -0
  6. package/src/app/keybindings/actions.ts +1 -1
  7. package/src/app/pane-runtime/index.tsx +1 -1
  8. package/src/app/pane-runtime/ticker-inspector-runtime.ts +1 -1
  9. package/src/app/pane-runtime/ticker-open-runtime.ts +1 -1
  10. package/src/app/pane-runtime/ticker-open-target.ts +12 -2
  11. package/src/cli/commands/command-utils.ts +4 -0
  12. package/src/cli/commands/market.ts +119 -27
  13. package/src/cli/commands/search.ts +1 -1
  14. package/src/cli/commands/ticker.ts +10 -6
  15. package/src/cli/currency-name-hint.ts +60 -0
  16. package/src/cli/desktop-pane-shot-api-policy.ts +10 -2
  17. package/src/cli/desktop-pane-shot.ts +2 -1
  18. package/src/cli/history-rows.ts +18 -1
  19. package/src/cli/known-gaps.ts +17 -2
  20. package/src/cli/not-a-ticker.ts +5 -3
  21. package/src/cli/pane-functions/catalog.ts +9 -1
  22. package/src/cli/pane-functions/headless.ts +7 -3
  23. package/src/cli/pane-functions/market-session.ts +6 -7
  24. package/src/cli/series-search.ts +4 -5
  25. package/src/components/chart/composite/panel-bitmap.ts +28 -2
  26. package/src/components/chart/composite/time-axis.ts +17 -2
  27. package/src/components/command-bar/action-runtime.ts +2 -0
  28. package/src/components/command-bar/commands/direct/runtime.ts +3 -3
  29. package/src/components/command-bar/helpers.ts +2 -0
  30. package/src/components/command-bar/list/model.ts +9 -0
  31. package/src/components/command-bar/pane-actions.ts +46 -35
  32. package/src/components/command-bar/pane-templates/workflow.ts +6 -0
  33. package/src/components/command-bar/panel/index.tsx +30 -3
  34. package/src/components/command-bar/panel/types.ts +7 -0
  35. package/src/components/command-bar/routes/root/results.ts +4 -4
  36. package/src/components/command-bar/routes/root/selection.ts +3 -2
  37. package/src/components/command-bar/routes/ticker-search/actions.ts +21 -16
  38. package/src/components/command-bar/routing/launch-request.ts +3 -2
  39. package/src/components/command-bar/routing/list-state.ts +4 -1
  40. package/src/components/command-bar/surface/index.tsx +15 -1
  41. package/src/components/layout/floating-pane.tsx +10 -0
  42. package/src/components/layout/pane/frame.tsx +6 -0
  43. package/src/components/layout/pane/header.tsx +244 -42
  44. package/src/components/layout/pane/index.tsx +20 -2
  45. package/src/components/layout/shell/active-drag.ts +160 -28
  46. package/src/components/layout/shell/drag/index.ts +99 -96
  47. package/src/components/layout/shell/drag/live.ts +3 -17
  48. package/src/components/layout/shell/drag/magnets.ts +304 -0
  49. package/src/components/layout/shell/drag/overlays.tsx +77 -75
  50. package/src/components/layout/shell/drag/runtime.ts +12 -7
  51. package/src/components/layout/shell/index.tsx +66 -32
  52. package/src/components/layout/shell/native/pointer-runtime.ts +7 -2
  53. package/src/components/layout/shell/native/surfaces.ts +1 -9
  54. package/src/components/layout/shell/native/window-state.ts +21 -25
  55. package/src/components/layout/shell/pane/layers.tsx +153 -24
  56. package/src/components/layout/shell/shortcuts.ts +4 -1
  57. package/src/components/layout/shell/terminal-pointer-runtime.ts +24 -1
  58. package/src/components/layout/shell/window-mode/overlays.tsx +14 -6
  59. package/src/components/layout/status-bar.tsx +75 -6
  60. package/src/components/layout/window-controls.tsx +96 -35
  61. package/src/components/layout/window-fullscreen.ts +20 -0
  62. package/src/components/quote-flash.ts +36 -32
  63. package/src/core/app-runtime.ts +4 -1
  64. package/src/core/connection-health.ts +76 -1
  65. package/src/core/state/app/command-bar-launch.ts +12 -0
  66. package/src/core/state/app/layout.ts +4 -3
  67. package/src/core/state/app/types.ts +4 -1
  68. package/src/data/config/layout.ts +2 -2
  69. package/src/data/config/store/fold-panes.ts +6 -1
  70. package/src/i18n/es.ts +8 -1
  71. package/src/i18n/ja.ts +8 -1
  72. package/src/i18n/ko.ts +8 -1
  73. package/src/i18n/zh-cn.ts +8 -1
  74. package/src/i18n/zh-tw.ts +8 -1
  75. package/src/layout/pane-follow.ts +3 -2
  76. package/src/layout/pane-layout-move.ts +2 -1
  77. package/src/layout/pane-manager/dock-stack.ts +38 -0
  78. package/src/layout/pane-manager/dock-tree.ts +76 -15
  79. package/src/layout/pane-manager/docking.ts +48 -6
  80. package/src/layout/pane-manager/floating-actions.ts +12 -3
  81. package/src/layout/pane-manager/floating-placement.ts +189 -0
  82. package/src/layout/pane-manager/floating.ts +23 -4
  83. package/src/layout/pane-manager/gridlock.ts +16 -4
  84. package/src/layout/pane-manager/hidden-panes.ts +30 -1
  85. package/src/layout/pane-manager/index.ts +2 -0
  86. package/src/layout/pane-manager/layout-state.ts +17 -0
  87. package/src/layout/pane-manager/types.ts +4 -1
  88. package/src/layout/ticker-retarget.ts +88 -0
  89. package/src/layout-marketplace/cloud.ts +9 -1
  90. package/src/market-data/connection-follow.ts +68 -0
  91. package/src/market-data/coordinator/entries.ts +15 -3
  92. package/src/market-data/coordinator/events.ts +17 -1
  93. package/src/market-data/coordinator/financials.ts +20 -7
  94. package/src/market-data/coordinator/index.ts +217 -4
  95. package/src/market-data/coordinator/quotes.ts +10 -0
  96. package/src/market-data/frame-scheduler.ts +47 -10
  97. package/src/market-data/frame-wake.ts +74 -0
  98. package/src/market-data/futures-board.ts +7 -6
  99. package/src/market-data/hooks.tsx +43 -3
  100. package/src/market-data/performance.ts +78 -9
  101. package/src/market-data/request-types.ts +6 -3
  102. package/src/news/aggregator.ts +12 -1
  103. package/src/plugins/builtin/alerts/cli.ts +2 -1
  104. package/src/plugins/builtin/analytics/risk-evidence.ts +1 -0
  105. package/src/plugins/builtin/attention/evidence.ts +1 -1
  106. package/src/plugins/builtin/awards/client.ts +1 -1
  107. package/src/plugins/builtin/awards/evidence.ts +1 -1
  108. package/src/plugins/builtin/awards/pane.tsx +2 -1
  109. package/src/plugins/builtin/bond-calculator/math.ts +1 -1
  110. package/src/plugins/builtin/broker-manager/footer.ts +3 -2
  111. package/src/plugins/builtin/broker-manager/index.tsx +2 -1
  112. package/src/plugins/builtin/broker-manager/keyboard.ts +2 -1
  113. package/src/plugins/builtin/buildout/company/pane.tsx +2 -1
  114. package/src/plugins/builtin/buildout/model/index.ts +6 -0
  115. package/src/plugins/builtin/buildout/pane/index.tsx +2 -1
  116. package/src/plugins/builtin/catalysts/evidence.ts +1 -1
  117. package/src/plugins/builtin/catalysts/pane.tsx +2 -1
  118. package/src/plugins/builtin/chart-composer/headless.ts +40 -1
  119. package/src/plugins/builtin/chart-composer/index.tsx +13 -0
  120. package/src/plugins/builtin/chat/controller/index.ts +10 -3
  121. package/src/plugins/builtin/chat/controller/session-runtime.ts +9 -2
  122. package/src/plugins/builtin/chat/status-widget.tsx +3 -1
  123. package/src/plugins/builtin/cloud-tweets/table.tsx +3 -2
  124. package/src/plugins/builtin/comment-letters/client.ts +2 -1
  125. package/src/plugins/builtin/company-kpis/client.ts +1 -1
  126. package/src/plugins/builtin/company-kpis/pane.tsx +2 -1
  127. package/src/plugins/builtin/company-kpis/screenshot-evidence.ts +3 -2
  128. package/src/plugins/builtin/cot/headless.ts +9 -3
  129. package/src/plugins/builtin/cot/model.ts +44 -3
  130. package/src/plugins/builtin/credit-documents/client.ts +1 -1
  131. package/src/plugins/builtin/credit-documents/evidence.ts +1 -1
  132. package/src/plugins/builtin/credit-documents/pane.tsx +2 -1
  133. package/src/plugins/builtin/earnings-calls/pane.tsx +1 -1
  134. package/src/plugins/builtin/earnings-ripple/index.tsx +6 -1
  135. package/src/plugins/builtin/econ/calendar-model.ts +2 -0
  136. package/src/plugins/builtin/econ/fred-catalog.ts +5 -5
  137. package/src/plugins/builtin/econ/print-watch.ts +3 -1
  138. package/src/plugins/builtin/futures/series.ts +16 -1
  139. package/src/plugins/builtin/fx-matrix/headless.ts +4 -2
  140. package/src/plugins/builtin/fx-matrix/index.tsx +37 -3
  141. package/src/plugins/builtin/fx-matrix/pairs.ts +15 -0
  142. package/src/plugins/builtin/gpu/headless.ts +2 -1
  143. package/src/plugins/builtin/help/function-card.tsx +2 -1
  144. package/src/plugins/builtin/help/index.tsx +3 -2
  145. package/src/plugins/builtin/insider/display.ts +45 -6
  146. package/src/plugins/builtin/ipo-calendar/model.ts +2 -0
  147. package/src/plugins/builtin/iv-history/client.ts +2 -1
  148. package/src/plugins/builtin/iv-history/headless.ts +2 -1
  149. package/src/plugins/builtin/jobs/pages.ts +4 -4
  150. package/src/plugins/builtin/kelly-sizer/headless.ts +2 -1
  151. package/src/plugins/builtin/market-heatmap/index.tsx +2 -1
  152. package/src/plugins/builtin/members/client.ts +1 -1
  153. package/src/plugins/builtin/mna/distress/client.ts +1 -0
  154. package/src/plugins/builtin/mna/pane.tsx +4 -1
  155. package/src/plugins/builtin/options/market-reference.ts +1 -1
  156. package/src/plugins/builtin/options/open-interest-as-of.ts +3 -1
  157. package/src/plugins/builtin/options/view.tsx +2 -1
  158. package/src/plugins/builtin/options-calculator/evidence.ts +1 -1
  159. package/src/plugins/builtin/options-scenario/csp-screen-pane.tsx +1 -1
  160. package/src/plugins/builtin/options-scenario/csp-screen.ts +8 -4
  161. package/src/plugins/builtin/options-scenario/csp.ts +28 -9
  162. package/src/plugins/builtin/options-scenario/evidence.ts +5 -4
  163. package/src/plugins/builtin/options-scenario/pane.tsx +2 -1
  164. package/src/plugins/builtin/perps/client.ts +1 -1
  165. package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +2 -1
  166. package/src/plugins/builtin/portfolio-list/pane/index.tsx +7 -3
  167. package/src/plugins/builtin/portfolio-list/use-throttled-memo.ts +10 -19
  168. package/src/plugins/builtin/research/analyst-model.ts +1 -0
  169. package/src/plugins/builtin/research/equity-diagnostic-pane.tsx +2 -1
  170. package/src/plugins/builtin/research/index.tsx +1 -0
  171. package/src/plugins/builtin/research/relative-valuation-currency.ts +1 -1
  172. package/src/plugins/builtin/research/relative-valuation-peers.ts +2 -1
  173. package/src/plugins/builtin/research-search/command-bar-search.ts +3 -1
  174. package/src/plugins/builtin/research-search/snippet.ts +1 -0
  175. package/src/plugins/builtin/revenue-breakdown/client.ts +3 -2
  176. package/src/plugins/builtin/seasonality/headless.ts +2 -1
  177. package/src/plugins/builtin/sec/command-bar-search.ts +3 -2
  178. package/src/plugins/builtin/sec/index.tsx +7 -4
  179. package/src/plugins/builtin/sec/row-summaries.ts +28 -12
  180. package/src/plugins/builtin/sectors/client.ts +18 -8
  181. package/src/plugins/builtin/sectors/index.tsx +19 -5
  182. package/src/plugins/builtin/short-interest/watch-client.ts +2 -1
  183. package/src/plugins/builtin/social-mentions/client.ts +2 -1
  184. package/src/plugins/builtin/supply-chain/client.ts +1 -1
  185. package/src/plugins/builtin/supply-chain/evidence.ts +1 -1
  186. package/src/plugins/builtin/supply-chain/graph-pane.tsx +2 -1
  187. package/src/plugins/builtin/supply-chain/pane.tsx +2 -1
  188. package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +1 -1
  189. package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +24 -4
  190. package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +1 -1
  191. package/src/plugins/builtin/ticker-detail/overview/pane.tsx +4 -1
  192. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +25 -2
  193. package/src/plugins/builtin/time-sales/client.ts +1 -0
  194. package/src/plugins/builtin/vol-surface/client.ts +2 -1
  195. package/src/plugins/builtin/yield-curve/headless.ts +3 -1
  196. package/src/portfolio/column-values.ts +76 -10
  197. package/src/react/async-resource.ts +12 -0
  198. package/src/remote/controller.ts +3 -1
  199. package/src/renderers/browser/app-services.ts +8 -1
  200. package/src/renderers/browser/cloud-transport.ts +6 -1
  201. package/src/renderers/cloudflare/worker.ts +24 -2
  202. package/src/renderers/dom/host/box.tsx +204 -176
  203. package/src/renderers/dom/host/style.ts +49 -20
  204. package/src/renderers/dom/host/text.tsx +3 -2
  205. package/src/renderers/dom/styles.css +32 -0
  206. package/src/renderers/electrobun/bun/desktop/backend.ts +2 -0
  207. package/src/renderers/electrobun/bun/desktop/host-requests.ts +25 -1
  208. package/src/renderers/electrobun/bun/desktop/relaunch.ts +9 -1
  209. package/src/renderers/electrobun/bun/desktop/windows-script.ts +9 -6
  210. package/src/renderers/electrobun/bun/window/windows-native.ts +26 -1
  211. package/src/renderers/electrobun/shared/protocol.ts +6 -0
  212. package/src/renderers/electrobun/view/ui-host.tsx +7 -0
  213. package/src/renderers/electrobun/view/window-fullscreen.ts +10 -3
  214. package/src/shares/portable-layout.ts +99 -2
  215. package/src/sources/provider-router/index.ts +9 -3
  216. package/src/sources/provider-router/sources.ts +26 -1
  217. package/src/sync/core-contributors.ts +18 -4
  218. package/src/time-series/price-units.ts +11 -0
  219. package/src/time-series/resolve.ts +12 -0
  220. package/src/types/config.ts +17 -1
  221. package/src/types/plugin.ts +6 -0
  222. package/src/ui/host.tsx +2 -0
  223. package/src/utils/currency-names.ts +20 -0
  224. package/src/utils/currency-pair.ts +6 -0
  225. package/src/utils/exchange-rate-snapshot.ts +20 -2
  226. package/src/utils/fx-market-hours.ts +43 -0
@@ -1,3 +1,5 @@
1
+ import { WORD_CURRENCY_CODES } from "../../../utils/currency-names";
2
+
1
3
  /** The default board, in its default order. */
2
4
  export const MAJOR_CURRENCIES = ["USD", "EUR", "GBP", "JPY", "CHF", "CAD", "AUD", "NZD"] as const;
3
5
 
@@ -15,6 +17,19 @@ export const FX_CURRENCIES = [
15
17
  ] as const;
16
18
  export type FxCurrency = typeof FX_CURRENCIES[number];
17
19
 
20
+ /**
21
+ * The words a reader looks for the board by: the codes it carries (but those
22
+ * that are English words) and the names of its currencies, so `catalog yen`,
23
+ * `catalog chf` and `catalog "swiss franc"` find it. "cad" is a word too, yet
24
+ * in a market catalog it is the loonie far more often than not, so it still
25
+ * finds the board; only the fx line waits for CAD in capitals.
26
+ */
27
+ export const FX_CURRENCY_KEYWORDS: readonly string[] = [
28
+ ...FX_CURRENCIES.filter((code) => code === "CAD" || !WORD_CURRENCY_CODES.has(code)).map((code) => code.toLowerCase()),
29
+ "dollar", "euro", "yen", "pound", "sterling", "franc", "swiss franc", "loonie", "aussie", "kiwi", "yuan", "renminbi",
30
+ "krona", "krone", "won", "rupee", "rupiah", "ringgit", "baht", "peso", "rand", "lira", "zloty", "forint", "koruna", "shekel",
31
+ ];
32
+
18
33
  /** The flag each currency wears on the desktop and web; the euro is the EU's, not one member's. */
19
34
  export const CURRENCY_FLAG_REGIONS: Record<FxCurrency, string> = {
20
35
  USD: "US", EUR: "EU", GBP: "GB", JPY: "JP", CHF: "CH", CAD: "CA", AUD: "AU", NZD: "NZ",
@@ -9,6 +9,7 @@ import {
9
9
  import { quoteFreshnessFields } from "../shared/report-freshness";
10
10
  import { countOf, freePreviewNote } from "../shared/free-preview";
11
11
  import { getRegularSessionDisplay } from "../../../market-data/market/status";
12
+ import { logFailure } from "../../../utils/log-failure";
12
13
 
13
14
  const observationRow = (row: GpuObservation) => ({ gpu: gpuLabel(row), source: gpuSource(row), basis: gpuBasisLabel(row.basis),
14
15
  price: row.pricePerGpuHr, availability: row.availability, observedAt: row.observedAt, effectiveAt: row.effectiveAt, provenance: row.provenance ?? "live", provenanceLabel: gpuProvenanceLabel(row, true),
@@ -98,7 +99,7 @@ export const gpuHeadless: HeadlessPaneDefinition<"bundle"> = {
98
99
  const related = gpuEquityRows(rows, selected, !!board.access?.locked);
99
100
  const histories = await loadGpuEquityHistory(ctx.marketData);
100
101
  const equities = await Promise.all(related.map(async (row) => {
101
- const quote = await ctx.marketData.getQuote(row.symbol, row.exchange).catch(() => null);
102
+ const quote = await ctx.marketData.getQuote(row.symbol, row.exchange).catch(logFailure("gpu.headless", "Load GPU equity quote failed", null));
102
103
  const history = histories.find((entry) => entry.symbol === row.symbol);
103
104
  // The regular session's last and move, as the pane's board shows them.
104
105
  const headline = getRegularSessionDisplay(quote);
@@ -27,6 +27,7 @@ import { Box, Text, TextAttributes, useRendererHost } from "../../../ui";
27
27
  import { useDialog, useDialogKeyboard, type AlertContext } from "../../../ui/dialog";
28
28
  import { getSharedRegistry } from "../../registry";
29
29
  import type { HelpFunction } from "./function-index";
30
+ import { logFailure } from "../../../utils/log-failure";
30
31
 
31
32
  export type FunctionHelpRequest =
32
33
  /** `inAppDocs: false` where DOCS cannot open (a popped-out window). */
@@ -209,7 +210,7 @@ export function useFunctionHelpHost({ closeCommandBar }: { closeCommandBar: () =
209
210
  content: (context: AlertContext) => (
210
211
  <FunctionHelpCard {...context} fn={request.fn} width={width} compact={compact} inAppDocs={request.inAppDocs !== false} />
211
212
  ),
212
- }).catch(() => {}).finally(() => {
213
+ }).catch(logFailure("help.function-card", "Open function help card failed")).finally(() => {
213
214
  openRef.current = false;
214
215
  });
215
216
  };
@@ -19,6 +19,7 @@ import { KeybindingsEditor } from "./keybindings-editor";
19
19
  import { ShortcutTable, type ShortcutTableEntry } from "./shortcut-table";
20
20
  import { resolveCommandShortcuts, resolveWindowTemplates } from "./shortcut-model";
21
21
  import { badgeColumnWidth } from "./table-cells";
22
+ import { logFailure } from "../../../utils/log-failure";
22
23
 
23
24
  const HELP_TABS = [
24
25
  { label: "Basics", value: "basics" },
@@ -93,7 +94,7 @@ function HelpPane({ focused, width, height }: PaneProps) {
93
94
  .then((next) => {
94
95
  if (live) setPricing(next);
95
96
  })
96
- .catch(() => {});
97
+ .catch(logFailure("help", "Load Cloud pricing for help failed"));
97
98
  return () => {
98
99
  live = false;
99
100
  };
@@ -205,7 +206,7 @@ function HelpPane({ focused, width, height }: PaneProps) {
205
206
  ? [entry("cmd-open", commandBarBadges, "Open command mode for actions, pane commands, and typed prefixes.")]
206
207
  : []),
207
208
  ...(tickerSearchBadges.length > 0
208
- ? [entry("cmd-ticker-search", tickerSearchBadges, "Open ticker search directly.")]
209
+ ? [entry("cmd-ticker-search", tickerSearchBadges, "Ticker search: Enter changes the focused pane's ticker and the panes linked to it, as a click on the ticker in a pane's title does on the desktop and the web. Shift+Enter opens a new pane. From a pane with no ticker it opens DES.")]
209
210
  : []),
210
211
  entry("cmd-des", ["DES", "<ticker>"], "Open security details for a specific ticker."),
211
212
  entry("cmd-help-card", ["HELP", "<function>"], "Open a function's help card: what it shows, its keys, how fresh its data is. HELP HELP reaches support."),
@@ -46,16 +46,23 @@ function nameWord(word: string): string {
46
46
  return word.split(/([-'\u2019])/).map((part) => /^[-'\u2019]$/.test(part) ? part : capitalizeWord(part)).join("");
47
47
  }
48
48
 
49
- function formatPersonName(name: string): string {
50
- const words = name.replace(/,/g, " ").split(/\s+/).filter(Boolean);
49
+ /** A person's words split from the suffixes that follow the name ("JR", "III"). */
50
+ function splitPersonName(name: string): { words: string[]; suffixes: string[] } {
51
+ const parts = name.replace(/,/g, " ").split(/\s+/).filter(Boolean);
51
52
  const suffixes: string[] = [];
52
- const rest: string[] = [];
53
- words.forEach((word, index) => {
53
+ const words: string[] = [];
54
+ parts.forEach((word, index) => {
54
55
  const suffix = index > 0 ? PERSON_SUFFIXES[word.replace(/\./g, "").toUpperCase()] : undefined;
55
56
  if (suffix) suffixes.push(suffix);
56
- else rest.push(word);
57
+ else words.push(word);
57
58
  });
58
- if (rest.length < 2) return [...rest.map(nameWord), ...suffixes].join(" ");
59
+ return { words, suffixes };
60
+ }
61
+
62
+ /** `filing` reads "LAST FIRST MIDDLE", as an SEC filing conforms an owner; `natural` is already first-name-first. */
63
+ function formatPersonName(name: string, order: "filing" | "natural" = "filing"): string {
64
+ const { words: rest, suffixes } = splitPersonName(name);
65
+ if (order === "natural" || rest.length < 2) return [...rest.map(nameWord), ...suffixes].join(" ");
59
66
  // SEC filings conform the reporting owner to "LAST FIRST MIDDLE".
60
67
  let surnameLength = 1;
61
68
  while (surnameLength < rest.length - 1 && SURNAME_PARTICLES.has(rest[surnameLength - 1]!.toLocaleLowerCase())) surnameLength += 1;
@@ -78,6 +85,38 @@ export function formatInsiderName(name: string): string {
78
85
  .join("; ");
79
86
  }
80
87
 
88
+ /** A name's words without initials, suffixes or case, in a fixed order: two spellings of one person share it. */
89
+ function nameKey(name: string): string {
90
+ return splitPersonName(name).words
91
+ .map((word) => word.replace(/[.,]+$/, "").toLocaleLowerCase())
92
+ .filter((word) => word.length > 1)
93
+ .sort()
94
+ .join(" ");
95
+ }
96
+
97
+ /**
98
+ * A name typed freely on a form, such as the seller on a Form 144, which is
99
+ * as often "KEVAN PAREKH" as it is "COOK TIMOTHY D". A person already known
100
+ * from an insider form (`knownNames`, as those forms file them) is written as
101
+ * the Insider table writes them; a comma after the first word, or a trailing
102
+ * initial, marks filing order; any other name is taken as first-name-first
103
+ * and only has its case fixed.
104
+ */
105
+ export function formatFreeformPersonName(name: string, knownNames: readonly string[] = []): string {
106
+ return name.split(";").map((part) => part.trim()).filter(Boolean)
107
+ .map((part) => {
108
+ if (isEntityName(part)) return part;
109
+ const key = nameKey(part);
110
+ const known = key ? knownNames.find((candidate) => nameKey(candidate) === key) : undefined;
111
+ if (known) return formatInsiderName(known);
112
+ const { words } = splitPersonName(part);
113
+ // "Cook, Timothy" and "COOK TIMOTHY D" put the surname first.
114
+ const surnameFirst = /^[^\s,]+,/.test(part) || (words.length > 1 && isInitial(words[words.length - 1]!));
115
+ return formatPersonName(part, surnameFirst ? "filing" : "natural");
116
+ })
117
+ .join("; ");
118
+ }
119
+
81
120
  interface RoleRank {
82
121
  label: string;
83
122
  rank: number;
@@ -55,6 +55,7 @@ function venueToday(timeZone: string, now = new Date()): string {
55
55
  try {
56
56
  format = new Intl.DateTimeFormat("en-US", { timeZone, year: "numeric", month: "2-digit", day: "2-digit" });
57
57
  } catch {
58
+ // Intentional ignore: a zone this runtime does not know reads the board at the local date.
58
59
  format = null;
59
60
  }
60
61
  venueDays.set(timeZone, format);
@@ -145,6 +146,7 @@ function countryName(code: string): string {
145
146
  regionNames ??= new Intl.DisplayNames(["en"], { type: "region" });
146
147
  name = regionNames.of(code) ?? "";
147
148
  } catch {
149
+ // Intentional ignore: a region the runtime cannot name leaves the search without a country name.
148
150
  name = "";
149
151
  }
150
152
  countryNames.set(code, name);
@@ -7,6 +7,7 @@ import type { DataProvider } from "../../../types/data-provider";
7
7
  import type { PricePoint } from "../../../types/financials";
8
8
  import { realizedVolatilityCadenceIssue, rollingRealizedVolatility } from "../shared/volatility";
9
9
  import { NO_FATE, type ListingFate } from "../../../tickers/listing-fate";
10
+ import { logFailure } from "../../../utils/log-failure";
10
11
 
11
12
  export type IvMethod = "quote-mid" | "trade-close";
12
13
  /**
@@ -244,7 +245,7 @@ async function loadRealizedVolatilities(
244
245
  try {
245
246
  const entry = await dependencies.loadChart({ instrument, bufferRange: "1Y", granularity: "resolution", resolution: "1d" });
246
247
  value = screenHv(resolveEntryValue(entry) ?? [], window);
247
- } catch { value = null; }
248
+ } catch (error) { value = logFailure("iv-history.client", "Load screen price history failed", null)(error); }
248
249
  result.set(instrument.symbol, value);
249
250
  options.onValue?.(instrument.symbol, value);
250
251
  }
@@ -17,6 +17,7 @@ import { zonedDateKey } from "../../../utils/zoned-date-time";
17
17
  import { listingFateNotes, listingFateReport, loadListingFate, MovedSymbolError } from "../../../tickers/listing-fate";
18
18
  import { startTickerChangeLookup } from "../../../tickers/ticker-changes";
19
19
  import { fxVolatilityRefusal } from "../../../market-data/options-alternatives";
20
+ import { logFailure } from "../../../utils/log-failure";
20
21
 
21
22
  const METHODOLOGY = "docs/research-data.md#implied-volatility-history";
22
23
  const percent = (value: unknown) => typeof value === "number" ? formatVol(value) : "--";
@@ -50,7 +51,7 @@ export const ivHistoryHeadless: HeadlessPaneDefinition<"bundle"> = {
50
51
  // What became of the symbol, as `quote` reads it, looked up beside the figures: FB's are the fund listed
51
52
  // there now, TWTR stopped trading, and HFC, which became DINO, has none of its own.
52
53
  const changes = startTickerChangeLookup(ctx.marketData, instrument.symbol, instrument.exchange);
53
- const quote = ctx.marketData.getQuote(instrument.symbol, instrument.exchange ?? "").catch(() => null);
54
+ const quote = ctx.marketData.getQuote(instrument.symbol, instrument.exchange ?? "").catch(logFailure("iv-history.headless", "Load IV history quote failed", null));
54
55
  const [payload, prices, releases] = await Promise.all([
55
56
  loadIvHistory(instrument.symbol, { signal: ctx.signal }, ctx.apiClient),
56
57
  loadRealizedVolatilityHistory({ instrument, signal: ctx.signal }, createRealizedVolatilityDependencies(ctx.marketData)),
@@ -1,4 +1,5 @@
1
1
  import { useCallback, useRef, useState } from "react";
2
+ import { logFailure } from "../../../utils/log-failure";
2
3
 
3
4
  /**
4
5
  * Pages appended past what the first response carried. Keyed on the first
@@ -35,10 +36,9 @@ export function useAppendedPages<T>(
35
36
  return { key, items: [...base, ...items], nextOffset: offset + items.length, exhausted: items.length === 0 };
36
37
  });
37
38
  })
38
- .catch(() => {
39
- // The rows already loaded stay; only the next page failed, and a
40
- // later scroll asks again.
41
- })
39
+ // The rows already loaded stay; only the next page failed, and a
40
+ // later scroll asks again.
41
+ .catch(logFailure("jobs.pages", "Load more job postings failed"))
42
42
  .finally(() => {
43
43
  if (inFlight.current === key) inFlight.current = null;
44
44
  setLoadingMore(false);
@@ -16,6 +16,7 @@ import {
16
16
  type KellyHistoryInputs,
17
17
  } from "./history";
18
18
  import { formatPct, formatSignedPct } from "./view";
19
+ import { logFailure } from "../../../utils/log-failure";
19
20
 
20
21
  /** The fractions of full Kelly a report sizes, largest first. */
21
22
  const KELLY_FRACTIONS = [
@@ -77,7 +78,7 @@ export const kellyHeadless: HeadlessPaneDefinition<"bundle"> = {
77
78
  // coordinator every chart reads daily closes from (the History tab's request, cache included).
78
79
  const [entry, quote] = await Promise.all([
79
80
  new MarketDataCoordinator(ctx.marketData).loadChart(kellyHistoryRequest({ symbol, exchange }, years), { forceRefresh: ctx.refresh }),
80
- ctx.marketData.getQuote(symbol, exchange, ctx.refresh ? { cacheMode: "refresh" } : undefined).catch(() => null),
81
+ ctx.marketData.getQuote(symbol, exchange, ctx.refresh ? { cacheMode: "refresh" } : undefined).catch(logFailure("kelly-sizer.headless", "Load Kelly sizing quote failed", null)),
81
82
  ]);
82
83
  const history = clipPriceHistoryToRange(resolveEntryValue(entry) ?? [], range);
83
84
  ctx.signal.throwIfAborted();
@@ -101,6 +101,7 @@ import {
101
101
  overlayScreenerQuoteEntries,
102
102
  resolveScreenerQuoteFeedStatus,
103
103
  } from "../../../market-data/quotes/screener-live-quotes";
104
+ import { logFailure } from "../../../utils/log-failure";
104
105
 
105
106
  const NO_ASSETS: HeatmapBoardAsset[] = [];
106
107
  const NO_TARGETS: QuoteSubscriptionTarget[] = [];
@@ -144,7 +145,7 @@ function loadCollectionSnapshots(
144
145
  const instrument = instrumentFromTicker(ticker, ticker.metadata.ticker, instrumentOptions);
145
146
  return instrument ? [instrument] : [];
146
147
  });
147
- if (instruments.length > 0) void coordinator.loadSnapshotsBatch(instruments, { forceRefresh }).catch(() => {});
148
+ if (instruments.length > 0) void coordinator.loadSnapshotsBatch(instruments, { forceRefresh }).catch(logFailure("market-heatmap", "Load heatmap collection snapshots failed"));
148
149
  }
149
150
 
150
151
  function formatMoneyCompact(value: number | null | undefined, currency: string): string {
@@ -39,7 +39,7 @@ async function fetchPayload<T>(fetcher: () => Promise<T>, validate: (data: T) =>
39
39
  async function fetchFundPayload<T>(fund: string, fetcher: () => Promise<T>, validate: (data: T) => T, client: Client, unavailable = UNAVAILABLE) {
40
40
  try { return validate(await fetcher()); } catch (error) {
41
41
  if (error instanceof ApiRequestError && error.status === 404) {
42
- const funds = await fetchFunds(client).then((payload) => payload.funds, () => []);
42
+ const funds = await fetchFunds(client).then((payload) => payload.funds, () => { /* Intentional ignore: an unreadable covered list leaves the server's own message. */ return []; });
43
43
  if (funds.length && !coveredFund(funds, fund)) throw new Error(notCoveredMessage(fund, funds));
44
44
  }
45
45
  throw unavailableOnServer(error, unavailable);
@@ -48,6 +48,7 @@ const isWebUrl = (value: unknown): value is string => {
48
48
  const url = new URL(value);
49
49
  return url.protocol === "https:" || url.protocol === "http:";
50
50
  } catch {
51
+ // Intentional ignore: malformed URLs fail this web link field validator.
51
52
  return false;
52
53
  }
53
54
  };
@@ -53,6 +53,7 @@ import {
53
53
  stageLabel,
54
54
  termsLabel,
55
55
  } from "./model";
56
+ import { logFailure } from "../../../utils/log-failure";
56
57
 
57
58
  const STATUS_OPTIONS: { value: MnaStatusFilter; label: string }[] = [
58
59
  { value: "pending", label: "Pending" },
@@ -238,7 +239,9 @@ function MnaDealsView({ focused, width, height, symbol }: {
238
239
  .then((page) => {
239
240
  if (pageRequest.current === request) setPaged({ owner: first, payload: appendMnaDeals(data, page) });
240
241
  })
241
- .catch(() => {})
242
+ .catch((error) => {
243
+ if (!request.signal.aborted) logFailure("mna.pane", "Load more M&A deals failed")(error);
244
+ })
242
245
  .finally(() => {
243
246
  if (pageRequest.current === request) setLoadingMore(false);
244
247
  });
@@ -25,7 +25,7 @@ export function optionMarketReference(value: unknown): OptionMarketReference | u
25
25
 
26
26
  export function parseOptionMarketReference(value: string | undefined): OptionMarketReference | undefined {
27
27
  if (!value) return undefined;
28
- try { return optionMarketReference(JSON.parse(value)); } catch { return undefined; }
28
+ try { return optionMarketReference(JSON.parse(value)); } catch { /* Intentional ignore: a market reference that does not parse opens the contract without one. */ return undefined; }
29
29
  }
30
30
 
31
31
  function timestamp(milliseconds: number | undefined): string | null {
@@ -1,6 +1,7 @@
1
1
  import type { OptionsChain } from "../../../types/financials";
2
2
  import { formatCalendarDay } from "./model-spot";
3
3
  import { loadOpenInterest, type OpenInterestPayload, type OptionsPositioningApi } from "../options-positioning/client";
4
+ import { logFailure } from "../../../utils/log-failure";
4
5
 
5
6
  /**
6
7
  * The session a chain's open interest is counted at
@@ -63,7 +64,8 @@ export async function loadListedOpenInterest(
63
64
  try {
64
65
  const listed = await loadOpenInterest(symbol, expiry, { signal: options.signal ?? AbortSignal.timeout(LISTED_TIMEOUT_MS) }, options.api);
65
66
  return listed.expiry === expiry ? listed : null;
66
- } catch {
67
+ } catch (error) {
68
+ logFailure("options.open-interest-as-of", "Load listed open interest failed")(error);
67
69
  return null;
68
70
  }
69
71
  }
@@ -97,6 +97,7 @@ import {
97
97
  strikeWindowShortLabel,
98
98
  strikeWindowValue,
99
99
  } from "./strike-window";
100
+ import { logFailure } from "../../../utils/log-failure";
100
101
 
101
102
  /** The summary strip and analytics recompute from live quotes at most this often. */
102
103
  const OPTIONS_SUMMARY_THROTTLE_MS = 1_000;
@@ -675,7 +676,7 @@ export function OptionsView({ width, height, focused, nestedInTabs = false, ivRa
675
676
  void dialog.alert({
676
677
  closeOnClickOutside: true,
677
678
  content: (ctx: AlertContext) => <AnalyticsAsOfDialog {...ctx} rows={rows} />,
678
- }).catch(() => {});
679
+ }).catch(logFailure("options.view", "Open analytics as-of dialog failed"));
679
680
  }, [dialog, enrichment]);
680
681
  usePaneFooter("options-enrichment", () => ({ info: [
681
682
  ...(enrichmentState.loading ? [{ id: "enrichment-loading", parts: [{ text: "loading analytics", tone: "muted" as const }] }] : []),
@@ -153,7 +153,7 @@ export function readCalculatorEvidence(value: unknown): CalculatorEvidence | nul
153
153
  expected = valueOption(draft);
154
154
  implied = solveImpliedVolatility(draft, draft.marketPrice);
155
155
  }
156
- } catch { return null; }
156
+ } catch { /* Intentional ignore: inputs the valuation rejects cannot prove the captured values, so the evidence is rejected. */ return null; }
157
157
  if (!validValuation(expected) || metrics.some((key) => !sameNumber(evidence.valuation![key], expected[key]))
158
158
  || evidence.implied.note !== implied.note || (implied.volatility === null ? evidence.implied.volatility !== null
159
159
  : evidence.implied.volatility === null || !sameNumber(evidence.implied.volatility, implied.volatility))
@@ -135,7 +135,7 @@ export function CspScreenPane({ width, height, focused }: PaneProps) {
135
135
  const { createPaneFromTemplate } = usePluginAppActions();
136
136
  const assetData = useAssetData();
137
137
  const strategy = useMemo((): StrategyFamily => {
138
- try { return readStrategyFamily(strategySetting); } catch { return "csp"; }
138
+ try { return readStrategyFamily(strategySetting); } catch { /* Intentional ignore: an unknown saved strategy opens the cash-secured put screen. */ return "csp"; }
139
139
  }, [strategySetting]);
140
140
  const family = strategyFamilyDef(strategy);
141
141
  // Each strategy opens at its own deltas; the names and the expiry carry over.
@@ -9,7 +9,7 @@ import { zonedDateKey } from "../../../utils/zoned-date-time";
9
9
  import { ivRankReason, loadIvScreen, type ImpliedVolatilityApi, type IvScreenRow } from "../iv-history/client";
10
10
  import { quoteObservation } from "../shared/report-freshness";
11
11
  import { loadScenarioMarket, scenarioPositionFromSettings, scenarioSpotBasis, type ScenarioLoaderDependencies, type ScenarioMarketSnapshot } from "./client";
12
- import { cashSecuredPut, loadNextEarningsDates, type CashSecuredPut } from "./csp";
12
+ import { cashSecuredPut, EARNINGS_CALENDAR_UNAVAILABLE, loadNextEarningsDates, type CashSecuredPut } from "./csp";
13
13
  import { seededLegQuotes } from "./hedge";
14
14
  import { scenarioValue } from "./model";
15
15
 
@@ -252,7 +252,7 @@ export async function screenNames<T>(
252
252
  const rank = ivRow?.iv30?.rank;
253
253
  const ivRank = rank != null && Number.isFinite(rank) ? rank : null;
254
254
  try {
255
- const screened = await screen(instrument, earnings.get(symbol) ?? null, scenario);
255
+ const screened = await screen(instrument, earnings === EARNINGS_CALENDAR_UNAVAILABLE ? earnings : earnings.get(symbol) ?? null, scenario);
256
256
  markets.push(screened.market);
257
257
  if (ivRank == null && !ivRanks.error) {
258
258
  const reason = ivRankReason(ivRow);
@@ -289,10 +289,14 @@ export function cspScreenCriteriaText(criteria: CspScreenCriteria, now: number):
289
289
  + (criteria.expiration == null ? ` (${criteria.days} days)` : "");
290
290
  }
291
291
 
292
- /** `before 2026-11-04`, `after 2027-01-19`, `unknown`: whether the next report falls before the put (or a trade's first leg) expires, and its date. */
292
+ /**
293
+ * `before 2026-11-04`, `after 2027-01-19`, `unknown`: whether the next report falls before the put (or a trade's first leg)
294
+ * expires, and its date; `unavailable` when the earnings calendar could not be read.
295
+ */
293
296
  export function cspEarningsText(csp: Pick<CashSecuredPut, "earnings"> | null): string {
294
297
  if (!csp) return "--";
295
- const { beforeExpiry, date } = csp.earnings;
298
+ const { beforeExpiry, date, unavailable } = csp.earnings;
299
+ if (unavailable) return "unavailable";
296
300
  return beforeExpiry == null ? "unknown" : `${beforeExpiry ? "before" : "after"} ${date}`;
297
301
  }
298
302
 
@@ -7,6 +7,7 @@ import { newYorkDay, resolveListingEvents, upcomingReportDate } from "../shared/
7
7
  import { parsePublicTickerKey } from "../../../utils/exchanges";
8
8
  import { formatHedgePrice } from "./hedge";
9
9
  import { amountUnit, exportPercent, UNKNOWN_CURRENCY, type ScenarioPosition } from "./model";
10
+ import { logFailure } from "../../../utils/log-failure";
10
11
 
11
12
  /**
12
13
  * A cash-secured put (docs/research-data.md#cash-secured-put): one short put
@@ -25,7 +26,7 @@ import { amountUnit, exportPercent, UNKNOWN_CURRENCY, type ScenarioPosition } fr
25
26
  * - break-even = strike - entry price
26
27
  * - days to expiry = calendar days from the valuation date in New York to the expiry date
27
28
  * - earnings before expiry: yes when the next report is on or before the expiry date,
28
- * no when it is after, unknown when the calendar has no upcoming date
29
+ * no when it is after, unknown when the calendar has no upcoming date or could not be read
29
30
  */
30
31
  export interface CashSecuredPut {
31
32
  currency: string;
@@ -77,8 +78,17 @@ export interface CspEarnings {
77
78
  date: string | null;
78
79
  /** Null is unknown: no upcoming date to compare. */
79
80
  beforeExpiry: boolean | null;
81
+ /** The earnings calendar could not be read, so there may be a date it did not give. */
82
+ unavailable?: true;
80
83
  }
81
84
 
85
+ /**
86
+ * What `loadNextEarningsDate` answers when the earnings calendar could not be
87
+ * read, in place of a date. Unlike null (no date published) it is reported as
88
+ * unavailable. A string, so a capture can keep it in the pane's settings.
89
+ */
90
+ export const EARNINGS_CALENDAR_UNAVAILABLE = "calendar-unavailable";
91
+
82
92
  const DAY_MS = 86_400_000;
83
93
  const newYorkDate = new Intl.DateTimeFormat("en-CA", { timeZone: "America/New_York", year: "numeric", month: "2-digit", day: "2-digit" });
84
94
 
@@ -94,8 +104,9 @@ export function calendarDaysToExpiry(asOf: number, expiry: string): { valuationD
94
104
  daysToExpiry: Math.max(0, Math.round((Date.parse(`${expiry}T00:00:00Z`) - Date.parse(`${valuationDate}T00:00:00Z`)) / DAY_MS)) };
95
105
  }
96
106
 
97
- /** Whether the next report falls before the put expires; unknown without an upcoming date. */
107
+ /** Whether the next report falls before the put expires; unknown without an upcoming date or a calendar to read one from. */
98
108
  export function earningsBeforeExpiry(earningsDate: string | null | undefined, valuationDate: string, expiry: string): CspEarnings {
109
+ if (earningsDate === EARNINGS_CALENDAR_UNAVAILABLE) return { date: null, beforeExpiry: null, unavailable: true };
99
110
  if (!earningsDate || !/^\d{4}-\d{2}-\d{2}$/.test(earningsDate) || earningsDate < valuationDate) return { date: null, beforeExpiry: null };
100
111
  return { date: earningsDate, beforeExpiry: earningsDate <= expiry };
101
112
  }
@@ -146,19 +157,25 @@ export function cashSecuredPut(
146
157
  /**
147
158
  * The next report date, YYYY-MM-DD, as every earnings surface resolves it
148
159
  * (shared/earnings-calendar): the calendar's, or once that date has passed
149
- * the next one on record; null when there is none or the calendar cannot be
150
- * read.
160
+ * the next one on record; null when there is none, and
161
+ * EARNINGS_CALENDAR_UNAVAILABLE when the calendar cannot be read.
151
162
  */
152
163
  export async function loadNextEarningsDate(provider: DataProvider | null | undefined, symbol: string, today = newYorkDay()): Promise<string | null> {
153
- return (await loadNextEarningsDates(provider, [symbol], today)).get(symbol.trim().toUpperCase()) ?? null;
164
+ const dates = await loadNextEarningsDates(provider, [symbol], today);
165
+ return dates === EARNINGS_CALENDAR_UNAVAILABLE ? dates : dates.get(symbol.trim().toUpperCase()) ?? null;
154
166
  }
155
167
 
156
- /** The next report date of each symbol, by its upper-case symbol, from one calendar request; a symbol with none is left out. */
168
+ /**
169
+ * The next report date of each symbol, by its upper-case symbol, from one
170
+ * calendar request; a symbol with none is left out. EARNINGS_CALENDAR_UNAVAILABLE
171
+ * when the calendar cannot be read.
172
+ */
157
173
  export async function loadNextEarningsDates(
158
174
  provider: DataProvider | null | undefined, symbols: readonly string[], today = newYorkDay(),
159
- ): Promise<Map<string, string>> {
175
+ ): Promise<Map<string, string> | typeof EARNINGS_CALENDAR_UNAVAILABLE> {
160
176
  const keys = [...new Set(symbols.map((symbol) => symbol.trim().toUpperCase()))];
161
- const result = await loadEarningsCalendar(provider, keys).catch(() => null);
177
+ const result = await loadEarningsCalendar(provider, keys).catch(logFailure("options-scenario.csp", "Load earnings calendar for cash-secured puts failed", null));
178
+ if (provider && !result) return EARNINGS_CALENDAR_UNAVAILABLE;
162
179
  if (!provider || !result?.events.length) return new Map();
163
180
  const listings = keys.map((key) => {
164
181
  const listing = parsePublicTickerKey(key);
@@ -184,6 +201,7 @@ function otmText(csp: CashSecuredPut): string {
184
201
  }
185
202
 
186
203
  function earningsText(earnings: CspEarnings): string {
204
+ if (earnings.unavailable) return "unknown (earnings calendar unavailable)";
187
205
  if (earnings.beforeExpiry == null) return "unknown (no upcoming date published)";
188
206
  return `${earnings.beforeExpiry ? "yes" : "no"} (next report ${earnings.date})`;
189
207
  }
@@ -249,6 +267,7 @@ export function cspStatItems(csp: CashSecuredPut): StatItem[] {
249
267
  { id: "csp-break-even", label: "Break-even", value: formatHedgePrice(csp.breakEven), detail: "per share" },
250
268
  { id: "csp-days", label: "DTE", value: String(csp.daysToExpiry), detail: csp.expiry },
251
269
  { id: "csp-earnings", label: "Earnings", value: earnings.beforeExpiry == null ? "unknown" : earnings.beforeExpiry ? "before expiry" : "after expiry",
252
- detail: earnings.date ?? "no date", tone: earnings.beforeExpiry ? "warning" : undefined },
270
+ detail: earnings.unavailable ? "calendar unavailable" : earnings.date ?? "no date",
271
+ tone: earnings.beforeExpiry || earnings.unavailable ? "warning" : undefined },
253
272
  ];
254
273
  }
@@ -3,6 +3,7 @@ import { useRemoteUiNode } from "../../../remote/semantic-tree";
3
3
  import type { TickerFinancials } from "../../../types/financials";
4
4
  import { parsePublicTickerKey } from "../../../utils/exchanges";
5
5
  import { buildScenario, type ScenarioControls, type ScenarioModel, type ScenarioPosition } from "./model";
6
+ import { EARNINGS_CALENDAR_UNAVAILABLE } from "./csp";
6
7
  import { isRecord, isStringArray } from "../../../utils/guards";
7
8
 
8
9
  export interface ScenarioEvidenceInput {
@@ -56,7 +57,7 @@ export function readScenarioEvidence(value: unknown): ScenarioEvidence | null {
56
57
  || !isRecord(value.scenario) || !isStringArray(value.scenario.warnings)) return null;
57
58
  const scenario = value.scenario as unknown as ScenarioModel;
58
59
  let expected: ScenarioModel;
59
- try { expected = buildScenario(scenario.position, scenario.controls); } catch { return null; }
60
+ try { expected = buildScenario(scenario.position, scenario.controls); } catch { /* Intentional ignore: a scenario that cannot be repriced is rejected as evidence by returning null. */ return null; }
60
61
  if (value.symbol !== expected.position.symbol) return null;
61
62
  // A clamped requested date can add a warning to the original model. Its
62
63
  // normalized controls reproduce the values, while retaining that warning.
@@ -83,7 +84,7 @@ export const scenarioScreenshotEvidence: PaneScreenshotEvidenceHook<ScenarioEvid
83
84
  controls?: ScenarioControls | null;
84
85
  market?: unknown;
85
86
  inputSource?: string;
86
- csp?: { earnings: { date: string | null } };
87
+ csp?: { earnings: { date: string | null; unavailable?: true } };
87
88
  } | undefined;
88
89
  const position = metadata?.position;
89
90
  const controls = metadata?.controls;
@@ -97,8 +98,8 @@ export const scenarioScreenshotEvidence: PaneScreenshotEvidenceHook<ScenarioEvid
97
98
  scenarioSnapshot: metadata?.scenario ?? null,
98
99
  scenarioMarketSnapshot: metadata?.market ?? null,
99
100
  scenarioSnapshotErrors: loaded.result.errors ?? [],
100
- // A cash-secured put shows the earnings date the report read, not another lookup's.
101
- ...(metadata?.csp ? { scenarioEarningsDate: metadata.csp.earnings.date } : {}),
101
+ // A cash-secured put shows the earnings date the report read, or that it could not read one, not another lookup's.
102
+ ...(metadata?.csp ? { scenarioEarningsDate: metadata.csp.earnings.unavailable ? EARNINGS_CALENDAR_UNAVAILABLE : metadata.csp.earnings.date } : {}),
102
103
  ...(position ? { seedPosition: position } : {}),
103
104
  ...(controls ? { date: new Date(controls.date).toISOString(), volShift: controls.volShift * 100,
104
105
  spotRange: controls.spotRange * 100 } : {}),
@@ -41,6 +41,7 @@ import { useScenarioEvidence } from "./evidence";
41
41
  import { hedgeStatItems, scenarioHedgeBudget, seededLegQuotes, type HedgeQuote } from "./hedge";
42
42
  import { isLiveOptionExpiry, readOptionExpiration } from "../../../utils/option-expiry";
43
43
  import { parsePublicTickerKey } from "../../../utils/exchanges";
44
+ import { logFailure } from "../../../utils/log-failure";
44
45
 
45
46
  const EMPTY_ERRORS: string[] = [];
46
47
  const TABS = [{ value: "payoff", label: "Payoff" }, { value: "grid", label: "P&L grid" }, { value: "legs", label: "Legs" }];
@@ -225,7 +226,7 @@ export function OptionsScenarioPane({ width, height, focused }: PaneProps) {
225
226
  const choices = saved.filter((entry) => entry.position.symbol === underlying && (!exchange || entry.position.exchange === exchange));
226
227
  if (!choices.length) { notify({ body: "No saved strategies for this ticker." }); return; }
227
228
  const id = await dialog.prompt<string>({ content: (ctx: PromptContext<string>) => <ChoiceDialog {...ctx} title="Load strategy"
228
- choices={choices.map((entry) => ({ id: entry.id, label: entry.name, detail: dateLabel(entry.position.asOf) }))} /> }).catch(() => "");
229
+ choices={choices.map((entry) => ({ id: entry.id, label: entry.name, detail: dateLabel(entry.position.asOf) }))} /> }).catch(logFailure("options-scenario.pane", "Open saved strategy choices failed", ""));
229
230
  const selected = choices.find((entry) => entry.id === id);
230
231
  // A saved strategy opens at its saved spot, date and vols; following the market is an explicit choice.
231
232
  if (selected) { setPosition(selected.position); setControls(selected.controls); setFollow(false); setLocalError(null); }
@@ -261,7 +261,7 @@ export async function nearestPerpMarkets(input: string, client: Pick<typeof apiC
261
261
  const rows = (await client.getCloudPerpsBoard({ search: text })).rows.filter((row) => !row.delisted
262
262
  && `${row.symbol} ${row.baseAsset} ${row.displayName}`.toUpperCase().includes(text));
263
263
  if (rows.length) return rows;
264
- } catch { return []; }
264
+ } catch { /* Intentional ignore: a board that cannot be read suggests nothing, so the caller keeps its own examples. */ return []; }
265
265
  }
266
266
  return [];
267
267
  }));
@@ -47,9 +47,10 @@ function requireWatchlistArgs(
47
47
  // A pasted list in the place of the name is a list, not a watchlist that is missing.
48
48
  const pasted = misplacedSymbolList(args, file, { noun: "watchlist", verb, collections: config.watchlists, usage });
49
49
  if (pasted) ctx.fail(pasted.message, pasted.details);
50
+ // The watchlist goes first: `watchlist add USDJPY=X USDCHF=X` read USDJPY=X as its name, so the form is said too.
50
51
  ctx.fail(
51
52
  `Watchlist "${args[0]}" was not found.`,
52
- config.watchlists.length > 0 ? `Watchlists: ${config.watchlists.map((entry) => entry.name).join(", ")}` : undefined,
53
+ [config.watchlists.length > 0 ? `Watchlists: ${config.watchlists.map((entry) => entry.name).join(", ")}` : "", usage].filter(Boolean).join("\n"),
53
54
  );
54
55
  }
55
56
  return { watchlist: match.collection, rest: match.rest };