gloomberb 0.15.7 → 0.16.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/README.md +11 -2
- package/package.json +1 -1
- package/src/api-client/app-attention.ts +147 -0
- package/src/api-client/attention.ts +26 -0
- package/src/api-client/awards.ts +215 -0
- package/src/api-client/catalysts.ts +160 -0
- package/src/api-client/chat.ts +137 -14
- package/src/api-client/company-kpis.ts +153 -0
- package/src/api-client/cpi.ts +52 -0
- package/src/api-client/credit-documents.ts +107 -0
- package/src/api-client/data.ts +192 -3
- package/src/api-client/distress.ts +164 -0
- package/src/api-client/doe.ts +75 -0
- package/src/api-client/equity-screener.ts +11 -0
- package/src/api-client/exposure.ts +202 -0
- package/src/api-client/gpu.ts +93 -0
- package/src/api-client/hiring.ts +110 -0
- package/src/api-client/index.ts +78 -3
- package/src/api-client/normalizers.ts +31 -1
- package/src/api-client/paths.ts +3 -0
- package/src/api-client/perps.ts +127 -0
- package/src/api-client/power.ts +148 -0
- package/src/api-client/request.ts +58 -1
- package/src/api-client/research-activity.ts +172 -13
- package/src/api-client/socket.ts +75 -27
- package/src/api-client/supply-chain-graph.ts +40 -0
- package/src/api-client/supply-chain.ts +98 -0
- package/src/api-client/telemetry.ts +29 -0
- package/src/api-client/themes.ts +28 -0
- package/src/api-client/types.ts +33 -1
- package/src/api-client/wall-experiments.ts +100 -0
- package/src/api-client/wall-summary.ts +49 -0
- package/src/api-client/web-experiments.ts +136 -0
- package/src/app/pane-runtime/plugin-bindings.ts +5 -0
- package/src/app/pane-runtime/ticker-open-runtime.ts +8 -2
- package/src/app/runtime/update.ts +13 -1
- package/src/cli/commands/system.ts +2 -0
- package/src/cli/desktop-pane-shot.ts +3 -4
- package/src/cli/pane-functions/data.ts +78 -0
- package/src/cli/pane-functions/financial-ratio-shot.ts +160 -0
- package/src/cli/pane-functions/function-help.ts +220 -8
- package/src/cli/pane-functions/headless.ts +4 -0
- package/src/cli/pane-functions/screenshot-evidence.ts +21 -0
- package/src/cli/pane-functions/screenshot.ts +49 -5
- package/src/components/chart/composite/composite-chart.tsx +15 -2
- package/src/components/chart/composite/format.ts +24 -11
- package/src/components/chart/composite/rasterizer.ts +67 -16
- package/src/components/chart/composite/scene.ts +53 -2
- package/src/components/chart/composite/session-shading.ts +3 -2
- package/src/components/chart/composite/text-renderer.ts +52 -1
- package/src/components/chart/composite/time-axis.ts +100 -30
- package/src/components/chart/composite/tools.ts +2 -1
- package/src/components/chart/composite/types.ts +4 -0
- package/src/components/chart-table/index.ts +1 -0
- package/src/components/chart-table/layout.ts +15 -0
- package/src/components/command-bar/action-runtime.ts +1 -0
- package/src/components/command-bar/commands/direct/index.ts +32 -0
- package/src/components/command-bar/commands/registry.ts +7 -0
- package/src/components/command-bar/pane-templates/items.ts +11 -0
- package/src/components/command-bar/pane-templates/workflow.ts +19 -4
- package/src/components/command-bar/routes/root/command-items.ts +6 -0
- package/src/components/command-bar/routes/root/provider-search.ts +2 -0
- package/src/components/command-bar/routes/root/results.ts +64 -0
- package/src/components/command-bar/routes/root/runtime.ts +8 -0
- package/src/components/command-bar/routes/ticker-search/results.ts +89 -24
- package/src/components/command-bar/routes/ticker-search/route.ts +2 -0
- package/src/components/command-bar/surface/index.tsx +15 -0
- package/src/components/command-bar/view-model.ts +3 -0
- package/src/components/command-bar/workflow/collection-actions.ts +9 -7
- package/src/components/command-bar/workflow/ops.ts +19 -0
- package/src/components/command-bar/workflow/tickers.ts +5 -0
- package/src/components/company-logo.tsx +15 -2
- package/src/components/data-table/table-pane.ts +2 -1
- package/src/components/index.ts +1 -0
- package/src/components/layout/detached-pane-shell.tsx +12 -1
- package/src/components/layout/missing-pane.tsx +87 -23
- package/src/components/layout/pane/footer/index.tsx +64 -18
- package/src/components/layout/pane/footer/model.ts +85 -0
- package/src/components/layout/pane/sidebar.tsx +19 -1
- package/src/components/layout/shell/index.tsx +38 -28
- package/src/components/layout/shell/pane/management-shortcuts.ts +13 -1
- package/src/components/layout/status-bar.tsx +93 -28
- package/src/components/layout/status-widget-space.ts +72 -0
- package/src/components/onboarding/first-run-workspace.ts +8 -2
- package/src/components/onboarding/onboarding-wizard.tsx +35 -16
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +14 -5
- package/src/components/onboarding/wizard-model.ts +13 -5
- package/src/components/onboarding/wizard-positions.ts +56 -7
- package/src/components/price-performance.tsx +31 -34
- package/src/components/ui/data-table/index.tsx +11 -8
- package/src/components/ui/display.tsx +15 -6
- package/src/components/ui/fields.tsx +5 -0
- package/src/components/ui/figure.tsx +94 -0
- package/src/components/ui/header-case.ts +25 -3
- package/src/components/ui/icon.tsx +3 -1
- package/src/components/ui/message-composer.tsx +8 -1
- package/src/components/ui/query-bar.tsx +8 -1
- package/src/components/ui/ratio-bar.tsx +84 -0
- package/src/components/ui/toggle.tsx +3 -1
- package/src/components/use-scrollbox-layout.ts +17 -0
- package/src/core/state/app/layout.ts +35 -1
- package/src/core/state/app/state.ts +15 -0
- package/src/core/state/app/types.ts +1 -0
- package/src/data/config/store/normalize.ts +24 -0
- package/src/i18n/es.ts +2 -0
- package/src/i18n/ja.ts +2 -0
- package/src/i18n/ko.ts +2 -0
- package/src/i18n/zh-cn.ts +2 -0
- package/src/i18n/zh-tw.ts +2 -0
- package/src/layout-marketplace/pane-imagery.ts +1 -0
- package/src/market-data/coordinator/entries.ts +13 -0
- package/src/market-data/coordinator/financials.ts +33 -8
- package/src/market-data/market/freshness.ts +16 -5
- package/src/market-data/market/trading-sessions.ts +65 -1
- package/src/market-data/published-cn-sessions.ts +25 -0
- package/src/market-data/published-nse-sessions.ts +20 -0
- package/src/news/aggregator.ts +4 -0
- package/src/plugins/builtin/account-management/model.ts +6 -1
- package/src/plugins/builtin/account-management/pane.tsx +36 -25
- package/src/plugins/builtin/alerts/catalysts.ts +77 -0
- package/src/plugins/builtin/alerts/events-pane.tsx +3 -0
- package/src/plugins/builtin/alerts/events.ts +10 -4
- package/src/plugins/builtin/alerts/history-pane.tsx +1 -1
- package/src/plugins/builtin/alerts/history.ts +1 -0
- package/src/plugins/builtin/alerts/index.tsx +6 -0
- package/src/plugins/builtin/alerts/research-builder.ts +10 -3
- package/src/plugins/builtin/alerts/research-rules.ts +15 -1
- package/src/plugins/builtin/analytics/risk-client.ts +15 -3
- package/src/plugins/builtin/analytics/risk-headless.ts +123 -18
- package/src/plugins/builtin/attention/client.ts +80 -0
- package/src/plugins/builtin/attention/evidence.ts +30 -0
- package/src/plugins/builtin/attention/headless.ts +33 -0
- package/src/plugins/builtin/attention/index.tsx +18 -0
- package/src/plugins/builtin/attention/model.ts +59 -0
- package/src/plugins/builtin/attention/pane.tsx +211 -0
- package/src/plugins/builtin/attention/trending.tsx +59 -0
- package/src/plugins/builtin/awards/alerts.ts +32 -0
- package/src/plugins/builtin/awards/client.ts +82 -0
- package/src/plugins/builtin/awards/detail.tsx +107 -0
- package/src/plugins/builtin/awards/evidence.ts +36 -0
- package/src/plugins/builtin/awards/headless.ts +55 -0
- package/src/plugins/builtin/awards/index.tsx +20 -0
- package/src/plugins/builtin/awards/model.ts +42 -0
- package/src/plugins/builtin/awards/pane.tsx +263 -0
- package/src/plugins/builtin/catalysts/client.ts +28 -0
- package/src/plugins/builtin/catalysts/detail.tsx +88 -0
- package/src/plugins/builtin/catalysts/evidence.ts +47 -0
- package/src/plugins/builtin/catalysts/headless.ts +42 -0
- package/src/plugins/builtin/catalysts/history.ts +26 -0
- package/src/plugins/builtin/catalysts/index.tsx +29 -0
- package/src/plugins/builtin/catalysts/model.ts +135 -0
- package/src/plugins/builtin/catalysts/pane.tsx +159 -0
- package/src/plugins/builtin/chart-composer/cli-options.ts +4 -0
- package/src/plugins/builtin/chart-composer/headless-schema.ts +6 -0
- package/src/plugins/builtin/chart-composer/index.tsx +8 -1
- package/src/plugins/builtin/chart-composer/pane.tsx +28 -1
- package/src/plugins/builtin/chat/attachments/desktop.tsx +610 -0
- package/src/plugins/builtin/chat/attachments/files.ts +45 -0
- package/src/plugins/builtin/chat/attachments/model.ts +164 -0
- package/src/plugins/builtin/chat/attachments/terminal.tsx +72 -0
- package/src/plugins/builtin/chat/attachments/transfer.ts +165 -0
- package/src/plugins/builtin/chat/content/channel-navigation.ts +13 -12
- package/src/plugins/builtin/chat/content/composer-runtime.ts +25 -4
- package/src/plugins/builtin/chat/content/composer.tsx +46 -4
- package/src/plugins/builtin/chat/content/footer.tsx +46 -8
- package/src/plugins/builtin/chat/content/index.tsx +263 -62
- package/src/plugins/builtin/chat/content/layout-metrics.ts +10 -2
- package/src/plugins/builtin/chat/content/open-targets.ts +17 -3
- package/src/plugins/builtin/chat/content/scroll.ts +7 -1
- package/src/plugins/builtin/chat/content/shortcuts.ts +36 -11
- package/src/plugins/builtin/chat/content/snapshot.ts +3 -0
- package/src/plugins/builtin/chat/content/transcript.tsx +17 -1
- package/src/plugins/builtin/chat/content/types.ts +7 -0
- package/src/plugins/builtin/chat/controller/attachments.ts +213 -0
- package/src/plugins/builtin/chat/controller/connections.ts +3 -1
- package/src/plugins/builtin/chat/controller/index.ts +114 -2
- package/src/plugins/builtin/chat/controller/lifecycle.ts +9 -0
- package/src/plugins/builtin/chat/controller/messages.ts +35 -2
- package/src/plugins/builtin/chat/controller/send.ts +128 -25
- package/src/plugins/builtin/chat/controller/state.ts +12 -1
- package/src/plugins/builtin/chat/controller/utils.ts +7 -5
- package/src/plugins/builtin/chat/controller/view.ts +2 -0
- package/src/plugins/builtin/chat/index.tsx +21 -0
- package/src/plugins/builtin/chat/layout.ts +9 -4
- package/src/plugins/builtin/chat/message/desktop.tsx +55 -20
- package/src/plugins/builtin/chat/message/header.tsx +30 -5
- package/src/plugins/builtin/chat/message/inline-tokens.tsx +9 -0
- package/src/plugins/builtin/chat/message/pending-send.ts +35 -0
- package/src/plugins/builtin/chat/message/profile-popover.tsx +5 -1
- package/src/plugins/builtin/chat/message/render-state.ts +12 -2
- package/src/plugins/builtin/chat/message/terminal.tsx +51 -4
- package/src/plugins/builtin/chat/message/types.ts +6 -1
- package/src/plugins/builtin/chat/pane-state.ts +59 -1
- package/src/plugins/builtin/chat/profile-popover.ts +50 -1
- package/src/plugins/builtin/chat/sidebar.tsx +8 -3
- package/src/plugins/builtin/chat/status-widget.tsx +29 -12
- package/src/plugins/builtin/chat/unread-inbox-pane.tsx +143 -0
- package/src/plugins/builtin/chat/unread-inbox.ts +91 -0
- package/src/plugins/builtin/clinical-trials/client.ts +237 -0
- package/src/plugins/builtin/clinical-trials/index.tsx +74 -0
- package/src/plugins/builtin/clinical-trials/pane.tsx +225 -0
- package/src/plugins/builtin/clinical-trials/types.ts +2 -0
- package/src/plugins/builtin/cloud/askg/controller.ts +37 -6
- package/src/plugins/builtin/cloud/askg/executor.ts +59 -44
- package/src/plugins/builtin/cloud/askg/host.ts +8 -1
- package/src/plugins/builtin/cloud/askg/manifest.ts +29 -2
- package/src/plugins/builtin/cloud/askg/model.ts +47 -13
- package/src/plugins/builtin/cloud/askg/notes.ts +100 -0
- package/src/plugins/builtin/cloud/askg/pane.tsx +50 -14
- package/src/plugins/builtin/cloud/askg/protocol.ts +39 -1
- package/src/plugins/builtin/cloud/askg/result-budget.ts +156 -0
- package/src/plugins/builtin/cloud/askg/user-data.ts +89 -0
- package/src/plugins/builtin/cloud/auth-actions.tsx +55 -31
- package/src/plugins/builtin/cloud/plugin.tsx +4 -1
- package/src/plugins/builtin/cloud/team/pane-sections.tsx +10 -1
- package/src/plugins/builtin/cloud/team/pane.tsx +3 -2
- package/src/plugins/builtin/cloud/thesis/board-pane.tsx +2 -2
- package/src/plugins/builtin/cloud/thesis/detail.tsx +1 -1
- package/src/plugins/builtin/cloud/thesis/ticker-tab.tsx +2 -2
- package/src/plugins/builtin/cloud/trial-offer-status-widget.tsx +202 -0
- package/src/plugins/builtin/cloud/upgrade-command.ts +1 -1
- package/src/plugins/builtin/cloud/upgrade-dialog.tsx +29 -3
- package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +1 -1
- package/src/plugins/builtin/cloud-tweets/table.tsx +1 -1
- package/src/plugins/builtin/comment-letters/client.ts +342 -0
- package/src/plugins/builtin/comment-letters/index.tsx +74 -0
- package/src/plugins/builtin/comment-letters/pane.tsx +295 -0
- package/src/plugins/builtin/comment-letters/types.ts +43 -0
- package/src/plugins/builtin/company-attention/app-rank.tsx +79 -0
- package/src/plugins/builtin/company-attention/client.ts +69 -0
- package/src/plugins/builtin/company-attention/evidence.ts +45 -0
- package/src/plugins/builtin/company-attention/headless.ts +47 -0
- package/src/plugins/builtin/company-attention/index.tsx +30 -0
- package/src/plugins/builtin/company-attention/model.ts +129 -0
- package/src/plugins/builtin/company-attention/pane.tsx +183 -0
- package/src/plugins/builtin/company-kpis/client.ts +92 -0
- package/src/plugins/builtin/company-kpis/headless.ts +32 -0
- package/src/plugins/builtin/company-kpis/index.tsx +26 -0
- package/src/plugins/builtin/company-kpis/model.ts +124 -0
- package/src/plugins/builtin/company-kpis/pane.tsx +226 -0
- package/src/plugins/builtin/company-kpis/related.ts +11 -0
- package/src/plugins/builtin/company-kpis/screenshot-evidence.ts +44 -0
- package/src/plugins/builtin/composite-plugins.ts +34 -0
- package/src/plugins/builtin/correlation/history.ts +4 -1
- package/src/plugins/builtin/correlation/index.tsx +139 -80
- package/src/plugins/builtin/correlation/matrix/pair-chart.tsx +48 -0
- package/src/plugins/builtin/correlation/matrix/selection.ts +77 -0
- package/src/plugins/builtin/correlation/relationship/model.ts +2 -2
- package/src/plugins/builtin/cpi/client.ts +66 -0
- package/src/plugins/builtin/cpi/headless.ts +78 -0
- package/src/plugins/builtin/cpi/index.tsx +31 -0
- package/src/plugins/builtin/cpi/model.ts +198 -0
- package/src/plugins/builtin/cpi/pane.tsx +157 -0
- package/src/plugins/builtin/credit-documents/client.ts +99 -0
- package/src/plugins/builtin/credit-documents/detail.tsx +109 -0
- package/src/plugins/builtin/credit-documents/evidence.ts +64 -0
- package/src/plugins/builtin/credit-documents/gauge.tsx +55 -0
- package/src/plugins/builtin/credit-documents/headless.ts +40 -0
- package/src/plugins/builtin/credit-documents/index.tsx +19 -0
- package/src/plugins/builtin/credit-documents/model.ts +336 -0
- package/src/plugins/builtin/credit-documents/pane.tsx +185 -0
- package/src/plugins/builtin/custom-view/view-spec.ts +14 -2
- package/src/plugins/builtin/debt-maturities/pane.tsx +1 -0
- package/src/plugins/builtin/dividend-yield/pane.tsx +1 -1
- package/src/plugins/builtin/doe/client.ts +73 -0
- package/src/plugins/builtin/doe/headless.ts +93 -0
- package/src/plugins/builtin/doe/index.tsx +41 -0
- package/src/plugins/builtin/doe/model.ts +215 -0
- package/src/plugins/builtin/doe/pane.tsx +148 -0
- package/src/plugins/builtin/doe/range-bar.tsx +45 -0
- package/src/plugins/builtin/earnings/board.tsx +3 -0
- package/src/plugins/builtin/earnings/index.tsx +2 -0
- package/src/plugins/builtin/earnings-calls/pane.tsx +7 -1
- package/src/plugins/builtin/earnings-calls/transcript-view.tsx +7 -7
- package/src/plugins/builtin/earnings-ripple/client.ts +60 -0
- package/src/plugins/builtin/earnings-ripple/headless.ts +35 -0
- package/src/plugins/builtin/earnings-ripple/index.tsx +35 -0
- package/src/plugins/builtin/earnings-ripple/model.ts +98 -0
- package/src/plugins/builtin/earnings-ripple/pane.tsx +103 -0
- package/src/plugins/builtin/equity-screener/client.ts +1 -1
- package/src/plugins/builtin/equity-screener/criterion-editor.tsx +1 -1
- package/src/plugins/builtin/equity-screener/model.ts +74 -9
- package/src/plugins/builtin/equity-screener/pane.tsx +2 -0
- package/src/plugins/builtin/estimate-revisions/pane.tsx +3 -0
- package/src/plugins/builtin/executives/pane.tsx +7 -5
- package/src/plugins/builtin/exposure/charts.tsx +66 -0
- package/src/plugins/builtin/exposure/client.ts +53 -0
- package/src/plugins/builtin/exposure/drivers.ts +29 -0
- package/src/plugins/builtin/exposure/editor.tsx +61 -0
- package/src/plugins/builtin/exposure/evidence.ts +39 -0
- package/src/plugins/builtin/exposure/headless.ts +51 -0
- package/src/plugins/builtin/exposure/holdings.ts +56 -0
- package/src/plugins/builtin/exposure/index.tsx +13 -0
- package/src/plugins/builtin/exposure/model.ts +104 -0
- package/src/plugins/builtin/exposure/pane.tsx +247 -0
- package/src/plugins/builtin/fear-greed/charts.tsx +1 -1
- package/src/plugins/builtin/fear-greed/pane.tsx +2 -9
- package/src/plugins/builtin/filing-events/pane.tsx +2 -1
- package/src/plugins/builtin/gpu/board.tsx +163 -0
- package/src/plugins/builtin/gpu/changes.tsx +94 -0
- package/src/plugins/builtin/gpu/client.ts +130 -0
- package/src/plugins/builtin/gpu/equities.tsx +112 -0
- package/src/plugins/builtin/gpu/headless.ts +67 -0
- package/src/plugins/builtin/gpu/history.tsx +140 -0
- package/src/plugins/builtin/gpu/index.tsx +18 -0
- package/src/plugins/builtin/gpu/ladder.tsx +127 -0
- package/src/plugins/builtin/gpu/model.ts +317 -0
- package/src/plugins/builtin/gpu/pane.tsx +63 -0
- package/src/plugins/builtin/help/index.tsx +19 -2
- package/src/plugins/builtin/holders/pane.tsx +5 -9
- package/src/plugins/builtin/insider/detail.tsx +119 -0
- package/src/plugins/builtin/insider/display.ts +221 -0
- package/src/plugins/builtin/insider/headless.ts +24 -3
- package/src/plugins/builtin/insider/index.tsx +206 -108
- package/src/plugins/builtin/insider/insider-data.ts +31 -3
- package/src/plugins/builtin/insider/model.ts +53 -4
- package/src/plugins/builtin/insider/table-model.ts +226 -0
- package/src/plugins/builtin/insider/table.tsx +79 -0
- package/src/plugins/builtin/iv-history/screen-pane.tsx +1 -1
- package/src/plugins/builtin/jobs/pane.tsx +14 -7
- package/src/plugins/builtin/kelly-sizer/pane.tsx +1 -1
- package/src/plugins/builtin/macro-day/client.ts +50 -0
- package/src/plugins/builtin/macro-day/headless.ts +51 -0
- package/src/plugins/builtin/macro-day/index.tsx +21 -0
- package/src/plugins/builtin/macro-day/model.ts +137 -0
- package/src/plugins/builtin/macro-day/pane.tsx +118 -0
- package/src/plugins/builtin/macro-day/releases.ts +58 -0
- package/src/plugins/builtin/market-halts/model.ts +30 -17
- package/src/plugins/builtin/market-halts/pane.tsx +15 -21
- package/src/plugins/builtin/market-heatmap/data.ts +1 -1
- package/src/plugins/builtin/market-heatmap/index.tsx +198 -50
- package/src/plugins/builtin/market-heatmap/portfolio.ts +220 -0
- package/src/plugins/builtin/market-movers/index.tsx +1 -0
- package/src/plugins/builtin/market-movers/session-body.tsx +5 -2
- package/src/plugins/builtin/mna/distress/client.ts +326 -0
- package/src/plugins/builtin/mna/distress/detail.tsx +247 -0
- package/src/plugins/builtin/mna/distress/headless.ts +257 -0
- package/src/plugins/builtin/mna/distress/model.ts +427 -0
- package/src/plugins/builtin/mna/distress/pane.tsx +606 -0
- package/src/plugins/builtin/mna/index.tsx +15 -0
- package/src/plugins/builtin/mna/pane.tsx +42 -1
- package/src/plugins/builtin/news/index.tsx +62 -16
- package/src/plugins/builtin/news/wire/filter-articles.ts +54 -0
- package/src/plugins/builtin/news/wire/index.tsx +37 -3
- package/src/plugins/builtin/news/wire/industry-pane.tsx +29 -13
- package/src/plugins/builtin/news/wire/mutes.ts +253 -0
- package/src/plugins/builtin/news/wire/news/command-bar-search.ts +117 -0
- package/src/plugins/builtin/news/wire/news/footer.ts +4 -0
- package/src/plugins/builtin/news/wire/news/list-search.ts +34 -0
- package/src/plugins/builtin/news/wire/news/pop-out.tsx +158 -0
- package/src/plugins/builtin/news/wire/news/preset-pane.tsx +64 -19
- package/src/plugins/builtin/openfda/client.ts +300 -0
- package/src/plugins/builtin/openfda/index.tsx +71 -0
- package/src/plugins/builtin/openfda/pane.tsx +382 -0
- package/src/plugins/builtin/openfda/types.ts +76 -0
- package/src/plugins/builtin/options/footer.ts +1 -0
- package/src/plugins/builtin/options/view.tsx +1 -1
- package/src/plugins/builtin/options-calculator/pane.tsx +0 -1
- package/src/plugins/builtin/options-positioning/index.tsx +4 -2
- package/src/plugins/builtin/options-positioning/pane.tsx +1 -1
- package/src/plugins/builtin/pe-band/client.ts +61 -0
- package/src/plugins/builtin/pe-band/headless.ts +51 -0
- package/src/plugins/builtin/pe-band/index.tsx +20 -0
- package/src/plugins/builtin/pe-band/model.ts +267 -0
- package/src/plugins/builtin/pe-band/pane.tsx +159 -0
- package/src/plugins/builtin/perps/client.ts +66 -0
- package/src/plugins/builtin/perps/equity-row.tsx +28 -0
- package/src/plugins/builtin/perps/headless.ts +34 -0
- package/src/plugins/builtin/perps/index.tsx +14 -0
- package/src/plugins/builtin/perps/model.ts +58 -0
- package/src/plugins/builtin/perps/pane.tsx +185 -0
- package/src/plugins/builtin/plugin-marketplace/pane.tsx +0 -1
- package/src/plugins/builtin/portfolio-list/cli/render.ts +177 -87
- package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +6 -20
- package/src/plugins/builtin/portfolio-list/command-bar.ts +6 -2
- package/src/plugins/builtin/portfolio-list/headless.ts +237 -0
- package/src/plugins/builtin/portfolio-list/index.tsx +2 -0
- package/src/plugins/builtin/portfolio-list/mutations.ts +70 -1
- package/src/plugins/builtin/portfolio-list/pane/data.ts +17 -0
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +88 -5
- package/src/plugins/builtin/portfolio-list/pane/remove-ticker.ts +85 -0
- package/src/plugins/builtin/portfolio-list/pane/streaming.ts +18 -12
- package/src/plugins/builtin/portfolio-list/quick-add/index.tsx +6 -0
- package/src/plugins/builtin/power/client.ts +100 -0
- package/src/plugins/builtin/power/detail.tsx +82 -0
- package/src/plugins/builtin/power/evidence.ts +56 -0
- package/src/plugins/builtin/power/generation.tsx +37 -0
- package/src/plugins/builtin/power/headless.ts +43 -0
- package/src/plugins/builtin/power/index.tsx +16 -0
- package/src/plugins/builtin/power/model.ts +89 -0
- package/src/plugins/builtin/power/pane.tsx +209 -0
- package/src/plugins/builtin/power/query.ts +25 -0
- package/src/plugins/builtin/relative-rotation/pane.tsx +3 -3
- package/src/plugins/builtin/research/analyst-pane.tsx +1 -1
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +13 -4
- package/src/plugins/builtin/research/equity-diagnostic-pane.tsx +11 -9
- package/src/plugins/builtin/research-search/pane.tsx +21 -7
- package/src/plugins/builtin/revenue-breakdown/pane.tsx +1 -1
- package/src/plugins/builtin/reverse-dcf/client.ts +35 -0
- package/src/plugins/builtin/reverse-dcf/headless.ts +44 -0
- package/src/plugins/builtin/reverse-dcf/index.tsx +20 -0
- package/src/plugins/builtin/reverse-dcf/model.ts +87 -0
- package/src/plugins/builtin/reverse-dcf/pane.tsx +107 -0
- package/src/plugins/builtin/risk-factors/pane.tsx +6 -5
- package/src/plugins/builtin/scanner/denied.tsx +4 -2
- package/src/plugins/builtin/scanner/feed.ts +1 -0
- package/src/plugins/builtin/scanner/flow-pane.tsx +3 -2
- package/src/plugins/builtin/scanner/hilo-pane.tsx +1 -1
- package/src/plugins/builtin/seasonality/client.ts +4 -1
- package/src/plugins/builtin/sec/command-bar-search.ts +217 -0
- package/src/plugins/builtin/sec/forms.ts +54 -0
- package/src/plugins/builtin/sec/headless.ts +31 -5
- package/src/plugins/builtin/sec/index.tsx +67 -11
- package/src/plugins/builtin/sec/model.ts +35 -5
- package/src/plugins/builtin/sectors/headless.ts +1 -0
- package/src/plugins/builtin/sectors/index.tsx +72 -26
- package/src/plugins/builtin/shared/cloud-upgrade.ts +143 -39
- package/src/plugins/builtin/shared/pro-feature-wall.tsx +8 -4
- package/src/plugins/builtin/shared/research-cells.tsx +107 -0
- package/src/plugins/builtin/shared/series-list-detail.tsx +5 -1
- package/src/plugins/builtin/shared/ticker-request.ts +1 -1
- package/src/plugins/builtin/shared/wall-teaser-catalog.ts +80 -0
- package/src/plugins/builtin/shared/wall-teaser.tsx +192 -0
- package/src/plugins/builtin/shared/wall-view-lifecycle.ts +43 -0
- package/src/plugins/builtin/short-interest/index.tsx +31 -0
- package/src/plugins/builtin/short-interest/watch-client.ts +70 -0
- package/src/plugins/builtin/short-interest/watch-headless.ts +49 -0
- package/src/plugins/builtin/short-interest/watch-model.ts +185 -0
- package/src/plugins/builtin/short-interest/watch-pane.tsx +169 -0
- package/src/plugins/builtin/short-volume/pane.tsx +1 -1
- package/src/plugins/builtin/social-mentions/pane.tsx +1 -1
- package/src/plugins/builtin/supply-chain/client.ts +104 -0
- package/src/plugins/builtin/supply-chain/disclosure-quote.tsx +17 -0
- package/src/plugins/builtin/supply-chain/evidence.ts +88 -0
- package/src/plugins/builtin/supply-chain/flow-layout.ts +133 -0
- package/src/plugins/builtin/supply-chain/flow.tsx +323 -0
- package/src/plugins/builtin/supply-chain/graph-client.ts +83 -0
- package/src/plugins/builtin/supply-chain/graph-evidence.ts +25 -0
- package/src/plugins/builtin/supply-chain/graph-model.ts +45 -0
- package/src/plugins/builtin/supply-chain/graph-pane.tsx +218 -0
- package/src/plugins/builtin/supply-chain/graph.tsx +163 -0
- package/src/plugins/builtin/supply-chain/headless.ts +105 -0
- package/src/plugins/builtin/supply-chain/index.tsx +17 -0
- package/src/plugins/builtin/supply-chain/model.ts +145 -0
- package/src/plugins/builtin/supply-chain/pane.tsx +276 -0
- package/src/plugins/builtin/supply-chain/row-evidence.tsx +96 -0
- package/src/plugins/builtin/supply-chain/trust.ts +34 -0
- package/src/plugins/builtin/themes/client.ts +39 -0
- package/src/plugins/builtin/themes/headless.ts +38 -0
- package/src/plugins/builtin/themes/model.ts +92 -0
- package/src/plugins/builtin/themes/pane.tsx +125 -0
- package/src/plugins/builtin/thirteenf/pane.tsx +6 -15
- package/src/plugins/builtin/ticker-detail/data-panes/historical-prices.tsx +5 -6
- package/src/plugins/builtin/ticker-detail/data-panes/returns-model.ts +201 -0
- package/src/plugins/builtin/ticker-detail/data-panes/returns-pane.tsx +327 -0
- package/src/plugins/builtin/ticker-detail/financials/period-end-history.ts +5 -2
- package/src/plugins/builtin/ticker-detail/financials/ratios.ts +60 -12
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +2 -1
- package/src/plugins/builtin/ticker-detail/headless.ts +7 -2
- package/src/plugins/builtin/ticker-detail/index.tsx +22 -0
- package/src/plugins/builtin/ticker-detail/overview/components.tsx +53 -30
- package/src/plugins/builtin/ticker-detail/overview/pane.tsx +2 -0
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +112 -47
- package/src/plugins/builtin/ticker-detail/pane.tsx +50 -6
- package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +21 -42
- package/src/plugins/builtin/ticker-detail/quote-monitor/index.tsx +3 -0
- package/src/plugins/builtin/time-sales/pane.tsx +1 -1
- package/src/plugins/builtin/world-indices/indices.ts +1 -0
- package/src/plugins/catalog-browser.ts +40 -0
- package/src/plugins/catalog-manifest.ts +3 -0
- package/src/plugins/catalog-ui.ts +6 -0
- package/src/plugins/current-target.ts +0 -9
- package/src/public/__snapshots__/public-api.test.ts.snap +1 -0
- package/src/renderers/browser/cloud-transport.ts +66 -1
- package/src/renderers/browser/main.tsx +2 -0
- package/src/renderers/dom/data-table/row.tsx +2 -0
- package/src/renderers/dom/desktop/controls.tsx +38 -25
- package/src/renderers/dom/desktop/icons.tsx +8 -0
- package/src/renderers/dom/host/chart-surface.tsx +36 -2
- package/src/renderers/dom/host/focus-scope.ts +11 -1
- package/src/renderers/dom/styles.css +28 -0
- package/src/renderers/electrobun/view/backend-rpc.ts +3 -2
- package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +1 -1
- package/src/renderers/electrobun/view/http-fetch.ts +2 -0
- package/src/renderers/electrobun/view/main.tsx +3 -1
- package/src/renderers/electrobun/view/rpc-timeout.ts +59 -0
- package/src/renderers/opentui/start.tsx +3 -0
- package/src/shares/api.ts +3 -1
- package/src/sources/gloomberb-cloud/index.ts +47 -13
- package/src/sources/history-result.ts +1 -0
- package/src/sources/history-retention.ts +16 -0
- package/src/sources/provider-router/history.ts +4 -2
- package/src/sources/sec-edgar/identity.ts +36 -0
- package/src/sources/sec-edgar.ts +1 -34
- package/src/state/app/context/index.tsx +8 -0
- package/src/sync/core-contributors.ts +20 -2
- package/src/telemetry/attention-counts.ts +164 -0
- package/src/telemetry/live-config.ts +7 -0
- package/src/test-support/rpc-loopback.ts +7 -3
- package/src/test-support/shell-pane-keys.tsx +34 -0
- package/src/tickers/instrument-kind.ts +12 -6
- package/src/tickers/open-target.ts +1 -1
- package/src/tickers/search/asset-classes.ts +91 -0
- package/src/tickers/search/index.ts +62 -15
- package/src/tickers/search/ranking.ts +22 -3
- package/src/tickers/search/upsert.ts +4 -1
- package/src/time-series/live-bars.ts +8 -3
- package/src/time-series/resolve.ts +224 -17
- package/src/time-series/spec.ts +1 -0
- package/src/time-series/types.ts +9 -1
- package/src/types/config.ts +23 -1
- package/src/types/data-provider.ts +2 -0
- package/src/types/headless.ts +17 -0
- package/src/types/price-history.ts +2 -0
- package/src/ui/host.tsx +6 -0
- package/src/utils/double-escape-close.ts +20 -0
- package/src/utils/exchanges.ts +1 -0
- package/src/utils/html-entities.ts +15 -0
- package/src/utils/http-proxy-response.ts +44 -7
- package/src/utils/plugin-proxy-hosts.json +3 -0
- package/src/utils/price-history.ts +35 -1
- package/src/utils/sec.ts +21 -2
- package/src/utils/text-wrap.ts +13 -8
- package/src/utils/zoned-date-time.ts +67 -0
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { useEffect, useRef, useState, type ReactNode } from "react";
|
|
2
|
+
import { apiClient } from "../../../api-client";
|
|
3
|
+
import type { WallExperiment } from "../../../api-client/wall-experiments";
|
|
4
|
+
import { getWallSummary } from "../../../api-client/wall-summary";
|
|
5
|
+
import { usePlanAccess } from "../../../api-client/plan-access";
|
|
6
|
+
import { exposeWallTeaser, recordWallViewed } from "../../../api-client/research-activity";
|
|
7
|
+
import { Badge, DataTableView, KeyValueRow, SectionHeading } from "../../../components";
|
|
8
|
+
import { getTableWidth, tableColumnWidth } from "../../../components/ui/table-layout";
|
|
9
|
+
import { t } from "../../../i18n";
|
|
10
|
+
import { useAppLanguage } from "../../../i18n/react";
|
|
11
|
+
import { usePaneVisible } from "../../../state/app/activity";
|
|
12
|
+
import { useThemeColors } from "../../../theme/theme-context";
|
|
13
|
+
import { Box, Text, useUiCapabilities } from "../../../ui";
|
|
14
|
+
import { wrapTextLines } from "../../../utils/text-wrap";
|
|
15
|
+
import { listingIdentity } from "./ticker-request";
|
|
16
|
+
import { SIGNIN_WALL_TEASERS, WALL_TEASERS } from "./wall-teaser-catalog";
|
|
17
|
+
import { trackWallView } from "./wall-view-lifecycle";
|
|
18
|
+
|
|
19
|
+
export interface WallTeaserProps {
|
|
20
|
+
experiment?: WallExperiment;
|
|
21
|
+
placement: string;
|
|
22
|
+
width: number;
|
|
23
|
+
height: number;
|
|
24
|
+
title?: string;
|
|
25
|
+
message?: string;
|
|
26
|
+
symbol?: string | null;
|
|
27
|
+
exchange?: string;
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const SUMMARY_LABELS: Record<string, string> = {
|
|
32
|
+
risk_count: "Risk factors",
|
|
33
|
+
filed_at: "Filed",
|
|
34
|
+
proxy_count: "Proxy statements",
|
|
35
|
+
call_count: "Calls available",
|
|
36
|
+
last_call_at: "Last call",
|
|
37
|
+
filing_count_90d: "8-K filings in 90 days",
|
|
38
|
+
last_filed_at: "Last filed",
|
|
39
|
+
open_roles: "Open roles",
|
|
40
|
+
as_of: "As of",
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
type Summary = { kind: "counts"; items: { label: string; value: number | string }[] };
|
|
44
|
+
type Teaser = { kind: "summary"; summary: Summary } | { kind: "sample" } | { kind: "none" };
|
|
45
|
+
|
|
46
|
+
/** No layout reservation or focus changes: the original wall remains usable while asking. */
|
|
47
|
+
export function WallTeaser({ children, placement, width, height, title = "", message = "", symbol, exchange, experiment = "wall_teaser" }: WallTeaserProps) {
|
|
48
|
+
useAppLanguage();
|
|
49
|
+
const visible = usePaneVisible();
|
|
50
|
+
const access = usePlanAccess();
|
|
51
|
+
const userId = apiClient.getCurrentUser()?.id;
|
|
52
|
+
const native = useUiCapabilities().nativePaneChrome === true;
|
|
53
|
+
const colors = useThemeColors();
|
|
54
|
+
const catalogPlacement = experiment === "wall_teaser_signin" ? SIGNIN_WALL_TEASERS[placement] : placement;
|
|
55
|
+
const sample = catalogPlacement ? WALL_TEASERS[catalogPlacement] : undefined;
|
|
56
|
+
const blocked = experiment === "wall_teaser" && access.hasProAccess;
|
|
57
|
+
const enroll = experiment === "wall_teaser" || !!sample;
|
|
58
|
+
const listing = sample?.summaryHook ? listingIdentity(symbol, exchange) : null;
|
|
59
|
+
const key = `${experiment}:${userId ?? "guest"}:${placement}:${listing?.symbol ?? ""}:${listing?.exchange ?? ""}`;
|
|
60
|
+
const [resolved, setResolved] = useState<{ key: string; arm: string | null; teaser: Teaser } | null>(null);
|
|
61
|
+
// The original wall uses two inset rows and two action rows. The preview
|
|
62
|
+
// keeps its own bottom inset; a sample needs a badge, gap and table header.
|
|
63
|
+
const copyRows = wrapTextLines(t(title), Math.max(1, width - 2)).length
|
|
64
|
+
+ (message ? wrapTextLines(t(message), Math.max(1, width - 2)).length : 0);
|
|
65
|
+
const previewRows = Math.max(0, height - copyRows - 5);
|
|
66
|
+
const sampleRows = Math.min(8, Math.max(0, previewRows - 3));
|
|
67
|
+
const hookRows = sample?.summaryHook ? wrapTextLines(t(sample.summaryHook), Math.max(1, width - 2)).length : 0;
|
|
68
|
+
const fits = width >= 34 && sampleRows >= 2;
|
|
69
|
+
const trackedView = useRef<ReturnType<typeof trackWallView> | null>(null);
|
|
70
|
+
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
if (!visible || blocked) return;
|
|
73
|
+
const view = trackWallView({
|
|
74
|
+
identity: userId ?? "guest",
|
|
75
|
+
placement,
|
|
76
|
+
exposure: enroll ? exposeWallTeaser(experiment) : Promise.resolve(null),
|
|
77
|
+
currentIdentity: () => apiClient.getCurrentUser()?.id ?? "guest",
|
|
78
|
+
record: recordWallViewed,
|
|
79
|
+
});
|
|
80
|
+
trackedView.current = view;
|
|
81
|
+
return () => {
|
|
82
|
+
if (trackedView.current === view) trackedView.current = null;
|
|
83
|
+
view.release();
|
|
84
|
+
};
|
|
85
|
+
}, [visible, blocked, userId, placement, experiment, enroll]);
|
|
86
|
+
|
|
87
|
+
useEffect(() => {
|
|
88
|
+
if (!visible || blocked) return;
|
|
89
|
+
let cancelled = false;
|
|
90
|
+
void (async () => {
|
|
91
|
+
const arm = await (trackedView.current?.exposure ?? (enroll ? exposeWallTeaser(experiment) : Promise.resolve(null)));
|
|
92
|
+
if (cancelled) return;
|
|
93
|
+
let teaser: Teaser = { kind: "none" };
|
|
94
|
+
if (arm === "teaser" && fits && sample) {
|
|
95
|
+
const summary = listing
|
|
96
|
+
? await getWallSummary(catalogPlacement!, listing.symbol, listing.exchange)
|
|
97
|
+
: null;
|
|
98
|
+
teaser = summary?.items.length ? { kind: "summary", summary } : { kind: "sample" };
|
|
99
|
+
}
|
|
100
|
+
if (cancelled) return;
|
|
101
|
+
setResolved({ key, arm, teaser });
|
|
102
|
+
})();
|
|
103
|
+
return () => { cancelled = true; };
|
|
104
|
+
}, [visible, blocked, key, fits, catalogPlacement, listing?.symbol, listing?.exchange, sample, experiment, enroll]);
|
|
105
|
+
|
|
106
|
+
const current = resolved?.key === key ? resolved : null;
|
|
107
|
+
const summaryFits = current?.teaser.kind !== "summary" || current.teaser.summary.items.length + hookRows <= previewRows;
|
|
108
|
+
const teaser = fits && summaryFits && current?.arm === "teaser" ? current.teaser : { kind: "none" as const };
|
|
109
|
+
useEffect(() => {
|
|
110
|
+
if (!visible || !current || blocked) return;
|
|
111
|
+
trackedView.current?.report(current.arm === "teaser" ? teaser.kind : undefined);
|
|
112
|
+
}, [visible, current, blocked, placement, teaser.kind]);
|
|
113
|
+
|
|
114
|
+
return <>
|
|
115
|
+
{children}
|
|
116
|
+
{teaser.kind !== "none" && <Box
|
|
117
|
+
flexDirection="column" paddingX={1} paddingBottom={1} flexShrink={0}
|
|
118
|
+
data-gloom-ui="wall-teaser" data-teaser-kind={teaser.kind}
|
|
119
|
+
>
|
|
120
|
+
{teaser.kind === "summary" ? <>
|
|
121
|
+
{teaser.summary.items.map((item) => (
|
|
122
|
+
<KeyValueRow key={item.label} label={t(SUMMARY_LABELS[item.label] ?? item.label)}
|
|
123
|
+
value={String(item.value)} width={width - 2} labelWidth={Math.min(25, width - 14)} />
|
|
124
|
+
))}
|
|
125
|
+
{sample?.summaryHook && <Text fg={colors.textMuted} dim wrapText>{t(sample.summaryHook)}</Text>}
|
|
126
|
+
</> : <FrozenWallSample placement={catalogPlacement!} width={width - 2} rows={sampleRows} native={native} />}
|
|
127
|
+
</Box>}
|
|
128
|
+
</>;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const SAMPLE_TICKERS = ["AAPL", "MSFT", "NVDA", "AMZN", "TSLA", "META", "AMD", "GOOGL"];
|
|
132
|
+
|
|
133
|
+
/** Stable per cell, independent of viewport changes and renders. Never encodes data. */
|
|
134
|
+
function placeholderFraction(row: number, column: number): number {
|
|
135
|
+
return (38 + ((row * 17 + column * 29) % 49)) / 100;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function Placeholder({ row, column, width, native }: { row: number; column: number; width: number; native: boolean }) {
|
|
139
|
+
const colors = useThemeColors();
|
|
140
|
+
const fraction = placeholderFraction(row, column);
|
|
141
|
+
return native
|
|
142
|
+
? <Box style={{ background: colors.textMuted, opacity: 0.35, filter: "blur(3px)", width: `${fraction * 100}%`, height: "0.65em", marginTop: "0.2em", pointerEvents: "none", userSelect: "none" }} />
|
|
143
|
+
: <Text fg={colors.textMuted} dim>{"░".repeat(Math.max(2, Math.floor(width * fraction)))}</Text>;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function FrozenWallSample({ placement, width, rows, native }: { placement: string; width: number; rows: number; native: boolean }) {
|
|
147
|
+
const colors = useThemeColors();
|
|
148
|
+
const sample = WALL_TEASERS[placement]!;
|
|
149
|
+
const columns = sample.layout === "table" ? sample.columns.map((column, index) => ({
|
|
150
|
+
...column, id: String(index), label: t(column.label),
|
|
151
|
+
})) : [];
|
|
152
|
+
// Fit complete headers using the kit's own gap/header arithmetic. Preserve
|
|
153
|
+
// the real column order while dropping the least important fields first.
|
|
154
|
+
while (columns.length > 1 && getTableWidth(columns) > width) {
|
|
155
|
+
const priority = Math.max(...columns.map((column) => column.priority));
|
|
156
|
+
columns.splice(columns.findIndex((column) => column.priority === priority), 1);
|
|
157
|
+
}
|
|
158
|
+
const spare = Math.max(0, width - getTableWidth(columns));
|
|
159
|
+
columns.forEach((column, index) => {
|
|
160
|
+
column.width = tableColumnWidth(column) + Math.floor(spare / columns.length) + (index < spare % columns.length ? 1 : 0);
|
|
161
|
+
});
|
|
162
|
+
return <>
|
|
163
|
+
<Box flexDirection="row" marginBottom={1}><Badge label={t("Sample")} /></Box>
|
|
164
|
+
{sample.layout === "prose" ? <Box flexDirection="column">
|
|
165
|
+
{sample.issuer && <SectionHeading title={sample.issuer} />}
|
|
166
|
+
{Array.from({ length: rows }, (_, row) => <Box key={row} height={1}>
|
|
167
|
+
<Placeholder row={row} column={0} width={width} native={native} />
|
|
168
|
+
</Box>)}
|
|
169
|
+
</Box> :
|
|
170
|
+
<Box height={rows + 1} style={native ? { pointerEvents: "none", userSelect: "none" } : undefined}>
|
|
171
|
+
<DataTableView
|
|
172
|
+
columns={columns} items={SAMPLE_TICKERS.slice(0, rows)} rootWidth={width} rootHeight={rows + 1}
|
|
173
|
+
focused={false} keyboardNavigation={false} selection={{ kind: "none" }} sortable={false}
|
|
174
|
+
sortColumnId={null} sortDirection="asc" getItemKey={(_row, index) => String(index)}
|
|
175
|
+
isNavigable={() => false} emptyStateTitle="" showHorizontalScrollbar={false}
|
|
176
|
+
renderCell={(ticker, column) => {
|
|
177
|
+
const sourceColumn = sample.columns[Number(column.id)]!;
|
|
178
|
+
const identifier = sourceColumn.label === "TICKER" || sourceColumn.label === "NEW HIGH";
|
|
179
|
+
const row = SAMPLE_TICKERS.indexOf(ticker);
|
|
180
|
+
return {
|
|
181
|
+
text: identifier ? ticker : native ? "" : "░".repeat(Math.max(2, Math.floor(column.width * placeholderFraction(row, Number(column.id))))),
|
|
182
|
+
color: colors.textMuted,
|
|
183
|
+
content: native && !identifier
|
|
184
|
+
? <Placeholder row={row} column={Number(column.id)} width={column.width} native />
|
|
185
|
+
: undefined,
|
|
186
|
+
...(!identifier ? { attributes: 2 } : {}),
|
|
187
|
+
};
|
|
188
|
+
}}
|
|
189
|
+
/>
|
|
190
|
+
</Box>}
|
|
191
|
+
</>;
|
|
192
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
type Arm = "control" | "teaser" | null;
|
|
2
|
+
type TeaserKind = "summary" | "sample" | "none";
|
|
3
|
+
const active = new Map<string, Set<object>>();
|
|
4
|
+
|
|
5
|
+
/** Keeps a short visit measurable even if its optional teaser never finishes loading. */
|
|
6
|
+
export function trackWallView({ identity, placement, exposure, currentIdentity, record }: {
|
|
7
|
+
identity: string;
|
|
8
|
+
placement: string;
|
|
9
|
+
exposure: Promise<Arm>;
|
|
10
|
+
currentIdentity(): string;
|
|
11
|
+
record(placement: string, teaserKind?: TeaserKind): void;
|
|
12
|
+
}) {
|
|
13
|
+
const key = `${identity}:${placement}`;
|
|
14
|
+
const token = {};
|
|
15
|
+
const copies = active.get(key) ?? new Set<object>();
|
|
16
|
+
copies.add(token);
|
|
17
|
+
active.set(key, copies);
|
|
18
|
+
let released = false;
|
|
19
|
+
let reported = false;
|
|
20
|
+
const answer = exposure.catch(() => null);
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
exposure: answer,
|
|
24
|
+
report(teaserKind?: TeaserKind) {
|
|
25
|
+
if (released || reported || currentIdentity() !== identity) return;
|
|
26
|
+
reported = true;
|
|
27
|
+
record(placement, teaserKind);
|
|
28
|
+
},
|
|
29
|
+
release() {
|
|
30
|
+
if (released) return;
|
|
31
|
+
released = true;
|
|
32
|
+
copies.delete(token);
|
|
33
|
+
if (copies.size === 0) active.delete(key);
|
|
34
|
+
if (reported) return;
|
|
35
|
+
void answer.then((arm) => {
|
|
36
|
+
// A replacement or another copy will report what actually finishes
|
|
37
|
+
// rendering. Do not let an older ticker/size request win with "none".
|
|
38
|
+
if (active.has(key) || currentIdentity() !== identity) return;
|
|
39
|
+
record(placement, arm === "teaser" ? "none" : undefined);
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
@@ -7,6 +7,8 @@ import {
|
|
|
7
7
|
} from "./client";
|
|
8
8
|
import { shortInterestHeadless } from "./headless";
|
|
9
9
|
import { ShortInterestResearchTab, ShortInterestSurface } from "./surface";
|
|
10
|
+
import { shortWatchHeadless } from "./watch-headless";
|
|
11
|
+
import { SHORT_WATCH_SCOPE_OPTIONS, ShortWatchPane } from "./watch-pane";
|
|
10
12
|
import { followsWithoutFinraOverride, shortVolumeSettings } from "../short-volume";
|
|
11
13
|
import { isKnownNonUsListing } from "../../../utils/sec";
|
|
12
14
|
|
|
@@ -54,6 +56,21 @@ export const shortInterestModule: PluginModule = {
|
|
|
54
56
|
tableExport: true,
|
|
55
57
|
settings: { title: "Short Interest", fields: shortVolumeSettings },
|
|
56
58
|
},
|
|
59
|
+
{
|
|
60
|
+
id: "short-watch",
|
|
61
|
+
name: "Short Squeeze Watch",
|
|
62
|
+
icon: "S",
|
|
63
|
+
component: ShortWatchPane,
|
|
64
|
+
defaultPosition: "right",
|
|
65
|
+
defaultMode: "floating",
|
|
66
|
+
defaultFloatingSize: { width: 92, height: 28 },
|
|
67
|
+
tableExport: true,
|
|
68
|
+
headless: shortWatchHeadless,
|
|
69
|
+
settings: { title: "Short Squeeze Watch", fields: [
|
|
70
|
+
{ key: "scope", label: "Names", type: "select", options: [...SHORT_WATCH_SCOPE_OPTIONS] },
|
|
71
|
+
{ key: "symbols", label: "Custom symbols", type: "text", placeholder: "GME, AMC, CVNA" },
|
|
72
|
+
] },
|
|
73
|
+
},
|
|
57
74
|
],
|
|
58
75
|
|
|
59
76
|
paneTemplates: [
|
|
@@ -69,5 +86,19 @@ export const shortInterestModule: PluginModule = {
|
|
|
69
86
|
}),
|
|
70
87
|
headless: shortInterestHeadless,
|
|
71
88
|
},
|
|
89
|
+
{
|
|
90
|
+
id: "short-watch-pane",
|
|
91
|
+
paneId: "short-watch",
|
|
92
|
+
label: "Short Squeeze Watch",
|
|
93
|
+
description: "Short interest as a share of float, days to cover, the change since the prior settlement and the month's price move across your names.",
|
|
94
|
+
keywords: ["siw", "short", "squeeze", "crowded", "float", "days to cover", "watchlist", "portfolio"],
|
|
95
|
+
shortcut: { prefix: "SIW", argKind: "ticker-list" as const, argOptional: true },
|
|
96
|
+
headless: shortWatchHeadless,
|
|
97
|
+
createInstance: (_context, options) => ({
|
|
98
|
+
title: "Short Squeeze Watch",
|
|
99
|
+
placement: "floating" as const,
|
|
100
|
+
settings: options?.symbols?.length ? { scope: "custom", symbols: options.symbols.join(",") } : { scope: "mine" },
|
|
101
|
+
}),
|
|
102
|
+
},
|
|
72
103
|
],
|
|
73
104
|
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { apiClient } from "../../../api-client";
|
|
2
|
+
import { getSharedMarketDataCoordinator, MarketDataCoordinator, resolveEntryValue } from "../../../market-data/coordinator";
|
|
3
|
+
import type { ChartRequest, InstrumentRef } from "../../../market-data/request-types";
|
|
4
|
+
import type { QueryEntry } from "../../../market-data/result-types";
|
|
5
|
+
import type { DataProvider } from "../../../types/data-provider";
|
|
6
|
+
import type { PricePoint, TickerFinancials } from "../../../types/financials";
|
|
7
|
+
import { errorMessage } from "../../../utils/errors";
|
|
8
|
+
import { loadShortInterest } from "./client";
|
|
9
|
+
import { buildShortWatchRow, type ShortWatchRow } from "./watch-model";
|
|
10
|
+
import type { ShortInterestRecord } from "./types";
|
|
11
|
+
|
|
12
|
+
const CONCURRENCY = 6;
|
|
13
|
+
|
|
14
|
+
export interface ShortWatchDependencies {
|
|
15
|
+
loadRecords(symbol: string): Promise<ShortInterestRecord[]>;
|
|
16
|
+
loadSnapshots(instruments: InstrumentRef[], options?: { forceRefresh?: boolean }): Promise<QueryEntry<TickerFinancials>[]>;
|
|
17
|
+
loadChart(request: ChartRequest, options?: { forceRefresh?: boolean }): Promise<QueryEntry<PricePoint[]>>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function createShortWatchDependencies(
|
|
21
|
+
marketData?: DataProvider,
|
|
22
|
+
client: Pick<typeof apiClient, "getCloudShortInterest"> = apiClient,
|
|
23
|
+
): ShortWatchDependencies {
|
|
24
|
+
const coordinator = marketData ? new MarketDataCoordinator(marketData) : getSharedMarketDataCoordinator();
|
|
25
|
+
const missing = () => Promise.reject(new Error("Market data coordinator unavailable"));
|
|
26
|
+
return {
|
|
27
|
+
loadRecords: async (symbol) => (await loadShortInterest(symbol, client)).records,
|
|
28
|
+
loadSnapshots: (instruments, options) => coordinator ? coordinator.loadSnapshotsBatch(instruments, options) : missing(),
|
|
29
|
+
loadChart: (request, options) => coordinator ? coordinator.loadChart(request, options) : missing(),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Every name's settlements, float and daily closes. The floats come in one
|
|
35
|
+
* batched snapshot; settlements and closes are per symbol, six at a time. A
|
|
36
|
+
* name whose closes fail keeps its short interest without a price move.
|
|
37
|
+
*/
|
|
38
|
+
export async function loadShortWatch(
|
|
39
|
+
symbols: readonly string[],
|
|
40
|
+
options: { signal?: AbortSignal; forceRefresh?: boolean } = {},
|
|
41
|
+
dependencies: ShortWatchDependencies = createShortWatchDependencies(),
|
|
42
|
+
): Promise<ShortWatchRow[]> {
|
|
43
|
+
const instruments = symbols.map((symbol) => ({ symbol, exchange: "" }));
|
|
44
|
+
const snapshots = dependencies.loadSnapshots(instruments, { forceRefresh: options.forceRefresh }).catch(() => []);
|
|
45
|
+
const rows = new Array<ShortWatchRow>(symbols.length);
|
|
46
|
+
let next = 0;
|
|
47
|
+
const worker = async () => {
|
|
48
|
+
while (next < instruments.length && !options.signal?.aborted) {
|
|
49
|
+
const index = next++;
|
|
50
|
+
const instrument = instruments[index]!;
|
|
51
|
+
const [records, history] = await Promise.allSettled([
|
|
52
|
+
dependencies.loadRecords(instrument.symbol),
|
|
53
|
+
dependencies.loadChart({ instrument, bufferRange: "3M", granularity: "resolution", resolution: "1d" },
|
|
54
|
+
{ forceRefresh: options.forceRefresh }).then((entry) => resolveEntryValue(entry) ?? []),
|
|
55
|
+
]);
|
|
56
|
+
const entry = (await snapshots)[index];
|
|
57
|
+
const floatShares = (entry ? resolveEntryValue(entry) : null)?.fundamentals?.floatShares ?? null;
|
|
58
|
+
rows[index] = buildShortWatchRow({
|
|
59
|
+
symbol: instrument.symbol,
|
|
60
|
+
records: records.status === "fulfilled" ? records.value : null,
|
|
61
|
+
floatShares,
|
|
62
|
+
history: history.status === "fulfilled" ? history.value : null,
|
|
63
|
+
error: records.status === "rejected" ? errorMessage(records.reason) : null,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
await Promise.all(Array.from({ length: Math.min(CONCURRENCY, instruments.length) }, worker));
|
|
68
|
+
options.signal?.throwIfAborted();
|
|
69
|
+
return rows;
|
|
70
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { HeadlessPaneDefinition } from "../../../types/plugin";
|
|
2
|
+
import { formatCompact, formatNumber } from "../../../utils/format";
|
|
3
|
+
import { createShortWatchDependencies, loadShortWatch } from "./watch-client";
|
|
4
|
+
import { customUniverse, type ShortWatchSetup, setupLabel, SHORT_WATCH_LIMIT, sortShortWatchRows } from "./watch-model";
|
|
5
|
+
|
|
6
|
+
const number = (digits: number, suffix = "") => (value: unknown) =>
|
|
7
|
+
typeof value === "number" && Number.isFinite(value) ? `${formatNumber(value, digits)}${suffix}` : "--";
|
|
8
|
+
const signedPercent = (value: unknown) =>
|
|
9
|
+
typeof value === "number" && Number.isFinite(value) ? `${value > 0 ? "+" : ""}${formatNumber(value, 1)}%` : "--";
|
|
10
|
+
|
|
11
|
+
export const shortWatchHeadless: HeadlessPaneDefinition<"rows"> = {
|
|
12
|
+
shape: "rows",
|
|
13
|
+
argument: { kind: "symbol-list", maximum: SHORT_WATCH_LIMIT, description: "US tickers; the pane defaults to your portfolios and watchlists." },
|
|
14
|
+
options: [],
|
|
15
|
+
describe: "Short squeeze watch",
|
|
16
|
+
discovery: {
|
|
17
|
+
aliases: ["SIW"],
|
|
18
|
+
screenshotReadiness: "live-dom",
|
|
19
|
+
dataRequirements: ["FINRA short interest settlements", "Float", "Daily closes"],
|
|
20
|
+
limitations: ["Percent of float uses the current float against the settlement's shares short",
|
|
21
|
+
"Crowded is a fixed threshold, not a squeeze forecast"],
|
|
22
|
+
},
|
|
23
|
+
columns: [
|
|
24
|
+
{ key: "symbol", header: "Symbol" },
|
|
25
|
+
{ key: "setup", header: "Setup", format: (value) => setupLabel(value as ShortWatchSetup | null) || "--" },
|
|
26
|
+
{ key: "percentFloat", header: "% Float", align: "right", format: number(2, "%") },
|
|
27
|
+
{ key: "daysToCover", header: "Days to Cover", align: "right", format: number(2) },
|
|
28
|
+
{ key: "changePercent", header: "SI Chg %", align: "right", format: signedPercent },
|
|
29
|
+
{ key: "return1M", header: "1M %", align: "right", format: signedPercent },
|
|
30
|
+
{ key: "sharesShort", header: "Shares Short", align: "right", format: (value) => typeof value === "number" ? formatCompact(value) : "--" },
|
|
31
|
+
{ key: "settlementDate", header: "Settled" },
|
|
32
|
+
{ key: "closeDate", header: "Close" },
|
|
33
|
+
],
|
|
34
|
+
async load(args, ctx) {
|
|
35
|
+
const universe = customUniverse(args.symbols.join(","));
|
|
36
|
+
const rows = sortShortWatchRows(await loadShortWatch(universe.symbols, { signal: ctx.signal, forceRefresh: ctx.refresh },
|
|
37
|
+
createShortWatchDependencies(ctx.marketData, ctx.apiClient)), "setup", "desc");
|
|
38
|
+
const missing = rows.filter((row) => !row.settlementDate);
|
|
39
|
+
return {
|
|
40
|
+
rows: rows.map(({ error: _error, ...row }) => row),
|
|
41
|
+
complete: !missing.length && !universe.notice && rows.every((row) => row.return1M != null),
|
|
42
|
+
symbols: universe.symbols,
|
|
43
|
+
unavailableSymbols: missing.map((row) => row.symbol),
|
|
44
|
+
errors: [universe.notice, ...missing.map((row) => `${row.symbol}: ${row.error ?? "No short interest reported"}`)]
|
|
45
|
+
.filter((value): value is string => !!value),
|
|
46
|
+
metadata: { methodology: "docs/research-data.md#short-squeeze-watch-siw" },
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
};
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { realizedVolatilityCadenceIssue } from "../../../market-data/realized-volatility";
|
|
2
|
+
import type { PricePoint } from "../../../types/financials";
|
|
3
|
+
import type { TickerRecord } from "../../../types/ticker";
|
|
4
|
+
import { isKnownNonUsListing } from "../../../utils/sec";
|
|
5
|
+
import { compareSortValues, type SortDirection } from "../../../utils/sort-values";
|
|
6
|
+
import type { ShortInterestRecord } from "./types";
|
|
7
|
+
|
|
8
|
+
/** Short interest is published per settlement for each US listing, so a list fetches one symbol at a time. */
|
|
9
|
+
export const SHORT_WATCH_LIMIT = 60;
|
|
10
|
+
/**
|
|
11
|
+
* A short is crowded at a tenth of the float, or at five days of volume to
|
|
12
|
+
* cover once at least a twentieth of the float is short: days to cover alone
|
|
13
|
+
* flags thinly traded large caps whose shorts are a sliver of the float. With
|
|
14
|
+
* the float unknown, days to cover decides alone.
|
|
15
|
+
*/
|
|
16
|
+
const CROWDED_FLOAT_PERCENT = 10;
|
|
17
|
+
const CROWDED_DAYS_TO_COVER = 5;
|
|
18
|
+
const CROWDED_DAYS_MIN_FLOAT_PERCENT = 5;
|
|
19
|
+
/** The 1M base is the close a calendar month before the latest one, or the last close up to four days before (a weekend and a holiday). */
|
|
20
|
+
const RETURN_BASE_TOLERANCE_DAYS = 4;
|
|
21
|
+
const DAY_MS = 86_400_000;
|
|
22
|
+
const SYMBOL = /^[A-Z][A-Z0-9.]{0,9}$/;
|
|
23
|
+
const LISTED_TYPES = new Set(["", "STK", "EQUITY", "COMMONSTOCK", "ADR", "ETF", "FUND"]);
|
|
24
|
+
|
|
25
|
+
export type ShortWatchSetup = "crowded-rising" | "crowded";
|
|
26
|
+
|
|
27
|
+
export function setupLabel(setup: ShortWatchSetup | null): string {
|
|
28
|
+
return setup === "crowded-rising" ? "Crowded, rising" : setup === "crowded" ? "Crowded" : "";
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface ShortWatchRow {
|
|
32
|
+
symbol: string;
|
|
33
|
+
/** ISO date of the latest settlement. */
|
|
34
|
+
settlementDate: string | null;
|
|
35
|
+
sharesShort: number | null;
|
|
36
|
+
/** Percent change in shares short since the settlement before. */
|
|
37
|
+
changePercent: number | null;
|
|
38
|
+
daysToCover: number | null;
|
|
39
|
+
/** Shares short over the float, in percent. */
|
|
40
|
+
percentFloat: number | null;
|
|
41
|
+
/** Price change over a calendar month of daily closes, in percent. */
|
|
42
|
+
return1M: number | null;
|
|
43
|
+
/** ISO date of the close the return runs to. */
|
|
44
|
+
closeDate: string | null;
|
|
45
|
+
setup: ShortWatchSetup | null;
|
|
46
|
+
error: string | null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface ShortWatchInputs {
|
|
50
|
+
symbol: string;
|
|
51
|
+
records: readonly ShortInterestRecord[] | null;
|
|
52
|
+
floatShares: number | null;
|
|
53
|
+
history: readonly PricePoint[] | null;
|
|
54
|
+
error?: string | null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const isoDate = (date: Date) => date.toISOString().slice(0, 10);
|
|
58
|
+
const finite = (value: number | null | undefined): value is number => typeof value === "number" && Number.isFinite(value);
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The latest close against the close one calendar month earlier: the last close
|
|
62
|
+
* on or before that day, within four days of it, from daily bars only, so a gap in the history leaves the
|
|
63
|
+
* return unknown rather than measuring a longer window.
|
|
64
|
+
*/
|
|
65
|
+
export function oneMonthReturn(history: readonly PricePoint[]): { percent: number; date: string } | null {
|
|
66
|
+
// Weekly or intraday bars would measure from the wrong close.
|
|
67
|
+
if (realizedVolatilityCadenceIssue(history)) return null;
|
|
68
|
+
// Cached histories come back with ISO-string dates.
|
|
69
|
+
const closes = history.map((point) => ({ close: point.close, date: new Date(point.date) }))
|
|
70
|
+
.filter((point) => finite(point.close) && point.close > 0 && !Number.isNaN(point.date.getTime()))
|
|
71
|
+
.sort((left, right) => left.date.getTime() - right.date.getTime());
|
|
72
|
+
const last = closes.at(-1);
|
|
73
|
+
if (!last) return null;
|
|
74
|
+
const target = new Date(last.date);
|
|
75
|
+
target.setUTCMonth(target.getUTCMonth() - 1);
|
|
76
|
+
// 31 March less a month is 3 March; clamp to the month's last day.
|
|
77
|
+
if (target.getUTCMonth() === last.date.getUTCMonth()) target.setUTCDate(0);
|
|
78
|
+
const base = closes.filter((point) => point.date.getTime() <= target.getTime()).at(-1);
|
|
79
|
+
if (!base || target.getTime() - base.date.getTime() > RETURN_BASE_TOLERANCE_DAYS * DAY_MS) return null;
|
|
80
|
+
return { percent: (last.close / base.close - 1) * 100, date: isoDate(last.date) };
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function shortWatchSetup(row: Pick<ShortWatchRow, "percentFloat" | "daysToCover" | "return1M">): ShortWatchSetup | null {
|
|
84
|
+
const longToCover = row.daysToCover != null && row.daysToCover >= CROWDED_DAYS_TO_COVER;
|
|
85
|
+
const crowded = row.percentFloat != null
|
|
86
|
+
? row.percentFloat >= CROWDED_FLOAT_PERCENT || (longToCover && row.percentFloat >= CROWDED_DAYS_MIN_FLOAT_PERCENT)
|
|
87
|
+
: longToCover;
|
|
88
|
+
if (!crowded) return null;
|
|
89
|
+
return row.return1M != null && row.return1M > 0 ? "crowded-rising" : "crowded";
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* One name's latest settlement, its change from the settlement before, its
|
|
94
|
+
* shares short over the float, and its month's price move. A settlement that
|
|
95
|
+
* carries its own percent of float keeps it; otherwise the float is the
|
|
96
|
+
* snapshot's current float.
|
|
97
|
+
*/
|
|
98
|
+
export function buildShortWatchRow(inputs: ShortWatchInputs): ShortWatchRow {
|
|
99
|
+
const records = [...(inputs.records ?? [])].sort((left, right) => left.settlementDate.getTime() - right.settlementDate.getTime());
|
|
100
|
+
const latest = records.at(-1);
|
|
101
|
+
const prior = records.at(-2);
|
|
102
|
+
// A float smaller than the shares short is another class's float (BRK.B reports Berkshire's Class A), not a short over 100%.
|
|
103
|
+
const percentFloat = latest
|
|
104
|
+
? latest.shortPercentFloat ?? (finite(inputs.floatShares) && inputs.floatShares >= latest.sharesShort && inputs.floatShares > 0
|
|
105
|
+
? latest.sharesShort / inputs.floatShares * 100 : null)
|
|
106
|
+
: null;
|
|
107
|
+
const move = inputs.history ? oneMonthReturn(inputs.history) : null;
|
|
108
|
+
const row = {
|
|
109
|
+
symbol: inputs.symbol,
|
|
110
|
+
settlementDate: latest ? isoDate(latest.settlementDate) : null,
|
|
111
|
+
sharesShort: latest?.sharesShort ?? null,
|
|
112
|
+
changePercent: latest && prior && prior.sharesShort > 0 ? (latest.sharesShort / prior.sharesShort - 1) * 100 : null,
|
|
113
|
+
daysToCover: latest?.shortRatio ?? null,
|
|
114
|
+
percentFloat,
|
|
115
|
+
return1M: move?.percent ?? null,
|
|
116
|
+
closeDate: move?.date ?? null,
|
|
117
|
+
error: inputs.error ?? (latest ? null : "No short interest reported"),
|
|
118
|
+
};
|
|
119
|
+
return { ...row, setup: shortWatchSetup(row) };
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const SETUP_RANK: Record<ShortWatchSetup, number> = { "crowded-rising": 2, crowded: 1 };
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Crowded names that are rising first, then crowded names, then the rest; each
|
|
126
|
+
* group from the most crowded down, and names without a settlement last.
|
|
127
|
+
*/
|
|
128
|
+
function compareShortWatchRank(left: ShortWatchRow, right: ShortWatchRow): number {
|
|
129
|
+
return (right.settlementDate ? 1 : 0) - (left.settlementDate ? 1 : 0)
|
|
130
|
+
|| (right.setup ? SETUP_RANK[right.setup] : 0) - (left.setup ? SETUP_RANK[left.setup] : 0)
|
|
131
|
+
// Percent of float measures crowding; days to cover orders the names whose float is unknown, after them.
|
|
132
|
+
|| (right.percentFloat != null ? 1 : 0) - (left.percentFloat != null ? 1 : 0)
|
|
133
|
+
|| compareSortValues(left.percentFloat ?? left.daysToCover, right.percentFloat ?? right.daysToCover, "desc")
|
|
134
|
+
|| left.symbol.localeCompare(right.symbol);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export type ShortWatchSortId = "setup" | "symbol" | "percentFloat" | "daysToCover" | "changePercent" | "return1M" | "sharesShort" | "settlementDate" | "closeDate";
|
|
138
|
+
|
|
139
|
+
export function sortShortWatchRows(rows: readonly ShortWatchRow[], columnId: ShortWatchSortId, direction: SortDirection): ShortWatchRow[] {
|
|
140
|
+
if (columnId === "setup") {
|
|
141
|
+
const ranked = [...rows].sort(compareShortWatchRank);
|
|
142
|
+
return direction === "desc" ? ranked : ranked.reverse();
|
|
143
|
+
}
|
|
144
|
+
return [...rows].sort((left, right) => compareSortValues(left[columnId], right[columnId], direction)
|
|
145
|
+
|| compareShortWatchRank(left, right));
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** The one date every row shares, so it can sit in the footer instead of a column. */
|
|
149
|
+
export function sharedDate(rows: readonly ShortWatchRow[], key: "settlementDate" | "closeDate"): string | null {
|
|
150
|
+
const dates = new Set(rows.map((row) => row[key]).filter((value): value is string => !!value));
|
|
151
|
+
return dates.size === 1 ? [...dates][0]! : null;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export interface ShortWatchUniverse { symbols: string[]; notice: string | null }
|
|
155
|
+
|
|
156
|
+
/** US listings only: short interest settlements cover US-traded shares. */
|
|
157
|
+
function listed(ticker: Pick<TickerRecord, "metadata">): boolean {
|
|
158
|
+
const category = (ticker.metadata.assetCategory ?? "").toUpperCase().replace(/[\s_-]/g, "");
|
|
159
|
+
return LISTED_TYPES.has(category) && !isKnownNonUsListing(ticker as TickerRecord);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function cap(symbols: string[], skipped: string | null): ShortWatchUniverse {
|
|
163
|
+
const unique = [...new Set(symbols)];
|
|
164
|
+
return {
|
|
165
|
+
symbols: unique.slice(0, SHORT_WATCH_LIMIT),
|
|
166
|
+
notice: unique.length > SHORT_WATCH_LIMIT ? `Showing the first ${SHORT_WATCH_LIMIT} of ${unique.length} names.` : skipped,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const plural = (count: number) => `${count} name${count === 1 ? "" : "s"}`;
|
|
171
|
+
|
|
172
|
+
/** Every name in the user's portfolios and watchlists. */
|
|
173
|
+
export function ownNamesUniverse(tickers: readonly Pick<TickerRecord, "metadata">[]): ShortWatchUniverse {
|
|
174
|
+
const members = tickers.filter((ticker) => ticker.metadata.portfolios.length > 0 || ticker.metadata.watchlists.length > 0);
|
|
175
|
+
const symbols = members.filter(listed).map((ticker) => ticker.metadata.ticker.toUpperCase()).filter((symbol) => SYMBOL.test(symbol));
|
|
176
|
+
const skipped = members.length - symbols.length;
|
|
177
|
+
return cap(symbols.sort(), skipped ? `${plural(skipped)} left out: short interest covers US-listed shares.` : null);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export function customUniverse(text: string): ShortWatchUniverse {
|
|
181
|
+
const symbols = text.split(/[\s,]+/).map((value) => value.split(":")[0]!.toUpperCase()).filter(Boolean);
|
|
182
|
+
const valid = symbols.filter((symbol) => SYMBOL.test(symbol));
|
|
183
|
+
const skipped = symbols.length - valid.length;
|
|
184
|
+
return cap(valid, skipped ? `${plural(skipped)} left out: not a US ticker symbol.` : null);
|
|
185
|
+
}
|