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
|
@@ -3,6 +3,7 @@ import type { CpiBoardPayload, CpiReleaseStatus, CpiRow } from "../../../api-cli
|
|
|
3
3
|
import type { ChartStripSpec } from "../../../components/chart-table/header";
|
|
4
4
|
import { staticSeries } from "../../../components/chart/static/series";
|
|
5
5
|
import type { ResolvedSeries } from "../../../time-series/types";
|
|
6
|
+
import { cpiYearGapNote } from "../shared/cpi-year-gap";
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* The rows Gloom Cloud serves, by the ids its board uses, so `CPI shelter`
|
|
@@ -191,6 +192,22 @@ export function cpiChartSeries(row: CpiRow, headline: CpiRow | null, colors: Cpi
|
|
|
191
192
|
return series.filter((entry) => entry.points.length > 0);
|
|
192
193
|
}
|
|
193
194
|
|
|
195
|
+
/**
|
|
196
|
+
* Why a row's year-over-year change is empty for the release's month, with the
|
|
197
|
+
* latest month it has one for (`cpiYearGapNote`): "BLS published no October
|
|
198
|
+
* 2025 index, so no October 2026 y/y; All items 3.7% in September 2026." Null
|
|
199
|
+
* when the row has its change, or misses it for another reason.
|
|
200
|
+
*/
|
|
201
|
+
export function cpiYearGapLine(payload: Pick<CpiBoardPayload, "release">, row: CpiRow | null | undefined): string | null {
|
|
202
|
+
if (!payload.release.period || !row || row.yoy != null) return null;
|
|
203
|
+
const latest = row.history.findLast(([period, , yoy]) => yoy != null && period < payload.release.period!);
|
|
204
|
+
return cpiYearGapNote(payload.release.period, row.label, latest ? { period: latest[0], value: latest[2]! } : null);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/** The headline's gap line (`cpiYearGapLine`), which the table closes on. */
|
|
208
|
+
export const cpiHeadlineYearGapLine = (payload: CpiBoardPayload) =>
|
|
209
|
+
cpiYearGapLine(payload, payload.rows.find((row) => row.code === "SA0"));
|
|
210
|
+
|
|
194
211
|
/** One row for a short pane: the row's year-over-year line and its latest value. */
|
|
195
212
|
export function cpiChartStrip(row: CpiRow, color: string): ChartStripSpec | null {
|
|
196
213
|
const values = row.history.flatMap(([, , yoy]) => (yoy == null ? [] : [yoy]));
|
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
cpiChartSeries,
|
|
30
30
|
cpiChartStrip,
|
|
31
31
|
cpiHeaderLine,
|
|
32
|
+
cpiHeadlineYearGapLine,
|
|
32
33
|
cpiMonthDate,
|
|
33
34
|
cpiRowLabel,
|
|
34
35
|
cpiRows,
|
|
@@ -50,7 +51,7 @@ const COLUMNS: DataTableColumn[] = [
|
|
|
50
51
|
{ id: "annualized6m", label: "6M Ann", width: 7, align: "right", flexGrow: 1 },
|
|
51
52
|
{ id: "yoy", label: "Y/Y", width: 7, align: "right", flexGrow: 1 },
|
|
52
53
|
{ id: "contribution", label: "M/M Pts", width: 8, align: "right", flexGrow: 1 },
|
|
53
|
-
{ id: "contributionYoy", label: "Y/Y Pts", width: 8, align: "right", flexGrow: 1 },
|
|
54
|
+
{ id: "contributionYoy", label: "Y/Y Pts", width: 8, align: "right", flexGrow: 1, omitWhenEmpty: true },
|
|
54
55
|
];
|
|
55
56
|
const PANELS = [{ id: "main" }];
|
|
56
57
|
/** Legend, four plot rows and the time axis; the read under them takes its own rows. */
|
|
@@ -146,7 +147,8 @@ export function CpiPane({ width, height, focused }: PaneProps) {
|
|
|
146
147
|
useAutoRefresh(resource.updatedAt, resource.load);
|
|
147
148
|
usePaneRefreshKey(() => resource.reload(), { focused });
|
|
148
149
|
usePaneNoticeFooter({ registrationId: "cpi:notices", focused,
|
|
149
|
-
notices: [...(data?.gaps ?? []), ...(
|
|
150
|
+
notices: [...(data?.gaps ?? []), ...(data ? [cpiHeadlineYearGapLine(data)].filter((line): line is string => !!line) : []),
|
|
151
|
+
...(resource.data?.refreshError ? [resource.data.refreshError] : [])] });
|
|
150
152
|
usePaneStatusFooter({ registrationId: "cpi", loading: resource.loading, error: notAvailable ? null : resource.error,
|
|
151
153
|
stale: !!data && resource.data?.stale });
|
|
152
154
|
return (
|
|
@@ -72,10 +72,15 @@ const validPeg = (peg: CryptoMarketAsset["peg"]) =>
|
|
|
72
72
|
&& (peg.price === null || (isFiniteNumber(peg.price) && peg.price > 0))
|
|
73
73
|
&& nullableInstant(peg.asOf);
|
|
74
74
|
|
|
75
|
+
const venueNames = (value: unknown) => value === undefined
|
|
76
|
+
|| Array.isArray(value) && value.every((name) => typeof name === "string" && name.length > 0 && name.length <= 24);
|
|
77
|
+
|
|
75
78
|
const validRange = (range: CryptoMarketAsset["range24h"]) =>
|
|
76
79
|
!!range
|
|
77
80
|
&& [range.low, range.high].every((value) => isFiniteNumber(value) && value > 0)
|
|
78
|
-
&& [range.lowAt, range.highAt, range.start, range.end].every(instant)
|
|
81
|
+
&& [range.lowAt, range.highAt, range.start, range.end].every(instant)
|
|
82
|
+
&& [range.lowVenues, range.highVenues, range.venuesChecked].every(venueNames)
|
|
83
|
+
&& (range.venuesPending === undefined || typeof range.venuesPending === "boolean");
|
|
79
84
|
|
|
80
85
|
/** A malformed peg or 24h range is dropped from its coin alone; the coin and the rest of the board stay. */
|
|
81
86
|
function withValidStablecoinFields(asset: CryptoMarketAsset): CryptoMarketAsset {
|
|
@@ -36,6 +36,8 @@ const COIN_COLUMNS: HeadlessPaneColumn[] = [
|
|
|
36
36
|
{ key: "name", header: "Name" },
|
|
37
37
|
// Every coin is priced, traded and valued in US dollars: the text headers say so; an export keeps its headers.
|
|
38
38
|
{ key: "price", header: "Price", textHeader: "Price USD", align: "right", format: (_value, row) => String(row.priceText ?? "—") },
|
|
39
|
+
// Whose the price is: an exchange's own trade, the composite of several, or a composite held back.
|
|
40
|
+
{ key: "priceVenue", header: "Venue", literalHeader: true },
|
|
39
41
|
// Since 00:00 UTC, the day `quote` gives a coin (CRYPTO_CHANGE_BASIS_LABEL): the text says so, as the pane's
|
|
40
42
|
// CHG% UTC does, and an export keeps the header it has always had.
|
|
41
43
|
{ key: "changePercent", header: "Chg %", textHeader: "Chg % UTC", align: "right", format: percent },
|
|
@@ -52,14 +54,17 @@ const COIN_COLUMNS: HeadlessPaneColumn[] = [
|
|
|
52
54
|
* volume leave the table first.
|
|
53
55
|
*/
|
|
54
56
|
const STABLECOIN_COLUMNS: HeadlessPaneColumn[] = [
|
|
55
|
-
...COIN_COLUMNS.slice(0,
|
|
57
|
+
...COIN_COLUMNS.slice(0, 5),
|
|
56
58
|
{ key: "peg", header: "Peg", literalHeader: true, format: text("pegText") },
|
|
57
59
|
{ key: "offPegBp", header: "Off peg", literalHeader: true, align: "right", format: (value) => formatOffPeg(number(value)) },
|
|
58
60
|
{ key: "low24h", header: "24h low", literalHeader: true, align: "right", format: text("low24hText") },
|
|
59
61
|
{ key: "low24hAt", header: "Low UTC", literalHeader: true, shrink: false, format: isoMinute, textFormat: dayTime },
|
|
62
|
+
// The one exchange that alone reached the low or high, or how many did: one exchange's wick is not the market's.
|
|
63
|
+
{ key: "low24hVenue", header: "Low venue", literalHeader: true },
|
|
60
64
|
{ key: "high24h", header: "24h high", literalHeader: true, align: "right", format: text("high24hText") },
|
|
61
65
|
{ key: "high24hAt", header: "High UTC", literalHeader: true, shrink: false, format: isoMinute, textFormat: dayTime },
|
|
62
|
-
|
|
66
|
+
{ key: "high24hVenue", header: "High venue", literalHeader: true },
|
|
67
|
+
...COIN_COLUMNS.slice(5).map((column, index) => column.key === "marketCap"
|
|
63
68
|
? column
|
|
64
69
|
: { ...column, stackPriority: 4 - index, stackRows: 0 }),
|
|
65
70
|
];
|
|
@@ -400,6 +405,7 @@ export const cryptoBoardHeadless: HeadlessPaneDefinition<"rows"> = {
|
|
|
400
405
|
circulatingSupply: row.asset.circulatingSupply,
|
|
401
406
|
maxSupply: row.asset.maxSupply,
|
|
402
407
|
quoteTime: row.asset.quoteTime,
|
|
408
|
+
priceVenue: row.priceVenueText,
|
|
403
409
|
...(kind === "stablecoin" ? {
|
|
404
410
|
peg: row.peg,
|
|
405
411
|
pegText: row.pegText || "—",
|
|
@@ -410,6 +416,8 @@ export const cryptoBoardHeadless: HeadlessPaneDefinition<"rows"> = {
|
|
|
410
416
|
high24h: row.high24h,
|
|
411
417
|
high24hText: row.high24hText,
|
|
412
418
|
high24hAt: row.high24hAt == null ? null : new Date(row.high24hAt).toISOString(),
|
|
419
|
+
low24hVenue: row.low24hVenueText,
|
|
420
|
+
high24hVenue: row.high24hVenueText,
|
|
413
421
|
supply: row.supply,
|
|
414
422
|
supply7d: row.supply7d,
|
|
415
423
|
supply7dPercent: row.supply7dPercent,
|
|
@@ -4,6 +4,7 @@ import type { DataTableColumn } from "../../../components";
|
|
|
4
4
|
import { getTableWidth } from "../../../components/ui/table-layout";
|
|
5
5
|
import { buildQuoteKey, resolveEntryData } from "../../../market-data/selectors";
|
|
6
6
|
import { delayedFeedLagMs } from "../../../market-data/market/freshness";
|
|
7
|
+
import { quoteSourceName } from "../../../market-data/quotes/export-identity";
|
|
7
8
|
import type { QueryEntry } from "../../../market-data/result-types";
|
|
8
9
|
import type { PricePoint, Quote } from "../../../types/financials";
|
|
9
10
|
import type { HeadlessPaneFreshness } from "../../../types/headless";
|
|
@@ -87,6 +88,11 @@ export interface CryptoRow extends CryptoRowSupply {
|
|
|
87
88
|
live: boolean;
|
|
88
89
|
/** The price is a quote from a delayed feed, held back from the market. A price read from the board is not. */
|
|
89
90
|
delayed: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Where the price is from, as the row says it: the exchange whose own trade it is (`Coinbase`), `composite` for
|
|
93
|
+
* the board's price blended from several exchanges, or `15m delayed` for a composite held back.
|
|
94
|
+
*/
|
|
95
|
+
priceVenueText: string;
|
|
90
96
|
/** A stablecoin's peg; null for a coin, or a server that does not send it. */
|
|
91
97
|
peg: CryptoPeg | null;
|
|
92
98
|
/** `USD`, `EUR 1.1242` (the target in dollars), `USD yield`, `USD bond`; empty without a peg. */
|
|
@@ -101,6 +107,50 @@ export interface CryptoRow extends CryptoRowSupply {
|
|
|
101
107
|
/** The low and high at the price's decimals. */
|
|
102
108
|
low24hText: string;
|
|
103
109
|
high24hText: string;
|
|
110
|
+
/**
|
|
111
|
+
* Whose the low and high are, in plain words: `Coinbase only` when it alone of the exchanges read reached it,
|
|
112
|
+
* `Coinbase` when it was the only one read, `2 of 3`, `both` or `all 3` when more did, `other exchange` when none
|
|
113
|
+
* did (the composite's wick was an exchange not read), `checking` while the server still reads them, or a dash
|
|
114
|
+
* when no exchange was read. `+ Kraken` when the row's own price from that exchange lay outside the range and
|
|
115
|
+
* widened it.
|
|
116
|
+
*/
|
|
117
|
+
low24hVenueText: string;
|
|
118
|
+
high24hVenueText: string;
|
|
119
|
+
/** The row's own exchange price lay outside the composite's range and is the low or the high, as `+ Kraken` says. */
|
|
120
|
+
low24hWidened: boolean;
|
|
121
|
+
high24hWidened: boolean;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** The board's price that is no one exchange's: several blended by the source. */
|
|
125
|
+
const COMPOSITE_PRICE_VENUE = "composite";
|
|
126
|
+
/** An extreme whose exchanges' own candles the server is still reading: the board's refresh brings them. */
|
|
127
|
+
const CHECKING_EXCHANGES = "checking";
|
|
128
|
+
/** An extreme none of the exchanges read reached. */
|
|
129
|
+
const OTHER_EXCHANGE = "other exchange";
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Whose an extreme is: the exchange that alone reached it among several read (`Coinbase only`), the one read when
|
|
133
|
+
* only one was, how many of those read did (`2 of 3`, `both`, `all 3`), and when none did, another exchange's. An
|
|
134
|
+
* exchange that could not be read is not among those counted. While the server is still reading them it says so,
|
|
135
|
+
* never that none was read. A price newer than the range that widened it is the row's own price venue's.
|
|
136
|
+
*/
|
|
137
|
+
function extremeVenueText(reached: readonly string[] | undefined, checked: readonly string[] | undefined, pending = false): string {
|
|
138
|
+
if (!checked?.length || !reached) return pending ? CHECKING_EXCHANGES : MISSING_VALUE;
|
|
139
|
+
// The composite blends exchanges not read here: an extreme none of those read reached was one of theirs.
|
|
140
|
+
if (reached.length === 0) return OTHER_EXCHANGE;
|
|
141
|
+
if (reached.length === 1) return checked.length > 1 ? `${reached[0]} only` : reached[0]!;
|
|
142
|
+
if (reached.length < checked.length) return `${reached.length} of ${checked.length}`;
|
|
143
|
+
return checked.length === 2 ? "both" : `all ${checked.length}`;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* What a row says its price is: an exchange's own, a quote held back, the source of a live quote that names no
|
|
148
|
+
* exchange (Gloom Cloud), or the board's own composite.
|
|
149
|
+
*/
|
|
150
|
+
function priceVenueText(quote: Quote | null, delayed: boolean): string {
|
|
151
|
+
if (quote?.priceVenue) return quote.priceVenue;
|
|
152
|
+
if (delayed) return `${delayedFeedLagMs(CRYPTO_EXCHANGE) / 60_000}m delayed`;
|
|
153
|
+
return quote ? quoteSourceName(quote) || MISSING_VALUE : COMPOSITE_PRICE_VENUE;
|
|
104
154
|
}
|
|
105
155
|
|
|
106
156
|
export const cryptoQuoteKey = (asset: Pick<CryptoMarketAsset, "symbol">) =>
|
|
@@ -195,8 +245,9 @@ function buildCryptoRow(
|
|
|
195
245
|
const updated = isFiniteNumber(updatedAt) ? updatedAt : null;
|
|
196
246
|
const minimumDecimals = asset.kind === "stablecoin" ? 4 : 2;
|
|
197
247
|
const range = asset.kind === "stablecoin"
|
|
198
|
-
? dayRange(asset, price, updated)
|
|
199
|
-
:
|
|
248
|
+
? dayRange(asset, price, updated, quote?.priceVenue)
|
|
249
|
+
: NO_DAY_RANGE;
|
|
250
|
+
const delayed = quote?.dataSource === "delayed";
|
|
200
251
|
return {
|
|
201
252
|
asset,
|
|
202
253
|
id: asset.symbol,
|
|
@@ -214,7 +265,8 @@ function buildCryptoRow(
|
|
|
214
265
|
history,
|
|
215
266
|
updatedAt: updated,
|
|
216
267
|
live: !!quote && quote.delivery === "stream" && quote.stale !== true,
|
|
217
|
-
delayed
|
|
268
|
+
delayed,
|
|
269
|
+
priceVenueText: priceVenueText(quote, delayed),
|
|
218
270
|
peg,
|
|
219
271
|
pegText: formatPegTarget(peg),
|
|
220
272
|
offPegBp: offPegBasisPoints(price, peg),
|
|
@@ -260,25 +312,43 @@ export function offPegSeverity(bp: number | null): "none" | "watch" | "broken" {
|
|
|
260
312
|
return size >= OFF_PEG_BROKEN_BP ? "broken" : size >= OFF_PEG_WATCH_BP ? "watch" : "none";
|
|
261
313
|
}
|
|
262
314
|
|
|
315
|
+
const NO_DAY_RANGE = {
|
|
316
|
+
low24h: null, low24hAt: null, high24h: null, high24hAt: null,
|
|
317
|
+
low24hVenueText: MISSING_VALUE, high24hVenueText: MISSING_VALUE, low24hWidened: false, high24hWidened: false,
|
|
318
|
+
};
|
|
319
|
+
|
|
263
320
|
/**
|
|
264
321
|
* The 24-hour low and high the board reported, widened by a newer price than
|
|
265
|
-
* it had seen, so a live tick below the low is the low, at its time.
|
|
322
|
+
* it had seen, so a live tick below the low is the low, at its time. An
|
|
323
|
+
* exchange's own price outside the range widens it whenever it traded, as the
|
|
324
|
+
* quote service's range does (`rangeWidened`): the composite's range never
|
|
325
|
+
* took that exchange's trade in. The extreme then says whose (`+ Kraken`).
|
|
266
326
|
*/
|
|
267
|
-
function dayRange(asset: CryptoMarketAsset, price: number, updatedAt: number | null) {
|
|
327
|
+
function dayRange(asset: CryptoMarketAsset, price: number, updatedAt: number | null, priceVenue: string | undefined) {
|
|
268
328
|
const range = asset.range24h;
|
|
269
|
-
if (!range) return
|
|
329
|
+
if (!range) return NO_DAY_RANGE;
|
|
270
330
|
let low24h = range.low;
|
|
271
331
|
let low24hAt: number | null = Date.parse(range.lowAt);
|
|
272
332
|
let high24h = range.high;
|
|
273
333
|
let high24hAt: number | null = Date.parse(range.highAt);
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
334
|
+
// The raw extremes stay; each says whose it is.
|
|
335
|
+
let low24hVenueText = extremeVenueText(range.lowVenues, range.venuesChecked, range.venuesPending === true);
|
|
336
|
+
let high24hVenueText = extremeVenueText(range.highVenues, range.venuesChecked, range.venuesPending === true);
|
|
337
|
+
const widens = !!priceVenue || (updatedAt != null && updatedAt > Date.parse(range.end));
|
|
338
|
+
const ownVenue = priceVenue ? `+ ${priceVenue}` : COMPOSITE_PRICE_VENUE;
|
|
339
|
+
const low24hWidened = widens && price < low24h;
|
|
340
|
+
const high24hWidened = widens && price > high24h;
|
|
341
|
+
if (low24hWidened) [low24h, low24hAt, low24hVenueText] = [price, updatedAt, ownVenue];
|
|
342
|
+
if (high24hWidened) [high24h, high24hAt, high24hVenueText] = [price, updatedAt, ownVenue];
|
|
277
343
|
return {
|
|
278
344
|
low24h,
|
|
279
345
|
low24hAt: isFiniteNumber(low24hAt) ? low24hAt : null,
|
|
280
346
|
high24h,
|
|
281
347
|
high24hAt: isFiniteNumber(high24hAt) ? high24hAt : null,
|
|
348
|
+
low24hVenueText,
|
|
349
|
+
high24hVenueText,
|
|
350
|
+
low24hWidened: low24hWidened && !!priceVenue,
|
|
351
|
+
high24hWidened: high24hWidened && !!priceVenue,
|
|
282
352
|
};
|
|
283
353
|
}
|
|
284
354
|
|
|
@@ -393,6 +463,7 @@ type CryptoColumnId =
|
|
|
393
463
|
| "code"
|
|
394
464
|
| "name"
|
|
395
465
|
| "price"
|
|
466
|
+
| "priceVenueText"
|
|
396
467
|
| "changePercent"
|
|
397
468
|
| "return7d"
|
|
398
469
|
| "return30d"
|
|
@@ -404,8 +475,10 @@ type CryptoColumnId =
|
|
|
404
475
|
| "offPegBp"
|
|
405
476
|
| "low24h"
|
|
406
477
|
| "low24hAt"
|
|
478
|
+
| "low24hVenueText"
|
|
407
479
|
| "high24h"
|
|
408
480
|
| "high24hAt"
|
|
481
|
+
| "high24hVenueText"
|
|
409
482
|
| "supply"
|
|
410
483
|
| "supply7dPercent"
|
|
411
484
|
| "supply7d"
|
|
@@ -441,7 +514,7 @@ export function readCryptoSort(value: unknown): CryptoSortPreference {
|
|
|
441
514
|
: DEFAULT_CRYPTO_SORT;
|
|
442
515
|
}
|
|
443
516
|
|
|
444
|
-
const TEXT_COLUMNS = new Set<CryptoColumnId>(["rank", "code", "name", "pegText"]);
|
|
517
|
+
const TEXT_COLUMNS = new Set<CryptoColumnId>(["rank", "code", "name", "pegText", "priceVenueText", "low24hVenueText", "high24hVenueText"]);
|
|
445
518
|
|
|
446
519
|
/** Numbers open largest-first (top gainers, biggest caps); names open A-Z. */
|
|
447
520
|
export function nextCryptoSort(current: CryptoSortPreference, columnId: string): CryptoSortPreference {
|
|
@@ -473,6 +546,7 @@ const COLUMN_SPECS: CryptoColumnSpec[] = [
|
|
|
473
546
|
{ id: "code", label: "COIN", width: 7, align: "left" },
|
|
474
547
|
{ id: "name", label: "NAME", width: 10, align: "left", optional: 1 },
|
|
475
548
|
{ id: "price", label: "PRICE", width: 13, align: "right" },
|
|
549
|
+
{ id: "priceVenueText", label: "VENUE", title: "The exchange whose own trade the price is, or the composite of several", width: 11, align: "left", optional: 1.5 },
|
|
476
550
|
{ id: "changePercent", label: "CHG% UTC", title: "Change since 00:00 UTC", width: 8, align: "right" },
|
|
477
551
|
{ id: "return7d", label: "7D%", width: 8, align: "right" },
|
|
478
552
|
{ id: "return30d", label: "30D%", width: 8, align: "right", optional: 3 },
|
|
@@ -486,19 +560,23 @@ const COLUMN_SPECS: CryptoColumnSpec[] = [
|
|
|
486
560
|
* A stablecoin is read by its peg: what it holds to, how far off it is, and
|
|
487
561
|
* the 24-hour low and high with their times, before its returns. Narrowing,
|
|
488
562
|
* the returns, the sparkline and the day change leave first, then volume, the
|
|
489
|
-
* name and the high
|
|
563
|
+
* name and the high, then whose the low and the price are (the footer then
|
|
564
|
+
* says a delay); the peg, the low and when it traded stay.
|
|
490
565
|
*/
|
|
491
566
|
const STABLECOIN_COLUMN_SPECS: CryptoColumnSpec[] = [
|
|
492
567
|
{ id: "rank", label: "#", width: 3, align: "right" },
|
|
493
568
|
{ id: "code", label: "COIN", width: 7, align: "left" },
|
|
494
569
|
{ id: "name", label: "NAME", width: 10, align: "left", optional: 3 },
|
|
495
570
|
{ id: "price", label: "PRICE", width: 8, align: "right" },
|
|
571
|
+
{ id: "priceVenueText", label: "VENUE", title: "The exchange whose own trade the price is, or the composite of several", width: 11, align: "left", optional: 0.4 },
|
|
496
572
|
{ id: "pegText", label: "PEG", width: 10, align: "left" },
|
|
497
573
|
{ id: "offPegBp", label: "OFF PEG", width: 8, align: "right" },
|
|
498
574
|
{ id: "low24h", label: "24H LOW", width: 8, align: "right" },
|
|
499
575
|
{ id: "low24hAt", label: "LOW UTC", width: 9, align: "left" },
|
|
576
|
+
{ id: "low24hVenueText", label: "LOW VENUE", title: "The exchange that alone reached the low, how many of those read did, or another exchange; + an exchange whose price outside the range widened it", width: 14, align: "left", optional: 0.6 },
|
|
500
577
|
{ id: "high24h", label: "24H HIGH", width: 8, align: "right", optional: 1 },
|
|
501
578
|
{ id: "high24hAt", label: "HIGH UTC", width: 9, align: "left", optional: 2 },
|
|
579
|
+
{ id: "high24hVenueText", label: "HIGH VENUE", title: "The exchange that alone reached the high, how many of those read did, or another exchange; + an exchange whose price outside the range widened it", width: 14, align: "left", optional: 2.5 },
|
|
502
580
|
{ id: "changePercent", label: "CHG% UTC", title: "Change since 00:00 UTC", width: 8, align: "right", optional: 5 },
|
|
503
581
|
{ id: "return7d", label: "7D%", width: 8, align: "right", optional: 6 },
|
|
504
582
|
{ id: "return30d", label: "30D%", width: 8, align: "right", optional: 8 },
|
|
@@ -110,6 +110,7 @@ function renderCryptoCell(row: CryptoRow, column: CryptoColumn, logos: boolean):
|
|
|
110
110
|
text: formatCryptoPercent(value),
|
|
111
111
|
color: value == null ? colors.textDim : priceColor(value),
|
|
112
112
|
});
|
|
113
|
+
const widenedTone = (widened: boolean) => (widened ? { color: colors.warning, keepColorWhenSelected: true } : {});
|
|
113
114
|
switch (column.id) {
|
|
114
115
|
case "rank":
|
|
115
116
|
return { text: String(row.rank), color: colors.textDim };
|
|
@@ -147,10 +148,18 @@ function renderCryptoCell(row: CryptoRow, column: CryptoColumn, logos: boolean):
|
|
|
147
148
|
keepColorWhenSelected: severity !== "none",
|
|
148
149
|
};
|
|
149
150
|
}
|
|
151
|
+
// An extreme the row's own exchange price set, outside the composite's range, is flagged in the warning color.
|
|
150
152
|
case "low24h":
|
|
151
|
-
return { text: row.low24hText, value: row.low24h };
|
|
153
|
+
return { text: row.low24hText, value: row.low24h, ...widenedTone(row.low24hWidened) };
|
|
152
154
|
case "high24h":
|
|
153
|
-
return { text: row.high24hText, value: row.high24h };
|
|
155
|
+
return { text: row.high24hText, value: row.high24h, ...widenedTone(row.high24hWidened) };
|
|
156
|
+
case "priceVenueText":
|
|
157
|
+
// A price held back is said on its own row, in the warning color; an exchange's own or the composite is dim.
|
|
158
|
+
return { text: row.priceVenueText, color: row.delayed ? colors.warning : colors.textDim };
|
|
159
|
+
case "low24hVenueText":
|
|
160
|
+
return { text: row.low24hVenueText, color: row.low24hWidened ? colors.warning : colors.textDim };
|
|
161
|
+
case "high24hVenueText":
|
|
162
|
+
return { text: row.high24hVenueText, color: row.high24hWidened ? colors.warning : colors.textDim };
|
|
154
163
|
case "low24hAt":
|
|
155
164
|
return { text: formatDayRangeTime(row.low24hAt), value: row.low24hAt == null ? null : new Date(row.low24hAt), color: colors.textDim };
|
|
156
165
|
case "high24hAt":
|
|
@@ -282,12 +291,18 @@ export function CryptoBoardPane({ width, height, focused }: PaneProps) {
|
|
|
282
291
|
label: "Price freshness",
|
|
283
292
|
getMetadata: () => ({ ...CRYPTO_BOARD_FRESHNESS, observations }),
|
|
284
293
|
} : null);
|
|
285
|
-
const statusLine = useMemo(() => observations.length
|
|
286
|
-
? paneStatusLine(deriveHeadlessFreshness({ shape: "rows" }, { rows: observations, freshness: CRYPTO_BOARD_FRESHNESS }, now))
|
|
287
|
-
: null, [now, observations]);
|
|
288
294
|
// Supply columns join only once there is supply to show; an outage leaves the price columns as they are.
|
|
289
295
|
const hasSupply = !!supplyRows && supplyRows.size > 0;
|
|
290
296
|
const columns = useMemo(() => buildCryptoColumns(width, assetKind, hasSupply), [assetKind, hasSupply, width]);
|
|
297
|
+
// A row held back says so in its own VENUE cell, and the footer then dates the board without claiming a delay for
|
|
298
|
+
// all of it. Too narrow for that column, the footer says the delay as it did.
|
|
299
|
+
const venueShown = columns.some((column) => column.id === "priceVenueText");
|
|
300
|
+
const statusLine = useMemo(() => observations.length
|
|
301
|
+
? paneStatusLine(deriveHeadlessFreshness({ shape: "rows" }, {
|
|
302
|
+
rows: venueShown ? observations.map((row) => row.dataSource === "delayed" ? { quoteTime: row.quoteTime } : row) : observations,
|
|
303
|
+
freshness: CRYPTO_BOARD_FRESHNESS,
|
|
304
|
+
}, now))
|
|
305
|
+
: null, [now, observations, venueShown]);
|
|
291
306
|
|
|
292
307
|
// Other is muted against the theme it is drawn on; the coins take the shared series palette, which the chart themes.
|
|
293
308
|
const otherColor = useThemeColors().textMuted;
|
|
@@ -201,7 +201,7 @@ export type BucketColumn = Omit<DataTableColumn, "id"> & { id: BucketColumnId };
|
|
|
201
201
|
const BUCKET_TEXT_COLUMNS: BucketColumn[] = [
|
|
202
202
|
{ id: "label", label: "MATURITY", width: 15, align: "left" },
|
|
203
203
|
{ id: "value", label: "PRINCIPAL", width: 10, align: "right" },
|
|
204
|
-
{ id: "share", label: "% TOTAL", width: 8, align: "right" },
|
|
204
|
+
{ id: "share", label: "% TOTAL", width: 8, align: "right", omitWhenEmpty: true },
|
|
205
205
|
];
|
|
206
206
|
/** Below this the wall bars are too short to compare. */
|
|
207
207
|
const MIN_WALL_WIDTH = 10;
|
|
@@ -13,6 +13,8 @@ import { cashInMajorUnits } from "../../../utils/dividend-cash";
|
|
|
13
13
|
import { lapsedDividend, monthlyHistoryEnd } from "../../../utils/forward-dividend";
|
|
14
14
|
import type { DeclaredCash, DeclaredDividendAction, TickerFinancials } from "../../../types/financials";
|
|
15
15
|
import { logFailure } from "../../../utils/log-failure";
|
|
16
|
+
import { isCryptoInstrumentType } from "../../../tickers/search/ranking";
|
|
17
|
+
import { isCryptoPairSymbol } from "../../../utils/crypto-pair";
|
|
16
18
|
|
|
17
19
|
export const DIVIDENDS_CONNECTION_ID = "gloom-dividends";
|
|
18
20
|
|
|
@@ -180,6 +182,20 @@ export interface DividendData {
|
|
|
180
182
|
stale?: boolean;
|
|
181
183
|
priceAsOf?: string;
|
|
182
184
|
priceStale?: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* A crypto token: it pays no distributions, and a yield it earns (USDY's) accrues in its price, so it has no cash
|
|
187
|
+
* yield to show, never 0.00% (TOKEN_YIELD_NOTE).
|
|
188
|
+
*/
|
|
189
|
+
token?: true;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/** Why a token's yields are blank: said beside them, short. */
|
|
193
|
+
export const TOKEN_YIELD_NOTE = "token: no payouts, any yield accrues in its price";
|
|
194
|
+
|
|
195
|
+
/** A coin or token: a crypto instrument by its quote's type, else a coin pair (USDY-USD) on the crypto venue or none. */
|
|
196
|
+
function isToken(symbol: string, exchange: string, instrumentType: string | undefined): boolean {
|
|
197
|
+
if (instrumentType) return isCryptoInstrumentType(instrumentType);
|
|
198
|
+
return isCryptoPairSymbol(symbol.trim().toUpperCase()) && (!exchange || exchange.toUpperCase() === "CCC");
|
|
183
199
|
}
|
|
184
200
|
|
|
185
201
|
export async function fetchDividendData(
|
|
@@ -236,11 +252,17 @@ export async function fetchDividendData(
|
|
|
236
252
|
const summaryRatesComparable = !!summaryUnit.currency && summaryUnit.divisor === 1 && summaryUnit.currency === currency;
|
|
237
253
|
const metricFields = actions && historyError && quoteFields ? { ...quoteFields, trailingAnnualDividendRate: null } : quoteFields;
|
|
238
254
|
const declared = actions && cashCurrency ? declaredDividends(actions) : [];
|
|
239
|
-
const
|
|
240
|
-
|
|
255
|
+
const token = isToken(symbol, exchange, quote?.instrumentType);
|
|
256
|
+
const built = buildDividendMetrics(payments, metricFields, price, { historyAvailable, summaryRatesComparable, declared });
|
|
257
|
+
// A token's empty history is no 0.00% yield: it has none to measure.
|
|
258
|
+
const metrics = token && payments.length === 0
|
|
259
|
+
? { ...built, trailingRate: null, forwardRate: null, trailingYield: null, forwardYield: null, forwardRateAsOf: null }
|
|
260
|
+
: built;
|
|
261
|
+
if (!historyAvailable && !historyError && metrics.trailingRate == null && metrics.forwardRate == null && !token) {
|
|
241
262
|
throw new Error(`No dividend data found for ${symbol}`);
|
|
242
263
|
}
|
|
243
264
|
return {
|
|
265
|
+
...(token && payments.length === 0 ? { token: true as const } : {}),
|
|
244
266
|
payments, ...(declared.length > 0 ? { declared } : {}), ...(convertedFrom ? { convertedFrom } : {}), ...(convertedSubUnit ? { convertedSubUnit } : {}), metrics, price, currency: currency || undefined, historyAvailable,
|
|
245
267
|
...(suppliedPrice == null && price != null && quote ? dividendQuotePriceMetadata(quote) : {}),
|
|
246
268
|
...(historyError ? { historyError } : {}), ...(summaryError ? { summaryError } : {}),
|
|
@@ -4,7 +4,7 @@ import type {
|
|
|
4
4
|
HeadlessPaneDefinition,
|
|
5
5
|
HeadlessPaneLoadArgs,
|
|
6
6
|
} from "../../../types/plugin";
|
|
7
|
-
import { fetchDividendData, requestDividendHistory, statedForwardRate, type DividendData } from "./client";
|
|
7
|
+
import { fetchDividendData, requestDividendHistory, statedForwardRate, TOKEN_YIELD_NOTE, type DividendData } from "./client";
|
|
8
8
|
import { dividendReferencePrice } from "../../../utils/trailing-dividend";
|
|
9
9
|
import type { DividendPayment, GrowthPayments } from "./types";
|
|
10
10
|
import {
|
|
@@ -246,7 +246,9 @@ export function projectDividendYieldHeadless(
|
|
|
246
246
|
...(data.stale ? [{ label: "History status", value: staleHistoryText(data.fetchedAt) }] : []),
|
|
247
247
|
...(priceStatusText ? [{ label: "Price status", value: priceStatusText }] : []),
|
|
248
248
|
{ label: trailingLabel, value: roundedRatio(metrics.trailingYield),
|
|
249
|
-
formatted: metrics.trailingYield == null
|
|
249
|
+
formatted: metrics.trailingYield == null
|
|
250
|
+
? data.token ? `${formatDividendYield(null)} (${TOKEN_YIELD_NOTE})` : formatDividendYield(null)
|
|
251
|
+
: `${formatDividendYield(metrics.trailingYield)} (${trailingNotes})` },
|
|
250
252
|
{ label: forwardLabel, value: roundedRatio(metrics.forwardYield),
|
|
251
253
|
formatted: forwardText
|
|
252
254
|
?? (metrics.forwardYield == null ? formatDividendYield(null)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { HeadlessBundleResult, HeadlessPaneColumn } from "../../../types/headless";
|
|
2
2
|
import { MISSING_VALUE, formatPercent } from "../../../utils/format";
|
|
3
3
|
import { NOT_MEANINGFUL_TEXT } from "../../../utils/growth";
|
|
4
|
-
import type
|
|
4
|
+
import { TOKEN_YIELD_NOTE, type DividendData } from "./client";
|
|
5
5
|
import { formatDividendYield, growthPaymentsDetail, PAYOUT_NOT_MEANINGFUL, trailingPaymentsText } from "./view";
|
|
6
6
|
import type { FundBondFacts } from "../../../api-client/fund-facts";
|
|
7
7
|
import { NOT_SEC_YIELD } from "../../../market-data/bond-funds";
|
|
@@ -61,6 +61,7 @@ function incompleteNote(entry: DividendRankingEntry): string | null {
|
|
|
61
61
|
*/
|
|
62
62
|
function yieldBasis(entry: DividendRankingEntry): string | null {
|
|
63
63
|
if (!("data" in entry)) return null;
|
|
64
|
+
if (entry.data.token) return TOKEN_YIELD_NOTE;
|
|
64
65
|
const lapse = entry.data.metrics.lapse;
|
|
65
66
|
if (lapse?.historyEnds && lapse.lastPaid) return historyEndsText(lapse.lastPaid);
|
|
66
67
|
const counted = trailingPaymentsText(entry.data.metrics.trailingPayments, { cadence: true });
|
|
@@ -5,7 +5,7 @@ import { resolveCurrencyUnit } from "../../../utils/currency-units";
|
|
|
5
5
|
import type { ProjectedChartPoint } from "../../../components/chart/core/data";
|
|
6
6
|
import { calendarMonthsBefore } from "../../../utils/calendar-date";
|
|
7
7
|
import { NOT_MEANINGFUL, formatPriceEarnings } from "../../../utils/price-earnings";
|
|
8
|
-
import { LATE_GRACE_DAYS, trailingCashAt, type TrailingPayments } from "../../../utils/trailing-dividend";
|
|
8
|
+
import { CADENCE_GRACE_DAYS, LATE_GRACE_DAYS, trailingCashAt, type TrailingPayments } from "../../../utils/trailing-dividend";
|
|
9
9
|
|
|
10
10
|
const DAY = 24 * 60 * 60 * 1000;
|
|
11
11
|
|
|
@@ -77,6 +77,10 @@ export function buildTrailingCashChartPoints(payments: DividendPayment[], now =
|
|
|
77
77
|
const lateExpiry = expiry.getTime() + days * DAY;
|
|
78
78
|
if (lateExpiry <= now.getTime()) dates.add(lateExpiry);
|
|
79
79
|
}
|
|
80
|
+
} else {
|
|
81
|
+
// The cadence's look past two years ends too (inferCadence).
|
|
82
|
+
const cadenceExpiry = expiry.getTime() + CADENCE_GRACE_DAYS * DAY;
|
|
83
|
+
if (cadenceExpiry <= now.getTime()) dates.add(cadenceExpiry);
|
|
80
84
|
}
|
|
81
85
|
}
|
|
82
86
|
}
|
|
@@ -36,7 +36,7 @@ const ALL_COLUMNS: BoardColumn[] = [
|
|
|
36
36
|
{ id: "epsEstimate", label: "EPS EST", width: 7, align: "right" },
|
|
37
37
|
{ id: "analysts", label: "ESTS", width: 4, align: "right" },
|
|
38
38
|
{ id: "epsActual", label: "EPS ACT", width: 7, align: "right", mayBeBlank: true },
|
|
39
|
-
{ id: "basis", label: "BASIS", width: 5, align: "left" },
|
|
39
|
+
{ id: "basis", label: "BASIS", width: 5, align: "left", mayBeBlank: true },
|
|
40
40
|
{ id: "epsSurprise", label: "EPS SURP", width: 8, align: "right", mayBeBlank: true },
|
|
41
41
|
{ id: "revenueEstimate", label: "SALES EST", width: 9, align: "right" },
|
|
42
42
|
{ id: "cap", label: "MKT CAP", width: 8, align: "right" },
|
|
@@ -28,7 +28,9 @@ import { useAssetData, usePluginAppActions, usePluginTickerActions } from "../..
|
|
|
28
28
|
import { earningsResultsAlertValues } from "../alerts/research-builder";
|
|
29
29
|
import { cachedMembers, loadMembers } from "../members/client";
|
|
30
30
|
import { isBoardRowLoading, useQuoteBoard } from "../shared/use-quote-board";
|
|
31
|
-
import {
|
|
31
|
+
import { usePlanAccess } from "../../../api-client/plan-access";
|
|
32
|
+
import { useResearchCloudSession } from "../shared/research-cloud-session";
|
|
33
|
+
import { loadEarningsHighlight } from "./highlight";
|
|
32
34
|
import {
|
|
33
35
|
addDays,
|
|
34
36
|
boardKey,
|
|
@@ -117,7 +119,7 @@ export function EarningsBoard({ focused, width, height, scopedSymbols, highlight
|
|
|
117
119
|
height: number;
|
|
118
120
|
/** Named on the command bar; empty for the market board. */
|
|
119
121
|
scopedSymbols: readonly string[];
|
|
120
|
-
/** `EVTS <ticker>`:
|
|
122
|
+
/** `EVTS <ticker>`: open on this company's report and select its row. */
|
|
121
123
|
highlight?: string | null;
|
|
122
124
|
}) {
|
|
123
125
|
const dataProvider = useAssetData();
|
|
@@ -151,7 +153,7 @@ export function EarningsBoard({ focused, width, height, scopedSymbols, highlight
|
|
|
151
153
|
// range for both views: the table draws its days, the calendar its week (this week for the days ahead).
|
|
152
154
|
const [requestedDate] = usePaneSettingValue<string>("date", "");
|
|
153
155
|
const [requestedWeek] = usePaneSettingValue<string>("week", "");
|
|
154
|
-
const [
|
|
156
|
+
const [chosenRange, setRange] = usePluginPaneState<BoardRange | null>("range", null);
|
|
155
157
|
// The calendar's groups opened past their "+N more" slot, by `calendarGroupKey`.
|
|
156
158
|
const [expanded, setExpanded] = useState(NONE_EXPANDED);
|
|
157
159
|
const desktop = useUiCapabilities().nativePaneChrome === true;
|
|
@@ -171,6 +173,12 @@ export function EarningsBoard({ focused, width, height, scopedSymbols, highlight
|
|
|
171
173
|
|
|
172
174
|
const today = newYorkToday();
|
|
173
175
|
const market = !scoped && scope.kind === "all";
|
|
176
|
+
const access = usePlanAccess();
|
|
177
|
+
const session = useResearchCloudSession();
|
|
178
|
+
const accessKey = `${session.requestKey}:${access.hasProAccess ? "pro" : "free"}`;
|
|
179
|
+
const highlightLoader = useCallback((force: boolean) => loadEarningsHighlight(highlight!, today, dataProvider, force, accessKey), [accessKey, dataProvider, highlight, today]);
|
|
180
|
+
const highlightedReport = useAsyncResource(market && highlight ? highlightLoader : null);
|
|
181
|
+
const range = chosenRange ?? (requestedBoardRange(requestedDate, requestedWeek) || highlightedReport.data?.report.date || "");
|
|
174
182
|
// Keyed by content: ticker records change for many reasons, the board reloads only when the list's names do.
|
|
175
183
|
const collectionKey = useMemo(() => {
|
|
176
184
|
if (scope.kind !== "portfolio" && scope.kind !== "watchlist") return "";
|
|
@@ -196,7 +204,7 @@ export function EarningsBoard({ focused, width, height, scopedSymbols, highlight
|
|
|
196
204
|
const weekOffset = boardRangeWeek(range, today);
|
|
197
205
|
const week = useMemo(() => calendarWeekDates(today, weekOffset), [today, weekOffset]);
|
|
198
206
|
// EVTS 0700.HK names its listing, which the market board then keeps whatever the day's cut.
|
|
199
|
-
const highlightListing = market && highlight
|
|
207
|
+
const highlightListing = market && highlight ? boardKey(highlight) : null;
|
|
200
208
|
// The calendar reads its week, reported days included; the table its days. Each report says its currency
|
|
201
209
|
// (CCY), so every board reads the listings abroad too.
|
|
202
210
|
const query = useMemo<EarningsCalendarQuery>(() => {
|
|
@@ -228,6 +236,10 @@ export function EarningsBoard({ focused, width, height, scopedSymbols, highlight
|
|
|
228
236
|
const extra = fallback.status === "fulfilled"
|
|
229
237
|
? fallback.value.filter((event) => !covered.has(event.symbol)).map((event) => fallbackReport(event, owned, today))
|
|
230
238
|
: [];
|
|
239
|
+
const target = highlightedReport.data?.report;
|
|
240
|
+
if (target && target.date >= read.from && target.date <= read.to && ![...reports, ...extra].some((report) => boardRowOf(report, target.symbol))) {
|
|
241
|
+
extra.push({ ...target, owned: owned.get(target.symbol) ?? null });
|
|
242
|
+
}
|
|
231
243
|
return {
|
|
232
244
|
queryKey,
|
|
233
245
|
reports: [...reports, ...extra],
|
|
@@ -237,8 +249,8 @@ export function EarningsBoard({ focused, width, height, scopedSymbols, highlight
|
|
|
237
249
|
? (cloud.reason instanceof Error ? cloud.reason.message : String(cloud.reason))
|
|
238
250
|
: holdings?.refreshError ?? cloud.value.refreshError,
|
|
239
251
|
};
|
|
240
|
-
}, [calendar, dataProvider, market, named, owned, perTicker, query, queryKey, range, fund, today]);
|
|
241
|
-
const resource = useAsyncResource(loader, {
|
|
252
|
+
}, [calendar, dataProvider, highlightedReport.data, market, named, owned, perTicker, query, queryKey, range, fund, today]);
|
|
253
|
+
const resource = useAsyncResource(highlightedReport.loading ? null : loader, {
|
|
242
254
|
keepPreviousData: true,
|
|
243
255
|
initialData: () => {
|
|
244
256
|
const holdings = fund ? cachedMembers(fund.etf) : null;
|
|
@@ -324,16 +336,23 @@ export function EarningsBoard({ focused, width, height, scopedSymbols, highlight
|
|
|
324
336
|
const updatedAgo = useUpdatedAgo(resource.updatedAt);
|
|
325
337
|
const utcDay = useUtcDay();
|
|
326
338
|
// Its source and when the calendar was read, as `fn EVTS` ends; how long ago it loaded goes first on a narrow row.
|
|
327
|
-
const
|
|
328
|
-
|
|
329
|
-
...(
|
|
330
|
-
|
|
339
|
+
const highlightMissing = market && highlight && !resource.loading && !highlightedReport.loading && !data?.reports.some((report) => boardRowOf(report, highlight));
|
|
340
|
+
const footerInfo = useMemo(() => [
|
|
341
|
+
...(highlightMissing ? [{ id: "highlight", capture: true, parts: [{
|
|
342
|
+
text: highlightedReport.error ? `${highlight}: report date unavailable`
|
|
343
|
+
: highlightedReport.data ? `${highlight} reports on ${highlightedReport.data.report.date}; not in this range`
|
|
344
|
+
: `No report date for ${highlight}.`,
|
|
345
|
+
tone: "warning" as const,
|
|
346
|
+
}] }] : []),
|
|
347
|
+
...(data ? [reportFooterSegment(earningsBoardHeadless, { rows: [], metadata: { asOf: data.asOf } }),
|
|
348
|
+
...(updatedAgo ? [ageFooterSegment(updatedAgo)] : [])] : []),
|
|
349
|
+
], [data, highlight, highlightedReport.data, highlightedReport.error, highlightMissing, updatedAgo, utcDay]);
|
|
331
350
|
usePaneStatusFooter({
|
|
332
351
|
registrationId: "earnings-board",
|
|
333
352
|
enabled: !open,
|
|
334
|
-
loading: resource.loading,
|
|
335
|
-
error: resource.error ?? data?.refreshError ?? null,
|
|
336
|
-
stale: !!data?.stale,
|
|
353
|
+
loading: resource.loading || highlightedReport.loading,
|
|
354
|
+
error: resource.error ?? highlightedReport.error ?? data?.refreshError ?? highlightedReport.data?.refreshError ?? null,
|
|
355
|
+
stale: !!data?.stale || !!highlightedReport.data?.stale,
|
|
337
356
|
info: footerInfo,
|
|
338
357
|
});
|
|
339
358
|
const symbol = open?.symbol ?? selectedReport?.symbol ?? null;
|
|
@@ -357,8 +376,9 @@ export function EarningsBoard({ focused, width, height, scopedSymbols, highlight
|
|
|
357
376
|
}), [alerts, createPaneFromTemplate, navigateTicker, notify, symbol]);
|
|
358
377
|
|
|
359
378
|
// t, e, c, a and n are footer hints, which bind their own keys.
|
|
360
|
-
const
|
|
361
|
-
|
|
379
|
+
const refresh = useCallback(() => { highlightedReport.reload(); resource.reload(); }, [highlightedReport.reload, resource.reload]);
|
|
380
|
+
const handleKeyDown = useCallback((event: DataTableKeyEvent) => handleRefreshKey(event, refresh), [refresh]);
|
|
381
|
+
usePaneRefreshKey(refresh, { focused, enabled: calendar && !open });
|
|
362
382
|
|
|
363
383
|
const sortColumn = (Object.entries(SORTABLE).find(([, value]) => value === sort.column)?.[0]) ?? null;
|
|
364
384
|
const namesFilter: QueryBarFilter[] = scoped ? [] : [{
|
|
@@ -457,7 +477,7 @@ export function EarningsBoard({ focused, width, height, scopedSymbols, highlight
|
|
|
457
477
|
rootWidth={width}
|
|
458
478
|
rootHeight={height}
|
|
459
479
|
rootBefore={queryBar}
|
|
460
|
-
status={{ loading: resource.loading && !data, error: !data ? resource.error : null, subject: "the earnings calendar" }}
|
|
480
|
+
status={{ loading: (resource.loading || highlightedReport.loading) && !data, error: !data ? resource.error : null, subject: "the earnings calendar" }}
|
|
461
481
|
columns={columns}
|
|
462
482
|
items={rows}
|
|
463
483
|
getItemKey={(row) => row.key}
|