@gloom-sh/terminal 0.20.10 → 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/patches/@opentui%2Fcore@0.3.2.patch +16 -0
- 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 +366 -0
- package/src/api-client/socket-features.ts +75 -0
- package/src/api-client/socket-frames.ts +161 -0
- package/src/api-client/socket-listeners.ts +207 -0
- package/src/api-client/socket-quotes.ts +332 -0
- package/src/api-client/socket.ts +168 -983
- 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/brokers/signed-in/adapter.ts +19 -5
- package/src/brokers/signed-in/client.ts +13 -1
- package/src/brokers/signed-in/sign-in-dialog.tsx +33 -9
- 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/chart/native/kitty/manager.ts +2 -0
- package/src/components/chart/native/surface/manager.ts +211 -11
- package/src/components/command-bar/action-runtime.ts +2 -0
- package/src/components/command-bar/panel/index.tsx +2 -13
- package/src/components/command-bar/panel/layout.ts +1 -7
- package/src/components/command-bar/panel/runtime.ts +0 -1
- package/src/components/command-bar/panel/types.ts +0 -2
- 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/data-table/column-menu.tsx +89 -0
- package/src/components/data-table/sort-menu.tsx +9 -2
- package/src/components/data-table/view.tsx +33 -6
- package/src/components/form-modal/content.tsx +10 -0
- package/src/components/index.ts +1 -1
- 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/footer/index.tsx +25 -11
- package/src/components/layout/pane/footer/model.ts +62 -20
- package/src/components/layout/pane/header.tsx +140 -31
- package/src/components/layout/pane/sidebar.tsx +138 -20
- package/src/components/layout/pane/status-footer.ts +3 -1
- package/src/components/layout/shell/active-drag.ts +18 -13
- package/src/components/layout/shell/drag/magnets.ts +34 -18
- 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/ticker/list-table-view.tsx +5 -0
- package/src/components/ui/button.tsx +48 -4
- package/src/components/ui/data-table/column-order.ts +180 -0
- package/src/components/ui/data-table/index.tsx +12 -1
- package/src/components/ui/data-table/opentui/index.tsx +291 -32
- package/src/components/ui/data-table/opentui/model.ts +43 -4
- package/src/components/ui/data-table/types.ts +56 -0
- package/src/components/ui/data-table/use-column-order.ts +135 -0
- package/src/components/ui/index.ts +1 -1
- 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/components/ui/table-layout.ts +120 -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/docs/snapshot.json +3 -2
- package/src/i18n/es.ts +2 -0
- package/src/i18n/ja.ts +2 -0
- package/src/i18n/ko.ts +2 -0
- package/src/i18n/zh-cn.ts +2 -0
- package/src/i18n/zh-tw.ts +2 -0
- package/src/layout/pane-manager/dock-tree.ts +19 -0
- package/src/layout/pane-manager/index.ts +3 -0
- package/src/market-data/coordinator/index.ts +4 -3
- package/src/market-data/coordinator/quotes.ts +12 -4
- 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 +31 -0
- package/src/market-data/quotes/live-valuation.ts +32 -5
- package/src/market-data/quotes/regular-session-valuation.ts +1 -1
- 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/detail.tsx +5 -3
- package/src/plugins/builtin/broker-manager/index.tsx +7 -6
- package/src/plugins/builtin/broker-manager/model.ts +15 -6
- package/src/plugins/builtin/broker-manager/pane-actions.tsx +11 -4
- package/src/plugins/builtin/broker-manager/sign-in-end.ts +50 -19
- package/src/plugins/builtin/broker-manager/table.ts +10 -4
- 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 +35 -19
- package/src/plugins/builtin/cloud/askg/pane.tsx +4 -0
- package/src/plugins/builtin/cloud/askg/tool-timeline.tsx +2 -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/equity-screener/live.ts +74 -18
- package/src/plugins/builtin/equity-screener/model.ts +19 -4
- package/src/plugins/builtin/equity-screener/pane.tsx +19 -14
- package/src/plugins/builtin/equity-screener/refresh-anchor.ts +45 -0
- package/src/plugins/builtin/equity-screener/results.ts +22 -2
- package/src/plugins/builtin/equity-screener/screen-check.ts +9 -3
- 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/futures/index.tsx +15 -1
- package/src/plugins/builtin/futures/table.tsx +1 -1
- package/src/plugins/builtin/fx-matrix/index.tsx +32 -19
- package/src/plugins/builtin/holders/pane.tsx +30 -20
- package/src/plugins/builtin/insider/table.tsx +10 -7
- package/src/plugins/builtin/insider/tickers.tsx +1 -1
- package/src/plugins/builtin/iv-history/events.ts +5 -0
- package/src/plugins/builtin/iv-history/headless.ts +15 -9
- package/src/plugins/builtin/jobs/index.tsx +1 -0
- package/src/plugins/builtin/kelly-sizer/sections.tsx +2 -0
- package/src/plugins/builtin/macro-day/headless.ts +15 -6
- 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 +3 -0
- package/src/plugins/builtin/options-positioning/pane.tsx +1 -1
- package/src/plugins/builtin/options-scenario/pane.tsx +2 -1
- package/src/plugins/builtin/perps/cascade-tabs.tsx +2 -1
- package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +4 -31
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +19 -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 +15 -1
- package/src/plugins/builtin/rate-path/pane.tsx +2 -0
- package/src/plugins/builtin/realized-vol/headless.ts +28 -2
- package/src/plugins/builtin/revenue-breakdown/pane.tsx +2 -0
- package/src/plugins/builtin/reverse-dcf/pane.tsx +2 -1
- package/src/plugins/builtin/risk-factors/index.tsx +1 -0
- package/src/plugins/builtin/seasonality/pane.tsx +2 -1
- 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/thirteenf/pane.tsx +2 -0
- package/src/plugins/builtin/ticker-detail/financials/model.ts +28 -6
- package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +26 -9
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +58 -35
- 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 +6 -3
- package/src/plugins/builtin/vol-surface/pane.tsx +7 -3
- package/src/plugins/builtin/world-indices/index.tsx +5 -1
- package/src/plugins/builtin/yield-curve/index.tsx +2 -1
- 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/data-table/column-drag.ts +147 -0
- package/src/renderers/dom/data-table/index.tsx +22 -0
- package/src/renderers/dom/data-table/row.tsx +27 -5
- 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 +47 -5
- package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +2 -1
- package/src/renderers/opentui/chart-surface.tsx +1 -0
- package/src/renderers/opentui/frame-hits.ts +33 -0
- package/src/renderers/opentui/host.tsx +2 -0
- package/src/renderers/opentui/native-surface.ts +14 -21
- package/src/renderers/opentui/test-utils.tsx +3 -0
- 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 +46 -1
- package/src/state/pane-unsent-work.ts +47 -0
- package/src/test-support/app-store.ts +24 -1
- 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/time-series/live-quotes.ts +3 -9
- 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 +24 -0
- package/src/ui/pointer-drag.ts +11 -2
- package/src/utils/double-escape-close.ts +42 -0
- package/src/utils/fundamentals.ts +14 -3
- package/src/utils/fx-status.ts +30 -7
- package/src/utils/network-failure.ts +23 -0
- package/src/utils/share-multiples.cases.json +780 -2
- package/src/utils/share-multiples.ts +154 -24
|
@@ -12,19 +12,21 @@ import { ageFooterSegment } from "../../../components/layout/pane/footer";
|
|
|
12
12
|
import { staticSeries } from "../../../components/chart/static/series";
|
|
13
13
|
import { usePaneRefreshKey } from "../../../components/data-table/table-pane";
|
|
14
14
|
import { useAsyncResource, useAutoRefresh, usePluginPaneState, useUpdatedAgo } from "../../../public/react";
|
|
15
|
+
import { useUtcDay } from "../../../react/auto-refresh";
|
|
16
|
+
import { reportFooterSegment } from "../shared/source-footer";
|
|
17
|
+
import { earningsCalendarHeadless } from "./headless";
|
|
15
18
|
import { colors } from "../../../theme/colors";
|
|
16
19
|
import { useLiveStreamingSetting } from "../../../state/hooks/live-streaming";
|
|
17
20
|
import { useAssetData } from "../../runtime";
|
|
18
21
|
import { isBoardRowLoading, useQuoteBoard } from "../shared/use-quote-board";
|
|
19
|
-
import { newYorkToday, reportMove } from "./board-model";
|
|
22
|
+
import { historyListing, newYorkToday, reportMove } from "./board-model";
|
|
20
23
|
import { usePlanAccess } from "../../../api-client/plan-access";
|
|
21
24
|
import { useResearchCloudSession } from "../shared/research-cloud-session";
|
|
22
|
-
import { cachedEarningsHistory,
|
|
25
|
+
import { cachedEarningsHistory, loadEarningsHistory, noHistoryAbroad } from "./client";
|
|
23
26
|
import { loadEarningsCalendar } from "./data/cache";
|
|
24
27
|
import { chartAxis, chartPoints, chartRows, historyFigures, historyRows, type HistoryRow } from "./history-model";
|
|
25
28
|
import { historyColumns, renderHistoryCell, type HistoryColumn, type LiveMove } from "./history-table";
|
|
26
29
|
import { loadNoEarningsText } from "./no-earnings";
|
|
27
|
-
import { listingAbroadVenue } from "../../../utils/sec";
|
|
28
30
|
|
|
29
31
|
const barDate = (row: HistoryRow) => (row.implied != null || row.move != null ? new Date(`${row.date}T00:00:00Z`) : null);
|
|
30
32
|
|
|
@@ -41,11 +43,9 @@ export function EarningsHistoryView({ symbol, width, height, focused, registrati
|
|
|
41
43
|
registrationId: string;
|
|
42
44
|
}) {
|
|
43
45
|
const dataProvider = useAssetData();
|
|
44
|
-
// Past reports are
|
|
45
|
-
//
|
|
46
|
-
const
|
|
47
|
-
const abroad = !hasEarningsHistory(venueAbroad);
|
|
48
|
-
const ownAbroad = venueAbroad != null && !abroad;
|
|
46
|
+
// Past reports are a US listing's and a Hong Kong listing's own, read by its key however it was typed (0700.HK is
|
|
47
|
+
// 0700:HKEX): any other listing abroad shows its next report alone.
|
|
48
|
+
const { listing, abroad, ownAbroad } = historyListing(symbol);
|
|
49
49
|
// A Hong Kong listing's announcement figures come with Pro, as KPIS has them: what Gloom Cloud answers differs by
|
|
50
50
|
// plan, so it is kept per session and plan.
|
|
51
51
|
const access = usePlanAccess();
|
|
@@ -53,11 +53,11 @@ export function EarningsHistoryView({ symbol, width, height, focused, registrati
|
|
|
53
53
|
const accessKey = ownAbroad ? `${session.requestKey}:${access.hasProAccess ? "pro" : "free"}` : undefined;
|
|
54
54
|
const loader = useCallback(
|
|
55
55
|
(force: boolean) => (abroad ? Promise.resolve(null)
|
|
56
|
-
: ownAbroad ? loadEarningsHistory(
|
|
57
|
-
: loadEarningsHistory(
|
|
58
|
-
[abroad, accessKey,
|
|
56
|
+
: ownAbroad ? loadEarningsHistory(listing, force, undefined, accessKey).catch(noHistoryAbroad)
|
|
57
|
+
: loadEarningsHistory(listing, force)),
|
|
58
|
+
[abroad, accessKey, listing, ownAbroad],
|
|
59
59
|
);
|
|
60
|
-
const resource = useAsyncResource(loader, { initialData: () => (abroad ? null : cachedEarningsHistory(
|
|
60
|
+
const resource = useAsyncResource(loader, { initialData: () => (abroad ? null : cachedEarningsHistory(listing, accessKey)) });
|
|
61
61
|
// Past the stored calendar's horizon, and for listings it does not carry, the per-ticker calendar has the next date.
|
|
62
62
|
const upcomingLoader = useCallback(
|
|
63
63
|
(force: boolean) => loadEarningsCalendar(dataProvider, [symbol], { force }).then((result) => result.events[0] ?? null),
|
|
@@ -115,6 +115,14 @@ export function EarningsHistoryView({ symbol, width, height, focused, registrati
|
|
|
115
115
|
// A coin's history fails (it is no US ticker), which says nothing once its type has answered.
|
|
116
116
|
const historyError = noEarnings.loading || noEarnings.data ? null : resource.error;
|
|
117
117
|
const updatedAgo = useUpdatedAgo(resource.updatedAt);
|
|
118
|
+
const utcDay = useUtcDay();
|
|
119
|
+
// Its source and when the history was read, as `fn ERN` ends; how long ago it loaded goes first on a narrow row.
|
|
120
|
+
const footerInfo = useMemo(() => abroad
|
|
121
|
+
? [{ id: "us-listings", parts: [{ text: "past reports: US and Hong Kong listings only", tone: "muted" as const }] }]
|
|
122
|
+
: payload ? [
|
|
123
|
+
reportFooterSegment(earningsCalendarHeadless, { rows: [], metadata: { asOf: payload.asOf } }),
|
|
124
|
+
...(updatedAgo ? [ageFooterSegment(updatedAgo)] : []),
|
|
125
|
+
] : [], [abroad, payload, updatedAgo, utcDay]);
|
|
118
126
|
useAutoRefresh(resource.updatedAt, resource.load);
|
|
119
127
|
usePaneRefreshKey(() => { resource.reload(); upcoming.reload(); }, { focused });
|
|
120
128
|
usePaneStatusFooter({
|
|
@@ -122,8 +130,7 @@ export function EarningsHistoryView({ symbol, width, height, focused, registrati
|
|
|
122
130
|
loading: resource.loading,
|
|
123
131
|
error: historyError,
|
|
124
132
|
stale: !!resource.data?.stale,
|
|
125
|
-
info:
|
|
126
|
-
: payload && updatedAgo ? [ageFooterSegment(updatedAgo)] : [],
|
|
133
|
+
info: footerInfo,
|
|
127
134
|
});
|
|
128
135
|
|
|
129
136
|
return (
|
|
@@ -53,7 +53,11 @@ export interface EarningsCallsResult {
|
|
|
53
53
|
errorStatus?: number;
|
|
54
54
|
/** The server has just started looking for this company's calls. */
|
|
55
55
|
pending?: boolean;
|
|
56
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* The symbol is not one the SEC knows, so there is nothing to look for. Never
|
|
58
|
+
* set for a listing abroad, which the server answers by its stored calls:
|
|
59
|
+
* C38U:SGX with none yet is a company whose calls are not yet available.
|
|
60
|
+
*/
|
|
57
61
|
unknownTicker?: boolean;
|
|
58
62
|
/** The company's home line the calls are read from, when not the listing asked. */
|
|
59
63
|
companyFrom?: CompanyFrom | null;
|
|
@@ -172,16 +176,32 @@ function listKey(ticker: string | null, abroad: ListingAbroad | null, limit: num
|
|
|
172
176
|
return offset > 0 ? JSON.stringify([identity, limit, offset]) : JSON.stringify([identity, limit]);
|
|
173
177
|
}
|
|
174
178
|
|
|
179
|
+
/** A listing code without the zeros a venue pads it with: 0016 and 16 are one Hong Kong listing. */
|
|
180
|
+
const listingCode = (symbol: string) => symbol.trim().toUpperCase().replace(/^0+(?=\d)/, "");
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* A call filed under the listing's own key (0016:HKEX) is the listing's,
|
|
184
|
+
* whatever short name the exchange gives the company there: "SHK PPT" is Sun
|
|
185
|
+
* Hung Kai Properties, "HKEX" Hong Kong Exchanges and Clearing.
|
|
186
|
+
*/
|
|
187
|
+
function filedUnderListing(call: CloudEarningsCallPayload, abroad: ListingAbroad): boolean {
|
|
188
|
+
const separator = call.ticker.lastIndexOf(":");
|
|
189
|
+
if (separator < 0) return false;
|
|
190
|
+
return listingCode(call.ticker.slice(0, separator)) === listingCode(abroad.symbol)
|
|
191
|
+
&& call.ticker.slice(separator + 1).trim().toUpperCase() === abroad.exchange.toUpperCase();
|
|
192
|
+
}
|
|
193
|
+
|
|
175
194
|
/**
|
|
176
195
|
* A server that predates venue-aware lookups ignores the venue and lists the
|
|
177
196
|
* calls of the US company with the same symbol: AI in Paris would show C3.ai.
|
|
178
197
|
* Those calls are another company's, so they are dropped, and without the
|
|
179
|
-
* listing's company they cannot be told apart.
|
|
198
|
+
* listing's company they cannot be told apart. A call filed under the
|
|
199
|
+
* listing's own key is never such a call.
|
|
180
200
|
*/
|
|
181
201
|
function listingCalls(calls: CloudEarningsCallPayload[], abroad: ListingAbroad | null): CloudEarningsCallPayload[] {
|
|
182
202
|
if (!abroad) return calls;
|
|
183
203
|
const name = abroad.name;
|
|
184
|
-
return
|
|
204
|
+
return calls.filter((call) => filedUnderListing(call, abroad) || (!!name && !areDifferentCompanies(name, call.companyName)));
|
|
185
205
|
}
|
|
186
206
|
|
|
187
207
|
type EarningsCallsLoadOptions = IssuerListingParams & { force?: boolean; limit?: number; offset?: number };
|
|
@@ -231,7 +251,7 @@ export async function loadEarningsCallsWithClient(
|
|
|
231
251
|
const value = {
|
|
232
252
|
calls,
|
|
233
253
|
pending: payload.pending === true,
|
|
234
|
-
unknownTicker: payload.unknownTicker === true,
|
|
254
|
+
unknownTicker: payload.unknownTicker === true && !abroad,
|
|
235
255
|
...(companyFrom ? { companyFrom } : {}),
|
|
236
256
|
};
|
|
237
257
|
// A list with calls still being produced changes by the minute, so it
|
|
@@ -1,17 +1,35 @@
|
|
|
1
1
|
import type { CloudEarningsCallPayload } from "../../../api-client";
|
|
2
2
|
import { formatShortDate } from "../../../utils/datetime-format";
|
|
3
3
|
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* "FQ4 26", "H1 26" or "FY 26": the fiscal period, compact enough for a table
|
|
6
|
+
* column. A half year's results have no quarter, as a year's do, and are told
|
|
7
|
+
* apart by `fiscalHalf` (SHKP's interim and annual results calls of FY2026).
|
|
8
|
+
*/
|
|
5
9
|
function formatPeriod(
|
|
6
10
|
fiscalYear: number | null,
|
|
7
11
|
fiscalQuarter: number | null,
|
|
12
|
+
fiscalHalf?: number | null,
|
|
8
13
|
): string {
|
|
9
14
|
if (!fiscalQuarter && !fiscalYear) return "—";
|
|
10
|
-
const quarter = fiscalQuarter ? `FQ${fiscalQuarter}` : "FY";
|
|
15
|
+
const quarter = fiscalQuarter ? `FQ${fiscalQuarter}` : fiscalHalf ? `H${fiscalHalf}` : "FY";
|
|
11
16
|
const year = fiscalYear ? ` ${String(fiscalYear).slice(-2)}` : "";
|
|
12
17
|
return `${quarter}${year}`;
|
|
13
18
|
}
|
|
14
19
|
|
|
20
|
+
/** The FQ column of `fn CALLS`: the quarter, or `H1` for a half year's results. */
|
|
21
|
+
export function fiscalQuarterText(call: { fiscalQuarter: number | null; fiscalHalf?: number | null }): string | number | null {
|
|
22
|
+
return call.fiscalQuarter ?? (call.fiscalHalf ? `H${call.fiscalHalf}` : null);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* What a company with no call yet reads, in the pane and `fn CALLS`: not yet
|
|
27
|
+
* available, never an error or a gap in coverage.
|
|
28
|
+
*/
|
|
29
|
+
export function noCallsText(ticker: string): { title: string; message: string } {
|
|
30
|
+
return { title: `Earnings calls for ${ticker} are not yet available.`, message: "Calls appear once the company's investor site or filings list a webcast." };
|
|
31
|
+
}
|
|
32
|
+
|
|
15
33
|
export function formatCallDate(value: string | null): string {
|
|
16
34
|
return formatShortDate(value, { day: "2-digit", year: "2-digit", fallback: "\u2014" });
|
|
17
35
|
}
|
|
@@ -38,7 +56,7 @@ export function formatTimestamp(seconds: number): string {
|
|
|
38
56
|
|
|
39
57
|
type NamedCall = Pick<
|
|
40
58
|
CloudEarningsCallPayload,
|
|
41
|
-
"ticker" | "fiscalYear" | "fiscalQuarter" | "eventKind" | "eventLabel"
|
|
59
|
+
"ticker" | "fiscalYear" | "fiscalQuarter" | "fiscalHalf" | "eventKind" | "eventLabel"
|
|
42
60
|
>;
|
|
43
61
|
|
|
44
62
|
/** An event that is not an earnings call (a deal call, an investor day), shown by its label and never as a quarter. */
|
|
@@ -60,13 +78,13 @@ const SHORT_EVENT_LABELS: Record<string, string> = {
|
|
|
60
78
|
export function callPeriod(call: Omit<NamedCall, "ticker">): string {
|
|
61
79
|
const label = eventLabelOf(call);
|
|
62
80
|
if (label) return SHORT_EVENT_LABELS[label] ?? label;
|
|
63
|
-
return formatPeriod(call.fiscalYear, call.fiscalQuarter);
|
|
81
|
+
return formatPeriod(call.fiscalYear, call.fiscalQuarter, call.fiscalHalf);
|
|
64
82
|
}
|
|
65
83
|
|
|
66
84
|
/** Title for the detail stack: names the call so the body need not repeat it. */
|
|
67
85
|
export function callTitle(call: NamedCall): string {
|
|
68
86
|
const label = eventLabelOf(call);
|
|
69
87
|
if (label) return `${call.ticker} ${label}`;
|
|
70
|
-
const period = formatPeriod(call.fiscalYear, call.fiscalQuarter);
|
|
88
|
+
const period = formatPeriod(call.fiscalYear, call.fiscalQuarter, call.fiscalHalf);
|
|
71
89
|
return period === "—" ? call.ticker : `${call.ticker} ${period}`;
|
|
72
90
|
}
|
|
@@ -6,6 +6,7 @@ import type {
|
|
|
6
6
|
HeadlessPaneContext,
|
|
7
7
|
HeadlessPaneDefinition,
|
|
8
8
|
HeadlessPaneLoadArgs,
|
|
9
|
+
HeadlessPaneRow,
|
|
9
10
|
HeadlessRowsResult,
|
|
10
11
|
} from "../../../types/plugin";
|
|
11
12
|
import { explainRefusal } from "../shared/cloud-denied";
|
|
@@ -23,7 +24,7 @@ import {
|
|
|
23
24
|
type UpcomingCallsResult,
|
|
24
25
|
type UpcomingDays,
|
|
25
26
|
} from "./data";
|
|
26
|
-
import { callPeriod, eventLabelOf } from "./format";
|
|
27
|
+
import { callPeriod, eventLabelOf, fiscalQuarterText, noCallsText } from "./format";
|
|
27
28
|
import type { MarketDay } from "../earnings/board-model";
|
|
28
29
|
import {
|
|
29
30
|
calendarDays,
|
|
@@ -56,9 +57,11 @@ const optionalErrors = (error: string | null) => error ? [error] : undefined;
|
|
|
56
57
|
const CALL_COLUMNS = [
|
|
57
58
|
{ key: "ticker", header: "Ticker" },
|
|
58
59
|
{ key: "company", header: "Company" },
|
|
59
|
-
|
|
60
|
+
// A call known by its day alone prints the day, never a midnight it was not held at.
|
|
61
|
+
{ key: "callAt", header: "Call date", textFormat: (value: unknown, row: HeadlessPaneRow) => callDateText(value, row.timeKnown !== false) },
|
|
60
62
|
{ key: "fiscalYear", header: "FY", align: "right" as const },
|
|
61
|
-
|
|
63
|
+
// A half year's results read H1, never a blank quarter beside the year's.
|
|
64
|
+
{ key: "fiscalQuarter", header: "FQ", align: "right" as const, textFormat: (value: unknown, row: HeadlessPaneRow) => String(fiscalQuarterText({ fiscalQuarter: value as number | null, fiscalHalf: row.fiscalHalf as number | undefined }) ?? "—") },
|
|
62
65
|
{ key: "event", header: "Event" },
|
|
63
66
|
{ key: "status", header: "Status" },
|
|
64
67
|
{ key: "durationSeconds", header: "Seconds", align: "right" as const },
|
|
@@ -122,6 +125,14 @@ function explainDenied(ticker: string | null, context: HeadlessPaneContext) {
|
|
|
122
125
|
return async (error: unknown): Promise<never> => { throw await explainRefusal(error, callsLockNote, { symbol: ticker, context }); };
|
|
123
126
|
}
|
|
124
127
|
|
|
128
|
+
/** "2026-10-27 07:45 UTC" for a call whose start is known, "2026-09-10" for one known by its day. */
|
|
129
|
+
function callDateText(value: unknown, timeKnown: boolean): string {
|
|
130
|
+
const at = typeof value === "string" ? Date.parse(value) : Number.NaN;
|
|
131
|
+
if (!Number.isFinite(at)) return "—";
|
|
132
|
+
const iso = new Date(at).toISOString();
|
|
133
|
+
return timeKnown ? `${iso.slice(0, 16).replace("T", " ")} UTC` : iso.slice(0, 10);
|
|
134
|
+
}
|
|
135
|
+
|
|
125
136
|
function callRow(call: CloudEarningsCallPayload, now: number) {
|
|
126
137
|
const upcoming = isUpcomingCall(call, now);
|
|
127
138
|
return {
|
|
@@ -129,8 +140,10 @@ function callRow(call: CloudEarningsCallPayload, now: number) {
|
|
|
129
140
|
ticker: call.ticker,
|
|
130
141
|
company: call.companyName,
|
|
131
142
|
callAt: call.callAt,
|
|
143
|
+
timeKnown: callTimeKnown(call),
|
|
132
144
|
fiscalYear: call.fiscalYear,
|
|
133
145
|
fiscalQuarter: call.fiscalQuarter,
|
|
146
|
+
...(call.fiscalHalf ? { fiscalHalf: call.fiscalHalf } : {}),
|
|
134
147
|
// A deal call, a conference, an investor day: not a quarter's earnings call.
|
|
135
148
|
event: eventLabelOf(call),
|
|
136
149
|
status: call.hasTranscript ? "transcribed" : callStatusLabel(call, now) || call.status,
|
|
@@ -170,11 +183,15 @@ function projectEarningsCallsHeadless(
|
|
|
170
183
|
const ordered = next ? [next, ...matching.filter((call) => call !== next)] : matching;
|
|
171
184
|
const rows = ordered.slice(0, limit).map((call) => callRow(call, now));
|
|
172
185
|
const sourceLimit = result.sourceLimit ?? 200;
|
|
186
|
+
// A company with no call yet says so, as the pane does; a US symbol the SEC does not know is not one.
|
|
187
|
+
const ticker = typeof args.argument === "string" ? args.argument : null;
|
|
188
|
+
const none = ticker && !result.calls.length && !result.pending && !result.unknownTicker ? noCallsText(ticker) : null;
|
|
173
189
|
const sourceLimitReached = result.sourceLimitReached ?? result.calls.length >= sourceLimit;
|
|
174
190
|
|
|
175
191
|
return {
|
|
176
192
|
columns: CALL_COLUMNS,
|
|
177
193
|
rows,
|
|
194
|
+
...(none ? { empty: `${none.title} ${none.message}` } : {}),
|
|
178
195
|
...(next ? { textRows: rows.filter((row) => row.id !== next.id) } : {}),
|
|
179
196
|
errors: optionalErrors(unansweredRefreshError(result)),
|
|
180
197
|
...(sourceLimitReached || result.pending ? { complete: false } : {}),
|
|
@@ -243,6 +260,7 @@ function transcriptResult(
|
|
|
243
260
|
company: transcript.companyName,
|
|
244
261
|
fiscalYear: transcript.fiscalYear,
|
|
245
262
|
fiscalQuarter: transcript.fiscalQuarter,
|
|
263
|
+
...(transcript.fiscalHalf ? { fiscalHalf: transcript.fiscalHalf } : {}),
|
|
246
264
|
event: eventLabelOf(transcript),
|
|
247
265
|
// A call held in another language: the text is an English translation, its original under --section original.
|
|
248
266
|
translatedFrom: language,
|
|
@@ -290,6 +308,7 @@ function projectCalendar(
|
|
|
290
308
|
event: eventLabelOf(call),
|
|
291
309
|
fiscalYear: call.fiscalYear,
|
|
292
310
|
fiscalQuarter: call.fiscalQuarter,
|
|
311
|
+
...(call.fiscalHalf ? { fiscalHalf: call.fiscalHalf } : {}),
|
|
293
312
|
in: calendarAway(call, now),
|
|
294
313
|
status: call.hasTranscript ? "transcribed" : callStatusLabel(call, now) || call.status,
|
|
295
314
|
hasTranscript: call.hasTranscript,
|
|
@@ -469,6 +488,7 @@ export function createEarningsCallsHeadless(
|
|
|
469
488
|
const ahead = findCallForQuarter(calls.calls, quarter);
|
|
470
489
|
if (ahead) throw new Error(`${ticker}'s ${quarter} call is still to come. ${nextCallNotice(ahead, now)}`);
|
|
471
490
|
if (calls.unknownTicker) throw new Error(`${ticker} is not a known listed company.`);
|
|
491
|
+
if (!calls.calls.length && !calls.pending) throw new Error(noCallsText(ticker).title);
|
|
472
492
|
if (calls.pending) throw new Error(`Earnings call discovery for ${ticker} is still pending.`);
|
|
473
493
|
if (calls.sourceLimitReached ?? calls.calls.length >= (calls.sourceLimit ?? 200)) {
|
|
474
494
|
throw new Error(`No ${quarter} earnings call found among the latest ${calls.sourceLimit ?? 200} loaded calls for ${ticker}; earlier calls may exist.`);
|
|
@@ -295,10 +295,20 @@ export function findCallForQuarter(
|
|
|
295
295
|
)) ?? null;
|
|
296
296
|
}
|
|
297
297
|
|
|
298
|
+
// A half year's results: "H1 26", "1H26", "26H1".
|
|
299
|
+
const half = token.match(/^(?:H([12])(\d{2}|\d{4})?|([12])H(\d{2}|\d{4})?|(\d{2}|\d{4})H([12]))$/);
|
|
300
|
+
if (half) {
|
|
301
|
+
const which = Number(half[1] ?? half[3] ?? half[6]);
|
|
302
|
+
const year = half[2] ?? half[4] ?? half[5];
|
|
303
|
+
return sorted.find((call) => call.fiscalHalf === which && sameYear(call.fiscalYear, year ? Number(year) : null)) ?? null;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// A year's call, never its half's (SHKP's interim and annual results calls share FY2026), even when the half is all
|
|
307
|
+
// the year has so far: H1-2026 asks for that one.
|
|
298
308
|
const fiscalYear = token.match(/^(?:FY)?(\d{2}|\d{4})$/);
|
|
299
309
|
if (fiscalYear) {
|
|
300
310
|
const year = Number(fiscalYear[1]);
|
|
301
|
-
return sorted.find((call) => sameYear(call.fiscalYear, year)) ?? null;
|
|
311
|
+
return sorted.find((call) => sameYear(call.fiscalYear, year) && !call.fiscalHalf) ?? null;
|
|
302
312
|
}
|
|
303
313
|
|
|
304
314
|
return null;
|
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
import { isPermanentClientError } from "../../../api-client/errors";
|
|
52
52
|
import { savedCopyFooterInfo } from "../../../components/layout/pane/footer";
|
|
53
53
|
import { STALE_SEGMENT } from "../../../components/layout/pane/status-footer";
|
|
54
|
-
import { callPeriod, callTitle, eventLabelOf, formatCallDate, formatDuration, formatSentiment } from "./format";
|
|
54
|
+
import { callPeriod, callTitle, eventLabelOf, formatCallDate, formatDuration, formatSentiment, noCallsText } from "./format";
|
|
55
55
|
import { findCallForQuarter, findInLines, MIN_FIND_LENGTH, originalIsMachineTranscript, translatedFrom, turnParagraphs } from "./model";
|
|
56
56
|
import { READER_TABS, TranscriptView, type ReaderTab, type TranscriptPlayback } from "./transcript-view";
|
|
57
57
|
import { PLAYBACK_RATES, SEEK_STEP_SECONDS, useCallPlayback } from "./use-call-playback";
|
|
@@ -1012,10 +1012,7 @@ function CallsListView({
|
|
|
1012
1012
|
return listPending ? (
|
|
1013
1013
|
<PaneStatusBody loading align="center" loadingLabel={`Looking for ${ticker}'s earnings calls...`} />
|
|
1014
1014
|
) : (
|
|
1015
|
-
<EmptyState
|
|
1016
|
-
title={`No earnings calls found for ${ticker}.`}
|
|
1017
|
-
message="Calls appear here once the company's investor site or filings list a webcast."
|
|
1018
|
-
/>
|
|
1015
|
+
<EmptyState {...noCallsText(ticker)} />
|
|
1019
1016
|
);
|
|
1020
1017
|
}
|
|
1021
1018
|
|
|
@@ -605,6 +605,33 @@ export function countriesWithoutEvents(filter: CountryFilter, events: ReadonlyAr
|
|
|
605
605
|
return filterCountries(filter).filter((country) => !listed.has(country));
|
|
606
606
|
}
|
|
607
607
|
|
|
608
|
+
/**
|
|
609
|
+
* The countries the calendar covers: those of the currencies its release feed
|
|
610
|
+
* lists (the euro area's members under EU), the banks whose decisions and the
|
|
611
|
+
* statistics offices whose CPI releases Gloom Cloud keeps, and Hong Kong's and
|
|
612
|
+
* Singapore's government bond auctions.
|
|
613
|
+
*/
|
|
614
|
+
const CALENDAR_COUNTRIES: ReadonlySet<string> = new Set([
|
|
615
|
+
"US", "EU", ...Object.values(EURO_AREA_MEMBERS), "GB", "JP", "CN", "CA", "AU", "NZ", "CH",
|
|
616
|
+
"IN", "ID", "KR", "BR", "MX", "RU", "TR", "ZA", "NO", "SE", "HK", "SG",
|
|
617
|
+
]);
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* Countries the filter names that the calendar does not cover (EG, NG, AR):
|
|
621
|
+
* none it knows of, and none any row of the loaded calendar is for, so no
|
|
622
|
+
* release of theirs would show however long the window.
|
|
623
|
+
*/
|
|
624
|
+
export function countriesNotInCalendar(filter: CountryFilter, events: ReadonlyArray<Pick<EconEvent, "country" | "event">>): string[] {
|
|
625
|
+
const listed = new Set(countriesWithoutEvents(filter, events));
|
|
626
|
+
return filterCountries(filter).filter((country) => listed.has(country) && !CALENDAR_COUNTRIES.has(country));
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
/** "EG is not in the calendar", or EG, NG and AR are (`countriesNotInCalendar`). */
|
|
630
|
+
export function notInCalendarMessage(countries: readonly string[]): string {
|
|
631
|
+
const named = countries.length > 1 ? `${countries.slice(0, -1).join(", ")} and ${countries.at(-1)}` : countries.join("");
|
|
632
|
+
return `${named} ${countries.length > 1 ? "are" : "is"} not in the calendar.`;
|
|
633
|
+
}
|
|
634
|
+
|
|
608
635
|
/**
|
|
609
636
|
* "No scheduled releases for MX in this window", or for MX or ZA; with the
|
|
610
637
|
* day the listing ends, where it does ("; releases are listed through 2026-11-20").
|
|
@@ -28,6 +28,9 @@ const GROUPS: ReadonlyArray<{ group: string; rows: readonly FredRow[] }> = [
|
|
|
28
28
|
["DFII10", "10Y TIPS real yield", "%", "daily", ["treasury", "real yield"]],
|
|
29
29
|
["T10Y2Y", "10Y minus 2Y Treasury spread", "%", "daily", ["treasury", "curve", "2s10s"]],
|
|
30
30
|
["T10Y3M", "10Y minus 3M Treasury spread", "%", "daily", ["treasury", "curve"]],
|
|
31
|
+
// The Federal Reserve Board's Kim-Wright estimates, a week or so behind.
|
|
32
|
+
...Array.from({ length: 10 }, (_, index): FredRow =>
|
|
33
|
+
[`THREEFYTP${index + 1}`, `${index + 1}Y Treasury term premium (Kim-Wright)`, "%", "daily", ["treasury", "term premium", "Kim-Wright"]]),
|
|
31
34
|
["SOFR", "SOFR", "%", "daily", ["secured overnight financing rate", "money markets"]],
|
|
32
35
|
["SORA", "SORA (Singapore overnight rate average)", "%", "daily", ["SGD", "Singapore", "MAS", "overnight", "money markets"]],
|
|
33
36
|
["OBFR", "Overnight bank funding rate", "%", "daily", ["OBFR", "money markets"]],
|
|
@@ -56,7 +56,9 @@ import {
|
|
|
56
56
|
matchesCountry,
|
|
57
57
|
matchesImpact,
|
|
58
58
|
NO_CONSENSUS_NOTE,
|
|
59
|
+
countriesNotInCalendar,
|
|
59
60
|
noScheduledReleasesMessage,
|
|
61
|
+
notInCalendarMessage,
|
|
60
62
|
noTimeNote as noTimeNoteText,
|
|
61
63
|
parseCountryFilter,
|
|
62
64
|
listingEnd,
|
|
@@ -322,11 +324,16 @@ function EconCalendarPane({ focused, width, height }: PaneProps) {
|
|
|
322
324
|
const separatorBg = blendHex(colors.bg, colors.border, 0.3);
|
|
323
325
|
const staleness = fetchedAt ? formatStaleness(fetchedAt, now) : "";
|
|
324
326
|
// The calendar has events and the filters hid them all: say which, with the way back.
|
|
325
|
-
// Countries named one by one with nothing in the calendar: a quiet window there,
|
|
327
|
+
// Countries named one by one with nothing in the calendar: a quiet window there, or one the calendar does not cover
|
|
328
|
+
// (EG, NG), said plainly.
|
|
326
329
|
const unscheduled = useMemo(() => countriesWithoutEvents(countryFilter, events), [countryFilter, events]);
|
|
330
|
+
const absent = useMemo(() => countriesNotInCalendar(countryFilter, events), [countryFilter, events]);
|
|
331
|
+
const quiet = unscheduled.filter((code) => !absent.includes(code));
|
|
327
332
|
const filterEmptyTitle = events.length === 0 ? null
|
|
328
333
|
: unscheduled.length > 0 && unscheduled.length === countryFilter.split(",").length
|
|
329
|
-
?
|
|
334
|
+
? [absent.length > 0 ? notInCalendarMessage(absent) : null,
|
|
335
|
+
quiet.length > 0 ? noScheduledReleasesMessage(quiet, releasesThrough ? shortDayLabel(dayStart(releasesThrough)) : null) : null]
|
|
336
|
+
.filter(Boolean).join(" ").replace(/\.$/, "")
|
|
330
337
|
: filteredEmptyTitle(impactFilter, countryFilter);
|
|
331
338
|
const emptyStateHint = !loading && !error
|
|
332
339
|
? [
|
|
@@ -261,8 +261,10 @@ export const econStatisticsHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
261
261
|
const read = typeof args.argument === "string" ? readStatArg(args.argument) : null;
|
|
262
262
|
const requested = read?.stat ?? null;
|
|
263
263
|
if (args.argument && !requested) {
|
|
264
|
+
// ECST is the US's statistics; another country's policy rate is in CBR, and its published series in `fred`.
|
|
264
265
|
throw new Error(
|
|
265
|
-
`Unknown economic statistic "${String(args.argument)}".
|
|
266
|
+
`Unknown economic statistic "${String(args.argument)}". ECST covers US statistics only: ${STATS.map(({ id }) => id).join(", ")}. `
|
|
267
|
+
+ "For other countries, policy rates are in fn CBR and published series in gloom fred --list.",
|
|
266
268
|
);
|
|
267
269
|
}
|
|
268
270
|
const range = args.options.range as StatRangeId;
|
|
@@ -22,7 +22,7 @@ export const econStatisticsModule: PluginModule = {
|
|
|
22
22
|
id: "econ-statistics-pane",
|
|
23
23
|
paneId: ECON_STATISTICS_PANE_ID,
|
|
24
24
|
label: "Economic Statistics",
|
|
25
|
-
description: "
|
|
25
|
+
description: "US inflation, labour, growth, housing and rates against their own history.",
|
|
26
26
|
keywords: [...new Set([
|
|
27
27
|
"economic",
|
|
28
28
|
"statistics",
|
|
@@ -6,7 +6,7 @@ import type { QueryEntry } from "../../../market-data/result-types";
|
|
|
6
6
|
import { buildQuoteKey, resolveEntryData } from "../../../market-data/selectors";
|
|
7
7
|
import type { Quote } from "../../../types/financials";
|
|
8
8
|
import { isFiniteNumber } from "../../../utils/guards";
|
|
9
|
-
import { isValuationMultiple } from "./model";
|
|
9
|
+
import { isValuationMultiple, screenRowId } from "./model";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* A screen row with its quote laid over it: price, change, volume and market
|
|
@@ -107,32 +107,64 @@ function overlayLiveScreenRow(snapshotRow: ScreenRow, quote: Quote | null | unde
|
|
|
107
107
|
/** The last overlay per snapshot row, so a row whose quote did not move keeps its object. */
|
|
108
108
|
const liveRows = new WeakMap<ScreenRow, { quote: Quote | null; row: LiveScreenRow }>();
|
|
109
109
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
110
|
+
/** Where each quote key sits in a rows array: a screen's rows are replaced as a whole, so this is read once per array. */
|
|
111
|
+
const rowPositions = new WeakMap<readonly ScreenRow[], Map<string, number[]>>();
|
|
112
|
+
|
|
113
|
+
function positionsByQuoteKey(rows: readonly ScreenRow[]): Map<string, number[]> {
|
|
114
|
+
let positions = rowPositions.get(rows);
|
|
115
|
+
if (!positions) {
|
|
116
|
+
positions = new Map();
|
|
117
|
+
rows.forEach((row, index) => {
|
|
118
|
+
const key = screenRowQuoteKey(row);
|
|
119
|
+
const at = positions!.get(key);
|
|
120
|
+
if (at) at.push(index);
|
|
121
|
+
else positions!.set(key, [index]);
|
|
122
|
+
});
|
|
123
|
+
rowPositions.set(rows, positions);
|
|
124
|
+
}
|
|
125
|
+
return positions;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* The rows with their quotes laid over them. Only the rows a quote names are
|
|
130
|
+
* touched, so a long list costs what its quotes do, and the same array comes
|
|
131
|
+
* back while none of them moved a row (a tick for a row off the loaded pages,
|
|
132
|
+
* or one that changes none of what the row shows).
|
|
133
|
+
*/
|
|
134
|
+
function overlayRows(
|
|
135
|
+
rows: readonly ScreenRow[],
|
|
136
|
+
quotes: Iterable<readonly [string, Quote | null | undefined]>,
|
|
137
|
+
): readonly LiveScreenRow[] {
|
|
138
|
+
const positions = positionsByQuoteKey(rows);
|
|
139
|
+
let next: LiveScreenRow[] | null = null;
|
|
140
|
+
for (const [key, quote] of quotes) {
|
|
141
|
+
if (quote === undefined) continue;
|
|
142
|
+
for (const index of positions.get(key) ?? []) {
|
|
143
|
+
const row = rows[index]!;
|
|
144
|
+
let live: LiveScreenRow;
|
|
145
|
+
const cached = liveRows.get(row);
|
|
146
|
+
if (cached && cached.quote === quote) live = cached.row;
|
|
147
|
+
else {
|
|
148
|
+
live = overlayLiveScreenRow(row, quote);
|
|
149
|
+
liveRows.set(row, { quote, row: live });
|
|
150
|
+
}
|
|
151
|
+
if (live !== (next ?? rows)[index]) (next ??= [...rows])[index] = live;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return next ?? rows;
|
|
120
155
|
}
|
|
121
156
|
|
|
122
157
|
/** The pane's rows with the streamed quotes on screen laid over them. */
|
|
123
158
|
export function overlayLiveScreenRows(
|
|
124
159
|
rows: readonly ScreenRow[],
|
|
125
160
|
entries: ReadonlyMap<string, QueryEntry<Quote>>,
|
|
126
|
-
): LiveScreenRow[] {
|
|
127
|
-
return overlayRows(rows, (key) =>
|
|
128
|
-
const entry = entries.get(key);
|
|
129
|
-
return entry ? resolveEntryData(entry) : undefined;
|
|
130
|
-
});
|
|
161
|
+
): readonly LiveScreenRow[] {
|
|
162
|
+
return overlayRows(rows, Array.from(entries, ([key, entry]) => [key, resolveEntryData(entry)] as const));
|
|
131
163
|
}
|
|
132
164
|
|
|
133
165
|
/** Rows with quotes keyed by screenRowQuoteKey laid over them, for a report. */
|
|
134
|
-
export function overlayScreenQuotes(rows: readonly ScreenRow[], quotes: ReadonlyMap<string, Quote>): LiveScreenRow[] {
|
|
135
|
-
return overlayRows(rows,
|
|
166
|
+
export function overlayScreenQuotes(rows: readonly ScreenRow[], quotes: ReadonlyMap<string, Quote>): readonly LiveScreenRow[] {
|
|
167
|
+
return overlayRows(rows, quotes);
|
|
136
168
|
}
|
|
137
169
|
|
|
138
170
|
/** The fields a quote moves on a row (overlayLiveScreenRow). */
|
|
@@ -165,6 +197,30 @@ export function sortLiveScreenRows<T extends ScreenRow>(rows: readonly T[], sort
|
|
|
165
197
|
.map(({ row }) => row);
|
|
166
198
|
}
|
|
167
199
|
|
|
200
|
+
/**
|
|
201
|
+
* Where each row sits in the screen's order by the figures it shows
|
|
202
|
+
* (sortLiveScreenRows), by row id in that order. The pane takes it from
|
|
203
|
+
* figures sampled every few seconds, so a tick reorders nothing: the rows it
|
|
204
|
+
* moves are placed by it (placeLiveScreenRows), and the sort is not redone.
|
|
205
|
+
*/
|
|
206
|
+
export function liveScreenPlaces(rows: readonly ScreenRow[], sort: ScreenDefinition["sort"]): ReadonlyMap<string, number> {
|
|
207
|
+
return new Map(sortLiveScreenRows(rows, sort).map((row, index) => [screenRowId(row), index]));
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/** `rows` in the order of `places`; a row it does not know follows those it does, in the order it has. */
|
|
211
|
+
export function placeLiveScreenRows<T extends ScreenRow>(rows: readonly T[], places: ReadonlyMap<string, number>): T[] {
|
|
212
|
+
const placed: Array<T | undefined> = [];
|
|
213
|
+
const rest: T[] = [];
|
|
214
|
+
for (const row of rows) {
|
|
215
|
+
const place = places.get(screenRowId(row));
|
|
216
|
+
if (place === undefined || placed[place] !== undefined) rest.push(row);
|
|
217
|
+
else placed[place] = row;
|
|
218
|
+
}
|
|
219
|
+
const ordered: T[] = [];
|
|
220
|
+
for (const row of placed) if (row !== undefined) ordered.push(row);
|
|
221
|
+
return ordered.concat(rest);
|
|
222
|
+
}
|
|
223
|
+
|
|
168
224
|
/** The extended sessions some row has a print for, in the order their columns go. */
|
|
169
225
|
export function screenExtendedSessions(rows: readonly LiveScreenRow[]): ExtendedSession[] {
|
|
170
226
|
return (["PRE", "POST", "OVERNIGHT"] as const).filter((session) => rows.some((row) => row.extended?.session === session));
|
|
@@ -339,8 +339,12 @@ export function screenMetricSetting(setting: unknown, fallback: NumericField): [
|
|
|
339
339
|
* snapshot's day without one.
|
|
340
340
|
*/
|
|
341
341
|
export function screenYtdBase(rows: readonly ScreenRow[], assembledAt?: string | null, now = Date.now()): string | null {
|
|
342
|
-
|
|
343
|
-
|
|
342
|
+
let newest = "";
|
|
343
|
+
for (const row of rows) {
|
|
344
|
+
const day = row.metrics.returnYtdPercent?.asOf?.slice(0, 10);
|
|
345
|
+
if (day && day > newest) newest = day;
|
|
346
|
+
}
|
|
347
|
+
const day = newest || assembledAt?.slice(0, 10);
|
|
344
348
|
return day ? yearToDateBaseLabel(day, "NYSE", now) : null;
|
|
345
349
|
}
|
|
346
350
|
|
|
@@ -420,8 +424,19 @@ export function screenCurrencyEmpty(
|
|
|
420
424
|
};
|
|
421
425
|
}
|
|
422
426
|
|
|
423
|
-
|
|
424
|
-
|
|
427
|
+
/**
|
|
428
|
+
* A row's id as last read: the table, the order and the lookups of a long list
|
|
429
|
+
* ask for it row by row on every render, and a screen's rows do not change
|
|
430
|
+
* between them.
|
|
431
|
+
*/
|
|
432
|
+
const rowIds = new WeakMap<object, { symbol: string; exchange: string; id: string }>();
|
|
433
|
+
export const screenRowId = (row: Pick<ScreenRow, "symbol" | "exchange">) => {
|
|
434
|
+
const known = rowIds.get(row);
|
|
435
|
+
if (known && known.symbol === row.symbol && known.exchange === row.exchange) return known.id;
|
|
436
|
+
const id = `${canonicalExchange(row.exchange)}:${row.symbol}`;
|
|
437
|
+
rowIds.set(row, { symbol: row.symbol, exchange: row.exchange, id });
|
|
438
|
+
return id;
|
|
439
|
+
};
|
|
425
440
|
export const screenLabel = (field: string) =>
|
|
426
441
|
({
|
|
427
442
|
kpiArr: "Annual recurring revenue",
|