gloomberb 0.20.13 → 0.20.16
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/checkout-handoff.tsx +7 -14
- package/src/account/device-signin-dialog.tsx +35 -24
- package/src/api-client/crypto-markets.ts +10 -0
- package/src/api-client/errors.ts +3 -1
- package/src/api-client/index.ts +54 -0
- package/src/api-client/install-experiments.ts +8 -7
- package/src/api-client/money-markets.ts +7 -0
- package/src/api-client/paths.ts +2 -1
- package/src/api-client/product-waitlist.ts +63 -0
- package/src/api-client/request.ts +16 -4
- package/src/api-client/types/billing.ts +45 -0
- package/src/api-client/yearly-plan.ts +132 -0
- package/src/app/global-shortcuts.ts +5 -3
- package/src/app/pane-runtime/index.tsx +2 -2
- package/src/app/pane-runtime/plugin-bindings.ts +3 -1
- package/src/app/pane-runtime/ticker-open-runtime.ts +6 -1
- package/src/app/since-last-visit/keys.ts +26 -0
- package/src/app/since-last-visit/model.ts +266 -0
- package/src/app/since-last-visit/strip.tsx +193 -0
- package/src/app/since-last-visit/use-since-last-visit.ts +289 -0
- package/src/app/since-last-visit/visit-tracker.ts +191 -0
- package/src/app.tsx +15 -0
- package/src/architecture/floating-promise-allowlist.json +0 -1
- package/src/brokers/signed-in/sign-in-dialog.tsx +38 -38
- package/src/cli/commands/market.ts +103 -27
- package/src/cli/commands/overview.ts +18 -4
- package/src/cli/commands/system.ts +29 -1
- package/src/cli/commands/ticker.ts +12 -5
- package/src/cli/desktop-pane-shot-api-policy.ts +4 -1
- package/src/cli/desktop-pane-shot-browser.ts +2 -1
- package/src/cli/desktop-pane-shot-view.ts +3 -7
- package/src/cli/desktop-pane-shot.ts +26 -28
- package/src/cli/errors.ts +3 -1
- package/src/cli/freshness.ts +7 -2
- package/src/cli/glossary.ts +10 -5
- package/src/cli/help.ts +1 -0
- package/src/cli/helpers.ts +8 -16
- package/src/cli/history-export.ts +4 -0
- package/src/cli/history-rows.ts +24 -0
- package/src/cli/index.ts +4 -0
- package/src/cli/known-gaps.ts +2 -2
- package/src/cli/listing-arg.ts +79 -11
- package/src/cli/not-a-ticker.ts +4 -0
- package/src/cli/options.ts +29 -1
- package/src/cli/pane-functions/catalog.ts +70 -12
- package/src/cli/pane-functions/function-help.ts +1 -1
- package/src/cli/pane-functions/headless.ts +68 -3
- package/src/cli/pane-functions/index.ts +2 -2
- package/src/cli/pane-functions/options.ts +7 -0
- package/src/cli/pane-functions/resolver.ts +104 -15
- package/src/cli/pane-functions/screenshot-payload.ts +3 -0
- package/src/cli/report-tables.ts +20 -5
- package/src/cli/result.ts +22 -4
- package/src/cli/shot-temp-dir.ts +30 -0
- package/src/cli/suffixed-listing-rows.ts +11 -0
- 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/composite-chart.tsx +3 -3
- package/src/components/chart/composite/format.ts +2 -1
- 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/command-bar/commands/collection-list.ts +1 -0
- package/src/components/command-bar/commands/direct/index.ts +31 -8
- package/src/components/command-bar/commands/registry.ts +7 -0
- package/src/components/command-bar/routes/root/command-items.ts +8 -0
- package/src/components/command-bar/routes/root/results.ts +19 -2
- 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/company-logo.tsx +10 -3
- package/src/components/data-table/sections.ts +6 -1
- package/src/components/layout/pane/title.ts +16 -6
- package/src/components/layout/shell/index.tsx +5 -1
- package/src/components/layout/shell/ticker-link-menu.ts +12 -9
- 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/ticker/badge/format.ts +12 -3
- package/src/components/ticker/badge/index.tsx +9 -3
- package/src/components/ticker/list-table-view.tsx +119 -17
- package/src/components/ui/choice-dialog.tsx +1 -1
- package/src/components/ui/confirm-dialog.tsx +3 -2
- package/src/components/ui/data-table/display-columns.ts +16 -0
- package/src/components/ui/data-table/index.tsx +40 -9
- package/src/components/ui/data-table/types.ts +14 -0
- 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/number-prompt-dialog.tsx +2 -1
- package/src/components/use-pane-notice-footer.tsx +3 -1
- package/src/core/state/app/layout-reducer.ts +3 -1
- package/src/core/state/app/layout.ts +2 -2
- package/src/data/config/layout.ts +14 -0
- package/src/data/config/store/normalize.ts +11 -1
- package/src/docs/snapshot.json +2 -2
- package/src/i18n/es.ts +39 -0
- package/src/i18n/ja.ts +39 -0
- package/src/i18n/ko.ts +39 -0
- package/src/i18n/zh-cn.ts +39 -0
- package/src/i18n/zh-tw.ts +39 -0
- package/src/layout/pane-follow.ts +141 -4
- package/src/layout/pane-layout-move.ts +10 -7
- package/src/layout/ticker-navigation.ts +13 -19
- package/src/layout/ticker-retarget.ts +3 -2
- package/src/market-data/market/format.ts +35 -1
- package/src/market-data/market/index-level.ts +19 -0
- package/src/market-data/quotes/contributions.ts +13 -0
- package/src/market-data/quotes/export-identity.ts +36 -1
- package/src/market-data/quotes/resolution.ts +16 -0
- package/src/plugins/builtin/account-management/keyboard.ts +14 -0
- package/src/plugins/builtin/account-management/model.ts +2 -0
- package/src/plugins/builtin/account-management/pane.tsx +79 -7
- package/src/plugins/builtin/account-management/password-dialog.tsx +2 -2
- package/src/plugins/builtin/account-management/payment-recovery-row.tsx +97 -0
- package/src/plugins/builtin/account-management/yearly-plan-row.tsx +359 -0
- 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 +20 -9
- package/src/plugins/builtin/analytics/risk-pane.tsx +2 -2
- package/src/plugins/builtin/awards/pane.tsx +6 -8
- package/src/plugins/builtin/changelog/index.tsx +6 -44
- package/src/plugins/builtin/changelog/versions.ts +17 -68
- 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/pane.tsx +1 -1
- 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/cloud/askg/executor.ts +2 -1
- package/src/plugins/builtin/cloud/askg/sources.ts +2 -1
- package/src/plugins/builtin/cloud/plugin.tsx +2 -0
- 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/cpi/headless.ts +6 -1
- package/src/plugins/builtin/cpi/model.ts +17 -0
- package/src/plugins/builtin/cpi/pane.tsx +4 -2
- package/src/plugins/builtin/crypto-board/client.ts +6 -1
- package/src/plugins/builtin/crypto-board/headless.ts +10 -2
- package/src/plugins/builtin/crypto-board/model.ts +89 -11
- package/src/plugins/builtin/crypto-board/pane.tsx +20 -5
- package/src/plugins/builtin/debt-maturities/model.ts +1 -1
- package/src/plugins/builtin/dividend-yield/client.ts +24 -2
- package/src/plugins/builtin/dividend-yield/headless.ts +4 -2
- package/src/plugins/builtin/dividend-yield/ranking.ts +2 -1
- package/src/plugins/builtin/dividend-yield/view.ts +5 -1
- package/src/plugins/builtin/earnings/board-table.ts +1 -1
- package/src/plugins/builtin/earnings/board.tsx +36 -16
- package/src/plugins/builtin/earnings/highlight.ts +47 -0
- package/src/plugins/builtin/earnings/history-table.ts +9 -1
- package/src/plugins/builtin/earnings/index.tsx +1 -1
- package/src/plugins/builtin/earnings-calls/pane.tsx +2 -2
- package/src/plugins/builtin/earnings-ripple/index.tsx +2 -0
- package/src/plugins/builtin/econ/calendar-model.ts +17 -1
- package/src/plugins/builtin/econ/fred-catalog.ts +33 -4
- package/src/plugins/builtin/econ-statistics/headless.ts +21 -0
- package/src/plugins/builtin/estimate-revisions/model.ts +1 -1
- package/src/plugins/builtin/exposure/index.tsx +1 -1
- package/src/plugins/builtin/macro-day/headless.ts +21 -10
- package/src/plugins/builtin/macro-day/model.ts +42 -3
- package/src/plugins/builtin/macro-day/pane.tsx +26 -8
- package/src/plugins/builtin/macro-day/releases.ts +24 -1
- package/src/plugins/builtin/market-valuation/detail.tsx +3 -3
- package/src/plugins/builtin/market-valuation/headless.ts +11 -4
- package/src/plugins/builtin/market-valuation/pane.tsx +3 -1
- package/src/plugins/builtin/market-valuation/view.ts +14 -0
- package/src/plugins/builtin/money-markets/client.ts +4 -1
- package/src/plugins/builtin/money-markets/headless.ts +15 -4
- package/src/plugins/builtin/money-markets/index.tsx +1 -1
- package/src/plugins/builtin/money-markets/pane.tsx +7 -1
- package/src/plugins/builtin/news/wire/news/detail-view.tsx +20 -8
- package/src/plugins/builtin/pe-band/pane.tsx +1 -1
- 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/render.ts +8 -1
- package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +178 -17
- package/src/plugins/builtin/portfolio-list/headless.ts +33 -6
- package/src/plugins/builtin/portfolio-list/pane/groups.tsx +220 -0
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +95 -18
- package/src/plugins/builtin/portfolio-list/pane/period-pnl.ts +24 -6
- package/src/plugins/builtin/portfolio-list/period-pnl.ts +16 -1
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +4 -1
- package/src/plugins/builtin/portfolio-list/summary/totals.ts +6 -4
- package/src/plugins/builtin/portfolio-list/table.tsx +38 -16
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +4 -2
- package/src/plugins/builtin/research/relative-valuation-headless.ts +15 -5
- package/src/plugins/builtin/research/relative-valuation-model.ts +7 -1
- package/src/plugins/builtin/research/relative-valuation-pane.tsx +7 -4
- 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/headless-options.ts +1 -1
- package/src/plugins/builtin/social-mentions/model.ts +2 -2
- package/src/plugins/builtin/thirteenf/pane.tsx +1 -1
- package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +45 -2
- package/src/plugins/builtin/ticker-detail/financials/model.ts +51 -16
- package/src/plugins/builtin/ticker-detail/financials/nopat.ts +16 -0
- package/src/plugins/builtin/ticker-detail/financials/ratios.ts +44 -13
- package/src/plugins/builtin/ticker-detail/financials/schema.ts +33 -2
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +4 -2
- package/src/plugins/builtin/ticker-detail/headless-schema.ts +30 -4
- package/src/plugins/builtin/ticker-detail/headless.ts +280 -35
- package/src/plugins/builtin/ticker-detail/overview/components.tsx +4 -5
- package/src/plugins/builtin/ticker-detail/overview/model.ts +9 -2
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +10 -2
- package/src/plugins/builtin/ticker-detail/pharma-signals/eligibility.ts +32 -0
- package/src/plugins/builtin/ticker-detail/pharma-signals/tab.tsx +162 -0
- package/src/plugins/builtin/ticker-detail/pharma-signals/waitlist.ts +126 -0
- package/src/plugins/builtin/ticker-detail/research-groups.ts +6 -4
- package/src/plugins/builtin/ticker-detail/research-tabs.ts +11 -0
- package/src/portfolio/collection-name.ts +2 -1
- package/src/portfolio/column-values.ts +34 -12
- package/src/portfolio/listed-symbol.ts +4 -2
- package/src/portfolio/period-pnl.ts +51 -1
- package/src/portfolio/suffixed-listings.ts +3 -1
- package/src/portfolio/watchlist-groups.ts +212 -0
- package/src/react/ticker-source.ts +3 -1
- package/src/renderers/dom/dialog-host.tsx +5 -5
- package/src/renderers/dom/styles.css +7 -0
- package/src/renderers/electrobun/view/remote/capability-invoker.ts +1 -1
- package/src/renderers/opentui/dialog-host.tsx +3 -4
- package/src/sources/gloomberb-cloud/normalizers.ts +5 -0
- package/src/sources/provider-router/history.ts +5 -2
- package/src/state/app/bootstrap.ts +11 -0
- package/src/state/app/context/index.tsx +6 -0
- package/src/sync/collections-contributor.ts +5 -2
- package/src/sync/config-merge.ts +10 -2
- package/src/sync/sanitize.ts +28 -0
- package/src/telemetry/usage-counts.ts +17 -0
- package/src/test-support/plugin-persistence.ts +12 -0
- package/src/tickers/company-name-listing.ts +4 -3
- package/src/tickers/company-name.ts +19 -1
- package/src/tickers/instrument-coverage.ts +27 -0
- package/src/tickers/search/home-listing.ts +38 -1
- package/src/tickers/search/index.ts +3 -2
- package/src/tickers/search/ranking.ts +21 -2
- package/src/time-series/base-series.ts +4 -0
- package/src/time-series/chart-seed.ts +1 -1
- package/src/time-series/financial-period-coverage.ts +4 -12
- package/src/time-series/parsed-history-cache.ts +1 -1
- package/src/time-series/resolve.ts +1 -1
- package/src/time-series/types.ts +5 -2
- package/src/time-series/use-chart-resolution.ts +6 -1
- package/src/types/config.ts +32 -0
- package/src/types/financials.ts +13 -0
- package/src/types/headless.ts +7 -0
- package/src/types/plugin-context.ts +5 -0
- package/src/types/ticker.ts +14 -0
- package/src/ui/ascii-font.ts +1 -4
- package/src/ui/dialog-stack.ts +17 -0
- package/src/ui/dialog.tsx +6 -2
- package/src/utils/async-deadline.ts +2 -2
- package/src/utils/crypto-pair.ts +9 -0
- package/src/utils/csv.ts +44 -5
- package/src/utils/exchanges.ts +13 -0
- package/src/utils/financial-statements.ts +60 -3
- package/src/utils/futures-generic.ts +17 -0
- package/src/utils/trailing-dividend.ts +13 -3
|
@@ -110,6 +110,7 @@ function buildRelativeColumns(
|
|
|
110
110
|
peNamesYear = false,
|
|
111
111
|
growthLabel = REVENUE_GROWTH_LABEL,
|
|
112
112
|
symbolWidth = SYMBOL_WIDTH,
|
|
113
|
+
forwardNamesYear = false,
|
|
113
114
|
): RelativeColumn[] {
|
|
114
115
|
// The name gives back what a wide ticker takes, so the figures keep their place.
|
|
115
116
|
const nameWidth = Math.max(10, 16 - (symbolWidth - SYMBOL_WIDTH));
|
|
@@ -129,7 +130,8 @@ function buildRelativeColumns(
|
|
|
129
130
|
{ id: "marketCap", label: `MCAP ${baseCurrency}`, width: capWidth, align: "right" },
|
|
130
131
|
// Wider while a peer's P/E is on its latest fiscal year's EPS and names it ("24.6 FY Mar-26").
|
|
131
132
|
{ id: "trailingPE", label: "P/E", width: peNamesYear ? 14 : metricWidth, align: "right" },
|
|
132
|
-
|
|
133
|
+
// Wider while a peer's forward P/E names the fiscal year of its consensus ("24.8 FY28").
|
|
134
|
+
{ id: "forwardPE", label: "FWD", width: forwardNamesYear ? 10 : metricWidth, align: "right" },
|
|
133
135
|
{ id: "evSales", label: "EV/S", width: metricWidth, align: "right" },
|
|
134
136
|
{ id: "fcfYield", label: "FCF%", width: metricWidth, align: "right" },
|
|
135
137
|
// Latest quarter against the year before, and a trailing-twelve-month margin.
|
|
@@ -284,11 +286,12 @@ export function RelativeValuationPane({ focused, width, height }: PaneProps) {
|
|
|
284
286
|
const extendedSessionsKey = extendedSessionsOf(rows).join(",");
|
|
285
287
|
const marginNamesYear = rows.some((row) => row.operatingMarginPeriod != null);
|
|
286
288
|
const peNamesYear = rows.some((row) => row.trailingPEPeriod != null);
|
|
289
|
+
const forwardNamesYear = rows.some((row) => row.forwardPEPeriod != null);
|
|
287
290
|
const growthLabel = revenueGrowthHeader(rows, REVENUE_GROWTH_LABEL, PERIOD_REVENUE_GROWTH_LABEL);
|
|
288
291
|
const columns = useMemo(
|
|
289
292
|
() => buildRelativeColumns(baseCurrency, extendedSessionsKey ? extendedSessionsKey.split(",") as ExtendedSession[] : [], marginNamesYear, peNamesYear,
|
|
290
|
-
growthLabel, symbolWidth),
|
|
291
|
-
[baseCurrency, extendedSessionsKey, marginNamesYear, peNamesYear, growthLabel, symbolWidth],
|
|
293
|
+
growthLabel, symbolWidth, forwardNamesYear),
|
|
294
|
+
[baseCurrency, extendedSessionsKey, marginNamesYear, peNamesYear, growthLabel, symbolWidth, forwardNamesYear],
|
|
292
295
|
);
|
|
293
296
|
|
|
294
297
|
const comparableRows = useMemo(() => rows.map((row) => ({
|
|
@@ -382,7 +385,7 @@ export function RelativeValuationPane({ focused, width, height }: PaneProps) {
|
|
|
382
385
|
return { text: `${formatPriceEarnings(row.reportedMultiples.trailingPE)}${row.trailingPEPeriod ? ` ${row.trailingPEPeriod}` : ""}`, color: colors.text };
|
|
383
386
|
case "forwardPE":
|
|
384
387
|
if (row.notMeaningful.forwardPE) return notMeaningfulCell();
|
|
385
|
-
return { text: formatPriceEarnings(row.reportedMultiples.forwardPE)
|
|
388
|
+
return { text: `${formatPriceEarnings(row.reportedMultiples.forwardPE)}${row.forwardPEPeriod ? ` ${row.forwardPEPeriod}` : ""}`, color: colors.text };
|
|
386
389
|
case "evSales":
|
|
387
390
|
// A withdrawn EV says so, one at or below zero reads N/M as a P/E over a loss does; the footer says why.
|
|
388
391
|
if (row.evSales == null && row.notMeaningful.evSales) return notMeaningfulCell();
|
|
@@ -53,6 +53,8 @@ interface CloudUpgradeOptions {
|
|
|
53
53
|
* never for a press ignored as a repeat.
|
|
54
54
|
*/
|
|
55
55
|
onOpening?: () => void;
|
|
56
|
+
/** What the press is about, said under the sign-up dialog's title when it opens first (`Stock quotes are 15 min delayed`). */
|
|
57
|
+
reason?: string;
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
function recordUpgradeIntent(placement: string | undefined): void {
|
|
@@ -178,7 +180,7 @@ export function openCloudUpgradeUrl(placement: string): boolean {
|
|
|
178
180
|
return true;
|
|
179
181
|
}
|
|
180
182
|
|
|
181
|
-
const CLOUD_UPGRADE_OPTION_KEYS: ReadonlyArray<keyof CloudUpgradeOptions> = ["placement", "interval", "recordIntent", "sheet", "onOpening"];
|
|
183
|
+
const CLOUD_UPGRADE_OPTION_KEYS: ReadonlyArray<keyof CloudUpgradeOptions> = ["placement", "interval", "recordIntent", "sheet", "onOpening", "reason"];
|
|
182
184
|
|
|
183
185
|
/** A press event carries none of these keys, so it never reads as options. */
|
|
184
186
|
function isCloudUpgradeOptions(value: unknown): value is CloudUpgradeOptions {
|
|
@@ -243,7 +245,7 @@ export function useCloudUpgradeAction(placement: string): (options?: unknown) =>
|
|
|
243
245
|
if (resolvePlanAccess(apiClient.getCurrentUser()).hasProAccess) return;
|
|
244
246
|
void openUpgradeRef.current({ ...checkout, recordIntent: false });
|
|
245
247
|
};
|
|
246
|
-
if (requestAuthDialog({ mode: "signup", onSignedIn: continueSignedIn })) {
|
|
248
|
+
if (requestAuthDialog({ mode: "signup", onSignedIn: continueSignedIn, ...(checkout.reason ? { reason: checkout.reason } : {}) })) {
|
|
247
249
|
if (checkout.recordIntent !== false) recordUpgradeIntent(checkout.placement);
|
|
248
250
|
return;
|
|
249
251
|
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The months BLS never published a CPI index for: October 2025, which the
|
|
3
|
+
* 2025 shutdown left uncollected. Every index of the release, all items and
|
|
4
|
+
* core among them, has no level that month, so a change against it has none.
|
|
5
|
+
*/
|
|
6
|
+
const UNPUBLISHED_CPI_MONTHS: ReadonlySet<string> = new Set(["2025-10"]);
|
|
7
|
+
|
|
8
|
+
const MONTH_NAMES = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November",
|
|
9
|
+
"December"];
|
|
10
|
+
|
|
11
|
+
/** "October 2025" from 2025-10 (a `YYYY-MM-DD` date names its month too). */
|
|
12
|
+
const monthName = (period: string) => `${MONTH_NAMES[Number(period.slice(5, 7)) - 1]} ${period.slice(0, 4)}`;
|
|
13
|
+
|
|
14
|
+
/** The month before or after one, `YYYY-MM`. */
|
|
15
|
+
function shiftMonth(period: string, months: number): string {
|
|
16
|
+
const at = new Date(Date.UTC(Number(period.slice(0, 4)), Number(period.slice(5, 7)) - 1 + months, 1));
|
|
17
|
+
return at.toISOString().slice(0, 7);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Why a CPI month has no change over twelve months, when the month a year
|
|
22
|
+
* before it has no index: "BLS published no October 2025 index, so no
|
|
23
|
+
* October 2026 y/y". Null for any other month (`YYYY-MM`).
|
|
24
|
+
*/
|
|
25
|
+
function cpiYearGapReason(period: string): string | null {
|
|
26
|
+
const yearAgo = shiftMonth(period, -12);
|
|
27
|
+
return UNPUBLISHED_CPI_MONTHS.has(yearAgo) ? `BLS published no ${monthName(yearAgo)} index, so no ${monthName(period)} y/y` : null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The line a CPI table with no year-over-year change for `period` closes on:
|
|
32
|
+
* why, and the latest change it has, "BLS published no October 2025 index, so
|
|
33
|
+
* no October 2026 y/y; All items 3.7% in September 2026." `latest` is the
|
|
34
|
+
* latest month that has one and its change in percent, to one decimal as BLS
|
|
35
|
+
* prints it. Null when the month has its change or none is missing for that reason.
|
|
36
|
+
*/
|
|
37
|
+
export function cpiYearGapNote(period: string, label: string, latest: { period: string; value: number } | null): string | null {
|
|
38
|
+
const reason = cpiYearGapReason(period);
|
|
39
|
+
if (!reason) return null;
|
|
40
|
+
return latest ? `${reason}; ${label} ${latest.value.toFixed(1)}% in ${monthName(latest.period)}.` : `${reason}.`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* For a CPI series whose latest change over twelve months is for `latest`
|
|
45
|
+
* (`YYYY-MM`, or its first day), why the month after it has none, and the
|
|
46
|
+
* latest month's name: ECST's CPI y/y reads September 2026 after October's
|
|
47
|
+
* CPI is out, as October has no y/y. Null when the next month has its change.
|
|
48
|
+
*/
|
|
49
|
+
export function cpiNextYearGap(latest: string): { reason: string; latestMonth: string } | null {
|
|
50
|
+
const month = latest.slice(0, 7);
|
|
51
|
+
const reason = cpiYearGapReason(shiftMonth(month, 1));
|
|
52
|
+
return reason ? { reason, latestMonth: monthName(month) } : null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** The US CPI changes over twelve months the economic calendar lists, all items and core, under the ids it gives them. */
|
|
56
|
+
const US_CPI_YOY_INDICATORS: ReadonlySet<string> = new Set(["us-inflation-rate-yoy", "us-core-inflation-rate-yoy"]);
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Why an economic calendar row of a US CPI change over twelve months has no
|
|
60
|
+
* actual, when the month a year before the one it covers has no index: the
|
|
61
|
+
* release of 10 November 2026 covers October 2026, and October 2025 was never
|
|
62
|
+
* published. A US CPI release covers the month before it. Null for any other row.
|
|
63
|
+
*/
|
|
64
|
+
export function cpiCalendarYearGapReason(row: { country: string; indicatorId?: string | null; actual: string | null; date: Date }): string | null {
|
|
65
|
+
if (row.country !== "US" || !row.indicatorId || !US_CPI_YOY_INDICATORS.has(row.indicatorId) || row.actual?.trim()) return null;
|
|
66
|
+
return cpiYearGapReason(shiftMonth(row.date.toISOString().slice(0, 7), -1));
|
|
67
|
+
}
|
|
@@ -36,7 +36,7 @@ export const FINANCIAL_PERIOD_OPTION: HeadlessPaneOptionDef = {
|
|
|
36
36
|
|
|
37
37
|
export const FINANCIAL_PERIOD_COUNT_OPTION: HeadlessPaneOptionDef = {
|
|
38
38
|
key: "periods",
|
|
39
|
-
description: "Keep only the latest N annual or quarterly
|
|
39
|
+
description: "Keep only the latest N annual or quarterly periods per ticker; a period without a value stays as a gap.",
|
|
40
40
|
type: "integer",
|
|
41
41
|
aliases: ["years", "limit"],
|
|
42
42
|
minimum: 1,
|
|
@@ -47,8 +47,8 @@ export type SocialColumn = Omit<DataTableColumn, "id"> & { id: SocialColumnId };
|
|
|
47
47
|
export const SOCIAL_COLUMNS: SocialColumn[] = [
|
|
48
48
|
{ id: "day", label: "DATE", width: 12, align: "left" },
|
|
49
49
|
{ id: "mentions", label: "POSTS", width: 9, align: "right" },
|
|
50
|
-
{ id: "ratio", label: "VS MEDIAN", width: 10, align: "right" },
|
|
51
|
-
{ id: "wikiViews", label: "WIKI", width: 8, align: "right" },
|
|
50
|
+
{ id: "ratio", label: "VS MEDIAN", width: 10, align: "right", omitWhenEmpty: true },
|
|
51
|
+
{ id: "wikiViews", label: "WIKI", width: 8, align: "right", omitWhenEmpty: true },
|
|
52
52
|
{ id: "redditMentions", label: "REDDIT", width: 8, align: "right" },
|
|
53
53
|
{ id: "stance", label: "STANCE", width: 8, align: "right" },
|
|
54
54
|
{ id: "topPost", label: "TOP POST", width: 24, flexGrow: 1, align: "left" },
|
|
@@ -178,7 +178,7 @@ function ThirteenFBrowserPane({ focused, width, height, onDetailChange }: PanePr
|
|
|
178
178
|
const columns = useMemo(() => {
|
|
179
179
|
if (browserMode !== "performance") return buildBrowserColumns(false);
|
|
180
180
|
const history = rows[0]?.priorReturns ?? [];
|
|
181
|
-
return [...buildBrowserColumns().filter(column => !["rows", "filed"].includes(column.id)), ...history.map((point, index) => ({ id: `return${index + 1}` as FundBrowserColumnId, label: point.quarter, width: 10, align: "right" as const }))];
|
|
181
|
+
return [...buildBrowserColumns().filter(column => !["rows", "filed"].includes(column.id)), ...history.map((point, index) => ({ id: `return${index + 1}` as FundBrowserColumnId, label: point.quarter, width: 10, align: "right" as const, omitWhenEmpty: true }))];
|
|
182
182
|
}, [browserMode, rows]);
|
|
183
183
|
|
|
184
184
|
useEffect(() => {
|
|
@@ -4,6 +4,10 @@ import { dollarPairLabel, spotFromUsdValue, spotRateKind } from "../../../../mar
|
|
|
4
4
|
import { loadHeadlessFinancials, resolveHeadlessInstrument } from "../../shared/headless-market-data";
|
|
5
5
|
import { quoteObservation } from "../../shared/report-freshness";
|
|
6
6
|
import { heldCurrencyUnit } from "../../../../utils/currency-units";
|
|
7
|
+
import { canonicalExchange, displayTickerKey, isUsListingExchange, parsePublicTickerKey } from "../../../../utils/exchanges";
|
|
8
|
+
import { listingSuffixCandidate } from "../../../../sources/listing-symbols";
|
|
9
|
+
import { companyLinesName } from "../../../../tickers/company-name";
|
|
10
|
+
import { logFailure } from "../../../../utils/log-failure";
|
|
7
11
|
import { adrPairComparison, adrPairFigures, adrPairInputRows, adrPairLegs, ADR_PAIR_TEMPLATE_ID } from "./model";
|
|
8
12
|
|
|
9
13
|
/** Words that ask for this report's figures without being its code: `fn CCL` answers with ADR. */
|
|
@@ -32,6 +36,43 @@ async function readQuote(key: string, ctx: LoadContext, failed: (error: unknown)
|
|
|
32
36
|
return ctx.marketData.getQuote(instrument.symbol, instrument.exchange ?? "").catch(failed);
|
|
33
37
|
}
|
|
34
38
|
|
|
39
|
+
/** The company's other lines a note names before it counts the rest ("and 2 more"). */
|
|
40
|
+
const OTHER_LINES_NAMED = 3;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The company's lines on venues other than the pair's, as their listings
|
|
44
|
+
* (Hong Kong's 0005:HKEX for HSBC beside its London home line), with the
|
|
45
|
+
* issuer's name. Null when the service cannot say.
|
|
46
|
+
*/
|
|
47
|
+
async function otherLines(receiptKey: string, homeKey: string, ctx: LoadContext): Promise<{ issuer: string; lines: string[] } | null> {
|
|
48
|
+
const { getIssuerListings } = ctx.marketData;
|
|
49
|
+
if (!getIssuerListings) return null;
|
|
50
|
+
const [receipt, home] = await Promise.all([resolveHeadlessInstrument(ctx, receiptKey), resolveHeadlessInstrument(ctx, homeKey)]);
|
|
51
|
+
const homeVenue = canonicalExchange(home.exchange || listingSuffixCandidate(home.symbol)?.exchange || parsePublicTickerKey(homeKey).exchange);
|
|
52
|
+
const issuer = await Promise.resolve().then(() => getIssuerListings.call(ctx.marketData, receipt.symbol, receipt.exchange || undefined))
|
|
53
|
+
.catch(logFailure("plugins.adr-pair", "Reading the company's listings failed", null));
|
|
54
|
+
if (!issuer) return null;
|
|
55
|
+
// The receipt is the company's US line; another US line or the home venue's is no line abroad to add.
|
|
56
|
+
const lines = issuer.listings.filter((line) => {
|
|
57
|
+
const venue = canonicalExchange(line.exchange);
|
|
58
|
+
return venue && venue !== homeVenue && !isUsListingExchange(venue);
|
|
59
|
+
}).map((line) => parsePublicTickerKey(line.symbol).exchange ? displayTickerKey(line.symbol) : `${line.symbol}:${canonicalExchange(line.exchange)}`);
|
|
60
|
+
return { issuer: issuer.name, lines: [...new Set(lines)] };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* "HSBC Holdings plc also lists 0005:HKEX.", the company named as the
|
|
65
|
+
* not-traded message names it (`companyLinesName`, by its home line's name),
|
|
66
|
+
* the first few lines and how many more. Null when it has no other line.
|
|
67
|
+
*/
|
|
68
|
+
function otherLinesNote(other: { issuer: string; lines: string[] } | null, home: Quote | null): string | null {
|
|
69
|
+
if (!other || other.lines.length === 0) return null;
|
|
70
|
+
const named = other.lines.slice(0, OTHER_LINES_NAMED);
|
|
71
|
+
const more = other.lines.length - named.length;
|
|
72
|
+
const list = more > 0 ? `${named.join(", ")} and ${more} more` : named.join(", ");
|
|
73
|
+
return `${companyLinesName(home?.name, other.issuer)} also lists ${list}.`;
|
|
74
|
+
}
|
|
75
|
+
|
|
35
76
|
export const adrPairHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
36
77
|
shape: "bundle",
|
|
37
78
|
argument: { kind: "ticker", description: "A depositary receipt (GGAL, TSM) or its home listing (GGAL.BA, 2330.TW)" },
|
|
@@ -63,12 +104,14 @@ export const adrPairHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
63
104
|
errors.push(`${label}: ${error instanceof Error ? error.message : String(error)}`);
|
|
64
105
|
return null;
|
|
65
106
|
};
|
|
66
|
-
const [receipt, home] = await Promise.all([
|
|
107
|
+
const [receipt, home, other] = await Promise.all([
|
|
67
108
|
readQuote(legs.receiptKey, ctx, failed(legs.receiptKey)),
|
|
68
109
|
readQuote(legs.homeKey, ctx, failed(legs.homeKey)),
|
|
110
|
+
otherLines(legs.receiptKey, legs.homeKey, ctx),
|
|
69
111
|
]);
|
|
70
112
|
ctx.signal.throwIfAborted();
|
|
71
113
|
const quotes = { receipt, home };
|
|
114
|
+
const otherLinesText = otherLinesNote(other, home);
|
|
72
115
|
// A minor unit (GBp) is read as its currency, as the comparison reads the price.
|
|
73
116
|
const homeCurrency = quotes.home?.currency ? heldCurrencyUnit(quotes.home.currency).currency : "";
|
|
74
117
|
const spot = homeCurrency ? await readSpot(homeCurrency, ctx).catch(failed(dollarPairLabel(homeCurrency))) : null;
|
|
@@ -105,7 +148,7 @@ export const adrPairHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
105
148
|
rows: rows.map(({ opens: _opens, ...row }) => row),
|
|
106
149
|
},
|
|
107
150
|
],
|
|
108
|
-
...(comparison.timingNote ? { notes: [comparison.timingNote] } : {}),
|
|
151
|
+
...(comparison.timingNote || otherLinesText ? { notes: [comparison.timingNote, otherLinesText].filter((note): note is string => !!note) } : {}),
|
|
109
152
|
...(errors.length > 0 ? { errors } : {}),
|
|
110
153
|
freshness: {
|
|
111
154
|
observations: [quotes.receipt, quotes.home].filter((quote): quote is Quote => !!quote).map((quote) => ({ ...quoteObservation(quote) })),
|
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
displayWidth,
|
|
11
11
|
formatGrowthShort,
|
|
12
12
|
formatNumber,
|
|
13
|
-
formatWithDivisor,
|
|
14
13
|
padTo,
|
|
15
14
|
pickUnit,
|
|
16
15
|
} from "../../../../utils/format";
|
|
@@ -283,7 +282,20 @@ function formatFinancialValue(
|
|
|
283
282
|
if (value == null || !Number.isFinite(value)) return MISSING_VALUE;
|
|
284
283
|
if (row.format === "eps") return formatPerShareNumber(value);
|
|
285
284
|
if (row.format === "percent") return `${formatNumber(value * 100, 1)}%`;
|
|
286
|
-
return
|
|
285
|
+
return formatFinancialAmount(value, row.divisor);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* An amount in the table's one unit, to about three significant figures: `23.73` and `1,265.6`, a line a
|
|
290
|
+
* thousandth of the others as `0.001` rather than `0.00`, so no row needs a unit of its own.
|
|
291
|
+
*/
|
|
292
|
+
export function formatFinancialAmount(value: number, divisor: number): string {
|
|
293
|
+
const scaled = value / divisor;
|
|
294
|
+
const magnitude = Math.abs(scaled);
|
|
295
|
+
if (magnitude >= 100) return formatNumber(scaled, 1);
|
|
296
|
+
if (magnitude >= 1 || scaled === 0) return scaled.toFixed(2);
|
|
297
|
+
if (magnitude >= 0.001) return scaled.toFixed(3);
|
|
298
|
+
return Number(scaled.toPrecision(2)).toString();
|
|
287
299
|
}
|
|
288
300
|
|
|
289
301
|
/**
|
|
@@ -300,9 +312,11 @@ export function formatFinancialHeader(date: string, currency?: string, dateSourc
|
|
|
300
312
|
}
|
|
301
313
|
|
|
302
314
|
/**
|
|
303
|
-
* A report column's header (`gloom fn FA`):
|
|
304
|
-
*
|
|
305
|
-
* `
|
|
315
|
+
* A report column's header (`gloom fn FA`): the fiscal period as the pane's
|
|
316
|
+
* column names it and the day it ends (`FY2026 2026-09-30 USD bn (SEC
|
|
317
|
+
* date)`, `TTM Q3 FY26 2026-09-30 USD`), with a half in the quarterly list
|
|
318
|
+
* named as one (`H1 FY26 2026-06-30`, or `6M 2026-06-30` off the fiscal
|
|
319
|
+
* calendar), and a column Gloom Cloud filled
|
|
306
320
|
* from the company's results announcements dated by them alone (fillDate):
|
|
307
321
|
* `(announced 2026-08-20)` for its own results, `(comparative in the
|
|
308
322
|
* 2026-08-20 announcement)` for a later period's comparative column. `rows`
|
|
@@ -316,11 +330,17 @@ export function financialReportHeader(
|
|
|
316
330
|
rows: readonly FinancialStatement[] = [],
|
|
317
331
|
): string {
|
|
318
332
|
const { date, dateSource } = statement;
|
|
319
|
-
|
|
333
|
+
// The fiscal period as the pane names it (`FY2026`, `Q3 FY26`, `TTM Q3 FY26`), then the day it ends.
|
|
334
|
+
const named = (name: string, end: string) => (name.endsWith(end) ? name : `${name} ${end}`);
|
|
335
|
+
if (date === "TTM") {
|
|
336
|
+
const end = statement.aggregation?.periodEnd;
|
|
337
|
+
const period = end ? named(financialColumnLabel(statement, kind, yearEndMonth), end) : "TTM";
|
|
338
|
+
return currency ? `${period} ${currency}` : period;
|
|
339
|
+
}
|
|
320
340
|
const end = date.slice(0, 10);
|
|
321
341
|
const months = kind === "quarterly" ? statementPeriodMonths(statement) : undefined;
|
|
322
342
|
const longer = months && months > 3 ? longerPeriodLabel(end, months, yearEndMonth) : null;
|
|
323
|
-
const period =
|
|
343
|
+
const period = named(longer ?? financialColumnLabel(statement, kind, yearEndMonth), end);
|
|
324
344
|
const filled = statement.filledFrom?.source === "results" ? fillDate(statement, rows) : null;
|
|
325
345
|
const source = filled ? fillDateText(filled) : dateSource === "sec" ? "SEC date" : "provider date";
|
|
326
346
|
return `${currency ? `${period} ${currency}` : period} (${source})`;
|
|
@@ -501,9 +521,11 @@ function resolveMetricUnit(
|
|
|
501
521
|
}
|
|
502
522
|
|
|
503
523
|
/**
|
|
504
|
-
* The money unit
|
|
505
|
-
*
|
|
506
|
-
*
|
|
524
|
+
* The money unit of the whole table (`bn`), said once beside the currency:
|
|
525
|
+
* the unit most rows would take on their own. Every money row is shown in it,
|
|
526
|
+
* a smaller line to more decimals (formatFinancialAmount), so a column copied
|
|
527
|
+
* out of the table is in one unit and no row carries a `(mn)` of its own.
|
|
528
|
+
* Share counts are no money and keep theirs.
|
|
507
529
|
*/
|
|
508
530
|
export function shareFinancialUnit<T extends { unitLabel: string; label: string; moneyUnit: string | null; divisor: number }>(
|
|
509
531
|
rows: readonly T[],
|
|
@@ -513,11 +535,7 @@ export function shareFinancialUnit<T extends { unitLabel: string; label: string;
|
|
|
513
535
|
const unit = [...counts].sort((left, right) => right[1] - left[1])[0]?.[0];
|
|
514
536
|
if (!unit) return { rows: [...rows], unit: undefined };
|
|
515
537
|
return {
|
|
516
|
-
rows: rows.map((row) => {
|
|
517
|
-
if (row.moneyUnit === unit) return { ...row, unitLabel: row.label };
|
|
518
|
-
if (row.moneyUnit === "") return { ...row, unitLabel: row.label, moneyUnit: unit, divisor: UNIT_DIVISORS[unit]! };
|
|
519
|
-
return row;
|
|
520
|
-
}),
|
|
538
|
+
rows: rows.map((row) => row.moneyUnit == null ? row : { ...row, unitLabel: row.label, moneyUnit: unit, divisor: UNIT_DIVISORS[unit]! }),
|
|
521
539
|
unit,
|
|
522
540
|
};
|
|
523
541
|
}
|
|
@@ -527,6 +545,8 @@ export function buildFinancialRows(
|
|
|
527
545
|
statements: FinancialStatement[],
|
|
528
546
|
collapsedGroups: ReadonlySet<string>,
|
|
529
547
|
depth = 0,
|
|
548
|
+
/** The lines the table already shows, above this one: a line equal to one of them is left out. */
|
|
549
|
+
shown: Array<Pick<MetricDef, "key" | "compute" | "format">> = [],
|
|
530
550
|
): FinancialTableRow[] {
|
|
531
551
|
const rows: FinancialTableRow[] = [];
|
|
532
552
|
|
|
@@ -534,6 +554,11 @@ export function buildFinancialRows(
|
|
|
534
554
|
if (!hasFinancialRowValue(def, statements)) continue;
|
|
535
555
|
|
|
536
556
|
if (!isFinancialGroup(def)) {
|
|
557
|
+
// The same amount under another name further down (CapEx, then Purchase PPE) is shown once, where it is
|
|
558
|
+
// reported in every period the line above is; a line that differs in any period stays.
|
|
559
|
+
if (shown.some((line) => line.format === (def.format ?? "compact") && (line.key !== def.key || line.compute !== def.compute)
|
|
560
|
+
&& repeatsLine(def, line, statements))) continue;
|
|
561
|
+
shown.push({ key: def.key, compute: def.compute, format: def.format ?? "compact" });
|
|
537
562
|
const { unitLabel, moneyUnit, divisor, format } = resolveMetricUnit(statements, def, def.label);
|
|
538
563
|
rows.push({
|
|
539
564
|
kind: "metric",
|
|
@@ -561,6 +586,7 @@ export function buildFinancialRows(
|
|
|
561
586
|
? resolveMetricUnit(statements, { key: def.summaryKey, format: def.format ?? "compact" }, def.label)
|
|
562
587
|
: { unitLabel: def.label, moneyUnit: null, divisor: 1, format: def.format ?? "compact" };
|
|
563
588
|
|
|
589
|
+
if (def.summaryKey) shown.push({ key: def.summaryKey, format: def.format ?? "compact" });
|
|
564
590
|
rows.push({
|
|
565
591
|
kind: "group",
|
|
566
592
|
id: def.id,
|
|
@@ -577,7 +603,7 @@ export function buildFinancialRows(
|
|
|
577
603
|
});
|
|
578
604
|
|
|
579
605
|
if (expanded) {
|
|
580
|
-
rows.push(...buildFinancialRows(children, statements, collapsedGroups, depth + 1));
|
|
606
|
+
rows.push(...buildFinancialRows(children, statements, collapsedGroups, depth + 1, shown));
|
|
581
607
|
}
|
|
582
608
|
}
|
|
583
609
|
|
|
@@ -618,6 +644,12 @@ interface FinancialTableModelRow {
|
|
|
618
644
|
summaryKey?: keyof FinancialStatement;
|
|
619
645
|
label: string;
|
|
620
646
|
unitLabel: string;
|
|
647
|
+
/** How the row's figures read: money or a share count (`compact`), per-share earnings, or a percent of a fraction. */
|
|
648
|
+
format: FinancialMetricFormat;
|
|
649
|
+
/** What a `compact` figure is divided by to read in the row's unit (1e9 for `bn`). */
|
|
650
|
+
divisor: number;
|
|
651
|
+
/** The money unit word the figures are in (`bn`); null for share counts, per-share figures and percents. */
|
|
652
|
+
moneyUnit: string | null;
|
|
621
653
|
depth: number;
|
|
622
654
|
growthDirection: FinancialGrowthDirection;
|
|
623
655
|
cells: FinancialTableCellModel[];
|
|
@@ -783,6 +815,9 @@ export function buildFinancialTableModel(
|
|
|
783
815
|
summaryKey: row.kind === "group" ? row.summaryKey : undefined,
|
|
784
816
|
label: row.label,
|
|
785
817
|
unitLabel: row.unitLabel,
|
|
818
|
+
format: row.format,
|
|
819
|
+
divisor: row.divisor,
|
|
820
|
+
moneyUnit: row.moneyUnit,
|
|
786
821
|
depth: row.depth,
|
|
787
822
|
growthDirection: row.growthDirection,
|
|
788
823
|
cells,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FinancialStatement } from "../../../../types/financials";
|
|
2
|
+
|
|
3
|
+
const finite = (value: unknown): number | undefined => (typeof value === "number" && Number.isFinite(value) ? value : undefined);
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Operating income after tax at the period's effective rate (tax provision ÷ pretax income, held between 0% and
|
|
7
|
+
* 100%); a pretax loss pays no tax. Undefined when a line is missing. ROIC and the reinvestment rate read it.
|
|
8
|
+
*/
|
|
9
|
+
export function statementNopat(statement: FinancialStatement): number | undefined {
|
|
10
|
+
const operating = finite(statement.operatingIncome);
|
|
11
|
+
const tax = finite(statement.taxProvision);
|
|
12
|
+
const pretax = finite(statement.pretaxIncome);
|
|
13
|
+
if (operating === undefined || tax === undefined || pretax === undefined) return undefined;
|
|
14
|
+
const rate = pretax > 0 ? Math.min(1, Math.max(0, tax / pretax)) : 0;
|
|
15
|
+
return operating * (1 - rate);
|
|
16
|
+
}
|
|
@@ -4,6 +4,7 @@ import { MISSING_VALUE, formatNumber, pickUnit } from "../../../../utils/format"
|
|
|
4
4
|
import { pricePointIntegrity } from "../../../../utils/price-history-integrity";
|
|
5
5
|
import { formatPerShareNumber } from "../../../../utils/reported-money";
|
|
6
6
|
import { hasStatementGap } from "../../../../utils/statement-gaps";
|
|
7
|
+
import { statementNopat } from "./nopat";
|
|
7
8
|
import { debtAndLeases, leaseBasis, type LeaseBasis } from "../../../../utils/lease-liabilities";
|
|
8
9
|
import { cashAndShortTermInvestments, excludesCashRunway, formatRunwayMonths, SHORT_RUNWAY_HISTORY, monthlyOperatingBurn, QUARTER_MONTHS, reportsShortTermTotal, runwayMonths, YEAR_MONTHS } from "../../../../utils/cash-runway";
|
|
9
10
|
import {
|
|
@@ -21,17 +22,21 @@ import {
|
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
24
|
* Why a ratio or one of its inputs has no number: a line the statements do
|
|
24
|
-
* not carry for the period,
|
|
25
|
+
* not carry for the period, an average with no opening balance sheet on file
|
|
26
|
+
* (the period before the column's), a ratio whose denominator makes it meaningless
|
|
25
27
|
* (a loss under P/E, negative equity under ROE), no close at the period end,
|
|
26
28
|
* a close still loading, a quarter with fewer than four quarters to sum
|
|
27
29
|
* for a trailing flow, or operations that brought cash in, where a runway
|
|
28
30
|
* has no burn to divide by.
|
|
29
31
|
*/
|
|
30
|
-
export type RatioGap = "not-reported" | "short-history" | "no-burn" | "not-meaningful" | "no-price" | "loading";
|
|
32
|
+
export type RatioGap = "not-reported" | "no-opening" | "short-history" | "no-burn" | "not-meaningful" | "no-price" | "loading";
|
|
31
33
|
export type RatioAmount = number | RatioGap;
|
|
32
34
|
|
|
33
35
|
export const RATIO_GAP_TEXT: Record<RatioGap, string> = {
|
|
34
36
|
"not-reported": "not reported",
|
|
37
|
+
// An average of the opening and closing balance with no opening balance sheet on file: the oldest column's, a year's
|
|
38
|
+
// whose prior year is missing, a TTM column's without the quarter a year earlier.
|
|
39
|
+
"no-opening": "needs prior period",
|
|
35
40
|
"short-history": SHORT_RUNWAY_HISTORY,
|
|
36
41
|
"no-burn": "no burn",
|
|
37
42
|
"not-meaningful": "N/M",
|
|
@@ -155,10 +160,11 @@ const balanceEnds = (...lines: BalanceLine[]) => ({ statement, opening }: RatioP
|
|
|
155
160
|
return undefined;
|
|
156
161
|
};
|
|
157
162
|
|
|
158
|
-
/** The mean of the opening and closing balance. */
|
|
163
|
+
/** The mean of the opening and closing balance; a period with no opening balance sheet on file says it needs it. */
|
|
159
164
|
const average = (...lines: BalanceLine[]) => {
|
|
160
165
|
const ends = balanceEnds(...lines);
|
|
161
166
|
return (period: RatioPeriod): RatioAmount => {
|
|
167
|
+
if (!period.opening) return "no-opening";
|
|
162
168
|
const pair = ends(period);
|
|
163
169
|
return pair ? (pair[0] + pair[1]) / 2 : "not-reported";
|
|
164
170
|
};
|
|
@@ -201,6 +207,23 @@ const debtPlusEquity: BalanceLine = (statement) => {
|
|
|
201
207
|
const common = equity(statement);
|
|
202
208
|
return debt !== undefined && common !== undefined ? debt + common : undefined;
|
|
203
209
|
};
|
|
210
|
+
/** Invested capital as ROIC reads it: the data vendor's line, else total debt plus equity. */
|
|
211
|
+
const investedCapital = line("investedCapital");
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Invested capital less cash and short-term investments, averaged as ROIC averages it (both ends from the same
|
|
215
|
+
* line): the capital the operations use, so a debt-free company holding cash is not read as using it.
|
|
216
|
+
*/
|
|
217
|
+
function averageOperatingCapital(period: RatioPeriod): RatioAmount {
|
|
218
|
+
const { statement, opening, shortTermTotalOnFile } = period;
|
|
219
|
+
if (!opening) return "no-opening";
|
|
220
|
+
const cash = (at: FinancialStatement) => cashAndShortTermInvestments(at, shortTermTotalOnFile)?.amount;
|
|
221
|
+
const [closeCash, openCash] = [cash(statement), cash(opening)];
|
|
222
|
+
if (closeCash === undefined || openCash === undefined) return "not-reported";
|
|
223
|
+
const ends = balanceEnds(investedCapital, debtPlusEquity)(period);
|
|
224
|
+
return ends ? (ends[0] - openCash + ends[1] - closeCash) / 2 : "not-reported";
|
|
225
|
+
}
|
|
226
|
+
|
|
204
227
|
const freeCashFlow: BalanceLine = (statement) => {
|
|
205
228
|
const reportedFlow = finite(statement.freeCashFlow);
|
|
206
229
|
if (reportedFlow !== undefined) return reportedFlow;
|
|
@@ -240,14 +263,9 @@ const netIncome = flow("Net Income", line("netIncome"));
|
|
|
240
263
|
const revenue = line("totalRevenue");
|
|
241
264
|
const costOfRevenue = line("costOfRevenue");
|
|
242
265
|
|
|
243
|
-
/** Operating income after tax at the period's effective rate; a pretax loss pays no tax. */
|
|
266
|
+
/** Operating income after tax at the period's effective rate; a pretax loss pays no tax (statementNopat). */
|
|
244
267
|
function nopat({ statement }: RatioPeriod): RatioAmount {
|
|
245
|
-
|
|
246
|
-
const tax = finite(statement.taxProvision);
|
|
247
|
-
const pretax = finite(statement.pretaxIncome);
|
|
248
|
-
if (operating === undefined || tax === undefined || pretax === undefined) return "not-reported";
|
|
249
|
-
const rate = pretax > 0 ? Math.min(1, Math.max(0, tax / pretax)) : 0;
|
|
250
|
-
return operating * (1 - rate);
|
|
268
|
+
return reported(statementNopat(statement));
|
|
251
269
|
}
|
|
252
270
|
|
|
253
271
|
function dilutedEps({ statement }: RatioPeriod): RatioAmount {
|
|
@@ -366,7 +384,7 @@ export const RATIO_TABS: RatioTabDef[] = [
|
|
|
366
384
|
inputs: [netIncome, { label: "Avg Equity", operator: "÷", format: "money", value: average(...equityLines) }],
|
|
367
385
|
compute: ([income], period) => {
|
|
368
386
|
const ends = equityEnds(period);
|
|
369
|
-
return ends ? returnOnEquity(income!, ends) : "not-reported";
|
|
387
|
+
return ends ? returnOnEquity(income!, ends) : period.opening ? "not-reported" : "no-opening";
|
|
370
388
|
},
|
|
371
389
|
},
|
|
372
390
|
{
|
|
@@ -384,7 +402,20 @@ export const RATIO_TABS: RatioTabDef[] = [
|
|
|
384
402
|
signed: true,
|
|
385
403
|
inputs: [
|
|
386
404
|
{ label: "NOPAT", format: "money", annualized: true, value: nopat },
|
|
387
|
-
{ label: "Avg Invested Capital", operator: "÷", format: "money", value: average(
|
|
405
|
+
{ label: "Avg Invested Capital", operator: "÷", format: "money", value: average(investedCapital, debtPlusEquity) },
|
|
406
|
+
],
|
|
407
|
+
compute: ([income, base]) => over(income!, base!),
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
// ROIC with cash and short-term investments taken out of invested capital: Copart, debt free with its
|
|
411
|
+
// cash in its equity, reads its operations' return rather than one diluted by the cash.
|
|
412
|
+
id: "roic-ex-cash",
|
|
413
|
+
label: "ROIC ex Cash",
|
|
414
|
+
format: "percent",
|
|
415
|
+
signed: true,
|
|
416
|
+
inputs: [
|
|
417
|
+
{ label: "NOPAT", format: "money", annualized: true, value: nopat },
|
|
418
|
+
{ label: "Avg IC less Cash", operator: "÷", format: "money", value: averageOperatingCapital },
|
|
388
419
|
],
|
|
389
420
|
compute: ([income, base]) => over(income!, base!),
|
|
390
421
|
},
|
|
@@ -602,7 +633,7 @@ export const RATIO_TAB_KEYS = new Set(RATIO_TABS.map((tab) => tab.key));
|
|
|
602
633
|
* report explains more than a missing close, and a close still loading may
|
|
603
634
|
* yet arrive.
|
|
604
635
|
*/
|
|
605
|
-
const GAP_ORDER: RatioGap[] = ["not-reported", "short-history", "no-burn", "not-meaningful", "no-price", "loading"];
|
|
636
|
+
const GAP_ORDER: RatioGap[] = ["not-reported", "no-opening", "short-history", "no-burn", "not-meaningful", "no-price", "loading"];
|
|
606
637
|
|
|
607
638
|
function inputAmount(input: RatioInputDef, period: RatioPeriod): RatioAmount {
|
|
608
639
|
if (!input.trailing || !period.quarterly) return input.value(period);
|
|
@@ -1,9 +1,26 @@
|
|
|
1
|
-
import { revenueMargin } from "../../../../utils/growth";
|
|
1
|
+
import { revenueMargin, type Rate } from "../../../../utils/growth";
|
|
2
|
+
import type { FinancialStatement } from "../../../../types/financials";
|
|
2
3
|
import type { FinancialSubTab } from "./model";
|
|
4
|
+
import { statementNopat } from "./nopat";
|
|
3
5
|
|
|
4
6
|
/** A line over revenue: N/M where revenue is zero or negative. */
|
|
5
7
|
const financialRatio = revenueMargin;
|
|
6
8
|
|
|
9
|
+
/** What went out on a line kept as a negative number (capex, acquisitions), as a positive amount. */
|
|
10
|
+
const spent = (value: number | undefined): number | undefined => (typeof value === "number" && Number.isFinite(value) ? Math.abs(value) : undefined);
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The share of after-tax operating profit put back into the business: capex and acquisitions less D&A, over NOPAT
|
|
14
|
+
* (statementNopat). Acquisitions count where the statement reports them; N/M over NOPAT at or below zero.
|
|
15
|
+
*/
|
|
16
|
+
function reinvestmentRate(statement: FinancialStatement): Rate | undefined {
|
|
17
|
+
const capex = spent(statement.capitalExpenditure);
|
|
18
|
+
const depreciation = statement.depreciationAndAmortization ?? statement.depreciationAmortizationDepletion;
|
|
19
|
+
const nopat = statementNopat(statement);
|
|
20
|
+
if (capex === undefined || typeof depreciation !== "number" || !Number.isFinite(depreciation) || nopat === undefined) return undefined;
|
|
21
|
+
return financialRatio(capex + (spent(statement.purchaseOfBusiness) ?? 0) - depreciation, nopat);
|
|
22
|
+
}
|
|
23
|
+
|
|
7
24
|
const LOWER_IS_BETTER = "lower" as const;
|
|
8
25
|
const NEUTRAL_GROWTH = "neutral" as const;
|
|
9
26
|
|
|
@@ -130,9 +147,23 @@ export const FINANCIAL_SUB_TABS: FinancialSubTab[] = [
|
|
|
130
147
|
label: "Free Cash Flow",
|
|
131
148
|
summaryKey: "freeCashFlow",
|
|
132
149
|
defaultExpanded: true,
|
|
150
|
+
// Operating cash flow is the Operating group's own line below; a row here would repeat it.
|
|
133
151
|
children: [
|
|
134
|
-
{ label: "Operating CF", key: "operatingCashFlow", format: "compact" },
|
|
135
152
|
{ label: "CapEx", key: "capitalExpenditure", format: "compact", outflow: true },
|
|
153
|
+
{
|
|
154
|
+
label: "CapEx / Revenue",
|
|
155
|
+
id: "capex-revenue",
|
|
156
|
+
compute: (statement) => financialRatio(spent(statement.capitalExpenditure), statement.totalRevenue),
|
|
157
|
+
format: "percent",
|
|
158
|
+
growthDirection: NEUTRAL_GROWTH,
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
label: "Reinvestment Rate",
|
|
162
|
+
id: "reinvestment-rate",
|
|
163
|
+
compute: reinvestmentRate,
|
|
164
|
+
format: "percent",
|
|
165
|
+
growthDirection: NEUTRAL_GROWTH,
|
|
166
|
+
},
|
|
136
167
|
],
|
|
137
168
|
},
|
|
138
169
|
{
|
|
@@ -150,10 +150,12 @@ export function ResolvedFinancialsTab({
|
|
|
150
150
|
const [storedSubTab, setStoredSubTab] = usePaneStateValue<string>("financialSubTab", FINANCIAL_SUB_TABS[0]!.key);
|
|
151
151
|
const resolvedSubTabKey = resolveFinancialSectionKey(storedSubTab);
|
|
152
152
|
const subTabIdx = Math.max(0, FINANCIAL_SECTIONS.findIndex((tab) => tab.key === resolvedSubTabKey));
|
|
153
|
-
// Ratios open collapsed: the inputs behind each one show on demand.
|
|
153
|
+
// Ratios open collapsed: the inputs behind each one show on demand. A capture of a ratio tab opens them all
|
|
154
|
+
// (`financialRatiosExpanded`), so the picture holds the inputs the report lists.
|
|
155
|
+
const [ratiosExpanded] = usePaneStateValue<boolean>("financialRatiosExpanded", false);
|
|
154
156
|
const [collapsedGroups, setCollapsedGroups] = useState<Set<string>>(() => new Set([
|
|
155
157
|
...collectDefaultCollapsedGroupIds(FINANCIAL_SUB_TABS.flatMap((tab) => tab.rows)),
|
|
156
|
-
...RATIO_TABS.flatMap((tab) => tab.ratios.map((ratio) => ratio.id)),
|
|
158
|
+
...ratiosExpanded ? [] : RATIO_TABS.flatMap((tab) => tab.ratios.map((ratio) => ratio.id)),
|
|
157
159
|
]));
|
|
158
160
|
const [selectedRowId, setSelectedRowId] = useState<string | null>(null);
|
|
159
161
|
const bodyScrollRef = useRef<ScrollBoxRenderable>(null);
|