@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
|
@@ -54,6 +54,21 @@ function projectFearGreedHeadless(data: FearGreedData): HeadlessBundleResult {
|
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
/** `fn FNG` over a loaded reading, which the pane's footer also reads its source line from. */
|
|
58
|
+
export function fearGreedReport(result: FearGreedLoadResult): HeadlessBundleResult {
|
|
59
|
+
// A copy kept for a refresh that could not get through (offline, a timeout) ends the report with when it was
|
|
60
|
+
// saved, as other reports do; any other failure stays an error beside the old reading.
|
|
61
|
+
const savedCopy = result.source === "stale-fallback" && isTransientFailure(result.error);
|
|
62
|
+
const metadata = { fetchedAt: result.fetchedAt, stale: result.stale };
|
|
63
|
+
return {
|
|
64
|
+
...projectFearGreedHeadless(result.data),
|
|
65
|
+
...(result.refreshError && !savedCopy ? { errors: [result.refreshError] } : {}),
|
|
66
|
+
// A cached index the refresh could not replace is stale; otherwise CNN's published reading.
|
|
67
|
+
freshness: { source: "CNN", status: result.stale ? "stale" : "not-a-feed", basis: "published index" },
|
|
68
|
+
metadata: savedCopy ? servedFromSavedCopy(metadata, result.fetchedAt) : metadata,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
57
72
|
export interface FearGreedHeadlessDependencies {
|
|
58
73
|
load(args: HeadlessPaneLoadArgs, signal: AbortSignal): Promise<FearGreedLoadResult>;
|
|
59
74
|
}
|
|
@@ -73,19 +88,7 @@ export function createFearGreedHeadless(
|
|
|
73
88
|
options: [],
|
|
74
89
|
describe: "Fear & Greed",
|
|
75
90
|
async load(args, ctx) {
|
|
76
|
-
|
|
77
|
-
const projected = projectFearGreedHeadless(result.data);
|
|
78
|
-
// A copy kept for a refresh that could not get through (offline, a timeout) ends the report with when it was
|
|
79
|
-
// saved, as other reports do; any other failure stays an error beside the old reading.
|
|
80
|
-
const savedCopy = result.source === "stale-fallback" && isTransientFailure(result.error);
|
|
81
|
-
const metadata = { fetchedAt: result.fetchedAt, stale: result.stale };
|
|
82
|
-
return {
|
|
83
|
-
...projected,
|
|
84
|
-
...(result.refreshError && !savedCopy ? { errors: [result.refreshError] } : {}),
|
|
85
|
-
// A cached index the refresh could not replace is stale; otherwise CNN's published reading.
|
|
86
|
-
freshness: { source: "CNN", status: result.stale ? "stale" : "not-a-feed", basis: "published index" },
|
|
87
|
-
metadata: savedCopy ? servedFromSavedCopy(metadata, result.fetchedAt) : metadata,
|
|
88
|
-
};
|
|
91
|
+
return fearGreedReport(await dependencies.load(args, ctx.signal));
|
|
89
92
|
},
|
|
90
93
|
};
|
|
91
94
|
}
|
|
@@ -14,7 +14,9 @@ import { usePaneRefreshKey } from "../../../components/data-table/table-pane";
|
|
|
14
14
|
import { useAsyncResource } from "../../../react/async-resource";
|
|
15
15
|
import type { PaneProps } from "../../../types/plugin";
|
|
16
16
|
import { Box, ScrollBox, useUiHost } from "../../../ui";
|
|
17
|
-
import { useAutoRefresh, useUpdatedAgo } from "../../../react/auto-refresh";
|
|
17
|
+
import { useAutoRefresh, useUpdatedAgo, useUtcDay } from "../../../react/auto-refresh";
|
|
18
|
+
import { reportFooterSegment } from "../shared/source-footer";
|
|
19
|
+
import { fearGreedHeadless, fearGreedReport } from "./headless";
|
|
18
20
|
import { getCachedFearGreedData, loadFearGreed, type FearGreedLoadResult } from "./cache";
|
|
19
21
|
import { IndexHistoryChart, IndicatorChart } from "./charts";
|
|
20
22
|
import type { FearGreedData } from "./data";
|
|
@@ -57,6 +59,8 @@ export function FearGreedPane({ paneId, focused, width, height }: PaneProps) {
|
|
|
57
59
|
|
|
58
60
|
usePaneRefreshKey(refresh, { focused });
|
|
59
61
|
|
|
62
|
+
const utcDay = useUtcDay();
|
|
63
|
+
const loaded = resource.data;
|
|
60
64
|
const footerInfo = useMemo(() => [
|
|
61
65
|
...(data ? [{
|
|
62
66
|
id: "score",
|
|
@@ -64,10 +68,14 @@ export function FearGreedPane({ paneId, focused, width, height }: PaneProps) {
|
|
|
64
68
|
{ text: `${formatScore(data.overall.score)} ${ratingLabel(data.overall.rating)}`, color: ratingColor(data.overall.rating), bold: true },
|
|
65
69
|
],
|
|
66
70
|
}] : []),
|
|
67
|
-
|
|
68
|
-
|
|
71
|
+
// Its source and when CNN published the reading, as `fn FNG` ends, a stale one with its warning beside it;
|
|
72
|
+
// a saved copy says when it was saved instead.
|
|
73
|
+
...(savedAt != null ? [savedCopyFooterSegment("saved-copy", savedAt)] : [
|
|
74
|
+
...(loaded?.data ? [reportFooterSegment(fearGreedHeadless, fearGreedReport({ ...loaded, stale: false }))] : []),
|
|
75
|
+
...(stale ? [{ id: "stale", parts: [{ text: "stale", tone: "warning" as const }] }] : []),
|
|
76
|
+
]),
|
|
69
77
|
...(updatedAgo ? [ageFooterSegment(updatedAgo, { id: "age", verb: "updated", tone: "value" })] : []),
|
|
70
|
-
], [data, savedAt, stale, updatedAgo]);
|
|
78
|
+
], [data, loaded, savedAt, stale, updatedAgo, utcDay]);
|
|
71
79
|
usePaneStatusFooter({ registrationId: paneId, loading, error, info: footerInfo });
|
|
72
80
|
|
|
73
81
|
const previousScores = useMemo(() => (data ? previousScoreItems(data) : []), [data]);
|
|
@@ -20,7 +20,7 @@ import { useFxRatesMap } from "../../../market-data/hooks";
|
|
|
20
20
|
import { resolveEntryData } from "../../../market-data/selectors";
|
|
21
21
|
import { useRemoteUiNode } from "../../../remote/semantic-tree";
|
|
22
22
|
import { usePaneSettingValue, useUpdatePaneSettings } from "../../../state/app/context";
|
|
23
|
-
import { colors, shownPriceColor } from "../../../theme/colors";
|
|
23
|
+
import { colors, inactiveSelectedBg, shownPriceColor } from "../../../theme/colors";
|
|
24
24
|
import { formatPercentRaw, MISSING_VALUE } from "../../../utils/format";
|
|
25
25
|
import type {
|
|
26
26
|
CommandBarResultDef, CommandBarSearchProvider, GloomPluginContext, PaneProps, PaneTemplateContext, PaneTemplateCreateOptions,
|
|
@@ -33,7 +33,8 @@ import { summarizeFxRates, fxStatusLabel } from "../../../utils/fx-status";
|
|
|
33
33
|
import type { PluginModule } from "../plugin-module";
|
|
34
34
|
import { fxRateObservations } from "../shared/fx-rate-freshness";
|
|
35
35
|
import { useLiveQuoteEntries } from "../../../state/hooks/quote-streaming";
|
|
36
|
-
import { useAutoRefresh, useUpdatedAgo } from "../../../react/auto-refresh";
|
|
36
|
+
import { useAutoRefresh, useUpdatedAgo, useUtcDay } from "../../../react/auto-refresh";
|
|
37
|
+
import { reportFooterSegment } from "../shared/source-footer";
|
|
37
38
|
import { useLiveStreamingSetting } from "../../../state/hooks/live-streaming";
|
|
38
39
|
import { fxBoardMoveDay, fxLegMoveReference, fxLegQuoteKey, fxLegReferenceRate, fxLegSavedAt, fxLegTargets, fxLegs, fxLegsBehind, liveFxLegEntry } from "./live-legs";
|
|
39
40
|
import { CURRENCY_FLAG_REGIONS, FX_CURRENCIES, formatRate, resolveCurrencies, type FxCurrency } from "./pairs";
|
|
@@ -195,20 +196,19 @@ function FxMatrixPane({ focused, width, height }: PaneProps) {
|
|
|
195
196
|
}));
|
|
196
197
|
// A report or capture of the board is dated by the rates it draws: when each
|
|
197
198
|
// was observed, whether it is delayed or stale, and where the FX market
|
|
198
|
-
// stands. The
|
|
199
|
+
// stands. The footer ends with the same line, as `fn FXC` does.
|
|
200
|
+
const rateObservations = () => {
|
|
201
|
+
const legQuotes = new Map(legs.map((leg) => [leg.currency, resolveEntryData(legEntries.get(fxLegQuoteKey(leg)))] as const));
|
|
202
|
+
return fxRateObservations(currencies, rates, (currency) => ({
|
|
203
|
+
entry: rateEntries.get(currency),
|
|
204
|
+
// Only a rate that is the pair quote's own says what that quote says.
|
|
205
|
+
legQuote: liveEntries.has(currency) ? legQuotes.get(currency) : null,
|
|
206
|
+
}));
|
|
207
|
+
};
|
|
199
208
|
useRemoteUiNode({
|
|
200
209
|
role: "report-freshness",
|
|
201
210
|
label: "Rate freshness",
|
|
202
|
-
getMetadata: () => {
|
|
203
|
-
const legQuotes = new Map(legs.map((leg) => [leg.currency, resolveEntryData(legEntries.get(fxLegQuoteKey(leg)))] as const));
|
|
204
|
-
return {
|
|
205
|
-
observations: fxRateObservations(currencies, rates, (currency) => ({
|
|
206
|
-
entry: rateEntries.get(currency),
|
|
207
|
-
// Only a rate that is the pair quote's own says what that quote says.
|
|
208
|
-
legQuote: liveEntries.has(currency) ? legQuotes.get(currency) : null,
|
|
209
|
-
})),
|
|
210
|
-
};
|
|
211
|
-
},
|
|
211
|
+
getMetadata: () => ({ observations: rateObservations() }),
|
|
212
212
|
});
|
|
213
213
|
const status = summarizeFxRates(currencies, rates, (currency) => rateEntries.get(currency));
|
|
214
214
|
const statusText = fxStatusLabel(status);
|
|
@@ -300,7 +300,7 @@ function FxMatrixPane({ focused, width, height }: PaneProps) {
|
|
|
300
300
|
row: FxCurrency,
|
|
301
301
|
column: DataTableColumn,
|
|
302
302
|
_index: number,
|
|
303
|
-
rowState: { selected: boolean },
|
|
303
|
+
rowState: { selected: boolean; inactive?: boolean },
|
|
304
304
|
): DataTableCell => {
|
|
305
305
|
if (column.id === "base") {
|
|
306
306
|
return {
|
|
@@ -344,9 +344,12 @@ function FxMatrixPane({ focused, width, height }: PaneProps) {
|
|
|
344
344
|
? crossMovePercent(base, rowReference, quote, columnReference)
|
|
345
345
|
: null,
|
|
346
346
|
);
|
|
347
|
-
// The cursor row keeps its selection colours
|
|
347
|
+
// The cursor row keeps its selection colours, quieter while the board does
|
|
348
|
+
// not have the keys; the tint leans on them.
|
|
348
349
|
const backgroundColor = rowState.selected
|
|
349
|
-
?
|
|
350
|
+
? rowState.inactive
|
|
351
|
+
? directionTint(level, { background: inactiveSelectedBg(colors), text: colors.text })
|
|
352
|
+
: directionTint(level, { background: colors.selected, text: colors.selectedText })
|
|
350
353
|
: directionTint(level, { background: colors.bg, text: colors.text });
|
|
351
354
|
return { text: formatRate(base / quote, quoteCurrency, reference), color: colors.text, backgroundColor };
|
|
352
355
|
}, [amount?.currency, convertedAmount, directionReferences, flagged, moveVsUsd, rates, referenceRates, status.loading]);
|
|
@@ -354,6 +357,7 @@ function FxMatrixPane({ focused, width, height }: PaneProps) {
|
|
|
354
357
|
const handleKeyDown = useCallback((event: DataTableKeyEvent) => handleRefreshKey(event, refresh), [refresh]);
|
|
355
358
|
|
|
356
359
|
const updatedAgo = useUpdatedAgo(status.latestFetchedAt || null);
|
|
360
|
+
const utcDay = useUtcDay();
|
|
357
361
|
|
|
358
362
|
usePaneFooter(FX_MATRIX_PANE_ID, () => {
|
|
359
363
|
const info: PaneFooterSegment[] = [];
|
|
@@ -361,13 +365,20 @@ function FxMatrixPane({ focused, width, height }: PaneProps) {
|
|
|
361
365
|
const unreadAmount = amountError ?? (typedAmount && "error" in typedAmount ? typedAmount.error : null);
|
|
362
366
|
if (unreadAmount) info.push({ id: "amount", parts: [{ text: unreadAmount, tone: "warning" }] });
|
|
363
367
|
if (status.loading > 0) info.push({ id: "loading", parts: [{ text: "loading", tone: "muted" }] });
|
|
364
|
-
|
|
368
|
+
// Where the rates are from and when, as `fn FXC` ends, dates them: the rates' status then says only what is wrong,
|
|
369
|
+
// naming the pair, never the oldest rate's time again.
|
|
370
|
+
const observations = savedAt == null ? rateObservations() : [];
|
|
371
|
+
const warns = !!(status.stale || status.unknownTime || status.unavailable);
|
|
372
|
+
if (statusText && (warns || observations.length === 0)) info.push({ id: "rates", parts: [{ text: statusText, tone: warns ? "warning" : "muted" }] });
|
|
365
373
|
// Every cross is read through each currency's dollar pair, the amount column too; `fx` reads a pair's own quote.
|
|
366
374
|
info.push({ id: "cross", parts: [{ text: "via USD", tone: "muted" }] });
|
|
367
375
|
if (savedAt != null) info.push(savedCopyFooterSegment("updated", savedAt));
|
|
368
|
-
else
|
|
376
|
+
else {
|
|
377
|
+
if (observations.length) info.push(reportFooterSegment(fxMatrixHeadless, { rows: [], freshness: { observations } }));
|
|
378
|
+
if (updatedAgo) info.push(ageFooterSegment(updatedAgo, { verb: "fetched" }));
|
|
379
|
+
}
|
|
369
380
|
return { info };
|
|
370
|
-
}, [amountError, savedAt, status.loading, statusText, typedAmount, updatedAgo]);
|
|
381
|
+
}, [amountError, rates, savedAt, status.loading, status.stale, status.unavailable, status.unknownTime, statusText, typedAmount, updatedAgo, utcDay]);
|
|
371
382
|
|
|
372
383
|
const queryBar = (
|
|
373
384
|
<QueryBar
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Box, Text } from "../../../ui";
|
|
2
2
|
import type { DataTableCell } from "../../../components";
|
|
3
|
-
import { colors } from "../../../theme/colors";
|
|
3
|
+
import { colors, inactiveSelectedText } from "../../../theme/colors";
|
|
4
4
|
import { blendForContrast } from "../../../theme/color-utils";
|
|
5
5
|
import { clipToDisplayWidth, displayWidth } from "../../../utils/format";
|
|
6
6
|
import type { InsiderTypeTone } from "./display";
|
|
@@ -24,10 +24,12 @@ export function insiderToneColor(tone: InsiderTypeTone): string {
|
|
|
24
24
|
return tone === "buy" ? colors.positive : tone === "sell" ? colors.negative : colors.textDim;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
function typeColor(tone: InsiderTypeTone, selected: boolean): string {
|
|
28
|
-
|
|
27
|
+
function typeColor(tone: InsiderTypeTone, selected: boolean, inactive: boolean): string {
|
|
28
|
+
// On the quieter fill of a pane without the keys, the row keeps its own colours, lifted to read there.
|
|
29
|
+
if (tone === "neutral") return !selected ? colors.textDim : inactive ? inactiveSelectedText(colors.textDim) : colors.selectedText;
|
|
29
30
|
const color = insiderToneColor(tone);
|
|
30
|
-
|
|
31
|
+
if (!selected) return color;
|
|
32
|
+
return inactive ? inactiveSelectedText(color) : blendForContrast(color, colors.selected, colors.selectedText, SELECTED_TONE_MIN_CONTRAST);
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
function isoDay(date: Date | null): string | null {
|
|
@@ -38,7 +40,7 @@ export function renderInsiderCell(
|
|
|
38
40
|
row: InsiderTableRow,
|
|
39
41
|
column: InsiderColumn,
|
|
40
42
|
_index: number,
|
|
41
|
-
rowState: { selected: boolean },
|
|
43
|
+
rowState: { selected: boolean; inactive?: boolean },
|
|
42
44
|
): DataTableCell {
|
|
43
45
|
// Awards, exercises and tax lines are context; buys and sales carry the figures.
|
|
44
46
|
const figureColor = row.tone === "neutral" ? colors.textDim : colors.text;
|
|
@@ -50,12 +52,13 @@ export function renderInsiderCell(
|
|
|
50
52
|
case "role":
|
|
51
53
|
return { text: row.role, color: colors.textMuted };
|
|
52
54
|
case "type": {
|
|
53
|
-
const
|
|
55
|
+
const inactive = rowState.inactive === true;
|
|
56
|
+
const color = typeColor(row.tone, rowState.selected, inactive);
|
|
54
57
|
const text = insiderTypeText(row, column.plan === true);
|
|
55
58
|
const markers = insiderTypeMarkers(row, column.plan === true);
|
|
56
59
|
if (markers.length === 0) return { text, color, keepColorWhenSelected: true };
|
|
57
60
|
// The markers read after the type in a quieter colour.
|
|
58
|
-
const markerColor = rowState.selected ? colors.
|
|
61
|
+
const markerColor = !rowState.selected ? colors.textMuted : inactive ? inactiveSelectedText(colors.textMuted) : colors.selectedText;
|
|
59
62
|
const label = clipToDisplayWidth(row.type, column.width);
|
|
60
63
|
const room = Math.max(0, column.width - displayWidth(label) - (label ? 1 : 0));
|
|
61
64
|
return {
|
|
@@ -249,7 +249,7 @@ function TickersTradesView({ symbols, width, height, focused, viewBar }: Tickers
|
|
|
249
249
|
</Box>
|
|
250
250
|
);
|
|
251
251
|
}
|
|
252
|
-
const renderCell = (row: TickerTradeRow, column: TradeColumn, index: number, state: { selected: boolean }): DataTableCell =>
|
|
252
|
+
const renderCell = (row: TickerTradeRow, column: TradeColumn, index: number, state: { selected: boolean; inactive?: boolean }): DataTableCell =>
|
|
253
253
|
column.id === "ticker"
|
|
254
254
|
? listingCell(row.ticker, colors, state.selected)
|
|
255
255
|
: renderInsiderCell(row, column as InsiderColumn, index, state);
|
|
@@ -7,7 +7,7 @@ import { HV_WINDOWS, type HvWindow, type IvLookback, type IvStatRow, projectIvHi
|
|
|
7
7
|
import { vcaUniverse } from "./universe";
|
|
8
8
|
import { offsetText, releaseOffsetRows } from "./events";
|
|
9
9
|
import { loadMacroReleases } from "../macro-day/client";
|
|
10
|
-
import { IV_EVENT_KINDS, MACRO_EVENT_LABELS, MACRO_RELEASE_SOURCES, staleMacroReleasesNotice, type MacroEventKind, type MacroRelease,
|
|
10
|
+
import { IV_EVENT_KINDS, MACRO_EVENT_LABELS, MACRO_RELEASE_SOURCES, POLICY_DECISION_KINDS, staleMacroReleasesNotice, type MacroEventKind, type MacroRelease,
|
|
11
11
|
type MacroReleaseList } from "../macro-day/releases";
|
|
12
12
|
import { lookupScheduledDates } from "../alerts/scheduled";
|
|
13
13
|
import { fetchCpiBoard } from "../cpi/client";
|
|
@@ -38,7 +38,7 @@ export const ivHistoryHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
38
38
|
{ key: "lookback", type: "enum", values: [{ value: "1Y" }, { value: "2Y" }, { value: "ALL" }], defaultValue: "1Y", description: "Visible history" },
|
|
39
39
|
{ key: "hvWindow", type: "enum", values: HV_WINDOWS.map((window) => ({ value: String(window) })), defaultValue: "20", description: "Realized volatility window in sessions" },
|
|
40
40
|
{ key: "event", type: "enum", aliases: ["release"], values: IV_EVENT_KINDS.map((value) => ({ value, ...value === "jobs" ? { aliases: ["nfp", "payrolls"] } : {} })),
|
|
41
|
-
description: "One row per release of this kind whose session at --offset has closed (the next scheduled FOMC, CPI or
|
|
41
|
+
description: "One row per release of this kind whose session at --offset has closed (the next scheduled FOMC, CPI, ECB or BoJ decision included), in place of the daily history",
|
|
42
42
|
example: "--event fomc --offset -6", shot: { reportOnly: "lists the readings around past release days" } },
|
|
43
43
|
{ key: "offset", type: "integer", minimum: -60, maximum: 60, defaultValue: 0,
|
|
44
44
|
description: "Sessions from each release with --event: 0 is the first session on or after the release day, -6 the sixth session before that",
|
|
@@ -47,7 +47,7 @@ export const ivHistoryHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
47
47
|
async load(args, ctx) {
|
|
48
48
|
const event = typeof args.options.event === "string" && args.options.event ? args.options.event as MacroEventKind : null;
|
|
49
49
|
const offset = Number(args.options.offset) || 0;
|
|
50
|
-
if (!event && offset !== 0) throw new Error("--offset counts sessions from a release day: add --event fomc, cpi, jobs or
|
|
50
|
+
if (!event && offset !== 0) throw new Error("--offset counts sessions from a release day: add --event fomc, cpi, jobs, ecb or boj.");
|
|
51
51
|
const instrument = await resolveHeadlessInstrument(ctx, args.symbols[0]!);
|
|
52
52
|
// What became of the symbol, as `quote` reads it, looked up beside the figures: FB's are the fund listed
|
|
53
53
|
// there now, TWTR stopped trading, and HFC, which became DINO, has none of its own.
|
|
@@ -103,7 +103,7 @@ export const ivHistoryHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
103
103
|
staleMacroReleasesNotice(releases.list),
|
|
104
104
|
].filter((note): note is string => !!note);
|
|
105
105
|
// A policy decision's row says what it did (ECB raised 75bp to 0.75%), as MDAY's does; the export keeps the rate before too.
|
|
106
|
-
const decisionColumns = event
|
|
106
|
+
const decisionColumns = POLICY_DECISION_KINDS.has(event)
|
|
107
107
|
? [{ key: "decision", header: "Decision" }, { key: "actual", header: "Actual" }, { key: "prior", header: "Prior" }] : [];
|
|
108
108
|
const eventColumns = [{ key: "releaseDate", header: "Release date" }, ...decisionColumns, { key: "session", header: "Session" },
|
|
109
109
|
...historyColumns.slice(1), ...skewColumns];
|
|
@@ -242,8 +242,8 @@ export const ivScreenHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
242
242
|
* The releases of `event` HIVG reads around: the days MDAY studies (the list
|
|
243
243
|
* the app ships with, extended by Gloom Cloud's), and the next one scheduled,
|
|
244
244
|
* from the CPI board's release calendar or the FOMC meetings WIRP prices, as
|
|
245
|
-
* scheduled alerts read them, or the ECB's next decision as Gloom
|
|
246
|
-
* it with its decision days. Payrolls have no schedule to read.
|
|
245
|
+
* scheduled alerts read them, or the ECB's or BoJ's next decision as Gloom
|
|
246
|
+
* Cloud lists it with its decision days. Payrolls have no schedule to read.
|
|
247
247
|
*/
|
|
248
248
|
async function eventReleases(event: MacroEventKind, ctx: HeadlessPaneContext): Promise<{
|
|
249
249
|
list: MacroReleaseList; upcoming: string | null; upcomingNote: string | null;
|
|
@@ -257,13 +257,14 @@ async function eventReleases(event: MacroEventKind, ctx: HeadlessPaneContext): P
|
|
|
257
257
|
fomc: async () => (await fetchRatePath(ctx.apiClient)).meetings,
|
|
258
258
|
}, zonedDateKey(Date.now(), "America/New_York")).then((dates) => dates.get(`macro:${event}`) ?? { date: null }),
|
|
259
259
|
]);
|
|
260
|
-
const
|
|
260
|
+
const served = event === "ecb" || event === "boj";
|
|
261
|
+
const upcoming = served ? published.scheduled?.[event] ?? null : next && "date" in next ? next.date : null;
|
|
261
262
|
const listed = upcoming != null && published.releases.some((release) => release.kind === event && release.date === upcoming);
|
|
262
263
|
const releases: MacroRelease[] = upcoming && !listed ? [...published.releases, { kind: event, date: upcoming }] : published.releases;
|
|
263
264
|
return {
|
|
264
265
|
list: { ...published, releases },
|
|
265
266
|
upcoming,
|
|
266
|
-
upcomingNote:
|
|
267
|
+
upcomingNote: served ? upcoming ? null : `The next ${label} decision is not scheduled here, so it has no row yet.`
|
|
267
268
|
: next == null ? `The next ${label} release is not scheduled here, so it has no row yet.`
|
|
268
269
|
: "error" in next ? `The next ${label} date could not be loaded (${next.error}), so it has no row.` : null,
|
|
269
270
|
};
|
|
@@ -24,8 +24,8 @@ export const macroDayHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
24
24
|
describe: (args) => `MDAY ${args.symbols[0] ?? ""}`,
|
|
25
25
|
discovery: { screenshotReadiness: "live-dom", limitations: [
|
|
26
26
|
"US listings, or a FRED series (FRED:T10Y2Y, whose moves in a rate or spread read in bp); close-to-close on the release day.",
|
|
27
|
-
"Published CPI, jobs and FOMC days, and from Gloom Cloud Brazil's IPCA days
|
|
28
|
-
"Actual, forecast and prior for the days Gloom Cloud has them (the US headlines from its kept economic calendar, under either feed's title; an FOMC day's are the federal funds target range and whether it held or moved, an ECB day's the deposit facility rate; IPCA from the central bank's SGS series); --surprise keeps the days that came in hot, cool or in line with the forecast.",
|
|
27
|
+
"Published CPI, jobs and FOMC days, and from Gloom Cloud Brazil's IPCA days, the ECB's decision days (every Governing Council monetary policy meeting) and the BoJ's (each monetary policy meeting's Tokyo day, from 2026); sessions after the list's last covered day (releasesThrough) are left out.",
|
|
28
|
+
"Actual, forecast and prior for the days Gloom Cloud has them (the US headlines from its kept economic calendar, under either feed's title; an FOMC day's are the federal funds target range and whether it held or moved, an ECB day's the deposit facility rate, a BoJ day's its policy rate; IPCA from the central bank's SGS series); --surprise keeps the days that came in hot, cool or in line with the forecast.",
|
|
29
29
|
"A CPI day the calendar lists without its year-on-year actual takes one computed from the CPI index against a year earlier, labelled computed.",
|
|
30
30
|
"A release day without figures says why: before the kept calendar starts, or listed without them.",
|
|
31
31
|
"A release day that is also the reaction session of the company's own earnings report is marked earnings and left out of the release averages and the normal day.",
|
|
@@ -77,7 +77,7 @@ export const macroDayHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
77
77
|
const labels = model.kinds.filter((kind) => events.some((event) => event.kind === kind && pick(event))).map((kind) => MACRO_EVENT_LABELS[kind]);
|
|
78
78
|
return `${labels.length > 1 ? `${labels.slice(0, -1).join(", ")} and ${labels.at(-1)}` : labels[0]} days`;
|
|
79
79
|
};
|
|
80
|
-
// A release Gloom Cloud alone lists (IPCA, the ECB) is summed up on its own: "Any release" is then the US ones'.
|
|
80
|
+
// A release Gloom Cloud alone lists (IPCA, the ECB, the BoJ) is summed up on its own: "Any release" is then the US ones'.
|
|
81
81
|
const usOnly = model.kinds.some((kind) => !US_MACRO_EVENT_KINDS.includes(kind as (typeof US_MACRO_EVENT_KINDS)[number]));
|
|
82
82
|
const missing = (event: MacroDayEvent) => event.figures ? null : event.figuresMissing
|
|
83
83
|
?? (beforeCalendar(event) ? `before ${figuresFrom}, when Gloom Cloud's economic calendar starts` : null);
|
|
@@ -213,7 +213,7 @@ export function projectMacroDays(history: readonly PricePoint[], options: {
|
|
|
213
213
|
const last = sessions.at(-1) ?? null;
|
|
214
214
|
const empty = (): MacroDayStats => stats([], null);
|
|
215
215
|
const kinds = MACRO_EVENT_KINDS.filter((kind) => US_KINDS.has(kind) || options.releases.some((release) => release.kind === kind));
|
|
216
|
-
if (!last) return { symbol: options.symbol, basis, events: [], kinds, byKind: { cpi: empty(), jobs: empty(), fomc: empty(), ipca: empty(), ecb: empty() },
|
|
216
|
+
if (!last) return { symbol: options.symbol, basis, events: [], kinds, byKind: { cpi: empty(), jobs: empty(), fomc: empty(), ipca: empty(), ecb: empty(), boj: empty() },
|
|
217
217
|
allEvents: empty(), earnings: empty(), normal: empty(), start: null, asOf: null };
|
|
218
218
|
|
|
219
219
|
// Sessions after the published lists end may be unlisted release days, so they are left out of both sides.
|
|
@@ -1,28 +1,35 @@
|
|
|
1
1
|
// Published release days, not a rule engine: the dates each release came
|
|
2
2
|
// out, read from the publishers' own archives. A release cancelled or moved (the
|
|
3
3
|
// 2025 shutdown) is as published, and a scheduled date is not a release day
|
|
4
|
-
// until it is out. Dates are New York calendar days
|
|
5
|
-
//
|
|
6
|
-
//
|
|
4
|
+
// until it is out. Dates are New York calendar days, but for the Bank of
|
|
5
|
+
// Japan's decisions, which are its own Tokyo days (announced around noon in
|
|
6
|
+
// Tokyo, after the New York close the evening before), so a day's close is the
|
|
7
|
+
// first to carry the decision. Brazil's IPCA days and the ECB's and BoJ's
|
|
8
|
+
// decision days come from Gloom Cloud only; the list the app ships with has
|
|
9
|
+
// the US releases.
|
|
7
10
|
import { zonedDateKey } from "../../../utils/zoned-date-time";
|
|
8
11
|
import { MACRO_RELEASE_TABLE } from "./release-table";
|
|
9
12
|
|
|
10
13
|
/** The US releases the bundled list carries, and the ones HIVG reads around. */
|
|
11
14
|
export type UsMacroEventKind = "cpi" | "jobs" | "fomc";
|
|
12
|
-
export type MacroEventKind = UsMacroEventKind | "ipca" | "ecb";
|
|
15
|
+
export type MacroEventKind = UsMacroEventKind | "ipca" | "ecb" | "boj";
|
|
13
16
|
|
|
14
17
|
export const US_MACRO_EVENT_KINDS: readonly UsMacroEventKind[] = ["cpi", "jobs", "fomc"];
|
|
15
|
-
/** The releases Gloom Cloud alone lists: Brazil's IPCA and the ECB's decisions. */
|
|
16
|
-
const SERVED_MACRO_EVENT_KINDS = ["ipca", "ecb"] as const satisfies readonly MacroEventKind[];
|
|
18
|
+
/** The releases Gloom Cloud alone lists: Brazil's IPCA and the ECB's and BoJ's decisions. */
|
|
19
|
+
const SERVED_MACRO_EVENT_KINDS = ["ipca", "ecb", "boj"] as const satisfies readonly MacroEventKind[];
|
|
17
20
|
export const MACRO_EVENT_KINDS: readonly MacroEventKind[] = [...US_MACRO_EVENT_KINDS, ...SERVED_MACRO_EVENT_KINDS];
|
|
18
|
-
/** The releases HIVG reads around: the US ones and the ECB's decisions. */
|
|
19
|
-
export const IV_EVENT_KINDS: readonly MacroEventKind[] = [...US_MACRO_EVENT_KINDS, "ecb"];
|
|
21
|
+
/** The releases HIVG reads around: the US ones and the ECB's and BoJ's decisions. */
|
|
22
|
+
export const IV_EVENT_KINDS: readonly MacroEventKind[] = [...US_MACRO_EVENT_KINDS, "ecb", "boj"];
|
|
23
|
+
/** The central banks' decisions: each day's row says what the meeting did and the rate after it. */
|
|
24
|
+
export const POLICY_DECISION_KINDS: ReadonlySet<MacroEventKind> = new Set(["fomc", "ecb", "boj"]);
|
|
25
|
+
/** The decisions whose next meeting Gloom Cloud lists ahead with their days. */
|
|
26
|
+
type ScheduledMacroEventKind = "ecb" | "boj";
|
|
20
27
|
|
|
21
|
-
export const MACRO_EVENT_LABELS: Record<MacroEventKind, string> = { cpi: "CPI", jobs: "Jobs", fomc: "FOMC", ipca: "IPCA", ecb: "ECB" };
|
|
28
|
+
export const MACRO_EVENT_LABELS: Record<MacroEventKind, string> = { cpi: "CPI", jobs: "Jobs", fomc: "FOMC", ipca: "IPCA", ecb: "ECB", boj: "BoJ" };
|
|
22
29
|
|
|
23
30
|
/**
|
|
24
31
|
* BLS news release archives for CPI and the Employment Situation, the Federal Reserve's meeting calendar, IBGE's
|
|
25
|
-
* calendar, the ECB's monetary policy decisions.
|
|
32
|
+
* calendar, the ECB's monetary policy decisions, the BoJ's monetary policy meetings.
|
|
26
33
|
*/
|
|
27
34
|
export const MACRO_RELEASE_SOURCES: Record<MacroEventKind, string> = {
|
|
28
35
|
cpi: "https://www.bls.gov/bls/news-release/cpi.htm",
|
|
@@ -30,6 +37,7 @@ export const MACRO_RELEASE_SOURCES: Record<MacroEventKind, string> = {
|
|
|
30
37
|
fomc: "https://www.federalreserve.gov/monetarypolicy/fomccalendars.htm",
|
|
31
38
|
ipca: "https://www.ibge.gov.br/calendario-indicadores-novoportal.html",
|
|
32
39
|
ecb: "https://www.ecb.europa.eu/press/govcdec/mopo/html/index.en.html",
|
|
40
|
+
boj: "https://www.boj.or.jp/en/mopo/mpmsche_minu/index.htm",
|
|
33
41
|
};
|
|
34
42
|
|
|
35
43
|
/** A list more than this many days behind today says so: a release day may be missing from its end. */
|
|
@@ -71,8 +79,8 @@ export interface MacroReleaseList {
|
|
|
71
79
|
coveredThrough: string;
|
|
72
80
|
/** The first day Gloom Cloud's economic calendar covers: days before it have no figures. */
|
|
73
81
|
figuresFrom?: string;
|
|
74
|
-
/** The ECB's next
|
|
75
|
-
scheduled?:
|
|
82
|
+
/** The ECB's and the BoJ's next decisions, which Gloom Cloud lists ahead. */
|
|
83
|
+
scheduled?: Partial<Record<ScheduledMacroEventKind, string>>;
|
|
76
84
|
}
|
|
77
85
|
|
|
78
86
|
const DAY_MS = 86_400_000;
|
|
@@ -104,7 +112,7 @@ function servedFigures(value: unknown): MacroReleaseFigures | undefined {
|
|
|
104
112
|
|
|
105
113
|
/**
|
|
106
114
|
* The served list extends the floor past its end; the floor keeps its own
|
|
107
|
-
* days up to there. IPCA and the ECB's decisions, which the floor does not
|
|
115
|
+
* days up to there. IPCA and the ECB's and BoJ's decisions, which the floor does not
|
|
108
116
|
* carry, are the served list's through its end, and left out when the server
|
|
109
117
|
* lists none. Every day, the
|
|
110
118
|
* floor's included, takes the figures the server has for it, or the reason it
|
|
@@ -115,7 +123,7 @@ function servedFigures(value: unknown): MacroReleaseFigures | undefined {
|
|
|
115
123
|
export function mergeMacroReleases(floor: MacroReleaseList, served: unknown): MacroReleaseList {
|
|
116
124
|
const payload = served as { coveredThrough?: unknown; releases?: Partial<Record<MacroEventKind, unknown>>;
|
|
117
125
|
figures?: Partial<Record<MacroEventKind, Record<string, unknown>>>; figuresFrom?: unknown;
|
|
118
|
-
figureGaps?: Partial<Record<MacroEventKind, Record<string, unknown>>>; scheduled?:
|
|
126
|
+
figureGaps?: Partial<Record<MacroEventKind, Record<string, unknown>>>; scheduled?: Partial<Record<ScheduledMacroEventKind, unknown>> } | null;
|
|
119
127
|
const servedThrough = payload?.coveredThrough;
|
|
120
128
|
if (!isDate(servedThrough)) return floor;
|
|
121
129
|
// The list is complete through the later of the two ends; a served list that stops short of the floor's adds figures only.
|
|
@@ -134,7 +142,8 @@ export function mergeMacroReleases(floor: MacroReleaseList, served: unknown): Ma
|
|
|
134
142
|
for (const date of new Set(dates)) if (date <= servedThrough) later.push({ kind, date });
|
|
135
143
|
}
|
|
136
144
|
const figuresFrom = isDate(payload?.figuresFrom) ? payload.figuresFrom : null;
|
|
137
|
-
const
|
|
145
|
+
const scheduled = Object.fromEntries((["ecb", "boj"] as const)
|
|
146
|
+
.flatMap((kind) => isDate(payload?.scheduled?.[kind]) ? [[kind, payload.scheduled[kind]]] : [])) as Partial<Record<ScheduledMacroEventKind, string>>;
|
|
138
147
|
const figuresOf = (release: MacroRelease): MacroRelease => {
|
|
139
148
|
const figures = servedFigures(payload?.figures?.[release.kind]?.[release.date]);
|
|
140
149
|
if (figures) return { ...release, figures };
|
|
@@ -142,7 +151,7 @@ export function mergeMacroReleases(floor: MacroReleaseList, served: unknown): Ma
|
|
|
142
151
|
return missing ? { ...release, figuresMissing: missing } : release;
|
|
143
152
|
};
|
|
144
153
|
return { releases: [...floor.releases, ...later].map(figuresOf).sort(byDate), coveredThrough, ...(figuresFrom ? { figuresFrom } : {}),
|
|
145
|
-
...(
|
|
154
|
+
...(Object.keys(scheduled).length ? { scheduled } : {}) };
|
|
146
155
|
}
|
|
147
156
|
|
|
148
157
|
/** Whole days from the list's last covered day to today in New York. */
|
|
@@ -10,7 +10,9 @@ import type { PluginModule } from "../plugin-module";
|
|
|
10
10
|
import { TICKER_RESEARCH_PANE_ID } from "../../../types/config";
|
|
11
11
|
import { publicTickerKey } from "../../../utils/exchanges";
|
|
12
12
|
import { usePaneSettingValue } from "../../../state/app/context";
|
|
13
|
-
import { useAssetData, usePluginPaneState, usePluginTickerActions } from "../../runtime";
|
|
13
|
+
import { useAssetData, usePluginPaneChoice, usePluginPaneState, usePluginTickerActions } from "../../runtime";
|
|
14
|
+
import { usePlanAccess } from "../../../api-client/plan-access";
|
|
15
|
+
import { shownPaneChoice } from "../../../core/state/app/pane-choices";
|
|
14
16
|
import { useLiveQuoteEntries } from "../../../state/hooks/quote-streaming";
|
|
15
17
|
import { useAutoRefresh } from "../../../react/auto-refresh";
|
|
16
18
|
import { useQuoteBoard } from "../shared/use-quote-board";
|
|
@@ -27,6 +29,7 @@ import {
|
|
|
27
29
|
INDEX_SHORT,
|
|
28
30
|
TABS,
|
|
29
31
|
createRows,
|
|
32
|
+
isProOnlyTab,
|
|
30
33
|
moverExtendedSessions,
|
|
31
34
|
overlayMarketMoverQuotes,
|
|
32
35
|
resolveSummarySymbols,
|
|
@@ -94,12 +97,19 @@ function MarketMoversPane({ focused, width, height }: PaneProps) {
|
|
|
94
97
|
const [requestedTab, setRequestedTab] = usePluginPaneState<TabId | null>("requestedTab", null);
|
|
95
98
|
const session = useUsSession();
|
|
96
99
|
const tabIds = useMemo(() => tabs.map((tab) => tab.id), [tabs]);
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
const freeTabIds = useMemo(() => tabIds.filter((tab) => !isProOnlyTab(tab)), [tabIds]);
|
|
101
|
+
// A list picked or asked for in this session, as opposed to restored with the workspace.
|
|
102
|
+
const [listChosen, chooseList] = usePluginPaneChoice("activeTab");
|
|
103
|
+
const [requestChosen] = usePluginPaneChoice("requestedTab");
|
|
104
|
+
const access = usePlanAccess();
|
|
105
|
+
const pick = { saved: savedTab, pickedIn, session, requested: requestedTab };
|
|
106
|
+
// Gaps restored for an account without Pro open on the list the session
|
|
107
|
+
// would show without them; the wall shows once Gaps is picked.
|
|
108
|
+
const activeTab = shownPaneChoice(resolveActiveTab({ tabs: tabIds, ...pick }), {
|
|
109
|
+
chosen: listChosen || requestChosen,
|
|
110
|
+
hasProAccess: access.hasProAccess,
|
|
111
|
+
proOnly: isProOnlyTab,
|
|
112
|
+
fallback: freeTabIds.length > 0 ? resolveActiveTab({ tabs: freeTabIds, ...pick }) : tabIds[0]!,
|
|
103
113
|
});
|
|
104
114
|
|
|
105
115
|
// The index summary is a quote board like any other, so it runs on the shared
|
|
@@ -117,10 +127,12 @@ function MarketMoversPane({ focused, width, height }: PaneProps) {
|
|
|
117
127
|
// Kept between quotes, so the tab strip skips the renders a board update gives the pane.
|
|
118
128
|
const tabItems = useMemo(() => tabs.map((tab) => ({ label: tab.label, value: tab.id })), [tabs]);
|
|
119
129
|
const selectTab = useCallback((value: string) => {
|
|
130
|
+
// Picking the list already saved changes no value, so say it was picked.
|
|
131
|
+
if (!listChosen) chooseList();
|
|
120
132
|
setSavedTab(value as TabId);
|
|
121
133
|
setPickedIn(session.key);
|
|
122
134
|
if (requestedTab) setRequestedTab(null);
|
|
123
|
-
}, [requestedTab, session.key, setPickedIn, setRequestedTab, setSavedTab]);
|
|
135
|
+
}, [chooseList, listChosen, requestedTab, session.key, setPickedIn, setRequestedTab, setSavedTab]);
|
|
124
136
|
const { strip: tabStrip } = usePaneTabs({ tabs: tabItems, activeValue: activeTab, onSelect: selectTab, focused, compact: true, variant: "bare" });
|
|
125
137
|
|
|
126
138
|
return (
|
|
@@ -26,6 +26,11 @@ export type ScreenerTabId = "gainers" | "losers" | "actives" | "trending";
|
|
|
26
26
|
export type SessionTabId = CloudSessionMoversCategory;
|
|
27
27
|
export type TabId = ScreenerTabId | SessionTabId;
|
|
28
28
|
|
|
29
|
+
/** Gaps only open with Gloom Cloud Pro; every plan reads the other lists (session-body.tsx). */
|
|
30
|
+
export function isProOnlyTab(tab: string): boolean {
|
|
31
|
+
return tab === "gaps";
|
|
32
|
+
}
|
|
33
|
+
|
|
29
34
|
export const TABS: Array<{ id: TabId; label: string }> = [
|
|
30
35
|
{ id: "gainers", label: "Gainers" },
|
|
31
36
|
{ id: "losers", label: "Losers" },
|
|
@@ -25,6 +25,7 @@ import { loadSessionMovers, SessionMoversAccessError } from "./client";
|
|
|
25
25
|
import { ANY_FLOAT, minFloatEmptyTitle, minFloatFilter, minFloatShares, partialFloatFooter } from "./min-float";
|
|
26
26
|
import { summaryFooterSegments } from "./footer";
|
|
27
27
|
import type { MarketSummaryQuote } from "./screener";
|
|
28
|
+
import { isProOnlyTab } from "./model";
|
|
28
29
|
import {
|
|
29
30
|
earlierSessionLabel,
|
|
30
31
|
listAsOfLabel,
|
|
@@ -67,7 +68,7 @@ export function SessionMoversBody(props: {
|
|
|
67
68
|
liveStreaming: boolean;
|
|
68
69
|
}) {
|
|
69
70
|
const access = usePlanAccess();
|
|
70
|
-
const proOnly = props.view
|
|
71
|
+
const proOnly = isProOnlyTab(props.view);
|
|
71
72
|
const [denied, setDenied] = useState(false);
|
|
72
73
|
const deny = useCallback(() => setDenied(true), []);
|
|
73
74
|
// A refusal is about the plan the account had then; a new plan asks again.
|
|
@@ -4,6 +4,15 @@ import { fetchHongKongMoneyMarkets, fetchMoneyMarkets } from "./client";
|
|
|
4
4
|
import { isHongKongTab, MONEY_MARKET_TABS, moneyMarketChange, moneyMarketNotices, moneyMarketRowNotices, moneyMarketRows, moneyMarketValue } from "./model";
|
|
5
5
|
|
|
6
6
|
const FRED_FRESHNESS = { source: "FRED", status: "not-a-feed", basis: "published daily and weekly data" } as const;
|
|
7
|
+
const HONG_KONG_FRESHNESS = { ...FRED_FRESHNESS, source: "HKMA", basis: "published Exchange Fund Bill closing yields" } as const;
|
|
8
|
+
|
|
9
|
+
/** The rows a view reports, without their histories, and what the view declares about them beyond the definition. */
|
|
10
|
+
export function moneyMarketReport(rows: readonly MoneyMarketRow[], hongKong: boolean) {
|
|
11
|
+
return {
|
|
12
|
+
...hongKong ? { freshness: HONG_KONG_FRESHNESS } : {},
|
|
13
|
+
rows: rows.map(({ history: _history, ...row }) => ({ ...row, percentileValue: row.percentile.value })),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
7
16
|
|
|
8
17
|
export const moneyMarketsHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
9
18
|
discovery: { aliases: ["BTMM"], dataRequirements: ["Gloom Cloud money-markets endpoint"],
|
|
@@ -20,7 +29,8 @@ export const moneyMarketsHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
20
29
|
const rows: MoneyMarketRow[] = "billsCurve" in data ? moneyMarketRows(data, String(args.options.tab)) : data.rows;
|
|
21
30
|
const errors = "billsCurve" in data ? moneyMarketNotices(data) : moneyMarketRowNotices(data.rows);
|
|
22
31
|
const complete = data.status === "available" && errors.length === 0;
|
|
23
|
-
|
|
32
|
+
const report = moneyMarketReport(rows, hongKong);
|
|
33
|
+
return { complete, ...report.freshness ? { freshness: report.freshness } : {},
|
|
24
34
|
sections: [{ title: hongKong ? "Exchange Fund Bill yields" : "Observations", columns: [
|
|
25
35
|
{ key: "label", header: "Instrument" },
|
|
26
36
|
{ key: "value", header: "Level", align: "right", format: (value, row) => moneyMarketValue(value as number | null, row.unit as "percent" | "usd-billions") },
|
|
@@ -29,7 +39,7 @@ export const moneyMarketsHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
29
39
|
{ key: "previousAsOf", header: "Versus", shrink: false, stackPriority: 1 },
|
|
30
40
|
{ key: "percentileValue", header: "Pctl 1Y", align: "right", stackPriority: 2, format: (value) => value == null ? "--" : Number(value).toFixed(0) },
|
|
31
41
|
{ key: "asOf", header: "As of", shrink: false }, { key: "status", header: "Status", stackPriority: 3 },
|
|
32
|
-
], rows: rows
|
|
42
|
+
], rows: report.rows }],
|
|
33
43
|
errors, unavailableSymbols: rows.filter((row) => row.status === "unavailable").flatMap((row) => row.sourceSeriesIds.length ? row.sourceSeriesIds : [row.label]),
|
|
34
44
|
metadata: { ...data, complete, selectedTab: args.options.tab } };
|
|
35
45
|
},
|