gloomberb 0.20.12 → 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 +1 -1
- package/src/account/billing.ts +3 -2
- package/src/account/upgrade-dialog.tsx +8 -8
- package/src/api-client/index.ts +10 -2
- package/src/api-client/install-experiments.ts +146 -0
- 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 -33
- package/src/brokers/signed-in/adapter.ts +2 -2
- package/src/brokers/signed-in/catalog.ts +13 -4
- package/src/cli/commands/market.ts +51 -32
- package/src/cli/commands/overview.ts +3 -3
- 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/history-rows.ts +18 -1
- package/src/cli/known-gaps.ts +9 -0
- package/src/cli/listing-arg.ts +105 -18
- 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 +2 -2
- package/src/cli/pane-functions/headless.ts +8 -8
- package/src/cli/pane-functions/index.ts +1 -1
- package/src/cli/pane-functions/report.ts +4 -1
- package/src/cli/perpetual-contract.ts +4 -4
- package/src/cli/quote-answer.ts +6 -2
- package/src/cli/result.ts +2 -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 +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/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/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/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/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 +101 -32
- 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 +16 -4
- package/src/components/ui/stat-grid.tsx +27 -6
- 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-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/quotes/listing-enterprise-value.ts +3 -3
- 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/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 +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/index.tsx +4 -2
- package/src/plugins/builtin/chart-composer/pane.tsx +7 -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/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/team/pane.tsx +12 -12
- package/src/plugins/builtin/cloud/thesis/detail.tsx +13 -8
- 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 +4 -3
- package/src/plugins/builtin/cpi/model.ts +8 -7
- 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/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/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 +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 +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 +14 -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/model.ts +3 -2
- package/src/plugins/builtin/earnings-ripple/pane.tsx +6 -6
- package/src/plugins/builtin/econ/calendar-model.ts +2 -2
- package/src/plugins/builtin/econ/detail-view.tsx +2 -2
- 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 +4 -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 +6 -5
- package/src/plugins/builtin/macro-day/model.ts +2 -1
- package/src/plugins/builtin/macro-day/pane.tsx +4 -4
- 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/headless.ts +2 -1
- package/src/plugins/builtin/money-markets/model.ts +3 -2
- package/src/plugins/builtin/money-markets/pane.tsx +4 -4
- 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/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/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 +2 -2
- package/src/plugins/builtin/portfolio-list/settings.ts +4 -1
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +4 -4
- 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/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/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 +4 -4
- 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 +33 -7
- 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/column-values.ts +47 -41
- package/src/portfolio/futures-positions.ts +2 -1
- package/src/renderers/electrobun/bun/desktop/backend-requests.ts +7 -1
- 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 +2 -0
- 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/tickers/company-name-listing.ts +2 -2
- package/src/tickers/company-name.ts +17 -1
- package/src/tickers/listing-venues.ts +26 -1
- package/src/tickers/renamed-listings.ts +2 -1
- package/src/tickers/search/index.ts +19 -0
- package/src/tickers/starter-symbols.ts +7 -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 +3 -2
- package/src/types/financials.ts +15 -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/utils/datetime-format.ts +74 -33
- 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/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/zoned-date-time.ts +47 -22
|
@@ -22,7 +22,9 @@ import type {
|
|
|
22
22
|
CorporateActionsData,
|
|
23
23
|
} from "../../../types/financials";
|
|
24
24
|
import { blendHex, colors } from "../../../theme/colors";
|
|
25
|
-
import { formatPercent } from "../../../utils/format";
|
|
25
|
+
import { MISSING_VALUE, formatPercent } from "../../../utils/format";
|
|
26
|
+
import { formatFilingDate } from "../../../utils/datetime-format";
|
|
27
|
+
import { NOT_MEANINGFUL_TEXT } from "../../../utils/growth";
|
|
26
28
|
import { useResolvedEntryValue, useSecFilingDocuments, useSecFilingsQuery } from "../../../market-data/hooks";
|
|
27
29
|
import { instrumentFromTicker } from "../../../market-data/request-types";
|
|
28
30
|
import { usePaneTicker } from "../../../state/app/context";
|
|
@@ -34,7 +36,7 @@ import { SignInWall } from "../cloud/auth-actions";
|
|
|
34
36
|
import { isCloudSessionRequired, useResearchCloudSession } from "../shared/research-cloud-session";
|
|
35
37
|
import { useBoundTicker as useSymbolBinding, useTickerRequest } from "../shared/ticker-request";
|
|
36
38
|
import { loadEarningsCalendar } from "../earnings/data/cache";
|
|
37
|
-
import { calendarEventOf,
|
|
39
|
+
import { calendarEventOf, listingDay, withResolvedEarnings } from "../shared/earnings-calendar";
|
|
38
40
|
import {
|
|
39
41
|
documentContentKey,
|
|
40
42
|
formatCompactDocumentLabel,
|
|
@@ -62,14 +64,6 @@ const SEC_EVENT_MATCH_WINDOW_DAYS = 7;
|
|
|
62
64
|
|
|
63
65
|
const eventRowKey = (row: EventRow) => row.id;
|
|
64
66
|
|
|
65
|
-
function todayDateKey(): string {
|
|
66
|
-
const now = new Date();
|
|
67
|
-
const year = now.getFullYear();
|
|
68
|
-
const month = String(now.getMonth() + 1).padStart(2, "0");
|
|
69
|
-
const day = String(now.getDate()).padStart(2, "0");
|
|
70
|
-
return `${year}-${month}-${day}`;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
67
|
function dateKeyToEpochDay(dateKey: string): number | null {
|
|
74
68
|
const timestamp = new Date(`${dateKey}T00:00:00Z`).getTime();
|
|
75
69
|
if (!Number.isFinite(timestamp)) return null;
|
|
@@ -165,7 +159,7 @@ function sharedMetricCurrency(rows: readonly EventRow[]): string | undefined {
|
|
|
165
159
|
export function buildEventColumns(width: number, unit?: string, variant: "corporate-actions" | "earnings-estimates" = "corporate-actions"): EventColumn[] {
|
|
166
160
|
if (variant === "earnings-estimates") {
|
|
167
161
|
return fitChartTableColumns<EventColumn>([
|
|
168
|
-
{ id: "date", label: "DATE", width:
|
|
162
|
+
{ id: "date", label: "DATE", width: 11, align: "left" },
|
|
169
163
|
{ id: "status", label: "EVENT", width: 8, align: "left" },
|
|
170
164
|
{ id: "period", label: "PERIOD", width: 9, align: "left" },
|
|
171
165
|
{ id: "eps", label: "EPS", width: unit ? 7 : 11, align: "right" },
|
|
@@ -176,7 +170,7 @@ export function buildEventColumns(width: number, unit?: string, variant: "corpor
|
|
|
176
170
|
], width, ["detail", "growth", "revenue"]);
|
|
177
171
|
}
|
|
178
172
|
const columns: EventColumn[] = [
|
|
179
|
-
{ id: "date", label: "DATE", width:
|
|
173
|
+
{ id: "date", label: "DATE", width: 11, align: "left" },
|
|
180
174
|
{ id: "status", label: "EVENT", width: 8, align: "left" },
|
|
181
175
|
{ id: "period", label: "PERIOD", width: 12, align: "left" },
|
|
182
176
|
{ id: "qEps", label: "Q EPS", width: 12, align: "right" },
|
|
@@ -203,18 +197,18 @@ function eventDetailTitle(row: EventRow): string {
|
|
|
203
197
|
/** The row's figures in one line; the date is left to the detail title. */
|
|
204
198
|
function eventSummaryLine(row: EventRow): string {
|
|
205
199
|
return [
|
|
206
|
-
row.period !==
|
|
200
|
+
row.period !== MISSING_VALUE ? row.period : null,
|
|
207
201
|
row.qEps != null ? `EPS ${formatEventMetric(row.qEps, row.epsCurrency, "eps")}` : null,
|
|
208
202
|
row.qRevenue != null ? `Rev ${formatEventMetric(row.qRevenue, row.revenueCurrency, "revenue")}` : null,
|
|
209
203
|
row.annualEps != null ? `Ann EPS ${formatEventMetric(row.annualEps, row.epsCurrency, "eps")}` : null,
|
|
210
204
|
row.annualRevenue != null ? `Ann Rev ${formatEventMetric(row.annualRevenue, row.revenueCurrency, "revenue")}` : null,
|
|
211
|
-
row.value !==
|
|
205
|
+
row.value !== MISSING_VALUE ? row.value : null,
|
|
212
206
|
row.detail || null,
|
|
213
207
|
].filter((line): line is string => !!line).join(" | ");
|
|
214
208
|
}
|
|
215
209
|
|
|
216
210
|
function earningsInput(value: number | undefined, currency?: string): string {
|
|
217
|
-
if (value == null || !Number.isFinite(value)) return
|
|
211
|
+
if (value == null || !Number.isFinite(value)) return MISSING_VALUE;
|
|
218
212
|
const amount = new Intl.NumberFormat("en-US", { maximumFractionDigits: 8 }).format(value);
|
|
219
213
|
return currency ? `${amount} ${currency}` : amount;
|
|
220
214
|
}
|
|
@@ -271,9 +265,9 @@ export function buildEventDetail({
|
|
|
271
265
|
detailRow("Low", amount(estimate.low)),
|
|
272
266
|
detailRow("High", amount(estimate.high)),
|
|
273
267
|
detailRow("Prior year", amount(estimate.yearAgo)),
|
|
274
|
-
detailRow("Growth", estimate.growth == null ?
|
|
268
|
+
detailRow("Growth", estimate.growth == null ? MISSING_VALUE : formatPercent(estimate.growth), undefined,
|
|
275
269
|
estimate.growth == null || estimate.growth === 0 ? undefined : estimate.growth > 0 ? "positive" : "negative"),
|
|
276
|
-
detailRow("Analysts", estimate.analysts == null ?
|
|
270
|
+
detailRow("Analysts", estimate.analysts == null ? MISSING_VALUE : String(estimate.analysts)),
|
|
277
271
|
...(estimate.currency ? [] : [detailNote("Currency unavailable.")]),
|
|
278
272
|
],
|
|
279
273
|
});
|
|
@@ -314,7 +308,9 @@ export function buildEventDetail({
|
|
|
314
308
|
row.epsActual == null && row.epsBasis === "adjusted" ? "adjusted" : null].filter(Boolean).join(", ") || undefined),
|
|
315
309
|
];
|
|
316
310
|
if (row.epsDifference != null) comparison.push(detailRow("Difference", earningsInput(row.epsDifference, row.epsCurrency)));
|
|
317
|
-
if (row.
|
|
311
|
+
if (row.surpriseNotMeaningful) {
|
|
312
|
+
comparison.push(detailRow("Surprise", NOT_MEANINGFUL_TEXT, "against a loss or zero estimate"));
|
|
313
|
+
} else if (row.surprisePercent != null) {
|
|
318
314
|
comparison.push(detailRow("Surprise", `${earningsInput(row.surprisePercent)}%`, undefined,
|
|
319
315
|
row.surprisePercent === 0 ? undefined : row.surprisePercent > 0 ? "positive" : "negative"));
|
|
320
316
|
}
|
|
@@ -483,7 +479,8 @@ export function CorporateActionsView({
|
|
|
483
479
|
reload: reloadActions,
|
|
484
480
|
} = useTickerRequest<CorporateActionsData>(actionsLoader, symbol, exchange);
|
|
485
481
|
const { data: calendarEvent, reload: reloadCalendar } = useTickerRequest(calendarLoader, symbol, exchange);
|
|
486
|
-
|
|
482
|
+
// The listing's own day, as `earnings` reads a report date: SIE:XETRA's has passed once Berlin's day has.
|
|
483
|
+
const today = listingDay(exchange);
|
|
487
484
|
const actionsData = useMemo(
|
|
488
485
|
() => (recordedActions ? withResolvedEarnings(recordedActions, calendarEvent, today) : recordedActions),
|
|
489
486
|
[calendarEvent, recordedActions, today],
|
|
@@ -498,11 +495,15 @@ export function CorporateActionsView({
|
|
|
498
495
|
const allRows = useMemo(() => (
|
|
499
496
|
buildEventRows(actionsData, analystData, financialsData, displayCurrency)
|
|
500
497
|
), [actionsData, analystData, displayCurrency, financialsData]);
|
|
498
|
+
// In the order they happen, as a calendar reads, from the oldest to the
|
|
499
|
+
// furthest estimate; the pane opens on the present (selectedIdx). The
|
|
500
|
+
// model's newest-first order is the report's, cut by a limit; a day's
|
|
501
|
+
// events keep its order among themselves.
|
|
501
502
|
const rows = useMemo(() => (
|
|
502
503
|
variant === "earnings-estimates"
|
|
503
504
|
? allRows.filter((row) => EARNINGS_STATUSES.has(row.status))
|
|
504
|
-
: allRows
|
|
505
|
-
), [allRows, variant]);
|
|
505
|
+
: [...allRows]
|
|
506
|
+
).sort((left, right) => left.date.localeCompare(right.date)), [allRows, variant]);
|
|
506
507
|
const unit = useMemo(() => sharedMetricCurrency(rows), [rows]);
|
|
507
508
|
const hasUnstatedCurrency = rows.some((row) =>
|
|
508
509
|
((row.qEps != null || row.annualEps != null) && !row.epsCurrency)
|
|
@@ -524,15 +525,23 @@ export function CorporateActionsView({
|
|
|
524
525
|
// Keyed by row id, not by position, so a reload or a shared layout comes
|
|
525
526
|
// back to the same event.
|
|
526
527
|
const [selectedKey, setSelectedKey] = usePluginPaneState<string | null>("selectedKey", null);
|
|
527
|
-
|
|
528
|
+
// Until one is picked, the next event: the rows run oldest to the furthest estimate, and the present is what is read first.
|
|
529
|
+
const selectedIdx = useMemo(() => {
|
|
530
|
+
const picked = rows.findIndex((row) => eventRowKey(row) === selectedKey);
|
|
531
|
+
if (picked >= 0) return picked;
|
|
532
|
+
const next = rows.findIndex((row) => row.date >= today);
|
|
533
|
+
return next >= 0 ? next : Math.max(0, rows.length - 1);
|
|
534
|
+
}, [rows, selectedKey, today]);
|
|
528
535
|
const [openRowId, setOpenRowId] = usePluginPaneState<string | null>("openRowId", null);
|
|
529
536
|
const detailScrollRef = useRef<ScrollBoxRenderable>(null);
|
|
530
|
-
const todayKey = todayDateKey();
|
|
531
537
|
const futureRowBackground = blendHex(colors.bg, colors.positive, 0.16);
|
|
532
|
-
//
|
|
538
|
+
// Tinted after the day the pane opens on, New York's, as the calendar dates
|
|
539
|
+
// a report: on the local day, a reader east of New York saw today's row
|
|
540
|
+
// opened untinted beside the next day's. Memoized so the table's row memo
|
|
541
|
+
// holds while the selection moves.
|
|
533
542
|
const rowBackground = useCallback((row: EventRow) => (
|
|
534
|
-
row.date >
|
|
535
|
-
), [futureRowBackground,
|
|
543
|
+
row.date > today ? futureRowBackground : undefined
|
|
544
|
+
), [futureRowBackground, today]);
|
|
536
545
|
const loading = actionsLoading || analystLoading;
|
|
537
546
|
const authWall = !loading && !actionsData && !analystData && (isCloudSessionRequired(actionsError) || isCloudSessionRequired(analystError));
|
|
538
547
|
// Parallel requests fail with the same message ("No ticker selected"), so the
|
|
@@ -630,7 +639,8 @@ export function CorporateActionsView({
|
|
|
630
639
|
};
|
|
631
640
|
switch (column.id) {
|
|
632
641
|
case "date":
|
|
633
|
-
|
|
642
|
+
// Day-first as the Filings tab beside it dates its rows; the ISO day still sorts the column.
|
|
643
|
+
return { text: formatFilingDate(row.date, row.date), value: row.date, color: colors.textDim };
|
|
634
644
|
case "status":
|
|
635
645
|
return { text: row.status, color: colors.textBright, attributes: TextAttributes.BOLD };
|
|
636
646
|
case "period":
|
|
@@ -640,9 +650,9 @@ export function CorporateActionsView({
|
|
|
640
650
|
case "revenue":
|
|
641
651
|
return metric(row.qRevenue ?? row.annualRevenue, row.revenueCurrency, "revenue");
|
|
642
652
|
case "surprise":
|
|
643
|
-
return { text: row.status === "Earnings" ? row.value :
|
|
653
|
+
return { text: row.status === "Earnings" ? row.value : MISSING_VALUE, value: row.surprisePercent, color: row.status === "Earnings" ? toneColor(row.tone) : colors.textDim };
|
|
644
654
|
case "growth":
|
|
645
|
-
return { text: row.estimateGrowthMetric && row.value !==
|
|
655
|
+
return { text: row.estimateGrowthMetric && row.value !== MISSING_VALUE ? `${row.value} ${row.estimateGrowthMetric === "eps" ? "EPS" : "rev"}` : MISSING_VALUE, color: row.estimateGrowthMetric ? toneColor(row.tone) : colors.textDim };
|
|
646
656
|
case "qEps":
|
|
647
657
|
return metric(row.qEps, row.epsCurrency, "eps");
|
|
648
658
|
case "qRevenue":
|
|
@@ -704,7 +714,7 @@ export function CorporateActionsView({
|
|
|
704
714
|
columns={columns}
|
|
705
715
|
items={rows}
|
|
706
716
|
sortColumnId={null}
|
|
707
|
-
sortDirection="
|
|
717
|
+
sortDirection="asc"
|
|
708
718
|
getItemKey={eventRowKey}
|
|
709
719
|
renderCell={renderCell}
|
|
710
720
|
getExportMetadata={() => [
|
|
@@ -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
|