@gloom-sh/terminal 0.20.12 → 0.20.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -1
- package/patches/@opentui%2Fcore@0.3.2.patch +22 -4
- package/src/account/auth-dialog.tsx +22 -4
- package/src/account/auth-form.tsx +6 -1
- package/src/account/billing.ts +3 -2
- package/src/account/checkout-handoff.tsx +7 -14
- package/src/account/device-signin-dialog.tsx +35 -24
- package/src/account/upgrade-dialog.tsx +8 -8
- package/src/api-client/crypto-markets.ts +10 -0
- package/src/api-client/errors.ts +3 -1
- package/src/api-client/index.ts +10 -2
- package/src/api-client/install-experiments.ts +146 -0
- package/src/api-client/money-markets.ts +7 -0
- package/src/api-client/request.ts +12 -2
- package/src/api-client/telemetry.ts +47 -0
- package/src/api-client/types/market.ts +4 -0
- package/src/api-client/types/news.ts +16 -0
- package/src/architecture/floating-promise-allowlist.json +17 -34
- package/src/brokers/signed-in/adapter.ts +2 -2
- package/src/brokers/signed-in/catalog.ts +13 -4
- package/src/brokers/signed-in/sign-in-dialog.tsx +38 -38
- package/src/cli/commands/market.ts +146 -55
- package/src/cli/commands/overview.ts +21 -7
- package/src/cli/commands/search.ts +103 -9
- package/src/cli/commands/ticker.ts +22 -13
- package/src/cli/earnings-calendar.ts +33 -53
- package/src/cli/errors.ts +3 -1
- package/src/cli/freshness.ts +7 -2
- package/src/cli/glossary.ts +10 -5
- package/src/cli/helpers.ts +8 -16
- package/src/cli/history-export.ts +4 -0
- package/src/cli/history-rows.ts +18 -1
- package/src/cli/known-gaps.ts +11 -2
- package/src/cli/listing-arg.ts +183 -28
- package/src/cli/not-a-ticker.ts +4 -0
- package/src/cli/pane-functions/catalog.ts +81 -12
- package/src/cli/pane-functions/dom.ts +8 -1
- package/src/cli/pane-functions/freshness.ts +2 -2
- package/src/cli/pane-functions/headless.ts +13 -10
- package/src/cli/pane-functions/index.ts +1 -1
- package/src/cli/pane-functions/options.ts +7 -0
- package/src/cli/pane-functions/report.ts +4 -1
- package/src/cli/pane-functions/resolver.ts +61 -15
- package/src/cli/perpetual-contract.ts +4 -4
- package/src/cli/quote-answer.ts +6 -2
- package/src/cli/result.ts +24 -5
- package/src/cli/symbol-args.ts +5 -3
- package/src/cli/symbol-list.ts +23 -10
- package/src/cli/symbol-rows.ts +135 -3
- package/src/cli/treasury-yields.ts +15 -1
- package/src/components/chart/composite/axis-overlays.tsx +5 -2
- package/src/components/chart/composite/composite-chart.tsx +1 -0
- package/src/components/chart/composite/format.ts +103 -16
- package/src/components/chart/composite/legend.tsx +60 -25
- package/src/components/chart/composite/panel-surface/axis-markers.ts +133 -0
- package/src/components/chart/composite/panel-surface/level-labels.tsx +78 -0
- package/src/components/chart/composite/panel-surface/overlays.ts +108 -0
- package/src/components/chart/composite/panel-surface/pan-coast.ts +54 -0
- package/src/components/chart/composite/panel-surface/panel-cursor.tsx +138 -0
- package/src/components/chart/composite/panel-surface/panel-levels.ts +47 -0
- package/src/components/chart/composite/panel-surface/plot-gestures.ts +403 -0
- package/src/components/chart/composite/panel-surface/plot-pointer.ts +65 -0
- package/src/components/chart/composite/panel-surface/plot-wheel.ts +102 -0
- package/src/components/chart/composite/panel-surface/pointer.ts +12 -0
- package/src/components/chart/composite/panel-surface/props.ts +79 -0
- package/src/components/chart/composite/panel-surface/tool-readout.ts +151 -0
- package/src/components/chart/composite/panel-surface/value-axis-gestures.ts +152 -0
- package/src/components/chart/composite/panel-surface.tsx +81 -1177
- package/src/components/chart/composite/time-axis.ts +51 -29
- package/src/components/chart/composite/toolbar.tsx +42 -6
- package/src/components/chart/curve/curve-surface.tsx +5 -5
- package/src/components/command-bar/commands/collection-list.ts +1 -0
- package/src/components/command-bar/list/badge.ts +8 -5
- package/src/components/command-bar/list/model.ts +0 -5
- package/src/components/command-bar/list/view.tsx +39 -2
- package/src/components/command-bar/routes/root/plugin-install.ts +4 -2
- package/src/components/command-bar/routes/root/provider-search.ts +23 -3
- package/src/components/command-bar/routes/root/results.ts +23 -11
- package/src/components/command-bar/routes/root/runtime.ts +3 -2
- package/src/components/command-bar/routes/root/selection.ts +3 -2
- package/src/components/command-bar/routes/root/shortcuts.ts +15 -0
- package/src/components/command-bar/routes/root/start-here.ts +1 -2
- package/src/components/command-bar/routes/ticker-search/actions.ts +2 -3
- package/src/components/command-bar/routes/ticker-search/results.ts +23 -4
- package/src/components/data-table/view.tsx +29 -6
- package/src/components/form-modal/host.tsx +1 -1
- package/src/components/layout/header.tsx +3 -2
- package/src/components/layout/market-summary.ts +3 -3
- package/src/components/layout/pane/error-boundary.tsx +2 -1
- package/src/components/layout/pane/title.ts +10 -4
- package/src/components/markdown-text.tsx +36 -0
- package/src/components/market-board/index.tsx +4 -3
- package/src/components/onboarding/first-run-workspace.ts +46 -11
- package/src/components/onboarding/onboarding-keyboard.ts +57 -5
- package/src/components/onboarding/onboarding-wizard.tsx +91 -24
- package/src/components/onboarding/portfolio-step/index.tsx +1 -0
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +36 -9
- package/src/components/onboarding/portfolio-step/types.ts +2 -0
- package/src/components/onboarding/tickers-step-model.ts +140 -0
- package/src/components/onboarding/tickers-step.tsx +116 -0
- package/src/components/onboarding/use-onboarding-broker-form.ts +1 -1
- package/src/components/onboarding/use-onboarding-progress.ts +100 -11
- package/src/components/onboarding/use-onboarding-upgrade.ts +3 -2
- package/src/components/onboarding/wizard-model.ts +3 -1
- package/src/components/onboarding/wizard-tickers.ts +139 -0
- package/src/components/pane-settings-dialog/tui.tsx +6 -3
- package/src/components/pane-settings-dialog.tsx +2 -1
- package/src/components/pane-template-wizard.tsx +2 -0
- package/src/components/price-performance.tsx +2 -2
- package/src/components/speedometer-gauge/model.ts +2 -1
- package/src/components/speedometer-gauge/terminal.tsx +13 -8
- package/src/components/ui/choice-dialog.tsx +102 -33
- package/src/components/ui/confirm-dialog.tsx +3 -2
- package/src/components/ui/frame.tsx +7 -3
- package/src/components/ui/icon.tsx +4 -2
- package/src/components/ui/list-view.tsx +8 -0
- package/src/components/ui/multi-select/dialog.tsx +1 -7
- package/src/components/ui/not-meaningful.ts +16 -0
- package/src/components/ui/number-prompt-dialog.tsx +2 -1
- package/src/components/ui/query-bar.tsx +16 -4
- package/src/components/ui/stat-grid.tsx +27 -6
- package/src/components/use-pane-notice-footer.tsx +3 -1
- package/src/data/config/store/normalize.ts +2 -0
- package/src/docs/snapshot.json +3 -3
- package/src/i18n/es.ts +6 -2
- package/src/i18n/ja.ts +6 -2
- package/src/i18n/ko.ts +6 -2
- package/src/i18n/zh-cn.ts +6 -2
- package/src/i18n/zh-tw.ts +6 -2
- package/src/layout-marketplace/model.ts +2 -1
- package/src/market-data/futures-contract.ts +2 -1
- package/src/market-data/hooks.tsx +1 -1
- package/src/market-data/market/change-basis.ts +27 -5
- package/src/market-data/market/format.ts +48 -14
- package/src/market-data/quotes/contributions.ts +13 -0
- package/src/market-data/quotes/export-identity.ts +36 -1
- package/src/market-data/quotes/listing-enterprise-value.ts +3 -3
- package/src/market-data/quotes/resolution.ts +16 -0
- package/src/market-data/quotes/time.ts +17 -10
- package/src/market-data/tax-equivalent.ts +3 -2
- package/src/news/aggregator.ts +19 -8
- package/src/news/hooks.ts +1 -1
- package/src/news/news-model.ts +49 -0
- package/src/news/types.ts +9 -0
- package/src/plugins/builtin/account-management/calendar-tab.tsx +8 -3
- package/src/plugins/builtin/account-management/pane.tsx +9 -8
- package/src/plugins/builtin/account-management/password-dialog.tsx +2 -2
- package/src/plugins/builtin/alerts/calendar-events.ts +4 -5
- package/src/plugins/builtin/alerts/format.ts +6 -5
- package/src/plugins/builtin/alerts/headless.ts +3 -2
- package/src/plugins/builtin/alerts/history.ts +2 -1
- package/src/plugins/builtin/alerts/pane.tsx +2 -1
- package/src/plugins/builtin/alerts/price-text.ts +2 -1
- package/src/plugins/builtin/alerts/scheduled.ts +6 -5
- package/src/plugins/builtin/analytics/account-returns.ts +6 -7
- package/src/plugins/builtin/analytics/display.ts +2 -1
- package/src/plugins/builtin/analytics/pane-model.ts +5 -9
- package/src/plugins/builtin/analytics/risk-client.ts +12 -2
- package/src/plugins/builtin/analytics/risk-headless.ts +66 -6
- package/src/plugins/builtin/analytics/risk-math.ts +23 -6
- package/src/plugins/builtin/analytics/risk-model.ts +26 -15
- package/src/plugins/builtin/analytics/risk-pane.tsx +8 -7
- package/src/plugins/builtin/analytics/view.tsx +5 -5
- package/src/plugins/builtin/attention/model.ts +6 -5
- package/src/plugins/builtin/attention/pane.tsx +5 -4
- package/src/plugins/builtin/awards/detail.tsx +5 -4
- package/src/plugins/builtin/awards/headless.ts +8 -7
- package/src/plugins/builtin/awards/model.ts +4 -3
- package/src/plugins/builtin/awards/pane.tsx +4 -4
- package/src/plugins/builtin/backtest/format.ts +3 -2
- package/src/plugins/builtin/backtest/report.ts +3 -2
- package/src/plugins/builtin/bond-calculator/headless.ts +2 -1
- package/src/plugins/builtin/bond-calculator/pane.tsx +2 -1
- package/src/plugins/builtin/broker-manager/add-flow.tsx +1 -1
- package/src/plugins/builtin/broker-trading/orders-data.ts +3 -3
- package/src/plugins/builtin/broker-trading/orders.tsx +3 -2
- package/src/plugins/builtin/broker-trading/ticket.tsx +2 -2
- package/src/plugins/builtin/buildout/cells.tsx +2 -1
- package/src/plugins/builtin/buildout/company/pane.tsx +4 -3
- package/src/plugins/builtin/buildout/data-runtime.ts +21 -23
- package/src/plugins/builtin/buildout/detail/values.ts +2 -1
- package/src/plugins/builtin/buildout/format.ts +4 -3
- package/src/plugins/builtin/buildout/pane/index.tsx +3 -3
- package/src/plugins/builtin/catalysts/detail.tsx +2 -1
- package/src/plugins/builtin/catalysts/model.ts +6 -5
- package/src/plugins/builtin/catalysts/pane.tsx +2 -1
- package/src/plugins/builtin/cds/headless.ts +3 -2
- package/src/plugins/builtin/cds/model.ts +8 -8
- package/src/plugins/builtin/cds/pane.tsx +3 -2
- package/src/plugins/builtin/central-bank-rates/headless.ts +2 -1
- package/src/plugins/builtin/central-bank-rates/model.ts +3 -2
- package/src/plugins/builtin/central-bank-rates/pane.tsx +5 -5
- package/src/plugins/builtin/changelog/index.tsx +2 -2
- package/src/plugins/builtin/chart-composer/catalog-inventory.ts +5 -2
- package/src/plugins/builtin/chart-composer/editor.tsx +1 -0
- package/src/plugins/builtin/chart-composer/index.tsx +4 -2
- package/src/plugins/builtin/chart-composer/pane.tsx +8 -4
- package/src/plugins/builtin/chart-composer/quick-add.tsx +4 -1
- package/src/plugins/builtin/chart-composer/series-catalog.ts +17 -1
- package/src/plugins/builtin/chart-composer/use-series-catalog.ts +3 -1
- package/src/plugins/builtin/chart-composer/user-series.ts +3 -1
- package/src/plugins/builtin/chat/attachments/desktop.tsx +2 -1
- package/src/plugins/builtin/chat/controller/utils.ts +2 -1
- package/src/plugins/builtin/clinical-trials/model.ts +4 -3
- package/src/plugins/builtin/clinical-trials/sponsor-tickers.ts +4 -2
- package/src/plugins/builtin/cloud/askg/lock-note.ts +16 -4
- package/src/plugins/builtin/cloud/askg/model.ts +2 -1
- package/src/plugins/builtin/cloud/askg/pane.tsx +35 -1
- package/src/plugins/builtin/cloud/company-picker.tsx +1 -3
- package/src/plugins/builtin/cloud/plugin.tsx +2 -0
- package/src/plugins/builtin/cloud/team/pane.tsx +12 -12
- package/src/plugins/builtin/cloud/thesis/detail.tsx +13 -8
- package/src/plugins/builtin/cloud/thesis/module.tsx +2 -0
- package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +6 -2
- package/src/plugins/builtin/cloud-tweets/model.ts +2 -2
- package/src/plugins/builtin/comment-letters/pane.tsx +2 -1
- package/src/plugins/builtin/commodity-balances/headless.ts +3 -2
- package/src/plugins/builtin/company-attention/app-rank.tsx +5 -4
- package/src/plugins/builtin/company-attention/building-model.ts +7 -7
- package/src/plugins/builtin/company-attention/headless.ts +6 -5
- package/src/plugins/builtin/company-attention/model.ts +4 -4
- package/src/plugins/builtin/company-attention/moves-model.ts +9 -9
- package/src/plugins/builtin/company-attention/signals-model.ts +9 -9
- package/src/plugins/builtin/company-kpis/headless.ts +2 -1
- package/src/plugins/builtin/company-kpis/model.ts +15 -10
- package/src/plugins/builtin/company-kpis/pane.tsx +2 -2
- package/src/plugins/builtin/congress-trades/detail.tsx +6 -5
- package/src/plugins/builtin/congress-trades/headless.ts +2 -1
- package/src/plugins/builtin/congress-trades/model.ts +6 -6
- package/src/plugins/builtin/congress-trades/table.tsx +7 -6
- package/src/plugins/builtin/connections/pane.tsx +5 -5
- package/src/plugins/builtin/correlation/headless.ts +2 -2
- package/src/plugins/builtin/correlation/index.tsx +4 -1
- package/src/plugins/builtin/correlation/matrix/selection.ts +2 -1
- package/src/plugins/builtin/correlation/relationship/view-model.ts +3 -3
- package/src/plugins/builtin/cot/headless.ts +3 -2
- package/src/plugins/builtin/cot/model.ts +2 -1
- package/src/plugins/builtin/cot/pane.tsx +4 -3
- package/src/plugins/builtin/cpi/headless.ts +10 -4
- package/src/plugins/builtin/cpi/model.ts +25 -7
- package/src/plugins/builtin/cpi/pane.tsx +3 -1
- package/src/plugins/builtin/credit-boards/cdx-pane.tsx +5 -4
- package/src/plugins/builtin/credit-boards/headless.ts +2 -1
- package/src/plugins/builtin/credit-boards/model.ts +5 -5
- package/src/plugins/builtin/credit-conditions/headless.ts +2 -1
- package/src/plugins/builtin/credit-conditions/index.tsx +2 -2
- package/src/plugins/builtin/credit-documents/model.ts +2 -2
- package/src/plugins/builtin/crypto-board/client.ts +6 -1
- package/src/plugins/builtin/crypto-board/defi-view.tsx +7 -7
- package/src/plugins/builtin/crypto-board/defi.ts +2 -2
- package/src/plugins/builtin/crypto-board/headless.ts +10 -2
- package/src/plugins/builtin/crypto-board/model.ts +93 -14
- package/src/plugins/builtin/crypto-board/pane.tsx +28 -13
- package/src/plugins/builtin/crypto-board/supply.ts +2 -2
- package/src/plugins/builtin/crypto-etf-flows/model.ts +4 -4
- package/src/plugins/builtin/custom-view/index.tsx +3 -1
- package/src/plugins/builtin/custom-view/pane.tsx +5 -1
- package/src/plugins/builtin/custom-view/view-spec.ts +11 -0
- package/src/plugins/builtin/debt-maturities/model.ts +3 -3
- package/src/plugins/builtin/debt-maturities/pane.tsx +2 -2
- package/src/plugins/builtin/dividend-yield/client.ts +31 -5
- package/src/plugins/builtin/dividend-yield/headless.ts +20 -13
- package/src/plugins/builtin/dividend-yield/pane.tsx +12 -10
- package/src/plugins/builtin/dividend-yield/ranking-view.tsx +4 -1
- package/src/plugins/builtin/dividend-yield/ranking.ts +21 -12
- package/src/plugins/builtin/dividend-yield/types.ts +4 -0
- package/src/plugins/builtin/dividend-yield/view.ts +8 -4
- package/src/plugins/builtin/docs/use-docs.ts +4 -2
- package/src/plugins/builtin/doe/headless.ts +2 -1
- package/src/plugins/builtin/doe/model.ts +12 -11
- package/src/plugins/builtin/earnings/board-model.ts +14 -8
- package/src/plugins/builtin/earnings/board-table.ts +13 -8
- package/src/plugins/builtin/earnings/calendar-model.ts +5 -5
- package/src/plugins/builtin/earnings/calendar.tsx +2 -1
- package/src/plugins/builtin/earnings/format.ts +16 -14
- package/src/plugins/builtin/earnings/headless.ts +57 -19
- package/src/plugins/builtin/earnings/history-model.ts +11 -7
- package/src/plugins/builtin/earnings/history-table.ts +22 -9
- package/src/plugins/builtin/earnings/history.tsx +4 -3
- package/src/plugins/builtin/earnings-calls/calendar.tsx +2 -1
- package/src/plugins/builtin/earnings-calls/format.ts +6 -5
- package/src/plugins/builtin/earnings-calls/upcoming.ts +5 -5
- package/src/plugins/builtin/earnings-ripple/headless.ts +2 -1
- package/src/plugins/builtin/earnings-ripple/index.tsx +2 -0
- package/src/plugins/builtin/earnings-ripple/model.ts +3 -2
- package/src/plugins/builtin/earnings-ripple/pane.tsx +6 -6
- package/src/plugins/builtin/econ/calendar-model.ts +19 -3
- package/src/plugins/builtin/econ/detail-view.tsx +2 -2
- package/src/plugins/builtin/econ/fred-catalog.ts +33 -4
- package/src/plugins/builtin/econ/index.tsx +7 -6
- package/src/plugins/builtin/econ-statistics/detail.tsx +2 -1
- package/src/plugins/builtin/econ-statistics/headless.ts +25 -4
- package/src/plugins/builtin/econ-statistics/pane.tsx +2 -2
- package/src/plugins/builtin/equity-screener/headless.ts +5 -5
- package/src/plugins/builtin/equity-screener/model.ts +6 -4
- package/src/plugins/builtin/equity-screener/pane.tsx +7 -7
- package/src/plugins/builtin/equity-screener/screen-check.ts +2 -1
- package/src/plugins/builtin/equity-screener/ticker-check.tsx +2 -1
- package/src/plugins/builtin/estimate-revisions/model.ts +3 -2
- package/src/plugins/builtin/estimate-revisions/pane.tsx +8 -8
- package/src/plugins/builtin/executives/format.ts +4 -4
- package/src/plugins/builtin/exposure/headless.ts +8 -8
- package/src/plugins/builtin/exposure/model.ts +4 -3
- package/src/plugins/builtin/exposure/pane.tsx +6 -5
- package/src/plugins/builtin/fear-greed/format.ts +7 -7
- package/src/plugins/builtin/fear-greed/headless.ts +2 -1
- package/src/plugins/builtin/filing-events/feed.ts +2 -1
- package/src/plugins/builtin/futures/table.tsx +8 -8
- package/src/plugins/builtin/futures-curve/headless.ts +18 -18
- package/src/plugins/builtin/futures-curve/model.ts +5 -5
- package/src/plugins/builtin/futures-curve/pane.tsx +8 -8
- package/src/plugins/builtin/fx-matrix/index.tsx +2 -2
- package/src/plugins/builtin/fx-matrix/pairs.ts +2 -1
- package/src/plugins/builtin/gpu/board.tsx +6 -5
- package/src/plugins/builtin/gpu/changes.tsx +2 -1
- package/src/plugins/builtin/gpu/equities.tsx +2 -2
- package/src/plugins/builtin/gpu/headless.ts +4 -3
- package/src/plugins/builtin/gpu/model.ts +8 -7
- package/src/plugins/builtin/help/functions-table.tsx +41 -9
- package/src/plugins/builtin/help/index.tsx +6 -3
- package/src/plugins/builtin/help/keybindings-editor.tsx +35 -7
- package/src/plugins/builtin/help/shortcut-table.tsx +19 -7
- package/src/plugins/builtin/help/table-cells.tsx +51 -0
- package/src/plugins/builtin/holders/pane.tsx +4 -1
- package/src/plugins/builtin/insider/base-values.ts +2 -2
- package/src/plugins/builtin/insider/display.ts +2 -1
- package/src/plugins/builtin/insider/headless.ts +16 -16
- package/src/plugins/builtin/insider/insider-data.ts +2 -1
- package/src/plugins/builtin/insider/signals-model.ts +3 -3
- package/src/plugins/builtin/insider/table-model.ts +27 -13
- package/src/plugins/builtin/insider/table.tsx +1 -1
- package/src/plugins/builtin/ipo-calendar/model.ts +4 -4
- package/src/plugins/builtin/iv-history/format.ts +8 -7
- package/src/plugins/builtin/iv-history/headless.ts +9 -8
- package/src/plugins/builtin/iv-history/pane.tsx +3 -2
- package/src/plugins/builtin/iv-history/screen-pane.tsx +5 -4
- package/src/plugins/builtin/jobs/headless.ts +11 -11
- package/src/plugins/builtin/jobs/model.ts +2 -2
- package/src/plugins/builtin/jobs/pane.tsx +5 -5
- package/src/plugins/builtin/jodi/model.ts +2 -2
- package/src/plugins/builtin/jodi/pane.tsx +2 -1
- package/src/plugins/builtin/kelly-sizer/headless.ts +4 -4
- package/src/plugins/builtin/kelly-sizer/model.ts +2 -1
- package/src/plugins/builtin/kelly-sizer/sections.tsx +2 -2
- package/src/plugins/builtin/macro-day/headless.ts +27 -15
- package/src/plugins/builtin/macro-day/model.ts +42 -4
- package/src/plugins/builtin/macro-day/pane.tsx +30 -12
- package/src/plugins/builtin/macro-day/releases.ts +24 -1
- package/src/plugins/builtin/market-halts/model.ts +11 -10
- package/src/plugins/builtin/market-halts/pane.tsx +2 -1
- package/src/plugins/builtin/market-heatmap/index.tsx +4 -4
- package/src/plugins/builtin/market-movers/session-table.ts +3 -3
- package/src/plugins/builtin/market-movers/session.ts +2 -1
- package/src/plugins/builtin/market-movers/table.ts +5 -5
- package/src/plugins/builtin/market-valuation/detail.tsx +2 -2
- package/src/plugins/builtin/market-valuation/headless.ts +7 -7
- package/src/plugins/builtin/market-valuation/pane.tsx +7 -7
- package/src/plugins/builtin/members/breadth-pane.tsx +5 -4
- package/src/plugins/builtin/members/headless.ts +2 -1
- package/src/plugins/builtin/members/model.ts +3 -2
- package/src/plugins/builtin/members/pane.tsx +10 -9
- package/src/plugins/builtin/mna/distress/model.ts +2 -1
- package/src/plugins/builtin/mna/model.ts +5 -5
- package/src/plugins/builtin/money-markets/client.ts +4 -1
- package/src/plugins/builtin/money-markets/headless.ts +17 -5
- package/src/plugins/builtin/money-markets/index.tsx +1 -1
- package/src/plugins/builtin/money-markets/model.ts +3 -2
- package/src/plugins/builtin/money-markets/pane.tsx +11 -5
- package/src/plugins/builtin/news/headless.ts +5 -2
- package/src/plugins/builtin/news/wire/breaking/notifications.ts +21 -19
- package/src/plugins/builtin/news/wire/news/row.ts +3 -1
- package/src/plugins/builtin/news/wire/news/table.tsx +3 -2
- package/src/plugins/builtin/news/wire/persisted-articles.ts +28 -3
- package/src/plugins/builtin/notes/headless.ts +2 -1
- package/src/plugins/builtin/notes/model.ts +2 -1
- package/src/plugins/builtin/openfda/pane.tsx +4 -3
- package/src/plugins/builtin/options/carry.ts +3 -2
- package/src/plugins/builtin/options/market-reference.ts +2 -1
- package/src/plugins/builtin/options/table.ts +48 -9
- package/src/plugins/builtin/options/view.tsx +47 -17
- package/src/plugins/builtin/options-calculator/headless.ts +3 -2
- package/src/plugins/builtin/options-calculator/pane.tsx +7 -7
- package/src/plugins/builtin/options-positioning/headless.ts +8 -7
- package/src/plugins/builtin/options-positioning/model.ts +10 -10
- package/src/plugins/builtin/options-positioning/pane.tsx +5 -5
- package/src/plugins/builtin/options-scenario/collar.ts +5 -4
- package/src/plugins/builtin/options-scenario/csp-screen-headless.ts +11 -10
- package/src/plugins/builtin/options-scenario/csp-screen-pane.tsx +15 -14
- package/src/plugins/builtin/options-scenario/csp-screen.ts +2 -1
- package/src/plugins/builtin/options-scenario/csp.ts +6 -5
- package/src/plugins/builtin/options-scenario/headless.ts +6 -5
- package/src/plugins/builtin/options-scenario/hedge.ts +3 -3
- package/src/plugins/builtin/options-scenario/pane.tsx +7 -6
- package/src/plugins/builtin/options-scenario/strategy-screen.ts +1 -1
- package/src/plugins/builtin/pe-band/headless.ts +9 -8
- package/src/plugins/builtin/pe-band/pane.tsx +7 -7
- package/src/plugins/builtin/perps/cascade.ts +3 -2
- package/src/plugins/builtin/perps/headless.ts +10 -9
- package/src/plugins/builtin/perps/model.ts +14 -14
- package/src/plugins/builtin/perps/pane.tsx +3 -2
- package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +4 -2
- package/src/plugins/builtin/portfolio-list/cli/period-report.ts +61 -11
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +11 -3
- package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +2 -0
- package/src/plugins/builtin/portfolio-list/header.tsx +2 -2
- package/src/plugins/builtin/portfolio-list/headless.ts +33 -6
- package/src/plugins/builtin/portfolio-list/index.tsx +3 -2
- package/src/plugins/builtin/portfolio-list/pane/futures-terms.ts +4 -2
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +5 -3
- package/src/plugins/builtin/portfolio-list/pane/period-pnl.ts +26 -7
- package/src/plugins/builtin/portfolio-list/pane/purchase-date-fx.ts +4 -2
- package/src/plugins/builtin/portfolio-list/period-pnl.ts +16 -1
- package/src/plugins/builtin/portfolio-list/quick-add/index.tsx +2 -2
- package/src/plugins/builtin/portfolio-list/settings.ts +4 -1
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +8 -5
- package/src/plugins/builtin/portfolio-list/summary/totals.ts +6 -4
- package/src/plugins/builtin/portfolio-list/table.tsx +25 -15
- package/src/plugins/builtin/power/detail.tsx +6 -5
- package/src/plugins/builtin/power/gas-model.ts +8 -7
- package/src/plugins/builtin/power/gas.tsx +2 -1
- package/src/plugins/builtin/power/headless.ts +7 -6
- package/src/plugins/builtin/power/model.ts +3 -2
- package/src/plugins/builtin/power/prices-headless.ts +10 -9
- package/src/plugins/builtin/power/prices-model.ts +3 -2
- package/src/plugins/builtin/power/prices.tsx +2 -1
- package/src/plugins/builtin/primary-dealers/model.ts +3 -3
- package/src/plugins/builtin/primary-dealers/pane.tsx +2 -2
- package/src/plugins/builtin/rate-path/headless.ts +8 -7
- package/src/plugins/builtin/rate-path/model.ts +6 -5
- package/src/plugins/builtin/rate-path/pane.tsx +6 -5
- package/src/plugins/builtin/realized-vol/fx-proxy.ts +2 -1
- package/src/plugins/builtin/realized-vol/headless.ts +11 -10
- package/src/plugins/builtin/realized-vol/pane.tsx +5 -4
- package/src/plugins/builtin/relative-rotation/headless.ts +2 -1
- package/src/plugins/builtin/relative-rotation/pane.tsx +6 -6
- package/src/plugins/builtin/research/analyst-headless.ts +5 -5
- package/src/plugins/builtin/research/analyst-model.ts +7 -7
- package/src/plugins/builtin/research/analyst-pane.tsx +7 -7
- package/src/plugins/builtin/research/client.ts +14 -0
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +40 -30
- package/src/plugins/builtin/research/event-model.ts +55 -22
- package/src/plugins/builtin/research/event-sources.ts +26 -8
- package/src/plugins/builtin/research/relative-valuation-columns.ts +20 -12
- package/src/plugins/builtin/research/relative-valuation-currency.ts +16 -0
- package/src/plugins/builtin/research/relative-valuation-headless.ts +33 -21
- package/src/plugins/builtin/research/relative-valuation-model.ts +31 -17
- package/src/plugins/builtin/research/relative-valuation-pane.tsx +29 -14
- package/src/plugins/builtin/research-search/model.ts +2 -1
- package/src/plugins/builtin/research-search/saved-view.tsx +4 -3
- package/src/plugins/builtin/revenue-breakdown/model.ts +4 -4
- package/src/plugins/builtin/reverse-dcf/headless.ts +7 -7
- package/src/plugins/builtin/reverse-dcf/model.ts +4 -4
- package/src/plugins/builtin/reverse-dcf/pane.tsx +2 -2
- package/src/plugins/builtin/scanner/flow-model.ts +7 -4
- package/src/plugins/builtin/scanner/flow-pane.tsx +1 -1
- package/src/plugins/builtin/scanner/headless.ts +3 -2
- package/src/plugins/builtin/scanner/hilo-model.ts +2 -1
- package/src/plugins/builtin/scanner/live-headless.ts +2 -2
- package/src/plugins/builtin/scanner/live-model.ts +3 -2
- package/src/plugins/builtin/scanner/live-pane.tsx +5 -5
- package/src/plugins/builtin/seasonality/headless.ts +2 -1
- package/src/plugins/builtin/seasonality/pane.tsx +4 -3
- package/src/plugins/builtin/sec/filing-display.tsx +12 -15
- package/src/plugins/builtin/sec/fund-facts.ts +2 -2
- package/src/plugins/builtin/sec/headless.ts +2 -1
- package/src/plugins/builtin/sec/index.tsx +6 -2
- package/src/plugins/builtin/sectors/headless.ts +4 -4
- package/src/plugins/builtin/sectors/index.tsx +7 -7
- package/src/plugins/builtin/shared/cloud-upgrade.ts +4 -2
- package/src/plugins/builtin/shared/cpi-year-gap.ts +67 -0
- package/src/plugins/builtin/shared/earnings-calendar.ts +90 -6
- package/src/plugins/builtin/shared/earnings-report.ts +13 -6
- package/src/plugins/builtin/shared/research-cells.tsx +2 -2
- package/src/plugins/builtin/shared/source-footer.ts +2 -1
- package/src/plugins/builtin/shared/trend.ts +2 -2
- package/src/plugins/builtin/shared/use-quote-board.ts +9 -8
- package/src/plugins/builtin/short-interest/headless.ts +6 -6
- package/src/plugins/builtin/short-interest/model.ts +9 -9
- package/src/plugins/builtin/short-interest/publications-model.ts +5 -5
- package/src/plugins/builtin/short-interest/publications-pane.tsx +3 -2
- package/src/plugins/builtin/short-interest/watch-headless.ts +5 -5
- package/src/plugins/builtin/short-interest/watch-pane.tsx +6 -6
- package/src/plugins/builtin/short-volume/model.ts +5 -5
- package/src/plugins/builtin/short-volume/pane.tsx +4 -4
- package/src/plugins/builtin/social-mentions/headless.ts +2 -1
- package/src/plugins/builtin/social-mentions/model.ts +4 -4
- package/src/plugins/builtin/supply-chain/graph-model.ts +2 -1
- package/src/plugins/builtin/supply-chain/graph-pane.tsx +2 -2
- package/src/plugins/builtin/supply-chain/headless.ts +3 -2
- package/src/plugins/builtin/supply-chain/model.ts +4 -4
- package/src/plugins/builtin/supply-chain/pane.tsx +2 -2
- package/src/plugins/builtin/supply-chain/row-evidence.tsx +2 -1
- package/src/plugins/builtin/themes/headless.ts +2 -1
- package/src/plugins/builtin/themes/model.ts +3 -2
- package/src/plugins/builtin/themes/pane.tsx +3 -2
- package/src/plugins/builtin/thirteenf/format.ts +9 -9
- package/src/plugins/builtin/thirteenf/headless.ts +3 -2
- package/src/plugins/builtin/thirteenf/model.ts +2 -1
- package/src/plugins/builtin/thirteenf/overlap-pane.tsx +2 -1
- package/src/plugins/builtin/thirteenf/pane.tsx +5 -4
- package/src/plugins/builtin/thirteenf/report-notes.ts +2 -1
- package/src/plugins/builtin/thirteenf/signals-pane.tsx +3 -2
- package/src/plugins/builtin/thirteenf/table.ts +6 -5
- package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +45 -2
- package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +4 -3
- package/src/plugins/builtin/ticker-detail/data-panes/historical-prices.tsx +4 -4
- package/src/plugins/builtin/ticker-detail/data-panes/returns-pane.tsx +3 -3
- package/src/plugins/builtin/ticker-detail/financials/model.ts +83 -35
- package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +3 -1
- package/src/plugins/builtin/ticker-detail/financials/ratios.ts +2 -2
- package/src/plugins/builtin/ticker-detail/financials/schema.ts +14 -18
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +8 -13
- package/src/plugins/builtin/ticker-detail/headless.ts +33 -6
- package/src/plugins/builtin/ticker-detail/overview/chart-scale.ts +52 -0
- package/src/plugins/builtin/ticker-detail/overview/components.tsx +8 -9
- package/src/plugins/builtin/ticker-detail/overview/model.ts +28 -14
- package/src/plugins/builtin/ticker-detail/overview/pane.tsx +6 -0
- package/src/plugins/builtin/ticker-detail/overview/tax-equivalent.ts +2 -1
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +43 -9
- package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +7 -5
- package/src/plugins/builtin/ticker-detail/quote-monitor/rows.ts +4 -4
- package/src/plugins/builtin/ticker-detail/settings.ts +17 -0
- package/src/plugins/builtin/time-sales/headless.ts +3 -2
- package/src/plugins/builtin/time-sales/model.ts +7 -5
- package/src/plugins/builtin/time-sales/pane.tsx +7 -6
- package/src/plugins/builtin/trace-bonds/model.ts +3 -2
- package/src/plugins/builtin/trace-bonds/pane.tsx +3 -2
- package/src/plugins/builtin/treasury-auctions/client.ts +2 -1
- package/src/plugins/builtin/treasury-auctions/headless.ts +6 -6
- package/src/plugins/builtin/treasury-auctions/hk-headless.ts +3 -2
- package/src/plugins/builtin/treasury-auctions/hk-view.tsx +10 -9
- package/src/plugins/builtin/treasury-auctions/hk.ts +5 -5
- package/src/plugins/builtin/treasury-auctions/model.ts +4 -4
- package/src/plugins/builtin/treasury-auctions/pane.tsx +18 -18
- package/src/plugins/builtin/treasury-auctions/treasury-direct.ts +2 -1
- package/src/plugins/builtin/treasury-daily/model.ts +2 -2
- package/src/plugins/builtin/vol-surface/events.ts +5 -4
- package/src/plugins/builtin/vol-surface/headless.ts +19 -18
- package/src/plugins/builtin/vol-surface/heat-grid.tsx +2 -1
- package/src/plugins/builtin/vol-surface/pane.tsx +8 -7
- package/src/plugins/builtin/vol-surface/stored.ts +2 -1
- package/src/plugins/builtin/vol-surface/tables.ts +4 -3
- package/src/plugins/builtin/volatility/headless.ts +5 -4
- package/src/plugins/builtin/volatility/pane.tsx +6 -6
- package/src/plugins/builtin/world-indices/headless.ts +7 -7
- package/src/plugins/builtin/world-indices/index.tsx +3 -1
- package/src/plugins/builtin/world-venue-map/headless.ts +2 -1
- package/src/plugins/builtin/world-venue-map/layered-pane.tsx +2 -1
- package/src/plugins/builtin/world-venue-map/layers.ts +3 -2
- package/src/plugins/builtin/world-venue-map/use-geo.ts +4 -2
- package/src/plugins/builtin/yield-curve/curves.ts +3 -3
- package/src/plugins/builtin/yield-curve/headless.ts +7 -6
- package/src/plugins/builtin/yield-curve/index.tsx +5 -4
- package/src/plugins/builtin/yield-curve/swaps.tsx +2 -1
- package/src/portfolio/allocation.ts +5 -5
- package/src/portfolio/collection-name.ts +2 -1
- package/src/portfolio/column-values.ts +61 -45
- package/src/portfolio/futures-positions.ts +2 -1
- package/src/portfolio/listed-symbol.ts +4 -2
- package/src/portfolio/period-pnl.ts +51 -1
- package/src/renderers/dom/dialog-host.tsx +5 -5
- package/src/renderers/electrobun/bun/desktop/backend-requests.ts +7 -1
- package/src/renderers/electrobun/view/remote/capability-invoker.ts +1 -1
- package/src/renderers/opentui/dialog-host.tsx +3 -4
- package/src/renderers/opentui/ui-host.tsx +32 -2
- package/src/renderers/share/layout-view.tsx +2 -1
- package/src/sources/gloomberb-cloud/news.ts +9 -0
- package/src/sources/gloomberb-cloud/normalizers.ts +7 -0
- package/src/sources/provider-router/history.ts +5 -2
- package/src/sources/provider-router/search.ts +15 -10
- package/src/state/hooks/inline-tickers.ts +3 -2
- package/src/state/hooks/quote-streaming.ts +9 -10
- package/src/team/collections-sync.ts +8 -3
- package/src/telemetry/usage-counts.ts +26 -0
- package/src/test-support/plugin-persistence.ts +12 -0
- package/src/tickers/company-name-listing.ts +6 -5
- package/src/tickers/company-name.ts +36 -2
- package/src/tickers/instrument-coverage.ts +27 -0
- package/src/tickers/listing-venues.ts +26 -1
- package/src/tickers/renamed-listings.ts +2 -1
- package/src/tickers/search/home-listing.ts +38 -1
- package/src/tickers/search/index.ts +22 -2
- package/src/tickers/search/ranking.ts +21 -2
- package/src/tickers/starter-symbols.ts +7 -0
- package/src/time-series/base-series.ts +4 -0
- package/src/time-series/fundamentals/statement-fields.ts +11 -14
- package/src/time-series/history-acquisition.ts +1 -1
- package/src/time-series/log-scale.ts +9 -0
- package/src/time-series/reporting.ts +3 -3
- package/src/time-series/resolve.ts +6 -4
- package/src/time-series/transforms.ts +10 -5
- package/src/time-series/types.ts +5 -2
- package/src/types/config.ts +9 -0
- package/src/types/data-provider.ts +3 -2
- package/src/types/financials.ts +28 -0
- package/src/types/headless.ts +2 -0
- package/src/types/instrument.ts +6 -0
- package/src/types/plugin-panes.ts +1 -1
- package/src/types/plugin-reports.ts +8 -0
- package/src/ui/dialog-stack.ts +17 -0
- package/src/ui/dialog.tsx +6 -2
- package/src/utils/crypto-pair.ts +9 -0
- package/src/utils/datetime-format.ts +74 -33
- package/src/utils/exchanges.ts +13 -0
- package/src/utils/financial-statements.ts +98 -17
- package/src/utils/format.ts +4 -9
- package/src/utils/fundamentals.ts +38 -16
- package/src/utils/futures-generic.ts +14 -0
- package/src/utils/growth.ts +67 -0
- package/src/utils/keyboard.ts +6 -0
- package/src/utils/options.ts +1 -1
- package/src/utils/report-timing.ts +2 -2
- package/src/utils/served-rates.ts +45 -0
- package/src/utils/text-wrap.ts +84 -3
- package/src/utils/trailing-dividend.ts +13 -3
- package/src/utils/zoned-date-time.ts +47 -22
|
@@ -7,6 +7,7 @@ import type {
|
|
|
7
7
|
TickerFinancials,
|
|
8
8
|
} from "../../../types/financials";
|
|
9
9
|
import {
|
|
10
|
+
MISSING_VALUE,
|
|
10
11
|
formatDistributionAmount,
|
|
11
12
|
formatCompact,
|
|
12
13
|
formatNumber,
|
|
@@ -18,6 +19,7 @@ import { classifyInstrumentType } from "../../../tickers/instrument-kind";
|
|
|
18
19
|
import { declaredDividends } from "../../../utils/declared-dividends";
|
|
19
20
|
import { isReasonCode, readableStatus } from "../../../utils/reason-codes";
|
|
20
21
|
import { fundamentalsEpsCurrency, SERVED_TRAILING_EPS } from "../../../utils/fundamentals";
|
|
22
|
+
import { isNotMeaningful, NOT_MEANINGFUL, NOT_MEANINGFUL_TEXT, NOT_MEANINGFUL_TONE, type Rate } from "../../../utils/growth";
|
|
21
23
|
import {
|
|
22
24
|
earningsDateStatus,
|
|
23
25
|
earningsDetail,
|
|
@@ -58,6 +60,8 @@ export interface EventRow {
|
|
|
58
60
|
epsEstimate?: number;
|
|
59
61
|
epsDifference?: number;
|
|
60
62
|
surprisePercent?: number;
|
|
63
|
+
/** The surprise is N/M: the estimate was of a loss, or of nothing. */
|
|
64
|
+
surpriseNotMeaningful?: true;
|
|
61
65
|
/** A reported figure's basis, or an upcoming estimate's when it is adjusted; the same quarter is named the same way in ERN. The TTM row's EPS is GAAP. */
|
|
62
66
|
epsBasis?: EpsBasisName;
|
|
63
67
|
/** The reported figure is the company's press release's, provisional until the calendar's replaces it. */
|
|
@@ -72,6 +76,8 @@ export interface EventRow {
|
|
|
72
76
|
estimateGrowthMetric?: "eps" | "revenue";
|
|
73
77
|
/** An estimate row's growth over the year-ago figure, as a fraction, of `estimateGrowthMetric`. */
|
|
74
78
|
estimateGrowth?: number;
|
|
79
|
+
/** The estimate's growth is N/M: its year-ago figure was a loss, or nothing. `estimateGrowth` is then absent. */
|
|
80
|
+
estimateGrowthNotMeaningful?: true;
|
|
75
81
|
fiscalPeriodEnd?: string;
|
|
76
82
|
periodDateSource?: FinancialStatement["dateSource"];
|
|
77
83
|
providerPeriodDate?: string;
|
|
@@ -95,7 +101,7 @@ function formatPeriod(period: string): string {
|
|
|
95
101
|
.replace(/\bcurrent\b/g, "cur")
|
|
96
102
|
.replace(/\bquarter\b/g, "qtr")
|
|
97
103
|
.replace(/\byear\b/g, "yr")
|
|
98
|
-
||
|
|
104
|
+
|| MISSING_VALUE;
|
|
99
105
|
}
|
|
100
106
|
|
|
101
107
|
function isFiscalEstimatePeriod(period: string): boolean {
|
|
@@ -167,15 +173,36 @@ function formatEstimateDetail(pair: EstimatePair): string {
|
|
|
167
173
|
return "Consensus";
|
|
168
174
|
}
|
|
169
175
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
176
|
+
/**
|
|
177
|
+
* An estimate's growth over its year-ago figure: the source's, except off a year-ago figure at or below zero, where
|
|
178
|
+
* it is N/M whatever the source worked out (a loss of 0.40 to a profit of 0.10 is no +125%). Undefined where there is none.
|
|
179
|
+
*/
|
|
180
|
+
function estimateRate(estimate: AnalystEstimateRecord | undefined): Rate | undefined {
|
|
181
|
+
if (!estimate) return undefined;
|
|
182
|
+
const yearAgo = estimate.yearAgo;
|
|
183
|
+
if (typeof yearAgo === "number" && Number.isFinite(yearAgo) && yearAgo <= 0) {
|
|
184
|
+
return typeof estimate.growth === "number" || typeof estimate.average === "number" ? NOT_MEANINGFUL : undefined;
|
|
185
|
+
}
|
|
186
|
+
return typeof estimate.growth === "number" && Number.isFinite(estimate.growth) ? estimate.growth : undefined;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/** The pair's growth, its EPS's where it has one, else its revenue's, and which. */
|
|
190
|
+
function estimatePairGrowth(pair: EstimatePair): { rate: Rate; metric: "eps" | "revenue" } | null {
|
|
191
|
+
const eps = estimateRate(pair.eps);
|
|
192
|
+
if (eps !== undefined) return { rate: eps, metric: "eps" };
|
|
193
|
+
const revenue = estimateRate(pair.revenue);
|
|
194
|
+
return revenue !== undefined ? { rate: revenue, metric: "revenue" } : null;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function estimateTone(growth: Rate | undefined): EventRow["tone"] {
|
|
198
|
+
if (growth === undefined) return "muted";
|
|
199
|
+
if (isNotMeaningful(growth)) return NOT_MEANINGFUL_TONE;
|
|
173
200
|
return growth >= 0 ? "positive" : "negative";
|
|
174
201
|
}
|
|
175
202
|
|
|
176
|
-
function estimateValue(
|
|
177
|
-
|
|
178
|
-
return growth
|
|
203
|
+
function estimateValue(growth: Rate | undefined): string {
|
|
204
|
+
if (isNotMeaningful(growth)) return NOT_MEANINGFUL_TEXT;
|
|
205
|
+
return growth === undefined ? MISSING_VALUE : formatPercent(growth);
|
|
179
206
|
}
|
|
180
207
|
|
|
181
208
|
/**
|
|
@@ -245,7 +272,7 @@ function ttmRow(
|
|
|
245
272
|
epsBasis: eps == null ? undefined : "GAAP",
|
|
246
273
|
annualEps: eps,
|
|
247
274
|
annualRevenue: ttm.totalRevenue,
|
|
248
|
-
value:
|
|
275
|
+
value: MISSING_VALUE,
|
|
249
276
|
tone: "muted",
|
|
250
277
|
};
|
|
251
278
|
}
|
|
@@ -352,8 +379,10 @@ export function buildEventRows(
|
|
|
352
379
|
// A pending announcement must never inherit the previous report's actuals.
|
|
353
380
|
const statement = earning.epsActual == null ? undefined : statementForEarningsDate(quarterlyStatements, earning);
|
|
354
381
|
const surprise = epsSurprise(earning.epsActual, earning.epsEstimate);
|
|
355
|
-
|
|
356
|
-
|
|
382
|
+
// Against a loss or zero estimate no percentage is shown, the source's either.
|
|
383
|
+
const surpriseNotMeaningful = earning.epsActual != null && isNotMeaningful(surprise);
|
|
384
|
+
const surprisePercent = earning.epsActual == null || surpriseNotMeaningful ? undefined
|
|
385
|
+
: typeof surprise === "number" ? Math.round(surprise * 10_000) / 100 : earning.surprisePercent;
|
|
357
386
|
rows.push({
|
|
358
387
|
id: earningsIds[index]!,
|
|
359
388
|
// An announcement keeps its date beside ERN's; a period-end row moves to its statement's.
|
|
@@ -361,7 +390,7 @@ export function buildEventRows(
|
|
|
361
390
|
dateType: earning.dateType,
|
|
362
391
|
status: "Earnings",
|
|
363
392
|
// The fiscal quarter, never the time of day ("After Hours"), which the row keeps as reportTime.
|
|
364
|
-
period: statement ? quarterLabel(statement.date) : earning.fiscalPeriod ? quarterLabel(earning.fiscalPeriod) :
|
|
393
|
+
period: statement ? quarterLabel(statement.date) : earning.fiscalPeriod ? quarterLabel(earning.fiscalPeriod) : MISSING_VALUE,
|
|
365
394
|
...(earning.time?.trim() ? { reportTime: earning.time.trim() } : {}),
|
|
366
395
|
detail: upcomingEarningsDetail(earning),
|
|
367
396
|
epsCurrency: earning.currency ?? (earning.epsActual == null ? feedCurrency : reportedCurrency),
|
|
@@ -373,6 +402,7 @@ export function buildEventRows(
|
|
|
373
402
|
epsEstimate: earning.epsEstimate,
|
|
374
403
|
epsDifference: earning.epsActual == null ? undefined : earning.difference,
|
|
375
404
|
surprisePercent,
|
|
405
|
+
...(surpriseNotMeaningful ? { surpriseNotMeaningful: true as const } : {}),
|
|
376
406
|
epsBasis: showsEpsBasis({ epsActual: earning.epsActual, epsBasis: earningsEpsBasis(earning.epsBasis) })
|
|
377
407
|
? epsBasisName(earningsEpsBasis(earning.epsBasis)) : undefined,
|
|
378
408
|
...(isProvisionalActual(earning) ? { epsProvisional: true as const } : {}),
|
|
@@ -384,8 +414,10 @@ export function buildEventRows(
|
|
|
384
414
|
periodDateSource: statement?.dateSource,
|
|
385
415
|
providerPeriodDate: earning.dateType === "fiscal-period-end" ? earning.date : undefined,
|
|
386
416
|
dateEvidence: statement?.dateEvidence,
|
|
387
|
-
value: surprisePercent != null ? formatPercentRaw(surprisePercent) :
|
|
388
|
-
tone:
|
|
417
|
+
value: surpriseNotMeaningful ? NOT_MEANINGFUL_TEXT : surprisePercent != null ? formatPercentRaw(surprisePercent) : MISSING_VALUE,
|
|
418
|
+
// N/M in the tone every pane draws N/M in: no colour of a beat or a miss for a percentage that says nothing.
|
|
419
|
+
tone: surpriseNotMeaningful ? NOT_MEANINGFUL_TONE
|
|
420
|
+
: surprisePercent == null ? "muted" : surprisePercent >= 0 ? "positive" : "negative",
|
|
389
421
|
});
|
|
390
422
|
}
|
|
391
423
|
|
|
@@ -393,7 +425,7 @@ export function buildEventRows(
|
|
|
393
425
|
for (const pair of buildEstimatePairs(estimates)) {
|
|
394
426
|
const isFiscal = isFiscalEstimatePeriod(pair.period);
|
|
395
427
|
if (!isFiscal && isReportedQuarter(pair.date, reportedPeriodEnds)) continue;
|
|
396
|
-
const growth = pair
|
|
428
|
+
const growth = estimatePairGrowth(pair);
|
|
397
429
|
rows.push({
|
|
398
430
|
id: `estimate:${pair.date}:${pair.period}`,
|
|
399
431
|
date: pair.date,
|
|
@@ -406,16 +438,17 @@ export function buildEventRows(
|
|
|
406
438
|
...(pair.eps ? { eps: { ...pair.eps } } : {}),
|
|
407
439
|
...(pair.revenue ? { revenue: { ...pair.revenue } } : {}),
|
|
408
440
|
},
|
|
409
|
-
estimateGrowthMetric:
|
|
410
|
-
...growth
|
|
441
|
+
estimateGrowthMetric: growth?.metric,
|
|
442
|
+
...typeof growth?.rate === "number" ? { estimateGrowth: growth.rate } : {},
|
|
443
|
+
...isNotMeaningful(growth?.rate) ? { estimateGrowthNotMeaningful: true as const } : {},
|
|
411
444
|
epsCurrency: pair.eps?.currency,
|
|
412
445
|
revenueCurrency: pair.revenue?.currency,
|
|
413
446
|
qEps: isFiscal ? undefined : pair.eps?.average,
|
|
414
447
|
qRevenue: isFiscal ? undefined : pair.revenue?.average,
|
|
415
448
|
annualEps: isFiscal ? pair.eps?.average : undefined,
|
|
416
449
|
annualRevenue: isFiscal ? pair.revenue?.average : undefined,
|
|
417
|
-
value: estimateValue(
|
|
418
|
-
tone: estimateTone(
|
|
450
|
+
value: estimateValue(growth?.rate),
|
|
451
|
+
tone: estimateTone(growth?.rate),
|
|
419
452
|
});
|
|
420
453
|
}
|
|
421
454
|
|
|
@@ -424,7 +457,7 @@ export function buildEventRows(
|
|
|
424
457
|
id: `div:${dividend.exDate}`,
|
|
425
458
|
date: dividend.exDate,
|
|
426
459
|
status: "Dividend",
|
|
427
|
-
period:
|
|
460
|
+
period: MISSING_VALUE,
|
|
428
461
|
detail: "Ex-date",
|
|
429
462
|
value: formatDistributionAmount(dividend.amount, data?.currency ?? currency),
|
|
430
463
|
tone: "positive",
|
|
@@ -437,7 +470,7 @@ export function buildEventRows(
|
|
|
437
470
|
id: `div-declared:${dividend.exDate}`,
|
|
438
471
|
date: dividend.exDate,
|
|
439
472
|
status: "Dividend",
|
|
440
|
-
period:
|
|
473
|
+
period: MISSING_VALUE,
|
|
441
474
|
// A one-off beside the regular payments says so: "Declared special, payable 2026-11-25".
|
|
442
475
|
detail: `Declared${dividend.special ? " special" : ""}${dividend.payDate ? `, payable ${dividend.payDate}` : ""}`,
|
|
443
476
|
value: formatDistributionAmount(dividend.amount, data?.currency ?? currency),
|
|
@@ -450,7 +483,7 @@ export function buildEventRows(
|
|
|
450
483
|
id: `split:${split.date}:${split.description ?? ""}`,
|
|
451
484
|
date: split.date,
|
|
452
485
|
status: "Factor",
|
|
453
|
-
period:
|
|
486
|
+
period: MISSING_VALUE,
|
|
454
487
|
detail: "Split/adjustment",
|
|
455
488
|
providerDescription: split.description,
|
|
456
489
|
adjustmentFactor: split.fromFactor && split.toFactor ? split.toFactor / split.fromFactor : split.ratio,
|
|
@@ -550,7 +583,7 @@ function hasAnalystEstimates(data: AnalystResearchData): boolean {
|
|
|
550
583
|
|
|
551
584
|
|
|
552
585
|
export function formatEventMetric(value: number | undefined, currency: string | undefined, kind: "eps" | "revenue"): string {
|
|
553
|
-
if (value == null || !Number.isFinite(value)) return
|
|
586
|
+
if (value == null || !Number.isFinite(value)) return MISSING_VALUE;
|
|
554
587
|
const formatted = kind === "eps" ? formatNumber(value, 2) : formatCompact(value);
|
|
555
588
|
return currency ? `${formatted} ${currency}` : formatted;
|
|
556
589
|
}
|
|
@@ -6,9 +6,11 @@ import type {
|
|
|
6
6
|
} from "../../../types/financials";
|
|
7
7
|
import { formatEventMetric } from "./event-model";
|
|
8
8
|
import { loadAnalystResearch } from "./client";
|
|
9
|
-
import { formatPercent, formatPercentRaw } from "../../../utils/format";
|
|
9
|
+
import { MISSING_VALUE, formatPercent, formatPercentRaw } from "../../../utils/format";
|
|
10
|
+
import { NOT_MEANINGFUL_TEXT } from "../../../utils/growth";
|
|
10
11
|
import { loadEarningsCalendar } from "../earnings/data/cache";
|
|
11
|
-
import { calendarEventOf,
|
|
12
|
+
import { calendarEventOf, listingDay, withResolvedEarnings } from "../shared/earnings-calendar";
|
|
13
|
+
import { parsePublicTickerKey } from "../../../utils/exchanges";
|
|
12
14
|
|
|
13
15
|
function metricFormat(currencyKey: "epsCurrency" | "revenueCurrency", kind: "eps" | "revenue") {
|
|
14
16
|
return (value: unknown, row: Record<string, unknown>) => {
|
|
@@ -38,15 +40,25 @@ export const EVENT_COLUMNS = [
|
|
|
38
40
|
export const EARNINGS_ESTIMATE_COLUMNS = [
|
|
39
41
|
...EVENT_COLUMNS.filter((column) => column.key !== "value" && column.key !== "detail"),
|
|
40
42
|
{
|
|
43
|
+
// Against a loss or zero estimate the surprise is N/M, as EVTS and ERN print it: JSON has null and
|
|
44
|
+
// `surpriseNotMeaningful`, CSV an empty cell with `n/m` in its status column.
|
|
41
45
|
key: "surprisePercent", header: "EPS surp", align: "right" as const,
|
|
42
|
-
format: (value: unknown) => value
|
|
46
|
+
format: (value: unknown, row: Record<string, unknown>) => typeof value !== "number" && row.surpriseNotMeaningful === true
|
|
47
|
+
? NOT_MEANINGFUL_TEXT.toLowerCase() : value == null ? MISSING_VALUE : formatPercentRaw(Number(value)),
|
|
48
|
+
textFormat: (value: unknown, row: Record<string, unknown>) => typeof value !== "number" && row.surpriseNotMeaningful === true
|
|
49
|
+
? NOT_MEANINGFUL_TEXT : value == null ? MISSING_VALUE : formatPercentRaw(Number(value)),
|
|
43
50
|
},
|
|
44
51
|
{
|
|
52
|
+
// Off a year-ago figure at or below zero the growth is N/M (`estimateGrowthNotMeaningful`), as the pane says.
|
|
45
53
|
key: "estimateGrowth", header: "YoY growth", align: "right" as const,
|
|
46
|
-
format: (value: unknown) => value
|
|
54
|
+
format: (value: unknown, row: Record<string, unknown>) => typeof value !== "number" && row.estimateGrowthNotMeaningful === true
|
|
55
|
+
? NOT_MEANINGFUL_TEXT.toLowerCase() : value == null ? MISSING_VALUE : formatPercent(Number(value)),
|
|
47
56
|
// The text says which figure grew, as the pane does; exports keep the percent a number.
|
|
48
|
-
textFormat: (value: unknown, row: Record<string, unknown>) =>
|
|
49
|
-
|
|
57
|
+
textFormat: (value: unknown, row: Record<string, unknown>) => {
|
|
58
|
+
const metric = row.estimateGrowthMetric === "revenue" ? "rev" : "EPS";
|
|
59
|
+
if (typeof value !== "number" && row.estimateGrowthNotMeaningful === true) return `${NOT_MEANINGFUL_TEXT} ${metric}`;
|
|
60
|
+
return value == null ? MISSING_VALUE : `${formatPercent(Number(value))} ${metric}`;
|
|
61
|
+
},
|
|
50
62
|
},
|
|
51
63
|
{ key: "detail", header: "Detail" },
|
|
52
64
|
];
|
|
@@ -70,9 +82,15 @@ function settledError(result: PromiseSettledResult<unknown>): string | null {
|
|
|
70
82
|
/**
|
|
71
83
|
* Corporate actions, analyst research and financials together; one failing
|
|
72
84
|
* leaves the others. The earnings rows are resolved against the earnings
|
|
73
|
-
* calendar
|
|
85
|
+
* calendar on the listing's own day (`listingDay`: SIE:XETRA's report has
|
|
86
|
+
* passed once Berlin's day has), so the next report reads as `earnings` and
|
|
87
|
+
* ERN give it.
|
|
74
88
|
*/
|
|
75
|
-
export async function loadEventSources(
|
|
89
|
+
export async function loadEventSources(
|
|
90
|
+
provider: DataProvider,
|
|
91
|
+
symbol: string,
|
|
92
|
+
today = listingDay(parsePublicTickerKey(symbol).exchange),
|
|
93
|
+
): Promise<EventSources> {
|
|
76
94
|
const [actions, estimates, financials, calendar] = await Promise.allSettled([
|
|
77
95
|
provider.getCorporateActions?.(symbol, "") ?? null,
|
|
78
96
|
// A listing no analyst covers answers with no estimates, not a failure.
|
|
@@ -2,8 +2,9 @@ import type { HeadlessPaneColumn, HeadlessPaneContext, HeadlessPaneRow } from ".
|
|
|
2
2
|
import type { FinancialStatement, TickerFinancials } from "../../../types/financials";
|
|
3
3
|
import { isUsListingExchange, parsePublicTickerKey } from "../../../utils/exchanges";
|
|
4
4
|
import { errorMessage } from "../../../utils/errors";
|
|
5
|
-
import { formatLevelPercent, formatNumber } from "../../../utils/format";
|
|
5
|
+
import { MISSING_VALUE, formatLevelPercent, formatNumber } from "../../../utils/format";
|
|
6
6
|
import { formatPriceEarnings, NOT_MEANINGFUL } from "../../../utils/price-earnings";
|
|
7
|
+
import { isNotMeaningful, NOT_MEANINGFUL_TEXT, revenueMargin } from "../../../utils/growth";
|
|
7
8
|
import { BANK_OR_INSURER_EBITDA, ebitdaLacksDepreciation, ebitdaOperatingIncomeBasis, isBankOrInsurerIndustry } from "../../../utils/ebitda";
|
|
8
9
|
import { fiscalPeriodLabel, fiscalYearEndMonth } from "../../../utils/fiscal-period";
|
|
9
10
|
import { latestFinancialPeriod } from "../../../utils/latest-financial-period";
|
|
@@ -66,10 +67,10 @@ export function parseExtraColumns(value: unknown): ExtraColumnId[] {
|
|
|
66
67
|
return typeof value === "string" && value ? value.split(",").filter((id): id is ExtraColumnId => (EXTRA_COLUMN_IDS as readonly string[]).includes(id)) : [];
|
|
67
68
|
}
|
|
68
69
|
|
|
69
|
-
const percent = (value: unknown) => (typeof value === "number" && Number.isFinite(value) ? `${value.toFixed(2)}%` :
|
|
70
|
+
const percent = (value: unknown) => (typeof value === "number" && Number.isFinite(value) ? `${value.toFixed(2)}%` : MISSING_VALUE);
|
|
70
71
|
/** Why a statement column's cell is blank ("no D&A"), in its place; "-" when nothing says. */
|
|
71
|
-
const gap = (row: HeadlessPaneRow, key: string) => (typeof row[key] === "string" && row[key] ? row[key] as string :
|
|
72
|
-
const text = (value: unknown) => (typeof value === "string" && value ? value :
|
|
72
|
+
const gap = (row: HeadlessPaneRow, key: string) => (typeof row[key] === "string" && row[key] ? row[key] as string : MISSING_VALUE);
|
|
73
|
+
const text = (value: unknown) => (typeof value === "string" && value ? value : MISSING_VALUE);
|
|
73
74
|
|
|
74
75
|
/** Each added column, then (exports only) the source and as-of of its cells. */
|
|
75
76
|
interface ColumnSpec {
|
|
@@ -99,7 +100,7 @@ const COLUMN_SPECS: Record<ExtraColumnId, ColumnSpec> = {
|
|
|
99
100
|
key: "nextEarningsDate", header: "Next Earnings", format: text, shrink: false,
|
|
100
101
|
// The text table says when in the day and whether the date is confirmed; exports keep them as columns.
|
|
101
102
|
textFormat: (value, row) => (typeof value === "string" && value
|
|
102
|
-
? [value, row.nextEarningsTiming, row.nextEarningsStatus === "estimated" ? "est" : null].filter(Boolean).join(" ") :
|
|
103
|
+
? [value, row.nextEarningsTiming, row.nextEarningsStatus === "estimated" ? "est" : null].filter(Boolean).join(" ") : MISSING_VALUE),
|
|
103
104
|
}, { key: "nextEarningsTiming", header: "Next Earnings Timing", format: text }, { key: "nextEarningsStatus", header: "Next Earnings Status", format: text }],
|
|
104
105
|
sourceKey: "nextEarningsSource",
|
|
105
106
|
asOfKey: "nextEarningsAsOf",
|
|
@@ -108,8 +109,8 @@ const COLUMN_SPECS: Record<ExtraColumnId, ColumnSpec> = {
|
|
|
108
109
|
label: "Avg Target",
|
|
109
110
|
columns: [
|
|
110
111
|
{ key: "targetMean", header: "Avg Target", align: "right", unitKey: "targetCurrency", unitColumn: true,
|
|
111
|
-
format: (value, row) => (typeof value === "number" ? formatAnalystPrice(value, typeof row.targetCurrency === "string" ? row.targetCurrency : undefined) :
|
|
112
|
-
{ key: "analystCount", header: "Analysts", align: "right", format: (value) => (typeof value === "number" ? String(value) :
|
|
112
|
+
format: (value, row) => (typeof value === "number" ? formatAnalystPrice(value, typeof row.targetCurrency === "string" ? row.targetCurrency : undefined) : MISSING_VALUE) },
|
|
113
|
+
{ key: "analystCount", header: "Analysts", align: "right", format: (value) => (typeof value === "number" ? String(value) : MISSING_VALUE) },
|
|
113
114
|
],
|
|
114
115
|
sourceKey: "targetSource",
|
|
115
116
|
asOfKey: "targetAsOf",
|
|
@@ -117,7 +118,8 @@ const COLUMN_SPECS: Record<ExtraColumnId, ColumnSpec> = {
|
|
|
117
118
|
grossMargin: {
|
|
118
119
|
label: "Gross Margin",
|
|
119
120
|
// Trailing twelve months, as TTM Op Margin; a fiscal year's margin, where the company reports no quarters, names its year.
|
|
120
|
-
columns: [{ key: "grossMarginPercent", header: "Gross Margin", align: "right", format: (value, row) => (typeof value !== "number"
|
|
121
|
+
columns: [{ key: "grossMarginPercent", header: "Gross Margin", align: "right", format: (value, row) => (typeof value !== "number"
|
|
122
|
+
? row.grossMarginNotMeaningful ? NOT_MEANINGFUL_TEXT : gap(row, "grossMarginGap")
|
|
121
123
|
: typeof row.grossMarginPeriod === "string" ? `${formatLevelPercent(value / 100)} ${row.grossMarginPeriod}` : formatLevelPercent(value / 100)) }],
|
|
122
124
|
sourceKey: "grossMarginSource",
|
|
123
125
|
asOfKey: "grossMarginAsOf",
|
|
@@ -271,6 +273,7 @@ async function loadTargetFields(symbols: readonly string[], ctx: HeadlessPaneCon
|
|
|
271
273
|
}
|
|
272
274
|
|
|
273
275
|
const STATEMENTS_SOURCE = "Gloom Cloud financial statements";
|
|
276
|
+
const GROSS_MARGIN_NOT_MEANINGFUL = "revenue is at or below zero";
|
|
274
277
|
|
|
275
278
|
/** Why a trailing figure is missing: fewer than four quarters, or a line the latest ones lack. */
|
|
276
279
|
function trailingGap(financials: TickerFinancials, line: string): string {
|
|
@@ -288,17 +291,22 @@ function grossMarginFields(financials: TickerFinancials): HeadlessPaneRow {
|
|
|
288
291
|
const trailing = latestTrailingStatement(financials);
|
|
289
292
|
if (trailing) {
|
|
290
293
|
const { grossProfit, totalRevenue } = trailing;
|
|
291
|
-
|
|
292
|
-
|
|
294
|
+
const margin = revenueMargin(grossProfit, totalRevenue);
|
|
295
|
+
if (typeof margin === "number") {
|
|
296
|
+
return { grossMarginPercent: 100 * margin, grossMarginSource: STATEMENTS_SOURCE, grossMarginAsOf: trailing.date.slice(0, 10) };
|
|
293
297
|
}
|
|
298
|
+
// Over revenue at or below zero a margin is N/M.
|
|
299
|
+
if (isNotMeaningful(margin)) return { grossMarginNotMeaningful: GROSS_MARGIN_NOT_MEANINGFUL, grossMarginAsOf: trailing.date.slice(0, 10) };
|
|
294
300
|
return { grossMarginGap: typeof totalRevenue === "number" && totalRevenue > 0 ? "no gross profit" : "no revenue" };
|
|
295
301
|
}
|
|
296
302
|
if (financials.quarterlyStatements.length > 0) return { grossMarginGap: trailingGap(financials, "gross profit") };
|
|
297
303
|
const year = latestFinancialPeriod(financials.annualStatements, (row) => row.date);
|
|
298
|
-
|
|
304
|
+
const margin = year ? revenueMargin(year.grossProfit, year.totalRevenue) : undefined;
|
|
305
|
+
if (!year || margin === undefined) return { grossMarginGap: "not reported" };
|
|
299
306
|
const label = fiscalPeriodLabel(year.date, "annual", fiscalYearEndMonth(financials.annualStatements));
|
|
307
|
+
if (isNotMeaningful(margin)) return { grossMarginNotMeaningful: GROSS_MARGIN_NOT_MEANINGFUL, grossMarginAsOf: year.date.slice(0, 10) };
|
|
300
308
|
return {
|
|
301
|
-
grossMarginPercent: 100 *
|
|
309
|
+
grossMarginPercent: 100 * margin,
|
|
302
310
|
grossMarginPeriod: /^FY\d{2}(\d{2})$/.test(label) ? `FY${label.slice(-2)}` : label,
|
|
303
311
|
grossMarginSource: STATEMENTS_SOURCE,
|
|
304
312
|
grossMarginAsOf: year.date.slice(0, 10),
|
|
@@ -45,6 +45,22 @@ function olderOf(left: string | null, right: string | null): string | null {
|
|
|
45
45
|
return Date.parse(left) <= Date.parse(right) ? left : right;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* The currency RV compares market caps in, the same in the pane and `fn RV`:
|
|
50
|
+
* the asked one, else the peers' own when they share one (four Xetra names in
|
|
51
|
+
* euros), else the app's base currency, dollars unless set.
|
|
52
|
+
*/
|
|
53
|
+
export function relativeCapCurrency(
|
|
54
|
+
asked: string | null | undefined,
|
|
55
|
+
capCurrencies: ReadonlyArray<string | null | undefined>,
|
|
56
|
+
baseCurrency: string | null | undefined,
|
|
57
|
+
): string {
|
|
58
|
+
if (asked) return asked;
|
|
59
|
+
const shared = new Set(capCurrencies.filter((currency): currency is string => !!currency));
|
|
60
|
+
if (shared.size === 1) return [...shared][0]!;
|
|
61
|
+
return baseCurrency || "USD";
|
|
62
|
+
}
|
|
63
|
+
|
|
48
64
|
/**
|
|
49
65
|
* Every row's market cap in `target`, through each currency's US dollar
|
|
50
66
|
* rate (a pence cap is first made pounds). A row already in `target`, or
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { withBalanceSheetRate } from "../../../market-data/quotes/balance-sheet-rate";
|
|
2
2
|
import { formatPriceEarnings, NOT_MEANINGFUL, PRICE_EARNINGS_NOTICE } from "../../../utils/price-earnings";
|
|
3
|
+
import { NOT_MEANINGFUL_TEXT } from "../../../utils/growth";
|
|
3
4
|
import type { HeadlessPaneColumn, HeadlessPaneContext, HeadlessPaneDefinition } from "../../../types/headless";
|
|
4
5
|
import { EXTENDED_SESSION_LABELS, type ExtendedSession } from "../../../market-data/market/status";
|
|
5
|
-
import { formatCompact, formatCurrency, formatLevelPercent, formatNumber, formatPercent, formatPercentRaw } from "../../../utils/format";
|
|
6
|
+
import { MISSING_VALUE, formatCompact, formatCurrency, formatLevelPercent, formatNumber, formatPercent, formatPercentRaw } from "../../../utils/format";
|
|
6
7
|
import { loadHeadlessFinancials, loadHeadlessSymbols } from "../shared/headless-market-data";
|
|
7
8
|
import { quoteFreshnessFields } from "../shared/report-freshness";
|
|
8
9
|
import {
|
|
@@ -15,17 +16,17 @@ import {
|
|
|
15
16
|
} from "./relative-valuation-peers";
|
|
16
17
|
import { extraColumns, extraColumnsBasis, loadExtraColumns, parseExtraColumns } from "./relative-valuation-columns";
|
|
17
18
|
import { fundamentalsBasisParts, revenueGrowthHalfTag, revenueGrowthHeader } from "./relative-valuation-basis";
|
|
18
|
-
import { conversionNote, convertMarketCaps, convertTargets, loadFxLegs, type CapConversion } from "./relative-valuation-currency";
|
|
19
|
+
import { conversionNote, convertMarketCaps, convertTargets, loadFxLegs, relativeCapCurrency, type CapConversion } from "./relative-valuation-currency";
|
|
19
20
|
|
|
20
21
|
const price = (value: unknown, row: Record<string, unknown>) => (
|
|
21
|
-
value == null || !row.currency ?
|
|
22
|
+
value == null || !row.currency ? MISSING_VALUE : formatCurrency(Number(value), String(row.currency))
|
|
22
23
|
);
|
|
23
|
-
const percent = (value: unknown) => value == null ?
|
|
24
|
+
const percent = (value: unknown) => value == null ? MISSING_VALUE : formatPercentRaw(Number(value));
|
|
24
25
|
|
|
25
26
|
/** The reason a row lacks the figure under `key` ("no TTM FCF"), which exports move to their status column. */
|
|
26
27
|
function gapText(row: Record<string, unknown>, key: RelativeValuationGapKey): string {
|
|
27
28
|
const gaps = row.gaps as Partial<Record<RelativeValuationGapKey, string>> | undefined;
|
|
28
|
-
return gaps?.[key] ??
|
|
29
|
+
return gaps?.[key] ?? MISSING_VALUE;
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
/**
|
|
@@ -39,7 +40,7 @@ function extendedColumn(session: ExtendedSession): HeadlessPaneColumn {
|
|
|
39
40
|
align: "right",
|
|
40
41
|
format: (value, row) => row.extendedSession === session && typeof value === "number"
|
|
41
42
|
? `${price(value, row)}${row.extendedMark ? " mid" : ""} ${percent(row.extendedChangePercent)}`
|
|
42
|
-
:
|
|
43
|
+
: MISSING_VALUE,
|
|
43
44
|
};
|
|
44
45
|
}
|
|
45
46
|
|
|
@@ -51,9 +52,9 @@ function extendedExportColumns(session: ExtendedSession): HeadlessPaneColumn[] {
|
|
|
51
52
|
const label = EXTENDED_SESSION_LABELS[session];
|
|
52
53
|
return [
|
|
53
54
|
{ key: "extendedPrice", header: label, align: "right", unitKey: "currency",
|
|
54
|
-
format: (value, row) => row.extendedSession === session && typeof value === "number" ? price(value, row) :
|
|
55
|
+
format: (value, row) => row.extendedSession === session && typeof value === "number" ? price(value, row) : MISSING_VALUE },
|
|
55
56
|
{ key: "extendedChangePercent", header: `${label} Chg%`, align: "right",
|
|
56
|
-
format: (value, row) => row.extendedSession === session && typeof value === "number" ? percent(value) :
|
|
57
|
+
format: (value, row) => row.extendedSession === session && typeof value === "number" ? percent(value) : MISSING_VALUE },
|
|
57
58
|
];
|
|
58
59
|
}
|
|
59
60
|
|
|
@@ -66,7 +67,7 @@ const EXTENDED_EXPORT_COLUMNS = EXTENDED_SESSIONS.flatMap(extendedExportColumns)
|
|
|
66
67
|
const QUOTE_COLUMNS: HeadlessPaneColumn[] = [
|
|
67
68
|
{ key: "symbol", header: "Ticker" },
|
|
68
69
|
// The company each ticker was read as: MTN is Vail Resorts in New York, MTN Group only as MTN:JSE.
|
|
69
|
-
{ key: "name", header: "Name", format: (value) => typeof value === "string" && value ? value :
|
|
70
|
+
{ key: "name", header: "Name", format: (value) => typeof value === "string" && value ? value : MISSING_VALUE },
|
|
70
71
|
{ key: "price", header: "Last", align: "right", unitKey: "currency",
|
|
71
72
|
format: (value, row) => value == null ? gapText(row, "price") : price(value, row) },
|
|
72
73
|
{ key: "changePercent", header: "Chg%", align: "right", format: (value, row) => value == null ? gapText(row, "changePercent") : percent(value) },
|
|
@@ -77,6 +78,11 @@ const REVENUE_GROWTH_HEADER = "Quarter Revenue YoY";
|
|
|
77
78
|
/** The column's name once a peer reports half-yearly: its figure is a half's (`H1`), named in the footer. */
|
|
78
79
|
const PERIOD_REVENUE_GROWTH_HEADER = "Revenue YoY";
|
|
79
80
|
|
|
81
|
+
/** A missing growth or margin: N/M where it is not meaningful, else why it is missing. */
|
|
82
|
+
const rateGapText = (row: Record<string, unknown>, key: "fcfYield" | "revenueGrowth" | "operatingMargin") =>
|
|
83
|
+
key !== "fcfYield" && (row as Partial<ReturnType<typeof relativeValuationValues>>).notMeaningful?.[key]
|
|
84
|
+
? NOT_MEANINGFUL_TEXT : gapText(row, key);
|
|
85
|
+
|
|
80
86
|
const VALUATION_COLUMNS: HeadlessPaneColumn[] = [
|
|
81
87
|
// In the currency each peer's cap is in, which exports write in the header or beside the figure.
|
|
82
88
|
{ key: "marketCap", header: "Mkt Cap", align: "right", unitKey: "marketCapCurrency", unitColumn: true,
|
|
@@ -111,9 +117,10 @@ const VALUATION_COLUMNS: HeadlessPaneColumn[] = [
|
|
|
111
117
|
...([["fcfYield", "FCF Yield"], ["revenueGrowth", REVENUE_GROWTH_HEADER], ["operatingMargin", "TTM Op Margin"]] as const).map(([key, header]) => ({
|
|
112
118
|
key, header, align: "right" as const,
|
|
113
119
|
// A figure alone, so an export's column holds only numbers; the period is in its own column (VALUATION_PERIOD_COLUMNS).
|
|
114
|
-
|
|
120
|
+
// Growth off revenue at or below zero, or a margin over it, reads N/M; notMeaningful says why.
|
|
121
|
+
format: (value: unknown, row: Record<string, unknown>) => value == null ? rateGapText(row, key)
|
|
115
122
|
: key === "revenueGrowth" ? formatPercent(Number(value)) : formatLevelPercent(Number(value)),
|
|
116
|
-
textFormat: (value: unknown, row: Record<string, unknown>) => value == null ?
|
|
123
|
+
textFormat: (value: unknown, row: Record<string, unknown>) => value == null ? rateGapText(row, key)
|
|
117
124
|
: key === "revenueGrowth" ? [formatPercent(Number(value)), revenueGrowthHalfTag(row.revenueGrowthHalf as string | null)].filter(Boolean).join(" ")
|
|
118
125
|
// A margin of the latest fiscal year, where no trailing quarters were served, says which year.
|
|
119
126
|
: key === "operatingMargin" && typeof row.operatingMarginPeriod === "string"
|
|
@@ -190,10 +197,13 @@ export const relativeValuationHeadless: HeadlessPaneDefinition<"rows"> = {
|
|
|
190
197
|
const staleSymbols = baseRows.filter((row) => row.quoteStale).map((row) => row.symbol);
|
|
191
198
|
const staleFundamentalsSymbols = baseRows.filter((row) => row.fundamentalsProvenance?.stale).map((row) => row.symbol);
|
|
192
199
|
|
|
193
|
-
//
|
|
194
|
-
|
|
195
|
-
const
|
|
196
|
-
const
|
|
200
|
+
// Every cap in one currency, at the rates the app converts with, as the pane compares them: the one --currency asks
|
|
201
|
+
// for, else the peers' own when they share one, else the app's base currency.
|
|
202
|
+
const askedCurrency = typeof args.options.currency === "string" ? args.options.currency : null;
|
|
203
|
+
const capCurrency = relativeCapCurrency(askedCurrency, baseRows.map((row) => row.marketCapCurrency), ctx.config?.baseCurrency);
|
|
204
|
+
const converts = askedCurrency != null || baseRows.some((row) => row.marketCapCurrency && row.marketCapCurrency !== capCurrency);
|
|
205
|
+
const fx = converts ? await loadFxLegs([capCurrency, ...baseRows.flatMap((row) => row.marketCapCurrency ?? [])], ctx) : null;
|
|
206
|
+
const converted = fx ? convertMarketCaps(baseRows, capCurrency, fx.legs) : null;
|
|
197
207
|
const capRows = converted?.rows ?? baseRows;
|
|
198
208
|
|
|
199
209
|
// --columns: each added column read from the path its own function uses.
|
|
@@ -202,12 +212,12 @@ export const relativeValuationHeadless: HeadlessPaneDefinition<"rows"> = {
|
|
|
202
212
|
const extra = await loadExtraColumns(extraIds, capRows.map((row) => row.symbol), financials, ctx);
|
|
203
213
|
const extraRows = capRows.map((row) => ({ ...row, ...extra.fields.get(row.symbol) }));
|
|
204
214
|
// Analyst targets go into the asked currency with the caps, at the same rates.
|
|
205
|
-
const targetCurrencies =
|
|
215
|
+
const targetCurrencies = askedCurrency && fx ? extraRows.flatMap((row): string[] => {
|
|
206
216
|
const currency = (row as Record<string, unknown>).targetCurrency;
|
|
207
217
|
return typeof currency === "string" && currency ? [currency] : [];
|
|
208
218
|
}) : [];
|
|
209
219
|
const targetFx = targetCurrencies.length > 0 ? await loadFxLegs(targetCurrencies.filter((currency) => !fx!.legs.has(resolveCurrencyUnit(currency).currency)), ctx) : null;
|
|
210
|
-
const targets =
|
|
220
|
+
const targets = askedCurrency && fx && targetCurrencies.length > 0
|
|
211
221
|
? convertTargets(extraRows, capCurrency, new Map([...fx.legs, ...targetFx?.legs ?? []])) : null;
|
|
212
222
|
const rows = targets?.rows ?? extraRows;
|
|
213
223
|
const conversions = [...converted?.conversions ?? [], ...targets?.conversions ?? []]
|
|
@@ -232,7 +242,7 @@ export const relativeValuationHeadless: HeadlessPaneDefinition<"rows"> = {
|
|
|
232
242
|
// The footer: the rates the caps were converted at, the statement period the figures run through, and the
|
|
233
243
|
// basis of each column that is not trailing twelve months.
|
|
234
244
|
const footnote = [
|
|
235
|
-
...
|
|
245
|
+
...converted ? [conversionNote(capCurrency, conversions,
|
|
236
246
|
targets?.conversions.length ? `market caps and analyst targets in ${capCurrency}` : undefined)] : [],
|
|
237
247
|
...fundamentalsBasisParts(rows, growthHeader),
|
|
238
248
|
...extraColumnsBasis(extraIds, rows),
|
|
@@ -262,8 +272,8 @@ export const relativeValuationHeadless: HeadlessPaneDefinition<"rows"> = {
|
|
|
262
272
|
staleSymbols,
|
|
263
273
|
staleFundamentalsSymbols,
|
|
264
274
|
...(selection ? { peerSelection: selection } : {}),
|
|
265
|
-
...(converted
|
|
266
|
-
basis: "marketCap is converted into the asked currency at each currency's US dollar rate, the rate the app's converted totals use; marketCapNative and marketCapNativeCurrency keep the cap as served." } } : {}),
|
|
275
|
+
...(converted ? { marketCapConversion: { currency: capCurrency, rates: converted.conversions,
|
|
276
|
+
basis: "marketCap is converted into one currency (the asked one, else the peers' own when they share one, else the base currency) at each currency's US dollar rate, the rate the app's converted totals use; marketCapNative and marketCapNativeCurrency keep the cap as served." } } : {}),
|
|
267
277
|
...(extraIds.length > 0 ? { addedColumnsBasis: "Each added column keeps its own source and as-of beside it: short interest at its FINRA settlement date, analyst targets at retrieval (converted with the caps under --currency, targetMeanNative keeping the served one), the next earnings date at the calendar's retrieval, gross margin and EV/EBITDA at the end of the latest quarter they sum. EV/EBITDA is the listing's enterprise value over the trailing four quarters of operating income plus D&A, as GE's EV/EBITDA ends." } : {}),
|
|
268
278
|
quoteBasis: "Stale quote fields are excluded from comparison; reportedQuote retains the rejected observation and quoteAsOf retains its source timestamp.",
|
|
269
279
|
priceBasis: "price, change and changePercent are the regular session: after the close, its close and that close's move. A pre-market, after-hours or overnight print is in extendedPrice, extendedChange and extendedChangePercent, measured from that close (extendedMark when it is a bid and ask midpoint). marketCap, the P/E multiples, evSales (through the equity part of the enterprise value) and fcfYield are measured at that regular session price.",
|
|
@@ -275,8 +285,10 @@ export const relativeValuationHeadless: HeadlessPaneDefinition<"rows"> = {
|
|
|
275
285
|
...rows.flatMap((row) => row.evSalesNote ? [`${row.symbol}: ${row.evSalesNote}`] : []),
|
|
276
286
|
...rows.flatMap((row) => row.marketCapNote ? [`${row.symbol}: ${row.marketCapNote}`] : []),
|
|
277
287
|
...rows.flatMap((row) => row.marketCapWithheld ? [`${row.symbol}: ${row.marketCapWithheld}`] : []),
|
|
288
|
+
...rows.flatMap((row) => (["revenueGrowth", "operatingMargin"] as const).flatMap((key) => row.notMeaningful[key]
|
|
289
|
+
? [`${row.symbol}: ${key === "revenueGrowth" ? "revenue growth" : "operating margin"} N/M, ${row.notMeaningful[key]}.`] : [])),
|
|
278
290
|
],
|
|
279
|
-
multipleBasis: "Comparable P/E fields require a positive finite multiple over positive EPS, and evSales an enterprise value above zero; notMeaningful says why one is null, and reportedMultiples preserves the finite provider P/E values.",
|
|
291
|
+
multipleBasis: "Comparable P/E fields require a positive finite multiple over positive EPS, and evSales an enterprise value above zero; revenueGrowth needs revenue above zero a year earlier and operatingMargin revenue above zero. notMeaningful says why one is null, and reportedMultiples preserves the finite provider P/E values.",
|
|
280
292
|
marketCapBasis: "Market caps retain their own currency and source. Fundamentals retrieval time is not a valuation date; quote timestamps do not date fallback caps.",
|
|
281
293
|
},
|
|
282
294
|
};
|