@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
|
@@ -11,6 +11,7 @@ import { subtractTimeRange } from "./date-window";
|
|
|
11
11
|
import { hiddenOnLogScale, logScaleHiddenWarning } from "./log-scale";
|
|
12
12
|
import {
|
|
13
13
|
CHART_RESOLUTION_STEP_MS,
|
|
14
|
+
chartBarSizeName,
|
|
14
15
|
chartBarSizeSource,
|
|
15
16
|
clampTimeRangeToMaxRange,
|
|
16
17
|
DEFAULT_CHART_RESOLUTION_SUPPORT,
|
|
@@ -134,6 +135,7 @@ import {
|
|
|
134
135
|
latestQuote,
|
|
135
136
|
mergeHistory,
|
|
136
137
|
baseSecuritySeries,
|
|
138
|
+
withPriorClose,
|
|
137
139
|
baseEconomicSeries,
|
|
138
140
|
baseCapabilitySeries,
|
|
139
141
|
staleFredWarning,
|
|
@@ -1090,7 +1092,32 @@ async function resolveChartSpecPass(
|
|
|
1090
1092
|
}
|
|
1091
1093
|
}));
|
|
1092
1094
|
|
|
1093
|
-
|
|
1095
|
+
let rawSeries = loaded.filter((entry): entry is ResolvedSeries => !!entry);
|
|
1096
|
+
const statementTarget = spec.viewport.currency;
|
|
1097
|
+
if (statementTarget && sources.loadStatementCurrency) {
|
|
1098
|
+
const statements = new Set(spec.series.filter(({ source }) => source.kind === "security" && source.fieldId.startsWith("fundamental.")).map(({ id }) => id));
|
|
1099
|
+
const group = (series: ResolvedSeries) => /^(currency-total|per-share)(?::|$)/.exec(series.unitGroup)?.[1];
|
|
1100
|
+
const nativeCurrency = (series: ResolvedSeries) => series.unitGroup.split(":")[1] ?? "";
|
|
1101
|
+
const monetary = rawSeries.filter((series) => statements.has(series.id) && group(series) && series.points.length);
|
|
1102
|
+
if (monetary.length) {
|
|
1103
|
+
const { rates, note, rateNotes, failures } = await sources.loadStatementCurrency(statementTarget, monetary.map(nativeCurrency).filter(Boolean));
|
|
1104
|
+
if (note) { coverageNotices.push(note); warnings.push(...rateNotes ?? [note]); }
|
|
1105
|
+
warnings.push(...failures);
|
|
1106
|
+
rawSeries = rawSeries.map((series) => {
|
|
1107
|
+
const currency = nativeCurrency(series);
|
|
1108
|
+
if (!monetary.includes(series) || currency === statementTarget) return series;
|
|
1109
|
+
const rate = rates.get(currency);
|
|
1110
|
+
return {
|
|
1111
|
+
...series, unit: group(series) === "per-share" ? `${statementTarget}/share` : statementTarget, unitGroup: `${group(series)}:${statementTarget}`,
|
|
1112
|
+
...(rate == null ? { warning: `No ${currency || "reporting currency"}/${statementTarget} rate` } : {}),
|
|
1113
|
+
points: rate == null ? [] : series.points.map((point) => ({ ...point,
|
|
1114
|
+
...(point.value == null ? {} : { nativeAmount: { value: point.value, currency: series.unit } }),
|
|
1115
|
+
value: point.value == null ? null : point.value * rate,
|
|
1116
|
+
})),
|
|
1117
|
+
};
|
|
1118
|
+
});
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1094
1121
|
const marketTimelineSeries = primaryMarketSeries?.visible === false
|
|
1095
1122
|
? rawSeries.filter((entry) => entry.id === primaryMarketSeries.id)
|
|
1096
1123
|
: [];
|
|
@@ -1130,11 +1157,21 @@ async function resolveChartSpecPass(
|
|
|
1130
1157
|
if (sessionView?.priorClose != null && primaryRaw?.transform === "raw"
|
|
1131
1158
|
&& primaryRaw.unitGroup.startsWith("price") && primaryRaw.unitGroup !== "price:unknown") {
|
|
1132
1159
|
const index = rawSeries.indexOf(primaryRaw);
|
|
1133
|
-
rawSeries[index] =
|
|
1160
|
+
rawSeries[index] = withPriorClose(primaryRaw, sessionView.priorClose);
|
|
1134
1161
|
}
|
|
1135
1162
|
const servedCadences = new Set(rawSeries.filter((entry) => entry.observationKind === "market" && entry.points.length > 0)
|
|
1136
1163
|
.map((entry) => entry.historyResolution));
|
|
1137
1164
|
const commonCadence = servedCadences.size === 1 ? [...servedCadences][0] : undefined;
|
|
1165
|
+
// A series served in other bars than the chart's (a source that did not answer for 5-minute bars, then
|
|
1166
|
+
// answered daily ones) says so, so its line is not read in the bars the others are in.
|
|
1167
|
+
if (servedCadences.size > 1) {
|
|
1168
|
+
const chartBars = builtBarSize ?? initialResolution;
|
|
1169
|
+
for (const entry of rawSeries) {
|
|
1170
|
+
const served = entry.barSize ?? entry.historyResolution;
|
|
1171
|
+
if (!visibleSeriesIds.has(entry.id) || entry.observationKind !== "market" || !entry.points.length || !served || served === chartBars) continue;
|
|
1172
|
+
warnings.push(`${entry.label}: ${chartBarSizeName(served)} bars, not the chart's ${chartBarSizeName(chartBars)} bars.`);
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1138
1175
|
const resolution = commonCadence ?? undefined;
|
|
1139
1176
|
const comparisonResolution = resolution ?? "auto";
|
|
1140
1177
|
const comparisonOptions = { preset: hasExplicitWindow ? null : spec.viewport.range, now: referenceNow.getTime() + Math.max(0, Date.now() - resolutionStartedAt) };
|
package/src/time-series/types.ts
CHANGED
|
@@ -147,6 +147,7 @@ export interface TimeSeriesPoint {
|
|
|
147
147
|
value: number | null;
|
|
148
148
|
/** Original primary scalar before any presentation transform, including missing values. */
|
|
149
149
|
rawValue?: number | null;
|
|
150
|
+
nativeAmount?: { value: number; currency: string };
|
|
150
151
|
open?: number | null;
|
|
151
152
|
high?: number | null;
|
|
152
153
|
low?: number | null;
|
|
@@ -318,7 +319,7 @@ export interface ResolvedSeries {
|
|
|
318
319
|
* `dataset`: a capability's published observations (vessel transits),
|
|
319
320
|
* whose values the legend dates because they arrive days late. */
|
|
320
321
|
observationKind?: "market" | "dataset";
|
|
321
|
-
/**
|
|
322
|
+
/** The move of the series's last bar from the close the latest market quote measures its change from, in percent. */
|
|
322
323
|
latestChangePercent?: number;
|
|
323
324
|
/** The previous session's close, set on a one-day chart's price series and drawn as its reference line. */
|
|
324
325
|
priorClose?: number;
|
package/src/types/financials.ts
CHANGED
|
@@ -444,6 +444,14 @@ export interface Fundamentals extends DepositaryReceiptFacts {
|
|
|
444
444
|
* home line, per receipt), `cpo` (a CPO line's company, per CPO).
|
|
445
445
|
*/
|
|
446
446
|
trailingEpsBasis?: "statements" | "home" | "cpo";
|
|
447
|
+
/**
|
|
448
|
+
* `YYYY-MM-DD`, the last day of the twelve months `revenue`, `netIncome` and
|
|
449
|
+
* `profitMargin` are: the statements' trailing window (Financials' TTM)
|
|
450
|
+
* when they are its figures. Absent when Gloom Cloud cannot tie them to one.
|
|
451
|
+
*/
|
|
452
|
+
trailingPeriodEnd?: string;
|
|
453
|
+
/** `statements`: the trailing revenue, net income and margin are the statements' window, in place of figures on no twelve months the EPS is on. */
|
|
454
|
+
trailingIncomeBasis?: "statements";
|
|
447
455
|
/** Provider-reported issuer market cap; marketCapCurrency identifies its units when known. */
|
|
448
456
|
marketCap?: number;
|
|
449
457
|
marketCapCurrency?: string;
|
|
@@ -876,7 +884,7 @@ export type StatementFilingKind = "annual_results" | "interim_results" | "quarte
|
|
|
876
884
|
|
|
877
885
|
/** A results announcement or report on HKEXnews or SGXNet, with when it was published and read. */
|
|
878
886
|
export interface StatementFilingDocument {
|
|
879
|
-
source: "hkex" | "sgx";
|
|
887
|
+
source: "hkex" | "sgx" | "lse" | "cninfo" | "ir";
|
|
880
888
|
kind: StatementFilingKind;
|
|
881
889
|
title: string;
|
|
882
890
|
url: string;
|
package/src/types/headless.ts
CHANGED
|
@@ -704,6 +704,7 @@ export interface HeadlessBundleResult extends HeadlessPaneResultBase {
|
|
|
704
704
|
|
|
705
705
|
export interface HeadlessSeriesPoint extends HeadlessPaneRow {
|
|
706
706
|
date: string | number | Date;
|
|
707
|
+
nativeAmount?: { value: number; currency: string };
|
|
707
708
|
value?: number | null;
|
|
708
709
|
open?: number | null;
|
|
709
710
|
high?: number | null;
|
|
@@ -12,6 +12,8 @@ interface IssuerListing {
|
|
|
12
12
|
name: string;
|
|
13
13
|
/** The company's primary line. */
|
|
14
14
|
primary: boolean;
|
|
15
|
+
/** The shares one lot trades in, where the line's exchange states it (an HKEX or SGX line); absent elsewhere. */
|
|
16
|
+
boardLot?: number;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
export interface IssuerListings {
|
|
@@ -3,6 +3,7 @@ type AppDesktopNotificationMode = "never" | "when-inactive" | "always";
|
|
|
3
3
|
|
|
4
4
|
export interface AppNotificationDelivery {
|
|
5
5
|
toastVisible: boolean;
|
|
6
|
+
/** Whether an out-of-app banner was requested by the native or browser host. */
|
|
6
7
|
desktopRequested: boolean;
|
|
7
8
|
}
|
|
8
9
|
|
|
@@ -16,6 +17,8 @@ export interface AppNotificationRequest {
|
|
|
16
17
|
/** If true, in-app toast stays visible until user dismisses it */
|
|
17
18
|
persistent?: boolean;
|
|
18
19
|
desktop?: AppDesktopNotificationMode;
|
|
20
|
+
/** Also offer this banner in a background browser tab, if the user opted in. */
|
|
21
|
+
browser?: boolean;
|
|
19
22
|
/** macOS sound name (e.g., "Glass", "Ping", "Hero"). Ignored on other platforms. */
|
|
20
23
|
sound?: string;
|
|
21
24
|
action?: {
|
|
@@ -44,10 +44,12 @@ export interface PriceHistoryResult {
|
|
|
44
44
|
*/
|
|
45
45
|
nonPositiveCloseDates?: string[];
|
|
46
46
|
/**
|
|
47
|
-
* The router answered
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
47
|
+
* The router answered from a saved copy that stops short of the venue's
|
|
48
|
+
* latest session (a refetch failed, the app is offline or the source
|
|
49
|
+
* answered bars still behind), or from a source's own answer that stops
|
|
50
|
+
* there because no source had the present (the service's stored series while
|
|
51
|
+
* its source refuses). Never stored with a copy. Absent for a current copy,
|
|
52
|
+
* whatever its last bar, and for a source's current answer.
|
|
51
53
|
*/
|
|
52
54
|
savedCopyBehind?: true;
|
|
53
55
|
/**
|
package/src/ui/host.tsx
CHANGED
|
@@ -779,6 +779,8 @@ export interface RendererHost {
|
|
|
779
779
|
saveTextFile?(request: SaveTextFileRequest): Promise<string>;
|
|
780
780
|
supportsNativeDesktopNotifications?: boolean;
|
|
781
781
|
notify(notification: AppNotificationRequest): void;
|
|
782
|
+
notifyInBackground?(notification: AppNotificationRequest): boolean;
|
|
783
|
+
subscribeAppActivity?(listener: (active: boolean) => void): () => void;
|
|
782
784
|
showContextMenu?(items: ContextMenuItem[]): Promise<boolean>;
|
|
783
785
|
playTerminalMedia?(url: string, title?: string, options?: { muted?: boolean }): Promise<void>;
|
|
784
786
|
/** Stop terminal playback started by `playTerminalMedia`. */
|
|
@@ -48,7 +48,7 @@ const PAGES: Readonly<Record<string, (code: string) => ExchangeAnnouncementsPage
|
|
|
48
48
|
* ASX is ASX's announcements page for NST, a TSX listing SEDAR+. Null for a
|
|
49
49
|
* US venue and for a venue Gloom knows no page for.
|
|
50
50
|
*/
|
|
51
|
-
|
|
51
|
+
function exchangeAnnouncementsPage(symbol: string, exchange: string | null | undefined): ExchangeAnnouncementsPage | null {
|
|
52
52
|
const page = PAGES[canonicalExchange(exchange ?? "")];
|
|
53
53
|
const code = symbol.trim().toUpperCase();
|
|
54
54
|
return page && code ? page(code) : null;
|
|
@@ -77,6 +77,10 @@ export function listsExchangeAnnouncements(exchange: string | null | undefined):
|
|
|
77
77
|
*/
|
|
78
78
|
const ROUTINE_RETURNS = new Set(["Next Day Disclosure Returns", "Monthly Returns"]);
|
|
79
79
|
|
|
80
|
+
const ISSUER_RESULTS_PAGES: Readonly<Record<string, string>> = {
|
|
81
|
+
"RHM:XETRA": "https://www.rheinmetall.com/en/investor-relations/publications/financial-publications-and-presentations",
|
|
82
|
+
};
|
|
83
|
+
|
|
80
84
|
export function isRoutineReturn(item: { category?: string | null }): boolean {
|
|
81
85
|
return item.category != null && ROUTINE_RETURNS.has(item.category);
|
|
82
86
|
}
|
|
@@ -90,5 +94,6 @@ export function listingAnnouncementsPage(key: string, exchange?: string | null):
|
|
|
90
94
|
const suffixed = parsed.exchange ? null : listingSuffixExchange(parsed.symbol);
|
|
91
95
|
const venue = parsed.exchange || suffixed || exchange;
|
|
92
96
|
const symbol = suffixed ? parsed.symbol.replace(/\.[A-Z]+$/i, "") : parsed.symbol;
|
|
93
|
-
|
|
97
|
+
const issuerPage = !listsExchangeAnnouncements(venue) && ISSUER_RESULTS_PAGES[`${symbol.toUpperCase()}:${canonicalExchange(venue ?? "")}`];
|
|
98
|
+
return issuerPage ? { name: "Company results", url: issuerPage } : venue ? exchangeAnnouncementsPage(symbol, venue) : null;
|
|
94
99
|
}
|
|
@@ -522,6 +522,46 @@ export function ttmConversionNote(fundamentals: Pick<Fundamentals, "financialCur
|
|
|
522
522
|
return `TTM converted from ${from}${rate}${when}${eps}.`;
|
|
523
523
|
}
|
|
524
524
|
|
|
525
|
+
/**
|
|
526
|
+
* "TTM figures: the twelve months to 2026-06-30.": which twelve months the
|
|
527
|
+
* trailing revenue, net income and margin are, as Financials' TTM column
|
|
528
|
+
* names them. Undefined when Gloom Cloud does not say.
|
|
529
|
+
*/
|
|
530
|
+
export function trailingPeriodNote(fundamentals: Pick<Fundamentals, "trailingPeriodEnd"> | null | undefined): string | undefined {
|
|
531
|
+
const end = fundamentals?.trailingPeriodEnd;
|
|
532
|
+
return end && ISO_DAY.test(end) ? `TTM figures: the twelve months to ${end}.` : undefined;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
/** A rate as US dollars per unit of a currency, and when it was read (epoch ms), as the app's rates are held. */
|
|
536
|
+
interface UsdRateObservation {
|
|
537
|
+
rate: number;
|
|
538
|
+
asOf: number | null;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* "USD figures at USD/ARS 1552.24, as of 2026-11-18 06:25 UTC.": the rate a
|
|
543
|
+
* figure shown in `baseCurrency` beside its own currency's (a market cap
|
|
544
|
+
* 7.80T ARS, 5.03B USD) was converted at, as markets quote the pair, and when
|
|
545
|
+
* it was read, as the TTM conversion note and `ticker` say theirs. Undefined
|
|
546
|
+
* for the same currency or without both rates.
|
|
547
|
+
*/
|
|
548
|
+
export function baseCurrencyFiguresNote(
|
|
549
|
+
currency: string | null | undefined,
|
|
550
|
+
baseCurrency: string,
|
|
551
|
+
rates: ReadonlyMap<string, UsdRateObservation>,
|
|
552
|
+
): string | undefined {
|
|
553
|
+
const from = currency?.trim().toUpperCase();
|
|
554
|
+
const into = baseCurrency.trim().toUpperCase();
|
|
555
|
+
if (!from || !into || from === into) return undefined;
|
|
556
|
+
const leg = (code: string): UsdRateObservation | undefined => code === "USD" ? { rate: 1, asOf: null } : rates.get(code);
|
|
557
|
+
const source = leg(from), target = leg(into);
|
|
558
|
+
if (!source || !target || !usableRate(source.rate) || !usableRate(target.rate)) return undefined;
|
|
559
|
+
const quoted = quotedFxPair(from, into, source.rate / target.rate);
|
|
560
|
+
const times = [source.asOf, target.asOf].filter((time): time is number => time != null && Number.isFinite(time));
|
|
561
|
+
const time = times.length > 0 ? formatUtcTime(new Date(Math.min(...times))) : "";
|
|
562
|
+
return `${into} figures at ${quoted.pair} ${formatFxRate(quoted.rate)}${time ? `, as of ${time}` : ""}.`;
|
|
563
|
+
}
|
|
564
|
+
|
|
525
565
|
/**
|
|
526
566
|
* "EPS (TTM) in USD, converted from CLP at report-date rates.": an EPS in another currency than the trailing amounts
|
|
527
567
|
* beside it. Undefined when they share one.
|
|
@@ -27,6 +27,8 @@ export class DataServiceUnreachableError extends Error {
|
|
|
27
27
|
const NO_CONNECTION_CODES = new Set([
|
|
28
28
|
"ConnectionRefused",
|
|
29
29
|
"FailedToOpenSocket",
|
|
30
|
+
// Bun 1.4's refusal of a proxy to open a tunnel to the server (Bun 1.3 hands back the proxy's 502 instead).
|
|
31
|
+
"ERR_PROXY_TUNNEL",
|
|
30
32
|
"ECONNREFUSED",
|
|
31
33
|
"ENOTFOUND",
|
|
32
34
|
"EAI_AGAIN",
|
|
@@ -174,9 +174,17 @@ export function pricePointValues(point: PricePoint, integrity = pricePointIntegr
|
|
|
174
174
|
};
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
+
/** What every price view says of the bars it shows whose prices contradict each other. */
|
|
178
|
+
export const CONTRADICTORY_PRICES = "contradictory prices";
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* "2 bars have contradictory prices; left blank.", or undefined for none: the bars a view shows blank because their
|
|
182
|
+
* high, low, open and close contradict each other. Only views that show those bars say it; a figure read across them
|
|
183
|
+
* names itself instead (priceReturnIntegrityNotice).
|
|
184
|
+
*/
|
|
177
185
|
export function priceHistoryIntegrityNotice(count: number): string | undefined {
|
|
178
186
|
return count > 0
|
|
179
|
-
? `${count
|
|
187
|
+
? `${count === 1 ? "1 bar has" : `${count} bars have`} ${CONTRADICTORY_PRICES}; left blank.`
|
|
180
188
|
: undefined;
|
|
181
189
|
}
|
|
182
190
|
|