@gloom-sh/terminal 0.20.12 → 0.20.14
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/package.json +2 -1
- package/patches/@opentui%2Fcore@0.3.2.patch +22 -4
- package/src/account/auth-dialog.tsx +22 -4
- package/src/account/auth-form.tsx +6 -1
- package/src/account/billing.ts +3 -2
- package/src/account/checkout-handoff.tsx +7 -14
- package/src/account/device-signin-dialog.tsx +35 -24
- package/src/account/upgrade-dialog.tsx +8 -8
- package/src/api-client/crypto-markets.ts +10 -0
- package/src/api-client/errors.ts +3 -1
- package/src/api-client/index.ts +10 -2
- package/src/api-client/install-experiments.ts +146 -0
- package/src/api-client/money-markets.ts +7 -0
- package/src/api-client/request.ts +12 -2
- package/src/api-client/telemetry.ts +47 -0
- package/src/api-client/types/market.ts +4 -0
- package/src/api-client/types/news.ts +16 -0
- package/src/architecture/floating-promise-allowlist.json +17 -34
- package/src/brokers/signed-in/adapter.ts +2 -2
- package/src/brokers/signed-in/catalog.ts +13 -4
- package/src/brokers/signed-in/sign-in-dialog.tsx +38 -38
- package/src/cli/commands/market.ts +146 -55
- package/src/cli/commands/overview.ts +21 -7
- package/src/cli/commands/search.ts +103 -9
- package/src/cli/commands/ticker.ts +22 -13
- package/src/cli/earnings-calendar.ts +33 -53
- package/src/cli/errors.ts +3 -1
- package/src/cli/freshness.ts +7 -2
- package/src/cli/glossary.ts +10 -5
- package/src/cli/helpers.ts +8 -16
- package/src/cli/history-export.ts +4 -0
- package/src/cli/history-rows.ts +18 -1
- package/src/cli/known-gaps.ts +11 -2
- package/src/cli/listing-arg.ts +183 -28
- package/src/cli/not-a-ticker.ts +4 -0
- package/src/cli/pane-functions/catalog.ts +81 -12
- package/src/cli/pane-functions/dom.ts +8 -1
- package/src/cli/pane-functions/freshness.ts +2 -2
- package/src/cli/pane-functions/headless.ts +13 -10
- package/src/cli/pane-functions/index.ts +1 -1
- package/src/cli/pane-functions/options.ts +7 -0
- package/src/cli/pane-functions/report.ts +4 -1
- package/src/cli/pane-functions/resolver.ts +61 -15
- package/src/cli/perpetual-contract.ts +4 -4
- package/src/cli/quote-answer.ts +6 -2
- package/src/cli/result.ts +24 -5
- package/src/cli/symbol-args.ts +5 -3
- package/src/cli/symbol-list.ts +23 -10
- package/src/cli/symbol-rows.ts +135 -3
- package/src/cli/treasury-yields.ts +15 -1
- package/src/components/chart/composite/axis-overlays.tsx +5 -2
- package/src/components/chart/composite/composite-chart.tsx +1 -0
- package/src/components/chart/composite/format.ts +103 -16
- package/src/components/chart/composite/legend.tsx +60 -25
- package/src/components/chart/composite/panel-surface/axis-markers.ts +133 -0
- package/src/components/chart/composite/panel-surface/level-labels.tsx +78 -0
- package/src/components/chart/composite/panel-surface/overlays.ts +108 -0
- package/src/components/chart/composite/panel-surface/pan-coast.ts +54 -0
- package/src/components/chart/composite/panel-surface/panel-cursor.tsx +138 -0
- package/src/components/chart/composite/panel-surface/panel-levels.ts +47 -0
- package/src/components/chart/composite/panel-surface/plot-gestures.ts +403 -0
- package/src/components/chart/composite/panel-surface/plot-pointer.ts +65 -0
- package/src/components/chart/composite/panel-surface/plot-wheel.ts +102 -0
- package/src/components/chart/composite/panel-surface/pointer.ts +12 -0
- package/src/components/chart/composite/panel-surface/props.ts +79 -0
- package/src/components/chart/composite/panel-surface/tool-readout.ts +151 -0
- package/src/components/chart/composite/panel-surface/value-axis-gestures.ts +152 -0
- package/src/components/chart/composite/panel-surface.tsx +81 -1177
- package/src/components/chart/composite/time-axis.ts +51 -29
- package/src/components/chart/composite/toolbar.tsx +42 -6
- package/src/components/chart/curve/curve-surface.tsx +5 -5
- package/src/components/command-bar/commands/collection-list.ts +1 -0
- package/src/components/command-bar/list/badge.ts +8 -5
- package/src/components/command-bar/list/model.ts +0 -5
- package/src/components/command-bar/list/view.tsx +39 -2
- package/src/components/command-bar/routes/root/plugin-install.ts +4 -2
- package/src/components/command-bar/routes/root/provider-search.ts +23 -3
- package/src/components/command-bar/routes/root/results.ts +23 -11
- package/src/components/command-bar/routes/root/runtime.ts +3 -2
- package/src/components/command-bar/routes/root/selection.ts +3 -2
- package/src/components/command-bar/routes/root/shortcuts.ts +15 -0
- package/src/components/command-bar/routes/root/start-here.ts +1 -2
- package/src/components/command-bar/routes/ticker-search/actions.ts +2 -3
- package/src/components/command-bar/routes/ticker-search/results.ts +23 -4
- package/src/components/data-table/view.tsx +29 -6
- package/src/components/form-modal/host.tsx +1 -1
- package/src/components/layout/header.tsx +3 -2
- package/src/components/layout/market-summary.ts +3 -3
- package/src/components/layout/pane/error-boundary.tsx +2 -1
- package/src/components/layout/pane/title.ts +10 -4
- package/src/components/markdown-text.tsx +36 -0
- package/src/components/market-board/index.tsx +4 -3
- package/src/components/onboarding/first-run-workspace.ts +46 -11
- package/src/components/onboarding/onboarding-keyboard.ts +57 -5
- package/src/components/onboarding/onboarding-wizard.tsx +91 -24
- package/src/components/onboarding/portfolio-step/index.tsx +1 -0
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +36 -9
- package/src/components/onboarding/portfolio-step/types.ts +2 -0
- package/src/components/onboarding/tickers-step-model.ts +140 -0
- package/src/components/onboarding/tickers-step.tsx +116 -0
- package/src/components/onboarding/use-onboarding-broker-form.ts +1 -1
- package/src/components/onboarding/use-onboarding-progress.ts +100 -11
- package/src/components/onboarding/use-onboarding-upgrade.ts +3 -2
- package/src/components/onboarding/wizard-model.ts +3 -1
- package/src/components/onboarding/wizard-tickers.ts +139 -0
- package/src/components/pane-settings-dialog/tui.tsx +6 -3
- package/src/components/pane-settings-dialog.tsx +2 -1
- package/src/components/pane-template-wizard.tsx +2 -0
- package/src/components/price-performance.tsx +2 -2
- package/src/components/speedometer-gauge/model.ts +2 -1
- package/src/components/speedometer-gauge/terminal.tsx +13 -8
- package/src/components/ui/choice-dialog.tsx +102 -33
- package/src/components/ui/confirm-dialog.tsx +3 -2
- package/src/components/ui/frame.tsx +7 -3
- package/src/components/ui/icon.tsx +4 -2
- package/src/components/ui/list-view.tsx +8 -0
- package/src/components/ui/multi-select/dialog.tsx +1 -7
- package/src/components/ui/not-meaningful.ts +16 -0
- package/src/components/ui/number-prompt-dialog.tsx +2 -1
- package/src/components/ui/query-bar.tsx +16 -4
- package/src/components/ui/stat-grid.tsx +27 -6
- package/src/components/use-pane-notice-footer.tsx +3 -1
- package/src/data/config/store/normalize.ts +2 -0
- package/src/docs/snapshot.json +3 -3
- package/src/i18n/es.ts +6 -2
- package/src/i18n/ja.ts +6 -2
- package/src/i18n/ko.ts +6 -2
- package/src/i18n/zh-cn.ts +6 -2
- package/src/i18n/zh-tw.ts +6 -2
- package/src/layout-marketplace/model.ts +2 -1
- package/src/market-data/futures-contract.ts +2 -1
- package/src/market-data/hooks.tsx +1 -1
- package/src/market-data/market/change-basis.ts +27 -5
- package/src/market-data/market/format.ts +48 -14
- package/src/market-data/quotes/contributions.ts +13 -0
- package/src/market-data/quotes/export-identity.ts +36 -1
- package/src/market-data/quotes/listing-enterprise-value.ts +3 -3
- package/src/market-data/quotes/resolution.ts +16 -0
- package/src/market-data/quotes/time.ts +17 -10
- package/src/market-data/tax-equivalent.ts +3 -2
- package/src/news/aggregator.ts +19 -8
- package/src/news/hooks.ts +1 -1
- package/src/news/news-model.ts +49 -0
- package/src/news/types.ts +9 -0
- package/src/plugins/builtin/account-management/calendar-tab.tsx +8 -3
- package/src/plugins/builtin/account-management/pane.tsx +9 -8
- package/src/plugins/builtin/account-management/password-dialog.tsx +2 -2
- package/src/plugins/builtin/alerts/calendar-events.ts +4 -5
- package/src/plugins/builtin/alerts/format.ts +6 -5
- package/src/plugins/builtin/alerts/headless.ts +3 -2
- package/src/plugins/builtin/alerts/history.ts +2 -1
- package/src/plugins/builtin/alerts/pane.tsx +2 -1
- package/src/plugins/builtin/alerts/price-text.ts +2 -1
- package/src/plugins/builtin/alerts/scheduled.ts +6 -5
- package/src/plugins/builtin/analytics/account-returns.ts +6 -7
- package/src/plugins/builtin/analytics/display.ts +2 -1
- package/src/plugins/builtin/analytics/pane-model.ts +5 -9
- package/src/plugins/builtin/analytics/risk-client.ts +12 -2
- package/src/plugins/builtin/analytics/risk-headless.ts +66 -6
- package/src/plugins/builtin/analytics/risk-math.ts +23 -6
- package/src/plugins/builtin/analytics/risk-model.ts +26 -15
- package/src/plugins/builtin/analytics/risk-pane.tsx +8 -7
- package/src/plugins/builtin/analytics/view.tsx +5 -5
- package/src/plugins/builtin/attention/model.ts +6 -5
- package/src/plugins/builtin/attention/pane.tsx +5 -4
- package/src/plugins/builtin/awards/detail.tsx +5 -4
- package/src/plugins/builtin/awards/headless.ts +8 -7
- package/src/plugins/builtin/awards/model.ts +4 -3
- package/src/plugins/builtin/awards/pane.tsx +4 -4
- package/src/plugins/builtin/backtest/format.ts +3 -2
- package/src/plugins/builtin/backtest/report.ts +3 -2
- package/src/plugins/builtin/bond-calculator/headless.ts +2 -1
- package/src/plugins/builtin/bond-calculator/pane.tsx +2 -1
- package/src/plugins/builtin/broker-manager/add-flow.tsx +1 -1
- package/src/plugins/builtin/broker-trading/orders-data.ts +3 -3
- package/src/plugins/builtin/broker-trading/orders.tsx +3 -2
- package/src/plugins/builtin/broker-trading/ticket.tsx +2 -2
- package/src/plugins/builtin/buildout/cells.tsx +2 -1
- package/src/plugins/builtin/buildout/company/pane.tsx +4 -3
- package/src/plugins/builtin/buildout/data-runtime.ts +21 -23
- package/src/plugins/builtin/buildout/detail/values.ts +2 -1
- package/src/plugins/builtin/buildout/format.ts +4 -3
- package/src/plugins/builtin/buildout/pane/index.tsx +3 -3
- package/src/plugins/builtin/catalysts/detail.tsx +2 -1
- package/src/plugins/builtin/catalysts/model.ts +6 -5
- package/src/plugins/builtin/catalysts/pane.tsx +2 -1
- package/src/plugins/builtin/cds/headless.ts +3 -2
- package/src/plugins/builtin/cds/model.ts +8 -8
- package/src/plugins/builtin/cds/pane.tsx +3 -2
- package/src/plugins/builtin/central-bank-rates/headless.ts +2 -1
- package/src/plugins/builtin/central-bank-rates/model.ts +3 -2
- package/src/plugins/builtin/central-bank-rates/pane.tsx +5 -5
- package/src/plugins/builtin/changelog/index.tsx +2 -2
- package/src/plugins/builtin/chart-composer/catalog-inventory.ts +5 -2
- package/src/plugins/builtin/chart-composer/editor.tsx +1 -0
- package/src/plugins/builtin/chart-composer/index.tsx +4 -2
- package/src/plugins/builtin/chart-composer/pane.tsx +8 -4
- package/src/plugins/builtin/chart-composer/quick-add.tsx +4 -1
- package/src/plugins/builtin/chart-composer/series-catalog.ts +17 -1
- package/src/plugins/builtin/chart-composer/use-series-catalog.ts +3 -1
- package/src/plugins/builtin/chart-composer/user-series.ts +3 -1
- package/src/plugins/builtin/chat/attachments/desktop.tsx +2 -1
- package/src/plugins/builtin/chat/controller/utils.ts +2 -1
- package/src/plugins/builtin/clinical-trials/model.ts +4 -3
- package/src/plugins/builtin/clinical-trials/sponsor-tickers.ts +4 -2
- package/src/plugins/builtin/cloud/askg/lock-note.ts +16 -4
- package/src/plugins/builtin/cloud/askg/model.ts +2 -1
- package/src/plugins/builtin/cloud/askg/pane.tsx +35 -1
- package/src/plugins/builtin/cloud/company-picker.tsx +1 -3
- package/src/plugins/builtin/cloud/plugin.tsx +2 -0
- package/src/plugins/builtin/cloud/team/pane.tsx +12 -12
- package/src/plugins/builtin/cloud/thesis/detail.tsx +13 -8
- package/src/plugins/builtin/cloud/thesis/module.tsx +2 -0
- package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +6 -2
- package/src/plugins/builtin/cloud-tweets/model.ts +2 -2
- package/src/plugins/builtin/comment-letters/pane.tsx +2 -1
- package/src/plugins/builtin/commodity-balances/headless.ts +3 -2
- package/src/plugins/builtin/company-attention/app-rank.tsx +5 -4
- package/src/plugins/builtin/company-attention/building-model.ts +7 -7
- package/src/plugins/builtin/company-attention/headless.ts +6 -5
- package/src/plugins/builtin/company-attention/model.ts +4 -4
- package/src/plugins/builtin/company-attention/moves-model.ts +9 -9
- package/src/plugins/builtin/company-attention/signals-model.ts +9 -9
- package/src/plugins/builtin/company-kpis/headless.ts +2 -1
- package/src/plugins/builtin/company-kpis/model.ts +15 -10
- package/src/plugins/builtin/company-kpis/pane.tsx +2 -2
- package/src/plugins/builtin/congress-trades/detail.tsx +6 -5
- package/src/plugins/builtin/congress-trades/headless.ts +2 -1
- package/src/plugins/builtin/congress-trades/model.ts +6 -6
- package/src/plugins/builtin/congress-trades/table.tsx +7 -6
- package/src/plugins/builtin/connections/pane.tsx +5 -5
- package/src/plugins/builtin/correlation/headless.ts +2 -2
- package/src/plugins/builtin/correlation/index.tsx +4 -1
- package/src/plugins/builtin/correlation/matrix/selection.ts +2 -1
- package/src/plugins/builtin/correlation/relationship/view-model.ts +3 -3
- package/src/plugins/builtin/cot/headless.ts +3 -2
- package/src/plugins/builtin/cot/model.ts +2 -1
- package/src/plugins/builtin/cot/pane.tsx +4 -3
- package/src/plugins/builtin/cpi/headless.ts +10 -4
- package/src/plugins/builtin/cpi/model.ts +25 -7
- package/src/plugins/builtin/cpi/pane.tsx +3 -1
- package/src/plugins/builtin/credit-boards/cdx-pane.tsx +5 -4
- package/src/plugins/builtin/credit-boards/headless.ts +2 -1
- package/src/plugins/builtin/credit-boards/model.ts +5 -5
- package/src/plugins/builtin/credit-conditions/headless.ts +2 -1
- package/src/plugins/builtin/credit-conditions/index.tsx +2 -2
- package/src/plugins/builtin/credit-documents/model.ts +2 -2
- package/src/plugins/builtin/crypto-board/client.ts +6 -1
- package/src/plugins/builtin/crypto-board/defi-view.tsx +7 -7
- package/src/plugins/builtin/crypto-board/defi.ts +2 -2
- package/src/plugins/builtin/crypto-board/headless.ts +10 -2
- package/src/plugins/builtin/crypto-board/model.ts +93 -14
- package/src/plugins/builtin/crypto-board/pane.tsx +28 -13
- package/src/plugins/builtin/crypto-board/supply.ts +2 -2
- package/src/plugins/builtin/crypto-etf-flows/model.ts +4 -4
- package/src/plugins/builtin/custom-view/index.tsx +3 -1
- package/src/plugins/builtin/custom-view/pane.tsx +5 -1
- package/src/plugins/builtin/custom-view/view-spec.ts +11 -0
- package/src/plugins/builtin/debt-maturities/model.ts +3 -3
- package/src/plugins/builtin/debt-maturities/pane.tsx +2 -2
- package/src/plugins/builtin/dividend-yield/client.ts +31 -5
- package/src/plugins/builtin/dividend-yield/headless.ts +20 -13
- package/src/plugins/builtin/dividend-yield/pane.tsx +12 -10
- package/src/plugins/builtin/dividend-yield/ranking-view.tsx +4 -1
- package/src/plugins/builtin/dividend-yield/ranking.ts +21 -12
- package/src/plugins/builtin/dividend-yield/types.ts +4 -0
- package/src/plugins/builtin/dividend-yield/view.ts +8 -4
- package/src/plugins/builtin/docs/use-docs.ts +4 -2
- package/src/plugins/builtin/doe/headless.ts +2 -1
- package/src/plugins/builtin/doe/model.ts +12 -11
- package/src/plugins/builtin/earnings/board-model.ts +14 -8
- package/src/plugins/builtin/earnings/board-table.ts +13 -8
- package/src/plugins/builtin/earnings/calendar-model.ts +5 -5
- package/src/plugins/builtin/earnings/calendar.tsx +2 -1
- package/src/plugins/builtin/earnings/format.ts +16 -14
- package/src/plugins/builtin/earnings/headless.ts +57 -19
- package/src/plugins/builtin/earnings/history-model.ts +11 -7
- package/src/plugins/builtin/earnings/history-table.ts +22 -9
- package/src/plugins/builtin/earnings/history.tsx +4 -3
- package/src/plugins/builtin/earnings-calls/calendar.tsx +2 -1
- package/src/plugins/builtin/earnings-calls/format.ts +6 -5
- package/src/plugins/builtin/earnings-calls/upcoming.ts +5 -5
- package/src/plugins/builtin/earnings-ripple/headless.ts +2 -1
- package/src/plugins/builtin/earnings-ripple/index.tsx +2 -0
- package/src/plugins/builtin/earnings-ripple/model.ts +3 -2
- package/src/plugins/builtin/earnings-ripple/pane.tsx +6 -6
- package/src/plugins/builtin/econ/calendar-model.ts +19 -3
- package/src/plugins/builtin/econ/detail-view.tsx +2 -2
- package/src/plugins/builtin/econ/fred-catalog.ts +33 -4
- package/src/plugins/builtin/econ/index.tsx +7 -6
- package/src/plugins/builtin/econ-statistics/detail.tsx +2 -1
- package/src/plugins/builtin/econ-statistics/headless.ts +25 -4
- package/src/plugins/builtin/econ-statistics/pane.tsx +2 -2
- package/src/plugins/builtin/equity-screener/headless.ts +5 -5
- package/src/plugins/builtin/equity-screener/model.ts +6 -4
- package/src/plugins/builtin/equity-screener/pane.tsx +7 -7
- package/src/plugins/builtin/equity-screener/screen-check.ts +2 -1
- package/src/plugins/builtin/equity-screener/ticker-check.tsx +2 -1
- package/src/plugins/builtin/estimate-revisions/model.ts +3 -2
- package/src/plugins/builtin/estimate-revisions/pane.tsx +8 -8
- package/src/plugins/builtin/executives/format.ts +4 -4
- package/src/plugins/builtin/exposure/headless.ts +8 -8
- package/src/plugins/builtin/exposure/model.ts +4 -3
- package/src/plugins/builtin/exposure/pane.tsx +6 -5
- package/src/plugins/builtin/fear-greed/format.ts +7 -7
- package/src/plugins/builtin/fear-greed/headless.ts +2 -1
- package/src/plugins/builtin/filing-events/feed.ts +2 -1
- package/src/plugins/builtin/futures/table.tsx +8 -8
- package/src/plugins/builtin/futures-curve/headless.ts +18 -18
- package/src/plugins/builtin/futures-curve/model.ts +5 -5
- package/src/plugins/builtin/futures-curve/pane.tsx +8 -8
- package/src/plugins/builtin/fx-matrix/index.tsx +2 -2
- package/src/plugins/builtin/fx-matrix/pairs.ts +2 -1
- package/src/plugins/builtin/gpu/board.tsx +6 -5
- package/src/plugins/builtin/gpu/changes.tsx +2 -1
- package/src/plugins/builtin/gpu/equities.tsx +2 -2
- package/src/plugins/builtin/gpu/headless.ts +4 -3
- package/src/plugins/builtin/gpu/model.ts +8 -7
- package/src/plugins/builtin/help/functions-table.tsx +41 -9
- package/src/plugins/builtin/help/index.tsx +6 -3
- package/src/plugins/builtin/help/keybindings-editor.tsx +35 -7
- package/src/plugins/builtin/help/shortcut-table.tsx +19 -7
- package/src/plugins/builtin/help/table-cells.tsx +51 -0
- package/src/plugins/builtin/holders/pane.tsx +4 -1
- package/src/plugins/builtin/insider/base-values.ts +2 -2
- package/src/plugins/builtin/insider/display.ts +2 -1
- package/src/plugins/builtin/insider/headless.ts +16 -16
- package/src/plugins/builtin/insider/insider-data.ts +2 -1
- package/src/plugins/builtin/insider/signals-model.ts +3 -3
- package/src/plugins/builtin/insider/table-model.ts +27 -13
- package/src/plugins/builtin/insider/table.tsx +1 -1
- package/src/plugins/builtin/ipo-calendar/model.ts +4 -4
- package/src/plugins/builtin/iv-history/format.ts +8 -7
- package/src/plugins/builtin/iv-history/headless.ts +9 -8
- package/src/plugins/builtin/iv-history/pane.tsx +3 -2
- package/src/plugins/builtin/iv-history/screen-pane.tsx +5 -4
- package/src/plugins/builtin/jobs/headless.ts +11 -11
- package/src/plugins/builtin/jobs/model.ts +2 -2
- package/src/plugins/builtin/jobs/pane.tsx +5 -5
- package/src/plugins/builtin/jodi/model.ts +2 -2
- package/src/plugins/builtin/jodi/pane.tsx +2 -1
- package/src/plugins/builtin/kelly-sizer/headless.ts +4 -4
- package/src/plugins/builtin/kelly-sizer/model.ts +2 -1
- package/src/plugins/builtin/kelly-sizer/sections.tsx +2 -2
- package/src/plugins/builtin/macro-day/headless.ts +27 -15
- package/src/plugins/builtin/macro-day/model.ts +42 -4
- package/src/plugins/builtin/macro-day/pane.tsx +30 -12
- package/src/plugins/builtin/macro-day/releases.ts +24 -1
- package/src/plugins/builtin/market-halts/model.ts +11 -10
- package/src/plugins/builtin/market-halts/pane.tsx +2 -1
- package/src/plugins/builtin/market-heatmap/index.tsx +4 -4
- package/src/plugins/builtin/market-movers/session-table.ts +3 -3
- package/src/plugins/builtin/market-movers/session.ts +2 -1
- package/src/plugins/builtin/market-movers/table.ts +5 -5
- package/src/plugins/builtin/market-valuation/detail.tsx +2 -2
- package/src/plugins/builtin/market-valuation/headless.ts +7 -7
- package/src/plugins/builtin/market-valuation/pane.tsx +7 -7
- package/src/plugins/builtin/members/breadth-pane.tsx +5 -4
- package/src/plugins/builtin/members/headless.ts +2 -1
- package/src/plugins/builtin/members/model.ts +3 -2
- package/src/plugins/builtin/members/pane.tsx +10 -9
- package/src/plugins/builtin/mna/distress/model.ts +2 -1
- package/src/plugins/builtin/mna/model.ts +5 -5
- package/src/plugins/builtin/money-markets/client.ts +4 -1
- package/src/plugins/builtin/money-markets/headless.ts +17 -5
- package/src/plugins/builtin/money-markets/index.tsx +1 -1
- package/src/plugins/builtin/money-markets/model.ts +3 -2
- package/src/plugins/builtin/money-markets/pane.tsx +11 -5
- package/src/plugins/builtin/news/headless.ts +5 -2
- package/src/plugins/builtin/news/wire/breaking/notifications.ts +21 -19
- package/src/plugins/builtin/news/wire/news/row.ts +3 -1
- package/src/plugins/builtin/news/wire/news/table.tsx +3 -2
- package/src/plugins/builtin/news/wire/persisted-articles.ts +28 -3
- package/src/plugins/builtin/notes/headless.ts +2 -1
- package/src/plugins/builtin/notes/model.ts +2 -1
- package/src/plugins/builtin/openfda/pane.tsx +4 -3
- package/src/plugins/builtin/options/carry.ts +3 -2
- package/src/plugins/builtin/options/market-reference.ts +2 -1
- package/src/plugins/builtin/options/table.ts +48 -9
- package/src/plugins/builtin/options/view.tsx +47 -17
- package/src/plugins/builtin/options-calculator/headless.ts +3 -2
- package/src/plugins/builtin/options-calculator/pane.tsx +7 -7
- package/src/plugins/builtin/options-positioning/headless.ts +8 -7
- package/src/plugins/builtin/options-positioning/model.ts +10 -10
- package/src/plugins/builtin/options-positioning/pane.tsx +5 -5
- package/src/plugins/builtin/options-scenario/collar.ts +5 -4
- package/src/plugins/builtin/options-scenario/csp-screen-headless.ts +11 -10
- package/src/plugins/builtin/options-scenario/csp-screen-pane.tsx +15 -14
- package/src/plugins/builtin/options-scenario/csp-screen.ts +2 -1
- package/src/plugins/builtin/options-scenario/csp.ts +6 -5
- package/src/plugins/builtin/options-scenario/headless.ts +6 -5
- package/src/plugins/builtin/options-scenario/hedge.ts +3 -3
- package/src/plugins/builtin/options-scenario/pane.tsx +7 -6
- package/src/plugins/builtin/options-scenario/strategy-screen.ts +1 -1
- package/src/plugins/builtin/pe-band/headless.ts +9 -8
- package/src/plugins/builtin/pe-band/pane.tsx +7 -7
- package/src/plugins/builtin/perps/cascade.ts +3 -2
- package/src/plugins/builtin/perps/headless.ts +10 -9
- package/src/plugins/builtin/perps/model.ts +14 -14
- package/src/plugins/builtin/perps/pane.tsx +3 -2
- package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +4 -2
- package/src/plugins/builtin/portfolio-list/cli/period-report.ts +61 -11
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +11 -3
- package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +2 -0
- package/src/plugins/builtin/portfolio-list/header.tsx +2 -2
- package/src/plugins/builtin/portfolio-list/headless.ts +33 -6
- package/src/plugins/builtin/portfolio-list/index.tsx +3 -2
- package/src/plugins/builtin/portfolio-list/pane/futures-terms.ts +4 -2
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +5 -3
- package/src/plugins/builtin/portfolio-list/pane/period-pnl.ts +26 -7
- package/src/plugins/builtin/portfolio-list/pane/purchase-date-fx.ts +4 -2
- package/src/plugins/builtin/portfolio-list/period-pnl.ts +16 -1
- package/src/plugins/builtin/portfolio-list/quick-add/index.tsx +2 -2
- package/src/plugins/builtin/portfolio-list/settings.ts +4 -1
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +8 -5
- package/src/plugins/builtin/portfolio-list/summary/totals.ts +6 -4
- package/src/plugins/builtin/portfolio-list/table.tsx +25 -15
- package/src/plugins/builtin/power/detail.tsx +6 -5
- package/src/plugins/builtin/power/gas-model.ts +8 -7
- package/src/plugins/builtin/power/gas.tsx +2 -1
- package/src/plugins/builtin/power/headless.ts +7 -6
- package/src/plugins/builtin/power/model.ts +3 -2
- package/src/plugins/builtin/power/prices-headless.ts +10 -9
- package/src/plugins/builtin/power/prices-model.ts +3 -2
- package/src/plugins/builtin/power/prices.tsx +2 -1
- package/src/plugins/builtin/primary-dealers/model.ts +3 -3
- package/src/plugins/builtin/primary-dealers/pane.tsx +2 -2
- package/src/plugins/builtin/rate-path/headless.ts +8 -7
- package/src/plugins/builtin/rate-path/model.ts +6 -5
- package/src/plugins/builtin/rate-path/pane.tsx +6 -5
- package/src/plugins/builtin/realized-vol/fx-proxy.ts +2 -1
- package/src/plugins/builtin/realized-vol/headless.ts +11 -10
- package/src/plugins/builtin/realized-vol/pane.tsx +5 -4
- package/src/plugins/builtin/relative-rotation/headless.ts +2 -1
- package/src/plugins/builtin/relative-rotation/pane.tsx +6 -6
- package/src/plugins/builtin/research/analyst-headless.ts +5 -5
- package/src/plugins/builtin/research/analyst-model.ts +7 -7
- package/src/plugins/builtin/research/analyst-pane.tsx +7 -7
- package/src/plugins/builtin/research/client.ts +14 -0
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +40 -30
- package/src/plugins/builtin/research/event-model.ts +55 -22
- package/src/plugins/builtin/research/event-sources.ts +26 -8
- package/src/plugins/builtin/research/relative-valuation-columns.ts +20 -12
- package/src/plugins/builtin/research/relative-valuation-currency.ts +16 -0
- package/src/plugins/builtin/research/relative-valuation-headless.ts +33 -21
- package/src/plugins/builtin/research/relative-valuation-model.ts +31 -17
- package/src/plugins/builtin/research/relative-valuation-pane.tsx +29 -14
- package/src/plugins/builtin/research-search/model.ts +2 -1
- package/src/plugins/builtin/research-search/saved-view.tsx +4 -3
- package/src/plugins/builtin/revenue-breakdown/model.ts +4 -4
- package/src/plugins/builtin/reverse-dcf/headless.ts +7 -7
- package/src/plugins/builtin/reverse-dcf/model.ts +4 -4
- package/src/plugins/builtin/reverse-dcf/pane.tsx +2 -2
- package/src/plugins/builtin/scanner/flow-model.ts +7 -4
- package/src/plugins/builtin/scanner/flow-pane.tsx +1 -1
- package/src/plugins/builtin/scanner/headless.ts +3 -2
- package/src/plugins/builtin/scanner/hilo-model.ts +2 -1
- package/src/plugins/builtin/scanner/live-headless.ts +2 -2
- package/src/plugins/builtin/scanner/live-model.ts +3 -2
- package/src/plugins/builtin/scanner/live-pane.tsx +5 -5
- package/src/plugins/builtin/seasonality/headless.ts +2 -1
- package/src/plugins/builtin/seasonality/pane.tsx +4 -3
- package/src/plugins/builtin/sec/filing-display.tsx +12 -15
- package/src/plugins/builtin/sec/fund-facts.ts +2 -2
- package/src/plugins/builtin/sec/headless.ts +2 -1
- package/src/plugins/builtin/sec/index.tsx +6 -2
- package/src/plugins/builtin/sectors/headless.ts +4 -4
- package/src/plugins/builtin/sectors/index.tsx +7 -7
- package/src/plugins/builtin/shared/cloud-upgrade.ts +4 -2
- package/src/plugins/builtin/shared/cpi-year-gap.ts +67 -0
- package/src/plugins/builtin/shared/earnings-calendar.ts +90 -6
- package/src/plugins/builtin/shared/earnings-report.ts +13 -6
- package/src/plugins/builtin/shared/research-cells.tsx +2 -2
- package/src/plugins/builtin/shared/source-footer.ts +2 -1
- package/src/plugins/builtin/shared/trend.ts +2 -2
- package/src/plugins/builtin/shared/use-quote-board.ts +9 -8
- package/src/plugins/builtin/short-interest/headless.ts +6 -6
- package/src/plugins/builtin/short-interest/model.ts +9 -9
- package/src/plugins/builtin/short-interest/publications-model.ts +5 -5
- package/src/plugins/builtin/short-interest/publications-pane.tsx +3 -2
- package/src/plugins/builtin/short-interest/watch-headless.ts +5 -5
- package/src/plugins/builtin/short-interest/watch-pane.tsx +6 -6
- package/src/plugins/builtin/short-volume/model.ts +5 -5
- package/src/plugins/builtin/short-volume/pane.tsx +4 -4
- package/src/plugins/builtin/social-mentions/headless.ts +2 -1
- package/src/plugins/builtin/social-mentions/model.ts +4 -4
- package/src/plugins/builtin/supply-chain/graph-model.ts +2 -1
- package/src/plugins/builtin/supply-chain/graph-pane.tsx +2 -2
- package/src/plugins/builtin/supply-chain/headless.ts +3 -2
- package/src/plugins/builtin/supply-chain/model.ts +4 -4
- package/src/plugins/builtin/supply-chain/pane.tsx +2 -2
- package/src/plugins/builtin/supply-chain/row-evidence.tsx +2 -1
- package/src/plugins/builtin/themes/headless.ts +2 -1
- package/src/plugins/builtin/themes/model.ts +3 -2
- package/src/plugins/builtin/themes/pane.tsx +3 -2
- package/src/plugins/builtin/thirteenf/format.ts +9 -9
- package/src/plugins/builtin/thirteenf/headless.ts +3 -2
- package/src/plugins/builtin/thirteenf/model.ts +2 -1
- package/src/plugins/builtin/thirteenf/overlap-pane.tsx +2 -1
- package/src/plugins/builtin/thirteenf/pane.tsx +5 -4
- package/src/plugins/builtin/thirteenf/report-notes.ts +2 -1
- package/src/plugins/builtin/thirteenf/signals-pane.tsx +3 -2
- package/src/plugins/builtin/thirteenf/table.ts +6 -5
- package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +45 -2
- package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +4 -3
- package/src/plugins/builtin/ticker-detail/data-panes/historical-prices.tsx +4 -4
- package/src/plugins/builtin/ticker-detail/data-panes/returns-pane.tsx +3 -3
- package/src/plugins/builtin/ticker-detail/financials/model.ts +83 -35
- package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +3 -1
- package/src/plugins/builtin/ticker-detail/financials/ratios.ts +2 -2
- package/src/plugins/builtin/ticker-detail/financials/schema.ts +14 -18
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +8 -13
- package/src/plugins/builtin/ticker-detail/headless.ts +33 -6
- package/src/plugins/builtin/ticker-detail/overview/chart-scale.ts +52 -0
- package/src/plugins/builtin/ticker-detail/overview/components.tsx +8 -9
- package/src/plugins/builtin/ticker-detail/overview/model.ts +28 -14
- package/src/plugins/builtin/ticker-detail/overview/pane.tsx +6 -0
- package/src/plugins/builtin/ticker-detail/overview/tax-equivalent.ts +2 -1
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +43 -9
- package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +7 -5
- package/src/plugins/builtin/ticker-detail/quote-monitor/rows.ts +4 -4
- package/src/plugins/builtin/ticker-detail/settings.ts +17 -0
- package/src/plugins/builtin/time-sales/headless.ts +3 -2
- package/src/plugins/builtin/time-sales/model.ts +7 -5
- package/src/plugins/builtin/time-sales/pane.tsx +7 -6
- package/src/plugins/builtin/trace-bonds/model.ts +3 -2
- package/src/plugins/builtin/trace-bonds/pane.tsx +3 -2
- package/src/plugins/builtin/treasury-auctions/client.ts +2 -1
- package/src/plugins/builtin/treasury-auctions/headless.ts +6 -6
- package/src/plugins/builtin/treasury-auctions/hk-headless.ts +3 -2
- package/src/plugins/builtin/treasury-auctions/hk-view.tsx +10 -9
- package/src/plugins/builtin/treasury-auctions/hk.ts +5 -5
- package/src/plugins/builtin/treasury-auctions/model.ts +4 -4
- package/src/plugins/builtin/treasury-auctions/pane.tsx +18 -18
- package/src/plugins/builtin/treasury-auctions/treasury-direct.ts +2 -1
- package/src/plugins/builtin/treasury-daily/model.ts +2 -2
- package/src/plugins/builtin/vol-surface/events.ts +5 -4
- package/src/plugins/builtin/vol-surface/headless.ts +19 -18
- package/src/plugins/builtin/vol-surface/heat-grid.tsx +2 -1
- package/src/plugins/builtin/vol-surface/pane.tsx +8 -7
- package/src/plugins/builtin/vol-surface/stored.ts +2 -1
- package/src/plugins/builtin/vol-surface/tables.ts +4 -3
- package/src/plugins/builtin/volatility/headless.ts +5 -4
- package/src/plugins/builtin/volatility/pane.tsx +6 -6
- package/src/plugins/builtin/world-indices/headless.ts +7 -7
- package/src/plugins/builtin/world-indices/index.tsx +3 -1
- package/src/plugins/builtin/world-venue-map/headless.ts +2 -1
- package/src/plugins/builtin/world-venue-map/layered-pane.tsx +2 -1
- package/src/plugins/builtin/world-venue-map/layers.ts +3 -2
- package/src/plugins/builtin/world-venue-map/use-geo.ts +4 -2
- package/src/plugins/builtin/yield-curve/curves.ts +3 -3
- package/src/plugins/builtin/yield-curve/headless.ts +7 -6
- package/src/plugins/builtin/yield-curve/index.tsx +5 -4
- package/src/plugins/builtin/yield-curve/swaps.tsx +2 -1
- package/src/portfolio/allocation.ts +5 -5
- package/src/portfolio/collection-name.ts +2 -1
- package/src/portfolio/column-values.ts +61 -45
- package/src/portfolio/futures-positions.ts +2 -1
- package/src/portfolio/listed-symbol.ts +4 -2
- package/src/portfolio/period-pnl.ts +51 -1
- package/src/renderers/dom/dialog-host.tsx +5 -5
- package/src/renderers/electrobun/bun/desktop/backend-requests.ts +7 -1
- package/src/renderers/electrobun/view/remote/capability-invoker.ts +1 -1
- package/src/renderers/opentui/dialog-host.tsx +3 -4
- package/src/renderers/opentui/ui-host.tsx +32 -2
- package/src/renderers/share/layout-view.tsx +2 -1
- package/src/sources/gloomberb-cloud/news.ts +9 -0
- package/src/sources/gloomberb-cloud/normalizers.ts +7 -0
- package/src/sources/provider-router/history.ts +5 -2
- package/src/sources/provider-router/search.ts +15 -10
- package/src/state/hooks/inline-tickers.ts +3 -2
- package/src/state/hooks/quote-streaming.ts +9 -10
- package/src/team/collections-sync.ts +8 -3
- package/src/telemetry/usage-counts.ts +26 -0
- package/src/test-support/plugin-persistence.ts +12 -0
- package/src/tickers/company-name-listing.ts +6 -5
- package/src/tickers/company-name.ts +36 -2
- package/src/tickers/instrument-coverage.ts +27 -0
- package/src/tickers/listing-venues.ts +26 -1
- package/src/tickers/renamed-listings.ts +2 -1
- package/src/tickers/search/home-listing.ts +38 -1
- package/src/tickers/search/index.ts +22 -2
- package/src/tickers/search/ranking.ts +21 -2
- package/src/tickers/starter-symbols.ts +7 -0
- package/src/time-series/base-series.ts +4 -0
- package/src/time-series/fundamentals/statement-fields.ts +11 -14
- package/src/time-series/history-acquisition.ts +1 -1
- package/src/time-series/log-scale.ts +9 -0
- package/src/time-series/reporting.ts +3 -3
- package/src/time-series/resolve.ts +6 -4
- package/src/time-series/transforms.ts +10 -5
- package/src/time-series/types.ts +5 -2
- package/src/types/config.ts +9 -0
- package/src/types/data-provider.ts +3 -2
- package/src/types/financials.ts +28 -0
- package/src/types/headless.ts +2 -0
- package/src/types/instrument.ts +6 -0
- package/src/types/plugin-panes.ts +1 -1
- package/src/types/plugin-reports.ts +8 -0
- package/src/ui/dialog-stack.ts +17 -0
- package/src/ui/dialog.tsx +6 -2
- package/src/utils/crypto-pair.ts +9 -0
- package/src/utils/datetime-format.ts +74 -33
- package/src/utils/exchanges.ts +13 -0
- package/src/utils/financial-statements.ts +98 -17
- package/src/utils/format.ts +4 -9
- package/src/utils/fundamentals.ts +38 -16
- package/src/utils/futures-generic.ts +14 -0
- package/src/utils/growth.ts +67 -0
- package/src/utils/keyboard.ts +6 -0
- package/src/utils/options.ts +1 -1
- package/src/utils/report-timing.ts +2 -2
- package/src/utils/served-rates.ts +45 -0
- package/src/utils/text-wrap.ts +84 -3
- package/src/utils/trailing-dividend.ts +13 -3
- package/src/utils/zoned-date-time.ts +47 -22
package/src/cli/listing-arg.ts
CHANGED
|
@@ -20,13 +20,14 @@ import {
|
|
|
20
20
|
findListingOfCompanyName, isCompanyNameInput, marksAnotherListing, readTerminalCodeArg, serviceMarkedListing, serviceMarkedOtherListing, type CompanyNameListing,
|
|
21
21
|
} from "../tickers/company-name-listing";
|
|
22
22
|
import { movedAwayChange, startTickerChangeLookup, type MovedTickerChange } from "../tickers/ticker-changes";
|
|
23
|
-
import { lineMayHaveMoved, listingChangeLine, loadListingFate, MovedSymbolError, SUCCESSOR_CHANGE_WAIT_MS, type ListingFate } from "../tickers/listing-fate";
|
|
23
|
+
import { isVenueAbroad, lineMayHaveMoved, listingChangeLine, loadListingFate, MovedSymbolError, SUCCESSOR_CHANGE_WAIT_MS, type ListingFate } from "../tickers/listing-fate";
|
|
24
24
|
import { quotedListingName } from "../tickers/listing-name";
|
|
25
25
|
import { withdrawalLabel } from "../market-data/quotes/delisting";
|
|
26
26
|
import { cliStyles } from "../utils/cli-output";
|
|
27
|
-
import { companyNameExtraWords, groupByCompany, namesDepositaryReceipt, sameCompany, sameListedName, shortCompanyName } from "../tickers/company-name";
|
|
27
|
+
import { companyLinesName, companyNameExtraWords, groupByCompany, namesDepositaryReceipt, sameCompany, sameCompanyName, sameListedName, shortCompanyName } from "../tickers/company-name";
|
|
28
28
|
import {
|
|
29
29
|
canonicalExchange,
|
|
30
|
+
displayTickerKey,
|
|
30
31
|
exchangeCodeVenues,
|
|
31
32
|
exchangeLabel,
|
|
32
33
|
exchangeName,
|
|
@@ -258,6 +259,45 @@ function tradesOn(symbol: string, venues: readonly ListingVenue[]): string {
|
|
|
258
259
|
return venues.length > 0 ? ` ${symbol} trades on: ${venues.map((venue) => venue.exchange).join(", ")}.` : "";
|
|
259
260
|
}
|
|
260
261
|
|
|
262
|
+
/** The companies a symbol's venues are asked about for their line on another venue: the first few, home lines first. */
|
|
263
|
+
const MAX_COMPANIES_ASKED = 4;
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* " Prudential plc trades on HKEX as 2378:HKEX." when a company that lists
|
|
267
|
+
* as `symbol` elsewhere has a line of its own on `exchange`: PRU on LSE is
|
|
268
|
+
* Prudential plc, whose Hong Kong line is 2378, and HSBC on NYSE is HSBC
|
|
269
|
+
* Holdings, whose is 0005. Each company is asked once, by one of its venues;
|
|
270
|
+
* empty when none has a line there or the service cannot say.
|
|
271
|
+
*/
|
|
272
|
+
async function companyLineOn(symbol: string, exchange: string, venues: readonly ListingVenue[], deps: ListingDeps): Promise<string> {
|
|
273
|
+
const { getIssuerListings } = deps.dataProvider;
|
|
274
|
+
if (!getIssuerListings) return "";
|
|
275
|
+
const byCompany = new Map<string, ListingVenue>();
|
|
276
|
+
for (const venue of [...venues].sort((a, b) => Number(!!b.home) - Number(!!a.home))) {
|
|
277
|
+
const company = venue.companyId ?? venue.name;
|
|
278
|
+
if (!byCompany.has(company)) byCompany.set(company, venue);
|
|
279
|
+
}
|
|
280
|
+
const asked = [...byCompany.values()].slice(0, MAX_COMPANIES_ASKED);
|
|
281
|
+
const issuers = await Promise.all(asked.map((venue) => Promise.resolve()
|
|
282
|
+
.then(() => getIssuerListings.call(deps.dataProvider, venue.symbol ?? symbol, venue.exchange))
|
|
283
|
+
.catch(logFailure("cli.listing-arg", "Read a company's listings failed", null))));
|
|
284
|
+
const lines = new Map<string, string>();
|
|
285
|
+
issuers.forEach((issuer, index) => {
|
|
286
|
+
const line = issuer?.listings.find((listing) => canonicalExchange(listing.exchange) === exchange);
|
|
287
|
+
if (!issuer || !line) return;
|
|
288
|
+
const key = parsePublicTickerKey(line.symbol).exchange ? displayTickerKey(line.symbol) : `${line.symbol}:${exchange}`;
|
|
289
|
+
// The name search writes the line asked about under, its home line first (Prudential plc), as ADR names it.
|
|
290
|
+
lines.set(key, `${companyLinesName(asked[index]!.name, issuer.name)} trades on ${exchange} as ${key}.`);
|
|
291
|
+
});
|
|
292
|
+
return [...lines.values()].map((line) => ` ${line}`).join("");
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/** "PRU does not trade on HKEX. Prudential plc trades on HKEX as 2378:HKEX. PRU trades on: LSE, NYSE." */
|
|
296
|
+
async function notTradedText(listing: Pick<ListingArg, "symbol" | "exchange">, venues: readonly ListingVenue[], deps: ListingDeps): Promise<string> {
|
|
297
|
+
const companyLine = await companyLineOn(listing.symbol, listing.exchange, venues, deps);
|
|
298
|
+
return `${listing.symbol} does not trade on ${listing.exchange}.${companyLine}${tradesOn(listing.symbol, venues)}`;
|
|
299
|
+
}
|
|
300
|
+
|
|
261
301
|
/** "Toronto Stock Exchange (TSX) or Tokyo Stock Exchange (JPX)". */
|
|
262
302
|
function venueChoices(venues: readonly string[]): string {
|
|
263
303
|
const labels = venues.map(exchangeLabel);
|
|
@@ -351,7 +391,7 @@ export async function notTradedMessage(
|
|
|
351
391
|
if (withdrawn) return withdrawnListingMessage(listing, withdrawn);
|
|
352
392
|
if (venues.length === 0 || venues.some((venue) => venue.exchange === listing.exchange)) return null;
|
|
353
393
|
if (await quotedOnVenue(listing, deps)) return null;
|
|
354
|
-
return
|
|
394
|
+
return notTradedText(listing, venues, deps);
|
|
355
395
|
}
|
|
356
396
|
|
|
357
397
|
/**
|
|
@@ -437,19 +477,61 @@ function namedByCode(symbol: string, venue: ListingVenue): boolean {
|
|
|
437
477
|
}
|
|
438
478
|
|
|
439
479
|
/**
|
|
440
|
-
*
|
|
441
|
-
*
|
|
480
|
+
* The companies whose lines the venues are, when the data service identifies
|
|
481
|
+
* any of them, each company's venues in search order. Venues with one id are
|
|
482
|
+
* one company, never two because each names it its own way (DHL Group AG on
|
|
483
|
+
* Xetra, Deutsche Post AG in Vienna). A venue with no id is a company's whose
|
|
484
|
+
* identified venue it is named like, or whose name that venue's company is
|
|
485
|
+
* known by besides (Deutsche Post AG, DHL Group's former name, on a line the
|
|
486
|
+
* service cannot link), else another company (BMW Industries on BSE beside
|
|
487
|
+
* Bayerische Motoren Werke on Xetra). A venue with no name, one that names its line by the code alone, and
|
|
488
|
+
* a receipt named like no company there are none. Null when no venue has an id.
|
|
489
|
+
*/
|
|
490
|
+
function identifiedCompanies(symbol: string, venues: readonly ListingVenue[]): ListingVenue[][] | null {
|
|
491
|
+
if (!venues.some((venue) => venue.companyId)) return null;
|
|
492
|
+
const groups: Array<{ id: string | null; venues: ListingVenue[] }> = [];
|
|
493
|
+
for (const venue of venues) {
|
|
494
|
+
if (!venue.companyId) continue;
|
|
495
|
+
const group = groups.find((entry) => entry.id === venue.companyId);
|
|
496
|
+
if (group) group.venues.push(venue);
|
|
497
|
+
else groups.push({ id: venue.companyId, venues: [venue] });
|
|
498
|
+
}
|
|
499
|
+
for (const venue of venues) {
|
|
500
|
+
if (venue.companyId || !venue.name.trim() || namedByCode(symbol, venue)) continue;
|
|
501
|
+
const named = (other: ListingVenue) => sameListedName(other.name, venue.name);
|
|
502
|
+
// Or named as the company is known besides: the former name the service sends on its rows (Deutsche Post AG).
|
|
503
|
+
const known = (other: ListingVenue) => (other.aliases ?? []).some((alias) => sameCompanyName(alias, venue.name));
|
|
504
|
+
const group = groups.find((entry) => entry.id && entry.venues.some((other) => !!other.companyId && (named(other) || known(other))))
|
|
505
|
+
?? groups.find((entry) => !entry.id && entry.venues.some(named));
|
|
506
|
+
if (group) group.venues.push(venue);
|
|
507
|
+
else if (!namesDepositaryReceipt(venue.name)) groups.push({ id: null, venues: [venue] });
|
|
508
|
+
}
|
|
509
|
+
const order = (venue: ListingVenue) => venues.indexOf(venue);
|
|
510
|
+
return groups.map((group) => group.venues.sort((left, right) => order(left) - order(right)))
|
|
511
|
+
.sort((left, right) => order(left[0]!) - order(right[0]!));
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* Whether the venues are several companies' lines: by the data service's
|
|
516
|
+
* company ids where it gives any (`identifiedCompanies`). Without ids, the
|
|
517
|
+
* names decide: a venue with no name is no other company, nor is one that
|
|
518
|
+
* names its line by the code alone.
|
|
442
519
|
*/
|
|
443
520
|
function listsSeveralCompanies(symbol: string, venues: readonly ListingVenue[]): boolean {
|
|
521
|
+
const identified = identifiedCompanies(symbol, venues);
|
|
522
|
+
if (identified) return identified.length > 1;
|
|
444
523
|
return groupByCompany(venues, (venue) => namedByCode(symbol, venue) ? "" : venue.name).length > 1;
|
|
445
524
|
}
|
|
446
525
|
|
|
447
526
|
/**
|
|
448
|
-
* The venue a bare code goes to: the
|
|
449
|
-
*
|
|
450
|
-
*
|
|
527
|
+
* The venue a bare code goes to: the line the data service marks as its
|
|
528
|
+
* company's home, else the first search lists with a real name, never one
|
|
529
|
+
* that names its line by the code alone when another names it, and NSE,
|
|
530
|
+
* India's main venue, before BSE whichever search listed first.
|
|
451
531
|
*/
|
|
452
532
|
function homeVenue(symbol: string, venues: readonly ListingVenue[]): ListingVenue | null {
|
|
533
|
+
const home = venues.find((venue) => venue.home && !venue.withdrawal);
|
|
534
|
+
if (home) return home;
|
|
453
535
|
const named = venues.filter((venue) => !namedByCode(symbol, venue));
|
|
454
536
|
const candidates = named.length ? named : venues;
|
|
455
537
|
const first = candidates[0] ?? null;
|
|
@@ -463,7 +545,10 @@ function homeVenue(symbol: string, venues: readonly ListingVenue[]): ListingVenu
|
|
|
463
545
|
* form of its fund's name), is left out rather than guessed at, and one
|
|
464
546
|
* fund's venues are one fund however each words it (`sameListedName`).
|
|
465
547
|
*/
|
|
466
|
-
function otherCompanies(venues: readonly ListingVenue[], company: string): ListingVenue[] {
|
|
548
|
+
function otherCompanies(symbol: string, venues: readonly ListingVenue[], company: string, chosen?: ListingVenue): ListingVenue[] {
|
|
549
|
+
// A line the data service identifies is told apart by its id, never by a name difference (`identifiedCompanies`).
|
|
550
|
+
const identified = chosen?.companyId ? identifiedCompanies(symbol, venues) : null;
|
|
551
|
+
if (identified) return identified.filter((group) => !group.includes(chosen!)).map((group) => group[0]!);
|
|
467
552
|
if (!company.trim()) return [];
|
|
468
553
|
const known = venues.filter((venue) => !namesDepositaryReceipt(venue.name) || sameListedName(venue.name, company));
|
|
469
554
|
return groupByCompany(known, (venue) => venue.name, sameListedName)
|
|
@@ -474,8 +559,12 @@ function otherCompanies(venues: readonly ListingVenue[], company: string): Listi
|
|
|
474
559
|
/**
|
|
475
560
|
* "CAR = Avis Budget Group, NASDAQ (different companies on XETRA, ASX)": the
|
|
476
561
|
* listing a bare symbol several companies list was read on, and where the
|
|
477
|
-
* others list it.
|
|
478
|
-
*
|
|
562
|
+
* others list it. A bare symbol the data service read on the largest
|
|
563
|
+
* company's home listing abroad says so, as "SXR8 -> XETRA" does, with each
|
|
564
|
+
* other company's line: "BMW -> XETRA (Bayerische Motoren Werke); also
|
|
565
|
+
* BMW:BSE, Bmw Industries". Null when no other company is known to list it,
|
|
566
|
+
* so a symbol that means one thing (XLK, and its receipt in Buenos Aires)
|
|
567
|
+
* says nothing.
|
|
479
568
|
*/
|
|
480
569
|
export function listingChoiceNote(
|
|
481
570
|
symbol: string,
|
|
@@ -485,15 +574,42 @@ export function listingChoiceNote(
|
|
|
485
574
|
if (!chosen.exchange) return null;
|
|
486
575
|
const chosenVenue = venues.find((venue) => venue.exchange === chosen.exchange);
|
|
487
576
|
const name = chosen.name?.trim() || chosenVenue?.name || "";
|
|
488
|
-
const
|
|
489
|
-
.filter((
|
|
577
|
+
const otherVenues = otherCompanies(symbol, venues, chosenVenue?.name || name, chosenVenue)
|
|
578
|
+
.filter((venue) => venue.exchange !== chosen.exchange);
|
|
579
|
+
const others = otherVenues.map((venue) => venue.exchange);
|
|
490
580
|
if (others.length === 0) return null;
|
|
491
581
|
const more = others.length - MAX_OTHER_LISTINGS;
|
|
582
|
+
if (isVenueAbroad(chosen.exchange)) {
|
|
583
|
+
const also = otherVenues.slice(0, MAX_OTHER_LISTINGS)
|
|
584
|
+
.map((venue) => `${venueKey(symbol, venue)}${venue.name ? `, ${shortCompanyName(venue.name)}` : ""}`).join("; ");
|
|
585
|
+
return `${symbol} -> ${chosen.exchange}${name ? ` (${shortCompanyName(name)})` : ""}; also ${also}${more > 0 ? ` and ${more} more: gloom search ${symbol}` : ""}`;
|
|
586
|
+
}
|
|
492
587
|
const named = `${others.slice(0, MAX_OTHER_LISTINGS).map(venueInProse).join(", ")}${more > 0 ? ` and ${more} more: gloom search ${symbol}` : ""}`;
|
|
493
588
|
const which = others.length === 1 ? "a different company" : "different companies";
|
|
494
589
|
return `${symbol} = ${name ? `${shortCompanyName(name)}, ` : ""}${exchangeName(chosen.exchange)} (${which} on ${named})`;
|
|
495
590
|
}
|
|
496
591
|
|
|
592
|
+
/**
|
|
593
|
+
* "CON = Concentra Group (NYSE); Continental AG is CON:XETRA": a bare symbol
|
|
594
|
+
* read on a US company while another company's main listing abroad (the line
|
|
595
|
+
* the data service marks as its home) carries the symbol too. Companies are
|
|
596
|
+
* told apart by the service's ids where both lines carry one, else by name.
|
|
597
|
+
* Null when no other company's main listing carries it.
|
|
598
|
+
*/
|
|
599
|
+
export function otherCompanyHomeNote(
|
|
600
|
+
symbol: string,
|
|
601
|
+
chosen: { exchange: string; name?: string | null },
|
|
602
|
+
venues: readonly ListingVenue[],
|
|
603
|
+
): string | null {
|
|
604
|
+
const chosenVenue = venues.find((venue) => venue.exchange === chosen.exchange);
|
|
605
|
+
const name = chosen.name?.trim() || chosenVenue?.name || "";
|
|
606
|
+
const id = chosenVenue?.companyId;
|
|
607
|
+
const home = venues.find((venue) => venue.home && !venue.withdrawal && !isUsListingExchange(venue.exchange)
|
|
608
|
+
&& (id && venue.companyId ? venue.companyId !== id : !!name && !sameListedName(venue.name, name)));
|
|
609
|
+
if (!home) return null;
|
|
610
|
+
return `${symbol} = ${name ? `${shortCompanyName(name)} ` : ""}(${chosen.exchange}); ${home.name} is ${venueKey(symbol, home)}`;
|
|
611
|
+
}
|
|
612
|
+
|
|
497
613
|
/** A venue as a sentence names it, in full: "the Warsaw Stock Exchange", "Xetra", "NASDAQ" (a name that is its code). */
|
|
498
614
|
function venueInProse(code: string): string {
|
|
499
615
|
const name = exchangeName(code);
|
|
@@ -570,18 +686,27 @@ export async function listingChoiceNotes(
|
|
|
570
686
|
if (listing.readFromName) return [...listingReadNotes(listing), ...coin];
|
|
571
687
|
if (!quote || UNLISTED_TYPES.has(quote.instrumentType?.trim().toUpperCase() ?? "")) return coin;
|
|
572
688
|
const exchange = canonicalExchange(quote.listingExchangeName || quote.exchangeName);
|
|
689
|
+
if (!exchange) return coin;
|
|
573
690
|
// A bare symbol read on a company's own US line (JPM on NYSE) is what it means: companies abroad sharing the
|
|
574
|
-
// letters are
|
|
575
|
-
|
|
691
|
+
// letters are named only when one has its main listing under them (CON, Continental AG's on Xetra), from the
|
|
692
|
+
// venues already asked for. A US receipt (SAN, Banco Santander's) may still be meant for another (Sanofi's SAN:EPA).
|
|
693
|
+
if (isUsListingExchange(exchange) && quote.isDepositaryReceipt !== true) {
|
|
694
|
+
const listed = venues ? await venues : [];
|
|
695
|
+
const other = otherCompanyHomeNote(listing.symbol, { exchange, name: quote.name }, listed);
|
|
696
|
+
return [...other ? [other] : [], ...coin];
|
|
697
|
+
}
|
|
576
698
|
const [listed, marked] = await Promise.all([
|
|
577
699
|
venues ?? loadBareVenues(listing, deps) ?? [],
|
|
578
700
|
// A primary listing the service names by the word, off the venue picked: NTT is NTT, Inc. (9432 on JPX), not Warsaw's NTT.
|
|
579
701
|
serviceMarkedOtherListing(deps.dataProvider, listing.symbol, exchange).catch(logFailure("cli.listing-arg", "Read the listing a word names failed", null)),
|
|
580
702
|
]);
|
|
581
703
|
const note = listingChoiceNote(listing.symbol, { exchange, name: quote.name }, listed);
|
|
582
|
-
const
|
|
704
|
+
const marking = marked ? `${marked.symbol}:${marked.exchange} ${marked.name}` : null;
|
|
583
705
|
const named = quote.name?.trim() ? `${shortCompanyName(quote.name)}, ` : "";
|
|
584
|
-
|
|
706
|
+
// A note that already lists others ("; also BMW:BSE, Bmw Industries") takes the marked listing among them.
|
|
707
|
+
const choice = !marking ? note
|
|
708
|
+
: note?.includes("; also ") ? `${note}; ${marking}`
|
|
709
|
+
: `${note ?? `${listing.symbol} = ${named}${exchangeName(exchange)}`}; also ${marking}`;
|
|
585
710
|
return [...choice ? [choice] : [], ...coin];
|
|
586
711
|
}
|
|
587
712
|
|
|
@@ -1496,13 +1621,18 @@ export async function resolveCliListing(
|
|
|
1496
1621
|
const read = await readTerminalCodeArg(deps.dataProvider, typed);
|
|
1497
1622
|
// A company's name, an entry of a comma list (`WHR, Whirlpool Corporation`), is the listing search names for it.
|
|
1498
1623
|
// A name before a legal form ("SAP SE", "SIEMENS AG") is looked up first: SE is also SIX Swiss's market code.
|
|
1499
|
-
const
|
|
1624
|
+
const legalForm = !!read && endsInLegalForm(typed);
|
|
1625
|
+
const asName = !read || legalForm ? await companyNameListingArg(raw, deps) : null;
|
|
1626
|
+
// Read both ways as two companies ("ZURN SE": Zurich Insurance on SIX, Zurn Elkay by name), the code's listing wins.
|
|
1627
|
+
const codeWins = legalForm && asName ? await codeOverCompanyName(read!, asName.found, deps) : null;
|
|
1628
|
+
const named = codeWins ? null : asName?.listing ?? null;
|
|
1500
1629
|
const terminal = named ? null : read;
|
|
1501
1630
|
// "AAPL GP" is written as a code, with a market code no venue answers to and no company's name: one entry, never AAPL and GP.
|
|
1502
1631
|
if (!terminal && !named) await refuseUnknownMarketCode(typed, deps);
|
|
1503
1632
|
// `BP.` is London's code for BP: its London line where London lists it, and `GE.` a US ticker with a stray dot.
|
|
1504
1633
|
const dotted = terminal || named || exchangeOption?.trim() ? null : readLondonDottedSymbol(typed);
|
|
1505
1634
|
let parsed = named ?? (dotted ? await londonDottedListing(dotted, deps) : parseListingArg(raw, exchangeOption, { ...options, terminalCode: terminal }));
|
|
1635
|
+
if (codeWins) parsed = { ...parsed, readAs: codeWins };
|
|
1506
1636
|
if (!parsed.symbol) throw new ListingArgError("Ticker symbol is required.");
|
|
1507
1637
|
// $VIX is Schwab's code for ^VIX, unless a security trades as VIX: $AAPL is a cashtag.
|
|
1508
1638
|
const index = named || parsed.exchange ? null : await readDollarIndexCode(raw, deps);
|
|
@@ -1560,6 +1690,33 @@ export async function resolveCliListing(
|
|
|
1560
1690
|
};
|
|
1561
1691
|
}
|
|
1562
1692
|
|
|
1693
|
+
/**
|
|
1694
|
+
* How a symbol and a market code read when the words are also a company's name
|
|
1695
|
+
* before its legal form, SE being both SIX Swiss's code and a European
|
|
1696
|
+
* company's form: "ZURN SE" is Zurich Insurance on SIX as a code and Zurn
|
|
1697
|
+
* Elkay Water Solutions as a name, "NOVN SE" Novartis and Novan, "SAP SE" SAP
|
|
1698
|
+
* either way. Two companies: the code names one listing on one venue, as a
|
|
1699
|
+
* desk typing a terminal's codes means it, so it wins, and the note names the
|
|
1700
|
+
* company the words would be ("Read "ZURN SE" as ZURN:SWX (Zurich Insurance
|
|
1701
|
+
* Group AG), not ZWS:NYSE (Zurn Elkay ...)"). One company, by the service's
|
|
1702
|
+
* company ids or by name: null, so the name reads the company's home listing
|
|
1703
|
+
* (SAP on Xetra, not its SIX line). Null too when the code's venue lists
|
|
1704
|
+
* nothing under the symbol.
|
|
1705
|
+
*/
|
|
1706
|
+
async function codeOverCompanyName(code: TerminalListingCode, found: CompanyNameListing, deps: ListingDeps): Promise<string | null> {
|
|
1707
|
+
if (!code.exchange) return null;
|
|
1708
|
+
const venues = await listingVenues(code.symbol, deps).catch(logFailure("cli.listing-arg", "Read a market code's listing failed", [] as ListingVenue[]));
|
|
1709
|
+
const line = venues.find((venue) => venue.exchange === code.exchange && venue.name.trim());
|
|
1710
|
+
if (!line) return null;
|
|
1711
|
+
const company = found.meant ?? found;
|
|
1712
|
+
const companyLine = company.symbol.toUpperCase() === code.symbol.toUpperCase()
|
|
1713
|
+
? venues.find((venue) => venue.exchange === company.exchange) : undefined;
|
|
1714
|
+
const ids = [line.companyId, companyLine?.companyId];
|
|
1715
|
+
if (ids[0] && ids[1] ? ids[0] === ids[1] : sameCompany(line.name, company.name)) return null;
|
|
1716
|
+
const key = company.exchange ? `${company.symbol}:${company.exchange}` : company.symbol;
|
|
1717
|
+
return `${terminalCodeReadAs(code).replace(/\.$/, "")} (${line.name.trim()}), not ${key} (${company.name.trim()}).`;
|
|
1718
|
+
}
|
|
1719
|
+
|
|
1563
1720
|
/** A US share class typed with a space for its mark: `BRK B`, `brk b`. */
|
|
1564
1721
|
const SPACED_SHARE_CLASS = /^([A-Za-z]{1,5})\s+([A-Za-z])$/;
|
|
1565
1722
|
/** A US share class typed with no mark at all, in capitals: `BRKB`, `BFB`. */
|
|
@@ -1672,7 +1829,7 @@ async function checkTerminalCodeVenue(listing: ListingArg, market: string, deps:
|
|
|
1672
1829
|
if (!hint && !isSearchOnlyVenue(listing.exchange)) return;
|
|
1673
1830
|
const venues = await listingVenues(listing.symbol, deps).catch(logFailure("cli.listing-arg", "Read listing venues failed", []));
|
|
1674
1831
|
if (venues.length === 0 || venues.some((venue) => venue.exchange === listing.exchange)) return;
|
|
1675
|
-
throw new ListingArgError(
|
|
1832
|
+
throw new ListingArgError(await notTradedText(listing, venues, deps), hint ?? undefined);
|
|
1676
1833
|
}
|
|
1677
1834
|
|
|
1678
1835
|
/**
|
|
@@ -1751,9 +1908,11 @@ const NAME_WRITTEN_WORD = /^(?=.*\p{Ll})\p{L}[\p{L}&'’-]*$/u;
|
|
|
1751
1908
|
/**
|
|
1752
1909
|
* Symbols at most whose venues a command looks up to name the company each
|
|
1753
1910
|
* bare one went to, and whose words it checks as companies' names
|
|
1754
|
-
* (`companyWord`, a quote each)
|
|
1911
|
+
* (`companyWord`, a quote each): a desk's morning list of a dozen names (the
|
|
1912
|
+
* DAX names it covers) still says which company each one read. A longer
|
|
1913
|
+
* list is a batch of tickers.
|
|
1755
1914
|
*/
|
|
1756
|
-
export const MAX_CHOICE_LOOKUPS =
|
|
1915
|
+
export const MAX_CHOICE_LOOKUPS = 12;
|
|
1757
1916
|
|
|
1758
1917
|
/** At most this many words typed apart are tried as one company's name (`joinCompanyNameWords`). */
|
|
1759
1918
|
const MAX_JOINED_NAME_WORDS = 4;
|
|
@@ -1871,9 +2030,10 @@ async function japaneseNameListing(
|
|
|
1871
2030
|
* symbol, and for a name search finds no listing for, which then fails as a
|
|
1872
2031
|
* symbol would.
|
|
1873
2032
|
*/
|
|
1874
|
-
async function companyNameListingArg(raw: string, deps: ListingDeps): Promise<ListingArg | null> {
|
|
2033
|
+
async function companyNameListingArg(raw: string, deps: ListingDeps): Promise<{ listing: ListingArg; found: CompanyNameListing } | null> {
|
|
1875
2034
|
const typed = stripStrayEdges(raw).text || raw;
|
|
1876
|
-
|
|
2035
|
+
const found = isCompanyNameInput(typed) ? await findCompanyName(typed, deps) : null;
|
|
2036
|
+
return found ? { listing: companyListingArg(typed, found), found } : null;
|
|
1877
2037
|
}
|
|
1878
2038
|
|
|
1879
2039
|
/** `Read "crude oil" as CL=F (WTI Crude Oil), the benchmark future; Brent is BZ=F.` */
|
|
@@ -2017,11 +2177,6 @@ function movedWithoutQuote(change: ListingFate["change"], name: string | null):
|
|
|
2017
2177
|
return moved && sameCompany(name, moved.issuer) ? moved : null;
|
|
2018
2178
|
}
|
|
2019
2179
|
|
|
2020
|
-
async function readCompanyName(typed: string, deps: Pick<ListingDeps, "dataProvider">, options: { oneWord?: boolean } = {}): Promise<ListingArg | null> {
|
|
2021
|
-
const found = await findCompanyName(typed, deps, options);
|
|
2022
|
-
return found ? companyListingArg(typed, found) : null;
|
|
2023
|
-
}
|
|
2024
|
-
|
|
2025
2180
|
function companyListingArg(typed: string, found: CompanyNameListing): ListingArg {
|
|
2026
2181
|
const key = found.exchange ? `${found.symbol}:${found.exchange}` : found.symbol;
|
|
2027
2182
|
// A fund or an index carrying the name asks about the company's stock: "Did you mean JPM (JPMorgan Chase & Co.)?".
|
package/src/cli/not-a-ticker.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { futuresContractByWord } from "../market-data/futures-board";
|
|
2
|
+
import { venueOfDatedContract } from "../utils/futures-generic";
|
|
2
3
|
import { notATickerSymbol } from "../sources/provider-errors";
|
|
3
4
|
import { renamedListingFor, renamedListingHint } from "../tickers/renamed-listings";
|
|
4
5
|
import { boardCoinFor } from "./board-coins";
|
|
@@ -58,6 +59,9 @@ export function withSearchHints(text: string, args: readonly string[], isFredSer
|
|
|
58
59
|
if (renamed) return `${sentence} ${renamedListingHint(renamed)}`;
|
|
59
60
|
const coin = boardCoinFor(id);
|
|
60
61
|
if (coin) return `${sentence} Did you mean ${coin.symbol}${coin.name && coin.name.toUpperCase() !== coin.symbol ? ` (${coin.name})` : ""}?`;
|
|
62
|
+
// A dated contract typed without its venue (ZQZ26) is quoted with it: ZQZ26.CBT, as WIRP prints it.
|
|
63
|
+
const contract = venueOfDatedContract(id);
|
|
64
|
+
if (contract) return `${sentence} Did you mean ${contract}?`;
|
|
61
65
|
const tenor = treasuryYieldTenor(typed);
|
|
62
66
|
// A currency's name (`yen`) is its rate and its pair, not a ticker search could find; a commodity's word
|
|
63
67
|
// (`oil`, `brent`) is its future, which no search for the word finds first.
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import type { TickerRecord } from "../../types/ticker";
|
|
1
2
|
import { logFailure } from "../../utils/log-failure";
|
|
3
|
+
import { shellWord } from "../../utils/shell-word";
|
|
2
4
|
import { commands as builtInCommands, getCommandPrefixes } from "../../components/command-bar/commands/registry";
|
|
3
5
|
import type { HeadlessPaneDefinition, PaneDef, PaneTemplateCreateOptions, PaneTemplateDef } from "../../types/plugin";
|
|
4
6
|
import type { MarketContext } from "../types";
|
|
@@ -287,18 +289,24 @@ function sampleArgForTemplate(template: PaneTemplateDef): string {
|
|
|
287
289
|
}
|
|
288
290
|
}
|
|
289
291
|
|
|
292
|
+
/**
|
|
293
|
+
* A template's catalog entry. Without a market context (a search from the app,
|
|
294
|
+
* `functionsForQuestion`) no instance is made to read its default settings
|
|
295
|
+
* from, and no example is given: only what the template itself says.
|
|
296
|
+
*/
|
|
290
297
|
async function buildTemplateCatalogEntry(
|
|
291
298
|
template: PaneTemplateDef,
|
|
292
299
|
pane: PaneDef,
|
|
293
|
-
context: MarketContext,
|
|
300
|
+
context: MarketContext | null,
|
|
294
301
|
token: string,
|
|
302
|
+
listName?: string | null,
|
|
295
303
|
): Promise<PaneCatalogEntry> {
|
|
296
304
|
const sampleArg = sampleArgForTemplate(template);
|
|
297
305
|
const createOptions: PaneTemplateCreateOptions | undefined = buildCreateOptions(template, sampleArg);
|
|
298
306
|
const primarySymbol = createOptions?.symbol ?? createOptions?.symbols?.[0] ?? null;
|
|
299
307
|
let defaultSettings: Record<string, unknown> = template.catalogSettings ?? {};
|
|
300
308
|
|
|
301
|
-
if (template.catalogSettings === undefined && template.createInstance) {
|
|
309
|
+
if (context && template.catalogSettings === undefined && template.createInstance) {
|
|
302
310
|
try {
|
|
303
311
|
const spec = await template.createInstance(buildTemplateContext(context, primarySymbol), createOptions);
|
|
304
312
|
defaultSettings = spec?.settings ?? {};
|
|
@@ -321,7 +329,7 @@ async function buildTemplateCatalogEntry(
|
|
|
321
329
|
aliases: [...(template.shortcut?.aliases ?? [])],
|
|
322
330
|
argKind: argument.kind,
|
|
323
331
|
argPlaceholder: argument.placeholder,
|
|
324
|
-
...argExamples(headless, context),
|
|
332
|
+
...context ? argExamples(headless, context, pane, listName) : null,
|
|
325
333
|
...(headless?.argument.kind === "tickers" && template.shortcut?.argKind === "ticker"
|
|
326
334
|
? { shotArgument: argumentHint({ argKind: "ticker", argPlaceholder: template.shortcut.argPlaceholder }) } : {}),
|
|
327
335
|
keywords: template.keywords ?? [],
|
|
@@ -332,18 +340,34 @@ async function buildTemplateCatalogEntry(
|
|
|
332
340
|
|
|
333
341
|
/**
|
|
334
342
|
* The arguments a function's examples show past its placeholder: its own, and
|
|
335
|
-
* for a list of more than two symbols, a
|
|
336
|
-
*
|
|
343
|
+
* for a list of more than two symbols, a list's name, which stands for its
|
|
344
|
+
* symbols: the reader's first watchlist or portfolio that holds any
|
|
345
|
+
* (`listName`), so the example runs as printed.
|
|
337
346
|
*/
|
|
338
|
-
function argExamples(
|
|
339
|
-
|
|
347
|
+
function argExamples(
|
|
348
|
+
headless: HeadlessPaneDefinition | undefined,
|
|
349
|
+
context: MarketContext,
|
|
350
|
+
pane?: PaneDef,
|
|
351
|
+
listName: string | null = context.config.watchlists[0]?.name ?? "Watchlist",
|
|
352
|
+
): { argExamples: readonly string[] } | null {
|
|
353
|
+
// A rendered view's own examples (VIEW's spec) stand where a headless model would give them.
|
|
354
|
+
const own = headless?.argument.examples ?? pane?.reportArgument?.examples ?? [];
|
|
340
355
|
const argument = headless?.argument;
|
|
341
356
|
const list = (argument?.kind === "symbol-list" || argument?.kind === "tickers") && (argument.maximum == null || argument.maximum > 2);
|
|
342
|
-
const
|
|
343
|
-
const examples = list ? [...own, /^[\w.-]+$/.test(name) ? name : `'${name.replace(/'/g, "'\\''")}'`] : own;
|
|
357
|
+
const examples = list && listName ? [...own, shellWord(listName)] : own;
|
|
344
358
|
return examples.length > 0 ? { argExamples: examples } : null;
|
|
345
359
|
}
|
|
346
360
|
|
|
361
|
+
/** The first watchlist, else portfolio, that holds a symbol: the list a function's example names. Null when none does. */
|
|
362
|
+
async function exampleListName(context: MarketContext): Promise<string | null> {
|
|
363
|
+
const tickers = await Promise.resolve().then(() => context.store.loadAllTickers())
|
|
364
|
+
.catch(logFailure("cli-catalog", "Read the lists for an example failed", [] as TickerRecord[]));
|
|
365
|
+
const watchlist = context.config.watchlists.find((list) => tickers.some((ticker) => ticker.metadata.watchlists.includes(list.id)));
|
|
366
|
+
const portfolio = watchlist ? null : context.config.portfolios.find((list) => tickers.some((ticker) => ticker.metadata.portfolios.includes(list.id)
|
|
367
|
+
|| ticker.metadata.positions.some((position) => position.portfolio === list.id && position.shares !== 0)));
|
|
368
|
+
return (watchlist ?? portfolio)?.name ?? null;
|
|
369
|
+
}
|
|
370
|
+
|
|
347
371
|
/**
|
|
348
372
|
* The functions `gloom catalog` and search list. An unlisted one (`listed:
|
|
349
373
|
* false`) is left out, and its pane is not listed in its place; `unlisted`
|
|
@@ -353,10 +377,12 @@ function argExamples(headless: HeadlessPaneDefinition | undefined, context: Mark
|
|
|
353
377
|
*/
|
|
354
378
|
export async function buildPaneCatalogEntries(
|
|
355
379
|
registry: PaneFunctionCatalog,
|
|
356
|
-
context: MarketContext,
|
|
380
|
+
context: MarketContext | null,
|
|
357
381
|
{ unlisted = false, appPanes = false }: { unlisted?: boolean; appPanes?: boolean } = {},
|
|
358
382
|
): Promise<PaneCatalogEntry[]> {
|
|
359
383
|
const entries: PaneCatalogEntry[] = [];
|
|
384
|
+
// Read once, when an example first needs it.
|
|
385
|
+
let listName: Promise<string | null> | undefined;
|
|
360
386
|
const templatedPaneIds = new Set<string>();
|
|
361
387
|
const codedPaneIds = new Set([...registry.paneTemplates.values()]
|
|
362
388
|
.filter((template) => template.shortcut?.prefix && template.listed !== false)
|
|
@@ -371,7 +397,8 @@ export async function buildPaneCatalogEntries(
|
|
|
371
397
|
if (!forUsers && !unlisted && !appPanes) continue;
|
|
372
398
|
// A template only the UI audits list keeps the id an older catalog listed it by, so a base and a head picture it under one name.
|
|
373
399
|
const token = forUsers || unlisted ? paneFunctionCode(template, pane, registry) : template.id;
|
|
374
|
-
|
|
400
|
+
listName ??= context ? exampleListName(context) : Promise.resolve(null);
|
|
401
|
+
entries.push(await buildTemplateCatalogEntry(template, pane, context, token, await listName));
|
|
375
402
|
}
|
|
376
403
|
|
|
377
404
|
for (const pane of registry.panes.values()) {
|
|
@@ -388,7 +415,7 @@ export async function buildPaneCatalogEntries(
|
|
|
388
415
|
aliases,
|
|
389
416
|
argKind: argument.kind,
|
|
390
417
|
argPlaceholder: argument.placeholder,
|
|
391
|
-
...argExamples(pane.headless, context),
|
|
418
|
+
...context ? argExamples(pane.headless, context, pane, await (listName ??= exampleListName(context))) : null,
|
|
392
419
|
keywords: [],
|
|
393
420
|
defaultSettings: {},
|
|
394
421
|
capability: getPaneFunctionCapability(undefined, pane),
|
|
@@ -727,6 +754,48 @@ export async function suggestPaneFunctions(
|
|
|
727
754
|
return loose ? [] : shown;
|
|
728
755
|
}
|
|
729
756
|
|
|
757
|
+
/**
|
|
758
|
+
* Words a question asks with, which name nothing a function covers: "what did the DAX do yesterday" asks about the
|
|
759
|
+
* DAX, and "do" alone found DOE and DOCS.
|
|
760
|
+
*/
|
|
761
|
+
const QUESTION_WORDS = new Set([
|
|
762
|
+
"what", "whats", "what's", "which", "who", "why", "when", "where", "how", "much", "many", "did", "does", "do", "done", "is", "are", "was",
|
|
763
|
+
"were", "will", "would", "could", "should", "can", "has", "have", "had", "been", "be", "me", "my", "i", "we", "you", "it", "its", "it's",
|
|
764
|
+
"this", "that", "these", "those", "there", "show", "tell", "give", "get", "about", "today", "yesterday", "tonight", "now", "last",
|
|
765
|
+
"latest", "current", "currently", "doing", "happen", "happened", "going", "go", "went", "please", "the", "a", "an", "of", "on", "in",
|
|
766
|
+
"for", "to", "and", "or", "at", "by", "with", "from", "up", "down",
|
|
767
|
+
]);
|
|
768
|
+
|
|
769
|
+
/** A question's topic: its words without the ones it asks with ("dax" for "what did the DAX do yesterday?"); empty when it is all asking. */
|
|
770
|
+
function questionTopic(question: string): string {
|
|
771
|
+
return question.toLowerCase().replace(/[?!.,;:"]/g, " ").split(/\s+/).filter((word) => word && !QUESTION_WORDS.has(word)).join(" ");
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
/** A function a question names, as ASKG offers it signed out. */
|
|
775
|
+
export interface FunctionForQuestion {
|
|
776
|
+
code: string;
|
|
777
|
+
label: string;
|
|
778
|
+
/** `gloom fn WEI`, `gloom fn CMP <tickers>`: the command that runs it. */
|
|
779
|
+
command: string;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
/**
|
|
783
|
+
* The functions `catalog` finds for a question's topic, best first, up to
|
|
784
|
+
* `limit`: what Ask Gloom offers without an account ("what did the DAX do
|
|
785
|
+
* yesterday" finds WEI and CMP). Built from the templates alone, without a
|
|
786
|
+
* market context, so the app's pane asks it as the command line does.
|
|
787
|
+
*/
|
|
788
|
+
export async function functionsForQuestion(registry: PaneFunctionCatalog, question: string, limit = 3): Promise<FunctionForQuestion[]> {
|
|
789
|
+
const topic = questionTopic(question);
|
|
790
|
+
if (!topic) return [];
|
|
791
|
+
const entries = await buildPaneCatalogEntries(registry, null);
|
|
792
|
+
const { shown } = selectPaneCatalogMatches(filterPaneCatalogEntries(entries, topic), topic, limit);
|
|
793
|
+
return shown.map((entry) => {
|
|
794
|
+
const argument = argumentHint(entry);
|
|
795
|
+
return { code: entry.token, label: entry.label, command: `gloom fn ${entry.token}${argument ? ` ${argument}` : ""}` };
|
|
796
|
+
});
|
|
797
|
+
}
|
|
798
|
+
|
|
730
799
|
const CATALOG_TEXT_WIDTH = 100;
|
|
731
800
|
const READINESS_LABELS: Record<PaneFunctionReadiness, string> = {
|
|
732
801
|
ready: "ready",
|
|
@@ -4,6 +4,7 @@ import { formatUtcTime, parseReportTime } from "../../utils/utc-time";
|
|
|
4
4
|
import type { MarketContext } from "../types";
|
|
5
5
|
import type { PaneFunctionReport } from "./report";
|
|
6
6
|
import type { ResolvedPaneFunction } from "./resolver";
|
|
7
|
+
import { functionsForQuestion, type PaneFunctionCatalog } from "./catalog";
|
|
7
8
|
import { collectShotSymbols } from "./data";
|
|
8
9
|
import { lockNoteLines } from "./lock-note";
|
|
9
10
|
import { createHeadlessPaneContext } from "./headless";
|
|
@@ -437,12 +438,17 @@ async function signedOutDomReport(
|
|
|
437
438
|
resolved: ResolvedPaneFunction,
|
|
438
439
|
context: MarketContext,
|
|
439
440
|
rawArg: string,
|
|
441
|
+
catalog?: PaneFunctionCatalog,
|
|
440
442
|
): Promise<PaneFunctionReport | null> {
|
|
441
443
|
if (!resolved.pane.signInWall || !resolved.pane.reportLockNote || resolvePersistedCloudSessionToken(context)) return null;
|
|
442
444
|
const symbols = collectShotSymbols(resolved, rawArg);
|
|
445
|
+
const argument = rawArg.trim();
|
|
443
446
|
const note = await resolved.pane.reportLockNote({
|
|
444
447
|
gate: "sign-in", symbol: symbols[0] ?? null, token: resolved.token,
|
|
445
448
|
context: createHeadlessPaneContext(resolved, context, new AbortController().signal),
|
|
449
|
+
// A question asked behind the wall (ASKG) is offered the functions the catalog finds for it.
|
|
450
|
+
...argument ? { argument } : {},
|
|
451
|
+
...catalog ? { functionsFor: (question: string, limit: number) => functionsForQuestion(catalog, question, limit) } : {},
|
|
446
452
|
});
|
|
447
453
|
const reason = lockNoteReason(note);
|
|
448
454
|
return {
|
|
@@ -473,8 +479,9 @@ export async function buildDomFunctionReport(
|
|
|
473
479
|
resolved: ResolvedPaneFunction,
|
|
474
480
|
context: MarketContext,
|
|
475
481
|
rawArg: string,
|
|
482
|
+
catalog?: PaneFunctionCatalog,
|
|
476
483
|
): Promise<PaneFunctionReport> {
|
|
477
|
-
const signedOut = await signedOutDomReport(resolved, context, rawArg);
|
|
484
|
+
const signedOut = await signedOutDomReport(resolved, context, rawArg, catalog);
|
|
478
485
|
if (signedOut) return signedOut;
|
|
479
486
|
let result: PaneScreenshotResult;
|
|
480
487
|
try {
|
|
@@ -1029,7 +1029,7 @@ function reopenText(market: ReportMarket, now: number, local: boolean, short: bo
|
|
|
1029
1029
|
const utc = `${day}${iso.slice(11, 16)} UTC`;
|
|
1030
1030
|
const reader = local ? localTimeSuffix(at) : "";
|
|
1031
1031
|
const zone = market.reopensTimeZone;
|
|
1032
|
-
const label = zone ? timeZoneLabel(zone) : null;
|
|
1032
|
+
const label = zone ? timeZoneLabel(zone, at) : null;
|
|
1033
1033
|
if (short || !zone || label === "UTC") return `${utc}${reader}`;
|
|
1034
1034
|
const venue = zonedDateTimeParts(at, zone);
|
|
1035
1035
|
const venueDay = `${venue.year}-${twoDigits(venue.month)}-${twoDigits(venue.day)}`;
|
|
@@ -1099,7 +1099,7 @@ function marketsText(markets: readonly VenueMarket[], now: number, short: boolea
|
|
|
1099
1099
|
const opensAt = (market: VenueMarket) => market.reopensAt ? Date.parse(market.reopensAt) : Number.POSITIVE_INFINITY;
|
|
1100
1100
|
const rank = (market: VenueMarket) => market.state === "open" ? 0 : market.state === "closed" ? 2 : 1;
|
|
1101
1101
|
const ordered = [...markets].sort((left, right) => rank(left) - rank(right) || opensAt(left) - opensAt(right));
|
|
1102
|
-
// `LSE opens 08:00 UTC, 08:00
|
|
1102
|
+
// `LSE opens 08:00 UTC, 08:00 GMT · US 13:30 UTC, 09:30 ET`: a verb is said once for the opens that follow
|
|
1103
1103
|
// each other with it; a week's first trade after a session's open says its own (`reopens 22:00 UTC`).
|
|
1104
1104
|
let previousVerb: string | null = null;
|
|
1105
1105
|
const parts = ordered.map((market) => {
|