gloomberb 0.19.4 → 0.19.6

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 (321) hide show
  1. package/package.json +3 -1
  2. package/patches/@opentui%2Fcore@0.3.2.patch +86 -25
  3. package/src/api-client/equity-screener.ts +23 -0
  4. package/src/app/pane-runtime/index.tsx +2 -0
  5. package/src/app/pane-runtime/plugin-bindings.ts +10 -1
  6. package/src/app.tsx +63 -16
  7. package/src/cli/commands/command-utils.ts +4 -0
  8. package/src/cli/commands/market.ts +264 -33
  9. package/src/cli/commands/search.ts +22 -4
  10. package/src/cli/commands/ticker.ts +84 -39
  11. package/src/cli/currency-name-hint.ts +60 -0
  12. package/src/cli/glossary.ts +3 -3
  13. package/src/cli/history-rows.ts +18 -1
  14. package/src/cli/known-gaps.ts +25 -2
  15. package/src/cli/listing-arg.ts +12 -0
  16. package/src/cli/not-a-ticker.ts +5 -3
  17. package/src/cli/pane-functions/capabilities.ts +2 -0
  18. package/src/cli/pane-functions/catalog.ts +31 -5
  19. package/src/cli/pane-functions/function-help.ts +8 -5
  20. package/src/cli/pane-functions/headless.ts +11 -6
  21. package/src/cli/pane-functions/market-session.ts +6 -7
  22. package/src/cli/pane-functions/resolver.ts +75 -2
  23. package/src/cli/quote-answer.ts +9 -0
  24. package/src/cli/series-search.ts +4 -5
  25. package/src/cli/symbol-list.ts +54 -2
  26. package/src/cli/symbol-rows.ts +14 -2
  27. package/src/cli/ticker-resolution.ts +89 -20
  28. package/src/components/chart/composite/axis-overlays.tsx +60 -27
  29. package/src/components/chart/composite/composite-chart.tsx +118 -63
  30. package/src/components/chart/composite/cursor-source.ts +111 -0
  31. package/src/components/chart/composite/format.ts +168 -6
  32. package/src/components/chart/composite/legend.tsx +8 -4
  33. package/src/components/chart/composite/panel-bitmap.ts +28 -2
  34. package/src/components/chart/composite/panel-labels.ts +20 -1
  35. package/src/components/chart/composite/panel-surface.tsx +201 -92
  36. package/src/components/chart/composite/price-axis-labels.tsx +92 -46
  37. package/src/components/chart/composite/price-series.ts +31 -8
  38. package/src/components/chart/composite/scene.ts +154 -59
  39. package/src/components/chart/composite/series-axis-tags.tsx +4 -2
  40. package/src/components/chart/composite/time-axis.ts +30 -7
  41. package/src/components/chart/composite/time-scale.ts +211 -56
  42. package/src/components/chart/composite/types.ts +11 -1
  43. package/src/components/chart/composite/use-composite-chart-keyboard.ts +32 -12
  44. package/src/components/chart/curve/curve-surface.tsx +5 -2
  45. package/src/components/chart/curve/model.ts +4 -1
  46. package/src/components/chart/native/use-bitmap-metrics.ts +81 -0
  47. package/src/components/chart/static/series.ts +3 -0
  48. package/src/components/command-bar/commands/collection-list.ts +81 -0
  49. package/src/components/command-bar/commands/direct/index.ts +6 -0
  50. package/src/components/command-bar/commands/registry.ts +8 -0
  51. package/src/components/command-bar/layout-items/current-layout.ts +22 -1
  52. package/src/components/command-bar/layout-items/focused-pane.ts +22 -1
  53. package/src/components/command-bar/pane-templates/items.ts +19 -3
  54. package/src/components/command-bar/pane-templates/workflow.ts +5 -0
  55. package/src/components/command-bar/routes/root/results.ts +23 -3
  56. package/src/components/command-bar/routes/root/selection.ts +4 -2
  57. package/src/components/command-bar/routes/root/shortcut-feedback.ts +1 -1
  58. package/src/components/command-bar/routes/root/shortcut-items.ts +3 -4
  59. package/src/components/command-bar/routes/root/shortcuts.ts +58 -14
  60. package/src/components/command-bar/routes/root/ticker-first.ts +32 -0
  61. package/src/components/command-bar/surface/environment.ts +2 -0
  62. package/src/components/command-bar/view-model.ts +7 -0
  63. package/src/components/command-bar/workflow/ops.ts +2 -1
  64. package/src/components/command-bar/workflow/tickers.ts +20 -0
  65. package/src/components/layout/shell/active-drag.ts +38 -7
  66. package/src/components/layout/shell/drag/magnets.ts +106 -0
  67. package/src/components/layout/shell/menu.ts +15 -1
  68. package/src/components/layout/shell/pane/actions.ts +4 -0
  69. package/src/components/layout/shell/ticker-link-menu.ts +12 -3
  70. package/src/components/layout/status-bar.tsx +20 -0
  71. package/src/components/layout/window-controls.tsx +96 -35
  72. package/src/components/layout/window-fullscreen.ts +20 -0
  73. package/src/components/onboarding/onboarding-keyboard.ts +5 -1
  74. package/src/components/onboarding/onboarding-wizard.tsx +15 -4
  75. package/src/components/onboarding/portfolio-step/positions-panel.tsx +8 -5
  76. package/src/components/onboarding/use-onboarding-progress.ts +20 -1
  77. package/src/components/price-sparkline/view.tsx +14 -6
  78. package/src/components/quote-flash.ts +36 -32
  79. package/src/components/ticker/badge/index.tsx +8 -4
  80. package/src/components/ticker/badge/list.tsx +23 -7
  81. package/src/components/ui/column-grid.tsx +8 -2
  82. package/src/components/ui/data-table/opentui/model.ts +4 -1
  83. package/src/components/ui/tabs.tsx +5 -2
  84. package/src/core/state/app/layout.ts +18 -3
  85. package/src/core/state/app/state.ts +2 -0
  86. package/src/core/state/app/types.ts +5 -0
  87. package/src/data/config/layout.ts +3 -0
  88. package/src/data/config/store/normalize.ts +39 -4
  89. package/src/i18n/es.ts +10 -0
  90. package/src/i18n/ja.ts +10 -0
  91. package/src/i18n/ko.ts +10 -0
  92. package/src/i18n/zh-cn.ts +10 -0
  93. package/src/i18n/zh-tw.ts +10 -0
  94. package/src/layout/pane-manager/floating-placement.ts +7 -4
  95. package/src/layout/pane-manager/floating.ts +5 -2
  96. package/src/market-data/bond-funds.ts +19 -0
  97. package/src/market-data/coordinator/events.ts +17 -1
  98. package/src/market-data/frame-scheduler.ts +47 -10
  99. package/src/market-data/frame-wake.ts +74 -0
  100. package/src/market-data/futures-board.ts +7 -6
  101. package/src/market-data/futures-contract.ts +14 -3
  102. package/src/market-data/hooks.tsx +12 -3
  103. package/src/market-data/market/freshness.ts +18 -0
  104. package/src/market-data/market/status.ts +15 -2
  105. package/src/market-data/performance.ts +78 -9
  106. package/src/market-data/request-types.ts +6 -3
  107. package/src/plugins/builtin/alerts/cli.ts +2 -1
  108. package/src/plugins/builtin/analytics/risk-evidence.ts +1 -0
  109. package/src/plugins/builtin/attention/evidence.ts +1 -1
  110. package/src/plugins/builtin/awards/client.ts +1 -1
  111. package/src/plugins/builtin/awards/evidence.ts +1 -1
  112. package/src/plugins/builtin/awards/pane.tsx +2 -1
  113. package/src/plugins/builtin/bond-calculator/headless.ts +2 -1
  114. package/src/plugins/builtin/bond-calculator/index.tsx +1 -1
  115. package/src/plugins/builtin/bond-calculator/math.ts +1 -1
  116. package/src/plugins/builtin/bond-calculator/model.ts +14 -5
  117. package/src/plugins/builtin/bond-calculator/pane.tsx +1 -1
  118. package/src/plugins/builtin/broker-manager/footer.ts +3 -2
  119. package/src/plugins/builtin/broker-manager/index.tsx +2 -1
  120. package/src/plugins/builtin/broker-manager/keyboard.ts +2 -1
  121. package/src/plugins/builtin/buildout/cells.tsx +25 -45
  122. package/src/plugins/builtin/buildout/detail/company.tsx +3 -3
  123. package/src/plugins/builtin/buildout/detail/index.tsx +1 -1
  124. package/src/plugins/builtin/buildout/detail/intel.tsx +4 -7
  125. package/src/plugins/builtin/buildout/detail/site.tsx +4 -4
  126. package/src/plugins/builtin/buildout/detail/ui.tsx +39 -38
  127. package/src/plugins/builtin/buildout/format.ts +23 -1
  128. package/src/plugins/builtin/buildout/model/types.ts +1 -0
  129. package/src/plugins/builtin/buildout/pane/index.tsx +2 -8
  130. package/src/plugins/builtin/buildout/table-model.ts +12 -4
  131. package/src/plugins/builtin/catalysts/evidence.ts +1 -1
  132. package/src/plugins/builtin/catalysts/pane.tsx +2 -1
  133. package/src/plugins/builtin/cds/headless.ts +1 -0
  134. package/src/plugins/builtin/cds/index.tsx +1 -1
  135. package/src/plugins/builtin/chart-composer/headless.ts +40 -1
  136. package/src/plugins/builtin/cloud/plugin.tsx +2 -0
  137. package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +28 -3
  138. package/src/plugins/builtin/cloud-tweets/table.tsx +3 -2
  139. package/src/plugins/builtin/comment-letters/client.ts +2 -1
  140. package/src/plugins/builtin/company-kpis/client.ts +1 -1
  141. package/src/plugins/builtin/company-kpis/pane.tsx +2 -1
  142. package/src/plugins/builtin/company-kpis/screenshot-evidence.ts +3 -2
  143. package/src/plugins/builtin/correlation/headless.ts +3 -2
  144. package/src/plugins/builtin/cot/headless.ts +9 -3
  145. package/src/plugins/builtin/cot/model.ts +44 -3
  146. package/src/plugins/builtin/credit-documents/client.ts +1 -1
  147. package/src/plugins/builtin/credit-documents/evidence.ts +1 -1
  148. package/src/plugins/builtin/credit-documents/pane.tsx +2 -1
  149. package/src/plugins/builtin/crypto-board/pane.tsx +5 -4
  150. package/src/plugins/builtin/debt-maturities/headless.ts +11 -2
  151. package/src/plugins/builtin/debt-maturities/model.ts +66 -0
  152. package/src/plugins/builtin/debt-maturities/pane.tsx +23 -4
  153. package/src/plugins/builtin/earnings-calls/pane.tsx +1 -1
  154. package/src/plugins/builtin/earnings-ripple/index.tsx +6 -1
  155. package/src/plugins/builtin/earnings-ripple/pane.tsx +1 -1
  156. package/src/plugins/builtin/econ/calendar-model.ts +30 -6
  157. package/src/plugins/builtin/econ/fred-catalog.ts +5 -5
  158. package/src/plugins/builtin/econ/print-watch.ts +3 -1
  159. package/src/plugins/builtin/equity-screener/client.ts +1 -1
  160. package/src/plugins/builtin/equity-screener/criterion-editor.tsx +4 -16
  161. package/src/plugins/builtin/equity-screener/headless.ts +4 -2
  162. package/src/plugins/builtin/equity-screener/ideas.ts +67 -3
  163. package/src/plugins/builtin/equity-screener/model.ts +180 -12
  164. package/src/plugins/builtin/equity-screener/pane.tsx +52 -12
  165. package/src/plugins/builtin/equity-screener/screen-check.ts +7 -4
  166. package/src/plugins/builtin/equity-screener/watchlist.ts +33 -0
  167. package/src/plugins/builtin/futures/series.ts +16 -1
  168. package/src/plugins/builtin/futures-curve/client.ts +19 -0
  169. package/src/plugins/builtin/futures-curve/headless.ts +52 -13
  170. package/src/plugins/builtin/futures-curve/index.tsx +1 -1
  171. package/src/plugins/builtin/futures-curve/model.ts +77 -6
  172. package/src/plugins/builtin/futures-curve/pane.tsx +19 -3
  173. package/src/plugins/builtin/fx-matrix/headless.ts +4 -2
  174. package/src/plugins/builtin/fx-matrix/index.tsx +37 -3
  175. package/src/plugins/builtin/fx-matrix/pairs.ts +15 -0
  176. package/src/plugins/builtin/gpu/headless.ts +2 -1
  177. package/src/plugins/builtin/help/function-card.tsx +2 -1
  178. package/src/plugins/builtin/help/index.tsx +2 -1
  179. package/src/plugins/builtin/insider/display.ts +45 -6
  180. package/src/plugins/builtin/ipo-calendar/model.ts +2 -0
  181. package/src/plugins/builtin/iv-history/client.ts +2 -1
  182. package/src/plugins/builtin/iv-history/headless.ts +2 -1
  183. package/src/plugins/builtin/jobs/pages.ts +4 -4
  184. package/src/plugins/builtin/kelly-sizer/headless.ts +2 -1
  185. package/src/plugins/builtin/macro-day/client.ts +41 -0
  186. package/src/plugins/builtin/macro-day/headless.ts +19 -9
  187. package/src/plugins/builtin/macro-day/model.ts +3 -1
  188. package/src/plugins/builtin/market-heatmap/index.tsx +2 -1
  189. package/src/plugins/builtin/market-movers/index.tsx +4 -3
  190. package/src/plugins/builtin/members/client.ts +1 -1
  191. package/src/plugins/builtin/mna/distress/client.ts +1 -0
  192. package/src/plugins/builtin/mna/distress/headless.ts +1 -0
  193. package/src/plugins/builtin/mna/pane.tsx +4 -1
  194. package/src/plugins/builtin/options/market-reference.ts +1 -1
  195. package/src/plugins/builtin/options/open-interest-as-of.ts +3 -1
  196. package/src/plugins/builtin/options/view.tsx +2 -1
  197. package/src/plugins/builtin/options-calculator/evidence.ts +1 -1
  198. package/src/plugins/builtin/options-scenario/csp-screen-pane.tsx +1 -1
  199. package/src/plugins/builtin/options-scenario/csp-screen.ts +8 -4
  200. package/src/plugins/builtin/options-scenario/csp.ts +28 -9
  201. package/src/plugins/builtin/options-scenario/evidence.ts +5 -4
  202. package/src/plugins/builtin/options-scenario/pane.tsx +2 -1
  203. package/src/plugins/builtin/perps/client.ts +1 -1
  204. package/src/plugins/builtin/perps/pane.tsx +3 -1
  205. package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +17 -0
  206. package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +2 -1
  207. package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +4 -2
  208. package/src/plugins/builtin/portfolio-list/pane/index.tsx +7 -3
  209. package/src/plugins/builtin/portfolio-list/use-throttled-memo.ts +10 -19
  210. package/src/plugins/builtin/rate-path/headless.ts +24 -10
  211. package/src/plugins/builtin/research/analyst-model.ts +1 -0
  212. package/src/plugins/builtin/research/equity-diagnostic-pane.tsx +2 -1
  213. package/src/plugins/builtin/research/event-model.ts +10 -3
  214. package/src/plugins/builtin/research/events-headless.ts +20 -2
  215. package/src/plugins/builtin/research/index.tsx +1 -0
  216. package/src/plugins/builtin/research/relative-valuation-currency.ts +1 -1
  217. package/src/plugins/builtin/research/relative-valuation-peers.ts +2 -1
  218. package/src/plugins/builtin/research-search/command-bar-search.ts +3 -1
  219. package/src/plugins/builtin/research-search/snippet.ts +1 -0
  220. package/src/plugins/builtin/revenue-breakdown/client.ts +3 -2
  221. package/src/plugins/builtin/seasonality/headless.ts +2 -1
  222. package/src/plugins/builtin/sec/command-bar-search.ts +3 -2
  223. package/src/plugins/builtin/sec/fund-facts.ts +17 -1
  224. package/src/plugins/builtin/sec/index.tsx +8 -5
  225. package/src/plugins/builtin/sec/row-summaries.ts +28 -12
  226. package/src/plugins/builtin/shared/members-menu.tsx +103 -38
  227. package/src/plugins/builtin/short-interest/publications-model.ts +22 -1
  228. package/src/plugins/builtin/short-interest/publications-pane.tsx +13 -4
  229. package/src/plugins/builtin/short-interest/watch-client.ts +2 -1
  230. package/src/plugins/builtin/short-interest/watch-model.ts +1 -1
  231. package/src/plugins/builtin/social-mentions/client.ts +2 -1
  232. package/src/plugins/builtin/supply-chain/client.ts +1 -1
  233. package/src/plugins/builtin/supply-chain/evidence.ts +1 -1
  234. package/src/plugins/builtin/supply-chain/graph-pane.tsx +2 -1
  235. package/src/plugins/builtin/supply-chain/pane.tsx +2 -1
  236. package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +1 -1
  237. package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +24 -4
  238. package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +1 -1
  239. package/src/plugins/builtin/time-sales/client.ts +1 -0
  240. package/src/plugins/builtin/time-sales/pane.tsx +3 -2
  241. package/src/plugins/builtin/trace-bonds/client.ts +7 -4
  242. package/src/plugins/builtin/trace-bonds/index.tsx +1 -1
  243. package/src/plugins/builtin/vol-surface/client.ts +2 -1
  244. package/src/plugins/builtin/volatility/client.ts +6 -1
  245. package/src/plugins/builtin/volatility/headless.ts +0 -1
  246. package/src/plugins/builtin/yield-curve/curves.ts +15 -0
  247. package/src/plugins/builtin/yield-curve/headless.ts +9 -2
  248. package/src/plugins/builtin/yield-curve/index.tsx +5 -8
  249. package/src/plugins/host-modules.ts +22 -3
  250. package/src/plugins/host-smoke.ts +6 -3
  251. package/src/portfolio/collection-name.ts +19 -0
  252. package/src/portfolio/column-values.ts +76 -10
  253. package/src/renderers/browser/http-proxy-transport.ts +78 -8
  254. package/src/renderers/cloudflare/http-proxy.ts +13 -2
  255. package/src/renderers/cloudflare/proxy-session.ts +47 -24
  256. package/src/renderers/cloudflare/worker.ts +15 -2
  257. package/src/renderers/desktop/geometry.ts +279 -0
  258. package/src/renderers/desktop/screen-setup.ts +246 -0
  259. package/src/renderers/desktop/sequential-window-host.ts +179 -0
  260. package/src/renderers/desktop/test-utils.ts +71 -0
  261. package/src/renderers/desktop/window-controller.ts +433 -0
  262. package/src/renderers/desktop/window-host.ts +70 -0
  263. package/src/renderers/desktop/window-layouts.ts +630 -0
  264. package/src/renderers/dom/data-frames.ts +15 -4
  265. package/src/renderers/dom/host/box.tsx +204 -176
  266. package/src/renderers/dom/host/style.ts +49 -20
  267. package/src/renderers/dom/host/text.tsx +3 -2
  268. package/src/renderers/electrobun/bun/application-menu/click.ts +1 -0
  269. package/src/renderers/electrobun/bun/application-menu/index.ts +4 -1
  270. package/src/renderers/electrobun/bun/desktop/backend-requests.ts +19 -8
  271. package/src/renderers/electrobun/bun/desktop/backend.ts +322 -19
  272. package/src/renderers/electrobun/bun/desktop/detached-windows.ts +83 -61
  273. package/src/renderers/electrobun/bun/desktop/host-requests.ts +29 -15
  274. package/src/renderers/electrobun/bun/desktop/initialization.ts +30 -11
  275. package/src/renderers/electrobun/bun/desktop/relaunch.ts +9 -1
  276. package/src/renderers/electrobun/bun/desktop/screen-setup-file.ts +55 -0
  277. package/src/renderers/electrobun/bun/desktop/state-broadcaster.ts +44 -8
  278. package/src/renderers/electrobun/bun/desktop/windows-script.ts +9 -6
  279. package/src/renderers/electrobun/bun/desktop/workspace/index.ts +298 -97
  280. package/src/renderers/electrobun/bun/desktop/workspace/requests.ts +44 -6
  281. package/src/renderers/electrobun/bun/index.ts +4 -97
  282. package/src/renderers/electrobun/bun/window/electrobun-window-host.ts +306 -0
  283. package/src/renderers/electrobun/bun/window/focus.ts +0 -25
  284. package/src/renderers/electrobun/bun/window/remembered-frame.ts +4 -82
  285. package/src/renderers/electrobun/bun/window/windows-native.ts +26 -1
  286. package/src/renderers/electrobun/shared/protocol.ts +50 -2
  287. package/src/renderers/electrobun/view/backend-rpc.ts +15 -0
  288. package/src/renderers/electrobun/view/desktop/window/bridge.ts +63 -3
  289. package/src/renderers/electrobun/view/main.tsx +13 -7
  290. package/src/renderers/electrobun/view/ui-host.tsx +7 -0
  291. package/src/renderers/electrobun/view/window-fullscreen.ts +10 -3
  292. package/src/series/fred-argument.ts +17 -0
  293. package/src/sources/provider-router/financial-routes.ts +7 -1
  294. package/src/sources/provider-router/index.ts +7 -1
  295. package/src/state/app/context/index.tsx +16 -2
  296. package/src/state/desktop-windows.ts +63 -0
  297. package/src/sync/other-window-tabs.ts +62 -0
  298. package/src/tickers/company-name-listing.ts +23 -3
  299. package/src/tickers/listing-fate.ts +147 -1
  300. package/src/tickers/terminal-codes.ts +5 -0
  301. package/src/time-series/price-units.ts +11 -0
  302. package/src/time-series/types.ts +6 -0
  303. package/src/types/config.ts +10 -1
  304. package/src/types/desktop-window.ts +71 -2
  305. package/src/types/financials.ts +4 -0
  306. package/src/types/headless.ts +19 -0
  307. package/src/types/plugin.ts +6 -0
  308. package/src/ui/host.tsx +2 -0
  309. package/src/ui/index.tsx +14 -13
  310. package/src/ui/same-props.ts +58 -0
  311. package/src/utils/cli-output.ts +33 -4
  312. package/src/utils/currency-names.ts +20 -0
  313. package/src/utils/currency-pair.ts +6 -0
  314. package/src/utils/exchange-rate-snapshot.ts +20 -2
  315. package/src/utils/format.ts +7 -2
  316. package/src/utils/futures-generic.ts +12 -0
  317. package/src/utils/fx-market-hours.ts +43 -0
  318. package/src/utils/http-proxy-upstream.ts +6 -2
  319. package/src/utils/plugin-proxy-hosts.json +0 -4
  320. package/src/utils/plugin-proxy-hosts.ts +22 -0
  321. package/src/utils/sec-filings.ts +7 -1
@@ -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();
@@ -76,6 +76,47 @@ export async function loadMacroDayHistory(
76
76
  }
77
77
  }
78
78
 
79
+ /** A FRED series read as closes: its daily values, and whether a value is a rate, whose moves read in bp. */
80
+ export interface MacroDaySeriesHistory extends MacroDayHistory {
81
+ /** The series is in percent (a yield or a spread such as T10Y2Y): a move is the change in its level. */
82
+ rate: boolean;
83
+ /** FRED's title for it, "10-Year Treasury Constant Maturity Minus 2-Year Treasury Constant Maturity". */
84
+ title: string | null;
85
+ }
86
+
87
+ /** The five years of daily values a release-day study reads, as the price history is. */
88
+ const SERIES_LOOKBACK_DAYS = 5 * 366;
89
+
90
+ /**
91
+ * A FRED series (`FRED:T10Y2Y`) as the study's closes: each dated value, with
92
+ * blank days (holidays FRED lists as no value) left out. A rate or spread in
93
+ * percent moves by its level, read in basis points; any other series by its
94
+ * return. Never rejects but on cancel.
95
+ */
96
+ export async function loadMacroDaySeriesHistory(
97
+ request: { seriesId: string; signal?: AbortSignal },
98
+ client: Pick<typeof apiClient, "getCloudFredSeries"> = apiClient,
99
+ now = Date.now(),
100
+ ): Promise<MacroDaySeriesHistory> {
101
+ if (request.signal?.aborted) throw abortError(CANCELLED);
102
+ const startDate = new Date(now - SERIES_LOOKBACK_DAYS * 86_400_000).toISOString().slice(0, 10);
103
+ try {
104
+ const payload = await abortable(client.getCloudFredSeries(request.seriesId, { startDate, sortOrder: "asc" },
105
+ request.signal ? { signal: request.signal } : {}), request.signal, CANCELLED);
106
+ const history = payload.observations
107
+ .filter((point) => typeof point.value === "number" && Number.isFinite(point.value) && /^\d{4}-\d{2}-\d{2}$/.test(point.date))
108
+ .map((point) => ({ date: new Date(`${point.date}T00:00:00Z`), close: point.value! }))
109
+ .sort((left, right) => left.date.getTime() - right.date.getTime());
110
+ const fetchedAt = payload.fetchedAt ? Date.parse(payload.fetchedAt) : now;
111
+ return { history, stale: payload.stale === true, error: history.length ? null : `No values for FRED:${request.seriesId}`,
112
+ fetchedAt: Number.isFinite(fetchedAt) ? fetchedAt : now,
113
+ rate: /^percent\b/i.test(payload.info?.units?.trim() ?? ""), title: payload.info?.title?.trim() || null };
114
+ } catch (error) {
115
+ if (request.signal?.aborted || (error instanceof Error && error.name === "AbortError")) throw abortError(CANCELLED);
116
+ return { history: [], stale: false, error: errorMessage(error), fetchedAt: now, rate: false, title: null };
117
+ }
118
+ }
119
+
79
120
  export interface MacroDayEarnings {
80
121
  reports: MacroDayEarningsReport[];
81
122
  stale: boolean;
@@ -1,6 +1,7 @@
1
1
  import type { HeadlessPaneDefinition } from "../../../types/plugin";
2
2
  import { resolveHeadlessInstrument } from "../shared/headless-market-data";
3
- import { loadMacroDayEarnings, loadMacroDayHistory, loadMacroReleases, macroDayEarningsNotice } from "./client";
3
+ import { loadMacroDayEarnings, loadMacroDayHistory, loadMacroDaySeriesHistory, loadMacroReleases, macroDayEarningsNotice, type MacroDayEarnings } from "./client";
4
+ import { fredSeriesArgument } from "../../../series/fred-argument";
4
5
  import { formatMacroDayMove, macroDayEventLabel, macroDayStats, matchesSurprise, projectMacroDays, type MacroDayStats } from "./model";
5
6
  import { MACRO_EVENT_KINDS, MACRO_EVENT_LABELS, MACRO_RELEASE_SOURCES, MACRO_SURPRISE_LABELS, MACRO_SURPRISES, staleMacroReleasesNotice,
6
7
  type MacroEventKind, type MacroSurprise } from "./releases";
@@ -11,13 +12,15 @@ const multiple = (value: unknown) => typeof value === "number" ? `${value.toFixe
11
12
  const share = (value: unknown) => typeof value === "number" ? `${Math.round(value * 100)}%` : "--";
12
13
 
13
14
  export const macroDayHeadless: HeadlessPaneDefinition<"bundle"> = {
14
- shape: "bundle", argument: { kind: "ticker", description: "Ticker" },
15
+ shape: "bundle", argument: { kind: "ticker", description: "Ticker, or a FRED series such as FRED:T10Y2Y", examples: ["TLT", "FRED:T10Y2Y"] },
15
16
  usListingsOnly: "Macro release day data",
17
+ // A spread the catalog prints (FRED:T10Y2Y) moves on release days too: its moves in bp.
18
+ fredSeriesArgument: true,
16
19
  // Dated by the release list (releasesThrough) as much as by the closes, so no session schedule applies.
17
20
  freshness: { status: "not-a-feed", basis: "release-day study on daily closes" },
18
21
  describe: (args) => `MDAY ${args.symbols[0] ?? ""}`,
19
22
  discovery: { screenshotReadiness: "live-dom", limitations: [
20
- "US listings; close-to-close on the release day.",
23
+ "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.",
21
24
  "Published CPI, jobs and FOMC days, and Brazil's IPCA days from Gloom Cloud; sessions after the list's last covered day (releasesThrough) are left out.",
22
25
  "Actual, forecast and prior for the days Gloom Cloud has them (the US headlines from its kept economic calendar, IPCA from the central bank's SGS series); --surprise keeps the days that came in hot, cool or in line with the forecast.",
23
26
  "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.",
@@ -31,11 +34,18 @@ export const macroDayHeadless: HeadlessPaneDefinition<"bundle"> = {
31
34
  { key: "lookbackYears", type: "integer", minimum: 1, maximum: 5, defaultValue: 5, description: "Years of daily closes" },
32
35
  ],
33
36
  async load(args, ctx) {
34
- const instrument = await resolveHeadlessInstrument(ctx, args.symbols[0]!);
35
- const [history, releases, earnings] = await Promise.all([loadMacroDayHistory({ instrument, signal: ctx.signal }, ctx.marketData), loadMacroReleases(),
36
- loadMacroDayEarnings({ instrument, signal: ctx.signal })]);
37
+ // FRED:T10Y2Y is a series, read from FRED: it has no earnings, and a rate or spread moves by its level.
38
+ const seriesId = fredSeriesArgument(args.symbols[0]!);
39
+ const instrument = seriesId ? null : await resolveHeadlessInstrument(ctx, args.symbols[0]!);
40
+ const symbol = instrument?.symbol ?? `FRED:${seriesId}`;
41
+ const [history, releases, earnings] = await Promise.all([
42
+ instrument ? loadMacroDayHistory({ instrument, signal: ctx.signal }, ctx.marketData) : loadMacroDaySeriesHistory({ seriesId: seriesId!, signal: ctx.signal }, ctx.apiClient),
43
+ loadMacroReleases(),
44
+ instrument ? loadMacroDayEarnings({ instrument, signal: ctx.signal }) : Promise.resolve<MacroDayEarnings>({ reports: [], stale: false, error: null }),
45
+ ]);
46
+ const basis = "rate" in history ? history.rate ? "yield" as const : "return" as const : undefined;
37
47
  ctx.signal.throwIfAborted();
38
- const model = projectMacroDays(history.history, { symbol: instrument.symbol, lookbackYears: Number(args.options.lookbackYears) || 5,
48
+ const model = projectMacroDays(history.history, { symbol, basis, lookbackYears: Number(args.options.lookbackYears) || 5,
39
49
  releases: releases.releases, coveredThrough: releases.coveredThrough, earnings: earnings.reports });
40
50
  const notes = [staleMacroReleasesNotice(releases), macroDayEarningsNotice(earnings)].filter((note): note is string => !!note);
41
51
  const row = (label: string, stats: MacroDayStats) => ({ label, ...stats });
@@ -67,10 +77,10 @@ export const macroDayHeadless: HeadlessPaneDefinition<"bundle"> = {
67
77
  ...(figures ? { headline: figures.event } : {}) })) },
68
78
  ],
69
79
  complete: !history.stale && !earnings.stale && !history.error && !notes.length && model.events.length > 0,
70
- unavailableSymbols: model.events.length ? [] : [instrument.symbol],
80
+ unavailableSymbols: model.events.length ? [] : [symbol],
71
81
  errors: history.error ? [history.error] : [],
72
82
  ...(notes.length ? { notes } : {}),
73
- metadata: { unit: yieldMoves ? "change in the yield in percentage points, close to close on the release day"
83
+ metadata: { unit: yieldMoves ? `change in the ${seriesId ? "rate" : "yield"} in percentage points, close to close on the release day`
74
84
  : "decimal return, close to close on the release day", start: model.start, asOf: model.asOf,
75
85
  releasesThrough: releases.coveredThrough, releaseSources: Object.values(MACRO_RELEASE_SOURCES),
76
86
  stale: history.stale || earnings.stale, fetchedAt: history.fetchedAt, methodology: "docs/research-data.md#macro-day-reaction" },
@@ -164,6 +164,8 @@ const US_KINDS: ReadonlySet<MacroEventKind> = new Set(US_MACRO_EVENT_KINDS);
164
164
  */
165
165
  export function projectMacroDays(history: readonly PricePoint[], options: {
166
166
  symbol: string;
167
+ /** How a move is measured when the symbol does not say: a FRED rate or spread moves by its level, in bp. */
168
+ basis?: MacroDayMoveBasis;
167
169
  lookbackYears: number;
168
170
  releases: readonly MacroRelease[];
169
171
  /** The release list's last covered day. */
@@ -172,7 +174,7 @@ export function projectMacroDays(history: readonly PricePoint[], options: {
172
174
  earnings?: readonly MacroDayEarningsReport[];
173
175
  }): MacroDayModel {
174
176
  const { coveredThrough } = options;
175
- const basis = macroDayMoveBasis(options.symbol);
177
+ const basis = options.basis ?? macroDayMoveBasis(options.symbol);
176
178
  const byDate = new Map<string, number>();
177
179
  for (const point of history) {
178
180
  const time = new Date(point.date).getTime();
@@ -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 {
@@ -114,12 +114,13 @@ function MarketMoversPane({ focused, width, height }: PaneProps) {
114
114
  .filter((quote): quote is MarketSummaryQuote => !!quote)
115
115
  ), [summaryBoard, summarySymbols]);
116
116
 
117
- const tabItems = tabs.map((tab) => ({ label: tab.label, value: tab.id }));
118
- const selectTab = (value: string) => {
117
+ // Kept between quotes, so the tab strip skips the renders a board update gives the pane.
118
+ const tabItems = useMemo(() => tabs.map((tab) => ({ label: tab.label, value: tab.id })), [tabs]);
119
+ const selectTab = useCallback((value: string) => {
119
120
  setSavedTab(value as TabId);
120
121
  setPickedIn(session.key);
121
122
  if (requestedTab) setRequestedTab(null);
122
- };
123
+ }, [requestedTab, session.key, setPickedIn, setRequestedTab, setSavedTab]);
123
124
  const { strip: tabStrip } = usePaneTabs({ tabs: tabItems, activeValue: activeTab, onSelect: selectTab, focused, compact: true, variant: "bare" });
124
125
 
125
126
  return (
@@ -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
  };
@@ -146,6 +146,7 @@ export const distressHeadless: HeadlessPaneDefinition<"rows"> = {
146
146
  argument: { kind: "none" },
147
147
  discovery: {
148
148
  aliases: ["DIST"],
149
+ intents: ["distressed exchange", "chapter 11", "bankruptcy", "missed payment", "forbearance", "going concern", "covenant waiver", "delisting notice"],
149
150
  dataRequirements: ["Public SEC EDGAR filings and financial statement notes, TWSE and TPEx open data, BODACC and The Gazette notices"],
150
151
  limitations: [
151
152
  "A company missing from a list may still be in difficulty; absence is not a finding.",
@@ -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
  }));
@@ -411,7 +411,9 @@ export function PerpsPane({ width, height, focused, marketAction }: Pick<PanePro
411
411
  }, [assetOnly, carried, compareAsset, marketTab, setSearch, setCompareAsset, setTab]);
412
412
  const openMarket = useCallback((row: PerpBoardRow, next: PerpTab = openingTab(row.marketId, access.hasProAccess)) => { setSearch(row.marketId); setTab(next); }, [setSearch, setTab, access.hasProAccess]);
413
413
  const openMarketId = useCallback((marketId: string) => { setSearch(marketId); setTab(openingTab(marketId, access.hasProAccess)); }, [setSearch, setTab, access.hasProAccess]);
414
- const { strip, rows: tabRows } = usePaneTabs({ tabs: PERP_TABS.map((value) => ({ value, label: label(value) })), activeValue: tab, onSelect: selectTab, focused, dense: true });
414
+ // Kept between board updates, so the tab strip skips the renders they give the pane.
415
+ const tabItems = useMemo(() => PERP_TABS.map((value) => ({ value, label: label(value) })), []);
416
+ const { strip, rows: tabRows } = usePaneTabs({ tabs: tabItems, activeValue: tab, onSelect: selectTab, focused, dense: true });
415
417
  const refreshMarket = useCallback(() => { void resource.reload(); }, [resource.reload]);
416
418
  useAutoRefresh(resource.updatedAt, resource.load, { intervalMs: 60_000 });
417
419
  usePaneRefreshKey(refreshMarket, { focused: focused && marketTab && !querySearch.active && (tab !== "history" || !active) });
@@ -237,6 +237,23 @@ export function retryNotice(ctx: CliCommandContext): (count: number, waitMs: num
237
237
  };
238
238
  }
239
239
 
240
+ /** A list this long says how far its lookup has got, so a long add never looks stuck. */
241
+ const PROGRESS_FROM = 50;
242
+ const PROGRESS_EVERY_MS = 5_000;
243
+
244
+ /**
245
+ * Lines on standard error while a long add looks its symbols up: "Looked up
246
+ * 120 of 300 symbols." every few seconds, and nothing for a short list.
247
+ */
248
+ export function progressNotice(ctx: CliCommandContext, now = () => Date.now()): (looked: number, total: number) => void {
249
+ let last = now();
250
+ return (looked, total) => {
251
+ if (ctx.cliOptions.quiet || total < PROGRESS_FROM || looked >= total || now() - last < PROGRESS_EVERY_MS) return;
252
+ last = now();
253
+ console.error(cliStyles.muted(`Looked up ${looked} of ${total} symbols.`));
254
+ };
255
+ }
256
+
240
257
  /**
241
258
  * The symbols an add or remove was given, failing the command when there are
242
259
  * none or the file cannot be read. An add reads a typed company's name with
@@ -74,7 +74,7 @@ import {
74
74
  requirePortfolio,
75
75
  takeCollectionName,
76
76
  } from "./shared";
77
- import { addOneSymbol, addSymbols, FILE_OPTION, printSymbolRows, removeSymbols, requireSymbolList, retryNotice, shellWord, SYMBOL_LIST_HELP } from "./bulk-symbols";
77
+ import { addOneSymbol, addSymbols, FILE_OPTION, printSymbolRows, progressNotice, removeSymbols, requireSymbolList, retryNotice, shellWord, SYMBOL_LIST_HELP } from "./bulk-symbols";
78
78
  import { readNameEntries } from "../../../../cli/name-entries";
79
79
  import { DRIP_DEFAULT_YEARS, DRIP_MAX_YEARS, parseDripYears, parseWithholding } from "../income";
80
80
 
@@ -263,6 +263,7 @@ async function addToPortfolioCommand(args: string[], file: string | undefined, e
263
263
  suggest: true,
264
264
  dryRun,
265
265
  onRetry: retryNotice(ctx),
266
+ onProgress: progressNotice(ctx),
266
267
  retry,
267
268
  add: (ticker) => addTickerToPortfolio(ticker, portfolio.id),
268
269
  });
@@ -22,7 +22,7 @@ import {
22
22
  } from "../../../../portfolio/mutations";
23
23
  import { showCollection } from "./render";
24
24
  import { listingFields, misplacedSymbolList, refuseDryRun, takeCollectionName } from "./shared";
25
- import { addOneSymbol, addSymbols, FILE_OPTION, printSymbolRows, removeSymbols, requireSymbolList, retryNotice, shellWord, SYMBOL_LIST_HELP } from "./bulk-symbols";
25
+ import { addOneSymbol, addSymbols, FILE_OPTION, printSymbolRows, progressNotice, removeSymbols, requireSymbolList, retryNotice, shellWord, SYMBOL_LIST_HELP } from "./bulk-symbols";
26
26
  import { readNameEntries } from "../../../../cli/name-entries";
27
27
  import { CLI_COMMAND_GROUPS } from "../../../../cli/help";
28
28
 
@@ -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 };
@@ -122,6 +123,7 @@ async function addToWatchlistCommand(args: string[], file: string | undefined, e
122
123
  store: market.store,
123
124
  dataProvider: market.dataProvider,
124
125
  onRetry: retryNotice(ctx),
126
+ onProgress: progressNotice(ctx),
125
127
  retry,
126
128
  suggest: true,
127
129
  dryRun,