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
@@ -200,6 +200,72 @@ export function sortedDebtHistory(
200
200
  b.asOf.localeCompare(a.asOf),
201
201
  );
202
202
  }
203
+ /**
204
+ * What a year's cost proxy divides: `filed`, the filing's debt-only interest
205
+ * over the debt balances it reports; `average-principal`, the year's interest
206
+ * expense over its average scheduled principal.
207
+ */
208
+ export type DebtCostProxyKind = "filed" | "average-principal";
209
+
210
+ /** A year's cost proxy: the value, what it divides when there is one, and why not when there is none. */
211
+ export interface DebtCostProxy {
212
+ value: number | null;
213
+ kind: DebtCostProxyKind | null;
214
+ basis: string | null;
215
+ reason: string | null;
216
+ }
217
+
218
+ /**
219
+ * A year's borrowing cost proxy, in percent. The filing's own when it has
220
+ * one (debt interest over its reported debt balances, as the server reads
221
+ * it); else the year's interest expense over the average of its opening and
222
+ * closing scheduled principal, the opening one being the schedule a year
223
+ * earlier in `history`. With neither, null and the reason.
224
+ */
225
+ export function debtCostProxy(history: readonly DebtHistoryPoint[], point: DebtHistoryPoint): DebtCostProxy {
226
+ if (point.borrowingCostPercent !== null) {
227
+ return { value: point.borrowingCostPercent, kind: "filed", basis: point.borrowingCostDebtTags, reason: null };
228
+ }
229
+ const none = (reason: string): DebtCostProxy => ({ value: null, kind: null, basis: null, reason });
230
+ if (point.interestExpense === null) return none("no annual interest expense reported");
231
+ if (point.totalPrincipal === null) return none("partial principal schedule");
232
+ const opening = history.find((row) => {
233
+ const days = (Date.parse(point.asOf) - Date.parse(row.asOf)) / DAY_MS;
234
+ return days >= 350 && days <= 380;
235
+ });
236
+ if (!opening) return none("no schedule a year earlier to average");
237
+ if (opening.totalPrincipal === null) return none(`partial principal schedule at ${opening.asOf}`);
238
+ const average = (opening.totalPrincipal + point.totalPrincipal) / 2;
239
+ if (average <= 0) return none("no principal to average");
240
+ return {
241
+ value: (100 * point.interestExpense) / average,
242
+ kind: "average-principal",
243
+ basis: `Interest over average principal since ${opening.asOf}`,
244
+ reason: null,
245
+ };
246
+ }
247
+
248
+ /**
249
+ * The annual history as DDIS prints and exports it, newest first: each year's
250
+ * cost proxy as `debtCostProxy` reads it, and `borrowingCostBasis` naming what
251
+ * it divides (`filed` or `average-principal`; null with no proxy).
252
+ */
253
+ export function debtHistoryRows(history: readonly DebtHistoryPoint[]): Array<DebtHistoryPoint & { borrowingCostBasis: DebtCostProxyKind | null }> {
254
+ return history.toReversed().map((point) => {
255
+ const cost = debtCostProxy(history, point);
256
+ return { ...point, borrowingCostPercent: cost.value, borrowingCostBasis: cost.kind };
257
+ });
258
+ }
259
+
260
+ /** The note for the years a cost proxy cannot be read for: "Cost proxy %: none for 2021-12-31 (no schedule a year earlier to average)." */
261
+ export function debtCostProxyNote(history: readonly DebtHistoryPoint[]): string | null {
262
+ const missing = history.toReversed().flatMap((point) => {
263
+ const { reason } = debtCostProxy(history, point);
264
+ return reason ? [`${point.asOf} (${reason})`] : [];
265
+ });
266
+ return missing.length > 0 ? `Cost proxy %: none for ${missing.join(", ")}.` : null;
267
+ }
268
+
203
269
  export function debtNotices(data: DebtMaturitiesPayload): string[] {
204
270
  // Standing scope and open-ended bucket methodology are documented, not repeated as
205
271
  // active failures. The backend stops sending them; this covers older servers and caches.
@@ -51,6 +51,7 @@ import {
51
51
  bucketShare,
52
52
  datedBucketScale,
53
53
  debtAmount,
54
+ debtCostProxy,
54
55
  debtFilingUrl,
55
56
  debtMetricCaption,
56
57
  debtMetricValue,
@@ -165,17 +166,22 @@ function QuarterFactRow({ label, fact }: { label: string; fact: DebtFact | null
165
166
  }
166
167
  function FilingDetail({
167
168
  latest,
169
+ history,
168
170
  quarter,
169
171
  width,
170
172
  height,
171
173
  }: {
172
174
  latest: DebtLatest;
175
+ history: readonly DebtHistoryPoint[];
173
176
  quarter: DebtQuarter | null;
174
177
  width: number;
175
178
  height: number;
176
179
  }) {
177
180
  const expense = latest.interestExpenseFact,
178
181
  evidence = latest.borrowingCostEvidence;
182
+ // No debt-only proxy in the filing: interest over the year's average scheduled principal, or why there is none.
183
+ const point = history.at(-1);
184
+ const cost = latest.borrowingCostPercent.value === null && point ? debtCostProxy(history, point) : null;
179
185
  return (
180
186
  <DetailScroll width={width} height={height}>
181
187
  <KeyValueRow
@@ -205,7 +211,16 @@ function FilingDetail({
205
211
  value={`${expense.start} to ${expense.end}`}
206
212
  />
207
213
  ) : null}
208
- <MetricRow label="Debt cost proxy" metric={latest.borrowingCostPercent} />
214
+ {cost ? (
215
+ <KeyValueRow
216
+ labelWidth={20}
217
+ label="Debt cost proxy"
218
+ value={debtPercent(cost.value)}
219
+ detail={cost.basis ?? cost.reason ?? undefined}
220
+ />
221
+ ) : (
222
+ <MetricRow label="Debt cost proxy" metric={latest.borrowingCostPercent} />
223
+ )}
209
224
  <KeyValueRow
210
225
  labelWidth={20}
211
226
  label="Debt concepts"
@@ -250,13 +265,16 @@ function FilingDetail({
250
265
  }
251
266
  function HistoryDetail({
252
267
  point,
268
+ history,
253
269
  width,
254
270
  height,
255
271
  }: {
256
272
  point: DebtHistoryPoint;
273
+ history: readonly DebtHistoryPoint[];
257
274
  width: number;
258
275
  height: number;
259
276
  }) {
277
+ const cost = debtCostProxy(history, point);
260
278
  return (
261
279
  <DetailScroll width={width} height={height}>
262
280
  <KeyValueRow
@@ -297,8 +315,8 @@ function HistoryDetail({
297
315
  <KeyValueRow
298
316
  labelWidth={20}
299
317
  label="Debt cost proxy"
300
- value={debtPercent(point.borrowingCostPercent)}
301
- detail={point.borrowingCostDebtTags ?? undefined}
318
+ value={debtPercent(cost.value)}
319
+ detail={cost.basis ?? cost.reason ?? undefined}
302
320
  />
303
321
  </DetailScroll>
304
322
  );
@@ -559,7 +577,7 @@ export function DebtMaturitiesPane({ width, height, focused }: PaneProps) {
559
577
  {latest ? (
560
578
  <>
561
579
  {tab === "filing" ? (
562
- <FilingDetail latest={latest} quarter={quarter} width={width} height={bodyHeight} />
580
+ <FilingDetail latest={latest} history={data?.history ?? []} quarter={quarter} width={width} height={bodyHeight} />
563
581
  ) : tab === "maturities" ? (
564
582
  <DataTableStackView<DebtBucket, BucketColumn>
565
583
  emptyStateTitle="No maturity buckets available."
@@ -679,6 +697,7 @@ export function DebtMaturitiesPane({ width, height, focused }: PaneProps) {
679
697
  openHistoryRow ? (
680
698
  <HistoryDetail
681
699
  point={openHistoryRow}
700
+ history={data?.history ?? []}
682
701
  width={width}
683
702
  height={bodyHeight - 2}
684
703
  />
@@ -647,7 +647,7 @@ function CallsListView({
647
647
  // which is a deliberate act reserved for Enter.
648
648
  const prefetchTranscript = useCallback((call: CloudEarningsCallPayload) => {
649
649
  if (!call.hasTranscript || !access.emailVerified || !access.hasProAccess) return;
650
- void loadTranscript(call.id).catch(() => {});
650
+ void loadTranscript(call.id).catch(() => { /* Intentional ignore: a warm-up that fails is loaded again, and its failure shown, when the call opens. */ });
651
651
  }, [access.emailVerified, access.hasProAccess]);
652
652
 
653
653
  // A published transcript is immutable, so it loads once per call. Opening
@@ -2,8 +2,13 @@ import type { PluginModule } from "../plugin-module";
2
2
  import { formatTickerListInput, parseTickerListInput } from "../../../tickers/list";
3
3
  import { earningsRippleHeadless } from "./headless";
4
4
 
5
+ /**
6
+ * The tickers a typed argument names. A list the command bar refuses (more than
7
+ * ten) throws its message rather than opening the pane on the person's holdings.
8
+ * `fn` and `shot` pass their own list as `symbols` and never get here.
9
+ */
5
10
  function namedSymbols(arg: string | undefined): string[] {
6
- try { return arg?.trim() ? parseTickerListInput(arg) : []; } catch { return []; }
11
+ return arg?.trim() ? parseTickerListInput(arg) : [];
7
12
  }
8
13
 
9
14
  export const earningsRippleModule: PluginModule = {
@@ -23,7 +23,7 @@ const TABS = [{ value: "direct", label: "1 hop" }, { value: "two-hop", label: "2
23
23
  const COLUMNS: DataTableColumn[] = [
24
24
  { id: "date", label: "Date", width: 11, align: "left" },
25
25
  { id: "timing", label: "Time", width: 5, align: "left" },
26
- { id: "company", label: "Reports", width: 24, align: "left" },
26
+ { id: "company", label: "Reports", width: 24, flexGrow: 1, align: "left" },
27
27
  { id: "link", label: "Link", width: 13, align: "left" },
28
28
  { id: "holding", label: "Holding", width: 9, align: "left" },
29
29
  { id: "pct", label: "Revenue share", width: 15, align: "right" },
@@ -4,6 +4,8 @@ import { colors } from "../../../theme/colors";
4
4
  import { displayWidth, MISSING_VALUE } from "../../../utils/format";
5
5
  import { fetchEconCalendar } from "./calendar-source";
6
6
  import { parseEconFigure } from "./figures";
7
+ import { resolveFredMapping } from "./fred-series-map";
8
+ import { STATS } from "../econ-statistics/stats";
7
9
  import { isAllDayEvent, type EconEvent, type EconImpact } from "./types";
8
10
 
9
11
  const CACHE_KIND = "calendar";
@@ -277,17 +279,37 @@ function publisherNames(source: EconEvent["source"]): string[] {
277
279
  return [source.name, initials, site].map(compactName).filter(Boolean);
278
280
  }
279
281
 
282
+ /** ECST's names for each FRED series it charts, compacted: PAYEMS is Nonfarm Payrolls, nfp and the jobs report. */
283
+ let statNames: ReadonlyMap<string, readonly string[]> | null = null;
284
+
285
+ function statNamesOf(seriesId: string): readonly string[] {
286
+ statNames ??= STATS.reduce((names, stat) => names.set(stat.seriesId,
287
+ [...names.get(stat.seriesId) ?? [], ...[stat.label, ...stat.aliases ?? [], ...stat.keywords ?? []].map(compactName).filter(Boolean)]),
288
+ new Map<string, string[]>());
289
+ return statNames.get(seriesId) ?? [];
290
+ }
291
+
292
+ /**
293
+ * The names a row is searched by, compacted: the feed's own and the one the
294
+ * calendar shows, then what ECST calls the series the release is of
295
+ * (Non-Farm Employment Change is also nonfarm payrolls, nfp and the jobs report).
296
+ */
297
+ function eventSearchNames(event: Pick<EconEvent, "country" | "event" | "actual" | "forecast" | "prior">): string[] {
298
+ const series = resolveFredMapping(event.event, event.country)?.seriesId;
299
+ return [...[event.event, econEventName(event)].map(compactName), ...series ? statNamesOf(series) : []];
300
+ }
301
+
280
302
  /**
281
- * Whether a row carries every word of `query` in its name or its publisher's,
282
- * case, spaces and punctuation aside: `nonfarm` finds Non Farm Payrolls and
283
- * Non-Farm Employment Change, `fed funds` the Federal Funds Rate, and `usda`
284
- * every row the U.S. Department of Agriculture publishes. The name shown and
285
- * the feed's own are both read.
303
+ * Whether a row carries every word of `query` in one of its names or its
304
+ * publisher's, case, spaces and hyphens aside: `nonfarm` finds Non Farm
305
+ * Payrolls and Non-Farm Employment Change, `nfp` and `jobs report` the
306
+ * latter by ECST's names for it, `fed funds` the Federal Funds Rate, and
307
+ * `usda` every row the U.S. Department of Agriculture publishes.
286
308
  */
287
309
  export function matchesEventSearch(event: Pick<EconEvent, "country" | "event" | "actual" | "forecast" | "prior" | "source">, query: string): boolean {
288
310
  const words = query.split(/\s+/).map(compactName).filter(Boolean);
289
311
  if (words.length === 0) return true;
290
- const names = [event.event, econEventName(event)].map(compactName);
312
+ const names = eventSearchNames(event);
291
313
  const publisher = publisherNames(event.source);
292
314
  return names.some((name) => words.every((word) => name.includes(word) || publisher.some((text) => text.includes(word))));
293
315
  }
@@ -320,6 +342,7 @@ function isCountryCode(code: string): boolean {
320
342
  try {
321
343
  regionNames = new Intl.DisplayNames(["en"], { type: "region", fallback: "none" });
322
344
  } catch {
345
+ // Intentional ignore: a runtime without region names accepts any two-letter code instead.
323
346
  regionNames = null;
324
347
  }
325
348
  }
@@ -328,6 +351,7 @@ function isCountryCode(code: string): boolean {
328
351
  // ZZ is CLDR's "Unknown Region".
329
352
  return code !== "ZZ" && regionNames.of(code) !== undefined;
330
353
  } catch {
354
+ // Intentional ignore: a code the runtime's region names reject is no country code.
331
355
  return false;
332
356
  }
333
357
  }
@@ -141,18 +141,18 @@ const GROUPS: ReadonlyArray<{ group: string; rows: readonly FredRow[] }> = [
141
141
  {
142
142
  group: "FX",
143
143
  rows: [
144
- ["DEXUSEU", "Euro (USD per EUR)", "USD", "daily", ["EURUSD", "EUR"]],
145
- ["DEXUSUK", "British pound (USD per GBP)", "USD", "daily", ["GBPUSD", "GBP", "sterling"]],
144
+ ["DEXUSEU", "Euro (USD per EUR)", "USD", "daily", ["EURUSD", "EUR", "euro"]],
145
+ ["DEXUSUK", "British pound (USD per GBP)", "USD", "daily", ["GBPUSD", "GBP", "sterling", "pound"]],
146
146
  ["DEXUSAL", "Australian dollar (USD per AUD)", "USD", "daily", ["AUDUSD", "AUD"]],
147
147
  ["DEXUSNZ", "New Zealand dollar (USD per NZD)", "USD", "daily", ["NZDUSD", "NZD"]],
148
- ["DEXJPUS", "Japanese yen (JPY per USD)", "JPY", "daily", ["USDJPY", "JPY"]],
149
- ["DEXCHUS", "Chinese yuan (CNY per USD)", "CNY", "daily", ["USDCNY", "CNY", "renminbi"]],
148
+ ["DEXJPUS", "Japanese yen (JPY per USD)", "JPY", "daily", ["USDJPY", "JPY", "yen"]],
149
+ ["DEXCHUS", "Chinese yuan (CNY per USD)", "CNY", "daily", ["USDCNY", "CNY", "renminbi", "yuan"]],
150
150
  ["DEXINUS", "Indian rupee (INR per USD)", "INR", "daily", ["USDINR", "INR"]],
151
151
  ["DEXBZUS", "Brazilian real (BRL per USD)", "BRL", "daily", ["USDBRL", "BRL"]],
152
152
  ["DEXMXUS", "Mexican peso (MXN per USD)", "MXN", "daily", ["USDMXN", "MXN"]],
153
153
  ["DEXKOUS", "South Korean won (KRW per USD)", "KRW", "daily", ["USDKRW", "KRW"]],
154
154
  ["DEXCAUS", "Canadian dollar (CAD per USD)", "CAD", "daily", ["USDCAD", "CAD"]],
155
- ["DEXSZUS", "Swiss franc (CHF per USD)", "CHF", "daily", ["USDCHF", "CHF"]],
155
+ ["DEXSZUS", "Swiss franc (CHF per USD)", "CHF", "daily", ["USDCHF", "CHF", "franc", "swiss franc"]],
156
156
  ["DEXTAUS", "Taiwan dollar (TWD per USD)", "TWD", "daily", ["USDTWD", "TWD"]],
157
157
  ["DEXHKUS", "Hong Kong dollar (HKD per USD)", "HKD", "daily", ["USDHKD", "HKD"]],
158
158
  ["DEXSIUS", "Singapore dollar (SGD per USD)", "SGD", "daily", ["USDSGD", "SGD"]],
@@ -11,6 +11,7 @@ import {
11
11
  type EconCalendarCacheEntry,
12
12
  } from "./calendar-model";
13
13
  import type { EconEvent } from "./types";
14
+ import { logFailure } from "../../../utils/log-failure";
14
15
 
15
16
  /** The ECO setting that turns the print toast on. Off until the user turns it on, as breaking news is. */
16
17
  export const ECON_PRINT_NOTIFICATIONS_ENABLED_KEY = "econPrintNotificationsEnabled";
@@ -172,8 +173,9 @@ export function startHighImpactPrintWatch(
172
173
  try {
173
174
  // A due print is asked for past the cache; otherwise a fresh cache answers without a request.
174
175
  observe(await deps.load(due), before);
175
- } catch {
176
+ } catch (error) {
176
177
  // The next ask follows the same schedule.
178
+ logFailure("econ.print-watch", "Load calendar for print watch failed")(error);
177
179
  } finally {
178
180
  running = false;
179
181
  }
@@ -21,7 +21,7 @@ const savedPath = (id: string) => `saved/${encodeURIComponent(id)}`;
21
21
  export const screenerApi = {
22
22
  query: (query: ScreenQuery, signal?: AbortSignal, client: ScreenerClient = apiClient) =>
23
23
  client.equityScreener<ScreenPayload>("query", json("POST", query, { signal })),
24
- fields: (signal?: AbortSignal) => apiClient.equityScreener<ScreenFieldsResponse>("fields?include=social,research,attention,hiring-apps,kpis,volatility,dividends,technical,option-volatility,ownership,quality", { signal }),
24
+ fields: (signal?: AbortSignal) => apiClient.equityScreener<ScreenFieldsResponse>("fields?include=social,research,attention,hiring-apps,kpis,volatility,dividends,technical,option-volatility,ownership,quality,scores,grades", { signal }),
25
25
  export: (definition: ScreenDefinition, snapshotId: string) =>
26
26
  apiClient.equityScreener<ScreenExportResponse>("export", json("POST", { ...definition, snapshotId }, { headers: { Accept: "application/json" } })),
27
27
  saved: async (signal?: AbortSignal, client: ScreenerClient = apiClient) =>
@@ -13,7 +13,7 @@ import type {
13
13
  ScreenFieldDefinition,
14
14
  ScreenOperator,
15
15
  } from "../../../api-client/equity-screener";
16
- import { parseCriterion } from "./model";
16
+ import { criterionInputText, criterionValueHint, criterionValueLabel, parseCriterion } from "./model";
17
17
 
18
18
  export function CriterionEditor({
19
19
  fields,
@@ -40,13 +40,7 @@ export function CriterionEditor({
40
40
  const [operator, setOperator] = useState<ScreenOperator>(
41
41
  value?.op ?? field.operators[0]!,
42
42
  );
43
- const [text, setText] = useState(
44
- value && "value" in value
45
- ? Array.isArray(value.value)
46
- ? value.value.join(", ")
47
- : String(value.value)
48
- : "",
49
- );
43
+ const [text, setText] = useState(criterionInputText(value));
50
44
  const [error, setError] = useState<string | null>(null);
51
45
  const [active, setActive] = useState("field");
52
46
  const fieldControl = useRef<SelectControl>(null),
@@ -138,16 +132,10 @@ export function CriterionEditor({
138
132
  />
139
133
  {!["present", "missing"].includes(operator) ? (
140
134
  <TextField
141
- label={`Value${field.unit ? ` (${field.unit})` : ""}`}
135
+ label={criterionValueLabel(field)}
142
136
  value={text}
143
137
  onChange={setText}
144
- placeholder={
145
- operator === "between"
146
- ? "minimum, maximum"
147
- : operator === "in"
148
- ? "comma-separated values"
149
- : "threshold, e.g. 25 or 10B"
150
- }
138
+ placeholder={criterionValueHint(field, operator)}
151
139
  width={Math.min(45, width - 4)}
152
140
  focused={focused && active === "value"}
153
141
  onMouseDown={() => setActive("value")}
@@ -14,7 +14,7 @@ import { buildQuoteKey } from "../../../market-data/selectors";
14
14
  import type { Quote } from "../../../types/financials";
15
15
  import { formatCurrency, formatPercentRaw } from "../../../utils/format";
16
16
  import { fetchSavedScreens, fetchScreen, fetchScreenCheck } from "./client";
17
- import { SCREEN_IDEAS, screenIdea } from "./ideas";
17
+ import { ideaMetricSetting, SCREEN_IDEAS, screenIdea } from "./ideas";
18
18
  import { checkRows, screenCheckSummary, screenCheckTicker } from "./screen-check";
19
19
  import { overlayScreenQuotes, screenExtendedSessions, sortLiveScreenRows } from "./live";
20
20
  import {
@@ -252,6 +252,8 @@ export const equityScreenerHeadless: HeadlessPaneDefinition<"bundle"> = {
252
252
  "Technical fields (RSI, moving averages, MACD and golden crosses, new highs and lows, Bollinger width) read US listings' completed daily sessions: they describe the last close, not the session in progress. A days-since field counts trading days, 0 at the last session.",
253
253
  "Shares outstanding, float, short % of float and institutional ownership cover US filers: the 10-K or 10-Q cover count, the stored statistics float, the FINRA settlement, the 13F quarter. The source does not say when it measured the float, so float and short % of float are partial, dated by when the statistics were retrieved (within 30 days) and never above the dated shares outstanding. A stale or inconsistent input leaves a field unavailable with its reason. Institutional ownership is over the balance-sheet count at the 13F quarter end; over 100% is partial with its reason.",
254
254
  "ROIC, FCF yield, net debt / EBITDA and debt / equity read FA's latest annual column: the trailing four quarters, or the fiscal year when those quarters are it. Revenue and EPS CAGRs run from the latest fiscal year back 3 or 5 years, both years from the stored statements or both from the SEC filings (US filers), never one of each. Forward growth is the consensus EE shows for the fiscal year in progress. N/M where FA prints it: EBITDA, equity, invested capital or a base year at or below zero.",
255
+ "Piotroski F-score compares the latest two fiscal years; Altman Z, the Graham number, Lynch fair value, earnings yield and return on capital read FA's latest annual column at today's price and market cap, each dated by its period end. N/M where the score is not defined: Altman Z, the Magic Formula and an unclassified balance sheet's F-score for banks and insurers, the Graham number and Lynch value over a loss. Magic Formula rank and RS rating rank the covered US listings, not the whole market. Streak years run to the first stored year at most, read as at least that many; the distribution history covers about ten years. S&P 500 and Dow membership read the IVV and DIA holdings MEMB reads, 1 for a member.",
256
+ "Value, Growth, Profitability, Momentum and Revisions grades rank a few of these fields within the company's sector, every currency together, and print F to A+ (stored 1 to 13, so B+ or better is gte 10); a company's share classes and lines are graded once, on its most traded line, and a sector with fewer than 20 companies that have them ranks against every company, and the Reason says so. A grade needs two of its inputs; an N/M input is left out. The composite averages the grades' percentiles with equal weights (three grades or more), ranks the averages across every company and prints 1 to 5 with its label: Top, Strong, Neutral, Weak or Bottom, its nearest whole number.",
255
257
  ],
256
258
  },
257
259
  async load(args, ctx) {
@@ -303,7 +305,7 @@ export const equityScreenerHeadless: HeadlessPaneDefinition<"bundle"> = {
303
305
  }
304
306
  const limit = typeof args.options.limit === "number" ? args.options.limit : SCREEN_PAGE_ROWS;
305
307
  const data = await fetchScreenRows(definition, limit, ctx);
306
- const metrics = readMetrics(args.options.metric == null ? preset?.metric ?? "marketCap" : String(args.options.metric));
308
+ const metrics = readMetrics(args.options.metric == null ? preset ? ideaMetricSetting(preset) : "marketCap" : String(args.options.metric));
307
309
  const metric = metrics[0]!;
308
310
  // Last, Chg% and market cap are the regular session, as `quote` and the
309
311
  // pane read each row's quote; an extended print is a column of its own.
@@ -1,10 +1,12 @@
1
- import type { NumericField, ScreenCriterion, ScreenDefinition } from "../../../api-client/equity-screener";
1
+ import { LETTER_GRADE_FIELDS, type NumericField, type ScreenCriterion, type ScreenDefinition } from "../../../api-client/equity-screener";
2
2
 
3
- /** A ready screen in the Ideas tab and `--preset`: its definition and the metric it leads with. */
3
+ /** A ready screen in the Ideas tab and `--preset`: its definition, the metric it leads with and any it shows beside. */
4
4
  export interface ScreenIdea {
5
5
  id: string;
6
6
  name: string;
7
7
  metric: NumericField;
8
+ /** Columns after the metric, as `--metric` adds them. */
9
+ others?: readonly NumericField[];
8
10
  definition: ScreenDefinition;
9
11
  }
10
12
 
@@ -16,16 +18,19 @@ const idea = (
16
18
  name: string,
17
19
  criteria: ScreenCriterion[],
18
20
  sort: ScreenDefinition["sort"] & { field: NumericField },
21
+ others?: readonly NumericField[],
19
22
  ): ScreenIdea => ({
20
23
  id,
21
24
  name,
22
25
  metric: sort.field,
26
+ ...(others ? { others } : {}),
23
27
  definition: { version: 1, currency: "USD", criteria: [...criteria, TRADED], sort },
24
28
  });
25
29
 
26
30
  /**
27
31
  * Technical ideas, read at the last completed session, then fundamental ones, read on `FA`'s bases (the trailing four
28
- * quarters, or the latest fiscal year when those quarters are that year) and `EE`'s consensus.
32
+ * quarters, or the latest fiscal year when those quarters are that year) and `EE`'s consensus, then the classic
33
+ * scores and the grades. Each keeps to companies above $2B.
29
34
  */
30
35
  export const SCREEN_IDEAS: ScreenIdea[] = [
31
36
  idea("oversold-uptrend", "Oversold in an uptrend", [
@@ -72,7 +77,66 @@ export const SCREEN_IDEAS: ScreenIdea[] = [
72
77
  { field: "forwardPE", op: "lte", value: 20 },
73
78
  { field: "roicPercent", op: "gte", value: 10 },
74
79
  ], { field: "forwardEpsGrowthPercent", direction: "desc" }),
80
+ // Classic scores. Piotroski's F-score of 8 or 9, his high group, among cheaper companies: he scored the cheapest
81
+ // fifth by book to market, and a P/B of 2x or less keeps to cheaper names. Highest score first.
82
+ idea("piotroski", "Piotroski 8-9", [
83
+ { field: "piotroskiFScore", op: "gte", value: 8 },
84
+ { field: "priceToBook", op: "lte", value: 2 },
85
+ ], { field: "piotroskiFScore", direction: "desc" }),
86
+ // Greenblatt's Magic Formula: earnings yield and return on capital ranked over the covered US listings, the two
87
+ // ranks summed and ranked again. The top 100 hold about 50 companies above $2B; banks, insurers and utilities are
88
+ // left out, as he left them out. Best rank first.
89
+ idea("magic-formula", "Magic Formula top", [
90
+ { field: "magicFormulaRank", op: "lte", value: 100 },
91
+ ], { field: "magicFormulaRank", direction: "asc" }),
92
+ // An Altman Z of 3 or more, above his 2.99 safe zone, at a trailing P/E of 15x or less, about the market's long-run
93
+ // multiple. Cheapest first.
94
+ idea("altman-safe-value", "Altman safe and cheap", [
95
+ { field: "altmanZScore", op: "gte", value: 3 },
96
+ { field: "trailingPE", op: "lte", value: 15 },
97
+ ], { field: "trailingPE", direction: "asc" }),
98
+ // A price at or below the Graham number, sqrt(22.5 x EPS x book value per share), with ten profitable years in a
99
+ // row, Graham's test of earnings stability for the defensive investor. Furthest below first.
100
+ idea("graham-number", "Below the Graham number", [
101
+ { field: "grahamUpsidePercent", op: "gte", value: 0 },
102
+ { field: "profitableYears", op: "gte", value: 10 },
103
+ ], { field: "grahamUpsidePercent", direction: "desc" }),
104
+ // A price at or below Lynch's fair value, EPS times its five-year growth rate, so a PEG of 1 or less, with debt no
105
+ // larger than equity, as Lynch preferred. Most upside first.
106
+ idea("lynch-value", "Below Lynch fair value", [
107
+ { field: "lynchUpsidePercent", op: "gte", value: 0 },
108
+ { field: "debtToEquity", op: "lte", value: 1 },
109
+ ], { field: "lynchUpsidePercent", direction: "desc" }),
110
+ // Five years or more of higher trailing dividends, a yield of 2% or more and a payout of 75% or less of earnings,
111
+ // room to keep raising. The stored distribution history runs about ten years, so a longer record reads as at
112
+ // least that. Fastest 3-year dividend growth first.
113
+ idea("dividend-growers", "Dividend growers", [
114
+ { field: "dividendGrowthYears", op: "gte", value: 5 },
115
+ { field: "dividendYieldPercent", op: "gte", value: 2 },
116
+ { field: "payoutRatioPercent", op: "lte", value: 75 },
117
+ ], { field: "dividendGrowth3YPercent", direction: "desc" }),
118
+ // An RS rating of 90 or more, a 1Y total return in the top tenth of US listings, within 15% of the 52-week high, as
119
+ // IBD looks for leaders near their highs. Highest rating first.
120
+ idea("rs-leaders", "RS leaders", [
121
+ { field: "rsRating", op: "gte", value: 90 },
122
+ { field: "fromHigh52WPercent", op: "gte", value: -15 },
123
+ ], { field: "rsRating", direction: "desc" }),
124
+ // Ten profitable fiscal years in a row, five years or more of higher revenue, and ROIC of 15% or more. Longest
125
+ // revenue growth first.
126
+ idea("compounders", "Steady compounders", [
127
+ { field: "profitableYears", op: "gte", value: 10 },
128
+ { field: "revenueGrowthYears", op: "gte", value: 5 },
129
+ { field: "roicPercent", op: "gte", value: 15 },
130
+ ], { field: "revenueGrowthYears", direction: "desc" }),
131
+ // Grades: the composite of the five sector-relative grades at 4.5 or more, its Top label, which the ranking keeps
132
+ // to an eighth of the graded listings, with the five grades beside it. Highest composite first.
133
+ idea("top-grades", "Top grades", [
134
+ { field: "gradeComposite", op: "gte", value: 4.5 },
135
+ ], { field: "gradeComposite", direction: "desc" }, LETTER_GRADE_FIELDS),
75
136
  ];
76
137
 
138
+ /** The metric setting an idea opens with: its metric, then the columns it shows beside it (`--metric` form). */
139
+ export const ideaMetricSetting = (entry: ScreenIdea): string => [entry.metric, ...(entry.others ?? [])].join(",");
140
+
77
141
  export const screenIdea = (id: string | undefined): ScreenIdea | undefined =>
78
142
  SCREEN_IDEAS.find((entry) => entry.id === id);