gloomberb 0.20.11 → 0.20.13
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/src/account/billing.ts +3 -2
- package/src/account/upgrade-dialog.tsx +8 -8
- package/src/api-client/awards.ts +16 -0
- package/src/api-client/central-bank-rates.ts +5 -0
- package/src/api-client/data.ts +55 -2
- package/src/api-client/index.ts +28 -3
- package/src/api-client/install-experiments.ts +146 -0
- package/src/api-client/request.ts +86 -3
- package/src/api-client/socket-connection.ts +12 -1
- package/src/api-client/socket.ts +21 -3
- package/src/api-client/supply-chain-graph.ts +4 -2
- package/src/api-client/supply-chain.ts +8 -0
- package/src/api-client/telemetry.ts +47 -0
- package/src/api-client/types/econ.ts +10 -7
- package/src/api-client/types/filings-and-calls.ts +8 -0
- package/src/api-client/types/market.ts +4 -0
- package/src/api-client/types/news.ts +16 -0
- package/src/app/global-shortcuts.ts +2 -1
- package/src/app/keybindings/actions.ts +19 -0
- package/src/app/pane-runtime/index.tsx +18 -3
- package/src/app/pane-runtime/layout-placement.ts +63 -0
- package/src/app/pane-runtime/ticker-open-runtime.ts +10 -2
- package/src/architecture/floating-promise-allowlist.json +17 -33
- package/src/brokers/signed-in/adapter.ts +2 -2
- package/src/brokers/signed-in/catalog.ts +13 -4
- package/src/capabilities/chart-series.ts +4 -1
- package/src/cli/board-coins.ts +10 -1
- package/src/cli/commands/crypto-hints.ts +3 -2
- package/src/cli/commands/fred-series.ts +0 -54
- package/src/cli/commands/market.ts +260 -63
- package/src/cli/commands/overview.ts +50 -17
- package/src/cli/commands/search.ts +140 -17
- package/src/cli/commands/ticker.ts +37 -17
- package/src/cli/desktop-pane-shot.ts +27 -2
- package/src/cli/earnings-calendar.ts +33 -53
- package/src/cli/fx-quote-rate.ts +1 -1
- package/src/cli/glossary.ts +14 -5
- package/src/cli/history-catalog-series.ts +85 -0
- package/src/cli/history-rows.ts +18 -1
- package/src/cli/index.ts +1 -1
- package/src/cli/known-gaps.ts +9 -0
- package/src/cli/list-progress.ts +45 -0
- package/src/cli/listing-arg.ts +176 -25
- package/src/cli/name-entries.ts +8 -4
- package/src/cli/not-a-ticker.ts +2 -2
- package/src/cli/pane-functions/catalog.ts +55 -7
- package/src/cli/pane-functions/dom.ts +8 -1
- package/src/cli/pane-functions/freshness.ts +52 -5
- package/src/cli/pane-functions/headless.ts +8 -8
- package/src/cli/pane-functions/index.ts +8 -5
- package/src/cli/pane-functions/market-session.ts +66 -14
- package/src/cli/pane-functions/options.ts +5 -0
- package/src/cli/pane-functions/report.ts +4 -1
- package/src/cli/pane-functions/resolver.ts +9 -2
- package/src/cli/pane-functions/screenshot-assessment.ts +28 -3
- package/src/cli/pane-functions/screenshot-types.ts +6 -0
- package/src/cli/perpetual-contract.ts +4 -4
- package/src/cli/quote-answer.ts +55 -12
- package/src/cli/quote-list-reads.ts +87 -0
- package/src/cli/report-tables.ts +70 -13
- package/src/cli/result.ts +26 -3
- package/src/cli/symbol-list.ts +31 -4
- package/src/cli/terminal-code-hints.ts +83 -0
- package/src/cli/ticker-resolution.ts +2 -1
- package/src/cli/treasury-yields.ts +5 -0
- 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 +101 -15
- package/src/components/chart/composite/legend.tsx +60 -25
- 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/action-runtime.ts +2 -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 +20 -9
- 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/command-bar/routing/launch-request.ts +2 -1
- package/src/components/command-bar/routing/navigation-state.ts +4 -2
- package/src/components/command-bar/workflow/types.ts +6 -0
- package/src/components/data-table/view.tsx +29 -6
- package/src/components/form-modal/host.tsx +1 -1
- package/src/components/layout/detached-pane-shell.tsx +3 -0
- package/src/components/layout/double-escape-close.ts +34 -3
- package/src/components/layout/floating-pane.tsx +10 -4
- package/src/components/layout/header.tsx +3 -2
- package/src/components/layout/market-summary.ts +3 -3
- package/src/components/layout/pane/cycle-order.ts +66 -2
- package/src/components/layout/pane/error-boundary.tsx +2 -1
- package/src/components/layout/pane/header.tsx +140 -31
- package/src/components/layout/pane/sidebar.tsx +13 -5
- package/src/components/layout/pane/status-footer.ts +3 -1
- package/src/components/layout/shell/drag/runtime.ts +5 -0
- package/src/components/layout/shell/index.tsx +25 -0
- package/src/components/layout/shell/menu.ts +9 -0
- package/src/components/layout/shell/pane/actions.ts +36 -0
- package/src/components/layout/shell/pane/management-shortcuts.ts +27 -3
- package/src/components/layout/shell/pane-occlusion.ts +40 -0
- package/src/components/layout/shell/shortcuts.ts +17 -1
- package/src/components/layout/shell/terminal-pointer-runtime.ts +39 -6
- package/src/components/layout/shell/window-mode/index.ts +5 -16
- package/src/components/layout/shell/window-mode/overlays.tsx +3 -1
- package/src/components/markdown-text.tsx +36 -0
- package/src/components/market-board/index.tsx +18 -8
- package/src/components/metric-treemap/index.tsx +3 -1
- 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/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/button.tsx +48 -4
- package/src/components/ui/choice-dialog.tsx +101 -32
- package/src/components/ui/data-table/opentui/index.tsx +24 -9
- package/src/components/ui/data-table/types.ts +7 -0
- package/src/components/ui/inline-quick-add.tsx +19 -3
- package/src/components/ui/list-view.tsx +11 -5
- package/src/components/ui/multi-select/dialog.tsx +1 -7
- package/src/components/ui/not-meaningful.ts +16 -0
- package/src/components/ui/query-bar.tsx +32 -5
- package/src/components/ui/selection-fill.ts +39 -0
- package/src/components/ui/stat-grid.tsx +27 -6
- package/src/core/state/app/layout-reducer.ts +2 -1
- package/src/core/state/app/pane-choices.ts +68 -0
- package/src/core/state/app/state.ts +14 -6
- package/src/core/state/app/types.ts +8 -0
- package/src/data/config/store/normalize.ts +2 -0
- package/src/docs/snapshot.json +1 -1
- package/src/i18n/es.ts +5 -2
- package/src/i18n/ja.ts +5 -2
- package/src/i18n/ko.ts +5 -2
- package/src/i18n/zh-cn.ts +5 -2
- package/src/i18n/zh-tw.ts +5 -2
- package/src/layout/pane-manager/dock-tree.ts +19 -0
- package/src/layout/pane-manager/index.ts +3 -0
- 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 +13 -13
- package/src/market-data/market/freshness.ts +33 -0
- package/src/market-data/market/status.ts +5 -1
- package/src/market-data/quotes/contributions.ts +10 -0
- package/src/market-data/quotes/freshness.ts +19 -0
- package/src/market-data/quotes/listing-enterprise-value.ts +3 -3
- package/src/market-data/quotes/live-valuation.ts +31 -4
- package/src/market-data/quotes/resolution.ts +4 -0
- package/src/market-data/quotes/time.ts +17 -24
- 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/index.tsx +1 -0
- package/src/plugins/builtin/account-management/pane.tsx +9 -8
- 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-model.ts +6 -6
- package/src/plugins/builtin/analytics/risk-pane.tsx +6 -5
- 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 +17 -8
- package/src/plugins/builtin/awards/headless.ts +37 -15
- package/src/plugins/builtin/awards/model.ts +40 -5
- package/src/plugins/builtin/awards/pane.tsx +11 -8
- 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-manager/index.tsx +1 -0
- package/src/plugins/builtin/broker-trading/index.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 +8 -7
- package/src/plugins/builtin/central-bank-rates/index.tsx +1 -1
- package/src/plugins/builtin/central-bank-rates/model.ts +24 -5
- package/src/plugins/builtin/central-bank-rates/pane.tsx +19 -9
- package/src/plugins/builtin/changelog/index.tsx +2 -2
- package/src/plugins/builtin/chart-composer/headless.ts +5 -1
- package/src/plugins/builtin/chart-composer/index.tsx +4 -2
- package/src/plugins/builtin/chart-composer/pane.tsx +8 -3
- 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/content/handle-prompt.tsx +4 -0
- package/src/plugins/builtin/chat/controller/realtime.ts +17 -1
- package/src/plugins/builtin/chat/controller/utils.ts +2 -1
- package/src/plugins/builtin/chat/message/terminal.tsx +4 -1
- package/src/plugins/builtin/chat/sidebar.tsx +3 -4
- 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 +39 -1
- package/src/plugins/builtin/cloud/company-picker.tsx +1 -3
- package/src/plugins/builtin/cloud/plugin.tsx +1 -0
- package/src/plugins/builtin/cloud/team/module.tsx +1 -0
- package/src/plugins/builtin/cloud/team/pane.tsx +12 -12
- package/src/plugins/builtin/cloud/thesis/detail.tsx +22 -12
- 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/commodity-balances/pane.tsx +13 -5
- 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 +18 -13
- 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/index.ts +1 -0
- 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 +4 -3
- package/src/plugins/builtin/cpi/model.ts +8 -7
- package/src/plugins/builtin/credit-boards/cdx-pane.tsx +14 -9
- package/src/plugins/builtin/credit-boards/client.ts +5 -0
- package/src/plugins/builtin/credit-boards/headless.ts +3 -7
- package/src/plugins/builtin/credit-boards/model.ts +5 -11
- package/src/plugins/builtin/credit-boards/series.ts +19 -8
- package/src/plugins/builtin/credit-boards/sovr-pane.tsx +9 -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/defi-view.tsx +7 -7
- package/src/plugins/builtin/crypto-board/defi.ts +2 -2
- package/src/plugins/builtin/crypto-board/model.ts +4 -3
- package/src/plugins/builtin/crypto-board/pane.tsx +8 -8
- package/src/plugins/builtin/crypto-board/supply.ts +2 -2
- package/src/plugins/builtin/crypto-etf-flows/headless.ts +23 -13
- package/src/plugins/builtin/crypto-etf-flows/model.ts +4 -4
- package/src/plugins/builtin/crypto-etf-flows/pane.tsx +8 -3
- 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/headless.ts +16 -7
- package/src/plugins/builtin/debt-maturities/model.ts +12 -18
- package/src/plugins/builtin/debt-maturities/pane.tsx +11 -12
- package/src/plugins/builtin/dividend-yield/client.ts +7 -3
- package/src/plugins/builtin/dividend-yield/headless.ts +16 -11
- 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 +19 -11
- package/src/plugins/builtin/dividend-yield/types.ts +4 -0
- package/src/plugins/builtin/dividend-yield/view.ts +3 -3
- 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 +42 -7
- package/src/plugins/builtin/earnings/board-table.ts +13 -8
- package/src/plugins/builtin/earnings/board.tsx +15 -3
- package/src/plugins/builtin/earnings/calendar-model.ts +5 -5
- package/src/plugins/builtin/earnings/calendar.tsx +11 -6
- package/src/plugins/builtin/earnings/client.ts +0 -9
- package/src/plugins/builtin/earnings/format.ts +16 -14
- package/src/plugins/builtin/earnings/headless.ts +64 -23
- package/src/plugins/builtin/earnings/history-model.ts +11 -7
- package/src/plugins/builtin/earnings/history-table.ts +14 -9
- package/src/plugins/builtin/earnings/history.tsx +22 -14
- package/src/plugins/builtin/earnings-calls/calendar.tsx +2 -1
- package/src/plugins/builtin/earnings-calls/data.ts +24 -4
- package/src/plugins/builtin/earnings-calls/format.ts +29 -10
- package/src/plugins/builtin/earnings-calls/headless.ts +23 -3
- package/src/plugins/builtin/earnings-calls/index.tsx +1 -0
- package/src/plugins/builtin/earnings-calls/model.ts +11 -1
- package/src/plugins/builtin/earnings-calls/pane.tsx +2 -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/model.ts +3 -2
- package/src/plugins/builtin/earnings-ripple/pane.tsx +6 -6
- package/src/plugins/builtin/econ/calendar-model.ts +29 -2
- package/src/plugins/builtin/econ/detail-view.tsx +2 -2
- package/src/plugins/builtin/econ/fred-catalog.ts +3 -0
- package/src/plugins/builtin/econ/index.tsx +16 -8
- package/src/plugins/builtin/econ-statistics/detail.tsx +2 -1
- package/src/plugins/builtin/econ-statistics/headless.ts +7 -5
- package/src/plugins/builtin/econ-statistics/index.tsx +1 -1
- 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 +18 -14
- package/src/plugins/builtin/fear-greed/pane.tsx +12 -4
- package/src/plugins/builtin/filing-events/feed.ts +2 -1
- package/src/plugins/builtin/filing-events/index.tsx +1 -0
- 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 +32 -21
- 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 +11 -8
- package/src/plugins/builtin/insider/tickers.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 +18 -16
- 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/index.tsx +1 -0
- 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 +9 -8
- package/src/plugins/builtin/macro-day/model.ts +3 -2
- package/src/plugins/builtin/macro-day/pane.tsx +4 -4
- package/src/plugins/builtin/macro-day/releases.ts +25 -16
- 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/index.tsx +20 -8
- package/src/plugins/builtin/market-movers/model.ts +5 -0
- package/src/plugins/builtin/market-movers/session-body.tsx +2 -1
- 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/headless.ts +14 -3
- package/src/plugins/builtin/money-markets/model.ts +3 -2
- package/src/plugins/builtin/money-markets/pane.tsx +14 -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 +48 -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 +6 -6
- 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 -31
- package/src/plugins/builtin/portfolio-list/header.tsx +2 -2
- 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 +6 -1
- package/src/plugins/builtin/portfolio-list/pane/period-pnl.ts +2 -1
- package/src/plugins/builtin/portfolio-list/pane/purchase-date-fx.ts +4 -2
- package/src/plugins/builtin/portfolio-list/quick-add/index.tsx +24 -10
- package/src/plugins/builtin/portfolio-list/settings.ts +4 -1
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +9 -11
- package/src/plugins/builtin/portfolio-list/table.tsx +10 -1
- 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 +37 -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/risk-factors/index.tsx +1 -0
- 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/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 +71 -0
- 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 +8 -3
- 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 +9 -5
- package/src/plugins/builtin/social-mentions/headless.ts +2 -1
- package/src/plugins/builtin/social-mentions/model.ts +4 -4
- package/src/plugins/builtin/social-mentions/outliers.tsx +10 -1
- package/src/plugins/builtin/social-mentions/pane.tsx +7 -0
- package/src/plugins/builtin/supply-chain/client.ts +3 -1
- package/src/plugins/builtin/supply-chain/flow.tsx +25 -8
- package/src/plugins/builtin/supply-chain/graph-client.ts +1 -1
- package/src/plugins/builtin/supply-chain/graph-evidence.ts +1 -1
- package/src/plugins/builtin/supply-chain/graph-model.ts +14 -2
- package/src/plugins/builtin/supply-chain/graph-pane.tsx +11 -10
- package/src/plugins/builtin/supply-chain/graph.tsx +12 -6
- package/src/plugins/builtin/supply-chain/headless.ts +15 -8
- package/src/plugins/builtin/supply-chain/model.ts +72 -15
- package/src/plugins/builtin/supply-chain/pane.tsx +11 -8
- package/src/plugins/builtin/supply-chain/row-evidence.tsx +7 -6
- 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/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 +7 -5
- package/src/plugins/builtin/ticker-detail/overview/chart-scale.ts +52 -0
- package/src/plugins/builtin/ticker-detail/overview/components.tsx +18 -5
- package/src/plugins/builtin/ticker-detail/overview/model.ts +24 -13
- 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 +35 -7
- package/src/plugins/builtin/ticker-detail/pane.tsx +48 -24
- package/src/plugins/builtin/ticker-detail/quote-footer.ts +5 -0
- package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +13 -8
- 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/after.ts +50 -23
- package/src/plugins/builtin/treasury-auctions/cache.ts +23 -5
- package/src/plugins/builtin/treasury-auctions/client.ts +2 -1
- package/src/plugins/builtin/treasury-auctions/headless.ts +231 -42
- package/src/plugins/builtin/treasury-auctions/hk-headless.ts +14 -7
- package/src/plugins/builtin/treasury-auctions/hk-view.tsx +37 -34
- package/src/plugins/builtin/treasury-auctions/hk.ts +65 -13
- package/src/plugins/builtin/treasury-auctions/index.tsx +3 -0
- package/src/plugins/builtin/treasury-auctions/keys.ts +27 -0
- package/src/plugins/builtin/treasury-auctions/like.ts +137 -0
- package/src/plugins/builtin/treasury-auctions/model.ts +101 -23
- package/src/plugins/builtin/treasury-auctions/pane.tsx +56 -28
- 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 +6 -3
- package/src/plugins/builtin/vol-surface/pane.tsx +13 -9
- 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/plugins/runtime/index.tsx +1 -0
- package/src/plugins/runtime/state.ts +20 -0
- package/src/portfolio/allocation.ts +5 -5
- package/src/portfolio/column-values.ts +54 -42
- package/src/portfolio/futures-positions.ts +2 -1
- package/src/public/__snapshots__/public-api.test.ts.snap +5 -0
- package/src/public/react.ts +7 -0
- package/src/react/auto-refresh.ts +29 -0
- package/src/renderers/browser/deeplink-bridge.ts +24 -3
- package/src/renderers/dom/desktop/query-bar.tsx +229 -60
- package/src/renderers/dom/host/overflow-fade-px.ts +2 -0
- package/src/renderers/dom/host/overflow-fade.ts +1 -2
- package/src/renderers/dom/styles.css +25 -5
- package/src/renderers/electrobun/bun/desktop/backend-requests.ts +7 -1
- package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +2 -1
- package/src/renderers/opentui/ui-host.tsx +32 -2
- package/src/renderers/share/layout-view.tsx +2 -1
- package/src/series/types.ts +2 -0
- package/src/sources/gloomberb-cloud/fred-attribution.ts +86 -0
- package/src/sources/gloomberb-cloud/index.ts +25 -1
- package/src/sources/gloomberb-cloud/news.ts +9 -0
- package/src/sources/gloomberb-cloud/normalizers.ts +24 -3
- package/src/sources/provider-errors.ts +64 -1
- package/src/sources/provider-router/batches.ts +19 -0
- package/src/sources/provider-router/index.ts +7 -1
- package/src/sources/provider-router/search.ts +15 -10
- package/src/state/app/context/index.tsx +24 -1
- package/src/state/hooks/inline-tickers.ts +3 -2
- package/src/state/hooks/quote-streaming.ts +9 -10
- package/src/state/pane-unsent-work.ts +47 -0
- package/src/team/collections-sync.ts +8 -3
- package/src/telemetry/usage-counts.ts +26 -0
- package/src/test-support/shell-pane-keys.tsx +5 -0
- package/src/test-support/telemetry-guard.ts +83 -0
- package/src/test-support/test-env.ts +12 -0
- package/src/theme/colors.ts +17 -1
- package/src/theme/ui-tokens.ts +50 -1
- package/src/tickers/company-name-listing.ts +2 -2
- package/src/tickers/company-name.ts +17 -1
- package/src/tickers/listing-venues.ts +37 -2
- package/src/tickers/renamed-listings.ts +2 -1
- package/src/tickers/search/index.ts +19 -0
- package/src/tickers/search/japanese-names.json +1 -0
- package/src/tickers/search/japanese-names.ts +152 -0
- package/src/tickers/starter-symbols.ts +7 -0
- package/src/tickers/terminal-codes.ts +55 -6
- package/src/time-series/base-series.ts +3 -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/types/config.ts +9 -0
- package/src/types/data-provider.ts +9 -2
- package/src/types/financials.ts +26 -0
- package/src/types/instrument.ts +6 -0
- package/src/types/plugin-contributions.ts +7 -0
- package/src/types/plugin-panes.ts +8 -1
- package/src/types/plugin-reports.ts +8 -0
- package/src/ui/host.tsx +6 -0
- package/src/utils/datetime-format.ts +74 -33
- package/src/utils/double-escape-close.ts +42 -0
- package/src/utils/financial-statements.ts +39 -15
- package/src/utils/format.ts +4 -9
- package/src/utils/fundamentals.ts +38 -16
- package/src/utils/fx-status.ts +30 -7
- package/src/utils/growth.ts +67 -0
- package/src/utils/keyboard.ts +6 -0
- package/src/utils/network-failure.ts +23 -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/zoned-date-time.ts +47 -22
package/src/cli/quote-answer.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { QuoteBatchResult } from "../types/data-provider";
|
|
2
2
|
import type { Quote } from "../types/financials";
|
|
3
3
|
import { bareListingNote } from "../tickers/listing-fate";
|
|
4
|
-
import { notATickerSymbol } from "../sources/provider-errors";
|
|
4
|
+
import { isRateLimited, isTransientServiceFailure, notATickerSymbol, rateLimitedError } from "../sources/provider-errors";
|
|
5
5
|
import { listingSuffixCandidate } from "../sources/listing-symbols";
|
|
6
6
|
import { looksLikeCurrencyPair } from "../utils/currency-pair";
|
|
7
7
|
import { canonicalExchange } from "../utils/exchanges";
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
loadBareVenues,
|
|
24
24
|
notTradedMessage,
|
|
25
25
|
oneWordCompanyName,
|
|
26
|
+
tokyoCompanyNameArg,
|
|
26
27
|
parseListingArg,
|
|
27
28
|
quoteBareListing,
|
|
28
29
|
readShareClassCode,
|
|
@@ -36,7 +37,7 @@ import {
|
|
|
36
37
|
type ListingDataRequest,
|
|
37
38
|
type ListingVenue,
|
|
38
39
|
} from "./listing-arg";
|
|
39
|
-
import { withListingSuggestion } from "./not-a-ticker";
|
|
40
|
+
import { isNotATickerMessage, withListingSuggestion } from "./not-a-ticker";
|
|
40
41
|
import { notATickerWords } from "./company-name-hint";
|
|
41
42
|
import { isNetworkFailure } from "../utils/network-failure";
|
|
42
43
|
import { logFailure } from "../utils/log-failure";
|
|
@@ -66,7 +67,11 @@ export interface QuoteAnswer {
|
|
|
66
67
|
/** The listing the row is: the one asked for, or the venue a bare symbol was quoted on. */
|
|
67
68
|
listing: CliListing;
|
|
68
69
|
/** Why there is no quote, when there is more to say than the source's own error. */
|
|
69
|
-
failure?: {
|
|
70
|
+
failure?: {
|
|
71
|
+
message: string; details?: string; oneLine: string;
|
|
72
|
+
/** Several companies list the symbol and it went to none: a choice between live listings, not a dead symbol. */
|
|
73
|
+
choose?: boolean;
|
|
74
|
+
};
|
|
70
75
|
notes: string[];
|
|
71
76
|
/**
|
|
72
77
|
* Lines about another listing than the row's, printed under the table
|
|
@@ -96,7 +101,11 @@ export async function answerQuote(
|
|
|
96
101
|
refresh: boolean,
|
|
97
102
|
venues: Promise<ListingVenue[]> | null,
|
|
98
103
|
/** The row prints what its move is from: a quote asked for again is dated too. */
|
|
99
|
-
{ datesChangeBasis = false
|
|
104
|
+
{ datesChangeBasis = false, indexForm = null }: {
|
|
105
|
+
datesChangeBasis?: boolean;
|
|
106
|
+
/** The symbol's index form, already on its way (`indexFormRead`); asked for here when none is. */
|
|
107
|
+
indexForm?: IndexFormRead | null;
|
|
108
|
+
} = {},
|
|
100
109
|
): Promise<QuoteAnswer> {
|
|
101
110
|
const root = listing.exchange ? null : indexRootFor(listing.symbol);
|
|
102
111
|
// A bare root that quoted something else, such as MOVE (Corvex), points at the index too.
|
|
@@ -128,6 +137,9 @@ export async function answerQuote(
|
|
|
128
137
|
}
|
|
129
138
|
// No answer from the data service: no venue lookup or other listing would get one either.
|
|
130
139
|
if (isNetworkFailure(result.error)) return { result, listing, notes: [] };
|
|
140
|
+
// "Not a ticker" is the service's answer that no listing carries the symbol: its ^ form is the last thing to ask, and
|
|
141
|
+
// it need not wait for the venue search that is still out.
|
|
142
|
+
if (indexForm && isNotATickerMessage(errorMessage(result.error))) indexForm().catch(logFailure("cli.quote-answer", "Start a symbol's index form failed", null));
|
|
131
143
|
const notTraded = await notTradedMessage(listing, market);
|
|
132
144
|
if (notTraded) return { result, listing, failure: { message: notTraded, oneLine: notTraded }, notes: [] };
|
|
133
145
|
if (!isNoProviderError(result.error)) return { result, listing, notes: [] };
|
|
@@ -145,7 +157,16 @@ export async function answerQuote(
|
|
|
145
157
|
const named = !listing.exchange && listing.typed ? await serviceNamedCompany(listing.typed, market) : null;
|
|
146
158
|
const meant = named ? await answerNamedListing(named, market, request, refresh, datesChangeBasis) : null;
|
|
147
159
|
if (meant) return meant;
|
|
148
|
-
|
|
160
|
+
// A search turned away (busy twice, or at the request limit) leaves the row with that reason, never "Not a ticker";
|
|
161
|
+
// the limit's row says when to try again, and is not asked again.
|
|
162
|
+
let other: Awaited<ReturnType<typeof quoteBareListing>>;
|
|
163
|
+
try {
|
|
164
|
+
other = await quoteBareListing(listing, market, request, { refresh, datesChangeBasis });
|
|
165
|
+
} catch (error) {
|
|
166
|
+
if (isRateLimited(error)) return { result: { ...result, error: rateLimitedError(error, listing.symbol) }, listing, notes: [] };
|
|
167
|
+
if (!isTransientServiceFailure(error)) throw error;
|
|
168
|
+
return { result: { ...result, error, transient: true }, listing, notes: [] };
|
|
169
|
+
}
|
|
149
170
|
if (other?.kind === "quoted") {
|
|
150
171
|
return {
|
|
151
172
|
result: { target: other.listing.request, quote: other.quote },
|
|
@@ -165,7 +186,7 @@ export async function answerQuote(
|
|
|
165
186
|
if (!other && tryLines.length === 0) {
|
|
166
187
|
// ^GSPC typed in Windows' cmd.exe arrives as GSPC, the shell taking ^ for its escape character: said once no company
|
|
167
188
|
// of that name and no listing abroad answers for it, so a symbol listed abroad is still quoted. A known root (VIX) has its own line.
|
|
168
|
-
const caret = root ? null : await caretIndexLine(listing, result, market);
|
|
189
|
+
const caret = root ? null : await caretIndexLine(listing, result, indexForm ?? indexFormRead(listing, market, null));
|
|
169
190
|
if (caret) return { result, listing, failure: { message: caret, oneLine: caret }, notes: [] };
|
|
170
191
|
return await answerCompanyName(result, listing, market, request, refresh, datesChangeBasis)
|
|
171
192
|
?? { result: await withCurrencyPairHint(result, market), listing, notes: [] };
|
|
@@ -177,7 +198,7 @@ export async function answerQuote(
|
|
|
177
198
|
other ? `${other.heading}: ${other.listings.join(", ")}.` : "",
|
|
178
199
|
...tryLines,
|
|
179
200
|
].filter(Boolean).join(" ");
|
|
180
|
-
return { result, listing, failure: { message, details, oneLine }, notes: [] };
|
|
201
|
+
return { result, listing, failure: { message, details, oneLine, ...other?.choose ? { choose: true } : {} }, notes: [] };
|
|
181
202
|
}
|
|
182
203
|
|
|
183
204
|
/**
|
|
@@ -219,7 +240,8 @@ async function answerCompanyName(
|
|
|
219
240
|
const notATicker = !!notATickerSymbol(errorMessage(result.error) ?? "");
|
|
220
241
|
const unsettled = !notATicker && isUnsettledNoProvider(result.error);
|
|
221
242
|
if (!notATicker && !unsettled) return null;
|
|
222
|
-
|
|
243
|
+
// A name in kanji alone the service names no company for (中電工) may be a Tokyo company's whole name.
|
|
244
|
+
const named = await oneWordCompanyName(listing.typed, market) ?? (notATicker ? await tokyoCompanyNameArg(listing.typed) : null);
|
|
223
245
|
// A real ticker a source failed to quote is not a company's name, even when the company carries the word.
|
|
224
246
|
if (!named || (unsettled && named.symbol.toUpperCase() === listing.symbol.toUpperCase())) return null;
|
|
225
247
|
const answer = await answerNamedListing(named, market, request, refresh, datesChangeBasis);
|
|
@@ -341,6 +363,28 @@ export async function requireQuotedListing(
|
|
|
341
363
|
/** A bare symbol that may be an index's without its ^: letters, then letters or digits. */
|
|
342
364
|
const CARETLESS_INDEX = /^[A-Z][A-Z0-9]{1,9}$/;
|
|
343
365
|
|
|
366
|
+
/** The quote of a bare symbol's ^ form, read once however many ask: the first call starts the read, the rest get its answer. */
|
|
367
|
+
export type IndexFormRead = () => Promise<Quote | null>;
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* The read of a bare symbol's index form (GSPC for ^GSPC), or null for a listing that has none: a venue named or saved,
|
|
371
|
+
* a known index root (VIX has its own line), a symbol no index is written as.
|
|
372
|
+
*
|
|
373
|
+
* With the symbol's venues (`loadBareVenues`), the read starts as soon as they come back empty: no listing carries
|
|
374
|
+
* the symbol, so the answer will be that it is not a ticker and the ^ form is the one thing left to ask, which then
|
|
375
|
+
* goes beside the quote the service has not answered yet instead of after it. A symbol some venue lists asks only
|
|
376
|
+
* when its answer needs it.
|
|
377
|
+
*/
|
|
378
|
+
export function indexFormRead(listing: CliListing, market: MarketContext, venues: Promise<ListingVenue[]> | null): IndexFormRead | null {
|
|
379
|
+
if (listing.exchange || listing.saved || !CARETLESS_INDEX.test(listing.symbol) || indexRootFor(listing.symbol)) return null;
|
|
380
|
+
let read: Promise<Quote | null> | null = null;
|
|
381
|
+
const start: IndexFormRead = () => read ??= Promise.resolve().then(() => market.dataProvider.getQuote(`^${listing.symbol}`, ""))
|
|
382
|
+
.catch(logFailure("cli.quote-answer", "Quote a symbol's index form failed", null));
|
|
383
|
+
const kick = () => { start().catch(logFailure("cli.quote-answer", "Start a symbol's index form failed", null)); };
|
|
384
|
+
venues?.then((found) => { if (found.length === 0) kick(); }).catch(logFailure("cli.quote-answer", "Read a symbol's venues for its index form failed", null));
|
|
385
|
+
return start;
|
|
386
|
+
}
|
|
387
|
+
|
|
344
388
|
/**
|
|
345
389
|
* "Not a ticker: GSPC. Did you mean ^GSPC (S&P 500)? Try "^GSPC"." for a
|
|
346
390
|
* bare symbol that is not a ticker while its ^ form is an index: cmd.exe
|
|
@@ -348,11 +392,10 @@ const CARETLESS_INDEX = /^[A-Z][A-Z0-9]{1,9}$/;
|
|
|
348
392
|
* GSPC, and search would offer Goldman's preferreds for it. Null for any
|
|
349
393
|
* other symbol, a named venue, and when the ^ form quotes no index.
|
|
350
394
|
*/
|
|
351
|
-
async function caretIndexLine(listing: CliListing, result: QuoteBatchResult,
|
|
352
|
-
if (
|
|
395
|
+
async function caretIndexLine(listing: CliListing, result: QuoteBatchResult, indexForm: IndexFormRead | null): Promise<string | null> {
|
|
396
|
+
if (!indexForm) return null;
|
|
353
397
|
const index = `^${listing.symbol}`;
|
|
354
|
-
const quote = await
|
|
355
|
-
.catch(logFailure("cli.quote-answer", "Quote a symbol's index form failed", null));
|
|
398
|
+
const quote = await indexForm();
|
|
356
399
|
if (!quote || quote.instrumentType?.trim().toUpperCase() !== "INDEX") return null;
|
|
357
400
|
const said = notATickerSymbol(errorMessage(result.error) ?? "") ? `Not a ticker: ${listing.symbol}.` : `${listing.symbol} has no quote.`;
|
|
358
401
|
return `${said} Did you mean ${index}${quote.name ? ` (${quote.name})` : ""}? Try "${index}".`;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { QuoteBatchResult, QuoteSubscriptionTarget } from "../types/data-provider";
|
|
2
|
+
import { isRateLimited, isTransientServiceFailure } from "../sources/provider-errors";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Waits before each new ask for a list's rows that failed for a reason that
|
|
6
|
+
* says nothing of the symbol. Two: a busy moment passes within them, and a
|
|
7
|
+
* list still refused after them is done within ten seconds, each row saying why.
|
|
8
|
+
*/
|
|
9
|
+
const QUOTE_RETRY_WAITS_MS: readonly number[] = [2_000, 6_000];
|
|
10
|
+
|
|
11
|
+
/** Lists longer than this say how far they have got while they are slow. */
|
|
12
|
+
export const QUOTE_PROGRESS_MIN_SYMBOLS = 50;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Whether a row's failure says nothing of its symbol, so asked again in a
|
|
16
|
+
* moment it may be quoted: a source failed rather than answered (`transient`,
|
|
17
|
+
* which the router sets for a timeout or a refusal behind its bare "No quote
|
|
18
|
+
* provider available"), or the data service could not be reached, did not
|
|
19
|
+
* answer or was busy. A source's own reason (Not a ticker, a delisting) is an
|
|
20
|
+
* answer and is kept, and so is the request limit: asked again is more of
|
|
21
|
+
* what it refused, so its row says when to try.
|
|
22
|
+
*/
|
|
23
|
+
function isTransientQuoteFailure({ error, transient }: Pick<QuoteBatchResult, "error" | "transient">): boolean {
|
|
24
|
+
return error != null && !isRateLimited(error) && (transient === true || isTransientServiceFailure(error));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* A list is asked for this many symbols at a time, a few asks in flight, so it
|
|
29
|
+
* says how far it has got as each ask comes back: the service takes up to a
|
|
30
|
+
* hundred from a signed-out caller.
|
|
31
|
+
*/
|
|
32
|
+
const QUOTE_LIST_CHUNK = 100;
|
|
33
|
+
const QUOTE_LIST_CHUNKS_IN_FLIGHT = 3;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* A list's quotes, its rows that failed for a reason that says nothing of the
|
|
37
|
+
* symbol (`isTransientQuoteFailure`) asked for again after each wait, so a
|
|
38
|
+
* busy moment never marks a listing that trades as having no quote. A row
|
|
39
|
+
* still failing after the last wait keeps the latest reason it was given.
|
|
40
|
+
* Rows come back in the order of `targets`, each the target it was asked as.
|
|
41
|
+
* `onSettled` is told of each row once it is final, as the ask it came in
|
|
42
|
+
* returns: answered, refused for its own reason, or failing after the last
|
|
43
|
+
* wait.
|
|
44
|
+
*/
|
|
45
|
+
export async function quotesWithRetries(
|
|
46
|
+
targets: QuoteSubscriptionTarget[],
|
|
47
|
+
ask: (targets: QuoteSubscriptionTarget[]) => Promise<QuoteBatchResult[]>,
|
|
48
|
+
{
|
|
49
|
+
waitsMs = QUOTE_RETRY_WAITS_MS,
|
|
50
|
+
chunkSize = QUOTE_LIST_CHUNK,
|
|
51
|
+
onRetry,
|
|
52
|
+
onSettled,
|
|
53
|
+
}: {
|
|
54
|
+
waitsMs?: readonly number[];
|
|
55
|
+
chunkSize?: number;
|
|
56
|
+
/** Told before each new ask, with how many rows and how long it waits first. */
|
|
57
|
+
onRetry?: (count: number, waitMs: number) => void;
|
|
58
|
+
/** Told of an ask's rows that are final, each with its place in `targets`. */
|
|
59
|
+
onSettled?: (settled: Array<{ result: QuoteBatchResult; index: number }>) => void;
|
|
60
|
+
} = {},
|
|
61
|
+
): Promise<QuoteBatchResult[]> {
|
|
62
|
+
const results: QuoteBatchResult[] = [];
|
|
63
|
+
const transient = (result: QuoteBatchResult) => !result.quote && isTransientQuoteFailure(result);
|
|
64
|
+
const askInChunks = async (asked: number[], last: boolean): Promise<void> => {
|
|
65
|
+
const chunks: number[][] = [];
|
|
66
|
+
for (let at = 0; at < asked.length; at += chunkSize) chunks.push(asked.slice(at, at + chunkSize));
|
|
67
|
+
let next = 0;
|
|
68
|
+
await Promise.all(Array.from({ length: Math.min(QUOTE_LIST_CHUNKS_IN_FLIGHT, chunks.length) }, async () => {
|
|
69
|
+
while (next < chunks.length) {
|
|
70
|
+
const chunk = chunks[next++]!;
|
|
71
|
+
const answered = await ask(chunk.map((index) => targets[index]!));
|
|
72
|
+
const rows = chunk.flatMap((index, at) => answered[at] ? [{ result: answered[at]!, index }] : []);
|
|
73
|
+
for (const { result, index } of rows) results[index] = result;
|
|
74
|
+
onSettled?.(last ? rows : rows.filter(({ result }) => !transient(result)));
|
|
75
|
+
}
|
|
76
|
+
}));
|
|
77
|
+
};
|
|
78
|
+
await askInChunks(targets.map((_target, index) => index), waitsMs.length === 0);
|
|
79
|
+
for (const [attempt, waitMs] of waitsMs.entries()) {
|
|
80
|
+
const failed = targets.flatMap((_target, index) => results[index] && transient(results[index]!) ? [index] : []);
|
|
81
|
+
if (failed.length === 0) break;
|
|
82
|
+
onRetry?.(failed.length, waitMs);
|
|
83
|
+
await new Promise((resolve) => setTimeout(resolve, waitMs));
|
|
84
|
+
await askInChunks(failed, attempt === waitsMs.length - 1);
|
|
85
|
+
}
|
|
86
|
+
return results.filter(Boolean);
|
|
87
|
+
}
|
package/src/cli/report-tables.ts
CHANGED
|
@@ -97,7 +97,8 @@ type Cell =
|
|
|
97
97
|
/** `unit`: what the column draws a number of this row in, so a missing figure still names its unit. */
|
|
98
98
|
| { kind: "blank"; unit?: string }
|
|
99
99
|
| { kind: "text"; text: string; time?: boolean }
|
|
100
|
-
|
|
100
|
+
/** `drawn`: the value and the number the text drew for it, whose scale the whole column decides (`columnScale`). */
|
|
101
|
+
| { kind: "number"; value: number; unit: string; drawn?: { value: number; display: DisplayNumber } }
|
|
101
102
|
/** Text that may read as a number, once the whole column is known. */
|
|
102
103
|
| { kind: "textual"; text: string };
|
|
103
104
|
|
|
@@ -192,16 +193,50 @@ function readDisplay(value: string): DisplayNumber | typeof BLANK_DISPLAY | null
|
|
|
192
193
|
* with its sign turned (a short position as a negative amount) exports it as
|
|
193
194
|
* drawn, every digit, not the rounded figure read back.
|
|
194
195
|
*/
|
|
195
|
-
function valueAsDrawn(value: number, drawn: DisplayNumber): number | null {
|
|
196
|
-
const
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
196
|
+
function valueAsDrawn(value: number, drawn: DisplayNumber, scales: readonly number[] = SIGNED_SCALES): number | null {
|
|
197
|
+
const scale = scales.find((entry) => fitsDrawn(value, drawn, entry));
|
|
198
|
+
return scale === undefined ? null : exportNumber(value * scale);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/** Each display scale, then each with the sign turned, in the order a value is read by. */
|
|
202
|
+
const SIGNED_SCALES = [...DISPLAY_SCALES, ...DISPLAY_SCALES.map((scale) => -scale)];
|
|
203
|
+
|
|
204
|
+
/** Whether a value times a signed scale is the number drawn, to its last digit. */
|
|
205
|
+
function fitsDrawn(value: number, drawn: DisplayNumber, scale: number): boolean {
|
|
206
|
+
return Math.abs(value * scale - Number(drawn.number)) <= drawn.step * (1 + 1e-9) + Number.EPSILON;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* The one scale a column's values are drawn at, decided from all of them,
|
|
211
|
+
* one row's column too: a value near zero fits several (a spread of 0.0013
|
|
212
|
+
* drawn "+0.1" is within a step of itself as of 100 times itself), and read
|
|
213
|
+
* alone it would export at another scale than the rows beside it (0.0013
|
|
214
|
+
* beside 0.8586). Of the scales most values fit, the one whose values come
|
|
215
|
+
* closest to the figures drawn, in steps; the earlier in `SIGNED_SCALES` on a
|
|
216
|
+
* tie. A figure drawn as 0 says nothing of the scale (0.04 drawn "0" is
|
|
217
|
+
* nearer still at a hundredth of itself), so it is left out of the distance.
|
|
218
|
+
* Null for a column with no value drawn as a number.
|
|
219
|
+
*/
|
|
220
|
+
function columnScale(cells: readonly Cell[]): number | null {
|
|
221
|
+
const drawn = cells.flatMap((cell) => cell.kind === "number" && cell.drawn ? [cell.drawn] : []);
|
|
222
|
+
let best: { scale: number; fits: number; miss: number } | null = null;
|
|
223
|
+
for (const scale of SIGNED_SCALES) {
|
|
224
|
+
const fitting = drawn.filter((entry) => fitsDrawn(entry.value, entry.display, scale));
|
|
225
|
+
if (fitting.length === 0) continue;
|
|
226
|
+
const scaled = fitting.filter(({ display }) => Number(display.number) !== 0);
|
|
227
|
+
const miss = scaled.reduce((total, { value, display }) => total + Math.abs(value * scale - Number(display.number)) / display.step, 0) / Math.max(1, scaled.length);
|
|
228
|
+
if (!best || fitting.length > best.fits || (fitting.length === best.fits && miss < best.miss - 1e-9)) best = { scale, fits: fitting.length, miss };
|
|
203
229
|
}
|
|
204
|
-
return null;
|
|
230
|
+
return best?.scale ?? null;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/** The column's cells, each value drawn as a number exported at the column's one scale where it fits it. */
|
|
234
|
+
function atColumnScale(cells: Cell[]): Cell[] {
|
|
235
|
+
const scale = columnScale(cells);
|
|
236
|
+
if (scale == null) return cells;
|
|
237
|
+
return cells.map((cell) => cell.kind === "number" && cell.drawn && fitsDrawn(cell.drawn.value, cell.drawn.display, scale)
|
|
238
|
+
? { ...cell, value: exportNumber(cell.drawn.value * scale) }
|
|
239
|
+
: cell);
|
|
205
240
|
}
|
|
206
241
|
|
|
207
242
|
function timeCell(instant: number, dateOnly: boolean, shown: string | null, raw?: string): Cell {
|
|
@@ -220,13 +255,13 @@ function numberCell(value: number, shown: string | null, key: string | undefined
|
|
|
220
255
|
if (drawn === BLANK_DISPLAY) return BLANK;
|
|
221
256
|
// "3M" drawn from 3 is a tenor or a code, not three million.
|
|
222
257
|
if (drawn && BARE_SCALED.test(shown) && value === Number(shown.replace(/[kKMBT]$/, ""))) return text(shown);
|
|
223
|
-
if (drawn) return { kind: "number", value: valueAsDrawn(value, drawn) ?? Number(drawn.number), unit: drawn.unit };
|
|
258
|
+
if (drawn) return { kind: "number", value: valueAsDrawn(value, drawn) ?? Number(drawn.number), unit: drawn.unit, drawn: { value, display: drawn } };
|
|
224
259
|
// A time drawn as a date or a clock.
|
|
225
260
|
if (isEpochMilliseconds(value)) return timeCell(value, false, shown);
|
|
226
261
|
const [first, ...rest] = shown.split(/\s+/);
|
|
227
262
|
const lead = rest.length > 0 && CHANGE_NOTE.test(rest.join(" ")) ? readDisplay(first!) : null;
|
|
228
263
|
const scaled = lead && lead !== BLANK_DISPLAY ? valueAsDrawn(value, lead) : null;
|
|
229
|
-
if (lead && lead !== BLANK_DISPLAY && scaled != null) return { kind: "number", value: scaled, unit: lead.unit };
|
|
264
|
+
if (lead && lead !== BLANK_DISPLAY && scaled != null) return { kind: "number", value: scaled, unit: lead.unit, drawn: { value, display: lead } };
|
|
230
265
|
return text(shown);
|
|
231
266
|
}
|
|
232
267
|
|
|
@@ -288,7 +323,8 @@ function exportCell(raw: unknown, display: string | null, key?: string): Cell {
|
|
|
288
323
|
* becomes a number only beside other figures, never in a column of tenors
|
|
289
324
|
* ("3M, 6M, 1Y"). Identifier columns keep their text.
|
|
290
325
|
*/
|
|
291
|
-
function resolveColumn(header: string,
|
|
326
|
+
function resolveColumn(header: string, column: Cell[], parseText: boolean): ResolvedColumn {
|
|
327
|
+
const cells = atColumnScale(column);
|
|
292
328
|
const textual = cells.flatMap((cell) => cell.kind === "textual" ? [cell] : []);
|
|
293
329
|
const read = parseText ? textual.map((cell) => readDisplay(cell.text)) : [];
|
|
294
330
|
const numeric = read.filter((entry): entry is DisplayNumber => entry != null && entry !== BLANK_DISPLAY);
|
|
@@ -623,6 +659,27 @@ function sectionByTitle(tables: readonly CliReportTable[], wanted: string): CliR
|
|
|
623
659
|
return starting[0];
|
|
624
660
|
}
|
|
625
661
|
|
|
662
|
+
/**
|
|
663
|
+
* The report with a row for each listing a list left out (a pair with no options of its own, a listing abroad where
|
|
664
|
+
* the data covers US listings only), added to its first table that has a Symbol and a status column: the symbol, its
|
|
665
|
+
* reason in status, the figures empty, so every symbol asked for has a row, as `fn` help says a missing figure's
|
|
666
|
+
* reason goes in status. A report with no such table is as it was.
|
|
667
|
+
*/
|
|
668
|
+
export function withRefusedRows(report: CliReportTables, refused: ReadonlyArray<{ symbol: string; reason: string }> | undefined): CliReportTables {
|
|
669
|
+
if (!refused?.length) return report;
|
|
670
|
+
const at = report.tables.findIndex((table) => table.columns.some((column) => column.toLowerCase() === "symbol")
|
|
671
|
+
&& table.columns.some((column) => column === "status" || column === "value_status"));
|
|
672
|
+
if (at < 0) return report;
|
|
673
|
+
const table = report.tables[at]!;
|
|
674
|
+
const symbolAt = table.columns.findIndex((column) => column.toLowerCase() === "symbol");
|
|
675
|
+
const statusAt = table.columns.findIndex((column) => column === "status" || column === "value_status");
|
|
676
|
+
const rows = refused.map(({ symbol, reason }) => table.columns.map((_column, index) => index === symbolAt ? symbol : index === statusAt ? reason : ""));
|
|
677
|
+
const rowIdentities = [...table.rowIdentities ?? table.rows.map(() => undefined), ...refused.map(({ symbol }) => ({ symbolOrSeries: symbol, asOf: null }))];
|
|
678
|
+
const tables = [...report.tables];
|
|
679
|
+
tables[at] = { ...table, rows: [...table.rows, ...rows], rowIdentities };
|
|
680
|
+
return { ...report, tables };
|
|
681
|
+
}
|
|
682
|
+
|
|
626
683
|
/**
|
|
627
684
|
* `--section`: one table, by its title or the start of it (any case), or its
|
|
628
685
|
* 1-based position. Without a selector the report keeps every table.
|
package/src/cli/result.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MISSING_VALUE } from "../utils/format";
|
|
1
2
|
import type { CliGlobalOptions } from "./options";
|
|
2
3
|
import {
|
|
3
4
|
cliPlainEnabled,
|
|
@@ -264,7 +265,7 @@ function formatTextValue(
|
|
|
264
265
|
depth = 0,
|
|
265
266
|
width: number | null = null,
|
|
266
267
|
): string {
|
|
267
|
-
const missing = context === "record" ? cliPlainEnabled() ?
|
|
268
|
+
const missing = context === "record" ? cliPlainEnabled() ? MISSING_VALUE : cliStyles.muted(MISSING_VALUE) : "";
|
|
268
269
|
if (value == null || value === "") return missing;
|
|
269
270
|
// Times print in UTC with the zone named, never in the host's zone; JSON and CSV keep the raw value.
|
|
270
271
|
if (value instanceof Date) return formatUtcTime(value);
|
|
@@ -676,6 +677,25 @@ export function exitLeavingReadsBehind(): void {
|
|
|
676
677
|
}, LEFT_BEHIND_EXIT_MS).unref();
|
|
677
678
|
}
|
|
678
679
|
|
|
680
|
+
/** A result whose rows' "Not a ticker: US10Y." cells carry the hint `hinted` gives the sentence. */
|
|
681
|
+
function withHintedCells<T>(result: CliResult<T>, hinted: (text: string) => string): CliResult<T> {
|
|
682
|
+
if (!Array.isArray(result.data)) return result;
|
|
683
|
+
let changed = false;
|
|
684
|
+
const data = result.data.map((row: unknown) => {
|
|
685
|
+
if (!row || typeof row !== "object" || Array.isArray(row)) return row;
|
|
686
|
+
let next = row as Record<string, unknown>;
|
|
687
|
+
for (const [key, value] of Object.entries(row)) {
|
|
688
|
+
if (typeof value !== "string" || !value.includes("Not a ticker: ")) continue;
|
|
689
|
+
const hint = hinted(value);
|
|
690
|
+
if (hint === value) continue;
|
|
691
|
+
next = { ...next, [key]: hint };
|
|
692
|
+
changed = true;
|
|
693
|
+
}
|
|
694
|
+
return next;
|
|
695
|
+
});
|
|
696
|
+
return changed ? { ...result, data: data as T } : result;
|
|
697
|
+
}
|
|
698
|
+
|
|
679
699
|
export function printCliResult<T, Row extends Record<string, unknown> = Record<string, unknown>>(
|
|
680
700
|
result: CliResult<T>,
|
|
681
701
|
options: CliGlobalOptions,
|
|
@@ -686,11 +706,14 @@ export function printCliResult<T, Row extends Record<string, unknown> = Record<s
|
|
|
686
706
|
if (options.quiet && options.format === "text") return;
|
|
687
707
|
// JSON keeps the router's own words; everything else is for a person, so a "Not a ticker" gets its hint.
|
|
688
708
|
const hinted = (text: string) => options.format === "json" ? text : withSearchHints(text, args, isFredSeries);
|
|
709
|
+
// A CSV's status cell is where its row says why, so it gets the hint the warning line has: a cell ends in a comma,
|
|
710
|
+
// which the text's sentence search does not take for the sentence's end.
|
|
711
|
+
const cells = options.format === "csv" ? withHintedCells(result, hinted) : result;
|
|
689
712
|
// An export `--output` names is drawn for the file (no colour), and held for the command's end to write.
|
|
690
713
|
const toFile = options.output !== undefined && options.format !== "text";
|
|
691
714
|
const serialized = hinted(toFile
|
|
692
|
-
? renderForFile(() => serializeCliResult(
|
|
693
|
-
: serializeCliResult(
|
|
715
|
+
? renderForFile(() => serializeCliResult(cells, options, renderOptions))
|
|
716
|
+
: serializeCliResult(cells, options, renderOptions));
|
|
694
717
|
// A CSV's closing source and note lines go to stderr with the warnings: in the file they are rows of junk to a spreadsheet.
|
|
695
718
|
const { csv, footer } = options.format === "csv" ? splitCsvFooter(serialized) : { csv: serialized, footer: [] };
|
|
696
719
|
const output = csv;
|
package/src/cli/symbol-list.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { readFile } from "fs/promises";
|
|
2
2
|
import { fstatSync } from "fs";
|
|
3
|
-
import { splitSymbolArgLines, splitSymbolWords, stripStrayEdges, uniqueSymbols } from "./symbol-args";
|
|
3
|
+
import { splitSymbolArgLines, splitSymbolWords, stripStrayEdges, symbolInputKey, uniqueSymbols } from "./symbol-args";
|
|
4
4
|
import { foldTypedText } from "../utils/typed-text";
|
|
5
5
|
import { hasDecimalCommas, isFigure, isJunkCell, isNumberCell, isSheetErrorCell, protectFigureCommas, restoreFigureCommas } from "./symbol-cells";
|
|
6
|
-
import { endsInLegalForm, readTerminalListingCode, unknownBloombergMarket } from "../tickers/terminal-codes";
|
|
6
|
+
import { endsInLegalForm, readTerminalListingCode, unknownBloombergMarket, unreadBloombergCode } from "../tickers/terminal-codes";
|
|
7
7
|
|
|
8
8
|
/** Header cells that name a spreadsheet's symbol column, compared without case, spaces or punctuation. */
|
|
9
9
|
const SYMBOL_HEADERS = new Set(["symbol", "symbols", "ticker", "tickers", "code", "stockcode", "securitycode", "instrument"]);
|
|
@@ -153,7 +153,7 @@ function looksLikeSymbol(cell: string): boolean {
|
|
|
153
153
|
*/
|
|
154
154
|
function isTerminalCodeCell(cell: string): boolean {
|
|
155
155
|
return /\s/.test(cell.trim()) && !endsInLegalForm(cell)
|
|
156
|
-
&& (readTerminalListingCode(cell) != null || unknownBloombergMarket(cell) != null);
|
|
156
|
+
&& (readTerminalListingCode(cell) != null || unknownBloombergMarket(cell) != null || unreadBloombergCode(cell) != null);
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
/** A numeric exchange code as a grid holds one (`2007`, `0700`, `600519`): Hong Kong, Tokyo, Shanghai. Shorter is a quantity. */
|
|
@@ -420,6 +420,8 @@ export interface SymbolListSource {
|
|
|
420
420
|
* words, each a symbol.
|
|
421
421
|
*/
|
|
422
422
|
readEntries?: (entries: string[]) => Promise<string[]>;
|
|
423
|
+
/** Given, gets each line of the file and standard input as typed (`TypedForm`), for a command whose rows name them. */
|
|
424
|
+
typedForms?: TypedForm[];
|
|
423
425
|
}
|
|
424
426
|
|
|
425
427
|
export class SymbolListError extends Error {
|
|
@@ -456,6 +458,7 @@ export async function readSymbolList(source: SymbolListSource): Promise<{ symbol
|
|
|
456
458
|
const strays = new Set<string>(stripStrayEdges(typedArgs.join(" ")).notes);
|
|
457
459
|
const ignored: string[] = [];
|
|
458
460
|
const headers: string[] = [];
|
|
461
|
+
const typedForms = source.typedForms ?? [];
|
|
459
462
|
const addCells = async ({ symbols, ignored: beside, entries: whole, header }: SymbolText) => {
|
|
460
463
|
if (header) headers.push(`Skipped the first row as a header: ${listCells(header)}.`);
|
|
461
464
|
const cells = symbols.map((cell) => {
|
|
@@ -476,13 +479,37 @@ export async function readSymbolList(source: SymbolListSource): Promise<{ symbol
|
|
|
476
479
|
const code = (error as NodeJS.ErrnoException).code;
|
|
477
480
|
throw new SymbolListError(code === "ENOENT" ? `No file at ${source.file}.` : `Could not read ${source.file}: ${error instanceof Error ? error.message : String(error)}`);
|
|
478
481
|
}
|
|
482
|
+
typedForms.push(...typedLines(text));
|
|
479
483
|
await addCells(parseSymbolText(foldTypedText(text)));
|
|
480
484
|
}
|
|
481
485
|
if (wantsStdin || (typed.length === 0 && source.file == null && (source.stdinPiped ?? stdinIsPiped()))) {
|
|
482
|
-
|
|
486
|
+
const text = await readStdin();
|
|
487
|
+
typedForms.push(...typedLines(text));
|
|
488
|
+
await addCells(parseSymbolText(foldTypedText(text)));
|
|
483
489
|
}
|
|
484
490
|
// A number where a symbol goes (a line of prices, a typed 1.899) is left out with those typed beside a symbol.
|
|
485
491
|
const numbers = [...figures, ...collected.filter(isNumberCell)];
|
|
486
492
|
const notes = [ignoredCellsNote(ignored), ignoredNumbersNote(numbers)].filter((note): note is string => !!note);
|
|
487
493
|
return { ...uniqueSymbols(collected.filter((symbol) => !isNumberCell(symbol))), notes: [...headers, ...strays, ...notes] };
|
|
488
494
|
}
|
|
495
|
+
|
|
496
|
+
/** A line of a list as typed, before full-width letters and case were folded, and the entry it reads as. */
|
|
497
|
+
export interface TypedForm {
|
|
498
|
+
typed: string;
|
|
499
|
+
/** The entry the line reads as, its repeats' key (`symbolInputKey`): `USDJPY` and `usdjpy` are both `USDJPY`'s. */
|
|
500
|
+
key: string;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* Each line of a list's text that is one entry, as typed and in order, an exact repeat too, with the key of the entry
|
|
505
|
+
* it reads as: so a command can give every line its row and say which line of a sheet each row is, where several
|
|
506
|
+
* were read as one entry.
|
|
507
|
+
*/
|
|
508
|
+
function typedLines(text: string): TypedForm[] {
|
|
509
|
+
return text.split(/\r?\n/).flatMap((line) => {
|
|
510
|
+
const typed = line.trim();
|
|
511
|
+
const key = symbolInputKey(stripStrayEdges(foldTypedText(typed)).text);
|
|
512
|
+
if (!typed || !key) return [];
|
|
513
|
+
return [{ typed, key }];
|
|
514
|
+
});
|
|
515
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { UnreadBloombergCode } from "../tickers/terminal-codes";
|
|
2
|
+
import { isCurrencyCode } from "../utils/currency-pair";
|
|
3
|
+
import { METAL_FRONT_MONTH, METAL_NAMES } from "./fx-quote-rate";
|
|
4
|
+
import { treasuryYieldHint, treasuryYieldTenor } from "./treasury-yields";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The government yield curves the catalog charts (`CAP:bond-yield:<curve>-<tenor>`), by the
|
|
8
|
+
* currency Bloomberg's generic bond codes name (GTJPY10Y) or the root of its benchmark index
|
|
9
|
+
* (GJGB10, GDBR10, GUKG10, GCAN10YR), with the country the line names.
|
|
10
|
+
*/
|
|
11
|
+
const YIELD_CURVES: ReadonlyArray<{ curve: string; country: string; currencies: readonly string[]; index: RegExp }> = [
|
|
12
|
+
{ curve: "jp", country: "Japan's", currencies: ["JPY"], index: /^GJGB(\d{1,2})$/ },
|
|
13
|
+
{ curve: "de", country: "Germany's", currencies: ["DEM", "EUR"], index: /^GDBR(\d{1,2})$/ },
|
|
14
|
+
{ curve: "gb", country: "the UK's", currencies: ["GBP"], index: /^GUKG(\d{1,2})$/ },
|
|
15
|
+
{ curve: "ca", country: "Canada's", currencies: ["CAD"], index: /^GCAN(\d{1,2})YR$/ },
|
|
16
|
+
{ curve: "mx", country: "Mexico's", currencies: ["MXN"], index: /^GMXN(\d{1,2})YR$/ },
|
|
17
|
+
{ curve: "br", country: "Brazil's", currencies: ["BRL"], index: /^GEBR(\d{1,2})Y$/ },
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
/** Bloomberg's generic government bond code: GT, the currency, the tenor in years (GTJPY10Y, GTUSD2Y, GTDEM10YR). */
|
|
21
|
+
const GENERIC_BOND = /^GT([A-Z]{3})(\d{1,2})YR?$/;
|
|
22
|
+
|
|
23
|
+
/** The yield a Bloomberg bond code or benchmark index names, as the catalog series that charts it; null for any other. */
|
|
24
|
+
function yieldLine(code: string): string | null {
|
|
25
|
+
const bond = GENERIC_BOND.exec(code);
|
|
26
|
+
const [currency, years] = bond ? [bond[1]!, bond[2]!] : [null, null];
|
|
27
|
+
if (currency === "USD") {
|
|
28
|
+
const tenor = treasuryYieldTenor(`${Number(years)}y`);
|
|
29
|
+
return tenor ? treasuryYieldHint(tenor) : null;
|
|
30
|
+
}
|
|
31
|
+
for (const { curve, country, currencies, index } of YIELD_CURVES) {
|
|
32
|
+
const tenor = currency && currencies.includes(currency) ? years : index.exec(code)?.[1];
|
|
33
|
+
if (tenor) return `${country} ${Number(tenor)}-year government yield: gloom fn G CAP:bond-yield:${curve}-${Number(tenor)}y.`;
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** "Spot gold is not quoted; GC=F is the front-month future.", for XAU, XAUUSD and XAUJPY. */
|
|
39
|
+
function metalLine(code: string): string | null {
|
|
40
|
+
const metal = Object.keys(METAL_FRONT_MONTH).find((symbol) => code === symbol || (code.startsWith(symbol) && /^[A-Z]{3}$/.test(code.slice(3))));
|
|
41
|
+
return metal ? `Spot ${METAL_NAMES[metal]!.toLowerCase()} is not quoted; ${METAL_FRONT_MONTH[metal]} is the front-month future.` : null;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** The pair a currency code starts with (USDJPY of `USDJPY BGN`, `USDJPYV1M`), or null. */
|
|
45
|
+
function pairOf(code: string): { base: string; quote: string } | null {
|
|
46
|
+
const pair = /^([A-Z]{3})([A-Z]{3})/.exec(code);
|
|
47
|
+
if (!pair || pair[1] === pair[2] || !isCurrencyCode(pair[1]!) || !isCurrencyCode(pair[2]!)) return null;
|
|
48
|
+
return { base: pair[1]!, quote: pair[2]! };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Why a line written as a Bloomberg code that names nothing here
|
|
53
|
+
* (`unreadBloombergCode`) is not quoted, and what has it instead: a
|
|
54
|
+
* government bond's yield series, the Treasury yield an index is, the future
|
|
55
|
+
* spot gold is priced from, a pair's spot rate beside its forwards and vols.
|
|
56
|
+
* Starts with the line as typed, so a list's note names it once.
|
|
57
|
+
*/
|
|
58
|
+
export function unreadBloombergCodeMessage(read: UnreadBloombergCode): string {
|
|
59
|
+
const { typed, code, yellowKey } = read;
|
|
60
|
+
const root = code.split(" ")[0]!;
|
|
61
|
+
if (yellowKey === "Govt" || yellowKey === "Index") {
|
|
62
|
+
const tenor = /^USGG/.test(root) ? treasuryYieldTenor(root) : null;
|
|
63
|
+
if (tenor) return `${typed} is Bloomberg's US ${tenor.label} Treasury yield, which has no quote here. ${treasuryYieldHint(tenor)}`;
|
|
64
|
+
const line = yieldLine(root);
|
|
65
|
+
if (yellowKey === "Govt") {
|
|
66
|
+
return `${typed} is Bloomberg's code for a government bond, which is not quoted here. ${line
|
|
67
|
+
?? "Government yields: gloom catalog \"10Y government bond\"; US Treasuries: gloom fred DGS10."}`;
|
|
68
|
+
}
|
|
69
|
+
if (line) return `${typed} is Bloomberg's benchmark yield index, which has no quote here. ${line}`;
|
|
70
|
+
return `${typed} is a Bloomberg index code no symbol here is read from. Try gloom search ${root}.`;
|
|
71
|
+
}
|
|
72
|
+
if (yellowKey === "Curncy") {
|
|
73
|
+
const metal = metalLine(root);
|
|
74
|
+
if (metal) return `${typed}: ${metal}`;
|
|
75
|
+
const pair = pairOf(root);
|
|
76
|
+
if (pair) {
|
|
77
|
+
return `${typed} is not quoted here: Bloomberg's ${pair.base}/${pair.quote} forwards, option volatilities, risk reversals and pricing sources `
|
|
78
|
+
+ `are not carried. ${pair.base}/${pair.quote} spot: gloom quote ${pair.base}${pair.quote}=X.`;
|
|
79
|
+
}
|
|
80
|
+
return `${typed} is a Bloomberg currency code no symbol here is read from. Try gloom search ${root}.`;
|
|
81
|
+
}
|
|
82
|
+
return `${typed} is a Bloomberg commodity code no future here is rooted at. Try gloom search ${root.replace(/\d+$/, "")}.`;
|
|
83
|
+
}
|
|
@@ -61,6 +61,7 @@ import { NotASymbolError, notASymbolError } from "./symbol-cells";
|
|
|
61
61
|
import { kindFromListingSyntax } from "../tickers/instrument-kind";
|
|
62
62
|
import { classifyInstrumentKind, normalizeTickerSymbol } from "../tickers/search/ranking";
|
|
63
63
|
import { companyNameQueries, findFormerIssuerOfName, isCompanyNameInput, settledTerminalCode } from "../tickers/company-name-listing";
|
|
64
|
+
import { unreadBloombergCode } from "../tickers/terminal-codes";
|
|
64
65
|
|
|
65
66
|
/** The saved ticker for a symbol (`SAN:EPA`, or `SAN` with `--exchange EPA`), saving it from search first if needed. */
|
|
66
67
|
export async function resolveTickerForCli(
|
|
@@ -615,7 +616,7 @@ function listLookupPlan(input: string, exchange: string | undefined): ListLookup
|
|
|
615
616
|
if (notASymbolError(input)) return { searches: [], changes: null };
|
|
616
617
|
// A terminal's code abroad (`VOD LN`) is its listing as written: it asks only for its quote.
|
|
617
618
|
const code = settledTerminalCode(input);
|
|
618
|
-
if (code) return { searches: [], changes: null };
|
|
619
|
+
if (code || unreadBloombergCode(input)) return { searches: [], changes: null };
|
|
619
620
|
// A company's name searches what its reading searched (`readNameEntries`), answered by the same batch.
|
|
620
621
|
if (isCompanyNameInput(input)) return { searches: companyNameQueries(input), changes: null };
|
|
621
622
|
try {
|
|
@@ -67,6 +67,11 @@ export function treasuryYieldTenor(text: string): TreasuryYieldTenor | null {
|
|
|
67
67
|
return named || (!/\s/.test(typed) && YEAR_UNITS.has(unit)) ? tenor : null;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
/** FRED's Treasury yield series typed where a ticker goes (DGS10): no ticker search finds them. */
|
|
71
|
+
export function isTreasuryFredSeries(id: string): boolean {
|
|
72
|
+
return [...TENORS.values()].some((tenor) => tenor.fred === id);
|
|
73
|
+
}
|
|
74
|
+
|
|
70
75
|
/** The commands with the yield: its Cboe index when there is one, its FRED series, the curve. */
|
|
71
76
|
function yieldCommands(tenor: TreasuryYieldTenor): Array<readonly [command: string, gives: string]> {
|
|
72
77
|
return [
|
|
@@ -74,7 +74,7 @@ function keepApart<T extends LabelPlacement>(sorted: readonly T[], gap: number):
|
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* The cursor and anchor badges print over the flow text, so every label they
|
|
77
|
-
* touch, with
|
|
77
|
+
* touch, with blank cells either side, is blanked whole rather than leaving
|
|
78
78
|
* its ends around the badge. A single fixed-width axis text is split by its
|
|
79
79
|
* tick spans; evenly spread labels each count as one.
|
|
80
80
|
*/
|
|
@@ -235,8 +235,11 @@ export function StaticXAxisLabels({
|
|
|
235
235
|
const left = fractionalViewport ? ratio * width - label.length / 2 : extraMarkerLeft(label, ratio);
|
|
236
236
|
badgeSpans.push([left, left + label.length]);
|
|
237
237
|
}
|
|
238
|
+
// Two blank cells in the terminal: with one, a tick read as part of the
|
|
239
|
+
// crosshair's date (`2021 2023-12-25`, review, 12 Nov 2026).
|
|
240
|
+
const badgeClearance = isDesktop ? 1 : 2;
|
|
238
241
|
const clearOfBadges = (start: number, end: number) => badgeSpans.every(([badgeStart, badgeEnd]) => (
|
|
239
|
-
end +
|
|
242
|
+
end + badgeClearance <= badgeStart || start >= badgeEnd + badgeClearance
|
|
240
243
|
));
|
|
241
244
|
const placedPositionedLabels = visiblePositionedLabels.flatMap((entry, index) => {
|
|
242
245
|
const ratio = clampRatio(entry.ratio);
|
|
@@ -1109,6 +1109,7 @@ function ThemedCompositeChart({
|
|
|
1109
1109
|
drawColor={drawColor}
|
|
1110
1110
|
showColors={isDrawingTool(armedTool) || !!selectedDrawingId}
|
|
1111
1111
|
levelTool={levelsEditable}
|
|
1112
|
+
maxWidth={plotWidth}
|
|
1112
1113
|
pinned={chartLayout.toolbarPinned === true}
|
|
1113
1114
|
onTogglePinned={() => {
|
|
1114
1115
|
pressFromPointer();
|