@gloom-sh/terminal 0.20.18 → 0.20.19
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 +1 -1
- package/src/api-client/cot.ts +5 -6
- package/src/api-client/data.ts +11 -1
- package/src/api-client/index.ts +1 -0
- package/src/api-client/request.ts +162 -40
- package/src/api-client/types/news.ts +45 -0
- package/src/api-client/types/world-venues.ts +9 -0
- package/src/app.tsx +4 -2
- package/src/architecture/floating-promise-allowlist.json +1 -1
- package/src/cli/commands/market.ts +53 -17
- package/src/cli/commands/ticker.ts +13 -6
- package/src/cli/context.ts +8 -0
- package/src/cli/desktop-pane-shot-browser.ts +3 -1
- package/src/cli/desktop-pane-shot-view.ts +0 -1
- package/src/cli/desktop-pane-shot.ts +204 -43
- package/src/cli/errors.ts +3 -9
- package/src/cli/exit-codes.ts +1 -1
- package/src/cli/glossary.ts +1 -1
- package/src/cli/help.ts +1 -1
- package/src/cli/history-rows.ts +2 -2
- package/src/cli/index.ts +1 -1
- package/src/cli/listing-arg.ts +87 -23
- package/src/cli/pane-functions/catalog-snapshot.json +17 -6
- package/src/cli/pane-functions/dom.ts +30 -2
- package/src/cli/pane-functions/freshness.ts +23 -4
- package/src/cli/pane-functions/function-help.ts +3 -3
- package/src/cli/pane-functions/headless.ts +9 -1
- package/src/cli/pane-functions/index.ts +77 -10
- package/src/cli/pane-functions/report-notices.ts +10 -0
- package/src/cli/pane-functions/resolver.ts +3 -2
- package/src/cli/pane-functions/screenshot-assessment.ts +10 -5
- package/src/cli/pane-functions/screenshot-data-evidence.ts +7 -15
- package/src/cli/pane-functions/screenshot-payload.ts +24 -10
- package/src/cli/pane-functions/screenshot-render.ts +21 -8
- package/src/cli/pane-functions/screenshot-types.ts +9 -0
- package/src/cli/quote-answer.ts +1 -1
- package/src/cli/result.ts +17 -0
- package/src/cli/scroll-truncation.ts +7 -2
- package/src/cli/ticker-resolution.ts +1 -1
- package/src/cli/unreachable.ts +21 -0
- package/src/components/chart/composite/drawing-store.ts +11 -7
- package/src/components/chart/composite/format.ts +1 -0
- package/src/components/chart/composite/legend.tsx +5 -2
- package/src/components/chart/composite/panel-surface/plot-gestures.ts +9 -2
- package/src/components/chart/composite/panel-surface.tsx +1 -1
- package/src/components/chart/composite/tools.ts +164 -39
- package/src/components/chart-table/header.tsx +2 -2
- package/src/components/chart-table/layout.ts +5 -6
- package/src/components/command-bar/routes/root/runtime.ts +11 -3
- package/src/components/command-bar/routes/ticker-search/results.ts +5 -0
- package/src/components/command-bar/selection-runtime.ts +29 -5
- package/src/components/command-bar/surface/index.tsx +4 -1
- package/src/components/command-bar/workflow/alert.ts +13 -5
- package/src/components/layout/pane/footer/model.ts +10 -2
- package/src/components/layout/pane/status-footer.ts +24 -0
- package/src/components/price-performance.tsx +26 -8
- package/src/components/reader/article-reader.tsx +12 -5
- package/src/components/ui/data-table/opentui/index.tsx +7 -0
- package/src/components/ui/table-layout.ts +32 -1
- package/src/market-data/ah-pair.ts +19 -0
- package/src/market-data/coordinator/entries.ts +6 -4
- package/src/market-data/coordinator/index.ts +14 -3
- package/src/market-data/futures-board.ts +36 -29
- package/src/market-data/futures-contract.ts +37 -1
- package/src/market-data/market/change-basis.ts +9 -0
- package/src/market-data/market/status.ts +40 -4
- package/src/market-data/performance.ts +127 -32
- package/src/market-data/quotes/time.ts +5 -2
- package/src/news/types.ts +28 -0
- package/src/notifications/app-badge.ts +2 -3
- package/src/notifications/app-notifier.ts +5 -0
- package/src/plugins/builtin/alerts/cli.ts +65 -18
- package/src/plugins/builtin/alerts/command.ts +39 -9
- package/src/plugins/builtin/alerts/event-rows.ts +9 -3
- package/src/plugins/builtin/alerts/events-pane.tsx +16 -10
- package/src/plugins/builtin/alerts/headless.ts +12 -6
- package/src/plugins/builtin/alerts/index.tsx +60 -8
- package/src/plugins/builtin/alerts/option-contract.ts +197 -0
- package/src/plugins/builtin/alerts/price.ts +30 -5
- package/src/plugins/builtin/alerts/pro-rules.ts +62 -0
- package/src/plugins/builtin/alerts/research-builder.ts +5 -10
- package/src/plugins/builtin/analytics/account-returns.ts +1 -1
- package/src/plugins/builtin/analytics/pane-model.ts +2 -2
- package/src/plugins/builtin/analytics/risk-client.ts +1 -1
- package/src/plugins/builtin/buildout/company/pane.tsx +4 -14
- package/src/plugins/builtin/catalysts/model.ts +2 -1
- package/src/plugins/builtin/chart-composer/chart-spec.ts +5 -0
- package/src/plugins/builtin/chart-composer/cli-options.ts +5 -3
- package/src/plugins/builtin/chart-composer/headless-schema.ts +14 -10
- package/src/plugins/builtin/chart-composer/headless.ts +2 -0
- package/src/plugins/builtin/chart-composer/index.tsx +17 -5
- package/src/plugins/builtin/chart-composer/pane.tsx +14 -4
- package/src/plugins/builtin/chart-composer/viewport-labels.ts +2 -17
- package/src/plugins/builtin/chat/controller/notifications.ts +1 -0
- package/src/plugins/builtin/chat/index.tsx +0 -1
- package/src/plugins/builtin/commodities-energy/index.tsx +1 -1
- package/src/plugins/builtin/company-kpis/headless.ts +1 -1
- package/src/plugins/builtin/company-kpis/model.ts +21 -9
- package/src/plugins/builtin/congress-trades/model.ts +9 -5
- package/src/plugins/builtin/cot/client.ts +2 -3
- package/src/plugins/builtin/cot/headless.ts +16 -16
- package/src/plugins/builtin/cot/index.tsx +6 -6
- package/src/plugins/builtin/cot/model.ts +25 -5
- package/src/plugins/builtin/cot/pane.tsx +11 -6
- package/src/plugins/builtin/cot/series.ts +11 -8
- package/src/plugins/builtin/cpi/model.ts +15 -4
- package/src/plugins/builtin/cpi/pane.tsx +29 -7
- package/src/plugins/builtin/doe/model.ts +30 -0
- package/src/plugins/builtin/doe/pane.tsx +8 -2
- package/src/plugins/builtin/earnings/board-table.ts +9 -4
- package/src/plugins/builtin/earnings/headless.ts +10 -3
- package/src/plugins/builtin/earnings/history-table.ts +4 -2
- package/src/plugins/builtin/earnings-calls/calendar.tsx +4 -3
- package/src/plugins/builtin/earnings-ripple/pane.tsx +2 -2
- package/src/plugins/builtin/econ/index.tsx +4 -2
- package/src/plugins/builtin/futures/model.ts +14 -1
- package/src/plugins/builtin/futures/series.ts +1 -8
- package/src/plugins/builtin/fx-matrix/index.tsx +2 -2
- package/src/plugins/builtin/insider/detail.tsx +36 -7
- package/src/plugins/builtin/insider/filing-stories.ts +110 -0
- package/src/plugins/builtin/insider/headless.ts +37 -2
- package/src/plugins/builtin/insider/index.tsx +79 -10
- package/src/plugins/builtin/insider/model.ts +43 -5
- package/src/plugins/builtin/ipo-calendar/client.ts +11 -1
- package/src/plugins/builtin/ipo-calendar/model.ts +3 -7
- package/src/plugins/builtin/jobs/headless.ts +2 -1
- package/src/plugins/builtin/jobs/model.ts +6 -0
- package/src/plugins/builtin/jobs/pane.tsx +8 -3
- package/src/plugins/builtin/news/wire/news/detail-view.tsx +118 -10
- package/src/plugins/builtin/news/wire/news/story-evidence.ts +178 -0
- package/src/plugins/builtin/options/analytics.ts +1 -1
- package/src/plugins/builtin/options/view.tsx +18 -11
- package/src/plugins/builtin/options-positioning/model.ts +11 -0
- package/src/plugins/builtin/options-positioning/pane.tsx +22 -1
- package/src/plugins/builtin/options-scenario/client.ts +49 -8
- package/src/plugins/builtin/options-scenario/headless.ts +7 -3
- package/src/plugins/builtin/options-scenario/model.ts +33 -2
- package/src/plugins/builtin/options-scenario/pane.tsx +3 -4
- package/src/plugins/builtin/perps/cascade.ts +4 -3
- package/src/plugins/builtin/perps/markets-section.tsx +5 -2
- package/src/plugins/builtin/perps/model.ts +4 -3
- package/src/plugins/builtin/portfolio-list/table.tsx +3 -2
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +29 -14
- package/src/plugins/builtin/research/event-model.ts +12 -6
- package/src/plugins/builtin/research-search/index.tsx +3 -1
- package/src/plugins/builtin/scanner/denied.tsx +16 -4
- package/src/plugins/builtin/scanner/flow-pane.tsx +1 -1
- package/src/plugins/builtin/scanner/hilo-pane.tsx +1 -1
- package/src/plugins/builtin/sec/filing-display.tsx +14 -2
- package/src/plugins/builtin/sec/headless.ts +42 -4
- package/src/plugins/builtin/sec/index.tsx +21 -1
- package/src/plugins/builtin/sectors/sector-model.ts +1 -1
- package/src/plugins/builtin/shared/earnings-report.ts +32 -3
- package/src/plugins/builtin/shared/options-pro-copy.ts +34 -0
- package/src/plugins/builtin/shared/statement-currency.ts +23 -0
- package/src/plugins/builtin/shared/ticker-surface.ts +1 -1
- package/src/plugins/builtin/supply-chain/pane.tsx +4 -3
- package/src/plugins/builtin/themes/headless.ts +4 -4
- package/src/plugins/builtin/themes/model.ts +11 -8
- package/src/plugins/builtin/themes/pane.tsx +2 -2
- package/src/plugins/builtin/ticker-detail/financials/model.ts +22 -32
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +7 -9
- package/src/plugins/builtin/ticker-detail/headless-schema.ts +2 -0
- package/src/plugins/builtin/ticker-detail/headless.ts +28 -12
- package/src/plugins/builtin/ticker-detail/overview/board-lot.ts +21 -0
- package/src/plugins/builtin/ticker-detail/overview/model.ts +11 -1
- package/src/plugins/builtin/ticker-detail/overview/pane.tsx +4 -0
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +61 -13
- package/src/plugins/builtin/volatility/pane.tsx +3 -3
- package/src/plugins/builtin/world-venue-map/headless.ts +4 -2
- package/src/plugins/builtin/world-venue-map/model.ts +6 -1
- package/src/plugins/builtin/world-venue-map/venue-header.tsx +5 -3
- package/src/plugins/catalog-browser.ts +10 -1
- package/src/renderers/browser/activity.ts +16 -0
- package/src/renderers/browser/app-badge-host.ts +14 -0
- package/src/renderers/browser/main.tsx +5 -0
- package/src/renderers/browser/notifications.ts +103 -0
- package/src/renderers/browser/ui-host.tsx +4 -0
- package/src/renderers/dom/data-table/index.tsx +27 -4
- package/src/renderers/electrobun/view/http-fetch.ts +3 -2
- package/src/sources/gloomberb-cloud/index.ts +8 -6
- package/src/sources/gloomberb-cloud/news.ts +35 -0
- package/src/sources/provider-errors.ts +34 -7
- package/src/sources/provider-router/history.ts +32 -6
- package/src/time-series/base-series.ts +39 -6
- package/src/time-series/chart-seed.ts +2 -2
- package/src/time-series/history-quality.ts +4 -1
- package/src/time-series/hooks.ts +2 -0
- package/src/time-series/price-comparison.ts +17 -23
- package/src/time-series/reporting.ts +1 -1
- package/src/time-series/resolution.ts +13 -0
- package/src/time-series/resolve-context.ts +6 -0
- package/src/time-series/resolve.ts +39 -2
- package/src/time-series/types.ts +2 -1
- package/src/types/financials.ts +9 -1
- package/src/types/headless.ts +1 -0
- package/src/types/issuer-listings.ts +2 -0
- package/src/types/plugin-notifications.ts +3 -0
- package/src/types/price-history.ts +6 -4
- package/src/ui/host.tsx +2 -0
- package/src/utils/exchange-announcements.ts +7 -2
- package/src/utils/fundamentals.ts +40 -0
- package/src/utils/network-failure.ts +2 -0
- package/src/utils/price-history-integrity.ts +9 -1
|
@@ -3,6 +3,8 @@ import { useCallback, useMemo, useRef, useState } from "react";
|
|
|
3
3
|
import { ChartTableHeader, CompositeChart, DataTableStackView, spanDigits, DataTableView, PaneStatusBody, QueryBar, usePaneFooter, usePaneNoticeFooter, usePaneStatusFooter, usePaneTabs, useQueryBarSearch, type ChartTableChart, type DataTableColumn, type SelectControl } from "../../../components";
|
|
4
4
|
import { useAsyncResource, usePluginPaneState, useShortcut } from "../../../public/react";
|
|
5
5
|
import { usePaneInstance } from "../../../state/app/context";
|
|
6
|
+
import { COMMODITIES_ENERGY_PANE_ID } from "../commodities-energy/view-state";
|
|
7
|
+
import { useCommandValue } from "../shared/command-tab";
|
|
6
8
|
import { useThemeColors } from "../../../theme/theme-context";
|
|
7
9
|
import type { PaneProps } from "../../../types/plugin";
|
|
8
10
|
import type { ResolvedSeries } from "../../../time-series/types";
|
|
@@ -49,7 +51,8 @@ const cotDetailTitle = (name: string | undefined, code: string | null) => name ?
|
|
|
49
51
|
|
|
50
52
|
export function CotPane(props: PaneProps) {
|
|
51
53
|
const pane = usePaneInstance();
|
|
52
|
-
const [storedFamily, setFamily] =
|
|
54
|
+
const [storedFamily, setFamily] = useCommandValue<CotFamily>(COMMODITIES_ENERGY_PANE_ID, "report",
|
|
55
|
+
(params) => params.tab === "positioning" && params.cotReport ? cotFamily(params.cotReport) : null, cotFamily(pane?.settings?.report));
|
|
53
56
|
const family = cotFamily(storedFamily);
|
|
54
57
|
const { strip: tabStrip, rows: tabRows } = usePaneTabs({ tabs: [...COT_FAMILIES], activeValue: family, onSelect: (value) => setFamily(value as CotFamily), focused: props.focused, dense: true });
|
|
55
58
|
return <Box width={props.width} height={props.height} flexDirection="column">
|
|
@@ -62,10 +65,12 @@ function CotBoard({ width, height, focused, family, initialCode }: PaneProps & {
|
|
|
62
65
|
const session = useResearchCloudSession();
|
|
63
66
|
const [storedClass, setClass] = usePluginPaneState<CotClass>("class", COT_CLASSES[family][0]!.value);
|
|
64
67
|
const traderClass = cotClass(family, storedClass);
|
|
65
|
-
const [selected, setSelected] =
|
|
68
|
+
const [selected, setSelected] = useCommandValue<string | null>(COMMODITIES_ENERGY_PANE_ID, "selected",
|
|
69
|
+
(params) => params.tab === "positioning" ? params.code ?? null : null, initialCode);
|
|
66
70
|
// A closed detail is stored as "": pane state reads null as unset, so Back
|
|
67
71
|
// would fall through to the deep-linked code and reopen it.
|
|
68
|
-
const [storedOpen, setOpen] =
|
|
72
|
+
const [storedOpen, setOpen] = useCommandValue<string>(COMMODITIES_ENERGY_PANE_ID, "open",
|
|
73
|
+
(params) => params.tab === "positioning" ? params.code ?? null : null, initialCode ?? "");
|
|
69
74
|
const open = storedOpen || null;
|
|
70
75
|
const [storedScope, setScope] = usePluginPaneState<CotScope>("scope", "major");
|
|
71
76
|
const scope = cotScope(storedScope);
|
|
@@ -111,7 +116,7 @@ function CotBoard({ width, height, focused, family, initialCode }: PaneProps & {
|
|
|
111
116
|
] : [] }), [boardShown, focusSearch]);
|
|
112
117
|
usePaneNoticeFooter({ registrationId: "cot:board-notices", focused, enabled: !open, notices: data?.gaps ?? [] });
|
|
113
118
|
usePaneStatusFooter({ registrationId: "cot:board", enabled: !open, loading: resource.loading, error: resource.error,
|
|
114
|
-
info: data ? [{ id: "as-of", parts: [{ text:
|
|
119
|
+
info: data ? [{ id: "as-of", parts: [{ text: `${cotPositionsText(positions)} · as of ${data.asOf ?? MISSING_VALUE} · contracts`, tone: "muted" }] }] : [] });
|
|
115
120
|
// A class change reloads under the query bar, which stays.
|
|
116
121
|
return <DataTableStackView<CotBoardRow> columns={BOARD_COLUMNS} items={rows} focused={focused && !searching}
|
|
117
122
|
status={data ? undefined : { loading: resource.loading, error: resource.error, empty: !resource.loading && !resource.error, subject: "COT history" }}
|
|
@@ -127,7 +132,7 @@ function CotBoard({ width, height, focused, family, initialCode }: PaneProps & {
|
|
|
127
132
|
return { text: row.reportDate, color: colors.textMuted };
|
|
128
133
|
}}
|
|
129
134
|
rootBefore={<QueryBar width={width}
|
|
130
|
-
search={{ value: query, onChange: setQuery, placeholder: "market or
|
|
135
|
+
search={{ value: query, onChange: setQuery, placeholder: "market or COT code", focused, ...searchProps }}
|
|
131
136
|
filters={[
|
|
132
137
|
{ id: "class", label: "Class", value: traderClass, options: COT_CLASSES[family], onChange: setClass, controlRef: control },
|
|
133
138
|
{ id: "scope", label: "Scope", value: scope, defaultValue: "major", options: [...COT_SCOPES], onChange: setScope, controlRef: scopeControl },
|
|
@@ -197,7 +202,7 @@ function CotDetail({ width, height, focused, code, family, positions, traderClas
|
|
|
197
202
|
usePaneStatusFooter({ registrationId: "cot:detail", loading: resource.loading, error: resource.error,
|
|
198
203
|
// The unit the net is counted in, as `fn COT` titles it: what one contract is, where the report says.
|
|
199
204
|
// Futures and options combined says so; futures only reads as it always has.
|
|
200
|
-
info: payload ? [{ id: "as-of", parts: [{ text:
|
|
205
|
+
info: payload ? [{ id: "as-of", parts: [{ text: `${positions === "combined" ? `${cotPositionsText(positions)} · ` : ""}as of ${payload.asOf ?? MISSING_VALUE} · ${cotContractUnitText(payload.contract?.contractUnits) ?? "contracts"}${data?.priceAsOf ? ` · ${data.priceSymbol} ${data.priceAsOf}` : ""}`, tone: "muted" }] }] : [] });
|
|
201
206
|
return <PaneStatusBody loading={resource.loading && !data} error={!data ? resource.error : null} empty={!!payload && !payload.contract} subject="COT contract">
|
|
202
207
|
{payload && data ? <DataTableView columns={POSITION_COLUMNS} items={payload.positions} focused={focused} rootWidth={width} rootHeight={height}
|
|
203
208
|
rootBefore={<ChartTableHeader width={width} height={height} tableRows={payload.positions.length} chart={chart}
|
|
@@ -1,27 +1,30 @@
|
|
|
1
1
|
import type { SeriesDefinition } from "../../../series/types";
|
|
2
2
|
import { fetchCotContract } from "./client";
|
|
3
|
-
import { COT_ROOT_OPTIONS, cotContractCode, cotNetPoints } from "./model";
|
|
3
|
+
import { COT_ROOT_OPTIONS, cotContractCode, cotDefaultFamily, cotNetPoints } from "./model";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Speculative
|
|
7
|
-
*
|
|
6
|
+
* Speculative net positioning for each market the COT pane names by root:
|
|
7
|
+
* CFTC noncommercial or ICE Europe's managed money. The pane's other
|
|
8
8
|
* trader classes and markets stay in the pane.
|
|
9
9
|
*/
|
|
10
10
|
export const COT_SERIES: readonly SeriesDefinition[] = COT_ROOT_OPTIONS.flatMap((option): SeriesDefinition[] => {
|
|
11
11
|
const code = cotContractCode(option.value);
|
|
12
12
|
if (!code) return [];
|
|
13
|
+
const family = cotDefaultFamily(code);
|
|
14
|
+
const traderClass = family === "disaggregated" ? "managed-money" : "noncommercial";
|
|
15
|
+
const className = family === "disaggregated" ? "managed money" : "noncommercial";
|
|
13
16
|
const market = option.label.startsWith(`${option.value} `) ? option.label.slice(option.value.length + 1) : option.label;
|
|
14
17
|
return [{
|
|
15
|
-
id: `cot:${option.value.toLowerCase()}-
|
|
16
|
-
name: `${market}:
|
|
18
|
+
id: `cot:${option.value.toLowerCase().replace(/\s+/g, "-")}-${traderClass}-net`,
|
|
19
|
+
name: `${market}: ${className} net position`,
|
|
17
20
|
unit: "contracts",
|
|
18
21
|
frequency: "weekly",
|
|
19
22
|
group: "Positioning",
|
|
20
23
|
tags: ["COT", "commitments of traders", "speculators", "net spec", option.value],
|
|
21
|
-
publisher: "CFTC",
|
|
24
|
+
publisher: family === "disaggregated" ? "ICE Futures Europe" : "CFTC",
|
|
22
25
|
load: async () => {
|
|
23
|
-
const payload = await fetchCotContract(code,
|
|
24
|
-
return { points: cotNetPoints(payload.history,
|
|
26
|
+
const payload = await fetchCotContract(code, family);
|
|
27
|
+
return { points: cotNetPoints(payload.history, traderClass).map((point) => ({ date: point.date, value: point.value })) };
|
|
25
28
|
},
|
|
26
29
|
}];
|
|
27
30
|
});
|
|
@@ -124,11 +124,22 @@ function releaseTime(iso: string): string {
|
|
|
124
124
|
* 14 Oct 08:30 ET". A release past its time and not in yet reads "due".
|
|
125
125
|
*/
|
|
126
126
|
export function cpiHeaderLine(release: CpiReleaseStatus, now = Date.now()): string | undefined {
|
|
127
|
+
const stamp = cpiReleaseStamp(release);
|
|
128
|
+
if (!stamp) return undefined;
|
|
129
|
+
const next = cpiNextRelease(release, now);
|
|
130
|
+
return next ? `${stamp} · ${next}` : stamp;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** The month the data covers and when it came out: "Aug 2026 · released Fri 11 Sep 08:30 ET". What the pane's bar keeps whole. */
|
|
134
|
+
export function cpiReleaseStamp(release: CpiReleaseStatus): string | undefined {
|
|
127
135
|
if (!release.period) return undefined;
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
136
|
+
return release.releasedAt ? `${cpiMonth(release.period)} · released ${releaseTime(release.releasedAt)}` : cpiMonth(release.period);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** When the next release is due, "next Wed 14 Oct 08:30 ET" ("due" once past its time): what gives way in a narrow pane. */
|
|
140
|
+
export function cpiNextRelease(release: CpiReleaseStatus, now = Date.now()): string | undefined {
|
|
141
|
+
if (!release.nextReleaseAt) return undefined;
|
|
142
|
+
return `${Date.parse(release.nextReleaseAt) <= now ? "due" : "next"} ${releaseTime(release.nextReleaseAt)}`;
|
|
132
143
|
}
|
|
133
144
|
|
|
134
145
|
/** The first of the month a change is for, which the chart plots it on. */
|
|
@@ -22,15 +22,17 @@ import { useThemeColors } from "../../../theme/theme-context";
|
|
|
22
22
|
import type { ResolvedSeries } from "../../../time-series/types";
|
|
23
23
|
import type { PaneProps } from "../../../types/plugin";
|
|
24
24
|
import { Box, TextAttributes } from "../../../ui";
|
|
25
|
+
import { getTableWidth } from "../../../components/ui/table-layout";
|
|
25
26
|
import { nextHeaderSort } from "../../../utils/sort-values";
|
|
26
27
|
import { CPI_NOT_AVAILABLE, getCachedCpiBoard, loadCpiBoard } from "./client";
|
|
27
28
|
import {
|
|
28
29
|
CPI_TABLE_ORDER,
|
|
29
30
|
cpiChartSeries,
|
|
30
31
|
cpiChartStrip,
|
|
31
|
-
cpiHeaderLine,
|
|
32
32
|
cpiHeadlineYearGapLine,
|
|
33
33
|
cpiMonthDate,
|
|
34
|
+
cpiNextRelease,
|
|
35
|
+
cpiReleaseStamp,
|
|
34
36
|
cpiRowLabel,
|
|
35
37
|
cpiRows,
|
|
36
38
|
cpiTimeAxis,
|
|
@@ -43,8 +45,7 @@ import {
|
|
|
43
45
|
|
|
44
46
|
// The figures share the width a wide pane adds with the names, so they do not
|
|
45
47
|
// huddle at the right edge; in the terminal the name column takes it all.
|
|
46
|
-
const
|
|
47
|
-
{ id: "name", label: "Component", width: 22, align: "left", flexGrow: 4 },
|
|
48
|
+
const FIGURE_COLUMNS: DataTableColumn[] = [
|
|
48
49
|
{ id: "weight", label: "Wgt", width: 6, align: "right", flexGrow: 1 },
|
|
49
50
|
{ id: "change", label: "M/M", width: 7, align: "right", flexGrow: 1 },
|
|
50
51
|
{ id: "annualized3m", label: "3M Ann", width: 7, align: "right", flexGrow: 1 },
|
|
@@ -53,6 +54,24 @@ const COLUMNS: DataTableColumn[] = [
|
|
|
53
54
|
{ id: "contribution", label: "M/M Pts", width: 8, align: "right", flexGrow: 1 },
|
|
54
55
|
{ id: "contributionYoy", label: "Y/Y Pts", width: 8, align: "right", flexGrow: 1, omitWhenEmpty: true },
|
|
55
56
|
];
|
|
57
|
+
/** The names' widest, and the narrowest they are cut to before the figures scroll. */
|
|
58
|
+
const NAME_WIDTH = 22;
|
|
59
|
+
const NAME_MIN_WIDTH = 10;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The columns at a pane's width: the name takes the room the figures leave, up
|
|
63
|
+
* to its full width, and is cut before a figure scrolls out of view, as the
|
|
64
|
+
* sector and index boards size theirs. The Y/Y points count only when a row has
|
|
65
|
+
* them, since the column is left out while none does.
|
|
66
|
+
*/
|
|
67
|
+
function cpiColumns(width: number, yoyPoints: boolean): DataTableColumn[] {
|
|
68
|
+
const figures = yoyPoints ? FIGURE_COLUMNS : FIGURE_COLUMNS.filter((column) => column.id !== "contributionYoy");
|
|
69
|
+
const room = width - getTableWidth(figures) - 1;
|
|
70
|
+
return [
|
|
71
|
+
{ id: "name", label: "Component", width: Math.max(NAME_MIN_WIDTH, Math.min(NAME_WIDTH, room)), align: "left", flexGrow: 4 },
|
|
72
|
+
...FIGURE_COLUMNS,
|
|
73
|
+
];
|
|
74
|
+
}
|
|
56
75
|
const PANELS = [{ id: "main" }];
|
|
57
76
|
/** Legend, four plot rows and the time axis; the read under them takes its own rows. */
|
|
58
77
|
const CHART_ROWS_ABOVE_READ = 6;
|
|
@@ -92,7 +111,10 @@ function CpiBoard({ payload, initialRow, width, height, focused }: {
|
|
|
92
111
|
const selected = rows.find((row) => row.id === selectedId) ?? rows[0] ?? null;
|
|
93
112
|
const headline = payload.rows.find((row) => row.code === "SA0") ?? null;
|
|
94
113
|
const series = useMemo(() => selected ? cpiChartSeries(selected, headline, colors) : [], [selected, headline, colors]);
|
|
95
|
-
|
|
114
|
+
// The release stays whole in a narrow pane; when the next one is due gives way first.
|
|
115
|
+
const stamp = cpiReleaseStamp(payload.release);
|
|
116
|
+
const next = cpiNextRelease(payload.release);
|
|
117
|
+
const columns = useMemo(() => cpiColumns(width, rows.some((row) => row.contributionYoy != null)), [rows, width]);
|
|
96
118
|
// Room for the longest read at this width, so the chart does not give way to the strip as the selection moves.
|
|
97
119
|
const readRows = useChartReadRows(rows.map((row) => row.read), width);
|
|
98
120
|
const chart: ChartTableChart | null = selected ? {
|
|
@@ -109,9 +131,9 @@ function CpiBoard({ payload, initialRow, width, height, focused }: {
|
|
|
109
131
|
text, value, color: value == null || Number(text) === 0 ? colors.textDim : priceColor(value, colors),
|
|
110
132
|
});
|
|
111
133
|
return (
|
|
112
|
-
<DataTableView<CpiRow> columns={
|
|
113
|
-
rootBefore={<ChartTableHeader width={width} height={height} tableRows={rows.length} tableColumns={
|
|
114
|
-
query={
|
|
134
|
+
<DataTableView<CpiRow> columns={columns} items={rows} focused={focused} rootWidth={width} rootHeight={height}
|
|
135
|
+
rootBefore={<ChartTableHeader width={width} height={height} tableRows={rows.length} tableColumns={columns}
|
|
136
|
+
query={stamp ? <QueryBar width={width} asOf={stamp} meta={next} /> : undefined} chart={chart} />}
|
|
115
137
|
selection={{ kind: "id", selectedId: selected?.id ?? null, getId: (row) => row.id, onChange: setSelectedId }}
|
|
116
138
|
onActivate={(row) => setSelectedId(row.id)} getItemKey={(row) => row.id}
|
|
117
139
|
sortColumnId={sort.columnId} sortDirection={sort.direction} onHeaderClick={onHeaderClick}
|
|
@@ -5,6 +5,8 @@ import type { ChartStripSpec } from "../../../components/chart-table/header";
|
|
|
5
5
|
import { staticSeries } from "../../../components/chart/static/series";
|
|
6
6
|
import { blendHex } from "../../../theme/color-utils";
|
|
7
7
|
import type { ResolvedSeries } from "../../../time-series/types";
|
|
8
|
+
import { FUTURES_SECTOR_LABELS, type FuturesSector } from "../../../market-data/futures-board";
|
|
9
|
+
import { futuresSearchContracts } from "../futures/model";
|
|
8
10
|
|
|
9
11
|
export const DOE_TABS: ReadonlyArray<{ value: DoeTab; label: string }> = [
|
|
10
12
|
{ value: "crude", label: "Crude" },
|
|
@@ -49,6 +51,34 @@ export function doeSeriesOption(input: string | undefined) {
|
|
|
49
51
|
.some((name) => squash(name) === typed)) ?? null;
|
|
50
52
|
}
|
|
51
53
|
|
|
54
|
+
/** Futures on something that is held in stock: their inventories would be a board of their own. */
|
|
55
|
+
const PHYSICAL_SECTORS: ReadonlySet<FuturesSector> = new Set(["metals", "agriculture", "livestock"]);
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* What the inventories board says when the futures search it opened from
|
|
59
|
+
* (`fn FUT HG --tab inventories`) names no energy contract: what it covers,
|
|
60
|
+
* and that the contract's stocks are not on it (a financial future has none).
|
|
61
|
+
* Null for an energy search, one that names nothing, or none at all.
|
|
62
|
+
*/
|
|
63
|
+
export function doeCoverageNote(query: string | null | undefined): string | null {
|
|
64
|
+
const typed = query?.trim();
|
|
65
|
+
if (!typed) return null;
|
|
66
|
+
const contracts = futuresSearchContracts(typed);
|
|
67
|
+
if (!contracts.length || contracts.some((contract) => contract.sector === "energy")) return null;
|
|
68
|
+
const covers = "Covers US oil and gas inventories only";
|
|
69
|
+
const [only] = contracts;
|
|
70
|
+
// A name a full-size contract and its micro share (copper: HG and MHG) names the one called that.
|
|
71
|
+
const contract = contracts.length === 1 ? only : contracts.find((entry) => entry.name.toLowerCase() === typed.toLowerCase());
|
|
72
|
+
const named = contract ? `${contract.name} (${contract.code})` : null;
|
|
73
|
+
const physical = contracts.filter((contract) => PHYSICAL_SECTORS.has(contract.sector));
|
|
74
|
+
if (physical.length === contracts.length) {
|
|
75
|
+
const sectors = [...new Set(contracts.map((contract) => FUTURES_SECTOR_LABELS[contract.sector].toLowerCase()))];
|
|
76
|
+
return `${covers}, not ${named ?? sectors.join(" or ")} stocks.`;
|
|
77
|
+
}
|
|
78
|
+
if (!physical.length) return `${covers}; ${named ? `${named} is a financial future` : "these are financial futures"} with none to report.`;
|
|
79
|
+
return `${covers}, not the contracts searched for.`;
|
|
80
|
+
}
|
|
81
|
+
|
|
52
82
|
export function doeTab(value: unknown): DoeTab {
|
|
53
83
|
return value === "products" || value === "gas" ? value : "crude";
|
|
54
84
|
}
|
|
@@ -19,6 +19,7 @@ import { usePaneRefreshKey } from "../../../components/data-table/table-pane";
|
|
|
19
19
|
import { savedCopyFooterSegment } from "../../../components/layout/pane/footer";
|
|
20
20
|
import { useAsyncResource, useAutoRefresh, usePaneSettingValue, usePluginPaneState } from "../../../public/react";
|
|
21
21
|
import { usePaneInstance } from "../../../state/app/context";
|
|
22
|
+
import { useRemoteUiNode } from "../../../remote/semantic-tree";
|
|
22
23
|
import { useThemeColors } from "../../../theme/theme-context";
|
|
23
24
|
import type { ResolvedSeries } from "../../../time-series/types";
|
|
24
25
|
import type { PaneProps } from "../../../types/plugin";
|
|
@@ -29,6 +30,7 @@ import {
|
|
|
29
30
|
DOE_UNIT_LABEL,
|
|
30
31
|
doeAxisFormatter,
|
|
31
32
|
doeComparisonBasis,
|
|
33
|
+
doeCoverageNote,
|
|
32
34
|
doeHeaderLine,
|
|
33
35
|
doeReport,
|
|
34
36
|
doeRows,
|
|
@@ -130,7 +132,11 @@ export function DoePane({ width, height, focused }: PaneProps) {
|
|
|
130
132
|
const [openingTab] = usePaneSettingValue<string>("tab", "crude");
|
|
131
133
|
const [storedTab, setTab] = usePluginPaneState<string>("tab", openingTab);
|
|
132
134
|
const tab = doeTab(storedTab);
|
|
133
|
-
const
|
|
135
|
+
const params = usePaneInstance()?.params;
|
|
136
|
+
const initialSeries = params?.series ?? null;
|
|
137
|
+
// Opened from a futures search on a contract this board does not cover (`FUT HG --tab inventories`): it says so.
|
|
138
|
+
const coverage = useMemo(() => doeCoverageNote(params?.query), [params?.query]);
|
|
139
|
+
useRemoteUiNode(coverage ? { role: "report-notice", label: "Coverage", getMetadata: () => ({ text: coverage }) } : null);
|
|
134
140
|
const resource = useAsyncResource(loadDoeBoard, { initialData: getCachedDoeBoard });
|
|
135
141
|
const data = resource.data?.payload ?? null;
|
|
136
142
|
// The server not serving the board yet is a state of the data, not a failure.
|
|
@@ -141,7 +147,7 @@ export function DoePane({ width, height, focused }: PaneProps) {
|
|
|
141
147
|
// A refresh that failed shows the board an earlier read saved, and says when that copy is from.
|
|
142
148
|
const savedAt = resource.data?.savedAt ?? null;
|
|
143
149
|
usePaneNoticeFooter({ registrationId: "doe:notices", focused,
|
|
144
|
-
notices: [...(data?.gaps ?? []), ...(resource.data?.refreshError && savedAt == null ? [resource.data.refreshError] : [])] });
|
|
150
|
+
notices: [...(coverage ? [coverage] : []), ...(data?.gaps ?? []), ...(resource.data?.refreshError && savedAt == null ? [resource.data.refreshError] : [])] });
|
|
145
151
|
// What Vs 1Y and Vs 5Y are measured against on this tab: the EIA's published figures for gas storage.
|
|
146
152
|
const basis = useMemo(() => data ? doeComparisonBasis(doeRows(data, tab)) : null, [data, tab]);
|
|
147
153
|
const info = useMemo(() => {
|
|
@@ -6,7 +6,8 @@ import { colors } from "../../../theme/colors";
|
|
|
6
6
|
import { notMeaningfulCell } from "../../../components/ui/not-meaningful";
|
|
7
7
|
import { isNotMeaningful } from "../../../utils/growth";
|
|
8
8
|
import { TextAttributes } from "../../../ui";
|
|
9
|
-
import { epsBasisShort, showsEpsBasis } from "../shared/earnings-report";
|
|
9
|
+
import { ACTUAL_PENDING, actualPending, epsBasisShort, showsEpsBasis } from "../shared/earnings-report";
|
|
10
|
+
import { listingAbroadVenue } from "../../../utils/sec";
|
|
10
11
|
import type { BoardReport, BoardRow, BoardSort } from "./board-model";
|
|
11
12
|
import { epsText, impliedText, moneyText, moveSize, signedPercent, TIMING_LABEL, weekday, type Surprise } from "./format";
|
|
12
13
|
|
|
@@ -70,9 +71,12 @@ export const SORTABLE: Partial<Record<BoardColumnId, BoardSort["column"]>> = {
|
|
|
70
71
|
symbol: "symbol", cap: "cap", implied: "implied", average: "average",
|
|
71
72
|
};
|
|
72
73
|
|
|
73
|
-
/**
|
|
74
|
+
/**
|
|
75
|
+
* Whether any report on the board is out, with its actual or still pending: the narrow board then keeps EPS ACT and
|
|
76
|
+
* EPS SURP (boardColumns), so a report out today says its actual is pending rather than dropping the column.
|
|
77
|
+
*/
|
|
74
78
|
export function boardHasActuals(rows: readonly BoardRow[]): boolean {
|
|
75
|
-
return rows.some((row) => row.kind === "report" && row.report.epsActual != null);
|
|
79
|
+
return rows.some((row) => row.kind === "report" && (row.report.epsActual != null || actualPending(row.report, listingAbroadVenue(row.report.symbol) != null)));
|
|
76
80
|
}
|
|
77
81
|
|
|
78
82
|
/**
|
|
@@ -172,7 +176,8 @@ export function renderBoardCell(row: BoardRow, column: BoardColumn, context: Boa
|
|
|
172
176
|
case "analysts":
|
|
173
177
|
return { text: report.epsAnalysts == null ? MISSING_VALUE : String(report.epsAnalysts), color: dim };
|
|
174
178
|
case "epsActual":
|
|
175
|
-
//
|
|
179
|
+
// A report out with no actual yet says so; the company's press release's figure reads quieter until the calendar's replaces it.
|
|
180
|
+
if (actualPending(report, listingAbroadVenue(report.symbol) != null)) return { text: ACTUAL_PENDING, color: dim };
|
|
176
181
|
return { text: epsText(report.epsActual), color: report.epsActual == null ? dim : report.provisional ? colors.textMuted : colors.text };
|
|
177
182
|
case "basis":
|
|
178
183
|
return !showsEpsBasis(report)
|
|
@@ -19,7 +19,7 @@ import { epsText, impliedText, moneyText, moveSize, signedPercent, TIMING_LABEL
|
|
|
19
19
|
import { historyRows, periodText } from "./history-model";
|
|
20
20
|
import { fiscalPeriodText, fiscalQuarterText } from "./fiscal-quarter";
|
|
21
21
|
import { loadNoEarningsText } from "./no-earnings";
|
|
22
|
-
import { EPS_BASIS_NOTE, epsBasisName, lacksConsensus, NO_CONSENSUS, PROVISIONAL_NOTE, showsEpsBasis } from "../shared/earnings-report";
|
|
22
|
+
import { ACTUAL_PENDING, actualPending, EPS_BASIS_NOTE, epsBasisName, lacksConsensus, NO_CONSENSUS, PROVISIONAL_NOTE, showsEpsBasis } from "../shared/earnings-report";
|
|
23
23
|
import { lastReportOnRecord, listingDay, noNextReportText } from "../shared/earnings-calendar";
|
|
24
24
|
import { commandWord } from "../../../utils/shell-word";
|
|
25
25
|
import { listingAbroadVenue } from "../../../utils/sec";
|
|
@@ -59,6 +59,11 @@ const BASIS_COLUMN: HeadlessPaneColumn = {
|
|
|
59
59
|
textFormat: (value, row) => (value == null ? MISSING_VALUE : row.epsActualProvisional === true ? `${String(value)}, provisional` : String(value)),
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
+
/** A listing abroad's row (a board row naming one, an ERN row in its own currency) has no actual pending: see actualPending. */
|
|
63
|
+
function pendingAbroad(row: Record<string, unknown>): boolean {
|
|
64
|
+
return typeof row.symbol === "string" ? listingAbroadVenue(row.symbol) != null : row.currency != null && row.currency !== "USD";
|
|
65
|
+
}
|
|
66
|
+
|
|
62
67
|
const BOARD_COLUMNS: HeadlessPaneColumn[] = [
|
|
63
68
|
{ key: "date", header: "Date" },
|
|
64
69
|
{ key: "dateStatus", header: "Status" },
|
|
@@ -71,7 +76,8 @@ const BOARD_COLUMNS: HeadlessPaneColumn[] = [
|
|
|
71
76
|
{ key: "currency", header: "Ccy" },
|
|
72
77
|
{ key: "epsEstimate", header: "EPS est", align: right, format: (value) => epsText(num(value)) },
|
|
73
78
|
{ key: "epsAnalysts", header: "Ests", align: right },
|
|
74
|
-
|
|
79
|
+
// A report out with no actual yet says so (exports: in the status column), never a bare blank.
|
|
80
|
+
{ key: "epsActual", header: "EPS act", align: right, format: (value, row) => actualPending({ date: typeof row.date === "string" ? row.date : null, epsActual: num(value), dateStatus: typeof row.dateStatus === "string" ? row.dateStatus : null }, pendingAbroad(row)) ? ACTUAL_PENDING : epsText(num(value)) },
|
|
75
81
|
BASIS_COLUMN,
|
|
76
82
|
surpriseColumn("epsSurprise", "EPS surp"),
|
|
77
83
|
{ key: "revenueEstimate", header: "Sales est", align: right, format: (value) => moneyText(num(value)) },
|
|
@@ -100,7 +106,8 @@ const HISTORY_COLUMNS: HeadlessPaneColumn[] = [
|
|
|
100
106
|
// A reported quarter with no consensus on record says so (exports: in the status column), never a bare blank.
|
|
101
107
|
{ key: "epsEstimate", header: "EPS est", align: right, format: (value, row) => lacksConsensus({ epsActual: num(row.epsActual), epsEstimate: num(value) }) ? NO_CONSENSUS : epsText(num(value)) },
|
|
102
108
|
{ key: "epsAnalysts", header: "Ests", align: right },
|
|
103
|
-
|
|
109
|
+
// A report out with no actual yet says so (exports: in the status column), never a bare blank.
|
|
110
|
+
{ key: "epsActual", header: "EPS act", align: right, format: (value, row) => actualPending({ date: typeof row.date === "string" ? row.date : null, epsActual: num(value), dateStatus: typeof row.dateStatus === "string" ? row.dateStatus : null }, pendingAbroad(row)) ? ACTUAL_PENDING : epsText(num(value)) },
|
|
104
111
|
BASIS_COLUMN,
|
|
105
112
|
surpriseColumn("epsSurprise", "EPS surp"),
|
|
106
113
|
{ key: "revenueEstimate", header: "Sales est", align: right, format: (value) => moneyText(num(value)) },
|
|
@@ -6,7 +6,7 @@ import { notMeaningfulCell } from "../../../components/ui/not-meaningful";
|
|
|
6
6
|
import { isNotMeaningful } from "../../../utils/growth";
|
|
7
7
|
import { TextAttributes } from "../../../ui";
|
|
8
8
|
import { datedYear, epsText, impliedText, moneyText, signedPercent, TIMING_LABEL, type Surprise } from "./format";
|
|
9
|
-
import { epsBasisShort, lacksConsensus, NO_CONSENSUS_SHORT, showsEpsBasis } from "../shared/earnings-report";
|
|
9
|
+
import { ACTUAL_PENDING, actualPending, epsBasisShort, lacksConsensus, NO_CONSENSUS_SHORT, showsEpsBasis } from "../shared/earnings-report";
|
|
10
10
|
import { periodText, type HistoryRow } from "./history-model";
|
|
11
11
|
|
|
12
12
|
type HistoryColumnId =
|
|
@@ -122,7 +122,9 @@ export function renderHistoryCell(row: HistoryRow, column: HistoryColumn, liveMo
|
|
|
122
122
|
case "analysts":
|
|
123
123
|
return { text: row.epsAnalysts == null ? MISSING_VALUE : String(row.epsAnalysts), color: dim };
|
|
124
124
|
case "epsActual":
|
|
125
|
-
//
|
|
125
|
+
// A report out with no actual yet says so; the company's press release's figure reads quieter until the calendar's replaces it.
|
|
126
|
+
// A listing abroad's rows carry their own currency; a US listing's are dollars (null).
|
|
127
|
+
if (actualPending(row, row.currency != null)) return { text: ACTUAL_PENDING, color: dim };
|
|
126
128
|
return { text: inCurrency(epsText(row.epsActual), row), color: row.provisional ? colors.textMuted : colors.text };
|
|
127
129
|
case "basis":
|
|
128
130
|
// A listing abroad's basic EPS is not the statements' diluted figure: it says what it is.
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
import { handleRefreshKey } from "../../../components/data-table/table-pane";
|
|
23
23
|
import { savedCopyFooterInfo } from "../../../components/layout/pane/footer";
|
|
24
24
|
import { isPermanentClientError } from "../../../api-client/errors";
|
|
25
|
-
import { TABLE_COLUMN_GAP, tableColumnWidth } from "../../../components/ui/table-layout";
|
|
25
|
+
import { markHiddenTableColumns, TABLE_COLUMN_GAP, tableColumnWidth } from "../../../components/ui/table-layout";
|
|
26
26
|
import { useAsyncResource } from "../../../react/async-resource";
|
|
27
27
|
import { useAgeClock, useAutoRefresh } from "../../../react/auto-refresh";
|
|
28
28
|
import { colors } from "../../../theme/colors";
|
|
@@ -80,13 +80,14 @@ const SORTABLE: Partial<Record<CalendarColumnId, CalendarSort["column"]>> = {
|
|
|
80
80
|
function calendarColumns(width: number, { localClock }: { localClock: boolean }): CalendarColumn[] {
|
|
81
81
|
const fixed = (list: CalendarColumn[]) =>
|
|
82
82
|
list.reduce((sum, column) => sum + (column.id === "company" ? 0 : tableColumnWidth(column)) + TABLE_COLUMN_GAP, 2);
|
|
83
|
-
|
|
83
|
+
const original = localClock ? ALL_COLUMNS : ALL_COLUMNS.filter((column) => column.id !== "local");
|
|
84
|
+
let columns = original;
|
|
84
85
|
for (const id of DROP_ORDER) {
|
|
85
86
|
if (fixed(columns) + COMPANY_MIN_WIDTH <= width) break;
|
|
86
87
|
columns = columns.filter((column) => column.id !== id);
|
|
87
88
|
}
|
|
88
89
|
const companyWidth = Math.max(COMPANY_MIN_WIDTH, width - fixed(columns));
|
|
89
|
-
return columns.map((column) => (column.id === "company" ? { ...column, width: companyWidth } : column));
|
|
90
|
+
return markHiddenTableColumns(original, columns.map((column) => (column.id === "company" ? { ...column, width: companyWidth } : column)));
|
|
90
91
|
}
|
|
91
92
|
|
|
92
93
|
function renderCalendarCell(row: CalendarRow, column: CalendarColumn, now: number): DataTableCell {
|
|
@@ -2,7 +2,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
|
2
2
|
import { DataTableView, EmptyState, PaneStatusBody, usePaneFooter, usePaneNoticeFooter, usePaneTabs,
|
|
3
3
|
type DataTableCell, type DataTableColumn, type PaneHint } from "../../../components";
|
|
4
4
|
import { usePaneRefreshKey } from "../../../components/data-table/table-pane";
|
|
5
|
-
import { getTableWidth } from "../../../components/ui/table-layout";
|
|
5
|
+
import { getTableWidth, markHiddenTableColumns } from "../../../components/ui/table-layout";
|
|
6
6
|
import { usePlanAccess } from "../../../api-client/plan-access";
|
|
7
7
|
import { useAsyncResource, useAutoRefresh, usePaneSettingValue, usePluginAppActions, usePluginPaneState, useTickers } from "../../../public/react";
|
|
8
8
|
import type { PaneProps } from "../../../types/plugin";
|
|
@@ -91,7 +91,7 @@ function secondHopLayout(width: number, rows: readonly SecondHopRow[]) {
|
|
|
91
91
|
add();
|
|
92
92
|
if (room() < 0) undo();
|
|
93
93
|
}
|
|
94
|
-
return { columns: columns(), firstHopWidth };
|
|
94
|
+
return { columns: markHiddenTableColumns(SECOND_HOP_COLUMNS, columns()), firstHopWidth };
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
const move = (row: RippleRow | SecondHopRow): DataTableCell =>
|
|
@@ -111,7 +111,7 @@ function EconCalendarPane({ focused, width, height }: PaneProps) {
|
|
|
111
111
|
useEffect(() => subscribeCalendar(() => setCacheVersion((version) => version + 1)), []);
|
|
112
112
|
const cached = useMemo(() => getCalendarCache(), [cacheVersion]);
|
|
113
113
|
const shown = cached && (!calendar.data || cached.fetchedAt > calendar.data.fetchedAt) ? cached : calendar.data;
|
|
114
|
-
const
|
|
114
|
+
const loading = calendar.loading || (!shown && !calendar.error);
|
|
115
115
|
const events = shown?.data ?? NO_EVENTS;
|
|
116
116
|
const stale = shown?.stale ?? false;
|
|
117
117
|
const fetchedAt = shown?.fetchedAt ?? null;
|
|
@@ -423,6 +423,7 @@ function EconCalendarPane({ focused, width, height }: PaneProps) {
|
|
|
423
423
|
registrationId: "econ-calendar",
|
|
424
424
|
loading,
|
|
425
425
|
error,
|
|
426
|
+
emptyResult: !!shown && !rows.length && !detailEvent,
|
|
426
427
|
info: calendarStatus,
|
|
427
428
|
});
|
|
428
429
|
// The filter keys step through the choices; Shift steps back. The pane menu
|
|
@@ -584,12 +585,13 @@ function EconCalendarPane({ focused, width, height }: PaneProps) {
|
|
|
584
585
|
renderSectionHeader={renderSectionHeader}
|
|
585
586
|
renderCell={renderCell}
|
|
586
587
|
selectedTextOverridesCellColor
|
|
588
|
+
status={{ loading: loading && !rows.length, error: !loading && !events.length ? error : null, subject: "economic events" }}
|
|
587
589
|
emptyContent={filterEmptyTitle ? (
|
|
588
590
|
<Box width="100%" paddingX={1} paddingY={1}>
|
|
589
591
|
<EmptyState title={filterEmptyTitle} actions={<Button label="Show all" compact onPress={showAllEvents} />} />
|
|
590
592
|
</Box>
|
|
591
593
|
) : undefined}
|
|
592
|
-
emptyStateTitle={
|
|
594
|
+
emptyStateTitle={listedAfter ?? "No events"}
|
|
593
595
|
emptyStateHint={emptyStateHint}
|
|
594
596
|
showHorizontalScrollbar={false}
|
|
595
597
|
/>
|
|
@@ -2,7 +2,10 @@ import type { FuturesContractTermsPayload } from "../../../api-client/futures-cu
|
|
|
2
2
|
import type { Quote } from "../../../types/financials";
|
|
3
3
|
import { compareSortValues, type SortDirection } from "../../../utils/sort-values";
|
|
4
4
|
import type { BoardQuoteMap } from "../shared/use-quote-board";
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
FUTURES_BOARD_ROWS, FUTURES_SECTOR_ORDER, futuresBoardCode, futuresBoardContract, futuresGroupFilter, futuresNameKey,
|
|
7
|
+
type FuturesContract, type FuturesSector,
|
|
8
|
+
} from "../../../market-data/futures-board";
|
|
6
9
|
import { CONTRACT_MONTH_NAME, futuresPriceUnit } from "../../../market-data/futures-contract";
|
|
7
10
|
import { contractMonthLabel } from "../../../utils/contract-month";
|
|
8
11
|
import { quoteDotMarketState } from "../../../market-data/market/status";
|
|
@@ -165,6 +168,16 @@ function matchesFuturesSearch(contract: FuturesContract, query: string, quote?:
|
|
|
165
168
|
);
|
|
166
169
|
}
|
|
167
170
|
|
|
171
|
+
/**
|
|
172
|
+
* The board's contracts a search lists, as the board filters them: the one a
|
|
173
|
+
* code or symbol names (`FUT HG` opens on HG=F), else every contract the text
|
|
174
|
+
* matches (`FUT copper`, `FUT metals`).
|
|
175
|
+
*/
|
|
176
|
+
export function futuresSearchContracts(query: string): FuturesContract[] {
|
|
177
|
+
const named = futuresBoardContract(query.trim());
|
|
178
|
+
return named ? [named] : FUTURES_BOARD_ROWS.filter((contract) => matchesFuturesSearch(contract, query));
|
|
179
|
+
}
|
|
180
|
+
|
|
168
181
|
/**
|
|
169
182
|
* Why `fn FUT urea` lists nothing, for a search no contract matches: what
|
|
170
183
|
* to type instead, never the board's own Clear search button.
|
|
@@ -2,13 +2,6 @@ import type { SeriesDefinition } from "../../../series/types";
|
|
|
2
2
|
import { FUTURES_CONTRACTS, FUTURES_SECTOR_LABELS, futuresGroupTags, type FuturesContract } from "../../../market-data/futures-board";
|
|
3
3
|
import { futuresContractCode } from "../../../utils/futures-generic";
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* Grains and softs the board quotes in US cents with no unit of its own
|
|
7
|
-
* (soybean meal and cocoa quote in dollars). Checked against the server's
|
|
8
|
-
* contract terms on 2026-10-13.
|
|
9
|
-
*/
|
|
10
|
-
const US_CENT_CONTRACTS: ReadonlySet<string> = new Set(["ZC", "ZS", "ZL", "ZW", "KE", "KC", "SB", "CT"]);
|
|
11
|
-
|
|
12
5
|
/**
|
|
13
6
|
* The unit the board prints, not a blanket dollar price. Index and sector
|
|
14
7
|
* futures are points, rates are points (the board prints decimals, not 32nds), cents
|
|
@@ -16,7 +9,7 @@ const US_CENT_CONTRACTS: ReadonlySet<string> = new Set(["ZC", "ZS", "ZL", "ZW",
|
|
|
16
9
|
* futures are dollars per unit of the foreign currency.
|
|
17
10
|
*/
|
|
18
11
|
function futuresSeriesUnit(contract: FuturesContract): string {
|
|
19
|
-
if (contract.unit?.startsWith("US cents")
|
|
12
|
+
if (contract.unit?.startsWith("US cents")) return "USX";
|
|
20
13
|
if (contract.unit?.startsWith("EUR")) return "EUR";
|
|
21
14
|
if (contract.unit?.startsWith("USD")) return "USD";
|
|
22
15
|
if (contract.sector === "equity-index" || contract.sector === "equity-sectors" || contract.sector === "rates") return "points";
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
type PaneFooterSegment,
|
|
12
12
|
} from "../../../components";
|
|
13
13
|
import { handleRefreshKey } from "../../../components/data-table/table-pane";
|
|
14
|
-
import { getTableWidth } from "../../../components/ui/table-layout";
|
|
14
|
+
import { getTableWidth, markHiddenTableColumns } from "../../../components/ui/table-layout";
|
|
15
15
|
import { createDataTableCsv } from "../../../components/data-table/export";
|
|
16
16
|
import { ageFooterSegment, savedCopyFooterSegment } from "../../../components/layout/pane/footer";
|
|
17
17
|
import { CountryFlag } from "../../../components/ui/country-flag";
|
|
@@ -294,7 +294,7 @@ function FxMatrixPane({ focused, width, height }: PaneProps) {
|
|
|
294
294
|
})),
|
|
295
295
|
];
|
|
296
296
|
const throughEighth = columns.slice(0, columns.length - Math.max(0, currencies.length - MOVE_FITS_BESIDE));
|
|
297
|
-
return getTableWidth(throughEighth) <= width - 1 ? columns : columns.filter((column) => column.id !== "move");
|
|
297
|
+
return getTableWidth(throughEighth) <= width - 1 ? columns : markHiddenTableColumns(columns, columns.filter((column) => column.id !== "move"));
|
|
298
298
|
}, [amount != null, amountWidth, currencies, flagged, width]);
|
|
299
299
|
|
|
300
300
|
const renderCell = useCallback((
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RefObject } from "react";
|
|
2
2
|
import { Box, Text, useUiCapabilities, type ScrollBoxRenderable } from "../../../ui";
|
|
3
|
-
import { DetailScrollBody, KeyValueRow, Prose } from "../../../components";
|
|
3
|
+
import { ActionRow, DetailScrollBody, KeyValueRow, Prose } from "../../../components";
|
|
4
4
|
import { colors } from "../../../theme/colors";
|
|
5
5
|
import { wrapTextLines } from "../../../utils/text-wrap";
|
|
6
6
|
import {
|
|
@@ -10,9 +10,13 @@ import {
|
|
|
10
10
|
} from "../sec/filing-display";
|
|
11
11
|
import { isAmendedInsiderFiling } from "./amendments";
|
|
12
12
|
import type { InsiderReportingOwner } from "./insider-data";
|
|
13
|
-
import { buildInsiderDisclosureText, insiderDisplayName, isInsiderDisclosureOnly } from "./model";
|
|
13
|
+
import { OTHER_FILING_NOTES_LABEL, buildInsiderDisclosureText, insiderDisplayName, isInsiderDisclosureOnly } from "./model";
|
|
14
14
|
import type { InsiderTableRow } from "./table-model";
|
|
15
15
|
import { insiderToneColor } from "./table";
|
|
16
|
+
import { filingStorySource, type FilingStory } from "./filing-stories";
|
|
17
|
+
|
|
18
|
+
/** Heads the stories that report the transaction's filing, under its notes. */
|
|
19
|
+
const STORIES_LABEL = "Stories reporting this filing";
|
|
16
20
|
|
|
17
21
|
/** Every role an owner filed: the officer title, plus Director and 10% owner when the boxes add them. */
|
|
18
22
|
function ownerRoles(owner: InsiderReportingOwner): string {
|
|
@@ -81,8 +85,20 @@ function detailText(row: InsiderTableRow): string {
|
|
|
81
85
|
|
|
82
86
|
const FIELD_LABEL_WIDTH = 20;
|
|
83
87
|
|
|
84
|
-
/**
|
|
85
|
-
|
|
88
|
+
/** The heading over another line's notes reads muted, as the filing's own lines above the fields do. */
|
|
89
|
+
const textColor = (line: string) => (line === OTHER_FILING_NOTES_LABEL ? colors.textMuted : colors.text);
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* One Form 4 line read in full: who, the filing, every field, then remarks and
|
|
93
|
+
* footnotes, and the stories that report the filing, each opening in a pane.
|
|
94
|
+
*/
|
|
95
|
+
export function InsiderDetail({ row, width, scrollRef, stories = [], onOpenStory }: {
|
|
96
|
+
row: InsiderTableRow;
|
|
97
|
+
width: number;
|
|
98
|
+
scrollRef: RefObject<ScrollBoxRenderable | null>;
|
|
99
|
+
stories?: readonly FilingStory[];
|
|
100
|
+
onOpenStory?: (story: FilingStory) => void;
|
|
101
|
+
}) {
|
|
86
102
|
const textWidth = Math.max(width - 2, 12);
|
|
87
103
|
const fields = detailFields(row);
|
|
88
104
|
const text = detailText(row);
|
|
@@ -114,13 +130,26 @@ export function InsiderDetail({ row, width, scrollRef }: { row: InsiderTableRow;
|
|
|
114
130
|
{text && <Box height={1} />}
|
|
115
131
|
{nativePaneChrome
|
|
116
132
|
? text.split("\n").map((line, index) => (line.trim()
|
|
117
|
-
? <Prose key={`text-${index}`} text={line} width={textWidth} color={
|
|
133
|
+
? <Prose key={`text-${index}`} text={line} width={textWidth} color={textColor(line)} figures={false} />
|
|
118
134
|
: <Text key={`text-${index}`}>{" "}</Text>))
|
|
119
|
-
: text.split("\n").flatMap((line) => wrapTextLines(line, textWidth)).map((
|
|
135
|
+
: text.split("\n").flatMap((line) => wrapTextLines(line, textWidth).map((wrapped) => ({ wrapped, color: textColor(line) }))).map(({ wrapped, color }, index) => (
|
|
120
136
|
<Box key={`text-${index}`} height={1}>
|
|
121
|
-
<Text fg={
|
|
137
|
+
<Text fg={color}>{wrapped}</Text>
|
|
122
138
|
</Box>
|
|
123
139
|
))}
|
|
140
|
+
{stories.length > 0 && (
|
|
141
|
+
<>
|
|
142
|
+
<Box height={1} />
|
|
143
|
+
<Box height={nativePaneChrome ? undefined : 1}>
|
|
144
|
+
<Text fg={colors.textMuted}>{STORIES_LABEL}</Text>
|
|
145
|
+
</Box>
|
|
146
|
+
{stories.map((story) => (
|
|
147
|
+
<ActionRow key={story.id} label={story.headline} onPress={() => onOpenStory?.(story)}>
|
|
148
|
+
<Text fg={colors.textDim}>{filingStorySource(story)}</Text>
|
|
149
|
+
</ActionRow>
|
|
150
|
+
))}
|
|
151
|
+
</>
|
|
152
|
+
)}
|
|
124
153
|
</Box>
|
|
125
154
|
</DetailScrollBody>
|
|
126
155
|
);
|