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,185 @@
|
|
|
1
|
+
import { useCallback, useMemo } from "react";
|
|
2
|
+
import { isAccessDenied } from "../../../api-client/errors";
|
|
3
|
+
import { usePlanAccess } from "../../../api-client/plan-access";
|
|
4
|
+
import type { CreditDocumentsPayload, CreditHeadroom, CreditInstrument, CreditScreenPayload, CreditScreenRow } from "../../../api-client/credit-documents";
|
|
5
|
+
import { ChartTableHeader, DataTableView, EmptyState, PageStackView, PaneStatusBody, QueryBar, useChartTableSelection, usePaneFooter, usePaneNoticeFooter, usePaneStatusFooter, usePaneTabs, type DataTableCell, type DataTableColumn, type PaneHint } from "../../../components";
|
|
6
|
+
import { formatCompactAxis } from "../../../components/chart-table";
|
|
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, useUiCapabilities } 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 { cachedCredit, creditIssuerSymbol, CREDIT_UNAVAILABLE, fetchCreditScreen, loadCredit, validateCreditDocuments } from "./client";
|
|
18
|
+
import { CreditInstrumentDetail } from "./detail";
|
|
19
|
+
import { useCreditEvidence } from "./evidence";
|
|
20
|
+
import { HeadroomGauge } from "./gauge";
|
|
21
|
+
import { capitalCell, capitalColumns, capitalFigures, comparatorSymbol, covenantColumns, covenantUsage, CREDIT_TABS, creditAmount, covenantNumber, creditCurrencies, creditMaturityRows, creditPercent, creditTab, fieldLabel, headroomTone, instrumentOutstanding, isClosed, maturityAxis, maturityColumns, maturitySeries, maturityShares, NO_VALUE, screenColumns, screenRowId, sentence } from "./model";
|
|
22
|
+
|
|
23
|
+
type Row = { numbers?: Record<string, number | null>; id: string; values: Record<string, string>; instrumentId?: string; covenant?: CreditHeadroom; screen?: CreditScreenRow; year?: number; locked?: boolean; closed?: boolean };
|
|
24
|
+
const rowId = (row: Row) => row.id;
|
|
25
|
+
/** Cells a footer hint takes: `[k]label` and the space before it. */
|
|
26
|
+
const hintCells = (hint: PaneHint) => hint.key.length + hint.label.length + 3;
|
|
27
|
+
|
|
28
|
+
export function CreditDocumentsPane(props: PaneProps) {
|
|
29
|
+
const { symbol } = usePaneTickerIdentity();
|
|
30
|
+
const session = useResearchCloudSession(), access = usePlanAccess();
|
|
31
|
+
const accessKey = `${session.requestKey}:${access.hasProAccess ? "full" : "preview"}`;
|
|
32
|
+
return <CreditView key={`${symbol}:${accessKey}`} {...props} symbol={symbol} accessKey={accessKey} needsVerification={session.needsVerification} />;
|
|
33
|
+
}
|
|
34
|
+
function CreditView({ symbol, width, height, focused, accessKey, needsVerification }: PaneProps & { symbol: string | null; accessKey: string; needsVerification: boolean }) {
|
|
35
|
+
const colors = useThemeColors(), desktop = !!useUiCapabilities().nativePaneChrome;
|
|
36
|
+
const { createPaneFromTemplate } = usePluginAppActions();
|
|
37
|
+
const openUpgrade = useCloudUpgradeAction("crdoc");
|
|
38
|
+
const [openingTab] = usePaneSettingValue("tab", "capital");
|
|
39
|
+
const [savedTab, setTab] = usePluginPaneState<string>("credit:tab", openingTab);
|
|
40
|
+
const tab = creditTab(savedTab);
|
|
41
|
+
const [openingInstrument] = usePaneSettingValue<string | null>("instrument", null);
|
|
42
|
+
const [openId, setOpen] = usePluginPaneState<string | null>("credit:instrument", openingInstrument);
|
|
43
|
+
const [openingView] = usePaneSettingValue("view", "terms");
|
|
44
|
+
const [view, setView] = usePluginPaneState<string>("credit:view", openingView);
|
|
45
|
+
const [headroomSetting] = usePaneSettingValue("headroom", 20);
|
|
46
|
+
const [headroom, setHeadroom] = usePluginPaneState<number>("credit:headroom", headroomSetting);
|
|
47
|
+
const [monthsSetting] = usePaneSettingValue("months", 12);
|
|
48
|
+
const [months, setMonths] = usePluginPaneState<number>("credit:months", monthsSetting);
|
|
49
|
+
const [currency, setCurrency] = usePluginPaneState<string>("credit:currency", "");
|
|
50
|
+
const [sort, setSort] = usePluginPaneState<{column: string | null; direction: "asc" | "desc"}>(`credit:sort:${tab}`, {column: tab === "maturities" ? "year" : null, direction: "asc"});
|
|
51
|
+
const [selectedId, setSelected] = usePluginPaneState<string | null>(`credit:selected:${tab}`, null);
|
|
52
|
+
const [snapshotSetting] = usePaneSettingValue<CreditDocumentsPayload | null>("creditSnapshot", null);
|
|
53
|
+
const [screenSnapshot] = usePaneSettingValue<CreditScreenPayload | null>("creditScreenSnapshot", null);
|
|
54
|
+
const [instrumentSnapshot] = usePaneSettingValue<CreditInstrument | null>("creditInstrumentSnapshot", null);
|
|
55
|
+
const snapshot = useMemo(() => { try { return snapshotSetting ? validateCreditDocuments(snapshotSetting, symbol ? creditIssuerSymbol(symbol) : undefined) : null; } catch { return null; } }, [snapshotSetting, symbol]);
|
|
56
|
+
const loader = useCallback((force: boolean) => snapshot ? Promise.resolve({ payload: snapshot, stale: false, refreshError: null }) : loadCredit(symbol!, accessKey, force), [symbol, accessKey, snapshot]);
|
|
57
|
+
const resource = useAsyncResource(symbol ? loader : null, { initialData: () => symbol ? cachedCredit(symbol, accessKey) : null, clearOnError: isAccessDenied });
|
|
58
|
+
const data = resource.data?.payload ?? null;
|
|
59
|
+
const screenLoader = useCallback(() => screenSnapshot ? Promise.resolve(screenSnapshot) : fetchCreditScreen({ headroomBelow: headroom, springingWithinMonths: months, limit: 100 }), [screenSnapshot, headroom, months, accessKey]);
|
|
60
|
+
const screen = useAsyncResource(tab === "screen" ? screenLoader : null, { clearOnError: isAccessDenied });
|
|
61
|
+
const screenData = screen.data;
|
|
62
|
+
const currencies = data ? creditCurrencies(data) : [];
|
|
63
|
+
const selectedCurrency = currencies.includes(currency) ? currency : currencies[0] ?? "";
|
|
64
|
+
const maturityRows = useMemo(() => data ? creditMaturityRows(data, selectedCurrency) : [], [data, selectedCurrency]);
|
|
65
|
+
const series = useMemo(() => maturitySeries(maturityRows, selectedCurrency, colors.warning), [maturityRows, selectedCurrency, colors.warning]);
|
|
66
|
+
const preview = data?.access === "preview";
|
|
67
|
+
const columns = useMemo<DataTableColumn[]>(() => tab === "capital" ? data ? capitalColumns(data, width) : [] : tab === "covenants" ? covenantColumns(width)
|
|
68
|
+
: tab === "maturities" ? maturityColumns(width, preview) : screenColumns(width), [tab, data, width, preview]);
|
|
69
|
+
const figures = useMemo(() => tab === "capital" && data ? capitalFigures(data) : [], [tab, data]);
|
|
70
|
+
const unsortedRows = useMemo<Row[]>(() => {
|
|
71
|
+
if (tab === "screen") return (screenData?.rows ?? []).map((row) => ({ id: screenRowId(row), instrumentId: row.instrumentId, screen: row, numbers: {value:row.value}, values: { symbol: row.symbol, kind: row.kind === "springing_maturity" ? "Springing maturity" : row.value != null && row.value < 0 ? "Breach" : "Low headroom", value: creditPercent(row.value), date: row.date ?? NO_VALUE, instrument: row.instrumentName, reason: sentence(row.reason) } }));
|
|
72
|
+
if (!data) return [];
|
|
73
|
+
if (tab === "capital") return data.instruments.map((row) => ({ id: row.id, instrumentId: row.id, closed: isClosed(row), numbers: {principal:instrumentOutstanding(row)}, values: Object.fromEntries(["name", "facility", "coupon", "maturity", "principal", "currency", "ranking", "control"].map((id) => [id, capitalCell(row, id, data)])) }));
|
|
74
|
+
if (tab === "covenants") return data.covenants.map((row) => { const fact=data.instruments.find((item) => item.id === row.instrumentId)?.facts.find((item) => item.id === row.id); return ({ id: row.id, instrumentId: row.instrumentId, covenant: row, numbers: {headroom:row.headroomPercent,usage:covenantUsage(row),threshold:row.threshold,current:row.current}, values: { metric: sentence(row.metric), headroom: creditPercent(row.headroomPercent), usage: "", threshold: `${comparatorSymbol(row.comparator, row.inclusive)} ${covenantNumber(row.threshold,fact)}`, current: covenantNumber(row.current,fact), status: fieldLabel(row.status), date: row.asOf, instrument: row.instrumentName } }); });
|
|
75
|
+
const shares = preview ? new Map() : maturityShares(maturityRows);
|
|
76
|
+
return maturityRows.flatMap((row) => row.instruments.map((instrument) => { const id = `${row.year}:${instrument.id}`, share = shares.get(id); return { id, instrumentId: instrument.id, year: row.year, numbers: {year:row.year,principal:instrument.principal,share:share?.share ?? null,cumulative:share?.cumulative ?? null}, values: { year: String(row.year), principal: creditAmount(instrument.principal), share: creditPercent(share?.share), cumulative: creditPercent(share?.cumulative), instruments: instrument.name } }; }));
|
|
77
|
+
}, [data, screenData, tab, maturityRows, preview]);
|
|
78
|
+
const rows = useMemo(() => !sort.column ? unsortedRows : [...unsortedRows].sort((a,b) => {
|
|
79
|
+
const column=sort.column!;
|
|
80
|
+
const left=a.numbers && column in a.numbers ? a.numbers[column] : a.values[column]?.toLowerCase();
|
|
81
|
+
const right=b.numbers && column in b.numbers ? b.numbers[column] : b.values[column]?.toLowerCase();
|
|
82
|
+
return left == null || right == null ? left == right ? a.id.localeCompare(b.id) : left == null ? 1 : -1
|
|
83
|
+
: left === right ? a.id.localeCompare(b.id) : (left < right ? -1 : 1)*(sort.direction === "asc" ? 1 : -1);
|
|
84
|
+
}),[unsortedRows,sort]);
|
|
85
|
+
const selected = rows.find((row) => row.id === selectedId) ?? rows[0] ?? null;
|
|
86
|
+
const screenOpen = rows.find((row) => row.id === openId)?.screen;
|
|
87
|
+
const openInstrument = data?.instruments.find((row) => row.id === openId) ?? (screenOpen ? { id: screenOpen.instrumentId, key: screenOpen.instrumentId, name: screenOpen.instrumentName, currency: screenOpen.currency, facilityType: null, principal: null, commitment: null, drawn: null, maturity: null, facts: screenOpen.evidence } : null);
|
|
88
|
+
const [initialFact] = usePaneSettingValue<string | null>("fact", null);
|
|
89
|
+
const [openFactId, setOpenFact] = usePluginPaneState<string | null>(`credit:fact:open:${openInstrument?.id ?? "none"}`, initialFact);
|
|
90
|
+
const activeSymbol = screenOpen?.symbol ?? symbol;
|
|
91
|
+
const activeCovenant = tab === "covenants" ? data?.covenants.find((row) => row.id === selected?.id && row.instrumentId === openInstrument?.id) ?? null : null;
|
|
92
|
+
const locked = tab === "screen" ? screenData?.lockedRows ?? 0 : data?.lockedRows ?? 0;
|
|
93
|
+
const items = useMemo<Row[]>(() => [...rows, ...Array.from({ length: Math.min(3, locked) }, (_, index) => ({ id: `locked:${index}`, values: {}, locked: true }))], [rows, locked]);
|
|
94
|
+
const { strip, rows: tabRows } = usePaneTabs({ tabs: [...CREDIT_TABS], activeValue: tab, onSelect: (value) => { setTab(value); setOpen(null); }, focused: focused && !openInstrument, dense: true });
|
|
95
|
+
const bodyHeight = Math.max(3, height - tabRows);
|
|
96
|
+
const link = useChartTableSelection({ rows: rows.filter((row) => row.year !== undefined), getId: rowId, getDate: (row) => new Date(Date.UTC(row.year!, 0, 1)), selectedId: selected?.id ?? null, onSelect: setSelected, focused: focused && !openInstrument, enabled: tab === "maturities" });
|
|
97
|
+
useAutoRefresh(resource.updatedAt, resource.load);
|
|
98
|
+
useAutoRefresh(screen.updatedAt, screen.load);
|
|
99
|
+
usePaneRefreshKey(() => { void resource.reload(); if (tab === "screen") void screen.reload(); }, { focused });
|
|
100
|
+
const currentError = tab === "screen" ? screen.error : resource.error;
|
|
101
|
+
const available = tab === "screen" ? !!screenData : !!data;
|
|
102
|
+
const loading = tab === "screen" ? screen.loading : resource.loading;
|
|
103
|
+
const target = activeSymbol ?? symbol ?? "";
|
|
104
|
+
const allHints: PaneHint[] = [
|
|
105
|
+
...(symbol ? [
|
|
106
|
+
{ id: "credit:des", key: "d", label: "es", title: "Description (DES)", onPress: () => createPaneFromTemplate("new-ticker-detail-pane", { symbol: target }) },
|
|
107
|
+
{ id: "credit:fa", key: "f", label: "a", title: "Financial analysis (FA)", onPress: () => createPaneFromTemplate("financial-analysis-pane", { symbol: target }) },
|
|
108
|
+
{ id: "credit:graph", key: "g", label: "raph", title: "Price chart (G)", onPress: () => createPaneFromTemplate("chart-composer-pane", { arg: target }) },
|
|
109
|
+
{ id: "credit:ddis", key: "m", label: "aturities", title: "DDIS maturity schedule", onPress: () => createPaneFromTemplate("debt-maturities-pane", { symbol: target }) },
|
|
110
|
+
{ id: "credit:cds", key: "c", label: "ds", title: "CDS trades", onPress: () => createPaneFromTemplate("cds-pane", { symbol: target }) },
|
|
111
|
+
] : []),
|
|
112
|
+
...(locked || preview ? [{ id: "credit:upgrade", key: CLOUD_PLAN_KEY, label: "upgrade", title: "Upgrade to Pro", onPress: openUpgrade }] : []),
|
|
113
|
+
];
|
|
114
|
+
const asOf = tab === "screen" ? screenData?.asOf : data?.asOf;
|
|
115
|
+
const notices = [...(data?.warnings ?? []), ...(resource.data?.refreshError ? [resource.data.refreshError] : []), ...(screenData?.truncated ? ["Screen results reached the result limit; narrow the thresholds."] : [])];
|
|
116
|
+
// A narrow footer keeps the upgrade and the first links; the rest stay bound
|
|
117
|
+
// and move to the pane menu, so the status on the left never gets cut.
|
|
118
|
+
const footerBudget = width - 2 - (asOf ? 17 : 0) - (notices.length ? 5 : 0) - (openInstrument ? 14 : 0);
|
|
119
|
+
const { shown: hints, folded } = useMemo(() => {
|
|
120
|
+
const keep = new Set(allHints.map((hint) => hint.id));
|
|
121
|
+
let used = allHints.reduce((total, hint) => total + hintCells(hint), 0);
|
|
122
|
+
for (const hint of [...allHints].reverse()) {
|
|
123
|
+
if (used <= footerBudget) break;
|
|
124
|
+
if (hint.id === "credit:upgrade") continue;
|
|
125
|
+
keep.delete(hint.id);
|
|
126
|
+
used -= hintCells(hint);
|
|
127
|
+
}
|
|
128
|
+
return { shown: allHints.filter((hint) => keep.has(hint.id)), folded: allHints.filter((hint) => !keep.has(hint.id)) };
|
|
129
|
+
}, [allHints.map((hint) => hint.id).join(), footerBudget, target, openUpgrade, createPaneFromTemplate]);
|
|
130
|
+
usePaneStatusFooter({ registrationId: "credit-documents", loading, error: available ? currentError : null, stale: resource.data?.stale,
|
|
131
|
+
info: asOf ? [{ id: "as-of", parts: [{ text: `as of ${asOf.slice(0, 10)}`, tone: "muted" as const }] }] : [], hints });
|
|
132
|
+
usePaneFooter("credit:folded", () => folded.length ? { keys: folded, menu: folded.map((hint) => ({ id: `credit:menu:${hint.id}`, label: hint.title ?? hint.label, accelerator: hint.key, onSelect: () => hint.onPress?.() })) } : null, [folded]);
|
|
133
|
+
usePaneNoticeFooter({ registrationId: "credit:notices", focused, notices });
|
|
134
|
+
useCreditEvidence(data, screenData ?? null, instrumentSnapshot, tab, view, rows.map(rowId), openInstrument?.id ?? null, openFactId);
|
|
135
|
+
if (!symbol) return <EmptyState title="Select an issuer ticker." />;
|
|
136
|
+
if (!available && isCloudSessionRequired(currentError)) return <SignInWall placement="credit-documents-signin" action="view credit documents" needsVerification={needsVerification} />;
|
|
137
|
+
const query = tab === "screen" ? <QueryBar width={width} filters={[
|
|
138
|
+
{ id: "headroom", label: "Headroom below", value: String(headroom), options: [0, 10, 20, 30, 50, 100].map((value) => ({ value: String(value), label: `${value}%` })), onChange: (value) => setHeadroom(Number(value)) },
|
|
139
|
+
{ id: "springing", label: "Springing within", value: String(months), options: [3, 6, 12, 24, 36].map((value) => ({ value: String(value), label: `${value} months` })), onChange: (value) => setMonths(Number(value)) },
|
|
140
|
+
]} /> : tab === "maturities" ? <QueryBar width={width} filters={currencies.length ? [{ id: "currency", label: "Currency", value: selectedCurrency, options: currencies.map((value) => ({ value, label: value })), onChange: setCurrency }] : []} /> : undefined;
|
|
141
|
+
const rootBefore = tab === "maturities" ? <ChartTableHeader width={width} height={bodyHeight} tableRows={rows.length} tableColumns={columns} query={query}
|
|
142
|
+
chart={series.length ? { series, formatValue: creditAmount, formatAxisValue: formatCompactAxis, cursorDate: link.cursorDate, onCursorDateChange: link.onCursorDateChange, remoteKind: "credit-maturity-wall", xAxis: maturityAxis(maturityRows), onActivate: link.onActivate } : null} />
|
|
143
|
+
: tab === "capital" && figures.length ? <ChartTableHeader width={width} height={bodyHeight} tableRows={items.length} tableColumns={columns} figures={figures} /> : query;
|
|
144
|
+
const lockedText = tab === "screen" ? "Upgrade to see every signal" : "Upgrade to see all terms";
|
|
145
|
+
// The terminal prompt sits in the widest column so it is never cut.
|
|
146
|
+
const lockedColumn = columns.find((column) => column.flexGrow)?.id ?? columns[0]?.id;
|
|
147
|
+
const renderCell = (row: Row, column: DataTableColumn, _index: number, state: { selected: boolean }): DataTableCell => {
|
|
148
|
+
if (row.locked) return desktop ? { text: "", content: <Blurred><Text fg={colors.textDim}>{column.id === lockedColumn ? tab === "screen" ? "Additional signal" : "Additional credit document" : "Hidden"}</Text></Blurred> }
|
|
149
|
+
: { text: column.id === lockedColumn && row.id === "locked:0" ? lockedText : "░░░░", color: colors.textDim, ...(column.id === lockedColumn && row.id === "locked:0" ? { content: <UpgradeLabel text={lockedText} onPress={openUpgrade} /> } : {}) };
|
|
150
|
+
if (column.id === "usage" && row.covenant) return { text: "", content: <HeadroomGauge covenant={row.covenant} width={column.width} selected={state.selected} /> };
|
|
151
|
+
const text = row.values[column.id] ?? "";
|
|
152
|
+
const number = row.numbers?.[column.id];
|
|
153
|
+
const value = column.align === "right" && row.numbers && column.id in row.numbers ? number ?? null : undefined;
|
|
154
|
+
if (text === NO_VALUE) return { text, value, color: colors.textMuted };
|
|
155
|
+
if (row.closed) return { text, value, color: colors.textDim };
|
|
156
|
+
if (column.id === "headroom" && row.covenant) {
|
|
157
|
+
const tone = headroomTone(row.covenant);
|
|
158
|
+
return { text, value, color: tone ? colors[tone] : colors.textBright, keepColorWhenSelected: !!tone };
|
|
159
|
+
}
|
|
160
|
+
if (column.id === "value" && row.screen?.kind === "headroom") {
|
|
161
|
+
const tone = row.screen.value == null ? undefined : headroomTone({ headroomPercent: row.screen.value, status: row.screen.value < 0 ? "breach" : "compliant" });
|
|
162
|
+
return { text, value, color: tone ? colors[tone] : colors.text, keepColorWhenSelected: !!tone };
|
|
163
|
+
}
|
|
164
|
+
if (column.id === "status" && row.covenant) {
|
|
165
|
+
const breach = row.covenant.status === "breach";
|
|
166
|
+
return { text, color: breach ? colors.negative : colors.textDim, keepColorWhenSelected: breach };
|
|
167
|
+
}
|
|
168
|
+
return { text, value, color: column.id === columns[0]!.id ? colors.textBright : colors.text };
|
|
169
|
+
};
|
|
170
|
+
return <Box width={width} height={height} flexDirection="column">{strip}
|
|
171
|
+
<PaneStatusBody loading={!available && loading} error={!available && currentError !== CREDIT_UNAVAILABLE ? currentError : null}
|
|
172
|
+
empty={!available && currentError === CREDIT_UNAVAILABLE} emptyTitle={CREDIT_UNAVAILABLE} subject="credit documents">
|
|
173
|
+
{available ? <PageStackView focused={focused && !openFactId} detailOpen={!!openInstrument} onBack={() => setOpen(null)} detailTitle={openInstrument?.name}
|
|
174
|
+
detailContent={openInstrument && activeSymbol ? <CreditInstrumentDetail key={`${activeSymbol}:${openInstrument.id}`} symbol={activeSymbol} instrument={openInstrument} width={width} height={bodyHeight - 1} focused={focused} accessKey={accessKey} view={view} setView={setView} covenant={activeCovenant} openId={openFactId} setOpen={setOpenFact} captured={instrumentSnapshot?.id === openInstrument.id ? instrumentSnapshot : null} pro={data?.access === "full"} onUpgrade={openUpgrade} /> : null}
|
|
175
|
+
rootContent={<DataTableView<Row> columns={columns} items={items} sortColumnId={sort.column} sortDirection={sort.direction} onHeaderClick={(column) => setSort((current) => ({column,direction:current.column === column && current.direction === "asc" ? "desc" : "asc"}))} focused={focused && !openInstrument} rootWidth={width} rootHeight={bodyHeight} rootBefore={rootBefore}
|
|
176
|
+
getItemKey={rowId} selection={{ kind: "id", selectedId: selected?.id ?? null, getId: rowId, onChange: setSelected }}
|
|
177
|
+
onActivate={(row) => row.locked ? openUpgrade() : setOpen(row.screen ? row.id : row.instrumentId ?? null)}
|
|
178
|
+
renderCell={renderCell}
|
|
179
|
+
emptyStateTitle={tab === "screen" ? "No supported credit signals match these thresholds." : tab === "covenants" ? "No financial maintenance covenants documented." : tab === "maturities" ? "No supported instrument maturity amounts." : CREDIT_UNAVAILABLE}
|
|
180
|
+
emptyStateHint={tab === "screen" && (headroom < 100 || months < 36) ? "Raise either threshold to widen the screen." : undefined}
|
|
181
|
+
selectedTextOverridesCellColor showHorizontalScrollbar freezeFirstColumn resetScrollKey={`${symbol}:${tab}:${selectedCurrency}`}
|
|
182
|
+
bodyAfter={locked > 0 && desktop ? <LockedOverlay rows={Math.min(3, locked)} text={lockedText} onPress={openUpgrade} /> : undefined} />} /> : null}
|
|
183
|
+
</PaneStatusBody>
|
|
184
|
+
</Box>;
|
|
185
|
+
}
|
|
@@ -278,11 +278,23 @@ function compare(a: unknown, b: unknown): number {
|
|
|
278
278
|
return String(a).localeCompare(String(b), undefined, { numeric: true, sensitivity: "base" });
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
+
function isEmptyValue(value: unknown): boolean {
|
|
282
|
+
return value === null || value === undefined || value === "";
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/** Rows without a value sort last in either direction, so a descending sort leads with real values. */
|
|
286
|
+
function compareForSort(a: unknown, b: unknown, direction: 1 | -1): number {
|
|
287
|
+
const aEmpty = isEmptyValue(a);
|
|
288
|
+
const bEmpty = isEmptyValue(b);
|
|
289
|
+
if (aEmpty || bEmpty) return aEmpty === bEmpty ? 0 : aEmpty ? 1 : -1;
|
|
290
|
+
return compare(a, b) * direction;
|
|
291
|
+
}
|
|
292
|
+
|
|
281
293
|
function matches(row: ViewRow, filter: ViewFilter): boolean {
|
|
282
294
|
const value = row[filter.key];
|
|
283
295
|
switch (filter.op) {
|
|
284
296
|
case "exists":
|
|
285
|
-
return value
|
|
297
|
+
return !isEmptyValue(value);
|
|
286
298
|
case "eq":
|
|
287
299
|
return compare(value, filter.value) === 0;
|
|
288
300
|
case "neq":
|
|
@@ -311,7 +323,7 @@ export function applyViewProjection(rows: readonly ViewRow[], projection: ViewPr
|
|
|
311
323
|
const sort = sortOverride === undefined ? projection.sort : sortOverride ?? undefined;
|
|
312
324
|
if (sort) {
|
|
313
325
|
const direction = sort.direction === "asc" ? 1 : -1;
|
|
314
|
-
result = [...result].sort((a, b) =>
|
|
326
|
+
result = [...result].sort((a, b) => compareForSort(a[sort.by], b[sort.by], direction));
|
|
315
327
|
}
|
|
316
328
|
if (projection.limit !== undefined) result = result.slice(0, projection.limit);
|
|
317
329
|
return result;
|
|
@@ -488,6 +488,7 @@ export function DebtMaturitiesPane({ width, height, focused }: PaneProps) {
|
|
|
488
488
|
if (!data && isCloudSessionRequired(resource.error))
|
|
489
489
|
return (
|
|
490
490
|
<SignInWall
|
|
491
|
+
placement="debt-maturities-signin"
|
|
491
492
|
action="view debt maturities"
|
|
492
493
|
needsVerification={session.needsVerification}
|
|
493
494
|
/>
|
|
@@ -245,7 +245,7 @@ export function DividendYieldPane({ focused, width, height, loadData = fetchDivi
|
|
|
245
245
|
? "Loading dividends..."
|
|
246
246
|
: error ?? (data?.historyAvailable ? "No cash distributions reported." : "Dividend history unavailable.");
|
|
247
247
|
|
|
248
|
-
if (authWall) return <SignInWall action="view dividend history" needsVerification={cloudSession.needsVerification} />;
|
|
248
|
+
if (authWall) return <SignInWall placement="dividend-yield-signin" action="view dividend history" needsVerification={cloudSession.needsVerification} />;
|
|
249
249
|
|
|
250
250
|
return (
|
|
251
251
|
<DataTableView<DividendRow, DividendColumn>
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { apiClient } from "../../../api-client";
|
|
2
|
+
import type { DoeBoardPayload, DoeSeriesRow } from "../../../api-client/doe";
|
|
3
|
+
import { ApiRequestError } from "../../../api-client/errors";
|
|
4
|
+
import { createPluginCache } from "../../../data/plugin-cache";
|
|
5
|
+
import { cachedCloudResource, loadCloudResource } from "../shared/cloud-resource";
|
|
6
|
+
|
|
7
|
+
/** What the pane says while the server has no EIA weeks to serve: before the backend ships, or before its first read. */
|
|
8
|
+
export const DOE_NOT_AVAILABLE = "Oil and gas inventories are not available yet.";
|
|
9
|
+
|
|
10
|
+
export const doeBoardCache = createPluginCache<DoeBoardPayload>({
|
|
11
|
+
kind: "doe-board", source: "gloom-cloud", schemaVersion: 1,
|
|
12
|
+
// Weekly data: a quarter hour is soon enough to catch a release.
|
|
13
|
+
policy: { staleMs: 15 * 60_000, expireMs: 14 * 24 * 60 * 60_000 },
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const UNITS = new Set(["kb", "kbd", "pct", "bcf"]);
|
|
17
|
+
const TABS = new Set(["crude", "products", "gas"]);
|
|
18
|
+
const date = (value: unknown) => typeof value === "string" && /^\d{4}-\d{2}-\d{2}$/.test(value)
|
|
19
|
+
&& new Date(`${value}T00:00:00Z`).toISOString().slice(0, 10) === value;
|
|
20
|
+
const dateOrNull = (value: unknown) => value === null || date(value);
|
|
21
|
+
const instantOrNull = (value: unknown) => value === null || typeof value === "string" && Number.isFinite(Date.parse(value));
|
|
22
|
+
const finite = (value: unknown): value is number => typeof value === "number" && Number.isFinite(value);
|
|
23
|
+
const finiteOrNull = (value: unknown) => value === null || finite(value);
|
|
24
|
+
const pairs = (value: unknown) => Array.isArray(value)
|
|
25
|
+
&& value.every((pair) => Array.isArray(pair) && Number.isInteger(pair[0]) && finite(pair[1]));
|
|
26
|
+
|
|
27
|
+
function validRow(row: DoeSeriesRow): boolean {
|
|
28
|
+
const five = row.fiveYear, ago = row.yearAgo, seasonal = row.seasonal;
|
|
29
|
+
return typeof row.id === "string" && typeof row.label === "string" && UNITS.has(row.unit) && TABS.has(row.tab)
|
|
30
|
+
&& dateOrNull(row.weekEnding) && finiteOrNull(row.value) && finiteOrNull(row.weekChange) && (row.value == null) === (row.weekEnding == null)
|
|
31
|
+
&& (row.read === null || typeof row.read === "string")
|
|
32
|
+
&& (ago === null || date(ago.weekEnding) && finite(ago.value) && finite(ago.change) && finiteOrNull(ago.changePercent))
|
|
33
|
+
&& (five === null || Array.isArray(five.years) && five.years.length > 0 && [five.min, five.max, five.average, five.vsAverage].every(finite)
|
|
34
|
+
&& five.min <= five.max && finiteOrNull(five.averageChange) && finiteOrNull(five.vsAveragePercent) && finiteOrNull(five.position))
|
|
35
|
+
&& (seasonal === null || Number.isInteger(seasonal.year) && (seasonal.weeks === 52 || seasonal.weeks === 53)
|
|
36
|
+
&& pairs(seasonal.current) && pairs(seasonal.previous) && Array.isArray(seasonal.band)
|
|
37
|
+
&& seasonal.band.every((week) => Array.isArray(week) && Number.isInteger(week[0]) && week.slice(1).every(finiteOrNull)));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** A board that breaks the contract is refused whole rather than drawn with holes in it. */
|
|
41
|
+
function validateDoeBoard(payload: DoeBoardPayload): DoeBoardPayload {
|
|
42
|
+
if (!payload || payload.source !== "EIA" || !Number.isFinite(Date.parse(payload.generatedAt))
|
|
43
|
+
|| !["available", "partial", "unavailable"].includes(payload.status)
|
|
44
|
+
|| !Array.isArray(payload.gaps) || !payload.gaps.every((gap) => typeof gap === "string")
|
|
45
|
+
|| !Array.isArray(payload.reports) || !payload.reports.every((report) => (report.id === "petroleum" || report.id === "gas")
|
|
46
|
+
&& dateOrNull(report.weekEnding) && dateOrNull(report.nextWeekEnding)
|
|
47
|
+
&& instantOrNull(report.releasedAt) && instantOrNull(report.nextReleaseAt))
|
|
48
|
+
|| !Array.isArray(payload.series) || new Set(payload.series.map((row) => row.id)).size !== payload.series.length
|
|
49
|
+
|| !payload.series.every(validRow)) {
|
|
50
|
+
throw new Error("The server returned an invalid EIA weekly board");
|
|
51
|
+
}
|
|
52
|
+
return payload;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The board, or the not-available message when the server does not serve the
|
|
57
|
+
* route yet (404), cannot read its tables yet (503) or has no weeks stored.
|
|
58
|
+
*/
|
|
59
|
+
export async function fetchDoeBoard(client: Pick<typeof apiClient, "getCloudDoeBoard"> = apiClient): Promise<DoeBoardPayload> {
|
|
60
|
+
let payload: DoeBoardPayload;
|
|
61
|
+
try {
|
|
62
|
+
payload = await client.getCloudDoeBoard();
|
|
63
|
+
} catch (error) {
|
|
64
|
+
if (error instanceof ApiRequestError && (error.status === 404 || error.status === 503)) throw new Error(DOE_NOT_AVAILABLE);
|
|
65
|
+
throw error;
|
|
66
|
+
}
|
|
67
|
+
const board = validateDoeBoard(payload);
|
|
68
|
+
if (board.status === "unavailable" || !board.series.some((row) => row.value != null)) throw new Error(DOE_NOT_AVAILABLE);
|
|
69
|
+
return board;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export const getCachedDoeBoard = () => cachedCloudResource(doeBoardCache, "board", validateDoeBoard);
|
|
73
|
+
export const loadDoeBoard = (force = false) => loadCloudResource(doeBoardCache, "board", () => fetchDoeBoard(), { force, validate: validateDoeBoard });
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { DoeSeriesRow, DoeTab } from "../../../api-client/doe";
|
|
2
|
+
import type { HeadlessPaneDefinition } from "../../../types/plugin";
|
|
3
|
+
import { fetchDoeBoard } from "./client";
|
|
4
|
+
import {
|
|
5
|
+
DOE_TABS,
|
|
6
|
+
DOE_UNIT_LABEL,
|
|
7
|
+
doeHeaderLine,
|
|
8
|
+
doeReport,
|
|
9
|
+
doeRows,
|
|
10
|
+
doeSeriesOption,
|
|
11
|
+
doeTab,
|
|
12
|
+
formatDoeChange,
|
|
13
|
+
formatDoeLevel,
|
|
14
|
+
formatDoePosition,
|
|
15
|
+
formatDoeVsFive,
|
|
16
|
+
formatDoeVsYear,
|
|
17
|
+
} from "./model";
|
|
18
|
+
|
|
19
|
+
const text = (value: unknown) => typeof value === "string" ? value : "--";
|
|
20
|
+
|
|
21
|
+
/** One row per series, in the pane's words and units; numbers keep their published precision. */
|
|
22
|
+
function reportRow(row: DoeSeriesRow) {
|
|
23
|
+
return {
|
|
24
|
+
id: row.id, series: row.label, unit: DOE_UNIT_LABEL[row.unit], weekEnding: row.weekEnding,
|
|
25
|
+
level: formatDoeLevel(row.unit, row.value), weekChange: formatDoeChange(row.unit, row.weekChange),
|
|
26
|
+
vsYearAgo: formatDoeVsYear(row), vsFiveYear: formatDoeVsFive(row),
|
|
27
|
+
fiveYearLow: formatDoeLevel(row.unit, row.fiveYear?.min ?? null), fiveYearHigh: formatDoeLevel(row.unit, row.fiveYear?.max ?? null),
|
|
28
|
+
position: formatDoePosition(row), read: row.read,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const SUMMARY_COLUMNS = [
|
|
33
|
+
{ key: "series", header: "Series" }, { key: "unit", header: "Unit" },
|
|
34
|
+
{ key: "level", header: "Level", align: "right" as const }, { key: "weekChange", header: "1W change", align: "right" as const },
|
|
35
|
+
{ key: "vsYearAgo", header: "Vs 1Y", align: "right" as const }, { key: "vsFiveYear", header: "Vs 5Y avg", align: "right" as const },
|
|
36
|
+
{ key: "fiveYearLow", header: "5Y low", align: "right" as const }, { key: "fiveYearHigh", header: "5Y high", align: "right" as const },
|
|
37
|
+
{ key: "position", header: "In 5Y range", align: "right" as const }, { key: "read", header: "Read", format: text },
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
/** The selected series' year, week by week, against last year and the five-year band: the chart as a table. */
|
|
41
|
+
function seasonalRows(row: DoeSeriesRow) {
|
|
42
|
+
const seasonal = row.seasonal;
|
|
43
|
+
if (!seasonal) return [];
|
|
44
|
+
const current = new Map(seasonal.current), previous = new Map(seasonal.previous);
|
|
45
|
+
const level = (value: number | null | undefined) => formatDoeLevel(row.unit, value ?? null);
|
|
46
|
+
return seasonal.band.map(([week, min, average, max]) => ({ week, thisYear: level(current.get(week)), lastYear: level(previous.get(week)),
|
|
47
|
+
fiveYearLow: level(min), fiveYearAverage: level(average), fiveYearHigh: level(max) }));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** `DOE` reads every tab unless one is named; `NGS` starts on gas storage; a series argument adds its year. */
|
|
51
|
+
export function doeHeadless(defaultTab: DoeTab | "all"): HeadlessPaneDefinition<"bundle"> {
|
|
52
|
+
return {
|
|
53
|
+
shape: "bundle",
|
|
54
|
+
argument: { kind: "free-text", optional: true, placeholder: "series", description: "A series such as cushing, gasoline or east; omit for the tables." },
|
|
55
|
+
options: [{ key: "tab", type: "enum", values: [{ value: "all" }, ...DOE_TABS.map(({ value }) => ({ value }))], defaultValue: defaultTab,
|
|
56
|
+
description: "Crude, products, gas storage, or all three." }],
|
|
57
|
+
discovery: { aliases: ["DOE", "NGS"], dataRequirements: ["Gloom Cloud EIA weekly history"],
|
|
58
|
+
limitations: ["Weekly data, published Wednesday (petroleum) and Thursday (gas) at 10:30 ET, moved by holidays",
|
|
59
|
+
"Five-year ranges read earlier years on the same calendar day", "A range holds fewer than five years where a series is younger"] },
|
|
60
|
+
describe: "EIA weekly petroleum and natural gas storage",
|
|
61
|
+
async load(args) {
|
|
62
|
+
const data = await fetchDoeBoard();
|
|
63
|
+
const argument = Array.isArray(args.argument) ? args.argument.join(" ") : args.argument;
|
|
64
|
+
if (argument) {
|
|
65
|
+
const option = doeSeriesOption(argument);
|
|
66
|
+
const row = option ? data.series.find((entry) => entry.id === option.value) : null;
|
|
67
|
+
if (!row) throw new Error("Use a series such as cushing, gasoline, distillate or east");
|
|
68
|
+
return {
|
|
69
|
+
sections: [
|
|
70
|
+
{ title: doeHeaderLine(doeReport(data, row.tab)) ?? row.label, columns: SUMMARY_COLUMNS, rows: [reportRow(row)] },
|
|
71
|
+
{ title: `${row.label} ${row.seasonal?.year ?? ""} by week, ${DOE_UNIT_LABEL[row.unit]}`.trim(),
|
|
72
|
+
columns: [{ key: "week", header: "Week", align: "right" as const }, { key: "thisYear", header: "This year", align: "right" as const },
|
|
73
|
+
{ key: "lastYear", header: "Last year", align: "right" as const }, { key: "fiveYearLow", header: "5Y low", align: "right" as const },
|
|
74
|
+
{ key: "fiveYearAverage", header: "5Y avg", align: "right" as const }, { key: "fiveYearHigh", header: "5Y high", align: "right" as const }],
|
|
75
|
+
rows: seasonalRows(row) },
|
|
76
|
+
],
|
|
77
|
+
errors: data.gaps,
|
|
78
|
+
metadata: { ...data, series: [row], complete: data.status === "available" },
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
const tabs = args.options.tab === "all" || args.options.tab == null ? DOE_TABS.map(({ value }) => value) : [doeTab(args.options.tab)];
|
|
82
|
+
return {
|
|
83
|
+
sections: tabs.map((tab) => ({
|
|
84
|
+
title: `${DOE_TABS.find((entry) => entry.value === tab)!.label}${doeHeaderLine(doeReport(data, tab)) ? `: ${doeHeaderLine(doeReport(data, tab))}` : ""}`,
|
|
85
|
+
columns: SUMMARY_COLUMNS,
|
|
86
|
+
rows: doeRows(data, tab).map(reportRow),
|
|
87
|
+
})),
|
|
88
|
+
errors: data.gaps,
|
|
89
|
+
metadata: { ...data, complete: data.status === "available" },
|
|
90
|
+
};
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { DoeTab } from "../../../api-client/doe";
|
|
2
|
+
import type { PaneTemplateCreateOptions, PaneTemplateInstanceConfig } from "../../../types/plugin";
|
|
3
|
+
import type { PluginModule } from "../plugin-module";
|
|
4
|
+
import { doeBoardCache } from "./client";
|
|
5
|
+
import { doeHeadless } from "./headless";
|
|
6
|
+
import { DOE_SERIES_OPTIONS, doeSeriesOption } from "./model";
|
|
7
|
+
import { DoePane } from "./pane";
|
|
8
|
+
|
|
9
|
+
/** Opens on a tab, or on the series typed after the mnemonic and its tab. */
|
|
10
|
+
function doeInstance(tab: DoeTab, options?: PaneTemplateCreateOptions): PaneTemplateInstanceConfig {
|
|
11
|
+
const input = options?.arg?.trim();
|
|
12
|
+
const series = doeSeriesOption(input);
|
|
13
|
+
if (input && !series) throw new Error("Use a series such as cushing, gasoline, distillate or east");
|
|
14
|
+
return { placement: "floating", settings: { tab: series?.tab ?? tab }, ...(series ? { params: { series: series.value } } : {}) };
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const shortcut = (prefix: string, tab: DoeTab | null) => ({
|
|
18
|
+
prefix, argKind: "text" as const, argPlaceholder: "series", argOptional: true,
|
|
19
|
+
argOptions: () => DOE_SERIES_OPTIONS.filter((option) => !tab || option.tab === tab).map(({ value, label }) => ({ value, label })),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export const doeModule: PluginModule = {
|
|
23
|
+
panes: [{ id: "doe", name: "Oil and Gas Inventories", icon: "D", component: DoePane,
|
|
24
|
+
defaultPosition: "right", defaultMode: "floating", defaultFloatingSize: { width: 96, height: 34 },
|
|
25
|
+
tableExport: true, headless: doeHeadless("all") }],
|
|
26
|
+
paneTemplates: [{
|
|
27
|
+
id: "doe-pane", paneId: "doe", label: "Oil and Gas Inventories",
|
|
28
|
+
description: "EIA weekly petroleum and gas storage: builds and draws, year-ago and five-year ranges, seasonal charts.",
|
|
29
|
+
keywords: ["doe", "eia", "oil", "crude", "cushing", "spr", "gasoline", "distillate", "inventories", "stocks", "refinery"],
|
|
30
|
+
shortcut: shortcut("DOE", null), headless: doeHeadless("all"),
|
|
31
|
+
createInstance: (_context, options) => doeInstance("crude", options),
|
|
32
|
+
}, {
|
|
33
|
+
id: "doe-gas-pane", paneId: "doe", label: "Natural Gas Storage",
|
|
34
|
+
description: "EIA weekly working gas in storage, lower 48 and by region, against a year ago and the five-year range.",
|
|
35
|
+
keywords: ["ngs", "natural gas", "storage", "working gas", "injection", "withdrawal", "eia"],
|
|
36
|
+
shortcut: shortcut("NGS", "gas"), headless: doeHeadless("gas"),
|
|
37
|
+
createInstance: (_context, options) => doeInstance("gas", options),
|
|
38
|
+
}],
|
|
39
|
+
setup(ctx) { doeBoardCache.attach(ctx.persistence); },
|
|
40
|
+
dispose() { doeBoardCache.reset(); },
|
|
41
|
+
};
|