@gloom-sh/terminal 0.20.17 → 0.20.19
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 +3 -1
- package/src/account/auth-dialog.tsx +19 -1
- package/src/account/billing.ts +2 -1
- package/src/account/heard-from-question.tsx +235 -0
- package/src/account/heard-from.ts +97 -0
- package/src/api-client/cot.ts +5 -6
- package/src/api-client/data.ts +14 -3
- package/src/api-client/heard-from.ts +72 -0
- package/src/api-client/index.ts +64 -6
- package/src/api-client/mna.ts +18 -0
- package/src/api-client/request.ts +162 -40
- package/src/api-client/supply-chain.ts +9 -0
- package/src/api-client/types/billing.ts +35 -1
- package/src/api-client/types/news.ts +45 -0
- package/src/api-client/types/world-venues.ts +9 -0
- package/src/app/global-shortcuts.ts +5 -3
- package/src/app/pro-welcome/keys.ts +27 -0
- package/src/app/pro-welcome/model.ts +158 -0
- package/src/app/pro-welcome/row.tsx +176 -0
- package/src/app/pro-welcome/use-pro-welcome.ts +156 -0
- package/src/app/runtime/external-profile-changes.ts +135 -0
- package/src/app.tsx +37 -4
- package/src/architecture/core-builtin-allowlist.json +1 -1
- package/src/architecture/floating-promise-allowlist.json +1 -2
- package/src/architecture/shortcut-labels-allowlist.json +1 -0
- package/src/cli/alert-listing.ts +98 -0
- package/src/cli/commands/market.ts +191 -39
- package/src/cli/commands/overview.ts +7 -1
- package/src/cli/commands/plugins.ts +3 -2
- package/src/cli/commands/search.ts +30 -6
- package/src/cli/commands/ticker.ts +13 -6
- package/src/cli/context.ts +24 -5
- package/src/cli/csv-export.ts +2 -1
- package/src/cli/desktop-pane-shot-browser.ts +3 -1
- package/src/cli/desktop-pane-shot-view.ts +0 -1
- package/src/cli/desktop-pane-shot.ts +276 -52
- package/src/cli/errors.ts +3 -9
- package/src/cli/exit-codes.ts +1 -1
- package/src/cli/glossary.ts +65 -11
- package/src/cli/help.ts +1 -1
- package/src/cli/history-demergers.ts +117 -0
- package/src/cli/history-rows.ts +8 -4
- package/src/cli/index.ts +2 -1
- package/src/cli/known-gaps.ts +16 -0
- package/src/cli/known-us-stocks.ts +18 -0
- package/src/cli/listing-arg.ts +192 -38
- package/src/cli/pane-functions/catalog-snapshot-build.ts +83 -0
- package/src/cli/pane-functions/catalog-snapshot.json +877 -0
- package/src/cli/pane-functions/catalog-snapshot.ts +62 -0
- package/src/cli/pane-functions/catalog.ts +50 -16
- package/src/cli/pane-functions/data.ts +16 -4
- package/src/cli/pane-functions/dom.ts +54 -8
- package/src/cli/pane-functions/freshness.ts +39 -4
- package/src/cli/pane-functions/function-help.ts +3 -3
- package/src/cli/pane-functions/headless.ts +9 -1
- package/src/cli/pane-functions/index.ts +175 -50
- package/src/cli/pane-functions/report-notices.ts +10 -0
- package/src/cli/pane-functions/resolver.ts +11 -7
- package/src/cli/pane-functions/screenshot-assessment.ts +38 -10
- package/src/cli/pane-functions/screenshot-data-evidence.ts +7 -15
- package/src/cli/pane-functions/screenshot-payload.ts +36 -1
- package/src/cli/pane-functions/screenshot-render.ts +24 -9
- package/src/cli/pane-functions/screenshot-types.ts +9 -0
- package/src/cli/quote-answer.ts +33 -17
- package/src/cli/registry.ts +22 -2
- package/src/cli/result.ts +22 -4
- package/src/cli/scroll-truncation.ts +7 -2
- package/src/cli/series-search.ts +45 -6
- package/src/cli/shot-temp-dir.ts +4 -9
- package/src/cli/ticker-resolution.ts +1 -1
- package/src/cli/unreachable.ts +21 -0
- package/src/components/chart/composite/drawing-store.ts +11 -7
- package/src/components/chart/composite/format.ts +1 -0
- package/src/components/chart/composite/legend.tsx +48 -20
- package/src/components/chart/composite/panel-surface/panel-cursor.tsx +3 -3
- package/src/components/chart/composite/panel-surface/plot-gestures.ts +9 -2
- package/src/components/chart/composite/panel-surface.tsx +1 -1
- package/src/components/chart/composite/price-axis-labels.tsx +7 -5
- package/src/components/chart/composite/tools.ts +164 -39
- package/src/components/chart-table/header.tsx +11 -2
- package/src/components/chart-table/layout.ts +16 -17
- package/src/components/command-bar/pane-templates/items.ts +17 -1
- package/src/components/command-bar/routes/root/provider-search.ts +10 -1
- package/src/components/command-bar/routes/root/results.ts +34 -2
- package/src/components/command-bar/routes/root/runtime.ts +19 -4
- package/src/components/command-bar/routes/ticker-search/results.ts +5 -0
- package/src/components/command-bar/routes/ticker-search/route.ts +5 -0
- package/src/components/command-bar/selection-runtime.ts +29 -5
- package/src/components/command-bar/surface/index.tsx +4 -1
- package/src/components/command-bar/workflow/alert.ts +32 -13
- package/src/components/data-table/view.tsx +15 -2
- package/src/components/form-modal/content.tsx +9 -4
- package/src/components/index.ts +1 -1
- package/src/components/layout/header.tsx +9 -5
- package/src/components/layout/pane/capture-status.ts +6 -0
- package/src/components/layout/pane/footer/index.tsx +2 -0
- package/src/components/layout/pane/footer/model.ts +123 -17
- package/src/components/layout/pane/header.tsx +16 -2
- package/src/components/layout/pane/status-footer.ts +24 -0
- package/src/components/market-board/index.tsx +4 -2
- package/src/components/onboarding/onboarding-frame.tsx +6 -2
- package/src/components/onboarding/onboarding-keyboard.ts +7 -1
- package/src/components/onboarding/onboarding-wizard.tsx +3 -1
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +24 -15
- package/src/components/onboarding/setup-cards.ts +36 -0
- package/src/components/onboarding/use-onboarding-progress.ts +22 -1
- package/src/components/onboarding/wizard-account.ts +6 -1
- package/src/components/onboarding/wizard-model.ts +32 -6
- package/src/components/onboarding/wizard-positions.ts +1 -1
- package/src/components/price-performance.tsx +26 -8
- package/src/components/reader/article-reader.tsx +12 -5
- package/src/components/sign-in-gate.tsx +3 -1
- package/src/components/toggle-list.tsx +6 -8
- package/src/components/ui/confirm-dialog.tsx +47 -7
- package/src/components/ui/data-table/opentui/index.tsx +7 -0
- package/src/components/ui/data-table/types.ts +8 -0
- package/src/components/ui/display.tsx +17 -2
- package/src/components/ui/index.ts +1 -1
- package/src/components/ui/stat-grid.tsx +4 -0
- package/src/components/ui/status.tsx +13 -1
- package/src/components/ui/table-layout.ts +34 -2
- package/src/components/use-pane-notice-footer.tsx +16 -3
- package/src/data/config/store/index.ts +31 -0
- package/src/data/config/store/node.ts +61 -11
- package/src/data/config/store/normalize.ts +4 -6
- package/src/data/config/store/shared-file.ts +309 -0
- package/src/data/profile-merge.ts +299 -0
- package/src/data/sqlite/checkpointer.ts +11 -1
- package/src/data/sqlite/database.ts +1 -1
- package/src/data/ticker-repository.ts +134 -10
- package/src/data/ticker-store.ts +67 -0
- package/src/data/ticker-writes.ts +5 -0
- package/src/i18n/es.ts +27 -0
- package/src/i18n/ja.ts +27 -0
- package/src/i18n/ko.ts +27 -0
- package/src/i18n/zh-cn.ts +27 -0
- package/src/i18n/zh-tw.ts +27 -0
- package/src/layout-marketplace/gallery-desktop.tsx +2 -2
- package/src/market-data/ah-pair.ts +122 -0
- package/src/market-data/coordinator/entries.ts +6 -4
- package/src/market-data/coordinator/index.ts +14 -3
- package/src/market-data/depositary-pair.ts +6 -2
- package/src/market-data/futures-board.ts +36 -29
- package/src/market-data/futures-contract.ts +37 -1
- package/src/market-data/hooks.tsx +33 -2
- package/src/market-data/market/change-basis.ts +11 -1
- package/src/market-data/market/header-market.ts +11 -0
- package/src/market-data/market/status.ts +40 -4
- package/src/market-data/performance.ts +127 -32
- package/src/market-data/quotes/time.ts +5 -2
- package/src/market-data/split-terms.ts +28 -0
- package/src/news/types.ts +28 -0
- package/src/notifications/app-badge.ts +2 -3
- package/src/notifications/app-notifier.ts +5 -0
- package/src/plugins/builtin/account-management/footer.ts +1 -1
- package/src/plugins/builtin/account-management/keyboard.ts +4 -0
- package/src/plugins/builtin/account-management/model.ts +1 -0
- package/src/plugins/builtin/account-management/pane.tsx +75 -7
- package/src/plugins/builtin/account-management/payment-recovery-row.tsx +12 -5
- package/src/plugins/builtin/account-management/pro-cancel.tsx +197 -0
- package/src/plugins/builtin/account-management/trial-cancel.ts +1 -1
- package/src/plugins/builtin/alerts/cli-move.ts +2 -2
- package/src/plugins/builtin/alerts/cli.ts +101 -48
- package/src/plugins/builtin/alerts/command.ts +39 -9
- package/src/plugins/builtin/alerts/constants.ts +10 -0
- package/src/plugins/builtin/alerts/earnings-listing.ts +20 -0
- package/src/plugins/builtin/alerts/event-rows.ts +9 -3
- package/src/plugins/builtin/alerts/events-pane.tsx +16 -10
- package/src/plugins/builtin/alerts/format.ts +24 -8
- package/src/plugins/builtin/alerts/headless.ts +12 -6
- package/src/plugins/builtin/alerts/index.tsx +97 -16
- package/src/plugins/builtin/alerts/move-checks.ts +7 -0
- package/src/plugins/builtin/alerts/option-contract.ts +197 -0
- package/src/plugins/builtin/alerts/pane.tsx +1 -1
- package/src/plugins/builtin/alerts/price.ts +30 -5
- package/src/plugins/builtin/alerts/pro-rules.ts +62 -0
- package/src/plugins/builtin/alerts/quotes.ts +26 -2
- package/src/plugins/builtin/alerts/research-builder.ts +5 -10
- package/src/plugins/builtin/alerts/scheduled.ts +6 -1
- package/src/plugins/builtin/alerts/types.ts +7 -0
- package/src/plugins/builtin/analytics/account-returns.ts +1 -1
- package/src/plugins/builtin/analytics/manual-value.ts +61 -0
- package/src/plugins/builtin/analytics/pane-model.ts +2 -2
- package/src/plugins/builtin/analytics/risk-book.ts +7 -7
- package/src/plugins/builtin/analytics/risk-client.ts +27 -14
- package/src/plugins/builtin/analytics/risk-headless.ts +13 -8
- package/src/plugins/builtin/analytics/risk-model.ts +92 -4
- package/src/plugins/builtin/analytics/risk-pane.tsx +85 -38
- package/src/plugins/builtin/awards/pane.tsx +1 -1
- package/src/plugins/builtin/broker-trading/orders.tsx +2 -2
- package/src/plugins/builtin/buildout/company/pane.tsx +4 -14
- package/src/plugins/builtin/catalysts/model.ts +2 -1
- package/src/plugins/builtin/central-bank-rates/model.ts +8 -2
- package/src/plugins/builtin/central-bank-rates/pane.tsx +5 -3
- package/src/plugins/builtin/chart-composer/chart-spec.ts +5 -0
- package/src/plugins/builtin/chart-composer/cli-options.ts +9 -5
- package/src/plugins/builtin/chart-composer/data-catalog-pane.tsx +2 -6
- package/src/plugins/builtin/chart-composer/headless-schema.ts +14 -10
- package/src/plugins/builtin/chart-composer/headless.ts +2 -0
- package/src/plugins/builtin/chart-composer/index.tsx +17 -5
- package/src/plugins/builtin/chart-composer/pane.tsx +19 -6
- package/src/plugins/builtin/chart-composer/viewport-labels.ts +2 -17
- package/src/plugins/builtin/chat/controller/notifications.ts +1 -0
- package/src/plugins/builtin/chat/index.tsx +0 -1
- package/src/plugins/builtin/cloud/auth-actions.tsx +11 -6
- package/src/plugins/builtin/cloud/company-picker.tsx +5 -3
- package/src/plugins/builtin/cloud/upgrade-command.ts +1 -1
- package/src/plugins/builtin/commodities-energy/index.tsx +1 -1
- package/src/plugins/builtin/company-kpis/headless.ts +10 -5
- package/src/plugins/builtin/company-kpis/latest.ts +45 -0
- package/src/plugins/builtin/company-kpis/model.ts +57 -15
- package/src/plugins/builtin/company-kpis/pane.tsx +22 -8
- package/src/plugins/builtin/composite/alt-data.ts +20 -0
- package/src/plugins/builtin/composite/application.ts +14 -0
- package/src/plugins/builtin/composite/broker.ts +12 -0
- package/src/plugins/builtin/composite/credit.ts +33 -0
- package/src/plugins/builtin/composite/crypto.ts +10 -0
- package/src/plugins/builtin/composite/earnings.ts +12 -0
- package/src/plugins/builtin/composite/filings.ts +13 -0
- package/src/plugins/builtin/composite/futures-commodities.ts +23 -0
- package/src/plugins/builtin/composite/global-markets.ts +12 -0
- package/src/plugins/builtin/composite/options-volatility.ts +23 -0
- package/src/plugins/builtin/composite/ownership.ts +23 -0
- package/src/plugins/builtin/composite/portfolio.ts +10 -0
- package/src/plugins/builtin/composite/quant.ts +15 -0
- package/src/plugins/builtin/composite/rates-macro.ts +30 -0
- package/src/plugins/builtin/composite/screeners.ts +11 -0
- package/src/plugins/builtin/composite/shared.ts +11 -0
- package/src/plugins/builtin/composite/ticker-core.ts +36 -0
- package/src/plugins/builtin/congress-trades/headless.ts +31 -3
- package/src/plugins/builtin/congress-trades/model.ts +9 -5
- package/src/plugins/builtin/correlation/index.tsx +13 -17
- package/src/plugins/builtin/correlation/matrix/model.ts +18 -0
- package/src/plugins/builtin/cot/client.ts +2 -3
- package/src/plugins/builtin/cot/headless.ts +16 -16
- package/src/plugins/builtin/cot/index.tsx +6 -6
- package/src/plugins/builtin/cot/model.ts +25 -5
- package/src/plugins/builtin/cot/pane.tsx +11 -6
- package/src/plugins/builtin/cot/series.ts +11 -8
- package/src/plugins/builtin/cpi/model.ts +15 -4
- package/src/plugins/builtin/cpi/pane.tsx +29 -7
- package/src/plugins/builtin/dividend-yield/client.ts +57 -16
- package/src/plugins/builtin/dividend-yield/headless.ts +17 -11
- package/src/plugins/builtin/dividend-yield/model.ts +4 -3
- package/src/plugins/builtin/dividend-yield/pane.tsx +22 -18
- package/src/plugins/builtin/dividend-yield/ranking.ts +1 -1
- package/src/plugins/builtin/dividend-yield/types.ts +4 -0
- package/src/plugins/builtin/dividend-yield/view.ts +23 -12
- package/src/plugins/builtin/doe/model.ts +30 -0
- package/src/plugins/builtin/doe/pane.tsx +8 -2
- package/src/plugins/builtin/earnings/board-table.ts +9 -4
- package/src/plugins/builtin/earnings/fiscal-quarter.ts +39 -0
- package/src/plugins/builtin/earnings/headless.ts +16 -6
- package/src/plugins/builtin/earnings/history-model.ts +6 -4
- package/src/plugins/builtin/earnings/history-table.ts +7 -4
- package/src/plugins/builtin/earnings-calls/calendar.tsx +4 -3
- package/src/plugins/builtin/earnings-calls/pane.tsx +8 -2
- package/src/plugins/builtin/earnings-ripple/pane.tsx +2 -2
- package/src/plugins/builtin/econ/calendar-model.ts +16 -0
- package/src/plugins/builtin/econ/index.tsx +7 -2
- package/src/plugins/builtin/equity-screener/headless.ts +4 -1
- package/src/plugins/builtin/equity-screener/model.ts +7 -6
- package/src/plugins/builtin/estimate-revisions/headless.ts +1 -1
- package/src/plugins/builtin/exposure/model.ts +10 -0
- package/src/plugins/builtin/exposure/pane.tsx +10 -3
- package/src/plugins/builtin/futures/model.ts +14 -1
- package/src/plugins/builtin/futures/series.ts +1 -8
- package/src/plugins/builtin/fx-matrix/amount.ts +15 -1
- package/src/plugins/builtin/fx-matrix/headless.ts +12 -6
- package/src/plugins/builtin/fx-matrix/index.tsx +25 -7
- package/src/plugins/builtin/fx-matrix/settings.ts +9 -4
- package/src/plugins/builtin/insider/detail.tsx +36 -7
- package/src/plugins/builtin/insider/filing-stories.ts +110 -0
- package/src/plugins/builtin/insider/headless.ts +37 -2
- package/src/plugins/builtin/insider/index.tsx +79 -10
- package/src/plugins/builtin/insider/model.ts +43 -5
- package/src/plugins/builtin/ipo-calendar/client.ts +11 -1
- package/src/plugins/builtin/ipo-calendar/model.ts +3 -7
- package/src/plugins/builtin/jobs/headless.ts +2 -1
- package/src/plugins/builtin/jobs/model.ts +6 -0
- package/src/plugins/builtin/jobs/pane.tsx +8 -3
- package/src/plugins/builtin/kelly-sizer/pane.tsx +9 -4
- package/src/plugins/builtin/market-valuation/pane.tsx +22 -10
- package/src/plugins/builtin/mna/detail.tsx +67 -6
- package/src/plugins/builtin/mna/headless.ts +128 -13
- package/src/plugins/builtin/mna/model.ts +219 -16
- package/src/plugins/builtin/mna/pane.tsx +34 -6
- package/src/plugins/builtin/money-markets/model.ts +14 -5
- package/src/plugins/builtin/money-markets/pane.tsx +4 -3
- package/src/plugins/builtin/news/wire/news/detail-view.tsx +118 -10
- package/src/plugins/builtin/news/wire/news/footer.ts +3 -8
- package/src/plugins/builtin/news/wire/news/story-evidence.ts +178 -0
- package/src/plugins/builtin/options/analytics.ts +1 -1
- package/src/plugins/builtin/options/view.tsx +18 -11
- package/src/plugins/builtin/options-positioning/model.ts +11 -0
- package/src/plugins/builtin/options-positioning/pane.tsx +22 -1
- package/src/plugins/builtin/options-scenario/client.ts +49 -8
- package/src/plugins/builtin/options-scenario/csp-screen-pane.tsx +22 -6
- package/src/plugins/builtin/options-scenario/csp-screen.ts +39 -12
- package/src/plugins/builtin/options-scenario/headless.ts +7 -3
- package/src/plugins/builtin/options-scenario/model.ts +33 -2
- package/src/plugins/builtin/options-scenario/pane.tsx +3 -4
- package/src/plugins/builtin/options-scenario/strategy-screen.ts +7 -5
- package/src/plugins/builtin/pe-band/client.ts +13 -1
- package/src/plugins/builtin/pe-band/headless.ts +2 -2
- package/src/plugins/builtin/pe-band/model.ts +63 -10
- package/src/plugins/builtin/pe-band/pane.tsx +5 -5
- package/src/plugins/builtin/perps/cascade.ts +4 -3
- package/src/plugins/builtin/perps/markets-section.tsx +5 -2
- package/src/plugins/builtin/perps/model.ts +4 -3
- package/src/plugins/builtin/portfolio-list/allocation-rows.ts +26 -7
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +66 -13
- package/src/plugins/builtin/portfolio-list/cli/render.ts +76 -33
- package/src/plugins/builtin/portfolio-list/headless.ts +69 -22
- package/src/plugins/builtin/portfolio-list/pane/data.ts +3 -3
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +29 -14
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +2 -2
- package/src/plugins/builtin/portfolio-list/table.tsx +3 -2
- package/src/plugins/builtin/relative-rotation/pane.tsx +2 -3
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +33 -14
- package/src/plugins/builtin/research/event-model.ts +43 -19
- package/src/plugins/builtin/research/headless.ts +8 -1
- package/src/plugins/builtin/research/relative-valuation-pane.tsx +19 -17
- package/src/plugins/builtin/research-search/index.tsx +3 -1
- package/src/plugins/builtin/scanner/denied.tsx +16 -4
- package/src/plugins/builtin/scanner/flow-pane.tsx +1 -1
- package/src/plugins/builtin/scanner/hilo-pane.tsx +1 -1
- package/src/plugins/builtin/sec/filing-display.tsx +14 -2
- package/src/plugins/builtin/sec/headless.ts +42 -4
- package/src/plugins/builtin/sec/index.tsx +21 -1
- package/src/plugins/builtin/sectors/index.tsx +6 -9
- package/src/plugins/builtin/sectors/sector-model.ts +1 -1
- package/src/plugins/builtin/shared/cloud-upgrade.ts +1 -1
- package/src/plugins/builtin/shared/earnings-report.ts +49 -5
- package/src/plugins/builtin/shared/options-pro-copy.ts +34 -0
- package/src/plugins/builtin/shared/report-freshness.ts +2 -3
- package/src/plugins/builtin/shared/statement-currency.ts +23 -0
- package/src/plugins/builtin/shared/ticker-surface.ts +1 -1
- package/src/plugins/builtin/supply-chain/client.ts +34 -9
- package/src/plugins/builtin/supply-chain/evidence.ts +3 -2
- package/src/plugins/builtin/supply-chain/flow.tsx +4 -3
- package/src/plugins/builtin/supply-chain/graph-model.ts +14 -7
- package/src/plugins/builtin/supply-chain/graph-pane.tsx +3 -1
- package/src/plugins/builtin/supply-chain/graph.tsx +6 -3
- package/src/plugins/builtin/supply-chain/headless.ts +19 -4
- package/src/plugins/builtin/supply-chain/model.ts +50 -6
- package/src/plugins/builtin/supply-chain/pane.tsx +79 -18
- package/src/plugins/builtin/themes/headless.ts +4 -4
- package/src/plugins/builtin/themes/model.ts +11 -8
- package/src/plugins/builtin/themes/pane.tsx +2 -2
- package/src/plugins/builtin/ticker-detail/adr-pair/ah.ts +62 -0
- package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +119 -20
- package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +51 -1
- package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +25 -14
- package/src/plugins/builtin/ticker-detail/financials/model.ts +22 -32
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +7 -9
- package/src/plugins/builtin/ticker-detail/headless-schema.ts +2 -0
- package/src/plugins/builtin/ticker-detail/headless.ts +28 -12
- package/src/plugins/builtin/ticker-detail/overview/board-lot.ts +21 -0
- package/src/plugins/builtin/ticker-detail/overview/model.ts +28 -2
- package/src/plugins/builtin/ticker-detail/overview/pane.tsx +8 -0
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +68 -13
- package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +9 -2
- package/src/plugins/builtin/ticker-detail/quote-monitor/index.tsx +5 -2
- package/src/plugins/builtin/volatility/model.ts +17 -0
- package/src/plugins/builtin/volatility/pane.tsx +16 -7
- package/src/plugins/builtin/world-indices/index.tsx +2 -0
- package/src/plugins/builtin/world-indices/table.tsx +15 -0
- package/src/plugins/builtin/world-venue-map/evidence.ts +3 -2
- package/src/plugins/builtin/world-venue-map/headless.ts +32 -18
- package/src/plugins/builtin/world-venue-map/index.ts +19 -6
- package/src/plugins/builtin/world-venue-map/layered-pane.tsx +9 -5
- package/src/plugins/builtin/world-venue-map/layers.ts +33 -11
- package/src/plugins/builtin/world-venue-map/map.tsx +12 -0
- package/src/plugins/builtin/world-venue-map/model.ts +6 -1
- package/src/plugins/builtin/world-venue-map/pane.tsx +35 -6
- package/src/plugins/builtin/world-venue-map/place.ts +119 -0
- package/src/plugins/builtin/world-venue-map/venue-header.tsx +5 -3
- package/src/plugins/catalog-browser.ts +10 -1
- package/src/plugins/catalog-data.ts +20 -0
- package/src/plugins/catalog-lazy.ts +51 -0
- package/src/plugins/catalog-ui.ts +16 -18
- package/src/plugins/host-smoke.ts +5 -2
- package/src/portfolio/allocation.ts +79 -19
- package/src/portfolio/cash-balances.ts +76 -0
- package/src/portfolio/mutations.ts +43 -8
- package/src/public/__snapshots__/public-api.test.ts.snap +1 -0
- package/src/renderers/browser/activity.ts +16 -0
- package/src/renderers/browser/app-badge-host.ts +14 -0
- package/src/renderers/browser/main.tsx +5 -0
- package/src/renderers/browser/notifications.ts +103 -0
- package/src/renderers/browser/ui-host.tsx +4 -0
- package/src/renderers/desktop/window-layouts.ts +14 -0
- package/src/renderers/dom/data-table/index.tsx +27 -4
- package/src/renderers/dom/data-table/row.tsx +2 -0
- package/src/renderers/dom/host/tabs.tsx +57 -8
- package/src/renderers/dom/styles.css +13 -5
- package/src/renderers/electrobun/bun/desktop/backend-requests.ts +4 -0
- package/src/renderers/electrobun/bun/desktop/backend.ts +22 -1
- package/src/renderers/electrobun/bun/window/native-min-size.ts +6 -1
- package/src/renderers/electrobun/shared/protocol.ts +4 -0
- package/src/renderers/electrobun/view/cli-pane-shot-frame.tsx +50 -12
- package/src/renderers/electrobun/view/http-fetch.ts +3 -2
- package/src/renderers/electrobun/view/remote/ticker-repository.ts +10 -0
- package/src/series/standalone-catalog.ts +5 -4
- package/src/series/standalone.ts +13 -7
- package/src/sources/gloomberb-cloud/index.ts +22 -9
- package/src/sources/gloomberb-cloud/news.ts +35 -0
- package/src/sources/gloomberb-cloud/perpetuals.ts +60 -3
- package/src/sources/provider-errors.ts +34 -7
- package/src/sources/provider-router/financials.ts +20 -13
- package/src/sources/provider-router/history.ts +32 -6
- package/src/sources/provider-router/index.ts +4 -0
- package/src/sources/provider-router/search.ts +1 -0
- package/src/sync/collections-contributor.ts +3 -1
- package/src/sync/config-merge.ts +10 -1
- package/src/sync/sanitize.ts +26 -2
- package/src/tickers/company-name-listing.ts +16 -2
- package/src/tickers/listing-fate.ts +12 -8
- package/src/tickers/renamed-listings.ts +43 -10
- package/src/tickers/search/home-listing.ts +28 -0
- package/src/tickers/search/index.ts +19 -7
- package/src/tickers/terminal-codes.ts +11 -1
- package/src/time-series/base-series.ts +39 -6
- package/src/time-series/chart-seed.ts +2 -2
- package/src/time-series/history-quality.ts +4 -1
- package/src/time-series/hooks.ts +2 -0
- package/src/time-series/price-comparison.ts +17 -23
- package/src/time-series/reporting.ts +1 -1
- package/src/time-series/resolution.ts +13 -0
- package/src/time-series/resolve-context.ts +6 -0
- package/src/time-series/resolve.ts +42 -3
- package/src/time-series/spec.ts +2 -2
- package/src/time-series/types.ts +3 -2
- package/src/types/data-provider.ts +11 -0
- package/src/types/financials.ts +48 -4
- package/src/types/headless.ts +1 -0
- package/src/types/issuer-listings.ts +2 -0
- package/src/types/plugin-notifications.ts +3 -0
- package/src/types/price-history.ts +6 -4
- package/src/types/ticker.ts +10 -2
- package/src/ui/host.tsx +2 -0
- package/src/utils/cli-output.ts +1 -1
- package/src/utils/declared-dividends.ts +13 -1
- package/src/utils/dividend-cash.ts +5 -1
- package/src/utils/exchange-announcements.ts +7 -2
- package/src/utils/forward-dividend.ts +4 -3
- package/src/utils/fundamentals.ts +40 -0
- package/src/utils/network-failure.ts +2 -0
- package/src/utils/price-history-integrity.ts +9 -1
- package/src/utils/remove-folder.ts +37 -0
- package/src/utils/trailing-dividend.ts +1 -1
- package/src/plugins/builtin/composite-plugins.ts +0 -285
package/src/cli/listing-arg.ts
CHANGED
|
@@ -293,9 +293,38 @@ async function companyLineOn(symbol: string, exchange: string, venues: readonly
|
|
|
293
293
|
}
|
|
294
294
|
|
|
295
295
|
/** "PRU does not trade on HKEX. Prudential plc trades on HKEX as 2378:HKEX. PRU trades on: LSE, NYSE." */
|
|
296
|
-
async function notTradedText(
|
|
296
|
+
async function notTradedText(
|
|
297
|
+
listing: Pick<ListingArg, "symbol" | "exchange"> & { typed?: string },
|
|
298
|
+
venues: readonly ListingVenue[],
|
|
299
|
+
deps: ListingDeps,
|
|
300
|
+
): Promise<string> {
|
|
297
301
|
const companyLine = await companyLineOn(listing.symbol, listing.exchange, venues, deps);
|
|
298
|
-
return
|
|
302
|
+
return marketCodeNotTradedText(listing, venues, companyLine)
|
|
303
|
+
?? `${listing.symbol} does not trade on ${listing.exchange}.${companyLine}${tradesOn(listing.symbol, venues)}`;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* "IS is Bloomberg's code for NSE, where AKBNK does not trade. Did you mean
|
|
308
|
+
* AKBNK TI (AKBNK:BIST)?" for a listing typed as a Bloomberg code (`AKBNK IS`,
|
|
309
|
+
* read as AKBNK on NSE) whose symbol trades elsewhere: the code says which
|
|
310
|
+
* venue it named, and each venue the symbol is on is written the way it was
|
|
311
|
+
* typed, so the next try is one step. Null for a listing not typed so.
|
|
312
|
+
*/
|
|
313
|
+
function marketCodeNotTradedText(
|
|
314
|
+
listing: Pick<ListingArg, "symbol" | "exchange"> & { typed?: string },
|
|
315
|
+
venues: readonly ListingVenue[],
|
|
316
|
+
companyLine: string,
|
|
317
|
+
): string | null {
|
|
318
|
+
const code = listing.typed ? readTerminalListingCode(listing.typed) : null;
|
|
319
|
+
if (!code?.market || code.exchange !== listing.exchange || venues.length === 0) return null;
|
|
320
|
+
const symbol = code.symbol;
|
|
321
|
+
const choices = [...new Set(venues.map((venue) => {
|
|
322
|
+
const key = `${venue.symbol ?? symbol}:${venue.exchange}`;
|
|
323
|
+
const written = bloombergCodeOf(venue.symbol ?? symbol, venue.exchange);
|
|
324
|
+
return written ? `${written} (${key})` : key;
|
|
325
|
+
}))].slice(0, 3);
|
|
326
|
+
const meant = choices.length > 1 ? `${choices.slice(0, -1).join(", ")} or ${choices.at(-1)}` : choices[0]!;
|
|
327
|
+
return `${code.market} is Bloomberg's code for ${listing.exchange}, where ${symbol} does not trade.${companyLine} Did you mean ${meant}?`;
|
|
299
328
|
}
|
|
300
329
|
|
|
301
330
|
/** "Toronto Stock Exchange (TSX) or Tokyo Stock Exchange (JPX)". */
|
|
@@ -381,7 +410,7 @@ async function checkListingExchange(listing: ListingArg, deps: ListingDeps): Pro
|
|
|
381
410
|
* failure stands. It searches, so ask only after a request came back empty.
|
|
382
411
|
*/
|
|
383
412
|
export async function notTradedMessage(
|
|
384
|
-
listing: Pick<ListingArg, "symbol" | "exchange"
|
|
413
|
+
listing: Pick<ListingArg, "symbol" | "exchange"> & { typed?: string },
|
|
385
414
|
deps: ListingDeps,
|
|
386
415
|
): Promise<string | null> {
|
|
387
416
|
if (!listing.exchange) return null;
|
|
@@ -408,7 +437,7 @@ function withdrawnListingMessage(listing: Pick<ListingArg, "symbol" | "exchange"
|
|
|
408
437
|
|
|
409
438
|
/** Fails the command with `notTradedMessage`; returns when the symbol does trade there. */
|
|
410
439
|
export async function failIfNotTraded(
|
|
411
|
-
listing: Pick<ListingArg, "symbol" | "exchange"
|
|
440
|
+
listing: Pick<ListingArg, "symbol" | "exchange"> & { typed?: string },
|
|
412
441
|
deps: ListingDeps,
|
|
413
442
|
ctx: Pick<CliCommandContext, "fail">,
|
|
414
443
|
): Promise<void> {
|
|
@@ -436,6 +465,12 @@ export interface ListingDataRequest {
|
|
|
436
465
|
* whatever came back (`failMovedSymbol`).
|
|
437
466
|
*/
|
|
438
467
|
fate?: () => Promise<ListingFate>;
|
|
468
|
+
/**
|
|
469
|
+
* The listing's own quote, as the command reads it for itself: what says,
|
|
470
|
+
* without the fate, whether the line can have moved at all. A line whose
|
|
471
|
+
* quote trades is served as it comes back, with no lookup of its own.
|
|
472
|
+
*/
|
|
473
|
+
quote?: Promise<Quote | null>;
|
|
439
474
|
}
|
|
440
475
|
|
|
441
476
|
/**
|
|
@@ -1158,7 +1193,8 @@ export async function readBareListing(
|
|
|
1158
1193
|
/** `successor`: also say what became of the company that had the symbol, looked up beside its quote. */
|
|
1159
1194
|
{ refresh = false, successor = false }: { refresh?: boolean; successor?: boolean } = {},
|
|
1160
1195
|
): Promise<ReadListing | NotATicker | null> {
|
|
1161
|
-
|
|
1196
|
+
// Read on its listings below, beside its own quote, as `quote` reads it.
|
|
1197
|
+
const listing = await resolveCliListing(symbol, null, deps, { listingAbroad: false });
|
|
1162
1198
|
// A code the resolver read as another listing (NDX as ^NDX:NIM, the Nasdaq-100) is that listing, saying so.
|
|
1163
1199
|
if (listing.exchange) {
|
|
1164
1200
|
return listing.readAs ? { symbol: listing.symbol, exchange: listing.exchange, name: null, coinNote: null, readAs: listing.readAs } : null;
|
|
@@ -1327,9 +1363,11 @@ export async function failUnchosenListing(
|
|
|
1327
1363
|
* calls what it returned empty, and a listing's exchange is one its symbol does
|
|
1328
1364
|
* not trade on, the command ends in that message instead of the request's own
|
|
1329
1365
|
* "unavailable". With `request`, a bare symbol no source serves ends naming
|
|
1330
|
-
* its other listings (`otherListingsMessage`), and
|
|
1331
|
-
*
|
|
1332
|
-
*
|
|
1366
|
+
* its other listings (`otherListingsMessage`), and a symbol whose company
|
|
1367
|
+
* moved ends naming its new symbol, served or not. A request that succeeds
|
|
1368
|
+
* costs no extra lookup beyond the fate the command reads anyway, or, given
|
|
1369
|
+
* the command's own quote (`request.quote`), beyond a quote that says the
|
|
1370
|
+
* line stopped.
|
|
1333
1371
|
*/
|
|
1334
1372
|
export async function loadForListing<T>(
|
|
1335
1373
|
listings: ListingForLoad | readonly ListingForLoad[],
|
|
@@ -1342,24 +1380,55 @@ export async function loadForListing<T>(
|
|
|
1342
1380
|
const all = "symbol" in listings ? [listings] : listings;
|
|
1343
1381
|
const named = all.filter((listing) => listing.exchange);
|
|
1344
1382
|
const checkVenues = () => Promise.all(named.map((listing) => failIfNotTraded(listing, deps, ctx)));
|
|
1383
|
+
// One listing a command asked for: a company that moved ends the command naming its new symbol, as `quote` names
|
|
1384
|
+
// it, whether the load came back empty or failed (FI's window before the listing that reused the symbol has no bars
|
|
1385
|
+
// at all) or served the old line (FI's 2024 statements). A command that reads the fate itself asks it either way.
|
|
1386
|
+
// Otherwise a load that served asks only when the command's own quote says the line stopped, so a symbol that
|
|
1387
|
+
// trades costs no lookup; a load that failed or came back empty asks with the quote it has, or reads one.
|
|
1388
|
+
const one = request && all.length === 1 ? all[0]! : null;
|
|
1389
|
+
const refuseMoved = async (served: boolean) => {
|
|
1390
|
+
if (!one || !request) return;
|
|
1391
|
+
const quote = request.fate || !request.quote ? undefined : await request.quote.catch(() => {
|
|
1392
|
+
// Intentional ignore: the quote is the command's own read, which reports its failure; with none, the line reads as unquoted.
|
|
1393
|
+
return null;
|
|
1394
|
+
});
|
|
1395
|
+
if (served && !request.fate && (quote === undefined || !lineMayHaveMoved(quote))) return;
|
|
1396
|
+
const moved = (await (request.fate ?? commandFate(one, deps, quote))()).moved;
|
|
1397
|
+
if (moved) failMovedSymbol(moved, request);
|
|
1398
|
+
};
|
|
1345
1399
|
let value: T;
|
|
1346
1400
|
try {
|
|
1347
1401
|
value = await load();
|
|
1348
1402
|
} catch (error) {
|
|
1349
1403
|
await checkVenues();
|
|
1404
|
+
await refuseMoved(false);
|
|
1350
1405
|
if (request && all.length === 1 && isNoProviderError(error)) await failUnservedListing(ctx, request, otherListingsMessage(all[0]!, deps, request));
|
|
1351
1406
|
throw error;
|
|
1352
1407
|
}
|
|
1353
|
-
|
|
1408
|
+
const missed = isMiss?.(value) === true;
|
|
1409
|
+
if (missed) await checkVenues();
|
|
1354
1410
|
// Data came back, but the symbol's company moved and nothing new lists there: the data is another security's.
|
|
1355
|
-
|
|
1356
|
-
const { moved } = await request.fate();
|
|
1357
|
-
if (moved) failMovedSymbol(moved, request);
|
|
1358
|
-
}
|
|
1411
|
+
await refuseMoved(!missed);
|
|
1359
1412
|
return value;
|
|
1360
1413
|
}
|
|
1361
1414
|
|
|
1362
|
-
|
|
1415
|
+
/**
|
|
1416
|
+
* The fate of a command's one listing when the command did not look it up
|
|
1417
|
+
* itself (`listingFateLoader`), read with the quote the command has (`quote`;
|
|
1418
|
+
* left out, the fate reads one). A symbol the change history is not about (a
|
|
1419
|
+
* listing abroad, a pair) asks nothing of it.
|
|
1420
|
+
*/
|
|
1421
|
+
function commandFate(listing: ListingForLoad, deps: Pick<ListingDeps, "dataProvider">, quote?: Quote | null): () => Promise<ListingFate> {
|
|
1422
|
+
let fate: Promise<ListingFate> | null = null;
|
|
1423
|
+
return () => fate ??= loadListingFate(listing, deps.dataProvider, quote === undefined ? {} : { quote });
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
/** A command that ended naming the new symbol of a company that moved (`failMovedSymbol`). */
|
|
1427
|
+
export function isMovedSymbolFailure(error: unknown): boolean {
|
|
1428
|
+
return error instanceof Error && (error as { code?: unknown }).code === "ticker_moved";
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
type ListingForLoad = Pick<ListingArg, "symbol" | "exchange"> & Partial<Pick<CliListing, "saved" | "request">>;
|
|
1363
1432
|
|
|
1364
1433
|
/** The saved ticker for a listing: under its own key, or a saved symbol whose venue it is. */
|
|
1365
1434
|
export async function loadSavedListing(store: ListingStore, listing: ListingArg): Promise<TickerRecord | null> {
|
|
@@ -1579,6 +1648,12 @@ export async function resolveCliListing(
|
|
|
1579
1648
|
* `quote` reads names after its own quote request, and turns it off.
|
|
1580
1649
|
*/
|
|
1581
1650
|
companyWord?: boolean;
|
|
1651
|
+
/**
|
|
1652
|
+
* Read a bare symbol no source quotes on the listing `quote` reads it on (`readBareListingAbroad`): O8A
|
|
1653
|
+
* is O8A:FWB2. On by default; `quote` reads it after its own quote request, and turns it off, as does a
|
|
1654
|
+
* lookup that searches for the listing itself (`resolveCliTicker`).
|
|
1655
|
+
*/
|
|
1656
|
+
listingAbroad?: boolean;
|
|
1582
1657
|
} = {},
|
|
1583
1658
|
): Promise<CliListing> {
|
|
1584
1659
|
// "JPM US Equity" is Bloomberg's code for JPM; "Putnam US Equity", whose root is no US ticker, is a name.
|
|
@@ -1634,11 +1709,13 @@ export async function resolveCliListing(
|
|
|
1634
1709
|
let parsed = named ?? (dotted ? await londonDottedListing(dotted, deps) : parseListingArg(raw, exchangeOption, { ...options, terminalCode: terminal }));
|
|
1635
1710
|
if (codeWins) parsed = { ...parsed, readAs: codeWins };
|
|
1636
1711
|
if (!parsed.symbol) throw new ListingArgError("Ticker symbol is required.");
|
|
1712
|
+
// A bare code's own quote is asked once, however many of the readings below ask whether anything trades as it.
|
|
1713
|
+
const ownQuote = bareQuoteOnce(deps);
|
|
1637
1714
|
// $VIX is Schwab's code for ^VIX, unless a security trades as VIX: $AAPL is a cashtag.
|
|
1638
|
-
const index = named || parsed.exchange ? null : await readDollarIndexCode(raw, deps);
|
|
1715
|
+
const index = named || parsed.exchange ? null : await readDollarIndexCode(raw, deps, ownQuote);
|
|
1639
1716
|
if (index) parsed = index;
|
|
1640
1717
|
// NDX, which no security trades as, is the Nasdaq-100 for every command, as `quote` reads it; MOVE stays Corvex.
|
|
1641
|
-
const rooted = named || index || terminal || parsed.exchange ? null : await readBareIndexRoot(parsed, typed, deps);
|
|
1718
|
+
const rooted = named || index || terminal || parsed.exchange ? null : await readBareIndexRoot(parsed, typed, deps, ownQuote);
|
|
1642
1719
|
if (rooted) parsed = rooted;
|
|
1643
1720
|
// USD-NGN and USDNGN are the pair USDNGN=X unless a security is listed under those letters.
|
|
1644
1721
|
const pair = parsed.exchange ? null : await readAmbiguousCurrencyPair(parsed.symbol, deps);
|
|
@@ -1648,7 +1725,7 @@ export async function resolveCliListing(
|
|
|
1648
1725
|
if (hongKong) parsed = hongKong;
|
|
1649
1726
|
// A word no source quotes that names a company (`Naspers`) is its listing, for every command, as `quote` reads it.
|
|
1650
1727
|
const askCompany = !(options.companyWord === false || pair || named || index || rooted || hongKong || terminal || dotted);
|
|
1651
|
-
const company = askCompany ? await readBareCompanyName(parsed, typed, deps) : null;
|
|
1728
|
+
const company = askCompany ? await readBareCompanyName(parsed, typed, deps, ownQuote) : null;
|
|
1652
1729
|
if (company) parsed = company;
|
|
1653
1730
|
// A name in kanji alone the service names no company for (中電工; 中電 is CLP in Hong Kong) is a Tokyo company's
|
|
1654
1731
|
// whole name, when it is one.
|
|
@@ -1680,7 +1757,7 @@ export async function resolveCliListing(
|
|
|
1680
1757
|
// A code nothing could read stays the venue it is saved on.
|
|
1681
1758
|
const savedExchange = canonicalExchange(saved?.metadata.exchange);
|
|
1682
1759
|
if (listing.sharedCode && savedExchange) listing = { symbol: listing.symbol, exchange: savedExchange, key: `${listing.symbol}:${savedExchange}` };
|
|
1683
|
-
|
|
1760
|
+
const resolved: CliListing = {
|
|
1684
1761
|
...listing,
|
|
1685
1762
|
saved,
|
|
1686
1763
|
typed: typed.trim(),
|
|
@@ -1688,6 +1765,42 @@ export async function resolveCliListing(
|
|
|
1688
1765
|
? { symbol: listing.key, exchange: listing.exchange }
|
|
1689
1766
|
: { symbol: listing.symbol, exchange: saved?.metadata.exchange ?? "" },
|
|
1690
1767
|
};
|
|
1768
|
+
// A bare code no source quotes (O8A, listed in Frankfurt alone) is the listing `quote` reads it on, for every command.
|
|
1769
|
+
const readElse = pair || named || index || rooted || company || hongKong || terminal || dotted || suffixed || venueRow;
|
|
1770
|
+
const abroad = options.listingAbroad === false || readElse || listing.exchange || saved ? null : await readBareListingAbroad(resolved, deps, ownQuote);
|
|
1771
|
+
return abroad ?? resolved;
|
|
1772
|
+
}
|
|
1773
|
+
|
|
1774
|
+
/** A listing's code typed bare: letters and digits alone (O8A, 2222, SXR8), with no venue, suffix, pair or index mark. */
|
|
1775
|
+
const BARE_LISTING_CODE = /^[A-Z0-9]{1,10}$/;
|
|
1776
|
+
|
|
1777
|
+
/**
|
|
1778
|
+
* A bare code no source quotes, read on the listing `quote` reads it on, so
|
|
1779
|
+
* every command asks that listing for its data and names it: O8A, which
|
|
1780
|
+
* Pelican Aqua lists in Frankfurt alone, is O8A:FWB2, saying "O8A -> FWB2",
|
|
1781
|
+
* where the data service answers "Not a ticker" for the bare code. As in
|
|
1782
|
+
* `quote`, a word the service marks as a company's name is that company
|
|
1783
|
+
* first (`serviceNamedCompany`). Null, so the symbol stays as typed, for a
|
|
1784
|
+
* code with a quote of its own, whatever venue the service reads it on (AAPL;
|
|
1785
|
+
* SXR8, which it reads on Xetra), for one the shipped listings know as a US
|
|
1786
|
+
* stock, which costs no request, for a code several companies list (2222),
|
|
1787
|
+
* which a command asks about once its own request fails, and when the quote
|
|
1788
|
+
* or the search cannot answer.
|
|
1789
|
+
*/
|
|
1790
|
+
async function readBareListingAbroad(listing: CliListing, deps: ListingDeps, ownQuote: BareQuote): Promise<CliListing | null> {
|
|
1791
|
+
if (!BARE_LISTING_CODE.test(listing.symbol) || deps.dataProvider.knownUsStock?.(listing.symbol)) return null;
|
|
1792
|
+
const own = await ownQuote(listing.symbol);
|
|
1793
|
+
// Only a source's answer that nothing lists the code: one that failed (a timeout, a refusal) says nothing of it.
|
|
1794
|
+
if (own.quote || !isNoSourceAnswer(own.error)) return null;
|
|
1795
|
+
try {
|
|
1796
|
+
const named = listing.typed ? await serviceNamedCompany(listing.typed, deps) : null;
|
|
1797
|
+
if (named) return { ...await resolveNamedListing(named, deps), typed: listing.typed };
|
|
1798
|
+
const other = await quoteBareListing(listing, deps, { command: "quote", noun: "a quote" });
|
|
1799
|
+
if (other?.kind !== "quoted") return null;
|
|
1800
|
+
return { ...other.listing, typed: listing.typed, readAs: [listing.readAs, other.note].filter(Boolean).join(" ") };
|
|
1801
|
+
} catch (error) {
|
|
1802
|
+
return logFailure("cli.listing-arg", "Read a bare code on its listing abroad failed", null)(error);
|
|
1803
|
+
}
|
|
1691
1804
|
}
|
|
1692
1805
|
|
|
1693
1806
|
/**
|
|
@@ -1827,11 +1940,33 @@ async function refuseUnknownMarketCode(typed: string, deps: ListingDeps): Promis
|
|
|
1827
1940
|
async function checkTerminalCodeVenue(listing: ListingArg, market: string, deps: ListingDeps): Promise<void> {
|
|
1828
1941
|
const hint = bloombergMarketHint(market);
|
|
1829
1942
|
if (!hint && !isSearchOnlyVenue(listing.exchange)) return;
|
|
1830
|
-
|
|
1831
|
-
|
|
1943
|
+
// Only what search answers refuses the code: a busy or unreachable search leaves the listing's own request to speak.
|
|
1944
|
+
const venues = await listingVenues(listing.symbol, deps, { failTransient: true })
|
|
1945
|
+
.catch(logFailure("cli.listing-arg", "Read listing venues failed", null));
|
|
1946
|
+
if (!venues) return;
|
|
1947
|
+
const there = venues.filter((venue) => venue.exchange === listing.exchange);
|
|
1948
|
+
const own = (venue: ListingVenue) => !venue.symbol || venue.symbol.toUpperCase() === listing.symbol.toUpperCase();
|
|
1949
|
+
if (there.some(own) || (there.length > 0 && !hint)) return;
|
|
1950
|
+
// Where the codes differ, Bloomberg's ticker can name the company search lists there under the venue's code
|
|
1951
|
+
// (ARAMCO AB is Saudi Aramco, 2222 on Tadawul): say which one to type.
|
|
1952
|
+
const listed = there.find((venue) => !own(venue));
|
|
1953
|
+
const line = !hint ? null : listed ? { symbol: listed.symbol!, name: listed.name.trim() } : await venueLineNamed(listing, deps);
|
|
1954
|
+
if (line) {
|
|
1955
|
+
throw new ListingArgError(`${listing.symbol} is not a ${listing.exchange} code; did you mean ${line.symbol} ${market}${line.name ? ` (${line.name})` : ""}?`, hint!);
|
|
1956
|
+
}
|
|
1957
|
+
// Search lists the symbol nowhere: the request's own answer says what it finds, as it did before codes were checked.
|
|
1958
|
+
if (venues.length === 0) return;
|
|
1832
1959
|
throw new ListingArgError(await notTradedText(listing, venues, deps), hint ?? undefined);
|
|
1833
1960
|
}
|
|
1834
1961
|
|
|
1962
|
+
/** The one line search lists on the listing's venue for its symbol read as a name (ARAMCO: 2222 on TADAWUL); null for none or several. */
|
|
1963
|
+
async function venueLineNamed(listing: ListingArg, deps: ListingDeps): Promise<{ symbol: string; name: string } | null> {
|
|
1964
|
+
const found = await deps.dataProvider.search(listing.symbol).catch(logFailure("cli.listing-arg", "Search a code's company failed", []));
|
|
1965
|
+
const lines = found.filter((result) => canonicalExchange(result.exchange || result.primaryExchange) === listing.exchange);
|
|
1966
|
+
const symbols = [...new Set(lines.map((result) => parsePublicTickerKey(result.symbol).symbol))];
|
|
1967
|
+
return symbols.length === 1 && symbols[0] !== listing.symbol.toUpperCase() ? { symbol: symbols[0]!, name: lines[0]!.name.trim() } : null;
|
|
1968
|
+
}
|
|
1969
|
+
|
|
1835
1970
|
/**
|
|
1836
1971
|
* The index a broker's code names, as a listing: VIX.X and $VIX.X at once,
|
|
1837
1972
|
* $VIX when the sources answer that nothing trades as VIX. `$MOVE` stays
|
|
@@ -1840,22 +1975,40 @@ async function checkTerminalCodeVenue(listing: ListingArg, market: string, deps:
|
|
|
1840
1975
|
* network) says nothing about what trades, so `$MID` stays MID as typed.
|
|
1841
1976
|
* Null for anything else.
|
|
1842
1977
|
*/
|
|
1843
|
-
export async function readBrokerIndexCode(
|
|
1978
|
+
export async function readBrokerIndexCode(
|
|
1979
|
+
raw: string,
|
|
1980
|
+
deps: Pick<ListingDeps, "dataProvider">,
|
|
1981
|
+
ownQuote: BareQuote = bareQuoteOnce(deps),
|
|
1982
|
+
): Promise<ListingArg | null> {
|
|
1844
1983
|
const code = brokerIndexCode(stripStrayEdges(raw).text || raw);
|
|
1845
1984
|
if (!code) return null;
|
|
1846
|
-
if (code.bare && !await nothingTradesAs(code.bare,
|
|
1985
|
+
if (code.bare && !await nothingTradesAs(code.bare, ownQuote)) return null;
|
|
1847
1986
|
return { symbol: code.symbol, exchange: "", key: code.symbol, readAs: brokerIndexReadAs(code) };
|
|
1848
1987
|
}
|
|
1849
1988
|
|
|
1989
|
+
/** A bare code's own quote (`getQuote(symbol, "")`), or the error it failed with. */
|
|
1990
|
+
type BareQuote = (symbol: string) => Promise<{ quote: Quote | null; error?: unknown }>;
|
|
1991
|
+
|
|
1992
|
+
/** `BareQuote` asked once per code, for one resolution: every reading of the code that asks gets the same answer. */
|
|
1993
|
+
function bareQuoteOnce(deps: Pick<ListingDeps, "dataProvider">): BareQuote {
|
|
1994
|
+
const asked = new Map<string, Promise<{ quote: Quote | null; error?: unknown }>>();
|
|
1995
|
+
return (symbol) => {
|
|
1996
|
+
let answer = asked.get(symbol);
|
|
1997
|
+
if (!answer) {
|
|
1998
|
+
answer = loadListingQuoteAnswer(deps.dataProvider, { request: { symbol, exchange: "" } });
|
|
1999
|
+
asked.set(symbol, answer);
|
|
2000
|
+
}
|
|
2001
|
+
return answer;
|
|
2002
|
+
};
|
|
2003
|
+
}
|
|
2004
|
+
|
|
1850
2005
|
/** Whether the sources answer that no security trades as `symbol`: no quote, or a no-provider miss. */
|
|
1851
|
-
async function nothingTradesAs(symbol: string,
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
return false;
|
|
1858
|
-
}
|
|
2006
|
+
async function nothingTradesAs(symbol: string, ownQuote: BareQuote): Promise<boolean> {
|
|
2007
|
+
const { quote, error } = await ownQuote(symbol);
|
|
2008
|
+
if (error === undefined) return !quote;
|
|
2009
|
+
if (isNoProviderError(error)) return true;
|
|
2010
|
+
logFailure("cli.listing-arg", "Quote broker index root failed")(error);
|
|
2011
|
+
return false;
|
|
1859
2012
|
}
|
|
1860
2013
|
|
|
1861
2014
|
/**
|
|
@@ -1867,12 +2020,12 @@ async function nothingTradesAs(symbol: string, deps: Pick<ListingDeps, "dataProv
|
|
|
1867
2020
|
* row saved under it stays as typed, as does one whose quote failed another
|
|
1868
2021
|
* way (the network). Null for any other symbol.
|
|
1869
2022
|
*/
|
|
1870
|
-
async function readBareIndexRoot(parsed: ListingArg, typed: string, deps: ListingDeps): Promise<ListingArg | null> {
|
|
2023
|
+
async function readBareIndexRoot(parsed: ListingArg, typed: string, deps: ListingDeps, ownQuote: BareQuote): Promise<ListingArg | null> {
|
|
1871
2024
|
const root = indexRootFor(parsed.symbol);
|
|
1872
2025
|
const word = typed.trim();
|
|
1873
2026
|
if (!root || word.toUpperCase() !== parsed.symbol) return null;
|
|
1874
2027
|
if (await deps.store.loadTicker(parsed.symbol).catch(logFailure("cli.listing-arg", "Read a saved index root failed", null))) return null;
|
|
1875
|
-
if (!await nothingTradesAs(parsed.symbol,
|
|
2028
|
+
if (!await nothingTradesAs(parsed.symbol, ownQuote)) return null;
|
|
1876
2029
|
const marked = await serviceMarkedListing(deps.dataProvider, word, root.symbol)
|
|
1877
2030
|
.catch(logFailure("cli.listing-arg", "Read the listing an index root names failed", null));
|
|
1878
2031
|
const key = marked?.exchange ? `${marked.symbol}:${marked.exchange}` : marked?.symbol ?? root.symbol;
|
|
@@ -1888,11 +2041,11 @@ async function readBareIndexRoot(parsed: ListingArg, typed: string, deps: Listin
|
|
|
1888
2041
|
* listed abroad under it. Null for anything else, and when search names no
|
|
1889
2042
|
* company.
|
|
1890
2043
|
*/
|
|
1891
|
-
async function readBareCompanyName(parsed: ListingArg, typed: string, deps: ListingDeps): Promise<ListingArg | null> {
|
|
2044
|
+
async function readBareCompanyName(parsed: ListingArg, typed: string, deps: ListingDeps, ownQuote: BareQuote): Promise<ListingArg | null> {
|
|
1892
2045
|
const word = typed.trim();
|
|
1893
2046
|
if (parsed.exchange || !NAME_WRITTEN_WORD.test(word) || word.toUpperCase() !== parsed.symbol) return null;
|
|
1894
2047
|
if (await deps.store.loadTicker(parsed.symbol).catch(logFailure("cli.listing-arg", "Read a saved word failed", null))) return null;
|
|
1895
|
-
if (!await nothingTradesAs(parsed.symbol,
|
|
2048
|
+
if (!await nothingTradesAs(parsed.symbol, ownQuote)) return null;
|
|
1896
2049
|
const named = await oneWordCompanyName(word, deps).catch(logFailure("cli.listing-arg", "Read a word as a company's name failed", null));
|
|
1897
2050
|
// A code listed abroad under the word (FP on TSXV and BVB) is a symbol, whose listings the command names: never a name.
|
|
1898
2051
|
return named && named.symbol.toUpperCase() !== parsed.symbol ? named : null;
|
|
@@ -1972,7 +2125,8 @@ export async function joinCompanyNameWords<T extends { typed: string; listing: P
|
|
|
1972
2125
|
|
|
1973
2126
|
/** The listing a company's name was read as (`named`), resolved as its key is, still saying what it was read as. */
|
|
1974
2127
|
export async function resolveNamedListing(named: ListingArg, deps: ListingDeps): Promise<CliListing> {
|
|
1975
|
-
|
|
2128
|
+
// The name chose the listing: its key is never read again on another one.
|
|
2129
|
+
const resolved = await resolveCliListing(named.key, null, deps, { listingAbroad: false });
|
|
1976
2130
|
return {
|
|
1977
2131
|
...resolved, readAs: named.readAs, ...named.meant ? { meant: named.meant } : {},
|
|
1978
2132
|
...named.readFromName ? { readFromName: named.readFromName } : {}, ...named.venueFromSearch ? { venueFromSearch: named.venueFromSearch } : {},
|
|
@@ -2008,8 +2162,8 @@ async function joinedRun(
|
|
|
2008
2162
|
}
|
|
2009
2163
|
|
|
2010
2164
|
/** `readBrokerIndexCode` for a `$ROOT` code only: the `ROOT.X` codes are read where the listing is parsed. */
|
|
2011
|
-
function readDollarIndexCode(raw: string, deps: Pick<ListingDeps, "dataProvider"
|
|
2012
|
-
return brokerIndexCode(stripStrayEdges(raw).text || raw)?.bare ? readBrokerIndexCode(raw, deps) : Promise.resolve(null);
|
|
2165
|
+
function readDollarIndexCode(raw: string, deps: Pick<ListingDeps, "dataProvider">, ownQuote: BareQuote): Promise<ListingArg | null> {
|
|
2166
|
+
return brokerIndexCode(stripStrayEdges(raw).text || raw)?.bare ? readBrokerIndexCode(raw, deps, ownQuote) : Promise.resolve(null);
|
|
2013
2167
|
}
|
|
2014
2168
|
|
|
2015
2169
|
/** The listing a name typed in Japanese reads as, saying so; one that names several companies asks which, with how many. */
|
|
@@ -2228,7 +2382,7 @@ export async function requireCliListing(
|
|
|
2228
2382
|
exchangeOption: string | null | undefined,
|
|
2229
2383
|
deps: ListingDeps,
|
|
2230
2384
|
ctx: Pick<CliCommandContext, "fail">,
|
|
2231
|
-
options: { ownExchangeWins?: boolean; venueSuffix?: boolean; companyWord?: boolean } = {},
|
|
2385
|
+
options: { ownExchangeWins?: boolean; venueSuffix?: boolean; companyWord?: boolean; listingAbroad?: boolean } = {},
|
|
2232
2386
|
): Promise<CliListing> {
|
|
2233
2387
|
try {
|
|
2234
2388
|
return await resolveCliListing(raw, exchangeOption, deps, options);
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { join } from "path";
|
|
2
|
+
import type { GloomPlugin } from "../../types/plugin";
|
|
3
|
+
import { createDefaultConfig } from "../../types/config";
|
|
4
|
+
import { catalogSeriesFacts } from "../series-search";
|
|
5
|
+
import type { MarketContext } from "../types";
|
|
6
|
+
import { getHeadlessPaneDefinition } from "./capabilities";
|
|
7
|
+
import { buildPaneCatalogEntries, buildPaneFunctionLookup } from "./catalog";
|
|
8
|
+
import type { CatalogSnapshot, CatalogSnapshotEntry } from "./catalog-snapshot";
|
|
9
|
+
import { createPaneCatalog } from "./discovery";
|
|
10
|
+
import { namesFunction } from "./resolver";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The built-in plugins `fn` may set up without the others: nothing outside one of them reads what its setup leaves
|
|
14
|
+
* behind (a persistence a client attaches, a notification watch), as the FRED series cache rates-macro attaches is
|
|
15
|
+
* read by the chart composer and the other plugins that chart a macro series. `plugin-coupling.test.ts` fails when
|
|
16
|
+
* code one of these plugins loads calls a setup effect that another plugin's module owns.
|
|
17
|
+
*/
|
|
18
|
+
export const SELF_CONTAINED_PLUGINS: readonly string[] = ["ownership", "news", "screeners"];
|
|
19
|
+
|
|
20
|
+
const SENTINEL_LIST = { id: "catalog-snapshot-list", name: "Catalog Snapshot List" };
|
|
21
|
+
|
|
22
|
+
/** A context whose first list holds a symbol (`withList`), or one with no list that holds any. */
|
|
23
|
+
function snapshotContext(withList: boolean): MarketContext {
|
|
24
|
+
const config = createDefaultConfig("/catalog-snapshot");
|
|
25
|
+
if (withList) config.watchlists = [{ id: SENTINEL_LIST.id, name: SENTINEL_LIST.name }];
|
|
26
|
+
const held = withList ? [{ metadata: { watchlists: [SENTINEL_LIST.id], portfolios: [], positions: [] } }] : [];
|
|
27
|
+
return { config, store: { loadAllTickers: async () => held } } as unknown as MarketContext;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** The catalog of `plugins` as a fresh profile reads it, with the series they declare. */
|
|
31
|
+
export async function buildCatalogSnapshot(plugins: GloomPlugin[]): Promise<CatalogSnapshot> {
|
|
32
|
+
const context = snapshotContext(false);
|
|
33
|
+
// One plugin at a time, each torn down before the next is set up: setups leave state that a dispose undoes.
|
|
34
|
+
const owners = new Map<string, string>();
|
|
35
|
+
for (const plugin of plugins) {
|
|
36
|
+
const own = await createPaneCatalog(context, [plugin]);
|
|
37
|
+
try {
|
|
38
|
+
for (const id of own.paneTemplates.keys()) owners.set(`template:${id}`, plugin.id);
|
|
39
|
+
for (const id of own.panes.keys()) owners.set(`pane:${id}`, plugin.id);
|
|
40
|
+
} finally {
|
|
41
|
+
own.destroy();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const registry = await createPaneCatalog(context, plugins);
|
|
45
|
+
try {
|
|
46
|
+
const bare = await buildPaneCatalogEntries(registry, context);
|
|
47
|
+
const listed = await buildPaneCatalogEntries(registry, snapshotContext(true));
|
|
48
|
+
const entries = bare.map((entry, index): CatalogSnapshotEntry => {
|
|
49
|
+
const { argExamples, ...rest } = entry;
|
|
50
|
+
const pluginId = (entry.templateId ? owners.get(`template:${entry.templateId}`) : undefined) ?? owners.get(`pane:${entry.paneId}`);
|
|
51
|
+
if (!pluginId) throw new Error(`No plugin holds the function ${entry.token}.`);
|
|
52
|
+
return {
|
|
53
|
+
...rest,
|
|
54
|
+
pluginId,
|
|
55
|
+
...argExamples ? { examples: [...argExamples] } : {},
|
|
56
|
+
...(listed[index]?.argExamples?.length ?? 0) > (argExamples?.length ?? 0) ? { listArgument: true as const } : {},
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
// A coded function that reports data, of plugins that stand alone, is found by the words that name it; `fn` then loads only them.
|
|
60
|
+
const order = new Map(plugins.map((plugin, index) => [plugin.id, index]));
|
|
61
|
+
const functions: Record<string, string[]> = {};
|
|
62
|
+
for (const [word, found] of buildPaneFunctionLookup(registry)) {
|
|
63
|
+
if (!("paneId" in found && "description" in found) || !found.shortcut?.prefix) continue;
|
|
64
|
+
const pane = registry.panes.get(found.paneId);
|
|
65
|
+
const holders = [...new Set([owners.get(`template:${found.id}`), owners.get(`pane:${found.paneId}`)])]
|
|
66
|
+
.filter((id): id is string => !!id).sort((a, b) => order.get(a)! - order.get(b)!);
|
|
67
|
+
if (pane && holders.length > 0 && holders.every((id) => SELF_CONTAINED_PLUGINS.includes(id))
|
|
68
|
+
&& getHeadlessPaneDefinition(found, pane) && namesFunction(found, pane, word)) functions[word] = holders;
|
|
69
|
+
}
|
|
70
|
+
return { entries, series: catalogSeriesFacts(plugins), functions: Object.fromEntries(Object.entries(functions).sort(([a], [b]) => a.localeCompare(b))) };
|
|
71
|
+
} finally {
|
|
72
|
+
registry.destroy();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export const CATALOG_SNAPSHOT_PATH = join(import.meta.dir, "catalog-snapshot.json");
|
|
77
|
+
|
|
78
|
+
/** One line to a function and to a series, so a change to one reads as a change to one line. */
|
|
79
|
+
export function renderCatalogSnapshot(snapshot: CatalogSnapshot): string {
|
|
80
|
+
const lines = (rows: readonly unknown[]) => rows.map((row) => ` ${JSON.stringify(row)}`).join(",\n");
|
|
81
|
+
const functions = Object.entries(snapshot.functions).map(([word, holders]) => ` ${JSON.stringify(word)}: ${JSON.stringify(holders)}`).join(",\n");
|
|
82
|
+
return `{\n "entries": [\n${lines(snapshot.entries)}\n ],\n "series": [\n${lines(snapshot.series)}\n ],\n "functions": {\n${functions}\n }\n}\n`;
|
|
83
|
+
}
|