@gloom-sh/terminal 0.19.5 → 0.20.0
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.
- package/LICENSE +0 -4
- package/package.json +6 -5
- package/patches/@opentui%2Fcore@0.3.2.patch +86 -25
- package/patches/electrobun-devkit@2.0.5.patch +148 -0
- package/src/api-client/bond-trades.ts +59 -0
- package/src/api-client/data.ts +21 -0
- package/src/api-client/equity-screener.ts +23 -0
- package/src/api-client/index.ts +2 -0
- package/src/api-client/types/account.ts +86 -0
- package/src/api-client/types/assist.ts +32 -0
- package/src/api-client/types/auth.ts +63 -0
- package/src/api-client/types/billing.ts +54 -0
- package/src/api-client/types/chat.ts +180 -0
- package/src/api-client/types/congress.ts +107 -0
- package/src/api-client/types/credit.ts +110 -0
- package/src/api-client/types/econ.ts +158 -0
- package/src/api-client/types/equity-diagnostic.ts +73 -0
- package/src/api-client/types/filings-and-calls.ts +350 -0
- package/src/api-client/types/index.ts +25 -0
- package/src/api-client/types/jobs.ts +147 -0
- package/src/api-client/types/market.ts +122 -0
- package/src/api-client/types/news.ts +91 -0
- package/src/api-client/types/notes-and-theses.ts +172 -0
- package/src/api-client/types/quotes.ts +28 -0
- package/src/api-client/types/scanners.ts +125 -0
- package/src/api-client/types/screener.ts +65 -0
- package/src/api-client/types/search.ts +107 -0
- package/src/api-client/types/sync.ts +14 -0
- package/src/api-client/types/team-collections.ts +43 -0
- package/src/api-client/types/team-views.ts +32 -0
- package/src/api-client/types/teams.ts +135 -0
- package/src/api-client/types/ticker-data.ts +57 -0
- package/src/api-client/types/tweets.ts +59 -0
- package/src/api-client/types/world-venues.ts +23 -0
- package/src/app/pane-runtime/index.tsx +2 -0
- package/src/app/pane-runtime/plugin-bindings.ts +10 -1
- package/src/app/runtime/desktop-deeplink.ts +41 -6
- package/src/app/star-prompt/status-line.tsx +1 -1
- package/src/app.tsx +64 -23
- package/src/architecture/ui-tokens-allowlist.json +0 -8
- package/src/cli/commands/market.ts +149 -10
- package/src/cli/commands/search.ts +21 -3
- package/src/cli/commands/ticker.ts +90 -36
- package/src/cli/desktop-pane-shot-browser.ts +69 -3
- package/src/cli/glossary.ts +3 -3
- package/src/cli/known-gaps.ts +8 -0
- package/src/cli/listing-arg.ts +12 -0
- package/src/cli/pane-functions/capabilities.ts +2 -0
- package/src/cli/pane-functions/catalog.ts +25 -5
- package/src/cli/pane-functions/function-help.ts +8 -5
- package/src/cli/pane-functions/headless.ts +4 -3
- package/src/cli/pane-functions/resolver.ts +75 -2
- package/src/cli/quote-answer.ts +9 -0
- package/src/cli/symbol-list.ts +54 -2
- package/src/cli/symbol-rows.ts +14 -2
- package/src/cli/ticker-resolution.ts +89 -20
- package/src/components/chart/composite/axis-overlays.tsx +60 -27
- package/src/components/chart/composite/composite-chart.tsx +118 -63
- package/src/components/chart/composite/cursor-source.ts +111 -0
- package/src/components/chart/composite/format.ts +168 -6
- package/src/components/chart/composite/legend.tsx +8 -4
- package/src/components/chart/composite/panel-labels.ts +20 -1
- package/src/components/chart/composite/panel-surface.tsx +201 -92
- package/src/components/chart/composite/price-axis-labels.tsx +92 -46
- package/src/components/chart/composite/price-series.ts +31 -8
- package/src/components/chart/composite/scene.ts +154 -59
- package/src/components/chart/composite/series-axis-tags.tsx +4 -2
- package/src/components/chart/composite/time-axis.ts +13 -5
- package/src/components/chart/composite/time-scale.ts +211 -56
- package/src/components/chart/composite/types.ts +11 -1
- package/src/components/chart/composite/use-composite-chart-keyboard.ts +43 -14
- package/src/components/chart/curve/curve-surface.tsx +5 -2
- package/src/components/chart/curve/model.ts +4 -1
- package/src/components/chart/native/use-bitmap-metrics.ts +81 -0
- package/src/components/chart/static/series.ts +3 -0
- package/src/components/command-bar/commands/collection-list.ts +81 -0
- package/src/components/command-bar/commands/direct/index.ts +6 -0
- package/src/components/command-bar/commands/registry.ts +8 -0
- package/src/components/command-bar/layout-items/current-layout.ts +22 -1
- package/src/components/command-bar/layout-items/focused-pane.ts +22 -1
- package/src/components/command-bar/pane-templates/items.ts +19 -3
- package/src/components/command-bar/pane-templates/workflow.ts +5 -0
- package/src/components/command-bar/routes/root/results.ts +23 -3
- package/src/components/command-bar/routes/root/selection.ts +4 -2
- package/src/components/command-bar/routes/root/shortcut-feedback.ts +1 -1
- package/src/components/command-bar/routes/root/shortcut-items.ts +3 -4
- package/src/components/command-bar/routes/root/shortcuts.ts +58 -14
- package/src/components/command-bar/routes/root/ticker-first.ts +32 -0
- package/src/components/command-bar/surface/environment.ts +2 -0
- package/src/components/command-bar/view-model.ts +7 -0
- package/src/components/command-bar/workflow/ops.ts +2 -1
- package/src/components/command-bar/workflow/tickers.ts +20 -0
- package/src/components/data-table/export.ts +4 -1
- package/src/components/layout/detached-pane-shell.tsx +10 -37
- package/src/components/layout/double-escape-close.ts +90 -0
- package/src/components/layout/header.tsx +3 -2
- package/src/components/layout/market-summary.ts +6 -3
- package/src/components/layout/pane/footer/index.tsx +2 -6
- package/src/components/layout/pane/footer/model.ts +6 -12
- package/src/components/layout/shell/active-drag.ts +53 -11
- package/src/components/layout/shell/drag/magnets.ts +128 -19
- package/src/components/layout/shell/menu.ts +15 -1
- package/src/components/layout/shell/pane/actions.ts +10 -2
- package/src/components/layout/shell/pane/management-shortcuts.ts +13 -51
- package/src/components/layout/shell/ticker-link-menu.ts +12 -3
- package/src/components/layout/status-bar.tsx +24 -78
- package/src/components/layout/status-widget-space.ts +5 -5
- package/src/components/onboarding/onboarding-keyboard.ts +5 -1
- package/src/components/onboarding/onboarding-wizard.tsx +15 -4
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +9 -6
- package/src/components/onboarding/use-onboarding-progress.ts +20 -1
- package/src/components/price-sparkline/view.tsx +14 -6
- package/src/components/ticker/badge/index.tsx +8 -4
- package/src/components/ticker/badge/list.tsx +23 -7
- package/src/components/ui/column-grid.tsx +8 -2
- package/src/components/ui/data-table/index.tsx +5 -1
- package/src/components/ui/data-table/opentui/model.ts +4 -1
- package/src/components/ui/data-table/render-cell.ts +19 -0
- package/src/components/ui/delayed-mark.tsx +59 -7
- package/src/components/ui/icon.tsx +1 -8
- package/src/components/ui/menu.tsx +6 -1
- package/src/components/ui/tabs.tsx +5 -2
- package/src/core/state/app/layout.ts +18 -3
- package/src/core/state/app/state.ts +2 -0
- package/src/core/state/app/types.ts +5 -0
- package/src/data/config/layout.ts +3 -0
- package/src/data/config/store/normalize.ts +39 -4
- package/src/i18n/es.ts +13 -3
- package/src/i18n/ja.ts +13 -3
- package/src/i18n/ko.ts +13 -3
- package/src/i18n/zh-cn.ts +13 -3
- package/src/i18n/zh-tw.ts +13 -3
- package/src/layout/pane-manager/floating-placement.ts +7 -4
- package/src/layout/pane-manager/floating.ts +5 -2
- package/src/market-data/bond-funds.ts +19 -0
- package/src/market-data/futures-contract.ts +14 -3
- package/src/market-data/market/freshness.ts +18 -0
- package/src/market-data/market/status.ts +15 -2
- package/src/plugins/builtin/bond-calculator/headless.ts +2 -1
- package/src/plugins/builtin/bond-calculator/index.tsx +1 -1
- package/src/plugins/builtin/bond-calculator/model.ts +14 -5
- package/src/plugins/builtin/bond-calculator/pane.tsx +1 -1
- package/src/plugins/builtin/buildout/cells.tsx +25 -45
- package/src/plugins/builtin/buildout/detail/company.tsx +3 -3
- package/src/plugins/builtin/buildout/detail/index.tsx +1 -1
- package/src/plugins/builtin/buildout/detail/intel.tsx +4 -7
- package/src/plugins/builtin/buildout/detail/site.tsx +4 -4
- package/src/plugins/builtin/buildout/detail/ui.tsx +39 -38
- package/src/plugins/builtin/buildout/format.ts +23 -1
- package/src/plugins/builtin/buildout/model/types.ts +1 -0
- package/src/plugins/builtin/buildout/pane/index.tsx +2 -8
- package/src/plugins/builtin/buildout/table-model.ts +12 -4
- package/src/plugins/builtin/cds/headless.ts +1 -0
- package/src/plugins/builtin/cds/index.tsx +1 -1
- package/src/plugins/builtin/chat/content/composer.tsx +21 -27
- package/src/plugins/builtin/chat/content/index.tsx +31 -3
- package/src/plugins/builtin/chat/content/shortcuts.ts +4 -2
- package/src/plugins/builtin/chat/content/snapshot.ts +0 -3
- package/src/plugins/builtin/cloud/auth-actions.tsx +51 -23
- package/src/plugins/builtin/cloud/plugin.tsx +2 -0
- package/src/plugins/builtin/cloud/trial-offer-status-widget.tsx +3 -3
- package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +44 -12
- package/src/plugins/builtin/congress-trades/model.ts +2 -1
- package/src/plugins/builtin/congress-trades/pane.tsx +3 -0
- package/src/plugins/builtin/correlation/headless.ts +3 -2
- package/src/plugins/builtin/crypto-board/pane.tsx +5 -4
- package/src/plugins/builtin/custom-view/index.tsx +1 -1
- package/src/plugins/builtin/custom-view/loader.ts +85 -8
- package/src/plugins/builtin/custom-view/view-spec.ts +28 -0
- package/src/plugins/builtin/debt-maturities/headless.ts +11 -2
- package/src/plugins/builtin/debt-maturities/model.ts +66 -0
- package/src/plugins/builtin/debt-maturities/pane.tsx +23 -4
- package/src/plugins/builtin/earnings-ripple/pane.tsx +1 -1
- package/src/plugins/builtin/econ/calendar-model.ts +28 -6
- package/src/plugins/builtin/equity-screener/client.ts +1 -1
- package/src/plugins/builtin/equity-screener/criterion-editor.tsx +16 -19
- package/src/plugins/builtin/equity-screener/headless.ts +37 -3
- package/src/plugins/builtin/equity-screener/ideas.ts +67 -3
- package/src/plugins/builtin/equity-screener/model.ts +238 -27
- package/src/plugins/builtin/equity-screener/pane.tsx +88 -18
- package/src/plugins/builtin/equity-screener/screen-check.ts +7 -4
- package/src/plugins/builtin/equity-screener/watchlist.ts +33 -0
- package/src/plugins/builtin/executives/format.ts +5 -4
- package/src/plugins/builtin/executives/pane.tsx +1 -1
- package/src/plugins/builtin/futures-curve/client.ts +19 -0
- package/src/plugins/builtin/futures-curve/headless.ts +52 -13
- package/src/plugins/builtin/futures-curve/index.tsx +1 -1
- package/src/plugins/builtin/futures-curve/model.ts +77 -6
- package/src/plugins/builtin/futures-curve/pane.tsx +19 -3
- package/src/plugins/builtin/help/index.tsx +55 -1
- package/src/plugins/builtin/insider/model.ts +30 -2
- package/src/plugins/builtin/jobs/model.ts +2 -2
- package/src/plugins/builtin/macro-day/client.ts +41 -0
- package/src/plugins/builtin/macro-day/headless.ts +19 -9
- package/src/plugins/builtin/macro-day/model.ts +3 -1
- package/src/plugins/builtin/market-movers/index.tsx +4 -3
- package/src/plugins/builtin/mna/distress/headless.ts +1 -0
- package/src/plugins/builtin/mna/model.ts +2 -2
- package/src/plugins/builtin/notes/files.ts +2 -0
- package/src/plugins/builtin/notes/owner.tsx +20 -1
- package/src/plugins/builtin/notes/quick-notes-pane.tsx +22 -4
- package/src/plugins/builtin/notes/store.ts +6 -1
- package/src/plugins/builtin/perps/pane.tsx +3 -1
- package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +17 -0
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +2 -1
- package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +2 -1
- package/src/plugins/builtin/portfolio-list/header.tsx +1 -1
- package/src/plugins/builtin/rate-path/headless.ts +24 -10
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +29 -25
- package/src/plugins/builtin/research/event-model.ts +10 -3
- package/src/plugins/builtin/research/events-headless.ts +20 -2
- package/src/plugins/builtin/sec/fund-facts.ts +17 -1
- package/src/plugins/builtin/sec/index.tsx +1 -1
- package/src/plugins/builtin/series-inventory.ts +1 -0
- package/src/plugins/builtin/shared/earnings-report.ts +7 -2
- package/src/plugins/builtin/shared/members-menu.tsx +103 -38
- package/src/plugins/builtin/shared/use-quote-board.ts +85 -46
- package/src/plugins/builtin/short-interest/headless.ts +1 -1
- package/src/plugins/builtin/short-interest/model.ts +15 -6
- package/src/plugins/builtin/short-interest/publications-model.ts +22 -1
- package/src/plugins/builtin/short-interest/publications-pane.tsx +13 -4
- package/src/plugins/builtin/short-interest/types.ts +2 -0
- package/src/plugins/builtin/short-interest/watch-model.ts +1 -1
- package/src/plugins/builtin/thirteenf/overlap-pane.tsx +3 -0
- package/src/plugins/builtin/thirteenf/pane.tsx +3 -0
- package/src/plugins/builtin/ticker-detail/overview/model.ts +5 -3
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +4 -4
- package/src/plugins/builtin/time-sales/pane.tsx +3 -2
- package/src/plugins/builtin/trace-bonds/client.ts +7 -4
- package/src/plugins/builtin/trace-bonds/detail.tsx +198 -0
- package/src/plugins/builtin/trace-bonds/headless.ts +62 -4
- package/src/plugins/builtin/trace-bonds/history.ts +155 -0
- package/src/plugins/builtin/trace-bonds/index.tsx +1 -1
- package/src/plugins/builtin/trace-bonds/pane.tsx +64 -5
- package/src/plugins/builtin/volatility/client.ts +6 -1
- package/src/plugins/builtin/volatility/headless.ts +0 -1
- package/src/plugins/builtin/yield-curve/curves.ts +15 -0
- package/src/plugins/builtin/yield-curve/headless.ts +6 -1
- package/src/plugins/builtin/yield-curve/index.tsx +5 -8
- package/src/plugins/host-modules.ts +22 -3
- package/src/plugins/host-smoke.ts +6 -3
- package/src/plugins/installer.ts +16 -3
- package/src/plugins/plugin-names.ts +11 -2
- package/src/portfolio/collection-name.ts +19 -0
- package/src/remote/controller.ts +9 -2
- package/src/remote/schema.ts +2 -1
- package/src/renderers/browser/http-proxy-transport.ts +78 -8
- package/src/renderers/cloudflare/http-proxy.ts +73 -3
- package/src/renderers/cloudflare/proxy-session.ts +47 -24
- package/src/renderers/cloudflare/worker.ts +44 -4
- package/src/renderers/desktop/geometry.ts +279 -0
- package/src/renderers/desktop/screen-setup.ts +246 -0
- package/src/renderers/desktop/sequential-window-host.ts +179 -0
- package/src/renderers/desktop/test-utils.ts +71 -0
- package/src/renderers/desktop/window-controller.ts +433 -0
- package/src/renderers/desktop/window-host.ts +70 -0
- package/src/renderers/desktop/window-layouts.ts +630 -0
- package/src/renderers/dom/data-frames.ts +15 -4
- package/src/renderers/dom/desktop/icons.tsx +0 -2
- package/src/renderers/dom/styles.css +0 -3
- package/src/renderers/electrobun/bun/application-menu/click.ts +1 -0
- package/src/renderers/electrobun/bun/application-menu/index.ts +4 -1
- package/src/renderers/electrobun/bun/desktop/backend-requests.ts +19 -8
- package/src/renderers/electrobun/bun/desktop/backend.ts +320 -19
- package/src/renderers/electrobun/bun/desktop/detached-windows.ts +83 -61
- package/src/renderers/electrobun/bun/desktop/host-requests.ts +4 -14
- package/src/renderers/electrobun/bun/desktop/initialization.ts +30 -11
- package/src/renderers/electrobun/bun/desktop/install-records.ts +59 -0
- package/src/renderers/electrobun/bun/desktop/installer-folder.ts +208 -592
- package/src/renderers/electrobun/bun/desktop/macos-objc.ts +14 -0
- package/src/renderers/electrobun/bun/desktop/screen-setup-file.ts +55 -0
- package/src/renderers/electrobun/bun/desktop/state-broadcaster.ts +44 -8
- package/src/renderers/electrobun/bun/desktop/update.ts +1 -1
- package/src/renderers/electrobun/bun/desktop/workspace/index.ts +298 -97
- package/src/renderers/electrobun/bun/desktop/workspace/requests.ts +44 -6
- package/src/renderers/electrobun/bun/index.ts +22 -109
- package/src/renderers/electrobun/bun/window/create.ts +23 -3
- package/src/renderers/electrobun/bun/window/electrobun-window-host.ts +306 -0
- package/src/renderers/electrobun/bun/window/events.ts +4 -4
- package/src/renderers/electrobun/bun/window/focus.ts +0 -25
- package/src/renderers/electrobun/bun/window/frame.ts +2 -1
- package/src/renderers/electrobun/bun/window/native-min-size.ts +322 -0
- package/src/renderers/electrobun/bun/window/remembered-frame.ts +4 -82
- package/src/renderers/electrobun/shared/protocol.ts +44 -2
- package/src/renderers/electrobun/view/backend-rpc.ts +16 -1
- package/src/renderers/electrobun/view/desktop/window/bridge.ts +63 -3
- package/src/renderers/electrobun/view/main.tsx +13 -7
- package/src/series/fred-argument.ts +17 -0
- package/src/sources/gloomberb-cloud/index.ts +5 -7
- package/src/sources/provider-router/batches.ts +18 -3
- package/src/sources/provider-router/financial-routes.ts +7 -1
- package/src/sources/provider-router/financials.ts +18 -4
- package/src/state/app/context/index.tsx +16 -2
- package/src/state/desktop-windows.ts +63 -0
- package/src/sync/other-window-tabs.ts +62 -0
- package/src/tickers/company-name-listing.ts +23 -3
- package/src/tickers/listing-fate.ts +147 -1
- package/src/tickers/terminal-codes.ts +5 -0
- package/src/time-series/types.ts +6 -0
- package/src/types/config.ts +10 -1
- package/src/types/data-provider.ts +14 -0
- package/src/types/desktop-window.ts +71 -2
- package/src/types/financials.ts +19 -3
- package/src/types/headless.ts +21 -0
- package/src/types/plugin.ts +6 -0
- package/src/ui/index.tsx +14 -13
- package/src/ui/same-props.ts +58 -0
- package/src/utils/cli-output.ts +33 -4
- package/src/utils/double-escape-close.ts +38 -16
- package/src/utils/format.ts +30 -5
- package/src/utils/futures-generic.ts +12 -0
- package/src/utils/http-proxy-upstream.ts +6 -2
- package/src/utils/plugin-proxy-hosts.json +0 -4
- package/src/utils/plugin-proxy-hosts.ts +22 -0
- package/src/utils/price-earnings.ts +18 -0
- package/src/utils/sec-filings.ts +7 -1
- package/patches/electrobun@1.18.1.patch +0 -633
- package/src/api-client/types.ts +0 -2441
|
@@ -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
|
-
|
|
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(
|
|
301
|
-
detail={
|
|
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
|
/>
|
|
@@ -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
|
|
282
|
-
* case, spaces and
|
|
283
|
-
* Non-Farm Employment Change, `
|
|
284
|
-
*
|
|
285
|
-
* the
|
|
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 =
|
|
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
|
}
|
|
@@ -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, typedListName } from "./model";
|
|
17
17
|
|
|
18
18
|
export function CriterionEditor({
|
|
19
19
|
fields,
|
|
@@ -22,10 +22,14 @@ export function CriterionEditor({
|
|
|
22
22
|
onCancel,
|
|
23
23
|
focused,
|
|
24
24
|
width,
|
|
25
|
+
readWatchlist,
|
|
25
26
|
}: {
|
|
26
27
|
fields: ScreenFieldDefinition[];
|
|
27
28
|
value: ScreenCriterion | null;
|
|
28
|
-
|
|
29
|
+
/** One name typed for the symbol field, read as that watchlist's symbols with the note saying so, or null. */
|
|
30
|
+
readWatchlist?: (typed: string) => { symbols: readonly string[]; note: string } | null;
|
|
31
|
+
/** `note` says how a watchlist's name was read, as `fn EQS` says it. */
|
|
32
|
+
onSave: (criterion: ScreenCriterion, note: string | null) => void;
|
|
29
33
|
onCancel: () => void;
|
|
30
34
|
focused: boolean;
|
|
31
35
|
width: number;
|
|
@@ -40,13 +44,7 @@ export function CriterionEditor({
|
|
|
40
44
|
const [operator, setOperator] = useState<ScreenOperator>(
|
|
41
45
|
value?.op ?? field.operators[0]!,
|
|
42
46
|
);
|
|
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
|
-
);
|
|
47
|
+
const [text, setText] = useState(criterionInputText(value));
|
|
50
48
|
const [error, setError] = useState<string | null>(null);
|
|
51
49
|
const [active, setActive] = useState("field");
|
|
52
50
|
const fieldControl = useRef<SelectControl>(null),
|
|
@@ -58,9 +56,12 @@ export function CriterionEditor({
|
|
|
58
56
|
"save",
|
|
59
57
|
"cancel",
|
|
60
58
|
];
|
|
59
|
+
// A watchlist's name typed for the symbol list: what it reads as, before Save.
|
|
60
|
+
const listName = typedListName(field.id, operator, text);
|
|
61
|
+
const watchlistRead = listName ? readWatchlist?.(listName) ?? null : null;
|
|
61
62
|
const save = () => {
|
|
62
63
|
try {
|
|
63
|
-
onSave(parseCriterion(field, operator, text));
|
|
64
|
+
onSave(parseCriterion(field, operator, text, readWatchlist), watchlistRead?.note ?? null);
|
|
64
65
|
} catch (error) {
|
|
65
66
|
setError(error instanceof Error ? error.message : "Invalid criterion.");
|
|
66
67
|
}
|
|
@@ -138,23 +139,19 @@ export function CriterionEditor({
|
|
|
138
139
|
/>
|
|
139
140
|
{!["present", "missing"].includes(operator) ? (
|
|
140
141
|
<TextField
|
|
141
|
-
label={
|
|
142
|
+
label={criterionValueLabel(field)}
|
|
142
143
|
value={text}
|
|
143
144
|
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
|
-
}
|
|
145
|
+
placeholder={criterionValueHint(field, operator)}
|
|
151
146
|
width={Math.min(45, width - 4)}
|
|
152
147
|
focused={focused && active === "value"}
|
|
153
148
|
onMouseDown={() => setActive("value")}
|
|
154
149
|
onSubmit={save}
|
|
155
150
|
/>
|
|
156
151
|
) : null}
|
|
157
|
-
{error ? <Notice tone="negative">{error}</Notice>
|
|
152
|
+
{error ? <Notice tone="negative">{error}</Notice>
|
|
153
|
+
: watchlistRead ? <Notice tone="muted">{watchlistRead.note}</Notice>
|
|
154
|
+
: null}
|
|
158
155
|
<Box flexDirection="row" gap={1}>
|
|
159
156
|
<Button
|
|
160
157
|
label="Save criterion"
|
|
@@ -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 {
|
|
@@ -25,17 +25,21 @@ import {
|
|
|
25
25
|
unmatchedCategoryValues,
|
|
26
26
|
} from "./categories";
|
|
27
27
|
import { REPORT_ROWS } from "../shared/headless-options";
|
|
28
|
+
import { findNamedCollection, readWatchlistArgument } from "../../../portfolio/collection-name";
|
|
28
29
|
import {
|
|
29
30
|
appendScreenPage,
|
|
30
31
|
DEFAULT_SCREEN,
|
|
31
32
|
EXAMPLE_SCREEN_DEFINITION,
|
|
32
33
|
formatScreenMetric,
|
|
34
|
+
WATCHLIST_SCREEN_DEFINITION,
|
|
35
|
+
MAX_SYMBOL_VALUES,
|
|
33
36
|
metricDate,
|
|
34
37
|
parseScreenDefinition,
|
|
35
38
|
screenColumnLabel,
|
|
36
39
|
screenDefinitionSyntax,
|
|
37
40
|
screenCurrencyEmpty,
|
|
38
41
|
screenLabel,
|
|
42
|
+
screenSymbols,
|
|
39
43
|
screenYtdBase,
|
|
40
44
|
withheldMetricNote,
|
|
41
45
|
} from "./model";
|
|
@@ -45,6 +49,30 @@ import type { ScreenDefinition } from "../../../api-client/equity-screener";
|
|
|
45
49
|
const spacedJson = (definition: ScreenDefinition) =>
|
|
46
50
|
JSON.stringify(definition).replace(/([,:])(?=["{[\d-])/g, "$1 ");
|
|
47
51
|
|
|
52
|
+
/**
|
|
53
|
+
* A symbol criterion whose one value names a watchlist (`"value": ["HY3"]`)
|
|
54
|
+
* reads as the watchlist's symbols, at most a screen's 500, with the note
|
|
55
|
+
* that says so; any other criterion is left as it is.
|
|
56
|
+
*/
|
|
57
|
+
async function withWatchlistSymbols(
|
|
58
|
+
definition: ScreenDefinition,
|
|
59
|
+
ctx: Pick<HeadlessPaneContext, "config" | "resolveWatchlist">,
|
|
60
|
+
): Promise<{ definition: ScreenDefinition; notes: string[] }> {
|
|
61
|
+
const notes: string[] = [];
|
|
62
|
+
const criteria = await Promise.all(definition.criteria.map(async (criterion) => {
|
|
63
|
+
if (criterion.field !== "symbol" || criterion.op !== "in" || criterion.value.length !== 1) return criterion;
|
|
64
|
+
const typed = criterion.value[0]!;
|
|
65
|
+
const watchlist = findNamedCollection(ctx.config.watchlists, typed);
|
|
66
|
+
if (!watchlist || !ctx.resolveWatchlist) return criterion;
|
|
67
|
+
const members = screenSymbols(((await ctx.resolveWatchlist(typed)) ?? []).map((ticker) => ticker.metadata.ticker));
|
|
68
|
+
if (members.length === 0) return criterion;
|
|
69
|
+
const read = readWatchlistArgument(typed, watchlist, members, MAX_SYMBOL_VALUES);
|
|
70
|
+
notes.push(read.note);
|
|
71
|
+
return { ...criterion, value: read.symbols };
|
|
72
|
+
}));
|
|
73
|
+
return notes.length ? { definition: { ...definition, criteria }, notes } : { definition, notes };
|
|
74
|
+
}
|
|
75
|
+
|
|
48
76
|
/** The `--definition` value of the catalog's worked example, quoted for a shell. */
|
|
49
77
|
const EXAMPLE_DEFINITION_OPTION = `--definition '${spacedJson(EXAMPLE_SCREEN_DEFINITION)}'`;
|
|
50
78
|
|
|
@@ -207,6 +235,7 @@ export const equityScreenerHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
207
235
|
placeholder: "json",
|
|
208
236
|
description: screenDefinitionSyntax(),
|
|
209
237
|
example: EXAMPLE_DEFINITION_OPTION,
|
|
238
|
+
examples: [`--definition '${spacedJson(WATCHLIST_SCREEN_DEFINITION)}'`],
|
|
210
239
|
normalize: (value) => {
|
|
211
240
|
readDefinition(value);
|
|
212
241
|
return value;
|
|
@@ -252,6 +281,8 @@ export const equityScreenerHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
252
281
|
"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
282
|
"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
283
|
"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.",
|
|
284
|
+
"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.",
|
|
285
|
+
"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
286
|
],
|
|
256
287
|
},
|
|
257
288
|
async load(args, ctx) {
|
|
@@ -273,12 +304,15 @@ export const equityScreenerHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
273
304
|
definition = matches[0]!.definition;
|
|
274
305
|
savedName = matches[0]!.name;
|
|
275
306
|
}
|
|
307
|
+
const watchlistRead = await withWatchlistSymbols(definition, ctx);
|
|
308
|
+
definition = watchlistRead.definition;
|
|
276
309
|
if (args.options.check) {
|
|
277
310
|
const data = await fetchScreenCheck(definition, String(args.options.check), undefined, ctx.signal, ctx.apiClient);
|
|
278
311
|
return {
|
|
279
312
|
freshness: { asOf: data.snapshot.assembledAt },
|
|
280
313
|
complete: data.status === "available" && data.warnings.length === 0,
|
|
281
314
|
errors: data.warnings,
|
|
315
|
+
...(watchlistRead.notes.length ? { notes: watchlistRead.notes } : {}),
|
|
282
316
|
sections: data.criteria.length === 0 ? [{
|
|
283
317
|
title: data.row ? `${data.row.symbol}:${data.row.exchange}` : data.symbol,
|
|
284
318
|
entries: [{ label: "Result", value: screenCheckSummary(data) }],
|
|
@@ -303,7 +337,7 @@ export const equityScreenerHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
303
337
|
}
|
|
304
338
|
const limit = typeof args.options.limit === "number" ? args.options.limit : SCREEN_PAGE_ROWS;
|
|
305
339
|
const data = await fetchScreenRows(definition, limit, ctx);
|
|
306
|
-
const metrics = readMetrics(args.options.metric == null ? preset
|
|
340
|
+
const metrics = readMetrics(args.options.metric == null ? preset ? ideaMetricSetting(preset) : "marketCap" : String(args.options.metric));
|
|
307
341
|
const metric = metrics[0]!;
|
|
308
342
|
// Last, Chg% and market cap are the regular session, as `quote` and the
|
|
309
343
|
// pane read each row's quote; an extended print is a column of its own.
|
|
@@ -336,7 +370,7 @@ export const equityScreenerHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
336
370
|
const extra = extraScreenColumns(metrics, data.definition.sort.field);
|
|
337
371
|
const states = new Set(rows.map((row) => row.metrics[metric].state));
|
|
338
372
|
const legend = STATE_LEGEND.filter(({ state }) => states.has(state)).map(({ text }) => text);
|
|
339
|
-
const notes = [...kpiGaps, ...legend];
|
|
373
|
+
const notes = [...watchlistRead.notes, ...kpiGaps, ...legend];
|
|
340
374
|
// Payload status also counts ordinary per-field sparsity; only generation
|
|
341
375
|
// warnings are failures, and more pages are not an error.
|
|
342
376
|
return {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import type
|
|
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
|
|
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);
|