@gloom-sh/terminal 0.20.11 → 0.20.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -1
- package/src/api-client/awards.ts +16 -0
- package/src/api-client/central-bank-rates.ts +5 -0
- package/src/api-client/data.ts +55 -2
- package/src/api-client/index.ts +18 -1
- package/src/api-client/request.ts +86 -3
- package/src/api-client/socket-connection.ts +12 -1
- package/src/api-client/socket.ts +21 -3
- package/src/api-client/supply-chain-graph.ts +4 -2
- package/src/api-client/supply-chain.ts +8 -0
- package/src/api-client/types/econ.ts +10 -7
- package/src/api-client/types/filings-and-calls.ts +8 -0
- package/src/app/global-shortcuts.ts +2 -1
- package/src/app/keybindings/actions.ts +19 -0
- package/src/app/pane-runtime/index.tsx +18 -3
- package/src/app/pane-runtime/layout-placement.ts +63 -0
- package/src/app/pane-runtime/ticker-open-runtime.ts +10 -2
- package/src/capabilities/chart-series.ts +4 -1
- package/src/cli/board-coins.ts +10 -1
- package/src/cli/commands/crypto-hints.ts +3 -2
- package/src/cli/commands/fred-series.ts +0 -54
- package/src/cli/commands/market.ts +209 -31
- package/src/cli/commands/overview.ts +47 -14
- package/src/cli/commands/search.ts +37 -8
- package/src/cli/commands/ticker.ts +15 -4
- package/src/cli/desktop-pane-shot.ts +27 -2
- package/src/cli/fx-quote-rate.ts +1 -1
- package/src/cli/glossary.ts +14 -5
- package/src/cli/history-catalog-series.ts +85 -0
- package/src/cli/index.ts +1 -1
- package/src/cli/list-progress.ts +45 -0
- package/src/cli/listing-arg.ts +71 -7
- package/src/cli/name-entries.ts +8 -4
- package/src/cli/not-a-ticker.ts +2 -2
- package/src/cli/pane-functions/freshness.ts +50 -3
- package/src/cli/pane-functions/index.ts +7 -4
- package/src/cli/pane-functions/market-session.ts +66 -14
- package/src/cli/pane-functions/options.ts +5 -0
- package/src/cli/pane-functions/resolver.ts +9 -2
- package/src/cli/pane-functions/screenshot-assessment.ts +28 -3
- package/src/cli/pane-functions/screenshot-types.ts +6 -0
- package/src/cli/quote-answer.ts +49 -10
- package/src/cli/quote-list-reads.ts +87 -0
- package/src/cli/report-tables.ts +70 -13
- package/src/cli/result.ts +24 -2
- package/src/cli/symbol-list.ts +31 -4
- package/src/cli/terminal-code-hints.ts +83 -0
- package/src/cli/ticker-resolution.ts +2 -1
- package/src/cli/treasury-yields.ts +5 -0
- package/src/components/command-bar/action-runtime.ts +2 -0
- package/src/components/command-bar/routing/launch-request.ts +2 -1
- package/src/components/command-bar/routing/navigation-state.ts +4 -2
- package/src/components/command-bar/workflow/types.ts +6 -0
- package/src/components/layout/detached-pane-shell.tsx +3 -0
- package/src/components/layout/double-escape-close.ts +34 -3
- package/src/components/layout/floating-pane.tsx +10 -4
- package/src/components/layout/pane/cycle-order.ts +66 -2
- package/src/components/layout/pane/header.tsx +140 -31
- package/src/components/layout/pane/sidebar.tsx +13 -5
- package/src/components/layout/pane/status-footer.ts +3 -1
- package/src/components/layout/shell/drag/runtime.ts +5 -0
- package/src/components/layout/shell/index.tsx +25 -0
- package/src/components/layout/shell/menu.ts +9 -0
- package/src/components/layout/shell/pane/actions.ts +36 -0
- package/src/components/layout/shell/pane/management-shortcuts.ts +27 -3
- package/src/components/layout/shell/pane-occlusion.ts +40 -0
- package/src/components/layout/shell/shortcuts.ts +17 -1
- package/src/components/layout/shell/terminal-pointer-runtime.ts +39 -6
- package/src/components/layout/shell/window-mode/index.ts +5 -16
- package/src/components/layout/shell/window-mode/overlays.tsx +3 -1
- package/src/components/market-board/index.tsx +14 -5
- package/src/components/metric-treemap/index.tsx +3 -1
- package/src/components/ui/button.tsx +48 -4
- package/src/components/ui/data-table/opentui/index.tsx +24 -9
- package/src/components/ui/data-table/types.ts +7 -0
- package/src/components/ui/inline-quick-add.tsx +19 -3
- package/src/components/ui/list-view.tsx +11 -5
- package/src/components/ui/query-bar.tsx +16 -1
- package/src/components/ui/selection-fill.ts +39 -0
- package/src/core/state/app/layout-reducer.ts +2 -1
- package/src/core/state/app/pane-choices.ts +68 -0
- package/src/core/state/app/state.ts +14 -6
- package/src/core/state/app/types.ts +8 -0
- package/src/layout/pane-manager/dock-tree.ts +19 -0
- package/src/layout/pane-manager/index.ts +3 -0
- package/src/market-data/market/freshness.ts +33 -0
- package/src/market-data/market/status.ts +5 -1
- package/src/market-data/quotes/contributions.ts +10 -0
- package/src/market-data/quotes/freshness.ts +19 -0
- package/src/market-data/quotes/live-valuation.ts +31 -4
- package/src/market-data/quotes/resolution.ts +4 -0
- package/src/market-data/quotes/time.ts +0 -14
- package/src/plugins/builtin/account-management/index.tsx +1 -0
- package/src/plugins/builtin/awards/detail.tsx +12 -4
- package/src/plugins/builtin/awards/headless.ts +29 -8
- package/src/plugins/builtin/awards/model.ts +36 -2
- package/src/plugins/builtin/awards/pane.tsx +7 -4
- package/src/plugins/builtin/broker-manager/index.tsx +1 -0
- package/src/plugins/builtin/broker-trading/index.tsx +1 -1
- package/src/plugins/builtin/central-bank-rates/headless.ts +6 -6
- package/src/plugins/builtin/central-bank-rates/index.tsx +1 -1
- package/src/plugins/builtin/central-bank-rates/model.ts +21 -3
- package/src/plugins/builtin/central-bank-rates/pane.tsx +15 -5
- package/src/plugins/builtin/chart-composer/headless.ts +5 -1
- package/src/plugins/builtin/chart-composer/pane.tsx +1 -0
- package/src/plugins/builtin/chat/content/handle-prompt.tsx +4 -0
- package/src/plugins/builtin/chat/controller/realtime.ts +17 -1
- package/src/plugins/builtin/chat/message/terminal.tsx +4 -1
- package/src/plugins/builtin/chat/sidebar.tsx +3 -4
- package/src/plugins/builtin/cloud/askg/pane.tsx +4 -0
- package/src/plugins/builtin/cloud/plugin.tsx +1 -0
- package/src/plugins/builtin/cloud/team/module.tsx +1 -0
- package/src/plugins/builtin/cloud/thesis/detail.tsx +9 -4
- package/src/plugins/builtin/commodity-balances/pane.tsx +13 -5
- package/src/plugins/builtin/company-kpis/model.ts +3 -3
- package/src/plugins/builtin/connections/index.ts +1 -0
- package/src/plugins/builtin/credit-boards/cdx-pane.tsx +9 -5
- package/src/plugins/builtin/credit-boards/client.ts +5 -0
- package/src/plugins/builtin/credit-boards/headless.ts +1 -6
- package/src/plugins/builtin/credit-boards/model.ts +0 -6
- package/src/plugins/builtin/credit-boards/series.ts +19 -8
- package/src/plugins/builtin/credit-boards/sovr-pane.tsx +9 -5
- package/src/plugins/builtin/crypto-etf-flows/headless.ts +23 -13
- package/src/plugins/builtin/crypto-etf-flows/pane.tsx +8 -3
- package/src/plugins/builtin/debt-maturities/headless.ts +16 -7
- package/src/plugins/builtin/debt-maturities/model.ts +9 -15
- package/src/plugins/builtin/debt-maturities/pane.tsx +9 -10
- package/src/plugins/builtin/earnings/board-model.ts +33 -4
- package/src/plugins/builtin/earnings/board.tsx +15 -3
- package/src/plugins/builtin/earnings/calendar.tsx +10 -6
- package/src/plugins/builtin/earnings/client.ts +0 -9
- package/src/plugins/builtin/earnings/headless.ts +10 -7
- package/src/plugins/builtin/earnings/history.tsx +21 -14
- package/src/plugins/builtin/earnings-calls/data.ts +24 -4
- package/src/plugins/builtin/earnings-calls/format.ts +23 -5
- package/src/plugins/builtin/earnings-calls/headless.ts +23 -3
- package/src/plugins/builtin/earnings-calls/index.tsx +1 -0
- package/src/plugins/builtin/earnings-calls/model.ts +11 -1
- package/src/plugins/builtin/earnings-calls/pane.tsx +2 -5
- package/src/plugins/builtin/econ/calendar-model.ts +27 -0
- package/src/plugins/builtin/econ/fred-catalog.ts +3 -0
- package/src/plugins/builtin/econ/index.tsx +9 -2
- package/src/plugins/builtin/econ-statistics/headless.ts +3 -1
- package/src/plugins/builtin/econ-statistics/index.tsx +1 -1
- package/src/plugins/builtin/fear-greed/headless.ts +16 -13
- package/src/plugins/builtin/fear-greed/pane.tsx +12 -4
- package/src/plugins/builtin/filing-events/index.tsx +1 -0
- package/src/plugins/builtin/fx-matrix/index.tsx +30 -19
- package/src/plugins/builtin/insider/table.tsx +10 -7
- package/src/plugins/builtin/insider/tickers.tsx +1 -1
- package/src/plugins/builtin/iv-history/headless.ts +9 -8
- package/src/plugins/builtin/jobs/index.tsx +1 -0
- package/src/plugins/builtin/macro-day/headless.ts +3 -3
- package/src/plugins/builtin/macro-day/model.ts +1 -1
- package/src/plugins/builtin/macro-day/releases.ts +25 -16
- package/src/plugins/builtin/market-movers/index.tsx +20 -8
- package/src/plugins/builtin/market-movers/model.ts +5 -0
- package/src/plugins/builtin/market-movers/session-body.tsx +2 -1
- package/src/plugins/builtin/money-markets/headless.ts +12 -2
- package/src/plugins/builtin/money-markets/pane.tsx +10 -1
- package/src/plugins/builtin/options/view.tsx +1 -0
- package/src/plugins/builtin/options-positioning/pane.tsx +1 -1
- package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +4 -31
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +6 -1
- package/src/plugins/builtin/portfolio-list/quick-add/index.tsx +22 -8
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +6 -8
- package/src/plugins/builtin/portfolio-list/table.tsx +10 -1
- package/src/plugins/builtin/realized-vol/headless.ts +28 -2
- package/src/plugins/builtin/risk-factors/index.tsx +1 -0
- package/src/plugins/builtin/shared/source-footer.ts +70 -0
- package/src/plugins/builtin/short-interest/publications-pane.tsx +5 -1
- package/src/plugins/builtin/short-volume/pane.tsx +5 -1
- package/src/plugins/builtin/social-mentions/outliers.tsx +10 -1
- package/src/plugins/builtin/social-mentions/pane.tsx +7 -0
- package/src/plugins/builtin/supply-chain/client.ts +3 -1
- package/src/plugins/builtin/supply-chain/flow.tsx +25 -8
- package/src/plugins/builtin/supply-chain/graph-client.ts +1 -1
- package/src/plugins/builtin/supply-chain/graph-evidence.ts +1 -1
- package/src/plugins/builtin/supply-chain/graph-model.ts +12 -1
- package/src/plugins/builtin/supply-chain/graph-pane.tsx +9 -8
- package/src/plugins/builtin/supply-chain/graph.tsx +12 -6
- package/src/plugins/builtin/supply-chain/headless.ts +13 -7
- package/src/plugins/builtin/supply-chain/model.ts +68 -11
- package/src/plugins/builtin/supply-chain/pane.tsx +9 -6
- package/src/plugins/builtin/supply-chain/row-evidence.tsx +5 -5
- package/src/plugins/builtin/ticker-detail/overview/components.tsx +14 -1
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +2 -0
- package/src/plugins/builtin/ticker-detail/pane.tsx +48 -24
- package/src/plugins/builtin/ticker-detail/quote-footer.ts +5 -0
- package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +6 -3
- package/src/plugins/builtin/treasury-auctions/after.ts +50 -23
- package/src/plugins/builtin/treasury-auctions/cache.ts +23 -5
- package/src/plugins/builtin/treasury-auctions/headless.ts +226 -37
- package/src/plugins/builtin/treasury-auctions/hk-headless.ts +11 -5
- package/src/plugins/builtin/treasury-auctions/hk-view.tsx +27 -25
- package/src/plugins/builtin/treasury-auctions/hk.ts +60 -8
- package/src/plugins/builtin/treasury-auctions/index.tsx +3 -0
- package/src/plugins/builtin/treasury-auctions/keys.ts +27 -0
- package/src/plugins/builtin/treasury-auctions/like.ts +137 -0
- package/src/plugins/builtin/treasury-auctions/model.ts +100 -22
- package/src/plugins/builtin/treasury-auctions/pane.tsx +39 -11
- package/src/plugins/builtin/vol-surface/heat-grid.tsx +4 -2
- package/src/plugins/builtin/vol-surface/pane.tsx +5 -2
- package/src/plugins/runtime/index.tsx +1 -0
- package/src/plugins/runtime/state.ts +20 -0
- package/src/portfolio/column-values.ts +8 -2
- package/src/public/__snapshots__/public-api.test.ts.snap +5 -0
- package/src/public/react.ts +7 -0
- package/src/react/auto-refresh.ts +29 -0
- package/src/renderers/browser/deeplink-bridge.ts +24 -3
- package/src/renderers/dom/desktop/query-bar.tsx +229 -60
- package/src/renderers/dom/host/overflow-fade-px.ts +2 -0
- package/src/renderers/dom/host/overflow-fade.ts +1 -2
- package/src/renderers/dom/styles.css +25 -5
- package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +2 -1
- package/src/series/types.ts +2 -0
- package/src/sources/gloomberb-cloud/fred-attribution.ts +86 -0
- package/src/sources/gloomberb-cloud/index.ts +25 -1
- package/src/sources/gloomberb-cloud/normalizers.ts +22 -3
- package/src/sources/provider-errors.ts +64 -1
- package/src/sources/provider-router/batches.ts +19 -0
- package/src/sources/provider-router/index.ts +7 -1
- package/src/state/app/context/index.tsx +24 -1
- package/src/state/pane-unsent-work.ts +47 -0
- package/src/test-support/shell-pane-keys.tsx +5 -0
- package/src/test-support/telemetry-guard.ts +83 -0
- package/src/test-support/test-env.ts +12 -0
- package/src/theme/colors.ts +17 -1
- package/src/theme/ui-tokens.ts +50 -1
- package/src/tickers/listing-venues.ts +11 -1
- package/src/tickers/search/japanese-names.json +1 -0
- package/src/tickers/search/japanese-names.ts +152 -0
- package/src/tickers/terminal-codes.ts +55 -6
- package/src/time-series/base-series.ts +3 -0
- package/src/types/data-provider.ts +6 -0
- package/src/types/financials.ts +11 -0
- package/src/types/plugin-contributions.ts +7 -0
- package/src/types/plugin-panes.ts +7 -0
- package/src/ui/host.tsx +6 -0
- package/src/utils/double-escape-close.ts +42 -0
- package/src/utils/fx-status.ts +30 -7
- package/src/utils/network-failure.ts +23 -0
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
import { promptChoice } from "./prompts";
|
|
33
33
|
import { thesisStore } from "./store";
|
|
34
34
|
import { ClippedText } from "../../../../components/ui/display";
|
|
35
|
+
import { useSelectionFill } from "../../../../components/ui/selection-fill";
|
|
35
36
|
import { logFailure } from "../../../../utils/log-failure";
|
|
36
37
|
|
|
37
38
|
type Row =
|
|
@@ -155,6 +156,7 @@ export function ThesisDetail({ thesis, width, height, focused, footerId, onDelet
|
|
|
155
156
|
const [busy, setBusy] = useState(false);
|
|
156
157
|
const generation = useRef(0);
|
|
157
158
|
const { nativePaneChrome } = useUiCapabilities();
|
|
159
|
+
const selectionFill = useSelectionFill();
|
|
158
160
|
|
|
159
161
|
const ctx = useMemo<flows.FlowContext>(() => ({ dialog, notify, hasProAccess: plan.hasProAccess, openUpgrade }), [dialog, notify, openUpgrade, plan.hasProAccess]);
|
|
160
162
|
|
|
@@ -355,8 +357,11 @@ export function ThesisDetail({ thesis, width, height, focused, footerId, onDelet
|
|
|
355
357
|
const renderRow = useCallback((item: ListViewItem, state: { selected: boolean }) => {
|
|
356
358
|
const row = rows.find((entry) => entry.id === item.id);
|
|
357
359
|
if (!row) return null;
|
|
358
|
-
const
|
|
359
|
-
|
|
360
|
+
const lit = state.selected && selectionFill.lit;
|
|
361
|
+
// On the quieter fill a row's colours are lifted where they would not read.
|
|
362
|
+
const ink = (color: string) => (state.selected ? selectionFill.ink(color) : color);
|
|
363
|
+
const fg = lit ? colors.selectedText : ink(colors.text);
|
|
364
|
+
const dim = lit ? colors.selectedText : ink(colors.textDim);
|
|
360
365
|
// Every row is a full-width row box, so the DOM host lays headings and
|
|
361
366
|
// prose out flush left like the pillar rows instead of centering them.
|
|
362
367
|
if (row.kind === "heading") {
|
|
@@ -427,7 +432,7 @@ export function ThesisDetail({ thesis, width, height, focused, footerId, onDelet
|
|
|
427
432
|
<Text fg={dim}>{rightText}</Text>
|
|
428
433
|
</Box>
|
|
429
434
|
);
|
|
430
|
-
}, [contentWidth, rows, thesis.document]);
|
|
435
|
+
}, [contentWidth, rows, selectionFill.lit, thesis.document]);
|
|
431
436
|
|
|
432
437
|
const owner = isTeam ? teamStore.getTeam(thesis.owner.id)?.name ?? "team" : null;
|
|
433
438
|
const nextDue = thesis.document.catalysts
|
|
@@ -519,7 +524,7 @@ export function ThesisDetail({ thesis, width, height, focused, footerId, onDelet
|
|
|
519
524
|
rowGap={0}
|
|
520
525
|
height={nativePaneChrome ? undefined : Math.max(3, height - headerHeight - stripHeight)}
|
|
521
526
|
flexGrow={nativePaneChrome ? 1 : undefined}
|
|
522
|
-
getRowBackgroundColor={(item, state) => (state.selected ?
|
|
527
|
+
getRowBackgroundColor={(item, state) => (state.selected ? selectionFill.bg : item.disabled ? colors.bg : undefined)}
|
|
523
528
|
remoteRole="thesis"
|
|
524
529
|
remoteLabel={thesis.title}
|
|
525
530
|
/>
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import { usePaneRefreshKey } from "../../../components/data-table/table-pane";
|
|
12
12
|
import { ageFooterSegment, type PaneFooterSegment } from "../../../components/layout/pane/footer";
|
|
13
13
|
import { useAsyncResource } from "../../../react/async-resource";
|
|
14
|
-
import { useAutoRefresh, useUpdatedAgo } from "../../../react/auto-refresh";
|
|
14
|
+
import { useAutoRefresh, useUpdatedAgo, useUtcDay } from "../../../react/auto-refresh";
|
|
15
15
|
import { usePaneInstance } from "../../../state/app/context";
|
|
16
16
|
import { useThemeColors } from "../../../theme/theme-context";
|
|
17
17
|
import type { PaneProps } from "../../../types/plugin";
|
|
@@ -20,6 +20,8 @@ import { withCountryFlag, withFlagRoom } from "../../../components/ui/country-fl
|
|
|
20
20
|
import { nextHeaderSort } from "../../../utils/sort-values";
|
|
21
21
|
import { usePluginPaneState } from "../../runtime";
|
|
22
22
|
import { fetchCommodityBalances } from "./client";
|
|
23
|
+
import { commodityBalancesHeadless } from "./headless";
|
|
24
|
+
import { reportFooterSegment } from "../shared/source-footer";
|
|
23
25
|
import {
|
|
24
26
|
BALANCE_SORT,
|
|
25
27
|
PRICE_SORT,
|
|
@@ -94,11 +96,17 @@ export function CommodityBalancesPane({ width, height, focused }: PaneProps) {
|
|
|
94
96
|
queryBarWidth: width,
|
|
95
97
|
});
|
|
96
98
|
const updatedAgo = useUpdatedAgo(updatedAt);
|
|
99
|
+
const utcDay = useUtcDay();
|
|
100
|
+
// Its source and the estimates' month, as `fn PSD` ends; how long ago it loaded goes first on a narrow row.
|
|
97
101
|
const info = useMemo<PaneFooterSegment[]>(() => {
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
return
|
|
101
|
-
|
|
102
|
+
if (!data) return [];
|
|
103
|
+
const year = data.marketYear;
|
|
104
|
+
return [
|
|
105
|
+
reportFooterSegment(commodityBalancesHeadless, { sections: [], ...(data.month ? { metadata: { asOf: `${data.month}-01` } } : {}) }),
|
|
106
|
+
...(updatedAgo ? [ageFooterSegment(updatedAgo)] : []),
|
|
107
|
+
...(year ? [{ id: "year", parts: [{ text: year, tone: "muted" as const }] }] : []),
|
|
108
|
+
];
|
|
109
|
+
}, [data, updatedAgo, utcDay]);
|
|
102
110
|
|
|
103
111
|
useAutoRefresh(updatedAt, load);
|
|
104
112
|
usePaneRefreshKey(load, { focused });
|
|
@@ -282,8 +282,8 @@ export function fitCompanyColumns(columns: readonly DataTableColumn[], width: nu
|
|
|
282
282
|
const EXAMPLE_COMPANIES: Record<CompanyMode, readonly string[]> = { guidance: ["WMT", "DAL"], kpis: ["AAPL", "NVDA"] };
|
|
283
283
|
|
|
284
284
|
/**
|
|
285
|
-
* What an empty table says. A company with nothing on file for the function
|
|
286
|
-
*
|
|
285
|
+
* What an empty table says. A company with nothing on file for the function reads as
|
|
286
|
+
* not yet available, never as an error, and names one that has some; a selection or tab that narrows what the company
|
|
287
287
|
* has says what is missing from it. `cli` types `fn GUIDE WMT`, the app's command bar `GUIDE WMT`.
|
|
288
288
|
*/
|
|
289
289
|
export function companyEmptyState(mode: CompanyMode, symbol: string, view: { tab: string; hasRows: boolean }, surface: "cli" | "pane" = "pane"): { title: string; hint?: string } {
|
|
@@ -291,7 +291,7 @@ export function companyEmptyState(mode: CompanyMode, symbol: string, view: { tab
|
|
|
291
291
|
const examples = EXAMPLE_COMPANIES[mode];
|
|
292
292
|
const example = examples.find((candidate) => candidate !== symbol.trim().toUpperCase()) ?? examples[0]!;
|
|
293
293
|
const command = `${mode === "kpis" ? "KPIS" : "GUIDE"} ${example}`;
|
|
294
|
-
return { title:
|
|
294
|
+
return { title: mode === "kpis" ? `KPIs for ${symbol} are not yet available.` : `Guidance for ${symbol} is not yet available.`, hint: `Try ${surface === "cli" ? `\`fn ${command}\`` : command}.` };
|
|
295
295
|
}
|
|
296
296
|
|
|
297
297
|
/** What a missing KPI means, as KPIS states it among its limitations and EQS beside a KPI column with gaps. */
|
|
@@ -38,6 +38,7 @@ export const connectionsModule: PluginModule = {
|
|
|
38
38
|
reportFreshness: { status: "not-a-feed", basis: "connection health", local: true },
|
|
39
39
|
defaultPosition: "right",
|
|
40
40
|
defaultMode: "floating",
|
|
41
|
+
utilityWindow: true,
|
|
41
42
|
defaultFloatingSize: { width: 80, height: 24 },
|
|
42
43
|
portableShare: {
|
|
43
44
|
private: { params: true, settings: true, state: true },
|
|
@@ -21,7 +21,9 @@ import type { PaneProps } from "../../../types/plugin";
|
|
|
21
21
|
import { usePluginPaneState } from "../../runtime";
|
|
22
22
|
import { FIXED_INCOME_PANE_ID } from "../fixed-income/model";
|
|
23
23
|
import { useCommandValue } from "../shared/command-tab";
|
|
24
|
+
import { reportFooterSegment } from "../shared/source-footer";
|
|
24
25
|
import { getCachedCdxBoard, loadCdxBoard } from "./client";
|
|
26
|
+
import { cdxHeadless } from "./headless";
|
|
25
27
|
import {
|
|
26
28
|
axisFormatter,
|
|
27
29
|
cdxRows,
|
|
@@ -30,7 +32,6 @@ import {
|
|
|
30
32
|
formatLevel,
|
|
31
33
|
formatMove,
|
|
32
34
|
formatSpreadRank,
|
|
33
|
-
newestRowDate,
|
|
34
35
|
partialDayText,
|
|
35
36
|
SETTLEMENT_TEXT,
|
|
36
37
|
type CdxRow,
|
|
@@ -110,13 +111,16 @@ export function CdxPane({ focused, width, height }: PaneProps) {
|
|
|
110
111
|
useAutoRefresh(resource.updatedAt, refresh);
|
|
111
112
|
usePaneRefreshKey(reload, { focused, enabled: !loading });
|
|
112
113
|
|
|
113
|
-
//
|
|
114
|
-
|
|
114
|
+
// Its source and the newest day the rows carry, not when the response was put together, as `fn CDX` ends.
|
|
115
|
+
// The clock says the prints are delayed, so the line does not again.
|
|
116
|
+
const sourceLine = useMemo(() => payload
|
|
117
|
+
? reportFooterSegment(cdxHeadless, { sections: [{ title: "", columns: [], rows: payload.indexes.map((index) => ({ date: index.date })) }] }, { feed: false })
|
|
118
|
+
: null, [payload]);
|
|
115
119
|
// PCTL 1Y ranks spreads; the rows quoted in price (HY, EM) rank their spread equivalent, which a picture keeps.
|
|
116
120
|
const spreadEqRanked = useMemo(() => rows.filter((row) => row.rank.basis === "spread-eq")
|
|
117
121
|
.map((row) => row.index.name.replace(/^CDX\s+/i, "")).join(", "), [rows]);
|
|
118
122
|
const info = useMemo<PaneFooterSegment[]>(() => [
|
|
119
|
-
...(
|
|
123
|
+
...(sourceLine ? [sourceLine] : []),
|
|
120
124
|
...(payload ? [DELAYED_SEGMENT] : []),
|
|
121
125
|
...(resource.data?.stale ? [{ id: "stale", parts: [{ text: "STALE", tone: "warning" as const }] }] : []),
|
|
122
126
|
...(spreadEqRanked ? [{
|
|
@@ -124,7 +128,7 @@ export function CdxPane({ focused, width, height }: PaneProps) {
|
|
|
124
128
|
parts: [{ text: `${spreadEqRanked} pctl on spread eq`, tone: "muted" as const }],
|
|
125
129
|
variants: [[{ text: "pctl on spread eq", tone: "muted" as const }]],
|
|
126
130
|
}] : []),
|
|
127
|
-
], [
|
|
131
|
+
], [payload, sourceLine, resource.data?.stale, spreadEqRanked]);
|
|
128
132
|
usePaneStatusFooter({
|
|
129
133
|
registrationId: "cdx",
|
|
130
134
|
loading,
|
|
@@ -63,6 +63,11 @@ type BoardClient = Pick<typeof apiClient, "getCloudCdxBoard" | "getCloudSovrBoar
|
|
|
63
63
|
/** Days of history the server serves at most, for a history export. */
|
|
64
64
|
export const CDX_MAX_DAYS = 1100;
|
|
65
65
|
|
|
66
|
+
/** The publisher a board's payload names, spelled out: `DTCC PPD` is DTCC's public price dissemination. */
|
|
67
|
+
export function boardPublisher(source: string | null | undefined): string | undefined {
|
|
68
|
+
return source?.trim().replace(/\bPPD\b/, "Public Price Dissemination") || undefined;
|
|
69
|
+
}
|
|
70
|
+
|
|
66
71
|
export async function fetchCdxBoard(client: BoardClient = apiClient, days = BOARD_DAYS): Promise<CdxBoardPayload> {
|
|
67
72
|
try { return validateCdxBoard(await client.getCloudCdxBoard({ days })); }
|
|
68
73
|
catch (error) { throw unavailableOnServer(error, "Index CDS levels are not available yet."); }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { HeadlessPaneColumn, HeadlessPaneDefinition, HeadlessPaneRow } from "../../../types/plugin";
|
|
2
2
|
import type { CdxBoardIndex, CreditIndexQuote } from "../../../api-client/credit-boards";
|
|
3
|
-
import { CDX_MAX_DAYS, fetchCdxBoard, fetchSovrBoard, loadCurrencyMoves } from "./client";
|
|
3
|
+
import { boardPublisher, CDX_MAX_DAYS, fetchCdxBoard, fetchSovrBoard, loadCurrencyMoves } from "./client";
|
|
4
4
|
import { readsInBatches } from "../../../market-data/batched-reads";
|
|
5
5
|
import {
|
|
6
6
|
cdxDay,
|
|
@@ -55,11 +55,6 @@ const dayColumn: HeadlessPaneColumn = {
|
|
|
55
55
|
format: (value) => typeof value === "string" ? value : "",
|
|
56
56
|
};
|
|
57
57
|
|
|
58
|
-
/** The publisher a board's payload names, spelled out: `DTCC PPD` is DTCC's public price dissemination. */
|
|
59
|
-
function boardPublisher(source: string | null | undefined): string | undefined {
|
|
60
|
-
return source?.trim().replace(/\bPPD\b/, "Public Price Dissemination") || undefined;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
58
|
/**
|
|
64
59
|
* Each day's level on the contract on the run that day, newest first, over
|
|
65
60
|
* the last `days`: the chart as a table. Its key is `day`, not `date`, so the
|
|
@@ -224,12 +224,6 @@ export function formatSpreadRank(rank: SpreadRank): string {
|
|
|
224
224
|
return rank.basis === "price-inverted" && rank.percentile != null ? `${text}, price inverted` : text;
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
-
/** The newest day a board's rows are dated, which its footer dates the board by; null with none. */
|
|
228
|
-
export function newestRowDate(dates: ReadonlyArray<string | null | undefined>): string | null {
|
|
229
|
-
return dates.reduce<string | null>((newest, date) => date && /^\d{4}-\d{2}-\d{2}/.test(date) && (!newest || date > newest)
|
|
230
|
-
? date.slice(0, 10) : newest, null);
|
|
231
|
-
}
|
|
232
|
-
|
|
233
227
|
function daysBetween(from: string, to: string): number {
|
|
234
228
|
return Math.round((Date.parse(to) - Date.parse(from)) / 86_400_000);
|
|
235
229
|
}
|
|
@@ -2,7 +2,7 @@ import type { CdxBoardIndex, CreditBoardPoint } from "../../../api-client/credit
|
|
|
2
2
|
import type { SeriesDefinition, SeriesLoadRequest, SeriesLoadResult, SeriesPoint } from "../../../series/types";
|
|
3
3
|
import { logFailure } from "../../../utils/log-failure";
|
|
4
4
|
import { cachedSeriesNote } from "../shared/series-warning";
|
|
5
|
-
import { loadCdxBoard, loadFullCdxHistory, loadSovrBoard } from "./client";
|
|
5
|
+
import { boardPublisher, loadCdxBoard, loadFullCdxHistory, loadSovrBoard } from "./client";
|
|
6
6
|
|
|
7
7
|
/** The five on-the-run 5Y index contracts the CDX tab lists; IG and iTraxx quote spread, HY and EM price. */
|
|
8
8
|
const INDEXES = [
|
|
@@ -24,6 +24,14 @@ const SOVEREIGNS: ReadonlyArray<readonly [code: string, name: string]> = [
|
|
|
24
24
|
["DO", "Dominican Republic"], ["CI", "Ivory Coast"],
|
|
25
25
|
];
|
|
26
26
|
|
|
27
|
+
/** Every board's levels are DTCC's public trades, as the CDX and SOVR tabs cite them. */
|
|
28
|
+
const BOARD_SOURCE = "DTCC";
|
|
29
|
+
|
|
30
|
+
/** What a chart of a board's series cites: DTCC, and the publisher the board names (`DTCC Public Price Dissemination`). */
|
|
31
|
+
function boardAttribution(source: string | null | undefined): Pick<SeriesLoadResult, "attribution"> {
|
|
32
|
+
return { attribution: { source: BOARD_SOURCE, publisher: boardPublisher(source) ?? BOARD_SOURCE } };
|
|
33
|
+
}
|
|
34
|
+
|
|
27
35
|
function boardPoints(
|
|
28
36
|
rows: ReadonlyArray<{ id: string; points: readonly CreditBoardPoint[] }>,
|
|
29
37
|
id: string,
|
|
@@ -51,15 +59,15 @@ const BOARD_YEAR_ONLY = "The full history did not load; showing the last year.";
|
|
|
51
59
|
* every day the server keeps when the chart starts before it (ALL, 5Y).
|
|
52
60
|
* When that read fails the board's year stands in, said with `warning`.
|
|
53
61
|
*/
|
|
54
|
-
async function cdxIndexes(request: SeriesLoadRequest): Promise<{ indexes: readonly CdxBoardIndex[]; resource: CdxSeriesResource; warning?: string }> {
|
|
62
|
+
async function cdxIndexes(request: SeriesLoadRequest): Promise<{ indexes: readonly CdxBoardIndex[]; source: string; resource: CdxSeriesResource; warning?: string }> {
|
|
55
63
|
const resource = await loadCdxBoard();
|
|
56
64
|
const first = Math.min(...resource.payload.indexes.flatMap((index) => index.points.slice(0, 1).map((point) => Date.parse(`${point.date}T00:00:00Z`))));
|
|
57
65
|
if (!request.start || request.start.getTime() < first - BOARD_SLACK_MS) {
|
|
58
66
|
const full = await loadFullCdxHistory().catch(logFailure("credit-boards", "Read the full index CDS history failed", null));
|
|
59
|
-
if (full) return { indexes: full.indexes, resource: {} };
|
|
60
|
-
return { indexes: resource.payload.indexes, resource, warning: BOARD_YEAR_ONLY };
|
|
67
|
+
if (full) return { indexes: full.indexes, source: full.source, resource: {} };
|
|
68
|
+
return { indexes: resource.payload.indexes, source: resource.payload.source, resource, warning: BOARD_YEAR_ONLY };
|
|
61
69
|
}
|
|
62
|
-
return { indexes: resource.payload.indexes, resource };
|
|
70
|
+
return { indexes: resource.payload.indexes, source: resource.payload.source, resource };
|
|
63
71
|
}
|
|
64
72
|
|
|
65
73
|
/** A CDX series' note: the board's own, or, when it stood in for the full history, that. */
|
|
@@ -88,10 +96,11 @@ export const CREDIT_BOARD_SERIES: readonly SeriesDefinition[] = [
|
|
|
88
96
|
unit: index.quote === "spread" ? "bp" : "points",
|
|
89
97
|
frequency: "daily",
|
|
90
98
|
group: "Credit",
|
|
99
|
+
publisher: BOARD_SOURCE,
|
|
91
100
|
tags: ["CDS", "index CDS", index.quote, "credit default swap"],
|
|
92
101
|
load: async (request) => {
|
|
93
102
|
const read = await cdxIndexes(request);
|
|
94
|
-
return { ...boardPoints(read.indexes, index.code, index.name, read.resource), ...cdxSeriesNote(read) };
|
|
103
|
+
return { ...boardPoints(read.indexes, index.code, index.name, read.resource), ...cdxSeriesNote(read), ...boardAttribution(read.source) };
|
|
95
104
|
},
|
|
96
105
|
})),
|
|
97
106
|
...INDEXES.filter((index) => index.quote === "price").map((index): SeriesDefinition => ({
|
|
@@ -100,11 +109,12 @@ export const CREDIT_BOARD_SERIES: readonly SeriesDefinition[] = [
|
|
|
100
109
|
unit: "bp",
|
|
101
110
|
frequency: "daily",
|
|
102
111
|
group: "Credit",
|
|
112
|
+
publisher: BOARD_SOURCE,
|
|
103
113
|
tags: ["CDS", "index CDS", "spread", "spread equivalent", index.code, "credit default swap"],
|
|
104
114
|
description: `${index.name}'s daily price as a conventional spread: a model figure from the ISDA standard model at the index's coupon and standard recovery, on each day's on-the-run contract, not a traded spread.`,
|
|
105
115
|
load: async (request) => {
|
|
106
116
|
const read = await cdxIndexes(request);
|
|
107
|
-
return { points: spreadEquivalentPoints(read.indexes, index.code, `${index.name} spread eq`), ...cdxSeriesNote(read) };
|
|
117
|
+
return { points: spreadEquivalentPoints(read.indexes, index.code, `${index.name} spread eq`), ...cdxSeriesNote(read), ...boardAttribution(read.source) };
|
|
108
118
|
},
|
|
109
119
|
})),
|
|
110
120
|
...SOVEREIGNS.map(([code, name]): SeriesDefinition => ({
|
|
@@ -113,10 +123,11 @@ export const CREDIT_BOARD_SERIES: readonly SeriesDefinition[] = [
|
|
|
113
123
|
unit: "bp",
|
|
114
124
|
frequency: "daily",
|
|
115
125
|
group: "Credit",
|
|
126
|
+
publisher: BOARD_SOURCE,
|
|
116
127
|
tags: ["CDS", "sovereign", code, "credit default swap"],
|
|
117
128
|
load: async () => {
|
|
118
129
|
const resource = await loadSovrBoard();
|
|
119
|
-
return boardPoints(resource.payload.sovereigns, code, name, resource);
|
|
130
|
+
return { ...boardPoints(resource.payload.sovereigns, code, name, resource), ...boardAttribution(resource.payload.source) };
|
|
120
131
|
},
|
|
121
132
|
})),
|
|
122
133
|
];
|
|
@@ -23,7 +23,9 @@ import { formatPercentileRank } from "../../../utils/format";
|
|
|
23
23
|
import { useAssetData, usePluginPaneState } from "../../runtime";
|
|
24
24
|
import { FIXED_INCOME_PANE_ID } from "../fixed-income/model";
|
|
25
25
|
import { useCommandValue } from "../shared/command-tab";
|
|
26
|
+
import { reportFooterSegment } from "../shared/source-footer";
|
|
26
27
|
import { getCachedSovrBoard, loadCurrencyMoves, loadSovrBoard } from "./client";
|
|
28
|
+
import { sovrHeadless } from "./headless";
|
|
27
29
|
import { readsInBatches } from "../../../market-data/batched-reads";
|
|
28
30
|
import {
|
|
29
31
|
findSovereign,
|
|
@@ -31,7 +33,6 @@ import {
|
|
|
31
33
|
formatCurrencyMove,
|
|
32
34
|
formatLevel,
|
|
33
35
|
formatMove,
|
|
34
|
-
newestRowDate,
|
|
35
36
|
SETTLEMENT_TEXT,
|
|
36
37
|
sovrRows,
|
|
37
38
|
type SovrRow,
|
|
@@ -115,13 +116,16 @@ export function SovrPane({ focused, width, height }: PaneProps) {
|
|
|
115
116
|
moves.reload();
|
|
116
117
|
}, { focused, enabled: !loading });
|
|
117
118
|
|
|
118
|
-
//
|
|
119
|
-
|
|
119
|
+
// Its source and the newest day the rows carry, not when the response was put together, as `fn SOVR` ends.
|
|
120
|
+
// The clock says the prints are delayed, so the line does not again.
|
|
121
|
+
const sourceLine = useMemo(() => payload
|
|
122
|
+
? reportFooterSegment(sovrHeadless, { rows: payload.sovereigns.map((sovereign) => ({ date: sovereign.date })) }, { feed: false })
|
|
123
|
+
: null, [payload]);
|
|
120
124
|
const info = useMemo<PaneFooterSegment[]>(() => [
|
|
121
|
-
...(
|
|
125
|
+
...(sourceLine ? [sourceLine] : []),
|
|
122
126
|
...(payload ? [DELAYED_SEGMENT] : []),
|
|
123
127
|
...(resource.data?.stale ? [{ id: "stale", parts: [{ text: "STALE", tone: "warning" as const }] }] : []),
|
|
124
|
-
], [
|
|
128
|
+
], [payload, sourceLine, resource.data?.stale]);
|
|
125
129
|
usePaneStatusFooter({
|
|
126
130
|
registrationId: "sovr",
|
|
127
131
|
loading: loading || moves.loading,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CryptoEtfFlowsPayload } from "../../../api-client/crypto-etf-flows";
|
|
2
|
-
import type { HeadlessPaneColumn } from "../../../types/headless";
|
|
2
|
+
import type { HeadlessPaneColumn, HeadlessPaneFreshness } from "../../../types/headless";
|
|
3
3
|
import type { HeadlessPaneDefinition } from "../../../types/plugin";
|
|
4
4
|
import { REPORT_ROWS } from "../shared/headless-options";
|
|
5
5
|
import { readPriceWindow, type PriceWindow } from "../../../utils/price-window";
|
|
@@ -67,6 +67,27 @@ function fundsLine(payload: CryptoEtfFlowsPayload): string | null {
|
|
|
67
67
|
return named.length ? `Funds: ${named.join(", ")}.` : null;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
/**
|
|
71
|
+
* What dates the flows, as `fn ETFF` ends and the pane's footer says it: the
|
|
72
|
+
* publisher, the day (`asOf`, the newest unless a window ends before it) and
|
|
73
|
+
* when the server last read the publisher's table. `daily` says a missing
|
|
74
|
+
* trading day makes them stale.
|
|
75
|
+
*/
|
|
76
|
+
export function cryptoEtfFlowFreshness(payload: CryptoEtfFlowsPayload, asOf: string | null, daily = true): HeadlessPaneFreshness {
|
|
77
|
+
return {
|
|
78
|
+
source: payload.source.publisher,
|
|
79
|
+
publisher: payload.source.publisher,
|
|
80
|
+
status: "not-a-feed",
|
|
81
|
+
basis: "daily fund flows",
|
|
82
|
+
...(daily ? { cadence: "daily" as const } : {}),
|
|
83
|
+
tradingDayMarket: "US",
|
|
84
|
+
...(asOf ? { asOf } : {}),
|
|
85
|
+
oldest: null,
|
|
86
|
+
// When the server last read the publisher's table, which is what this report retrieved.
|
|
87
|
+
retrievedAt: payload.fetchedAt,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
70
91
|
export const cryptoEtfFlowsHeadless: HeadlessPaneDefinition<"rows"> = {
|
|
71
92
|
shape: "rows",
|
|
72
93
|
argument: { kind: "none" },
|
|
@@ -153,18 +174,7 @@ export const cryptoEtfFlowsHeadless: HeadlessPaneDefinition<"rows"> = {
|
|
|
153
174
|
notes: [window ? windowSummaryLine(payload, window, days) : summaryLine(payload), ...funds ? [funds] : [], `Source: ${payload.source.publisher}, ${payload.source.url}`],
|
|
154
175
|
complete: !payload.stale,
|
|
155
176
|
...(payload.stale ? { warnings: [`The flows were last read ${payload.fetchedAt.slice(0, 10)}; newer days may be missing.`] } : {}),
|
|
156
|
-
freshness:
|
|
157
|
-
source: payload.source.publisher,
|
|
158
|
-
publisher: payload.source.publisher,
|
|
159
|
-
status: "not-a-feed",
|
|
160
|
-
basis: "daily fund flows",
|
|
161
|
-
...(window && asOf !== payload.asOf ? {} : { cadence: "daily" as const }),
|
|
162
|
-
tradingDayMarket: "US",
|
|
163
|
-
...(asOf ? { asOf } : {}),
|
|
164
|
-
oldest: null,
|
|
165
|
-
// When the server last read the publisher's table, which is what this report retrieved.
|
|
166
|
-
retrievedAt: payload.fetchedAt,
|
|
167
|
-
},
|
|
177
|
+
freshness: cryptoEtfFlowFreshness(payload, asOf, !(window && asOf !== payload.asOf)),
|
|
168
178
|
metadata: {
|
|
169
179
|
asset,
|
|
170
180
|
unit: payload.unit,
|
|
@@ -18,11 +18,14 @@ import { useChartViewReset } from "../../../components/chart/core/view-reset";
|
|
|
18
18
|
import { scalarPoint, staticSeries } from "../../../components/chart/static/series";
|
|
19
19
|
import { handleRefreshKey, usePaneRefreshKey } from "../../../components/data-table/table-pane";
|
|
20
20
|
import { useAsyncResource, useAutoRefresh, usePaneSettingValue, usePluginPaneState, useUpdatedAgo } from "../../../public/react";
|
|
21
|
+
import { useUtcDay } from "../../../react/auto-refresh";
|
|
21
22
|
import { colors } from "../../../theme/colors";
|
|
22
23
|
import type { PaneProps } from "../../../types/plugin";
|
|
23
24
|
import { Box } from "../../../ui";
|
|
24
25
|
import { isPlainKeyboardEvent } from "../../../utils/keyboard";
|
|
25
26
|
import { cachedCryptoEtfFlows, loadCryptoEtfFlows } from "./client";
|
|
27
|
+
import { cryptoEtfFlowFreshness, cryptoEtfFlowsHeadless } from "./headless";
|
|
28
|
+
import { reportFooterSegment } from "../shared/source-footer";
|
|
26
29
|
import {
|
|
27
30
|
CRYPTO_ETF_FLOW_ASSETS,
|
|
28
31
|
CRYPTO_ETF_FLOW_RANGES,
|
|
@@ -103,16 +106,18 @@ export function CryptoEtfFlowsPane({ focused, width, height }: PaneProps) {
|
|
|
103
106
|
] : [];
|
|
104
107
|
|
|
105
108
|
const updatedAgo = useUpdatedAgo(resource.updatedAt);
|
|
109
|
+
const utcDay = useUtcDay();
|
|
110
|
+
// The publisher and the flows' day, as `fn ETFF` ends; how long ago it loaded goes first on a narrow row.
|
|
106
111
|
const footerInfo = useMemo(() => data ? [
|
|
107
|
-
{
|
|
112
|
+
reportFooterSegment(cryptoEtfFlowsHeadless, { rows: [], freshness: cryptoEtfFlowFreshness(data, data.asOf) }),
|
|
108
113
|
...(updatedAgo ? [ageFooterSegment(updatedAgo)] : []),
|
|
109
|
-
] : [], [data, updatedAgo]);
|
|
114
|
+
] : [], [data, updatedAgo, utcDay]);
|
|
110
115
|
useAutoRefresh(resource.updatedAt, resource.load);
|
|
111
116
|
const refresh = useCallback(() => resource.reload(), [resource.reload]);
|
|
112
117
|
usePaneRefreshKey(refresh, { focused });
|
|
113
118
|
usePaneStatusLinkFooter({
|
|
114
119
|
registrationId: CRYPTO_ETF_FLOWS_PANE_ID, focused, loading: resource.loading, error: data ? null : resource.error,
|
|
115
|
-
url: data?.source.url ?? null,
|
|
120
|
+
url: data?.source.url ?? null, showOpenHint: true,
|
|
116
121
|
info: footerInfo, stale: !!data && (data.stale || !!current?.stale),
|
|
117
122
|
});
|
|
118
123
|
usePaneNoticeFooter({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DebtMaturitiesPayload } from "../../../api-client/debt-maturities";
|
|
2
|
-
import type { HeadlessBundleSection } from "../../../types/headless";
|
|
2
|
+
import type { HeadlessBundleSection, HeadlessPaneFreshness } from "../../../types/headless";
|
|
3
3
|
import type { HeadlessPaneDefinition } from "../../../types/plugin";
|
|
4
4
|
import { fetchDebtMaturities } from "./client";
|
|
5
5
|
import {
|
|
@@ -79,6 +79,19 @@ function bandSections(data: DebtMaturitiesPayload, latest: DebtLatest): Headless
|
|
|
79
79
|
];
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
/** What dates a DDIS report, as `fn DDIS` ends and the pane's footer says it. */
|
|
83
|
+
export function debtReportFreshness(data: DebtMaturitiesPayload): HeadlessPaneFreshness {
|
|
84
|
+
const latest = data.latest;
|
|
85
|
+
if (latest && debtBands(latest)) {
|
|
86
|
+
// Dated by the report's balance sheet: an SEC filing named by its form, a report outside SEC cited
|
|
87
|
+
// as the server names it (its form, HKEX or CNINFO, would repeat that name).
|
|
88
|
+
return data.cik ? { asOf: latest.asOf, asOfLabel: latest.form } : { asOf: latest.asOf, source: data.source.name };
|
|
89
|
+
}
|
|
90
|
+
// The latest filing dates the report (a newer 10-Q's balance date), named by its form so the date is
|
|
91
|
+
// not read as the schedule's; the history rows are past years, not stale data.
|
|
92
|
+
return { asOf: debtNewestAsOf(data), asOfLabel: debtNewestForm(data) ?? undefined };
|
|
93
|
+
}
|
|
94
|
+
|
|
82
95
|
export const debtMaturitiesHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
83
96
|
shape: "bundle",
|
|
84
97
|
freshness: SEC_FILINGS,
|
|
@@ -125,9 +138,7 @@ export const debtMaturitiesHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
125
138
|
...(data.notes?.length ? { notes: data.notes } : {}),
|
|
126
139
|
sections: bandSections(data, latest),
|
|
127
140
|
metadata: { ...data },
|
|
128
|
-
|
|
129
|
-
// as the server names it (its form, HKEX or CNINFO, would repeat that name).
|
|
130
|
-
freshness: data.cik ? { asOf: latest.asOf, asOfLabel: latest.form } : { asOf: latest.asOf, source: data.source.name },
|
|
141
|
+
freshness: debtReportFreshness(data),
|
|
131
142
|
};
|
|
132
143
|
}
|
|
133
144
|
const quarter = newerQuarter(data);
|
|
@@ -212,9 +223,7 @@ export const debtMaturitiesHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
212
223
|
],
|
|
213
224
|
...(costNote || data.notes?.length ? { notes: [...(data.notes ?? []), ...(costNote ? [costNote] : [])] } : {}),
|
|
214
225
|
metadata: { ...data },
|
|
215
|
-
|
|
216
|
-
// not read as the schedule's; the history rows are past years, not stale data.
|
|
217
|
-
freshness: { asOf: debtNewestAsOf(data), asOfLabel: debtNewestForm(data) ?? undefined },
|
|
226
|
+
freshness: debtReportFreshness(data),
|
|
218
227
|
};
|
|
219
228
|
},
|
|
220
229
|
};
|
|
@@ -107,15 +107,17 @@ export function maturityRows(latest: DebtLatest): MaturityRow[] {
|
|
|
107
107
|
}
|
|
108
108
|
/**
|
|
109
109
|
* The wall's scale: the largest dated bucket. Thereafter is open ended and
|
|
110
|
-
* usually dwarfs every dated year, so scaling to it would flatten them.
|
|
110
|
+
* usually dwarfs every dated year, so scaling to it would flatten them. A
|
|
111
|
+
* ladder of exactly two bands in its filing's own terms (a balance sheet's
|
|
112
|
+
* within one year and after it) has no years to flatten: both share the
|
|
113
|
+
* larger, so 528M within the year never reads as long as 1.76B after it. A
|
|
114
|
+
* schedule by year keeps its dated scale however few of its years have a
|
|
115
|
+
* value, and its Thereafter stays capped.
|
|
111
116
|
*/
|
|
112
117
|
export function datedBucketScale(latest: DebtLatest): number {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
row.dated && row.value !== null ? [row.value] : [],
|
|
117
|
-
),
|
|
118
|
-
);
|
|
118
|
+
const rows = maturityRows(latest);
|
|
119
|
+
const scaled = debtBands(latest)?.length === 2 ? rows : rows.filter((row) => row.dated);
|
|
120
|
+
return Math.max(0, ...scaled.flatMap((row) => row.value === null ? [] : [row.value]));
|
|
119
121
|
}
|
|
120
122
|
export interface BucketBar {
|
|
121
123
|
/** Share of the bar column, 0 to 1. */
|
|
@@ -381,14 +383,6 @@ export function debtNewestAsOf(data: DebtMaturitiesPayload): string | null {
|
|
|
381
383
|
export function debtNewestForm(data: DebtMaturitiesPayload): string | null {
|
|
382
384
|
return newestDebtFiling(data)?.form ?? null;
|
|
383
385
|
}
|
|
384
|
-
/**
|
|
385
|
-
* Which filing the pane's date is, as its footer says it, longest first:
|
|
386
|
-
* `10-Q 2026-09-30, filed 2026-10-27`, then `10-Q 2026-09-30`.
|
|
387
|
-
*/
|
|
388
|
-
export function debtNewestFilingText(data: DebtMaturitiesPayload): string[] {
|
|
389
|
-
const filing = newestDebtFiling(data);
|
|
390
|
-
return filing ? [`${filing.form} ${filing.asOf}, filed ${filing.filed}`, `${filing.form} ${filing.asOf}`] : [];
|
|
391
|
-
}
|
|
392
386
|
/** The 10-Q's debt in one line, `Current 212.00M · Non-current 6.84B USD`. */
|
|
393
387
|
export function quarterDebtText(quarter: DebtQuarter): string {
|
|
394
388
|
return `Current ${debtAmount(quarter.current?.value ?? null)} · Non-current ${debtAmount(quarter.noncurrent?.value ?? null)} ${quarter.currency}`;
|
|
@@ -45,6 +45,9 @@ import {
|
|
|
45
45
|
useResearchCloudSession,
|
|
46
46
|
} from "../shared/research-cloud-session";
|
|
47
47
|
import { cachedDebtMaturities, loadDebtMaturities } from "./client";
|
|
48
|
+
import { debtMaturitiesHeadless, debtReportFreshness } from "./headless";
|
|
49
|
+
import { reportFooterSegment } from "../shared/source-footer";
|
|
50
|
+
import { useUtcDay } from "../../../react/auto-refresh";
|
|
48
51
|
import {
|
|
49
52
|
HISTORY_COLUMNS,
|
|
50
53
|
bandScaleText,
|
|
@@ -61,7 +64,6 @@ import {
|
|
|
61
64
|
debtFilingUrl,
|
|
62
65
|
debtMetricCaption,
|
|
63
66
|
debtMetricValue,
|
|
64
|
-
debtNewestFilingText,
|
|
65
67
|
debtNotices,
|
|
66
68
|
debtPercent,
|
|
67
69
|
historyAxis,
|
|
@@ -607,15 +609,12 @@ export function DebtMaturitiesPane({ width, height, focused }: PaneProps) {
|
|
|
607
609
|
label: "Principal total", values, value: debtAmount(last), color: colors.warning,
|
|
608
610
|
};
|
|
609
611
|
}, [bars]);
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
...(data && updatedAgo ? [ageFooterSegment(updatedAgo)] : []),
|
|
617
|
-
];
|
|
618
|
-
}, [data, updatedAgo]);
|
|
612
|
+
const utcDay = useUtcDay();
|
|
613
|
+
// Its source and which filing dates it, as `fn DDIS` ends, then how long ago it loaded: the age goes first in a narrow footer.
|
|
614
|
+
const filingFooter = useMemo(() => data ? [
|
|
615
|
+
reportFooterSegment(debtMaturitiesHeadless, { sections: [], freshness: debtReportFreshness(data) }),
|
|
616
|
+
...(updatedAgo ? [ageFooterSegment(updatedAgo)] : []),
|
|
617
|
+
] : [], [data, updatedAgo, utcDay]);
|
|
619
618
|
useAutoRefresh(resource.updatedAt, resource.load);
|
|
620
619
|
usePaneRefreshKey(() => resource.reload(), { focused });
|
|
621
620
|
usePaneNoticeFooter({
|
|
@@ -7,7 +7,8 @@ import type { TickerRecord } from "../../../types/ticker";
|
|
|
7
7
|
import { earningsDateStatus, earningsEpsBasis, isProvisionalActual } from "../shared/earnings-report";
|
|
8
8
|
import { calendarReport } from "../shared/earnings-calendar";
|
|
9
9
|
import { listingSuffixCandidate } from "../../../sources/listing-symbols";
|
|
10
|
-
import { isUsListingExchange } from "../../../utils/exchanges";
|
|
10
|
+
import { isUsListingExchange, parsePublicTickerKey } from "../../../utils/exchanges";
|
|
11
|
+
import { listingAbroadVenue } from "../../../utils/sec";
|
|
11
12
|
import { sameHistoryListing } from "./client";
|
|
12
13
|
import { shortDate, surprise, weekday } from "./format";
|
|
13
14
|
|
|
@@ -162,10 +163,38 @@ export function boardReport(report: EarningsCalendarReport, owned: ReadonlyMap<s
|
|
|
162
163
|
};
|
|
163
164
|
}
|
|
164
165
|
|
|
165
|
-
/**
|
|
166
|
+
/**
|
|
167
|
+
* A listing as the board and Gloom Cloud's earnings history key it, however it
|
|
168
|
+
* was typed: a vendor's suffix as the venue it names (0700.HK, 700.HK and
|
|
169
|
+
* 00700.HK are 0700:HKEX, VOD.L is VOD:LSE), a venue by its own code
|
|
170
|
+
* (0700:XHKG is 0700:HKEX), a Hong Kong code by its four digits, and a US
|
|
171
|
+
* listing by its ticker (AAPL:NASDAQ is AAPL). Any other key stays as typed.
|
|
172
|
+
*/
|
|
166
173
|
export function boardKey(symbol: string): string {
|
|
167
|
-
const
|
|
168
|
-
|
|
174
|
+
const typed = symbol.trim().toUpperCase();
|
|
175
|
+
const suffixed = listingSuffixCandidate(typed);
|
|
176
|
+
const key = suffixed ? `${suffixed.symbol}:${suffixed.exchange}` : typed;
|
|
177
|
+
const parsed = parsePublicTickerKey(key);
|
|
178
|
+
if (parsed.exchange && isUsListingExchange(parsed.exchange)) return parsed.symbol;
|
|
179
|
+
const venue = listingAbroadVenue(key);
|
|
180
|
+
if (!venue) return key;
|
|
181
|
+
const code = venue === "HKEX" && /^\d{1,5}$/.test(parsed.symbol) && Number(parsed.symbol) > 0
|
|
182
|
+
? String(Number(parsed.symbol)).padStart(4, "0") : parsed.symbol;
|
|
183
|
+
return `${code}:${venue}`;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* How ERN reads a symbol's past reports: by its listing's key, however it was
|
|
188
|
+
* typed (`boardKey`: 0700.HK is 0700:HKEX). A US listing's are the US
|
|
189
|
+
* board's, where SAN is not SAN:EPA's company; a Hong Kong listing has its
|
|
190
|
+
* own (`ownAbroad`), which Gloom Cloud reads from its results announcements,
|
|
191
|
+
* in their currency. Any other listing abroad has none (`abroad`) and shows
|
|
192
|
+
* its next report.
|
|
193
|
+
*/
|
|
194
|
+
export function historyListing(symbol: string): { listing: string; abroad: boolean; ownAbroad: boolean } {
|
|
195
|
+
const listing = boardKey(symbol);
|
|
196
|
+
const venue = listingAbroadVenue(listing);
|
|
197
|
+
return { listing, abroad: venue != null && venue !== "HKEX", ownAbroad: venue === "HKEX" };
|
|
169
198
|
}
|
|
170
199
|
|
|
171
200
|
/**
|