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,124 @@
|
|
|
1
|
+
import type { GuidancePayload, KpiGuidance, KpiObservation, KpiSeries, KpiUnit, KpisPayload } from "../../../api-client/company-kpis";
|
|
2
|
+
import type { DataTableColumn } from "../../../components";
|
|
3
|
+
import { scalarPoint, staticSeries } from "../../../components/chart/static/series";
|
|
4
|
+
import type { CompositeChartXAxis } from "../../../components/chart/composite/types";
|
|
5
|
+
import { formatCompact, formatNumber } from "../../../utils/format";
|
|
6
|
+
|
|
7
|
+
export type CompanyRow = KpiObservation | KpiGuidance;
|
|
8
|
+
export const isGuidance = (row: CompanyRow): row is KpiGuidance => "issuedDate" in row;
|
|
9
|
+
export const basisLabel = (basis: string) => ({ reported: "Reported", adjusted: "Adjusted", constant_currency: "Constant currency", organic: "Organic" })[basis] ?? basis;
|
|
10
|
+
export const dimensionLabel = (dimensions: Record<string, string>) => Object.entries(dimensions).sort(([a], [b]) => {
|
|
11
|
+
const rank = (key: string) => ["segment", "product", "geography", "region", "cohort"].includes(key) ? 0 : key === "comparison" ? 2 : 1;
|
|
12
|
+
return rank(a) - rank(b) || a.localeCompare(b);
|
|
13
|
+
}).map(([key, value]) => `${key.replaceAll("_", " ")}: ${value.replaceAll("_", " ")}`).join(" · ");
|
|
14
|
+
export const unitLabel = (row: Pick<CompanyRow, "unit" | "currency" | "dimensions">) => ({
|
|
15
|
+
currency: row.currency ?? "Currency", currency_per_share: `${row.currency ?? "Currency"}/share`, currency_per_unit: `${row.currency ?? "Currency"}/${row.dimensions.unit ?? "unit"}`,
|
|
16
|
+
percent: "%", basis_points: "bp", count: "Count", ratio: "x", volume: row.dimensions.unit ?? "Volume",
|
|
17
|
+
})[row.unit];
|
|
18
|
+
function numberText(value: number | null | undefined, unit: KpiUnit, withUnit = true): string {
|
|
19
|
+
if (value == null) return "--";
|
|
20
|
+
const number = Math.abs(value) >= 10_000 ? formatCompact(value, { fixedDecimals: true }) : formatNumber(value, Number.isInteger(value) ? 0 : 2);
|
|
21
|
+
return `${number}${!withUnit ? "" : unit === "percent" ? "%" : unit === "basis_points" ? "bp" : unit === "ratio" ? "x" : ""}`;
|
|
22
|
+
}
|
|
23
|
+
export const exactObservation = (row: KpiObservation) => !row.valueQualifier || row.valueQualifier === "exact";
|
|
24
|
+
export const observationValue = (row: KpiObservation, withUnit = true) => `${({ exact: "", approximately: "≈ ", at_least: "≥ ", at_most: "≤ ", greater_than: "> ", less_than: "< " })[row.valueQualifier ?? "exact"]}${numberText(row.value, row.unit, withUnit)}`;
|
|
25
|
+
export const valueText = (row: CompanyRow, value: number | null, withUnit = true) => numberText(value, row.unit, withUnit);
|
|
26
|
+
export const rangeText = (row: KpiGuidance, withUnit = true) => row.status === "withdrawn" ? "Withdrawn" : row.hedge === "qualitative" ? row.rangeText
|
|
27
|
+
: row.point !== null ? `${({ approximately: "≈ ", at_least: "≥ ", at_most: "≤ ", greater_than: "> ", less_than: "< " } as Record<string, string>)[row.hedge] ?? ""}${valueText(row, row.point, withUnit)}`
|
|
28
|
+
: row.low !== null && row.high !== null ? `${row.hedge === "approximately" ? "≈ " : ""}${valueText(row, row.low, withUnit)} – ${valueText(row, row.high, withUnit)}`
|
|
29
|
+
: row.low !== null ? `${row.hedge === "greater_than" ? ">" : "≥"} ${valueText(row, row.low, withUnit)}`
|
|
30
|
+
: row.high !== null ? `${row.hedge === "less_than" ? "<" : "≤"} ${valueText(row, row.high, withUnit)}` : row.rangeText;
|
|
31
|
+
/** The unit a value cell carries after its number; percent, bp and x are already in the number. */
|
|
32
|
+
export function unitSuffix(row: Pick<CompanyRow, "unit" | "currency" | "dimensions">): string {
|
|
33
|
+
if (row.unit === "currency") return row.currency ? ` ${row.currency}` : "";
|
|
34
|
+
if (row.unit === "currency_per_share") return ` ${row.currency ?? ""}/sh`.replace(" /", " ");
|
|
35
|
+
if (row.unit === "currency_per_unit" || row.unit === "volume") return ` ${unitLabel(row)}`;
|
|
36
|
+
return "";
|
|
37
|
+
}
|
|
38
|
+
/** Raised reads as good news, a cut as bad, a reiteration as no news. */
|
|
39
|
+
export const directionTone = (direction: KpiGuidance["direction"]) => direction === "raised" ? "positive" as const : direction === "cut" ? "negative" as const
|
|
40
|
+
: direction === "withdrawn" ? "warning" as const : direction === "initiated" ? "text" as const : "muted" as const;
|
|
41
|
+
/** A change is good when it moves the way the metric's owner wants it to. */
|
|
42
|
+
export const changeTone = (row: KpiObservation, value: number | null) => value === null || value === 0 || row.metric.favorable === "neutral" ? "muted" as const
|
|
43
|
+
: (value > 0) === (row.metric.favorable === "higher") ? "positive" as const : "negative" as const;
|
|
44
|
+
export const directionLabel = (direction: KpiGuidance["direction"]) => direction === "not_comparable" ? "Not comparable" : direction.charAt(0).toUpperCase() + direction.slice(1);
|
|
45
|
+
export const outcomeLabel = (row: KpiGuidance) => !row.actual ? "Pending" : row.actual.favorable === "in_line" ? "In range"
|
|
46
|
+
: row.actual.favorable === "neutral" ? row.actual.outcome === "above" ? "Above" : row.actual.outcome === "below" ? "Below" : "In range"
|
|
47
|
+
: row.actual.favorable === "beat" ? "Beat" : "Miss";
|
|
48
|
+
export const seriesLabel = (series: Pick<KpiSeries, "metric" | "basis" | "dimensions" | "unit" | "currency">) =>
|
|
49
|
+
`${series.metric.name} · ${basisLabel(series.basis)} · ${unitLabel(series)}${Object.keys(series.dimensions).length ? ` · ${dimensionLabel(series.dimensions)}` : ""}`;
|
|
50
|
+
export const guideGroupKey = (row: KpiGuidance) => JSON.stringify([row.seriesKey, row.period.start, row.period.end, row.period.kind, row.period.fiscalYear, row.period.fiscalQuarter, row.period.end === null && (row.period.fiscalYear === null || row.period.kind !== "year" && row.period.fiscalQuarter === null) ? row.period.label.toLocaleLowerCase() : null]);
|
|
51
|
+
export function allObservations(data: KpisPayload): KpiObservation[] {
|
|
52
|
+
return [...new Map([...data.series.flatMap((series) => series.observations), ...data.revisions].map((row) => [row.id, row])).values()];
|
|
53
|
+
}
|
|
54
|
+
export function allGuidance(data: GuidancePayload): KpiGuidance[] {
|
|
55
|
+
return [...new Map([...data.guidance, ...data.history].map((row) => [row.id, row])).values()];
|
|
56
|
+
}
|
|
57
|
+
export function observationChange(row: KpiObservation, observations: KpiObservation[]): { value: number | null; unit: string } {
|
|
58
|
+
const fiscalOrder = (item: KpiObservation) => item.period.fiscalYear !== null && (item.period.kind === "year" || item.period.fiscalQuarter !== null)
|
|
59
|
+
? item.period.fiscalYear * 4 + (item.period.fiscalQuarter ?? 0) : null;
|
|
60
|
+
const previousPeriod = (other: KpiObservation) => other.period.end && row.period.end ? other.period.end < row.period.end
|
|
61
|
+
: fiscalOrder(other) !== null && fiscalOrder(row) !== null && fiscalOrder(other)! < fiscalOrder(row)!;
|
|
62
|
+
const prior = observations.filter((other) => other.id !== row.id && other.current && !other.conflict && !other.contested && exactObservation(other) && other.seriesKey === row.seriesKey
|
|
63
|
+
&& other.period.kind === row.period.kind && previousPeriod(other)).sort((a, b) => periodOrder(b).localeCompare(periodOrder(a)))[0];
|
|
64
|
+
if (!prior || (row.conflict || row.contested) || !exactObservation(row)) return { value: null, unit: "" };
|
|
65
|
+
if (row.unit === "percent") return { value: row.value - prior.value, unit: "pp" };
|
|
66
|
+
if (row.unit === "basis_points") return { value: row.value - prior.value, unit: "bp" };
|
|
67
|
+
if (prior.value === 0) return { value: null, unit: "%" };
|
|
68
|
+
return { value: (row.value - prior.value) / Math.abs(prior.value) * 100, unit: "%" };
|
|
69
|
+
}
|
|
70
|
+
export const changeText = (change: { value: number | null; unit: string }) => change.value === null ? "--" : `${change.value > 0 ? "+" : ""}${formatNumber(change.value, 2)}${change.unit}`;
|
|
71
|
+
export const fiscalLabel = (row: CompanyRow) => row.period.fiscalYear === null ? row.period.label
|
|
72
|
+
: row.period.kind === "year" ? `FY${row.period.fiscalYear}`
|
|
73
|
+
: row.period.fiscalQuarter !== null ? `Q${row.period.fiscalQuarter} FY${row.period.fiscalYear}${row.period.kind === "ytd" ? " YTD" : ""}` : row.period.label;
|
|
74
|
+
export const periodOrder = (row: CompanyRow) => row.period.fiscalYear !== null
|
|
75
|
+
? `${row.period.fiscalYear}:${row.period.fiscalQuarter ?? 0}:${row.period.end ?? ""}` : row.period.end ?? row.period.label;
|
|
76
|
+
export function observationChart(rows: KpiObservation[], color: string) {
|
|
77
|
+
const valid = rows.filter((row) => row.current && !row.conflict && !row.contested && exactObservation(row));
|
|
78
|
+
const categorical = valid.some((row) => !row.period.end);
|
|
79
|
+
const values = valid.filter((row) => !categorical || row.period.fiscalYear !== null && (row.period.kind === "year" || row.period.fiscalQuarter !== null))
|
|
80
|
+
.sort((a, b) => periodOrder(a).localeCompare(periodOrder(b)));
|
|
81
|
+
const dates = new Map<string, Date>();
|
|
82
|
+
// These are positions in the plotting API, never calendar dates: both axis and cursor
|
|
83
|
+
// are replaced with fiscal labels, and the captured/source observation retains end:null.
|
|
84
|
+
values.forEach((row, index) => dates.set(row.id, categorical ? new Date(index * 30 * 86_400_000) : new Date(row.period.end!)));
|
|
85
|
+
const first = values[0];
|
|
86
|
+
const compatible = first && values.every((row) => row.seriesKey === first.seriesKey && row.period.kind === first.period.kind);
|
|
87
|
+
const series = values.length >= 2 && compatible ? [staticSeries(values.map((row) => scalarPoint(dates.get(row.id)!, row.value)),
|
|
88
|
+
{ id: `${first.seriesKey}:${first.period.kind}`, label: `${first.metric.name} (${first.period.kind})`, color, calendarSpaced: true })] : [];
|
|
89
|
+
const xAxis: CompositeChartXAxis | undefined = categorical ? {
|
|
90
|
+
ticks: values.map((row, index) => ({ ratio: index / Math.max(1, values.length - 1), label: fiscalLabel(row) })),
|
|
91
|
+
formatCursor: (ratio) => values[Math.max(0, Math.min(values.length - 1, Math.round(ratio * (values.length - 1))))] ? fiscalLabel(values[Math.max(0, Math.min(values.length - 1, Math.round(ratio * (values.length - 1))))]!) : "",
|
|
92
|
+
} : undefined;
|
|
93
|
+
return { series, dates, xAxis, ...(categorical && first ? { viewport: { start: dates.get(first.id)!, end: dates.get(values.at(-1)!.id)! } } : {}) };
|
|
94
|
+
}
|
|
95
|
+
export function guidanceSeries(rows: KpiGuidance[], selected: KpiGuidance | undefined, colors: { low: string; high: string; actual: string }) {
|
|
96
|
+
if (!selected) return [];
|
|
97
|
+
const compatible = rows.filter((row) => guideGroupKey(row) === guideGroupKey(selected) && row.status === "active")
|
|
98
|
+
.sort((a, b) => a.issuedDate.localeCompare(b.issuedDate) || a.asOf.localeCompare(b.asOf));
|
|
99
|
+
const timeline = [...new Map(compatible.map((row) => [row.issuedDate, row])).values()];
|
|
100
|
+
if (timeline.length < 2) return [];
|
|
101
|
+
const spec = [{ id: "low", label: "Guide low", color: colors.low }, { id: "high", label: "Guide high", color: colors.high }, { id: "point", label: "Point guide", color: colors.high }] as const;
|
|
102
|
+
const series = spec.flatMap((field) => timeline.filter((row) => row[field.id] !== null).length < 2 ? [] : [staticSeries(timeline.map((row) => scalarPoint(new Date(row.issuedDate), row[field.id])), { ...field, calendarSpaced: true })]);
|
|
103
|
+
const actual = selected.actual;
|
|
104
|
+
if (actual && series.length) series.push(staticSeries(timeline.map((row) => scalarPoint(new Date(row.issuedDate), actual.value)), { id: "actual", label: "Later actual", color: colors.actual, calendarSpaced: true }));
|
|
105
|
+
return series;
|
|
106
|
+
}
|
|
107
|
+
export function companyColumns(guidance: boolean, evidence: boolean, history: boolean, trend = false): DataTableColumn[] {
|
|
108
|
+
const columns: DataTableColumn[] = [
|
|
109
|
+
{ id: "metric", label: "Metric", width: 27, flexGrow: 1, align: "left" },
|
|
110
|
+
{ id: "period", label: "Fiscal period", width: 14, align: "left" },
|
|
111
|
+
{ id: "value", label: guidance ? "Guide" : "Value", width: guidance ? 26 : 16, align: "right" },
|
|
112
|
+
{ id: "change", label: guidance ? "Action" : "Prior change", width: 13, align: "right" },
|
|
113
|
+
...(trend ? [{ id: "trend", label: "Trend", width: 16, align: "left" as const }] : []),
|
|
114
|
+
...(guidance ? [{ id: "issued", label: "Issued", width: 11, align: "left" as const },
|
|
115
|
+
...(history ? [{ id: "actual", label: "Actual", width: 16, align: "right" as const }, { id: "outcome", label: "Outcome", width: 10, align: "left" as const }] : [])] : []),
|
|
116
|
+
{ id: "basis", label: "Basis", width: 18, align: "left" },
|
|
117
|
+
{ id: "scope", label: "Scope", width: 24, align: "left" },
|
|
118
|
+
...(evidence ? [{ id: "published", label: "Published", width: 11, align: "left" as const }, { id: "confidence", label: "Confidence", width: 11, align: "right" as const },
|
|
119
|
+
{ id: "revision", label: "Revision", width: 12, align: "left" as const }, { id: "quote", label: "Evidence", width: 54, align: "left" as const }] : []),
|
|
120
|
+
];
|
|
121
|
+
const order = evidence ? ["metric", "period", "quote", "published", "confidence", "revision", "value", "basis", "scope", "issued", "change"]
|
|
122
|
+
: history ? ["metric", "period", "actual", "outcome", "value", "issued", "change", "basis", "scope"] : null;
|
|
123
|
+
return order ? columns.sort((a, b) => order.indexOf(a.id) - order.indexOf(b.id)) : columns;
|
|
124
|
+
}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { useCallback, useMemo, useRef } from "react";
|
|
2
|
+
import { isAccessDenied } from "../../../api-client/errors";
|
|
3
|
+
import { usePlanAccess } from "../../../api-client/plan-access";
|
|
4
|
+
import type { KpiObservation } from "../../../api-client/company-kpis";
|
|
5
|
+
import { ChartTableHeader, DataTableStackView, DetailScrollBody, EmptyState, KeyValueRow, PaneStatusBody, QueryBar, SectionHeading,
|
|
6
|
+
useChartTableSelection, usePaneMenuItems, usePaneNoticeFooter, usePaneStatusFooter, usePaneTabs, type DataTableCell, type PaneHint } from "../../../components";
|
|
7
|
+
import { usePaneRefreshKey } from "../../../components/data-table/table-pane";
|
|
8
|
+
import { useAsyncResource, useAutoRefresh, usePaneSettingValue, usePluginAppActions, usePluginPaneState } from "../../../public/react";
|
|
9
|
+
import { usePaneTickerIdentity } from "../../../state/hooks/pane-ticker";
|
|
10
|
+
import { useThemeColors } from "../../../theme/theme-context";
|
|
11
|
+
import type { PaneProps } from "../../../types/plugin";
|
|
12
|
+
import { Box, Text, useRendererHost, useUiCapabilities, type ScrollBoxRenderable } from "../../../ui";
|
|
13
|
+
import { SignInWall } from "../cloud/auth-actions";
|
|
14
|
+
import { CLOUD_PLAN_KEY, useCloudUpgradeAction } from "../shared/cloud-upgrade";
|
|
15
|
+
import { Blurred, LockedOverlay, UpgradeLabel } from "../shared/locked-rows";
|
|
16
|
+
import { isCloudSessionRequired, useResearchCloudSession } from "../shared/research-cloud-session";
|
|
17
|
+
import { cachedCompanyData, loadCompanyData, KPI_UNAVAILABLE, validateCompanyData, type CompanyDataset, type CompanyMode } from "./client";
|
|
18
|
+
import { useCompanyEvidence } from "./screenshot-evidence";
|
|
19
|
+
import { allGuidance, allObservations, basisLabel, changeText, changeTone, companyColumns, dimensionLabel, directionLabel, directionTone, guideGroupKey, guidanceSeries, fiscalLabel,
|
|
20
|
+
isGuidance, exactObservation, observationValue, observationChange, observationChart, periodOrder, outcomeLabel, rangeText, seriesLabel, unitLabel, unitSuffix, valueText, type CompanyRow } from "./model";
|
|
21
|
+
import { PriceSparkline } from "../../../components/price-sparkline/view";
|
|
22
|
+
import type { PricePoint } from "../../../types/financials";
|
|
23
|
+
import { toneColor, withoutQuietColumns } from "../shared/research-cells";
|
|
24
|
+
|
|
25
|
+
/** Columns that say nothing while every row is the company's consolidated, as-reported figure. */
|
|
26
|
+
const QUIET_COLUMNS = { basis: ["Reported"], scope: ["Consolidated"] };
|
|
27
|
+
|
|
28
|
+
type Item = { id: string; row: CompanyRow } | { id: string; row: null };
|
|
29
|
+
const getId = (item: Item) => item.id;
|
|
30
|
+
function DisclosureEvidence({ row, sourceId, onSource, width }: { row: CompanyRow; sourceId: string | null; onSource: (id: string) => void; width: number }) {
|
|
31
|
+
const colors = useThemeColors();
|
|
32
|
+
const evidence = row.evidence.find((entry) => entry.id === sourceId) ?? row.evidence[0]!;
|
|
33
|
+
return <Box flexDirection="column" paddingX={1}>
|
|
34
|
+
{row.evidence.length > 1 ? <QueryBar width={Math.max(1, width - 4)} filters={[{ id: "source", label: "Document", value: evidence.id,
|
|
35
|
+
options: row.evidence.map((entry) => ({ value: entry.id, label: `${entry.publishedAt.slice(0, 10)} · ${entry.title}` })), onChange: onSource }]} /> : null}
|
|
36
|
+
<KeyValueRow label="Value" value={isGuidance(row) ? rangeText(row) : observationValue(row)} detail={row.currency || row.unit === "volume" || row.unit === "count" ? unitLabel(row) : undefined} labelWidth={18} />
|
|
37
|
+
<KeyValueRow label="Fiscal period" value={row.period.label} detail={row.period.end ? row.period.start ? `${row.period.start} to ${row.period.end}` : `${row.period.kind === "instant" ? "As of" : "Ended"} ${row.period.end}` : "Calendar dates unavailable"} labelWidth={18} />
|
|
38
|
+
<KeyValueRow label="Basis" value={basisLabel(row.basis)} labelWidth={18} />
|
|
39
|
+
<KeyValueRow label="Scope" value={dimensionLabel(row.dimensions) || "Consolidated"} labelWidth={18} />
|
|
40
|
+
<KeyValueRow label="Definition" value={row.metric.definition} labelWidth={18} />
|
|
41
|
+
<KeyValueRow label="Revision" value={`${row.revision}${row.current ? " · current" : " · superseded"}${!isGuidance(row) && (row.conflict || row.contested) ? " · conflicting disclosures" : ""}`} labelWidth={18} />
|
|
42
|
+
{row.revisionReason ? <KeyValueRow label="Correction" value={row.revisionReason} labelWidth={18} /> : null}
|
|
43
|
+
{isGuidance(row) ? <>
|
|
44
|
+
<KeyValueRow label="Issued" value={row.issuedDate} detail={directionLabel(row.direction)} labelWidth={18} />
|
|
45
|
+
<KeyValueRow label="Source range" value={row.rangeText} labelWidth={18} />
|
|
46
|
+
{row.conditions ? <KeyValueRow label="Conditions" value={row.conditions} labelWidth={18} /> : null}
|
|
47
|
+
<KeyValueRow label="Later actual" value={row.actual ? valueText(row, row.actual.value) : "Pending"} detail={row.actual ? outcomeLabel(row) : undefined} labelWidth={18} />
|
|
48
|
+
</> : null}
|
|
49
|
+
<Box key={evidence.id} flexDirection="column" paddingTop={1}>
|
|
50
|
+
<SectionHeading title="Source evidence" />
|
|
51
|
+
<KeyValueRow label="Document" value={evidence.title} labelWidth={18} />
|
|
52
|
+
<KeyValueRow label="Published" value={evidence.publishedAt.slice(0, 10)} detail={`${evidence.country} · ${evidence.language}`} labelWidth={18} />
|
|
53
|
+
<KeyValueRow label="Confidence" value={`${Math.round(evidence.confidence * 100)}%`} detail={evidence.quoteMatchMode === "exact" ? "Exact text match" : "Normalized text match"} labelWidth={18} />
|
|
54
|
+
<Box paddingY={1}><Text fg={colors.textBright}>{evidence.quote}</Text></Box>
|
|
55
|
+
<Text fg={colors.textDim}>{evidence.url}</Text>
|
|
56
|
+
</Box>
|
|
57
|
+
</Box>;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function CompanyKpisPane(props: PaneProps) {
|
|
61
|
+
const { symbol } = usePaneTickerIdentity();
|
|
62
|
+
return <CompanyView key={`${symbol}:kpis`} {...props} symbol={symbol} mode="kpis" />;
|
|
63
|
+
}
|
|
64
|
+
export function CompanyGuidancePane(props: PaneProps) {
|
|
65
|
+
const { symbol } = usePaneTickerIdentity();
|
|
66
|
+
return <CompanyView key={`${symbol}:guidance`} {...props} symbol={symbol} mode="guidance" />;
|
|
67
|
+
}
|
|
68
|
+
function CompanyView({ symbol, mode, width, height, focused }: PaneProps & { symbol: string | null; mode: CompanyMode }) {
|
|
69
|
+
const colors = useThemeColors();
|
|
70
|
+
const host = useRendererHost();
|
|
71
|
+
const desktop = !!useUiCapabilities().nativePaneChrome;
|
|
72
|
+
const { createPaneFromTemplate } = usePluginAppActions();
|
|
73
|
+
const session = useResearchCloudSession();
|
|
74
|
+
const access = usePlanAccess();
|
|
75
|
+
const accessKey = `${session.requestKey}:${access.hasProAccess ? "full" : "preview"}`;
|
|
76
|
+
const openUpgrade = useCloudUpgradeAction(mode === "kpis" ? "kpis" : "guide");
|
|
77
|
+
const [snapshotSetting] = usePaneSettingValue<CompanyDataset | null>("companySnapshot", null);
|
|
78
|
+
const snapshot = useMemo(() => { try { return snapshotSetting ? validateCompanyData(snapshotSetting) : null; } catch { return null; } }, [snapshotSetting]);
|
|
79
|
+
const loader = useCallback((force: boolean) => snapshot ? Promise.resolve({ payload: snapshot, stale: false, refreshError: null }) : loadCompanyData(mode, symbol!, accessKey, force), [mode, symbol, accessKey, snapshot]);
|
|
80
|
+
const resource = useAsyncResource(symbol ? loader : null, { initialData: () => symbol ? cachedCompanyData(mode, symbol, accessKey) : null, clearOnError: isAccessDenied });
|
|
81
|
+
const data = resource.data?.payload;
|
|
82
|
+
const kpis = data && "series" in data ? data : null;
|
|
83
|
+
const guidance = data && "guidance" in data ? data : null;
|
|
84
|
+
const [openingTab] = usePaneSettingValue("tab", "table");
|
|
85
|
+
const [tabValue, setTab] = usePluginPaneState<string>("company:tab", openingTab);
|
|
86
|
+
const tab = ["table", "chart", "evidence", ...(guidance ? ["history"] : [])].includes(tabValue) ? tabValue : "table";
|
|
87
|
+
const [openingMetric] = usePaneSettingValue("metric", "all");
|
|
88
|
+
const [metric, setMetric] = usePluginPaneState<string>("company:metric", openingMetric);
|
|
89
|
+
const [plotKey, setPlotKey] = usePluginPaneState<string>("company:plot", "");
|
|
90
|
+
const [selectedId, setSelected] = usePluginPaneState<string | null>(`company:selected:${tab}`, null);
|
|
91
|
+
const [openId, setOpen] = usePluginPaneState<string | null>("company:open", null);
|
|
92
|
+
const [sourceId, setSource] = usePluginPaneState<string | null>("company:source", null);
|
|
93
|
+
const [sort, setSort] = usePluginPaneState<{ column: string; direction: "asc" | "desc" }>("company:sort", { column: "period", direction: "desc" });
|
|
94
|
+
const detailScrollRef = useRef<ScrollBoxRenderable | null>(null);
|
|
95
|
+
const observations = useMemo(() => kpis ? allObservations(kpis) : [], [kpis]);
|
|
96
|
+
const guides = useMemo(() => guidance ? allGuidance(guidance) : [], [guidance]);
|
|
97
|
+
const allRows = useMemo<CompanyRow[]>(() => [...observations, ...guides], [observations, guides]);
|
|
98
|
+
const eligible = useMemo(() => allRows.filter((row) => metric === "all" || row.metricId === metric), [allRows, metric]);
|
|
99
|
+
const plotOptions = useMemo(() => mode === "kpis"
|
|
100
|
+
? [...new Map(eligible.filter((row) => !isGuidance(row)).map((row) => [`${row.seriesKey}:${row.period.kind}`, { value: `${row.seriesKey}:${row.period.kind}`, label: `${seriesLabel(row)} · ${row.period.kind}` }])).values()]
|
|
101
|
+
: [...new Map(eligible.filter(isGuidance).map((row) => [guideGroupKey(row), { value: guideGroupKey(row), label: `${seriesLabel(row)} · ${row.period.label}` }])).values()], [eligible, mode]);
|
|
102
|
+
const activePlot = plotOptions.some((option) => option.value === plotKey) ? plotKey : plotOptions[0]?.value ?? "";
|
|
103
|
+
const rows = useMemo(() => {
|
|
104
|
+
const values = eligible.filter((row) => tab === "chart" ? (isGuidance(row) ? guideGroupKey(row) : `${row.seriesKey}:${row.period.kind}`) === activePlot
|
|
105
|
+
: tab === "history" ? isGuidance(row) && !!row.actual
|
|
106
|
+
: tab === "evidence" ? true : isGuidance(row) ? guidance?.guidance.some((current) => current.id === row.id) : kpis?.series.some((series) => series.latest.id === row.id));
|
|
107
|
+
const key = (row: CompanyRow): string | number | null => {
|
|
108
|
+
const guide = isGuidance(row) ? row : null;
|
|
109
|
+
return sort.column === "metric" ? row.metric.name : sort.column === "value" ? guide ? guide.point ?? guide.low ?? guide.high : (row as KpiObservation).value
|
|
110
|
+
: sort.column === "issued" ? guide?.issuedDate ?? null : sort.column === "confidence" ? row.confidence
|
|
111
|
+
: sort.column === "actual" ? guide?.actual?.value ?? null : sort.column === "outcome" ? guide ? outcomeLabel(guide) : null
|
|
112
|
+
: sort.column === "basis" ? row.basis : sort.column === "unit" ? unitLabel(row) : sort.column === "scope" ? dimensionLabel(row.dimensions)
|
|
113
|
+
: sort.column === "published" ? row.evidence[0]!.publishedAt : sort.column === "revision" ? row.revision
|
|
114
|
+
: sort.column === "quote" ? row.evidence[0]!.quote : sort.column === "change" ? guide ? guide.direction : observationChange(row as KpiObservation, observations).value
|
|
115
|
+
: periodOrder(row);
|
|
116
|
+
};
|
|
117
|
+
return [...values].sort((a, b) => { const x = key(a), y = key(b);
|
|
118
|
+
return x === null || y === null ? x === y ? a.id.localeCompare(b.id) : x === null ? 1 : -1
|
|
119
|
+
: (x < y ? -1 : x > y ? 1 : a.metric.name.localeCompare(b.metric.name) || dimensionLabel(a.dimensions).localeCompare(dimensionLabel(b.dimensions)) || a.id.localeCompare(b.id)) * (sort.direction === "asc" ? 1 : -1);
|
|
120
|
+
});
|
|
121
|
+
}, [eligible, tab, activePlot, guidance, kpis, sort, observations]);
|
|
122
|
+
const selected = rows.find((row) => row.id === selectedId) ?? rows[0];
|
|
123
|
+
const openRow = allRows.find((row) => row.id === openId);
|
|
124
|
+
const activeRow = openRow ?? selected;
|
|
125
|
+
const preview = data?.access === "preview" && data.lockedRows > 0;
|
|
126
|
+
const lockedCount = preview ? Math.min(3, data.lockedRows) : 0;
|
|
127
|
+
const items = useMemo<Item[]>(() => [...rows.map((row) => ({ id: row.id, row })), ...Array.from({ length: lockedCount }, (_, index) => ({ id: `locked:${index}`, row: null }))], [rows, lockedCount]);
|
|
128
|
+
// One trend per series beside its latest value, once a series has three comparable points.
|
|
129
|
+
const trends = useMemo(() => {
|
|
130
|
+
const map = new Map<string, PricePoint[]>();
|
|
131
|
+
for (const series of kpis?.series ?? []) {
|
|
132
|
+
const points = series.observations.filter((row) => row.current && !row.conflict && !row.contested && exactObservation(row) && row.period.end && row.period.kind === series.latest.period.kind)
|
|
133
|
+
.sort((a, b) => periodOrder(a).localeCompare(periodOrder(b))).map((row) => ({ date: new Date(row.period.end!), close: row.value }));
|
|
134
|
+
if (points.length >= 3) map.set(series.latest.id, points);
|
|
135
|
+
}
|
|
136
|
+
return map;
|
|
137
|
+
}, [kpis]);
|
|
138
|
+
const columns = useMemo(() => withoutQuietColumns(companyColumns(mode === "guidance", tab === "evidence", tab === "history", mode === "kpis" && tab === "table" && trends.size > 0 && width >= 100),
|
|
139
|
+
rows, (row, id) => id === "basis" ? basisLabel(row.basis) : id === "scope" ? dimensionLabel(row.dimensions) || "Consolidated" : "", QUIET_COLUMNS), [mode, tab, trends, rows, width]);
|
|
140
|
+
const metricOptions = useMemo(() => [{ value: "all", label: "All metrics" }, ...[...new Map(allRows.map((row) => [row.metricId, { value: row.metricId, label: row.metric.name }])).values()]], [allRows]);
|
|
141
|
+
const kpiChart = useMemo(() => observationChart(rows.filter((row): row is KpiObservation => !isGuidance(row)), colors.warning), [rows, colors.warning]);
|
|
142
|
+
const series = useMemo(() => tab !== "chart" ? [] : mode === "kpis" ? kpiChart.series
|
|
143
|
+
: guidanceSeries(guides, selected && isGuidance(selected) ? selected : undefined, { low: colors.textMuted, high: colors.warning, actual: colors.positive }), [tab, mode, kpiChart, guides, selected, colors]);
|
|
144
|
+
const link = useChartTableSelection({ rows, getId: (row) => row.id, getDate: (row) => isGuidance(row) ? new Date(row.issuedDate) : kpiChart.dates.get(row.id) ?? null,
|
|
145
|
+
selectedId: selected?.id ?? null, onSelect: setSelected, focused: focused && !openRow, enabled: tab === "chart" });
|
|
146
|
+
const { strip, rows: tabRows } = usePaneTabs(data ? { tabs: [{ value: "table", label: mode === "guidance" ? "Tracker" : "Table" }, { value: "chart", label: "Chart" },
|
|
147
|
+
...(mode === "guidance" ? [{ value: "history", label: "History" }] : []), { value: "evidence", label: "Evidence" }], activeValue: tab,
|
|
148
|
+
onSelect: (value) => { setTab(value); setOpen(null); }, focused, dense: true } : null);
|
|
149
|
+
useAutoRefresh(resource.updatedAt, resource.load);
|
|
150
|
+
usePaneRefreshKey(() => void resource.reload(), { focused });
|
|
151
|
+
useCompanyEvidence(data ?? null, mode, tab, rows.map((row) => row.id));
|
|
152
|
+
const hints: PaneHint[] = [
|
|
153
|
+
...(activeRow ? [{ id: "evidence", key: "e", label: "vidence", onPress: () => setOpen(activeRow.id) },
|
|
154
|
+
{ id: "source", key: "o", label: "pen source", onPress: () => void host.openExternal((activeRow.evidence.find((entry) => entry.id === sourceId) ?? activeRow.evidence[0]!).url) }] : []),
|
|
155
|
+
...(symbol ? [{ id: "related", key: "c", label: mode === "kpis" ? "ompany guidance" : "ompany KPIs", onPress: () => createPaneFromTemplate(mode === "kpis" ? "company-guidance-pane" : "company-kpis-pane", { symbol }) },
|
|
156
|
+
] : []),
|
|
157
|
+
...(preview ? [{ id: "upgrade", key: CLOUD_PLAN_KEY, label: "upgrade", title: "Upgrade to Pro", onPress: openUpgrade }] : []),
|
|
158
|
+
];
|
|
159
|
+
usePaneMenuItems("company-disclosures:research", () => symbol ? [
|
|
160
|
+
{ id: "description", label: "Description (DES)", onSelect: () => createPaneFromTemplate("new-ticker-detail-pane", { symbol }) },
|
|
161
|
+
{ id: "financials", label: "Financial Analysis (FA)", onSelect: () => createPaneFromTemplate("financial-analysis-pane", { symbol }) },
|
|
162
|
+
{ id: "price-chart", label: "Price Chart (G)", onSelect: () => createPaneFromTemplate("chart-composer-pane", { arg: symbol }) },
|
|
163
|
+
] : null, [symbol, createPaneFromTemplate]);
|
|
164
|
+
usePaneStatusFooter({ registrationId: "company-kpis", loading: resource.loading, error: data ? resource.error : null, stale: resource.data?.stale,
|
|
165
|
+
info: data?.asOf ? [{ id: "as-of", parts: [{ text: `as of ${data.asOf.slice(0, 10)}`, tone: "muted" as const }] }] : [], hints });
|
|
166
|
+
usePaneNoticeFooter({ registrationId: "company-kpis:notices", focused, notices: [resource.data?.refreshError,
|
|
167
|
+
data?.truncated && data.access === "full" ? "The response reached its stored-record limit. Narrow the metric or date range in a CLI or REST query." : null,
|
|
168
|
+
data?.coverage.conflicts ? "Conflicting disclosures are retained in Evidence and excluded from comparable trends." : null].filter((value): value is string => !!value) });
|
|
169
|
+
if (!symbol) return <EmptyState title="Select a ticker." />;
|
|
170
|
+
if (!data && isCloudSessionRequired(resource.error)) return <SignInWall placement="company-kpis-signin" action="view company KPIs and guidance" needsVerification={session.needsVerification} />;
|
|
171
|
+
const bodyHeight = Math.max(3, height - tabRows);
|
|
172
|
+
const query = <QueryBar width={width} filters={[{ id: "metric", label: "Metric", value: metric, defaultValue: "all", options: metricOptions,
|
|
173
|
+
onChange: (value: string) => { setMetric(value); setSelected(null); setOpen(null); } }, ...(tab === "chart" && plotOptions.length ? [{ id: "series", label: "Series", value: activePlot,
|
|
174
|
+
options: plotOptions, onChange: (value: string) => { setPlotKey(value); setSelected(null); } }] : [])]} />;
|
|
175
|
+
const renderCell = (item: Item, column: (typeof columns)[number]): DataTableCell => {
|
|
176
|
+
const row = item.row;
|
|
177
|
+
if (!row) {
|
|
178
|
+
if (!desktop && column.id === "metric" && item.id === "locked:0") return { text: "Unlock with Pro", content: <UpgradeLabel text="Unlock with Pro" onPress={openUpgrade} />, onMouseDown: openUpgrade };
|
|
179
|
+
return desktop ? { text: "", content: <Blurred><Text fg={colors.textDim}>{column.id === "metric" ? "Additional disclosure" : "Hidden"}</Text></Blurred> } : { text: "░░░░░", color: colors.textDim };
|
|
180
|
+
}
|
|
181
|
+
const guide = isGuidance(row) ? row : null;
|
|
182
|
+
if (column.id === "trend") {
|
|
183
|
+
const points = trends.get(row.id);
|
|
184
|
+
if (!points) return { text: "" };
|
|
185
|
+
const change = observationChange(row as KpiObservation, observations).value;
|
|
186
|
+
const tone = changeTone(row as KpiObservation, change);
|
|
187
|
+
return { text: "", content: <PriceSparkline priceHistory={points} width={column.width} period="all" trend={tone === "muted" ? "neutral" : tone} /> };
|
|
188
|
+
}
|
|
189
|
+
if (column.id === "change") {
|
|
190
|
+
if (guide) return { text: directionLabel(guide.direction), color: toneColor(directionTone(guide.direction), colors), keepColorWhenSelected: guide.direction === "raised" || guide.direction === "cut" };
|
|
191
|
+
const change = observationChange(row as KpiObservation, observations);
|
|
192
|
+
return { text: changeText(change), value: change.value, color: toneColor(changeTone(row as KpiObservation, change.value), colors) };
|
|
193
|
+
}
|
|
194
|
+
const text = column.id === "metric" ? row.metric.name : column.id === "period" ? fiscalLabel(row) : column.id === "value" ? `${guide ? rangeText(guide) : observationValue(row as KpiObservation)}${guide?.status === "withdrawn" || guide?.hedge === "qualitative" ? "" : unitSuffix(row)}`
|
|
195
|
+
: column.id === "unit" ? unitLabel(row)
|
|
196
|
+
: column.id === "basis" ? basisLabel(row.basis) : column.id === "scope" ? dimensionLabel(row.dimensions) || "Consolidated"
|
|
197
|
+
: column.id === "issued" ? guide?.issuedDate ?? "--" : column.id === "actual" ? guide?.actual ? `${valueText(row, guide.actual.value)}${unitSuffix(row)}` : "--"
|
|
198
|
+
: column.id === "outcome" ? guide ? outcomeLabel(guide) : "--" : column.id === "published" ? row.evidence[0]!.publishedAt.slice(0, 10)
|
|
199
|
+
: column.id === "confidence" ? `${Math.round(row.confidence * 100)}%` : column.id === "revision" ? `${row.revision} ${row.current ? "current" : "superseded"}` : row.evidence[0]!.quote;
|
|
200
|
+
return { text, ...(column.id === "value" && !guide ? { value: exactObservation(row as KpiObservation) ? (row as KpiObservation).value : observationValue(row as KpiObservation) } : column.id === "actual" ? { value: guide?.actual?.value } : {}),
|
|
201
|
+
color: column.id === "metric" ? colors.textBright : column.id === "value" || column.id === "actual" ? colors.textBright
|
|
202
|
+
: column.id === "outcome" && guide?.actual ? guide.actual.favorable === "beat" ? colors.positive : guide.actual.favorable === "miss" ? colors.negative : colors.text
|
|
203
|
+
: column.id === "period" || column.id === "basis" || column.id === "scope" || column.id === "issued" || column.id === "published" || column.id === "revision" || column.id === "confidence" ? colors.textDim : colors.text,
|
|
204
|
+
keepColorWhenSelected: column.id === "outcome" && (guide?.actual?.favorable === "beat" || guide?.actual?.favorable === "miss") };
|
|
205
|
+
};
|
|
206
|
+
return <Box width={width} height={height} flexDirection="column">
|
|
207
|
+
{strip}
|
|
208
|
+
<PaneStatusBody loading={!data && resource.loading} error={!data && resource.error !== KPI_UNAVAILABLE ? resource.error : null}
|
|
209
|
+
empty={!data && resource.error === KPI_UNAVAILABLE} emptyTitle={KPI_UNAVAILABLE} subject="company disclosures">
|
|
210
|
+
{data ? <DataTableStackView<Item> focused={focused} rootWidth={width} rootHeight={bodyHeight} columns={columns} items={items} getItemKey={getId}
|
|
211
|
+
selection={{ kind: "id", selectedId: selected?.id ?? null, getId, onChange: setSelected }}
|
|
212
|
+
onActivate={(item) => item.row ? setOpen(item.row.id) : openUpgrade()} renderCell={renderCell} freezeFirstColumn selectedTextOverridesCellColor showHorizontalScrollbar
|
|
213
|
+
detailOpen={!!openRow} onBack={() => setOpen(null)} detailTitle={openRow ? `${openRow.metric.name} · ${fiscalLabel(openRow)}` : undefined}
|
|
214
|
+
detailScrollRef={detailScrollRef} detailContent={openRow ? <DetailScrollBody ref={detailScrollRef} resetScrollKey={openRow.id}><DisclosureEvidence row={openRow} sourceId={sourceId} onSource={setSource} width={width} /></DetailScrollBody> : null}
|
|
215
|
+
sortColumnId={sort.column} sortDirection={sort.direction} onHeaderClick={(column) => setSort((previous) => ({ column, direction: previous.column === column && previous.direction === "desc" ? "asc" : "desc" }))}
|
|
216
|
+
resetScrollKey={`${mode}:${symbol}:${tab}:${metric}:${activePlot}`}
|
|
217
|
+
emptyStateTitle={tab === "history" ? "Actuals have not been matched to these guidance periods yet." : "No disclosed observations for this selection yet."}
|
|
218
|
+
rootBefore={<ChartTableHeader width={width} height={bodyHeight} tableRows={items.length} tableColumns={columns} query={query}
|
|
219
|
+
chart={tab === "chart" ? { series, ...(mode === "kpis" ? { xAxis: kpiChart.xAxis, viewport: kpiChart.viewport } : {}), empty: preview ? "Full history is available with Pro." : "History is accumulating. Two comparable disclosures are needed for a trend.",
|
|
220
|
+
formatValue: (value) => selected ? `${valueText(selected, value)}${selected.currency ? ` ${unitLabel(selected)}` : ""}` : String(value),
|
|
221
|
+
formatAxisValue: (value) => selected ? valueText(selected, value) : String(value), remoteKind: "company-disclosure-history", ...link } : null} />}
|
|
222
|
+
bodyAfter={lockedCount && desktop ? <LockedOverlay rows={lockedCount} text="Upgrade for all disclosures and history" onPress={openUpgrade} /> : undefined}
|
|
223
|
+
/> : null}
|
|
224
|
+
</PaneStatusBody>
|
|
225
|
+
</Box>;
|
|
226
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { usePaneMenuItems } from "../../../components";
|
|
2
|
+
import { usePluginAppActions } from "../../../public/react";
|
|
3
|
+
|
|
4
|
+
/** Existing estimates and reported earnings stay in place; their menu opens cited company disclosures. */
|
|
5
|
+
export function useCompanyDisclosureLinks(symbol: string | null) {
|
|
6
|
+
const { createPaneFromTemplate } = usePluginAppActions();
|
|
7
|
+
usePaneMenuItems("company-disclosures:related", () => symbol ? [
|
|
8
|
+
{ id: "company-kpis", label: "Company KPIs (KPIS)", onSelect: () => createPaneFromTemplate("company-kpis-pane", { symbol }) },
|
|
9
|
+
{ id: "company-guidance", label: "Company Guidance (GUIDE)", onSelect: () => createPaneFromTemplate("company-guidance-pane", { symbol }) },
|
|
10
|
+
] : null, [symbol, createPaneFromTemplate]);
|
|
11
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { PaneScreenshotEvidenceHook } from "../../../cli/pane-functions/screenshot-evidence";
|
|
2
|
+
import { useRemoteUiNode } from "../../../remote/semantic-tree";
|
|
3
|
+
import { isRecord } from "../../../utils/guards";
|
|
4
|
+
import { companyQuery, fetchCompanyData, validateCompanyData, type CompanyDataset, type CompanyMode } from "./client";
|
|
5
|
+
import { allGuidance, allObservations } from "./model";
|
|
6
|
+
|
|
7
|
+
interface Evidence { kind: "company-disclosures"; version: 1; complete: boolean; plottedValueCount: number; payload: CompanyDataset; mode: CompanyMode; tab: string; rowIds: string[]; }
|
|
8
|
+
export function useCompanyEvidence(payload: CompanyDataset | null, mode: CompanyMode, tab: string, rowIds: string[]) {
|
|
9
|
+
useRemoteUiNode({ role: "chart-data", label: "Rendered company disclosures", getMetadata: () => ({
|
|
10
|
+
kind: "company-disclosures", version: 1, complete: !!payload, ready: !!payload, plottedValueCount: rowIds.length, payload, mode, tab, rowIds,
|
|
11
|
+
}) });
|
|
12
|
+
}
|
|
13
|
+
function screenshotEvidence(mode: CompanyMode): PaneScreenshotEvidenceHook<Evidence> {
|
|
14
|
+
return {
|
|
15
|
+
paneId: mode === "kpis" ? "company-kpis" : "company-guidance", kind: "company-disclosures", label: "company disclosures",
|
|
16
|
+
async prepare({ resolved }) {
|
|
17
|
+
const symbol = resolved.createOptions?.symbol ?? resolved.createOptions?.arg;
|
|
18
|
+
if (!symbol) throw new Error("A company disclosure screenshot requires a ticker");
|
|
19
|
+
const payload = await fetchCompanyData(mode, symbol, companyQuery(resolved.options));
|
|
20
|
+
return { settings: { companySnapshot: payload }, financials: [[payload.symbol, { annualStatements: [], quarterlyStatements: [], priceHistory: [] }]] };
|
|
21
|
+
},
|
|
22
|
+
read(value) {
|
|
23
|
+
if (!isRecord(value) || value.kind !== "company-disclosures" || value.version !== 1 || value.mode !== mode || !isRecord(value.payload)
|
|
24
|
+
|| !["table", "chart", "history", "evidence"].includes(String(value.tab)) || !Array.isArray(value.rowIds) || !value.rowIds.every((id) => typeof id === "string") || value.complete !== true) return null;
|
|
25
|
+
try {
|
|
26
|
+
const payload = validateCompanyData(value.payload as unknown as CompanyDataset);
|
|
27
|
+
const rows = "series" in payload ? allObservations(payload) : allGuidance(payload);
|
|
28
|
+
if (value.plottedValueCount !== value.rowIds.length || value.rowIds.some((id) => !rows.some((row) => row.id === id))) return null;
|
|
29
|
+
return value as unknown as Evidence;
|
|
30
|
+
} catch { return null; }
|
|
31
|
+
},
|
|
32
|
+
mismatches(evidence, { resolved, payload }) {
|
|
33
|
+
const snapshot = payload.config.layout.instances.find((entry) => entry.instanceId === payload.paneId)?.settings?.companySnapshot;
|
|
34
|
+
const issues: string[] = [];
|
|
35
|
+
if (JSON.stringify(evidence.payload) !== JSON.stringify(snapshot)) issues.push("Company disclosures differ from the captured source data");
|
|
36
|
+
if (evidence.tab !== (resolved.options.tab ?? "table")) issues.push("Company disclosure tab does not match");
|
|
37
|
+
return issues;
|
|
38
|
+
},
|
|
39
|
+
unavailable: (evidence) => evidence?.complete ? [] : ["company disclosures"],
|
|
40
|
+
symbols: ({ payload }) => payload.financials.map(([symbol]) => symbol),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export const companyKpisScreenshotEvidence = screenshotEvidence("kpis");
|
|
44
|
+
export const companyGuidanceScreenshotEvidence = screenshotEvidence("guidance");
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
import { creditDocumentsModule } from "./credit-documents";
|
|
2
|
+
import { attentionModule } from "./attention";
|
|
3
|
+
import { companyAttentionModule } from "./company-attention";
|
|
4
|
+
import { catalystsModule } from "./catalysts";
|
|
5
|
+
import { companyKpisModule } from "./company-kpis";
|
|
6
|
+
import { powerModule } from "./power";
|
|
7
|
+
import { perpsModule } from "./perps";
|
|
8
|
+
import { exposureModule } from "./exposure";
|
|
9
|
+
import { supplyChainModule } from "./supply-chain";
|
|
10
|
+
import { awardsModule } from "./awards";
|
|
1
11
|
import { cryptoBoardModule } from "./crypto-board";
|
|
2
12
|
import { portfolioAnalyticsModule } from "./analytics";
|
|
3
13
|
import { brokerManagerModule } from "./broker-manager";
|
|
@@ -12,12 +22,15 @@ import { creditBoardsModule } from "./credit-boards";
|
|
|
12
22
|
import { creditConditionsModule } from "./credit-conditions";
|
|
13
23
|
import { marketValuationModule } from "./market-valuation";
|
|
14
24
|
import { economicCalendarModule } from "./econ";
|
|
25
|
+
import { cpiModule } from "./cpi";
|
|
15
26
|
import { econStatisticsModule } from "./econ-statistics";
|
|
16
27
|
import { earningsModule } from "./earnings";
|
|
17
28
|
import { earningsCallsModule } from "./earnings-calls";
|
|
18
29
|
import { futuresModule } from "./futures";
|
|
19
30
|
import { futuresCurveModule } from "./futures-curve";
|
|
20
31
|
import { cotModule } from "./cot";
|
|
32
|
+
import { doeModule } from "./doe";
|
|
33
|
+
import { gpuModule } from "./gpu";
|
|
21
34
|
import { fxMatrixModule } from "./fx-matrix";
|
|
22
35
|
import { helpModule } from "./help";
|
|
23
36
|
import { positionSizerModule } from "./kelly-sizer";
|
|
@@ -58,6 +71,10 @@ import { optionsCalculatorModule } from "./options-calculator";
|
|
|
58
71
|
import { volSurfaceModule } from "./vol-surface";
|
|
59
72
|
import { realizedVolModule } from "./realized-vol";
|
|
60
73
|
import { seasonalityModule } from "./seasonality";
|
|
74
|
+
import { earningsRippleModule } from "./earnings-ripple";
|
|
75
|
+
import { reverseDcfModule } from "./reverse-dcf";
|
|
76
|
+
import { peBandModule } from "./pe-band";
|
|
77
|
+
import { macroDayModule } from "./macro-day";
|
|
61
78
|
import { ivHistoryModule } from "./iv-history";
|
|
62
79
|
import { backtestModule } from "./backtest";
|
|
63
80
|
import { researchModule } from "./research";
|
|
@@ -98,6 +115,10 @@ export const tickerResearchPlugin = composeBuiltinPlugin({
|
|
|
98
115
|
volSurfaceModule,
|
|
99
116
|
realizedVolModule,
|
|
100
117
|
seasonalityModule,
|
|
118
|
+
earningsRippleModule,
|
|
119
|
+
reverseDcfModule,
|
|
120
|
+
peBandModule,
|
|
121
|
+
macroDayModule,
|
|
101
122
|
ivHistoryModule,
|
|
102
123
|
backtestModule,
|
|
103
124
|
estimateRevisionsModule,
|
|
@@ -106,6 +127,13 @@ export const tickerResearchPlugin = composeBuiltinPlugin({
|
|
|
106
127
|
socialMentionsModule,
|
|
107
128
|
debtMaturitiesModule,
|
|
108
129
|
revenueBreakdownModule,
|
|
130
|
+
supplyChainModule,
|
|
131
|
+
creditDocumentsModule,
|
|
132
|
+
companyAttentionModule,
|
|
133
|
+
catalystsModule,
|
|
134
|
+
companyKpisModule,
|
|
135
|
+
awardsModule,
|
|
136
|
+
exposureModule,
|
|
109
137
|
mnaModule,
|
|
110
138
|
dividendYieldModule,
|
|
111
139
|
holdersModule,
|
|
@@ -146,7 +174,12 @@ export const marketOverviewPlugin = composeBuiltinPlugin({
|
|
|
146
174
|
futuresModule,
|
|
147
175
|
futuresCurveModule,
|
|
148
176
|
cotModule,
|
|
177
|
+
doeModule,
|
|
178
|
+
gpuModule,
|
|
179
|
+
attentionModule,
|
|
180
|
+
powerModule,
|
|
149
181
|
cryptoBoardModule,
|
|
182
|
+
perpsModule,
|
|
150
183
|
],
|
|
151
184
|
});
|
|
152
185
|
|
|
@@ -157,6 +190,7 @@ export const macroPlugin = composeBuiltinPlugin({
|
|
|
157
190
|
macroSharedResourcesModule,
|
|
158
191
|
economicCalendarModule,
|
|
159
192
|
econStatisticsModule,
|
|
193
|
+
cpiModule,
|
|
160
194
|
yieldCurveModule,
|
|
161
195
|
ratePathModule,
|
|
162
196
|
moneyMarketsModule,
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import type { AssetDataProvider, MarketDataRequestContext } from "../../../types/data-provider";
|
|
2
2
|
import type { TimeRange } from "../../../time-series/range";
|
|
3
|
+
import type { ManualChartResolution } from "../../../time-series/resolution";
|
|
3
4
|
import { clipPriceHistoryToRange } from "../../../time-series/history-window";
|
|
4
5
|
|
|
5
6
|
/** Risk views need daily closes even when a chart preset defaults to intraday or weekly bars. */
|
|
7
|
+
export const CORRELATION_HISTORY_RESOLUTION: ManualChartResolution = "1d";
|
|
8
|
+
|
|
6
9
|
export async function loadCorrelationHistory(
|
|
7
10
|
provider: AssetDataProvider, symbol: string, exchange: string, range: TimeRange,
|
|
8
11
|
context?: MarketDataRequestContext,
|
|
9
12
|
) {
|
|
10
13
|
const points = provider.getPriceHistoryForResolution
|
|
11
|
-
? await provider.getPriceHistoryForResolution(symbol, exchange, range,
|
|
14
|
+
? await provider.getPriceHistoryForResolution(symbol, exchange, range, CORRELATION_HISTORY_RESOLUTION, context)
|
|
12
15
|
: await provider.getPriceHistory(symbol, exchange, range, context);
|
|
13
16
|
return clipPriceHistoryToRange(points, range);
|
|
14
17
|
}
|