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,164 @@
|
|
|
1
|
+
import { apiClient } from "../api-client";
|
|
2
|
+
import type { AttentionAction, AttentionCountsPayload } from "../api-client/telemetry";
|
|
3
|
+
import { CHART_COMPOSER_PANE_ID, TICKER_RESEARCH_PANE_ID, type TelemetryConfig } from "../types/config";
|
|
4
|
+
import { telemetryOptedOut } from "./crash-reports";
|
|
5
|
+
import { subscribeTelemetryConfig } from "./live-config";
|
|
6
|
+
import { automationActive } from "./usage-counts";
|
|
7
|
+
|
|
8
|
+
const FLUSH_MS = 60_000;
|
|
9
|
+
const MAX_AGE_MS = 120_000;
|
|
10
|
+
const HOUR_MS = 3_600_000;
|
|
11
|
+
const MAX_EVENTS = 100;
|
|
12
|
+
const SYMBOL = /^[A-Z0-9^][A-Z0-9.^_:/=-]{0,63}$/;
|
|
13
|
+
const ACTIONS = new Set<AttentionAction>(["des", "chart", "quote", "option_chain", "watchlist_add"]);
|
|
14
|
+
|
|
15
|
+
/** Ticker-level counting always requires its own explicit consent. */
|
|
16
|
+
export function attentionCountsEnabled(
|
|
17
|
+
config: { telemetry?: TelemetryConfig } | null | undefined,
|
|
18
|
+
env: Record<string, string | undefined> = {},
|
|
19
|
+
): boolean {
|
|
20
|
+
return config?.telemetry?.attention === true && !telemetryOptedOut(env);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface AttentionHost {
|
|
24
|
+
isEnabled(): boolean;
|
|
25
|
+
/** An opaque object used only to notice account changes, never serialized. */
|
|
26
|
+
verifiedSession(): object | null;
|
|
27
|
+
send(payload: AttentionCountsPayload, signal: AbortSignal): Promise<void>;
|
|
28
|
+
now?(): number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** No disk queue, identifiers, timestamps in the payload, or retries. */
|
|
32
|
+
export class AttentionCounter {
|
|
33
|
+
private readonly pending = new Map<string, AttentionCountsPayload["events"][number]>();
|
|
34
|
+
private session: object | null = null;
|
|
35
|
+
private generation = 0;
|
|
36
|
+
private collectedAt: number | null = null;
|
|
37
|
+
private timer: ReturnType<typeof setTimeout> | null = null;
|
|
38
|
+
private inFlight: AbortController | null = null;
|
|
39
|
+
private disposed = false;
|
|
40
|
+
|
|
41
|
+
constructor(private readonly host: AttentionHost) {}
|
|
42
|
+
|
|
43
|
+
private now(): number { return this.host.now?.() ?? Date.now(); }
|
|
44
|
+
|
|
45
|
+
/** Synchronous: opt-out, sign-out and account changes erase unsent counts. */
|
|
46
|
+
refresh(): boolean {
|
|
47
|
+
try {
|
|
48
|
+
const session = !this.disposed && this.host.isEnabled() ? this.host.verifiedSession() : null;
|
|
49
|
+
if (!session || session !== this.session) {
|
|
50
|
+
this.clear();
|
|
51
|
+
this.session = session;
|
|
52
|
+
}
|
|
53
|
+
return session !== null;
|
|
54
|
+
} catch {
|
|
55
|
+
this.clear();
|
|
56
|
+
this.session = null;
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
private clear(): void {
|
|
62
|
+
this.generation += 1;
|
|
63
|
+
this.pending.clear();
|
|
64
|
+
this.collectedAt = null;
|
|
65
|
+
if (this.timer) clearTimeout(this.timer);
|
|
66
|
+
this.timer = null;
|
|
67
|
+
this.inFlight?.abort();
|
|
68
|
+
this.inFlight = null;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
dispose(): void {
|
|
72
|
+
this.disposed = true;
|
|
73
|
+
this.refresh();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Capture before awaiting ticker resolution: consent cannot be retroactive. */
|
|
77
|
+
capture(): (symbol: string, action: AttentionAction) => void {
|
|
78
|
+
if (!this.refresh() || automationActive()) return () => {};
|
|
79
|
+
const generation = this.generation;
|
|
80
|
+
return (rawSymbol, action) => {
|
|
81
|
+
try {
|
|
82
|
+
if (!this.refresh() || generation !== this.generation || automationActive()) return;
|
|
83
|
+
const symbol = rawSymbol.trim().toUpperCase();
|
|
84
|
+
if (!SYMBOL.test(symbol) || !ACTIONS.has(action)) return;
|
|
85
|
+
const now = this.now();
|
|
86
|
+
// A suspended window cannot replay an old hour after it wakes up.
|
|
87
|
+
if (this.collectedAt !== null && (now < this.collectedAt || now - this.collectedAt > MAX_AGE_MS
|
|
88
|
+
|| Math.floor(now / HOUR_MS) !== Math.floor(this.collectedAt / HOUR_MS))) {
|
|
89
|
+
this.pending.clear();
|
|
90
|
+
this.collectedAt = null;
|
|
91
|
+
}
|
|
92
|
+
if (this.pending.size >= MAX_EVENTS) return;
|
|
93
|
+
this.collectedAt ??= now;
|
|
94
|
+
this.pending.set(`${symbol}\0${action}`, { symbol, action });
|
|
95
|
+
this.schedule();
|
|
96
|
+
} catch { /* A count must never interrupt a user action. */ }
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
private schedule(): void {
|
|
101
|
+
if (this.timer || this.pending.size === 0 || this.disposed) return;
|
|
102
|
+
this.timer = setTimeout(() => { this.timer = null; void this.flush(); }, FLUSH_MS);
|
|
103
|
+
(this.timer as { unref?: () => void }).unref?.();
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
async flush(): Promise<void> {
|
|
107
|
+
if (this.timer) clearTimeout(this.timer);
|
|
108
|
+
this.timer = null;
|
|
109
|
+
if (!this.refresh() || this.inFlight || this.pending.size === 0) return;
|
|
110
|
+
const now = this.now();
|
|
111
|
+
const collectedAt = this.collectedAt!;
|
|
112
|
+
const events = [...this.pending.values()];
|
|
113
|
+
this.pending.clear();
|
|
114
|
+
this.collectedAt = null;
|
|
115
|
+
if (now < collectedAt || now - collectedAt > MAX_AGE_MS
|
|
116
|
+
|| Math.floor(now / HOUR_MS) !== Math.floor(collectedAt / HOUR_MS)) return;
|
|
117
|
+
const controller = new AbortController();
|
|
118
|
+
this.inFlight = controller;
|
|
119
|
+
try {
|
|
120
|
+
// There is deliberately no await between the final consent check and send.
|
|
121
|
+
if (this.refresh() && !controller.signal.aborted) {
|
|
122
|
+
await this.host.send({ consent: true, events }, controller.signal);
|
|
123
|
+
}
|
|
124
|
+
} catch { /* Failed batches are dropped, never retried. */ }
|
|
125
|
+
finally {
|
|
126
|
+
if (this.inFlight === controller) this.inFlight = null;
|
|
127
|
+
this.schedule();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
let counter: AttentionCounter | null = null;
|
|
133
|
+
|
|
134
|
+
/** Installed only by interactive terminal, desktop and web entry points. */
|
|
135
|
+
export function installAttentionCounter(isEnabled: () => boolean): () => void {
|
|
136
|
+
counter?.dispose();
|
|
137
|
+
const next = new AttentionCounter({
|
|
138
|
+
isEnabled,
|
|
139
|
+
verifiedSession: () => apiClient.getVerifiedSessionIdentity(),
|
|
140
|
+
send: (payload, signal) => apiClient.reportAttentionCounts(payload, signal),
|
|
141
|
+
});
|
|
142
|
+
counter = next;
|
|
143
|
+
const config = subscribeTelemetryConfig(() => next.refresh());
|
|
144
|
+
const auth = apiClient.subscribeCurrentUser(() => next.refresh());
|
|
145
|
+
return () => {
|
|
146
|
+
next.dispose();
|
|
147
|
+
config();
|
|
148
|
+
auth();
|
|
149
|
+
if (counter === next) counter = null;
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export function captureAttentionAction(): (symbol: string, action: AttentionAction) => void {
|
|
154
|
+
return counter?.capture() ?? (() => {});
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** Only explicit opens of these built-in surfaces count, never mount or polling. */
|
|
158
|
+
export function attentionActionForPane(paneId: string): AttentionAction | null {
|
|
159
|
+
if (paneId === TICKER_RESEARCH_PANE_ID) return "des";
|
|
160
|
+
if (paneId === CHART_COMPOSER_PANE_ID || paneId === "historical-prices") return "chart";
|
|
161
|
+
if (paneId === "quote-monitor") return "quote";
|
|
162
|
+
if (paneId === "options") return "option_chain";
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
@@ -6,9 +6,16 @@ import type { TelemetryConfig } from "../types/config";
|
|
|
6
6
|
* turned off in the command bar takes effect at once, not at the next launch.
|
|
7
7
|
*/
|
|
8
8
|
let reported: { telemetry?: TelemetryConfig } | null = null;
|
|
9
|
+
const listeners = new Set<() => void>();
|
|
9
10
|
|
|
10
11
|
export function reportTelemetryConfig(telemetry: TelemetryConfig | undefined): void {
|
|
11
12
|
reported = { telemetry };
|
|
13
|
+
for (const listener of listeners) listener();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function subscribeTelemetryConfig(listener: () => void): () => void {
|
|
17
|
+
listeners.add(listener);
|
|
18
|
+
return () => { listeners.delete(listener); };
|
|
12
19
|
}
|
|
13
20
|
|
|
14
21
|
/** The switches the app last reported, or the config read at launch until it has. */
|
|
@@ -3,12 +3,16 @@ const { createRPC } = await import(new URL("../shared/rpc.ts", import.meta.resol
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Sends a "backend.request" from an Electrobun RPC client to a server that answers with `handle`,
|
|
6
|
-
* JSON-cloning every packet the way the desktop transport does.
|
|
6
|
+
* JSON-cloning every packet the way the desktop transport does. `maxRequestTime` is the client's
|
|
7
|
+
* request timer, as the desktop view sets it.
|
|
7
8
|
*/
|
|
8
|
-
export function createRpcLoopback(
|
|
9
|
+
export function createRpcLoopback(
|
|
10
|
+
handle: (request: unknown) => unknown,
|
|
11
|
+
{ maxRequestTime = 1000 }: { maxRequestTime?: number } = {},
|
|
12
|
+
): (request: unknown) => Promise<unknown> {
|
|
9
13
|
let receiveClient: (packet: unknown) => void;
|
|
10
14
|
let receiveServer: (packet: unknown) => void;
|
|
11
|
-
const client = createRPC({ maxRequestTime
|
|
15
|
+
const client = createRPC({ maxRequestTime });
|
|
12
16
|
const server = createRPC({ requestHandler: { "backend.request": handle } });
|
|
13
17
|
client.setTransport({
|
|
14
18
|
registerHandler: (handler: typeof receiveClient) => { receiveClient = handler; },
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useShellPaneManagementShortcuts } from "../components/layout/shell/pane/management-shortcuts";
|
|
2
|
+
|
|
3
|
+
type ShellPaneKeyOptions = Parameters<typeof useShellPaneManagementShortcuts>[0];
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The shell's pane keys (window modes, share, pop out, double-Esc close)
|
|
7
|
+
* beside a pane under test. Every action declines unless the test passes its
|
|
8
|
+
* own. Rendered after the pane, its handlers register after the pane's, the
|
|
9
|
+
* order a pane restored with the layout at launch has in the app.
|
|
10
|
+
*/
|
|
11
|
+
export function TestShellPaneKeys(options: Partial<ShellPaneKeyOptions> & { focusedPaneId: string }) {
|
|
12
|
+
const none = () => false;
|
|
13
|
+
useShellPaneManagementShortcuts({
|
|
14
|
+
cancelActiveDrag: () => {},
|
|
15
|
+
closeAllFloatingPanes: none,
|
|
16
|
+
closeFocusedPane: none,
|
|
17
|
+
copyFocusedPaneScreenshot: none,
|
|
18
|
+
exportFocusedPaneCsv: none,
|
|
19
|
+
gridlockVisiblePanes: none,
|
|
20
|
+
hasActiveDrag: none,
|
|
21
|
+
inputCaptured: false,
|
|
22
|
+
openFocusedPaneMenu: none,
|
|
23
|
+
openFocusedPaneSettings: none,
|
|
24
|
+
openLayoutGallery: () => {},
|
|
25
|
+
overlayOpen: false,
|
|
26
|
+
popOutFocusedPane: none,
|
|
27
|
+
shareFocusedPane: none,
|
|
28
|
+
startWindowMode: () => {},
|
|
29
|
+
toggleFocusedPaneFullscreen: none,
|
|
30
|
+
toggleFocusedPaneFloating: none,
|
|
31
|
+
...options,
|
|
32
|
+
});
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
@@ -10,6 +10,9 @@ const KIND_BY_TYPE: Record<string, TickerInstrumentKind> = {
|
|
|
10
10
|
COMMONSTOCK: "equity",
|
|
11
11
|
ADR: "equity",
|
|
12
12
|
DEPOSITARYRECEIPT: "equity",
|
|
13
|
+
AMERICANDEPOSITARYRECEIPT: "equity",
|
|
14
|
+
GLOBALDEPOSITARYRECEIPT: "equity",
|
|
15
|
+
LIMITEDPARTNERSHIP: "equity",
|
|
13
16
|
REIT: "equity",
|
|
14
17
|
PREFERREDSTOCK: "equity",
|
|
15
18
|
ETF: "fund",
|
|
@@ -54,7 +57,7 @@ const KIND_BY_TYPE: Record<string, TickerInstrumentKind> = {
|
|
|
54
57
|
};
|
|
55
58
|
|
|
56
59
|
/** A provider or broker type string, or null when it names nothing known. */
|
|
57
|
-
function classifyInstrumentType(type: string | null | undefined): TickerInstrumentKind | null {
|
|
60
|
+
export function classifyInstrumentType(type: string | null | undefined): TickerInstrumentKind | null {
|
|
58
61
|
const normalized = (type ?? "").trim().toUpperCase().replace(/[\s_-]+/g, "");
|
|
59
62
|
if (!normalized) return null;
|
|
60
63
|
const exact = KIND_BY_TYPE[normalized];
|
|
@@ -65,17 +68,20 @@ function classifyInstrumentType(type: string | null | undefined): TickerInstrume
|
|
|
65
68
|
return null;
|
|
66
69
|
}
|
|
67
70
|
|
|
68
|
-
/** Market listing
|
|
69
|
-
function
|
|
70
|
-
if (
|
|
71
|
-
|
|
72
|
-
const symbol = parsePublicTickerKey(ticker.metadata.ticker).symbol;
|
|
71
|
+
/** Market listing syntax: `CCC` coins, `^` indices, `=X` pairs, `=F` futures. */
|
|
72
|
+
export function kindFromListingSyntax(listing: string, exchange?: string): TickerInstrumentKind | null {
|
|
73
|
+
if (canonicalExchange(exchange) === "CCC") return "crypto";
|
|
74
|
+
const symbol = parsePublicTickerKey(listing).symbol;
|
|
73
75
|
if (symbol.startsWith("^")) return "index";
|
|
74
76
|
if (symbol.endsWith("=X")) return "currency";
|
|
75
77
|
if (symbol.endsWith("=F")) return "future";
|
|
76
78
|
return null;
|
|
77
79
|
}
|
|
78
80
|
|
|
81
|
+
function kindFromListing(ticker: TickerRecord | null | undefined): TickerInstrumentKind | null {
|
|
82
|
+
return ticker ? kindFromListingSyntax(ticker.metadata.ticker, ticker.metadata.exchange) : null;
|
|
83
|
+
}
|
|
84
|
+
|
|
79
85
|
/**
|
|
80
86
|
* The ticker's instrument kind from its quote, broker contract, saved type and
|
|
81
87
|
* listing syntax. Brokers file funds and stocks under one generic type (`STK`),
|
|
@@ -99,7 +99,7 @@ export async function resolveTickerOpenTarget({
|
|
|
99
99
|
const ticker = await tickerRepository.createTicker({
|
|
100
100
|
ticker: quoteSymbol,
|
|
101
101
|
exchange: requested.exchange ?? quote.listingExchangeName ?? quote.exchangeName ?? "",
|
|
102
|
-
currency: quote.currency || "
|
|
102
|
+
currency: quote.currency || "",
|
|
103
103
|
name: quote.name || quoteSymbol,
|
|
104
104
|
assetCategory: undefined,
|
|
105
105
|
portfolios: [],
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { classifyInstrumentType, kindFromListingSyntax } from "../instrument-kind";
|
|
2
|
+
import type { TickerSearchInstrumentClass } from "./types";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Class codes typed after a symbol or name, the way a terminal's market
|
|
6
|
+
* sector key follows a ticker: `ES FUT`, `EURUSD CUR`, `SPY ETF`. The same
|
|
7
|
+
* letters are the badge on a matching search row, so the list teaches them.
|
|
8
|
+
* A code on its own is never a filter: `EQ` is still Equillium, and `FUT` and
|
|
9
|
+
* `ETF` still open their panes.
|
|
10
|
+
*/
|
|
11
|
+
const ASSET_CLASS_CODES = ["EQ", "CUR", "OPT", "FUT", "IDX", "ETF"] as const;
|
|
12
|
+
|
|
13
|
+
export type AssetClassCode = (typeof ASSET_CLASS_CODES)[number];
|
|
14
|
+
|
|
15
|
+
export interface AssetClassQuery {
|
|
16
|
+
code: AssetClassCode;
|
|
17
|
+
/** The symbol or name typed before the code. */
|
|
18
|
+
symbolQuery: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function isAssetClassCode(value: string): value is AssetClassCode {
|
|
22
|
+
return (ASSET_CLASS_CODES as readonly string[]).includes(value);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** The class a query ends with, when something comes before it. */
|
|
26
|
+
export function parseAssetClassQuery(query: string): AssetClassQuery | null {
|
|
27
|
+
const tokens = query.trim().split(/\s+/);
|
|
28
|
+
if (tokens.length < 2) return null;
|
|
29
|
+
const code = tokens.at(-1)!.toUpperCase();
|
|
30
|
+
if (!isAssetClassCode(code)) return null;
|
|
31
|
+
return { code, symbolQuery: tokens.slice(0, -1).join(" ") };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The market spelling a class gives a bare symbol: the catalogue answers `ES`
|
|
36
|
+
* with Eversource only, and `ES=F` with the E-mini future.
|
|
37
|
+
*/
|
|
38
|
+
export function assetClassMarketSymbol(query: AssetClassQuery): string | null {
|
|
39
|
+
const symbol = query.symbolQuery.toUpperCase();
|
|
40
|
+
if (!/^[A-Z0-9]{1,10}$/.test(symbol)) return null;
|
|
41
|
+
switch (query.code) {
|
|
42
|
+
case "FUT":
|
|
43
|
+
return `${symbol}=F`;
|
|
44
|
+
case "IDX":
|
|
45
|
+
return `^${symbol}`;
|
|
46
|
+
case "CUR":
|
|
47
|
+
return /^[A-Z]{6}$/.test(symbol) ? `${symbol}=X` : `${symbol}-USD`;
|
|
48
|
+
default:
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function isExchangeTradedType(type: string): boolean {
|
|
54
|
+
const compact = type.toUpperCase().replace(/[^A-Z]/g, "");
|
|
55
|
+
return /\bET[FNP]\b/i.test(type) || compact.startsWith("EXCHANGETRADED");
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The class code of a search row: its type when the type names one, else its
|
|
60
|
+
* listing syntax (`=F`, `=X`, `^`, the crypto venue). Coins count as currency.
|
|
61
|
+
* A fund is ETF only when it trades on an exchange.
|
|
62
|
+
*/
|
|
63
|
+
export function instrumentClassCode(item: {
|
|
64
|
+
instrumentClass?: TickerSearchInstrumentClass;
|
|
65
|
+
instrumentType?: string | null;
|
|
66
|
+
symbol: string;
|
|
67
|
+
exchange?: string | null;
|
|
68
|
+
}): AssetClassCode | null {
|
|
69
|
+
const type = item.instrumentType ?? "";
|
|
70
|
+
const kind = classifyInstrumentType(type) ?? kindFromListingSyntax(item.symbol, item.exchange ?? undefined);
|
|
71
|
+
switch (kind) {
|
|
72
|
+
case "equity":
|
|
73
|
+
return "EQ";
|
|
74
|
+
case "currency":
|
|
75
|
+
case "crypto":
|
|
76
|
+
return "CUR";
|
|
77
|
+
case "option":
|
|
78
|
+
return "OPT";
|
|
79
|
+
case "future":
|
|
80
|
+
return "FUT";
|
|
81
|
+
case "index":
|
|
82
|
+
return "IDX";
|
|
83
|
+
case "fund":
|
|
84
|
+
return isExchangeTradedType(type) ? "ETF" : null;
|
|
85
|
+
case "bond":
|
|
86
|
+
case "other":
|
|
87
|
+
return null;
|
|
88
|
+
default:
|
|
89
|
+
return item.instrumentClass === "equity" ? "EQ" : null;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -2,9 +2,10 @@ import type { SearchRequestContext, DataProvider } from "../../types/data-provid
|
|
|
2
2
|
import type { InstrumentSearchResult } from "../../types/instrument";
|
|
3
3
|
import type { TickerRecord } from "../../types/ticker";
|
|
4
4
|
import { canonicalExchange, parsePublicTickerKey, publicTickerKey } from "../../utils/exchanges";
|
|
5
|
-
import { tickerHasListingSuffix } from "../../sources/listing-symbols";
|
|
5
|
+
import { getListingSymbol, tickerHasListingSuffix } from "../../sources/listing-symbols";
|
|
6
6
|
import { parseOptionSymbol } from "../../utils/options";
|
|
7
7
|
import { resolveCurrencyUnit } from "../../utils/currency-units";
|
|
8
|
+
import { assetClassMarketSymbol, parseAssetClassQuery } from "./asset-classes";
|
|
8
9
|
import { searchContractKey, searchInstrumentKey } from "./identity";
|
|
9
10
|
import { tickerInstrumentLabel } from "../instrument-label";
|
|
10
11
|
import {
|
|
@@ -57,6 +58,26 @@ const OPTION_TYPES = new Set(["OPT", "OPTION", "OPTIONS"]);
|
|
|
57
58
|
|
|
58
59
|
const SHARE_CLASS_SUFFIXES = new Set(["A", "B", "C", "D", "K"]);
|
|
59
60
|
|
|
61
|
+
/**
|
|
62
|
+
* Venue codes people type after a dot in place of the listing suffix:
|
|
63
|
+
* TTALO.HEL or TTALO.XHEL for TTALO.HE. Only tried once the literal symbol
|
|
64
|
+
* finds nothing, so class shares such as BRK.B never reach them.
|
|
65
|
+
*/
|
|
66
|
+
const DOTTED_VENUE_CODES = new Set([
|
|
67
|
+
"HEL", "XHEL", "STO", "XSTO", "CPH", "XCSE", "OSL", "XOSL",
|
|
68
|
+
"AMS", "XAMS", "PAR", "XPAR", "LON", "XLON", "ETR", "XETR",
|
|
69
|
+
]);
|
|
70
|
+
|
|
71
|
+
/** The listing-suffix and colon spellings of `SYM.<venue code>`, in that order. */
|
|
72
|
+
function dottedVenueQueries(symbol: string): string[] {
|
|
73
|
+
const dot = symbol.lastIndexOf(".");
|
|
74
|
+
if (dot <= 0) return [];
|
|
75
|
+
const base = symbol.slice(0, dot);
|
|
76
|
+
const venue = symbol.slice(dot + 1);
|
|
77
|
+
if (!DOTTED_VENUE_CODES.has(venue)) return [];
|
|
78
|
+
return [...new Set([getListingSymbol(base, venue), `${base}:${venue}`])];
|
|
79
|
+
}
|
|
80
|
+
|
|
60
81
|
interface TickerSearchCandidateOptions {
|
|
61
82
|
includeOptionContracts?: boolean;
|
|
62
83
|
providerRanks?: ReadonlyMap<string, number>;
|
|
@@ -109,7 +130,8 @@ export function createLocalTickerSearchCandidates(
|
|
|
109
130
|
right: venue,
|
|
110
131
|
exchangeLabel: venue,
|
|
111
132
|
primaryExchangeLabel: contractKey ? result!.primaryExchange : primaryExchangeLabel,
|
|
112
|
-
providerRank: options.providerRanks?.get(symbol)
|
|
133
|
+
providerRank: options.providerRanks?.get(symbol)
|
|
134
|
+
?? options.providerRanks?.get(publicTickerKey(symbol, ticker.metadata.exchange)),
|
|
113
135
|
popularity: options.providerPopularity?.get(symbol),
|
|
114
136
|
category: "Saved",
|
|
115
137
|
kind: "ticker",
|
|
@@ -187,7 +209,8 @@ export async function searchTickerCandidates({
|
|
|
187
209
|
providerResults,
|
|
188
210
|
localLimit,
|
|
189
211
|
totalLimit,
|
|
190
|
-
|
|
212
|
+
// A search that hides contracts still shows them when asked: "AAPL OPT".
|
|
213
|
+
includeOptionContracts: includeOptionContracts || parseAssetClassQuery(query)?.code === "OPT",
|
|
191
214
|
});
|
|
192
215
|
return assemble(await searchProviderResults(
|
|
193
216
|
dataProvider,
|
|
@@ -230,22 +253,35 @@ export function buildTickerSearchCandidates({
|
|
|
230
253
|
return limitTickerSearchCandidates(assignTickerSearchCategories(ranked), totalLimit, localLimit);
|
|
231
254
|
}
|
|
232
255
|
|
|
233
|
-
|
|
234
|
-
query,
|
|
235
|
-
activeTicker,
|
|
236
|
-
tickers,
|
|
237
|
-
dataProvider,
|
|
238
|
-
searchContext,
|
|
239
|
-
}: {
|
|
256
|
+
interface ResolveTickerSearchOptions {
|
|
240
257
|
query?: string;
|
|
241
258
|
activeTicker: string | null;
|
|
242
259
|
tickers: ReadonlyMap<string, TickerRecord>;
|
|
243
260
|
dataProvider: DataProvider;
|
|
244
261
|
searchContext?: SearchRequestContext;
|
|
245
|
-
}
|
|
246
|
-
const symbol = normalizeTickerInput(activeTicker, query);
|
|
247
|
-
if (!symbol) return null;
|
|
262
|
+
}
|
|
248
263
|
|
|
264
|
+
export function resolveTickerSearch(options: ResolveTickerSearchOptions): Promise<ResolvedTickerSearch | null> {
|
|
265
|
+
const symbol = normalizeTickerInput(options.activeTicker, options.query);
|
|
266
|
+
if (!symbol) return Promise.resolve(null);
|
|
267
|
+
const literal = resolveTickerSymbol(symbol, options);
|
|
268
|
+
const alternatives = dottedVenueQueries(symbol);
|
|
269
|
+
// Most input has no venue code to retry: hand back the literal lookup
|
|
270
|
+
// itself, so it settles no later than it did before the retry existed.
|
|
271
|
+
if (alternatives.length === 0) return literal;
|
|
272
|
+
return literal.then(async (resolved) => {
|
|
273
|
+
for (const alternative of resolved ? [] : alternatives) {
|
|
274
|
+
const match = await resolveTickerSymbol(alternative, options);
|
|
275
|
+
if (match) return match;
|
|
276
|
+
}
|
|
277
|
+
return resolved;
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
async function resolveTickerSymbol(
|
|
282
|
+
symbol: string,
|
|
283
|
+
{ tickers, dataProvider, searchContext }: ResolveTickerSearchOptions,
|
|
284
|
+
): Promise<ResolvedTickerSearch | null> {
|
|
249
285
|
const local = tickers.get(symbol)
|
|
250
286
|
?? findExactTickerSearchMatch(createLocalTickerSearchCandidates(tickers.values()), symbol)?.ticker
|
|
251
287
|
?? null;
|
|
@@ -333,6 +369,10 @@ function buildProviderHints(
|
|
|
333
369
|
for (const [rank, result] of searchResults.entries()) {
|
|
334
370
|
const symbol = getSearchResultSymbol(result);
|
|
335
371
|
if (!ranks.has(symbol)) ranks.set(symbol, rank);
|
|
372
|
+
// A saved second listing is keyed with its venue (SAP:XETR); it takes
|
|
373
|
+
// that venue's place instead of the end of the issuer's listings.
|
|
374
|
+
const listingKey = publicTickerKey(symbol, listingExchange(result));
|
|
375
|
+
if (listingKey !== symbol && !ranks.has(listingKey)) ranks.set(listingKey, rank);
|
|
336
376
|
const score = searchResultPopularity(result);
|
|
337
377
|
if (score != null) popularity.set(symbol, Math.max(score, popularity.get(symbol) ?? score));
|
|
338
378
|
const existing = results.get(symbol);
|
|
@@ -354,10 +394,15 @@ function searchResultPopularity(result: InstrumentSearchResult): number | undefi
|
|
|
354
394
|
|
|
355
395
|
async function searchProviderResults(
|
|
356
396
|
dataProvider: DataProvider,
|
|
357
|
-
|
|
397
|
+
rawQuery: string,
|
|
358
398
|
searchContext?: SearchRequestContext,
|
|
359
399
|
onPartial?: (results: InstrumentSearchResult[]) => void,
|
|
360
400
|
): Promise<InstrumentSearchResult[]> {
|
|
401
|
+
// "ES FUT" looks up ES, and ES=F as well: the catalogue answers a bare root
|
|
402
|
+
// with stocks only. The ranking keeps the futures.
|
|
403
|
+
const assetClass = parseAssetClassQuery(rawQuery);
|
|
404
|
+
const query = assetClass?.symbolQuery ?? rawQuery;
|
|
405
|
+
const marketSymbol = assetClass ? assetClassMarketSymbol(assetClass) : null;
|
|
361
406
|
// A Map rather than a list plus a seen set, because a later source can send
|
|
362
407
|
// back a richer version of a symbol already recorded. Overwriting a key keeps
|
|
363
408
|
// its original position, so an upgrade does not reorder the list.
|
|
@@ -373,7 +418,9 @@ async function searchProviderResults(
|
|
|
373
418
|
// The variants are independent lookups of the same words, so they run
|
|
374
419
|
// together. Awaited in turn they multiplied every per-source timeout by the
|
|
375
420
|
// number of spellings tried.
|
|
376
|
-
|
|
421
|
+
const searchQueries = buildProviderSearchQueries(query);
|
|
422
|
+
if (marketSymbol && !searchQueries.includes(marketSymbol)) searchQueries.push(marketSymbol);
|
|
423
|
+
await Promise.all(searchQueries.map(async (searchQuery) => {
|
|
377
424
|
try {
|
|
378
425
|
const results = await dataProvider.search(searchQuery, {
|
|
379
426
|
...searchContext,
|
|
@@ -4,6 +4,7 @@ import type {
|
|
|
4
4
|
} from "./types";
|
|
5
5
|
import { getListingSymbol, tickerHasListingSuffix } from "../../sources/listing-symbols";
|
|
6
6
|
import { canonicalExchange, parsePublicTickerKey } from "../../utils/exchanges";
|
|
7
|
+
import { assetClassMarketSymbol, instrumentClassCode, parseAssetClassQuery } from "./asset-classes";
|
|
7
8
|
|
|
8
9
|
const FUND_TYPES = new Set(["ETF", "ETN", "ETP", "FUND", "MUTUALFUND", "CEF", "CLOSEDEND"]);
|
|
9
10
|
const DERIVATIVE_TYPES = new Set(["OPT", "OPTION", "OPTIONS", "FUT", "FUTURE", "FUTURES", "WARRANT", "WARRANTS", "RIGHT", "RIGHTS"]);
|
|
@@ -163,12 +164,23 @@ function getTickerSearchListingKey(item: Pick<TickerSearchRankableItem, "label">
|
|
|
163
164
|
|
|
164
165
|
export function rankTickerSearchItems<T extends Pick<TickerSearchRankableItem, "id" | "label" | "detail" | "kind" | "category" | "right"> & Partial<TickerSearchRankableItem>>(
|
|
165
166
|
items: T[],
|
|
166
|
-
|
|
167
|
+
rawQuery: string,
|
|
167
168
|
): T[] {
|
|
169
|
+
// A trailing class code ("ES FUT") keeps only rows of that class and ranks
|
|
170
|
+
// the words before it.
|
|
171
|
+
const assetClass = parseAssetClassQuery(rawQuery);
|
|
172
|
+
const query = assetClass?.symbolQuery ?? rawQuery;
|
|
168
173
|
const intent = analyzeSearchQuery(query);
|
|
169
174
|
if (!intent.normalizedQuery) return items;
|
|
170
175
|
|
|
171
|
-
const ranked =
|
|
176
|
+
const ranked = (assetClass
|
|
177
|
+
? items.filter((item) => instrumentClassCode({
|
|
178
|
+
instrumentClass: item.instrumentClass,
|
|
179
|
+
instrumentType: item.instrumentType,
|
|
180
|
+
symbol: item.symbol || item.label,
|
|
181
|
+
exchange: item.exchangeLabel || item.right,
|
|
182
|
+
}) === assetClass.code)
|
|
183
|
+
: items)
|
|
172
184
|
.map((item, index) => {
|
|
173
185
|
// A saved public key replaces its provider row during deduplication.
|
|
174
186
|
// Score its exact bare symbol like that row, retaining the saved identity
|
|
@@ -357,6 +369,13 @@ export function rankTickerSearchItems<T extends Pick<TickerSearchRankableItem, "
|
|
|
357
369
|
seen.add(key);
|
|
358
370
|
deduped.push(entry.item);
|
|
359
371
|
}
|
|
372
|
+
// "BTC CUR" means BTC-USD, which the word ranking puts behind wrapped coins
|
|
373
|
+
// whose names contain "BTC".
|
|
374
|
+
const marketSymbol = assetClass ? assetClassMarketSymbol(assetClass) : null;
|
|
375
|
+
const marketIndex = marketSymbol
|
|
376
|
+
? deduped.findIndex((item) => parsePublicTickerKey(item.symbol || item.label).symbol === marketSymbol)
|
|
377
|
+
: -1;
|
|
378
|
+
if (marketIndex > 0) deduped.unshift(...deduped.splice(marketIndex, 1));
|
|
360
379
|
return deduped;
|
|
361
380
|
}
|
|
362
381
|
|
|
@@ -630,7 +649,7 @@ function getCompanyNameKey(detail: string): string {
|
|
|
630
649
|
return normalizeCompanyName(detail.split("|")[0] || "");
|
|
631
650
|
}
|
|
632
651
|
|
|
633
|
-
function getIssuerGroupKey(detail: string): string {
|
|
652
|
+
export function getIssuerGroupKey(detail: string): string {
|
|
634
653
|
// Listing descriptions do not create a different issuer. Strip only these
|
|
635
654
|
// recognized tails for grouping, preserving full names and query relevance.
|
|
636
655
|
const issuer = normalizeSearchText(detail.split("|")[0] || "")
|
|
@@ -33,7 +33,10 @@ export async function upsertTickerFromSearchResult(
|
|
|
33
33
|
const metadata: TickerMetadata = {
|
|
34
34
|
ticker: symbol,
|
|
35
35
|
exchange: result.exchange,
|
|
36
|
-
|
|
36
|
+
// Unknown stays unknown (empty): a guessed USD outranked the portfolio's
|
|
37
|
+
// and base currency, and valued a Helsinki holding as dollars. A later
|
|
38
|
+
// search result that knows the currency fills it in.
|
|
39
|
+
currency: result.currency || result.brokerContract?.currency || "",
|
|
37
40
|
name: result.name || symbol,
|
|
38
41
|
assetCategory: result.brokerContract?.secType || result.type || undefined,
|
|
39
42
|
broker_contracts: result.brokerContract ? [result.brokerContract] : [],
|
|
@@ -14,6 +14,8 @@ import { isFiniteNumber } from "../utils/guards";
|
|
|
14
14
|
|
|
15
15
|
const DAY_MS = 24 * 60 * 60_000;
|
|
16
16
|
const EXTENDED_HOURS_STATES = new Set(["PRE", "PREPRE", "POST", "POSTPOST"]);
|
|
17
|
+
/** Before 04:00 and after 20:00 New York, outside even extended hours. */
|
|
18
|
+
const OVERNIGHT_STATES = new Set(["PREPRE", "POSTPOST"]);
|
|
17
19
|
const PRE_MARKET_STATES = new Set(["PRE", "PREPRE"]);
|
|
18
20
|
/** Bars formed without any history refresh stay bounded on a chart left open for weeks. */
|
|
19
21
|
const MAX_FORMED_BARS = 2_000;
|
|
@@ -30,6 +32,8 @@ export interface LiveBarOptions {
|
|
|
30
32
|
liveSince?: number;
|
|
31
33
|
/** The history's declared bar contract and acquisition time, when its source provides one. */
|
|
32
34
|
session?: Pick<HistorySession, "timestampConvention" | "observedAt">;
|
|
35
|
+
/** The history includes pre-market and after-hours bars, so quotes then form bars too. */
|
|
36
|
+
extendedHours?: boolean;
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
interface FormedBar {
|
|
@@ -291,9 +295,10 @@ export class LiveBarAccumulator {
|
|
|
291
295
|
this.lastPreMarket = preMarket;
|
|
292
296
|
this.version += 1;
|
|
293
297
|
|
|
294
|
-
// Loaded intraday bars cover the regular session
|
|
295
|
-
//
|
|
296
|
-
|
|
298
|
+
// Loaded intraday bars cover the regular session unless they include
|
|
299
|
+
// extended hours. Otherwise extended-hours prints would extend or form
|
|
300
|
+
// bars that no refresh can confirm.
|
|
301
|
+
if (!calendar && quote.marketState && (options.extendedHours ? OVERNIGHT_STATES : EXTENDED_HOURS_STATES).has(quote.marketState)) {
|
|
297
302
|
this.closeFormingVolume(previous);
|
|
298
303
|
return;
|
|
299
304
|
}
|