@gloom-sh/terminal 0.20.9 → 0.20.11
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/patches/@opentui%2Fcore@0.3.2.patch +16 -0
- package/src/api-client/auth.ts +6 -0
- package/src/api-client/data.ts +1 -0
- package/src/api-client/earnings.ts +15 -0
- package/src/api-client/index.ts +14 -3
- package/src/api-client/socket-connection.ts +355 -0
- package/src/api-client/socket-features.ts +75 -0
- package/src/api-client/socket-frames.ts +161 -0
- package/src/api-client/socket-listeners.ts +207 -0
- package/src/api-client/socket-quotes.ts +332 -0
- package/src/api-client/socket.ts +150 -983
- package/src/api-client/types/account.ts +10 -0
- package/src/api-client/types/billing.ts +10 -0
- package/src/api-client/types/econ.ts +19 -7
- package/src/api-client/types/market.ts +7 -0
- package/src/api-client/types/screener.ts +2 -0
- package/src/brokers/signed-in/adapter.ts +19 -5
- package/src/brokers/signed-in/client.ts +13 -1
- package/src/brokers/signed-in/sign-in-dialog.tsx +33 -9
- package/src/cli/commands/market.ts +18 -8
- package/src/cli/commands/overview.ts +26 -7
- package/src/cli/commands/ticker.ts +40 -15
- package/src/cli/desktop-pane-shot.ts +39 -0
- package/src/cli/errors.ts +20 -3
- package/src/cli/fx-pair.ts +11 -2
- package/src/cli/history-rows.ts +34 -3
- package/src/cli/index.ts +1 -1
- package/src/cli/listing-arg.ts +51 -13
- package/src/cli/pane-functions/headless.ts +4 -2
- package/src/cli/pane-functions/index.ts +1 -0
- package/src/cli/pane-functions/resolver.ts +2 -1
- package/src/cli/pane-functions/screenshot-assessment.ts +73 -5
- package/src/cli/pane-functions/screenshot-types.ts +4 -0
- package/src/components/chart/composite/chart-layout.ts +7 -4
- package/src/components/chart/composite/composite-chart.tsx +6 -16
- package/src/components/chart/composite/toolbar.tsx +258 -82
- package/src/components/chart/composite/use-composite-chart-keyboard.ts +5 -6
- package/src/components/chart/native/kitty/manager.ts +2 -0
- package/src/components/chart/native/surface/manager.ts +211 -11
- package/src/components/command-bar/list/model.ts +13 -0
- package/src/components/command-bar/panel/index.tsx +2 -13
- package/src/components/command-bar/panel/layout.ts +1 -7
- package/src/components/command-bar/panel/runtime.ts +0 -1
- package/src/components/command-bar/panel/types.ts +0 -2
- package/src/components/command-bar/routes/ticker-search/actions.ts +2 -0
- package/src/components/command-bar/routes/ticker-search/results.ts +15 -8
- package/src/components/command-bar/surface/index.tsx +10 -5
- package/src/components/command-bar/workflow/alert.ts +21 -7
- package/src/components/data-table/column-menu.tsx +89 -0
- package/src/components/data-table/sort-menu.tsx +9 -2
- package/src/components/data-table/table-pane.ts +3 -1
- package/src/components/data-table/view.tsx +33 -6
- package/src/components/form-modal/content.tsx +10 -0
- package/src/components/index.ts +1 -1
- package/src/components/layout/pane/footer/index.tsx +25 -11
- package/src/components/layout/pane/footer/model.ts +88 -21
- package/src/components/layout/pane/sidebar.tsx +125 -15
- package/src/components/layout/shell/active-drag.ts +18 -13
- package/src/components/layout/shell/drag/magnets.ts +34 -18
- package/src/components/metric-treemap/heat-surface.tsx +2 -1
- package/src/components/metric-treemap/index.tsx +3 -2
- package/src/components/ticker/list-table-view.tsx +5 -0
- package/src/components/ui/confirm-dialog.tsx +253 -7
- package/src/components/ui/data-table/column-order.ts +180 -0
- package/src/components/ui/data-table/index.tsx +13 -2
- package/src/components/ui/data-table/opentui/index.tsx +267 -23
- package/src/components/ui/data-table/opentui/model.ts +43 -4
- package/src/components/ui/data-table/types.ts +56 -0
- package/src/components/ui/data-table/use-column-order.ts +135 -0
- package/src/components/ui/index.ts +1 -1
- package/src/components/ui/list-view.tsx +4 -3
- package/src/components/ui/status.tsx +9 -6
- package/src/components/ui/table-layout.ts +120 -0
- package/src/docs/snapshot.json +39 -2
- package/src/i18n/es.ts +14 -0
- package/src/i18n/ja.ts +14 -0
- package/src/i18n/ko.ts +14 -0
- package/src/i18n/zh-cn.ts +14 -0
- package/src/i18n/zh-tw.ts +14 -0
- package/src/market-data/coordinator/index.ts +4 -3
- package/src/market-data/coordinator/quotes.ts +12 -4
- package/src/market-data/fx-closes.ts +14 -2
- package/src/market-data/market/change-basis.ts +35 -1
- package/src/market-data/market/status.ts +37 -0
- package/src/market-data/performance.ts +4 -1
- package/src/market-data/quotes/freshness.ts +12 -0
- package/src/market-data/quotes/live-valuation.ts +26 -3
- package/src/market-data/quotes/regular-session-valuation.ts +1 -1
- package/src/market-data/realized-volatility.ts +3 -0
- package/src/market-data/us-bond-market.ts +115 -0
- package/src/plugins/builtin/account-management/invite-row.tsx +54 -0
- package/src/plugins/builtin/account-management/keyboard.ts +3 -0
- package/src/plugins/builtin/account-management/model.ts +1 -0
- package/src/plugins/builtin/account-management/pane.tsx +51 -5
- package/src/plugins/builtin/account-management/trial-cancel.ts +32 -7
- package/src/plugins/builtin/broker-manager/detail.tsx +5 -3
- package/src/plugins/builtin/broker-manager/index.tsx +6 -6
- package/src/plugins/builtin/broker-manager/model.ts +15 -6
- package/src/plugins/builtin/broker-manager/pane-actions.tsx +11 -4
- package/src/plugins/builtin/broker-manager/sign-in-end.ts +50 -19
- package/src/plugins/builtin/broker-manager/table.ts +10 -4
- package/src/plugins/builtin/chat/sidebar.tsx +33 -16
- package/src/plugins/builtin/cloud/askg/pane-session.ts +94 -0
- package/src/plugins/builtin/cloud/askg/pane.tsx +40 -83
- package/src/plugins/builtin/cloud/askg/tool-timeline.tsx +2 -0
- package/src/plugins/builtin/congress-trades/pane.tsx +8 -2
- package/src/plugins/builtin/correlation/compute.ts +4 -3
- package/src/plugins/builtin/earnings/board-model.ts +33 -0
- package/src/plugins/builtin/earnings/board-table.ts +50 -11
- package/src/plugins/builtin/earnings/board.tsx +29 -13
- package/src/plugins/builtin/earnings/calendar.tsx +15 -3
- package/src/plugins/builtin/earnings/client.ts +4 -1
- package/src/plugins/builtin/earnings/headless.ts +27 -14
- package/src/plugins/builtin/econ/calendar-source.ts +3 -0
- package/src/plugins/builtin/equity-screener/live.ts +74 -18
- package/src/plugins/builtin/equity-screener/model.ts +19 -4
- package/src/plugins/builtin/equity-screener/pane.tsx +19 -14
- package/src/plugins/builtin/equity-screener/refresh-anchor.ts +45 -0
- package/src/plugins/builtin/equity-screener/results.ts +22 -2
- package/src/plugins/builtin/equity-screener/screen-check.ts +9 -3
- package/src/plugins/builtin/futures/index.tsx +15 -1
- package/src/plugins/builtin/futures/table.tsx +1 -1
- package/src/plugins/builtin/fx-matrix/index.tsx +2 -0
- package/src/plugins/builtin/help/index.tsx +1 -1
- package/src/plugins/builtin/holders/pane.tsx +30 -20
- package/src/plugins/builtin/ipo-calendar/model.ts +3 -3
- package/src/plugins/builtin/iv-history/events.ts +5 -0
- package/src/plugins/builtin/iv-history/headless.ts +19 -12
- package/src/plugins/builtin/kelly-sizer/sections.tsx +2 -0
- package/src/plugins/builtin/macro-day/headless.ts +27 -8
- package/src/plugins/builtin/macro-day/model.ts +17 -4
- package/src/plugins/builtin/macro-day/releases.ts +36 -15
- package/src/plugins/builtin/market-halts/model.ts +3 -2
- package/src/plugins/builtin/market-movers/headless.ts +2 -1
- package/src/plugins/builtin/market-movers/index.tsx +3 -2
- package/src/plugins/builtin/market-movers/model.ts +75 -22
- package/src/plugins/builtin/market-movers/screener.ts +2 -1
- package/src/plugins/builtin/market-movers/table.ts +7 -5
- package/src/plugins/builtin/options/view.tsx +2 -0
- package/src/plugins/builtin/options-scenario/pane.tsx +2 -1
- package/src/plugins/builtin/pe-band/model.ts +4 -0
- package/src/plugins/builtin/perps/cascade-tabs.tsx +2 -1
- package/src/plugins/builtin/portfolio-list/cell-version.ts +4 -4
- package/src/plugins/builtin/portfolio-list/cli/render.ts +9 -4
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +15 -1
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +24 -7
- package/src/plugins/builtin/portfolio-list/summary/totals.ts +40 -11
- package/src/plugins/builtin/portfolio-list/table.tsx +18 -1
- package/src/plugins/builtin/rate-path/pane.tsx +2 -0
- package/src/plugins/builtin/research/analyst-headless.ts +9 -1
- package/src/plugins/builtin/research/analyst-pane.tsx +10 -4
- package/src/plugins/builtin/research/client.ts +25 -1
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +2 -1
- package/src/plugins/builtin/research/event-model.ts +3 -13
- package/src/plugins/builtin/research/event-sources.ts +3 -1
- package/src/plugins/builtin/revenue-breakdown/pane.tsx +2 -0
- package/src/plugins/builtin/reverse-dcf/pane.tsx +2 -1
- package/src/plugins/builtin/seasonality/pane.tsx +2 -1
- package/src/plugins/builtin/short-interest/headless.ts +2 -0
- package/src/plugins/builtin/short-interest/publications-headless.ts +2 -0
- package/src/plugins/builtin/short-interest/watch-headless.ts +1 -0
- package/src/plugins/builtin/thirteenf/pane.tsx +2 -0
- package/src/plugins/builtin/ticker-detail/financials/model.ts +28 -6
- package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +26 -9
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +58 -35
- package/src/plugins/builtin/vol-surface/heat-grid.tsx +2 -1
- package/src/plugins/builtin/vol-surface/pane.tsx +2 -1
- package/src/plugins/builtin/world-indices/index.tsx +5 -1
- package/src/plugins/builtin/yield-curve/headless.ts +5 -1
- package/src/plugins/builtin/yield-curve/index.tsx +7 -1
- package/src/portfolio/column-values.ts +47 -14
- package/src/portfolio/return-metrics.ts +4 -2
- package/src/renderers/dom/data-table/column-drag.ts +147 -0
- package/src/renderers/dom/data-table/index.tsx +22 -0
- package/src/renderers/dom/data-table/row.tsx +27 -5
- package/src/renderers/dom/host/image-surface.tsx +19 -9
- package/src/renderers/dom/host/input.tsx +4 -0
- package/src/renderers/dom/styles.css +22 -0
- package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +23 -1
- package/src/renderers/opentui/chart-surface.tsx +1 -0
- package/src/renderers/opentui/frame-hits.ts +33 -0
- package/src/renderers/opentui/host.tsx +2 -0
- package/src/renderers/opentui/native-surface.ts +14 -21
- package/src/renderers/opentui/test-utils.tsx +3 -0
- package/src/sources/gloomberb-cloud/normalizers.ts +2 -0
- package/src/sources/provider-errors.ts +12 -0
- package/src/sources/provider-router/index.ts +12 -4
- package/src/state/app/context/index.tsx +22 -0
- package/src/state/pane-session.ts +145 -0
- package/src/test-support/app-store.ts +24 -1
- package/src/tickers/search/home-listing.ts +44 -1
- package/src/tickers/search/index.ts +5 -2
- package/src/tickers/search/ranking.ts +7 -7
- package/src/tickers/us-listing.ts +11 -5
- package/src/time-series/base-series.ts +7 -1
- package/src/time-series/fundamentals/current-valuation.ts +8 -0
- package/src/time-series/fundamentals/series.ts +6 -0
- package/src/time-series/live-quotes.ts +3 -9
- package/src/time-series/resolve.ts +1 -0
- package/src/types/financials.ts +20 -0
- package/src/types/headless.ts +9 -0
- package/src/ui/host.tsx +20 -0
- package/src/ui/pointer-drag.ts +11 -2
- package/src/utils/exchanges.ts +13 -8
- package/src/utils/fundamentals.ts +14 -3
- package/src/utils/price-earnings.ts +17 -10
- package/src/utils/price-history-integrity.ts +15 -0
- package/src/utils/reason-codes.ts +79 -0
- package/src/utils/share-multiples.cases.json +1667 -0
- package/src/utils/share-multiples.ts +384 -0
- package/src/utils/untrusted-text.ts +11 -0
|
@@ -56,6 +56,16 @@ export interface CreatedMcpKey {
|
|
|
56
56
|
apiKey: { id: string; name: string; scope: McpKeyScope };
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
/**
|
|
60
|
+
* The account's invite link (`/account/referral`), and how many free Pro
|
|
61
|
+
* months it has earned so far out of the most it can.
|
|
62
|
+
*/
|
|
63
|
+
export interface ReferralInvite {
|
|
64
|
+
url: string;
|
|
65
|
+
earned: number;
|
|
66
|
+
cap: number;
|
|
67
|
+
}
|
|
68
|
+
|
|
59
69
|
/** The account's private calendar feed link (`/account/calendar-feed`). */
|
|
60
70
|
export interface CalendarFeed {
|
|
61
71
|
url: string;
|
|
@@ -52,3 +52,13 @@ export interface CloudPricing {
|
|
|
52
52
|
monthly: CloudPricingTier;
|
|
53
53
|
yearly: CloudPricingTier;
|
|
54
54
|
}
|
|
55
|
+
|
|
56
|
+
/** Why someone cancelled, as gloom.sh's cancel window and the cancel endpoint name it. */
|
|
57
|
+
export type CloudCancelReason = "bugs" | "missing_feature" | "too_expensive" | "not_using" | "temporary" | "other";
|
|
58
|
+
|
|
59
|
+
/** What a cancel may carry besides the cancel itself; both are optional. */
|
|
60
|
+
export interface CloudCancelFeedback {
|
|
61
|
+
reason?: CloudCancelReason;
|
|
62
|
+
/** A short note in the person's words, at most `CLOUD_CANCEL_COMMENT_MAX` characters. */
|
|
63
|
+
comment?: string;
|
|
64
|
+
}
|
|
@@ -50,6 +50,12 @@ export interface CloudEconCalendarFromPayload {
|
|
|
50
50
|
events: CloudEconEventPayload[];
|
|
51
51
|
/** The first UTC day the stored calendar holds; null when it holds nothing. */
|
|
52
52
|
storedFrom: string | null;
|
|
53
|
+
/**
|
|
54
|
+
* The first UTC day any read lists: `storedFrom`, or the furthest day back
|
|
55
|
+
* the calendar reaches (400 days) once that is later. Absent from an older
|
|
56
|
+
* server.
|
|
57
|
+
*/
|
|
58
|
+
listedFrom?: string;
|
|
53
59
|
/** The last UTC day the calendar lists releases for; absent from an older server. */
|
|
54
60
|
listedThrough?: string;
|
|
55
61
|
}
|
|
@@ -97,23 +103,29 @@ export interface CloudMacroReleaseDaysPayload {
|
|
|
97
103
|
/** The last New York day the lists are complete for. */
|
|
98
104
|
coveredThrough: string;
|
|
99
105
|
sources: string[];
|
|
100
|
-
/** New York dates, oldest first. Brazil's IPCA days when the server can vouch for them. */
|
|
101
|
-
releases: Record<"cpi" | "jobs" | "fomc", string[]> & { ipca?: string[] };
|
|
106
|
+
/** New York dates, oldest first. Brazil's IPCA days when the server can vouch for them, and the ECB's decision days. */
|
|
107
|
+
releases: Record<"cpi" | "jobs" | "fomc", string[]> & { ipca?: string[]; ecb?: string[] };
|
|
102
108
|
/** Each kind's figures by New York release day, for the days they are known. */
|
|
103
|
-
figures?: Partial<Record<"cpi" | "jobs" | "fomc" | "ipca", Record<string, {
|
|
109
|
+
figures?: Partial<Record<"cpi" | "jobs" | "fomc" | "ipca" | "ecb", Record<string, {
|
|
104
110
|
event: string;
|
|
105
111
|
actual: string | null;
|
|
106
112
|
forecast: string | null;
|
|
107
113
|
prior: string | null;
|
|
108
114
|
/** Above the consensus (hot), below it (cool), at it (in-line); null without both. */
|
|
109
115
|
surprise: "hot" | "cool" | "in-line" | null;
|
|
110
|
-
/** An FOMC day's move in the
|
|
116
|
+
/** An FOMC or ECB day's move in the rate: "held", "cut 25bp", "raised 50bp". */
|
|
111
117
|
decision?: string;
|
|
118
|
+
/** How the actual was computed where the calendar lists none: a CPI's year-on-year change from the index. */
|
|
119
|
+
computed?: string;
|
|
120
|
+
/** Why a day with a consensus or a prior has no actual, where it cannot be computed either. */
|
|
121
|
+
actualMissing?: string;
|
|
112
122
|
}>>>;
|
|
113
|
-
/** The first
|
|
123
|
+
/** The first day the kept economic calendar holds, the one `econ` names: days before it have no figures. */
|
|
114
124
|
figuresFrom?: string;
|
|
115
|
-
/** Why a
|
|
116
|
-
figureGaps?: Partial<Record<"cpi" | "jobs" | "fomc", Record<string, string>>>;
|
|
125
|
+
/** Why a release day from `figuresFrom` on has no figures, by kind and day. */
|
|
126
|
+
figureGaps?: Partial<Record<"cpi" | "jobs" | "fomc" | "ecb", Record<string, string>>>;
|
|
127
|
+
/** The next day of a kind its publisher schedules ahead: the ECB's next decision. */
|
|
128
|
+
scheduled?: { ecb?: string };
|
|
117
129
|
}
|
|
118
130
|
|
|
119
131
|
export interface CloudFredObservationPayload {
|
|
@@ -28,6 +28,13 @@ export interface CloudPricePointPayload {
|
|
|
28
28
|
contract?: string;
|
|
29
29
|
/** A currency pair's daily bar: when its close was taken (17:00 New York), as an ISO time, where the server knows it. */
|
|
30
30
|
closedAt?: string;
|
|
31
|
+
/** A currency pair's daily bar whose source repeated its open as its close: the close is the next session's open. */
|
|
32
|
+
closeRebuilt?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* A currency pair's daily bar whose source repeated its open as its close, which no next open in its week rebuilds
|
|
35
|
+
* (none, or one over 5% away): the close is no day's close.
|
|
36
|
+
*/
|
|
37
|
+
closeCopied?: boolean;
|
|
31
38
|
}
|
|
32
39
|
|
|
33
40
|
type CloudMarketStatus =
|
|
@@ -37,6 +37,8 @@ export interface CloudMarketScreenerItem extends CloudMoverSessionFields {
|
|
|
37
37
|
avgVolume?: number;
|
|
38
38
|
/** Observation time of the optional retained metadata. */
|
|
39
39
|
metadataAsOf?: string;
|
|
40
|
+
/** The listing's market cap from the same retained metadata, where it has one. */
|
|
41
|
+
marketCap?: number;
|
|
40
42
|
tradeCount?: number;
|
|
41
43
|
currency: string;
|
|
42
44
|
high52w?: number;
|
|
@@ -50,6 +50,23 @@ function brokerReason(lastError: string | null | undefined): string | null {
|
|
|
50
50
|
return described.replace(/[\s.]+$/, "").slice(0, 200) || null;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
/**
|
|
54
|
+
* What a profile says once the broker ended its sign-in, and to connect again.
|
|
55
|
+
* A broker that keeps one AI app per account (IBKR) ends Gloom's grant when
|
|
56
|
+
* another app is connected to the account, and says only "Invalid
|
|
57
|
+
* authorization status"; that one is said in plain words. A broker the app
|
|
58
|
+
* does not know yet counts as one, since only IBKR says it.
|
|
59
|
+
*/
|
|
60
|
+
function signInEndedMessage(name: string, lastError: string | null | undefined, singleConnection = true): string {
|
|
61
|
+
if (singleConnection && /invalid authorization status/i.test(lastError ?? "")) {
|
|
62
|
+
return `${name} disconnected Gloom, most often because another AI app was connected to the same account, and ${name} allows one at a time. Press Connect in Brokers.`;
|
|
63
|
+
}
|
|
64
|
+
const reason = brokerReason(lastError);
|
|
65
|
+
return reason
|
|
66
|
+
? `${name} needs you to sign in again: ${reason}. Press Connect in Brokers.`
|
|
67
|
+
: `Press Connect in Brokers to sign in to ${name}.`;
|
|
68
|
+
}
|
|
69
|
+
|
|
53
70
|
/** Gloom holds no live sign-in for the broker: only connecting again helps. */
|
|
54
71
|
class SignInNeededError extends Error {}
|
|
55
72
|
|
|
@@ -520,11 +537,8 @@ export function createSignedInBrokerAdapter(overrides: Partial<SignedInBrokerAda
|
|
|
520
537
|
const connection = await get<SignedInBrokerConnection>(instance, "");
|
|
521
538
|
canTrade.set(instance.id, connection.status === "connected" && connection.canTrade === true);
|
|
522
539
|
if (connection.status !== "connected") {
|
|
523
|
-
const
|
|
524
|
-
|
|
525
|
-
throw new SignInNeededError(reason
|
|
526
|
-
? `${name} needs you to sign in again: ${reason}. Press Connect in Brokers.`
|
|
527
|
-
: `Press Connect in Brokers to sign in to ${name}.`);
|
|
540
|
+
const singleConnection = deps.findBroker(signedInBrokerId(instance))?.capabilities.singleConnection;
|
|
541
|
+
throw new SignInNeededError(signInEndedMessage(brokerName(instance), connection.lastError, singleConnection !== false));
|
|
528
542
|
}
|
|
529
543
|
});
|
|
530
544
|
},
|
|
@@ -49,12 +49,24 @@ export interface SignedInBrokerConnection {
|
|
|
49
49
|
* The three fields below are absent from a Gloom server that predates them.
|
|
50
50
|
*/
|
|
51
51
|
expiresAt?: string | null;
|
|
52
|
-
/** Within
|
|
52
|
+
/** Within Gloom's warning window before `expiresAt` (two days), or past it: time to renew. */
|
|
53
53
|
expiresSoon?: boolean;
|
|
54
54
|
/** Why the broker ended the sign-in, in its own words. Null while connected. */
|
|
55
55
|
lastError?: string | null;
|
|
56
|
+
/**
|
|
57
|
+
* Whether the broker keeps one connection per account and will ask to
|
|
58
|
+
* replace the Gloom connection it lists for this one on the next sign-in:
|
|
59
|
+
* while it is live, or after the broker ended it on its clock. `may` when
|
|
60
|
+
* Gloom cannot tell an end from the user removing Gloom at the broker;
|
|
61
|
+
* null when it will not ask (none, or another app took the account).
|
|
62
|
+
* Absent from a Gloom server that predates it.
|
|
63
|
+
*/
|
|
64
|
+
replacePrompt?: BrokerReplacePrompt | null;
|
|
56
65
|
}
|
|
57
66
|
|
|
67
|
+
/** What a single-connection broker asks about the Gloom connection it lists, on a new sign-in. */
|
|
68
|
+
export type BrokerReplacePrompt = "will" | "may";
|
|
69
|
+
|
|
58
70
|
/** Public: the list does not depend on the user, so Add Broker can show it signed out. */
|
|
59
71
|
export function listSignedInBrokers(): Promise<{ connectors: SignedInBroker[] }> {
|
|
60
72
|
return apiClient.brokerRequest("connectors", "");
|
|
@@ -22,7 +22,7 @@ import { useDialog, useDialogKeyboard, type DialogApi, type PromptContext } from
|
|
|
22
22
|
import { isPlainKey } from "../../utils/keyboard";
|
|
23
23
|
import { wrapTextLines } from "../../utils/text-wrap";
|
|
24
24
|
import { DeviceSignInDialog } from "../../account/device-signin-dialog";
|
|
25
|
-
import type { SignedInBroker } from "./client";
|
|
25
|
+
import type { BrokerReplacePrompt, SignedInBroker } from "./client";
|
|
26
26
|
import {
|
|
27
27
|
BrokerSignInController,
|
|
28
28
|
runBrokerSignIn,
|
|
@@ -53,8 +53,18 @@ export const BROKER_CONNECT_SUBTITLE = "Continue in your browser.";
|
|
|
53
53
|
/** The key every connect surface takes for a fresh link, as the desktop shows it. */
|
|
54
54
|
export const BROKER_CONNECT_NEW_LINK = { key: "r", label: "new link" };
|
|
55
55
|
|
|
56
|
-
/**
|
|
57
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Under the panel: the broker's own note, or what connecting a single-connection
|
|
58
|
+
* broker does to other apps. When the broker will ask to replace the Gloom
|
|
59
|
+
* connection it already lists (`replace`, as Gloom says), the note says to
|
|
60
|
+
* choose that before the user gets there; `may` when Gloom cannot tell.
|
|
61
|
+
*/
|
|
62
|
+
export function brokerSignInNote(broker: SignedInBroker, replace: BrokerReplacePrompt | null = null): string | null {
|
|
63
|
+
if (replace && broker.capabilities.singleConnection) {
|
|
64
|
+
return replace === "will"
|
|
65
|
+
? tf("{broker} will ask to replace your existing Gloom connection. Choose to replace it.", { broker: broker.name })
|
|
66
|
+
: tf("{broker} may ask to replace your existing Gloom connection. If it does, choose to replace it.", { broker: broker.name });
|
|
67
|
+
}
|
|
58
68
|
return broker.capabilities.signupNote
|
|
59
69
|
?? (broker.capabilities.singleConnection
|
|
60
70
|
? tf("Other AI apps linked to {broker} get disconnected. Connect them to Gloom instead.", { broker: broker.name })
|
|
@@ -125,8 +135,8 @@ export async function promptGloomSignIn(dialog: DialogApi): Promise<boolean> {
|
|
|
125
135
|
*/
|
|
126
136
|
const TERMINAL_DIALOG_ROWS = 12;
|
|
127
137
|
const DESKTOP_DIALOG_ROWS = 10;
|
|
128
|
-
/** Columns the terminal's full dialog takes from the window: margins, border and padding. */
|
|
129
|
-
const TERMINAL_DIALOG_INSET =
|
|
138
|
+
/** Columns the terminal's full dialog takes from the window: margins (4), border (2) and padding (4). */
|
|
139
|
+
const TERMINAL_DIALOG_INSET = 10;
|
|
130
140
|
/** Cells the desktop dialog's padding takes from its width. */
|
|
131
141
|
const DESKTOP_DIALOG_INSET = 4;
|
|
132
142
|
|
|
@@ -136,7 +146,13 @@ function BrokerSignInDialog({
|
|
|
136
146
|
broker,
|
|
137
147
|
write,
|
|
138
148
|
renew,
|
|
139
|
-
|
|
149
|
+
replace,
|
|
150
|
+
}: PromptContext<BrokerSignInOutcome> & {
|
|
151
|
+
broker: SignedInBroker;
|
|
152
|
+
write: boolean;
|
|
153
|
+
renew: boolean;
|
|
154
|
+
replace: BrokerReplacePrompt | null;
|
|
155
|
+
}) {
|
|
140
156
|
useAppLanguage();
|
|
141
157
|
const { nativePaneChrome } = useUiCapabilities();
|
|
142
158
|
const { width: termWidth, height: termHeight } = useViewport();
|
|
@@ -169,6 +185,7 @@ function BrokerSignInDialog({
|
|
|
169
185
|
snapshot={snapshot}
|
|
170
186
|
height={Math.max(4, termHeight - DESKTOP_DIALOG_ROWS)}
|
|
171
187
|
width={FORM_DIALOG_WIDTH - DESKTOP_DIALOG_INSET}
|
|
188
|
+
replace={replace}
|
|
172
189
|
/>
|
|
173
190
|
<Box style={{ marginTop: "var(--gloom-space-md)" }}>
|
|
174
191
|
<DialogActions alignEnd hints={{ keys: [BROKER_CONNECT_NEW_LINK] }}>
|
|
@@ -194,6 +211,7 @@ function BrokerSignInDialog({
|
|
|
194
211
|
snapshot={snapshot}
|
|
195
212
|
height={Math.max(4, termHeight - TERMINAL_DIALOG_ROWS)}
|
|
196
213
|
width={Math.max(10, termWidth - TERMINAL_DIALOG_INSET)}
|
|
214
|
+
replace={replace}
|
|
197
215
|
/>
|
|
198
216
|
<Box height={1} />
|
|
199
217
|
<Box height={1}>
|
|
@@ -221,6 +239,7 @@ export function BrokerConnectView({
|
|
|
221
239
|
height,
|
|
222
240
|
width,
|
|
223
241
|
browserKey = true,
|
|
242
|
+
replace = null,
|
|
224
243
|
}: {
|
|
225
244
|
broker: SignedInBroker;
|
|
226
245
|
snapshot: BrokerSignInSnapshot;
|
|
@@ -230,11 +249,13 @@ export function BrokerConnectView({
|
|
|
230
249
|
width: number;
|
|
231
250
|
/** Whether `b` opens the link now. */
|
|
232
251
|
browserKey?: boolean;
|
|
252
|
+
/** Whether the broker will or may ask to replace the Gloom connection it lists: the note says to choose that. */
|
|
253
|
+
replace?: BrokerReplacePrompt | null;
|
|
233
254
|
}) {
|
|
234
255
|
useAppLanguage();
|
|
235
256
|
const colors = useThemeColors();
|
|
236
257
|
const desktop = useUiCapabilities().nativePaneChrome === true;
|
|
237
|
-
const note = brokerSignInNote(broker);
|
|
258
|
+
const note = brokerSignInNote(broker, replace);
|
|
238
259
|
const noteLines = note ? wrapTextLines(note, Math.max(10, desktop ? Math.min(width, NOTE_MEASURE) : width)) : [];
|
|
239
260
|
// The note goes under the panel, which gets the rows left.
|
|
240
261
|
const noteRows = note ? 1 + noteLines.length : 0;
|
|
@@ -275,6 +296,8 @@ export interface BrokerSignInRequest {
|
|
|
275
296
|
write?: boolean;
|
|
276
297
|
/** Sign in again although the broker is connected. */
|
|
277
298
|
renew?: boolean;
|
|
299
|
+
/** Whether the broker will or may ask to replace the Gloom connection it lists, as Gloom says. */
|
|
300
|
+
replace?: BrokerReplacePrompt | null;
|
|
278
301
|
resolve: (connected: boolean) => void;
|
|
279
302
|
}
|
|
280
303
|
|
|
@@ -288,12 +311,12 @@ const requestListeners = new Set<(request: BrokerSignInRequest) => void>();
|
|
|
288
311
|
*/
|
|
289
312
|
export function requestBrokerSignIn(
|
|
290
313
|
broker: SignedInBroker,
|
|
291
|
-
options: { write?: boolean; renew?: boolean } = {},
|
|
314
|
+
options: { write?: boolean; renew?: boolean; replace?: BrokerReplacePrompt | null } = {},
|
|
292
315
|
): Promise<boolean> {
|
|
293
316
|
if (requestListeners.size === 0) return Promise.resolve(false);
|
|
294
317
|
return new Promise((resolve) => {
|
|
295
318
|
const write = options.write ?? Boolean(broker.capabilities.orders);
|
|
296
|
-
for (const listener of requestListeners) listener({ broker, write, renew: options.renew, resolve });
|
|
319
|
+
for (const listener of requestListeners) listener({ broker, write, renew: options.renew, replace: options.replace, resolve });
|
|
297
320
|
});
|
|
298
321
|
}
|
|
299
322
|
|
|
@@ -320,6 +343,7 @@ export function BrokerSignInDialogHost() {
|
|
|
320
343
|
broker={broker}
|
|
321
344
|
write={write}
|
|
322
345
|
renew={renew}
|
|
346
|
+
replace={request.replace ?? null}
|
|
323
347
|
/>
|
|
324
348
|
),
|
|
325
349
|
}) ?? "cancelled",
|
|
@@ -61,6 +61,7 @@ import {
|
|
|
61
61
|
formatAnalystReference,
|
|
62
62
|
ratingReason,
|
|
63
63
|
} from "../../plugins/builtin/research/analyst-model";
|
|
64
|
+
import { hasAnalystCoverage, loadAnalystResearch, noAnalystCoverageText } from "../../plugins/builtin/research/client";
|
|
64
65
|
import { getPublishedUsEquityCalendarYears, getPublishedUsEquitySession } from "../../market-data/published-us-sessions";
|
|
65
66
|
import { awaitingFirstDelayedPrint, isQuoteStaleForCurrentSession, noPrintsTodayText, nominalPriceText, nominalSessionLabel } from "../../market-data/quotes/freshness";
|
|
66
67
|
import {
|
|
@@ -155,6 +156,7 @@ import {
|
|
|
155
156
|
historyFacts,
|
|
156
157
|
historyFlagNote,
|
|
157
158
|
historyOpenNote,
|
|
159
|
+
historyCopiedCloseNote,
|
|
158
160
|
historyWickNote,
|
|
159
161
|
historyContractDrawdown,
|
|
160
162
|
historyRollNote,
|
|
@@ -194,7 +196,7 @@ import {
|
|
|
194
196
|
} from "../history-export";
|
|
195
197
|
import { fail, failWithError, isCliFailure, NO_DATA_CODE } from "../errors";
|
|
196
198
|
import { createConcurrencyLimiter, mapWithConcurrency } from "../../utils/concurrency";
|
|
197
|
-
import { MISSING_VOLUME_TEXT } from "../../utils/price-history-integrity";
|
|
199
|
+
import { CLOSE_COPIED_FLAG, MISSING_VOLUME_TEXT } from "../../utils/price-history-integrity";
|
|
198
200
|
import { CRYPTO_BOARD_HINT, quoteNotes } from "./crypto-hints";
|
|
199
201
|
import { bareFuturesCode, futuresBoardContract } from "../../market-data/futures-board";
|
|
200
202
|
import { commodityNamedIn, commoditySearchName } from "../../market-data/commodity-names";
|
|
@@ -235,7 +237,8 @@ import { quoteBarNotes } from "../../market-data/quotes/intraday-bar";
|
|
|
235
237
|
import { cedearRatioText, depositaryPairText, isReceiptSide, listingCedearRatio, listingDepositaryPair } from "../../market-data/depositary-pair";
|
|
236
238
|
import { isPesoDollarPair, loadPesoDollarRates, pesoDollarRateLines, pesoDollarRatesJson } from "../peso-dollar-rates";
|
|
237
239
|
import { withBalanceSheetRate } from "../../market-data/quotes/balance-sheet-rate";
|
|
238
|
-
import {
|
|
240
|
+
import { regularSessionValuationPrice } from "../../market-data/quotes/regular-session-valuation";
|
|
241
|
+
import { atLivePriceEarnings } from "../../market-data/quotes/live-valuation";
|
|
239
242
|
import { viewMarketCapitalization } from "../../utils/market-capitalization";
|
|
240
243
|
import {
|
|
241
244
|
barHistoryFreshness,
|
|
@@ -2031,6 +2034,7 @@ async function loadListingHistory(
|
|
|
2031
2034
|
: range === "YTD" ? ytdHistoryNotes(data) : [...historyNotes(range, interval, data[0]?.date, Date.now(), coverage != null), coverage ?? []],
|
|
2032
2035
|
// The status line says how far a bar still forming runs; the note is for the bars it does not name.
|
|
2033
2036
|
gaps ?? [], historyJumpNote(data) ?? [], historyRescaleNote(data) ?? [], historyFlagNote(data) ?? [], historyOpenNote(data) ?? [], historyWickNote(data) ?? [],
|
|
2037
|
+
historyCopiedCloseNote(data) ?? [],
|
|
2034
2038
|
historyMissingVolumeNote(data) ?? [],
|
|
2035
2039
|
historyVenueVolumeNote(data) ?? [],
|
|
2036
2040
|
// NG=F's rows are November's to the 23rd and December's from the 26th: each roll named, and thin bars said.
|
|
@@ -2237,9 +2241,10 @@ async function runHistory(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
2237
2241
|
// A yield (^TNX) falls and rises by its level, in bp, and its largest rise is said too.
|
|
2238
2242
|
const yieldUnits = isYieldIndexSymbol(history.listing.symbol);
|
|
2239
2243
|
// A week's or month's close is dated by its last session (March 2026 is Tue 31 Mar), not the 1st its bar is dated by.
|
|
2240
|
-
|
|
2244
|
+
// A pair's close its source copied from the open, with nothing to rebuild it from, is no day's close (flag close copied).
|
|
2245
|
+
const closes = (interval === "1wk" || interval === "1mo"
|
|
2241
2246
|
? data.map((row) => ({ ...row, date: barCloseSession(interval, row.date, identity.exchange || undefined, Date.now()) }))
|
|
2242
|
-
: data;
|
|
2247
|
+
: data).filter((row) => !row.flag?.split(",").includes(CLOSE_COPIED_FLAG));
|
|
2243
2248
|
const contractDrawdown = historyContractDrawdown(closes, yieldUnits ? "yield" : "return");
|
|
2244
2249
|
// A window's last week can close after the dates asked for (--to 2003, a week ending Fri 2 Jan 2004): measured to its end.
|
|
2245
2250
|
const until = ask.window?.to;
|
|
@@ -2754,7 +2759,7 @@ async function runFinancials(rawArgs: string[], ctx: Parameters<CliCommandDef["e
|
|
|
2754
2759
|
// A valuation is measured at the quote's regular session price, so the quote dates it.
|
|
2755
2760
|
const freshness = view === "valuation" ? valuationFreshness(financials) : fundamentalsFreshness(financials);
|
|
2756
2761
|
// Market cap, the multiples and the yield at the regular session price, as the text gives them; the quote stays as sent.
|
|
2757
|
-
const priced =
|
|
2762
|
+
const priced = atLivePriceEarnings(financials);
|
|
2758
2763
|
// One market cap per view: the share count times the price where the provider's sits more than 2% from it.
|
|
2759
2764
|
const capitalization = viewMarketCapitalization(priced.quote, priced.fundamentals, regularSessionValuationPrice(priced.quote));
|
|
2760
2765
|
// The filings behind the latest statements, and for a bank its deposits, uninsured share and CRE.
|
|
@@ -3649,7 +3654,8 @@ async function runAnalyst(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
3649
3654
|
const venues = loadBareVenues(listing, market);
|
|
3650
3655
|
const [data, quote] = await Promise.all([
|
|
3651
3656
|
loadForListing(
|
|
3652
|
-
listing
|
|
3657
|
+
// A listing no analyst covers loads as research with nothing in it, said below rather than failed.
|
|
3658
|
+
listing, market, ctx, () => loadAnalystResearch(market.dataProvider, listing.request.symbol, listing.request.exchange),
|
|
3653
3659
|
undefined, { command: "analyst", noun: "analyst research" },
|
|
3654
3660
|
),
|
|
3655
3661
|
loadListingQuote(market.dataProvider, listing),
|
|
@@ -3676,7 +3682,8 @@ async function runAnalyst(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
3676
3682
|
}, {
|
|
3677
3683
|
heading: listingHeading(identity),
|
|
3678
3684
|
rows: analystRows,
|
|
3679
|
-
summary: (research) => analystSummary(research, quote),
|
|
3685
|
+
summary: (research) => hasAnalystCoverage(research) ? analystSummary(research, quote) : "",
|
|
3686
|
+
empty: noAnalystCoverageText(identity.symbol),
|
|
3680
3687
|
rowNote: analystRowNote,
|
|
3681
3688
|
columns: [
|
|
3682
3689
|
{ key: "date", header: "Date" },
|
|
@@ -4082,7 +4089,10 @@ async function runFxOnDate(
|
|
|
4082
4089
|
};
|
|
4083
4090
|
const warnings = [
|
|
4084
4091
|
...request.readAs ?? [],
|
|
4085
|
-
...closeDate < date ? [
|
|
4092
|
+
...closeDate < date ? [[...legs.values()].some((leg) => leg.copiedClose === date)
|
|
4093
|
+
// The source repeated the day's open as its close and nothing rebuilt it: no close of that day is known.
|
|
4094
|
+
? `No daily close on ${date}: the source repeated that day's open as its close. This is the close of ${closeDate}, the trading day before it.`
|
|
4095
|
+
: `No daily close on ${date}, a weekend or market holiday: this is the close of ${closeDate}, the trading day before it.`] : [],
|
|
4086
4096
|
...toUsdByDefault && amount != null
|
|
4087
4097
|
? [`No target currency given, so ${fxSideCode(request, "currency")} is converted to USD; for another, write fx ${args[0]!.trim()} ${fxSideCode(request, "currency")}/<to> --date ${date}.`]
|
|
4088
4098
|
: [],
|
|
@@ -102,6 +102,7 @@ import {
|
|
|
102
102
|
laggingSeriesNote,
|
|
103
103
|
parseFredChange,
|
|
104
104
|
} from "./fred-series";
|
|
105
|
+
import { followsUsBondMarket, usBondMarketClosedNote } from "../../market-data/us-bond-market";
|
|
105
106
|
|
|
106
107
|
// Batch quotes often omit names for indices and ETFs; these baskets are fixed, so name them here.
|
|
107
108
|
const BASKET_NAMES = new Map<string, string>([
|
|
@@ -302,7 +303,8 @@ async function runMoverCommand(rawArgs: string[], ctx: Parameters<CliCommandDef[
|
|
|
302
303
|
// --session extended by the extended print's move from that close.
|
|
303
304
|
const { quotes, rankedBy } = rankMoverQuotes(category, movers.quotes.map(moverRegularSession), basis);
|
|
304
305
|
const rows = quotes.filter((quote) => meetsMinFloat(quote.floatShares, minFloat)).slice(0, limit).map((quote) => {
|
|
305
|
-
|
|
306
|
+
// closedSession only tells the live overlay which session the row's volume is.
|
|
307
|
+
const { extended, closedSession: _closedSession, ...row } = quote;
|
|
306
308
|
return {
|
|
307
309
|
...row,
|
|
308
310
|
extendedSession: extended?.session ?? null,
|
|
@@ -588,8 +590,12 @@ async function runEcon(args: string[], ctx: Parameters<CliCommandDef["execute"]>
|
|
|
588
590
|
// A day before anything the calendar holds says where its listing starts.
|
|
589
591
|
const firstEvent = events.reduce<Date | null>((first, event) => (!first || event.date < first ? event.date : first), null);
|
|
590
592
|
const listedFrom = firstEvent ? firstEvent.toISOString().slice(0, 10) : null;
|
|
591
|
-
|
|
593
|
+
// The stored calendar's first day, or once the calendar reaches back less far than that, the furthest day it lists.
|
|
594
|
+
const pastFrom = past ? past.listedFrom ?? past.storedFrom : null;
|
|
595
|
+
const startsLater = fromOption != null && (past ? pastFrom == null || pastFrom > fromOption : listedFrom != null && listedFrom > fromOption);
|
|
592
596
|
const listedBefore = !startsLater ? null
|
|
597
|
+
: past?.listedFrom && (!past.storedFrom || past.listedFrom > past.storedFrom)
|
|
598
|
+
? `The calendar lists back ${Math.round((todayStart - Date.parse(`${past.listedFrom}T00:00:00Z`)) / DAY_MS)} days, to ${past.listedFrom}; nothing earlier is listed`
|
|
593
599
|
: past?.storedFrom ? `The stored calendar starts ${past.storedFrom}; nothing earlier is listed`
|
|
594
600
|
: `No events are stored before ${listedFrom ?? isoDate(new Date(todayStart))}`;
|
|
595
601
|
// Countries asked for that nothing in the window is for: a quiet week there, not an unknown country.
|
|
@@ -666,7 +672,7 @@ async function runEcon(args: string[], ctx: Parameters<CliCommandDef["execute"]>
|
|
|
666
672
|
ctx.printResult({
|
|
667
673
|
data: rows,
|
|
668
674
|
...(unread ? { warnings: [unread] } : {}),
|
|
669
|
-
metadata: { country, impact, ...(search != null ? { search } : {}), from, listedThrough, storedFrom: past?.storedFrom ?? null, ...(viewerZone ? { timeZone: viewerZone } : {}) },
|
|
675
|
+
metadata: { country, impact, ...(search != null ? { search } : {}), from, listedThrough, storedFrom: past?.storedFrom ?? null, ...(past?.listedFrom ? { listedFrom: past.listedFrom } : {}), ...(viewerZone ? { timeZone: viewerZone } : {}) },
|
|
670
676
|
freshness: calendarFreshness,
|
|
671
677
|
}, {
|
|
672
678
|
dateKey: "date",
|
|
@@ -825,7 +831,7 @@ async function printFredSeries(ctx: Parameters<CliCommandDef["execute"]>[1], { s
|
|
|
825
831
|
...releasedOf(observation) ? { released: releasedOf(observation) } : {},
|
|
826
832
|
});
|
|
827
833
|
// A --start before the series begins comes back padded with blank days: the rows start at its first observation.
|
|
828
|
-
const
|
|
834
|
+
const fromStart = fredObservationsFromStart(data.observations, data.info?.observationStart)
|
|
829
835
|
.filter((observation) => !horizon || observation.date >= startDate)
|
|
830
836
|
.map(exportRow);
|
|
831
837
|
// The default start hides older history and a start before the series begins is moved up silently: say where it really starts.
|
|
@@ -837,8 +843,13 @@ async function printFredSeries(ctx: Parameters<CliCommandDef["execute"]>[1], { s
|
|
|
837
843
|
seriesNotOnFred(seriesId)?.attribution ?? null,
|
|
838
844
|
].filter((note): note is string => note != null);
|
|
839
845
|
// Nothing on or after the start: name where the series ends, so an empty answer is not a dead end.
|
|
840
|
-
const latest =
|
|
846
|
+
const latest = fromStart.length > 0 ? null : await loadFredSeries(seriesId, { limit: 1, sortOrder: "desc" })
|
|
841
847
|
.then((payload) => payload.observations[0] ?? null).catch(logFailure("cli.commands-overview", "Read latest economic series observation failed", null));
|
|
848
|
+
// A rate observed on US bond market days, started on a day the market was shut (Veterans Day), shows the day before
|
|
849
|
+
// and says why: "Wed 11 Nov: US bond market closed (Veterans Day); showing Tue 10 Nov".
|
|
850
|
+
const closedDay = latest && latest.value != null && followsUsBondMarket(seriesId) ? usBondMarketClosedNote(startDate, latest.date) : null;
|
|
851
|
+
const rows = closedDay && latest ? [exportRow(latest)] : fromStart;
|
|
852
|
+
if (closedDay) notes.unshift(closedDay);
|
|
842
853
|
// CSV and NDJSON are rows alone: an empty one would read as a series with no data, so it fails and says where the series ends.
|
|
843
854
|
if (rows.length === 0 && (ctx.cliOptions.format === "csv" || ctx.cliOptions.format === "ndjson")) {
|
|
844
855
|
ctx.fail(`No ${seriesId} observations on or after ${startDate}.`, fredEmptyAdvice(seriesId, latest));
|
|
@@ -859,7 +870,7 @@ async function printFredSeries(ctx: Parameters<CliCommandDef["execute"]>[1], { s
|
|
|
859
870
|
info: data.info, seriesId, startDate, sortOrder, unit, interval,
|
|
860
871
|
...(horizon ? { change: horizon } : {}),
|
|
861
872
|
...(notes.length ? { notes } : {}),
|
|
862
|
-
...(latest ? { latestObservation: exportRow(latest) } : {}),
|
|
873
|
+
...(latest && !closedDay ? { latestObservation: exportRow(latest) } : {}),
|
|
863
874
|
},
|
|
864
875
|
freshness: rowsFreshness(rows, {
|
|
865
876
|
source: ahead?.source ?? notOnFredSource(seriesId) ?? "FRED", status: "not-a-feed", basis: "published statistics", observedKey: "date", oldest: null,
|
|
@@ -910,7 +921,12 @@ async function runYieldCurve(rawArgs: string[], ctx: Parameters<CliCommandDef["e
|
|
|
910
921
|
rejectArgs(args, "yield-curve [--start <date>]", ctx);
|
|
911
922
|
const series = Object.keys(YIELD_TENORS);
|
|
912
923
|
const results = await withSavedFredSeries(ctx, () => Promise.all(series.map(async (seriesId) => {
|
|
913
|
-
|
|
924
|
+
let data = await loadFredSeries(seriesId, { startDate, sortOrder: "desc" });
|
|
925
|
+
// A start on a day the bond market was shut (Veterans Day) has nothing on or after it yet: the day before stands in.
|
|
926
|
+
if (!data.observations.some((observation) => observation.value != null)) {
|
|
927
|
+
const before = await loadFredSeries(seriesId, { limit: 2, sortOrder: "desc" });
|
|
928
|
+
if (before.observations[0] && usBondMarketClosedNote(startDate, before.observations[0].date)) data = before;
|
|
929
|
+
}
|
|
914
930
|
const [latest, previous] = data.observations;
|
|
915
931
|
return {
|
|
916
932
|
// A tenor from the copy an earlier read saved, the refresh having failed, says so in the source line.
|
|
@@ -930,6 +946,8 @@ async function runYieldCurve(rawArgs: string[], ctx: Parameters<CliCommandDef["e
|
|
|
930
946
|
})));
|
|
931
947
|
// Tenors whose latest yield FRED does not list yet name the Treasury and when it published them.
|
|
932
948
|
const ahead = fredProvenance(results.flatMap((row) => row.latest ? [row.latest] : []));
|
|
949
|
+
const shown = results.map((row) => row.date).filter(Boolean).sort().at(-1);
|
|
950
|
+
const closedDay = shown ? usBondMarketClosedNote(startDate, shown) : null;
|
|
933
951
|
// The curve shown was published with its last tenor: the newest of their FRED updates, when each has one.
|
|
934
952
|
const published = results.map((row) => row.publishedAt);
|
|
935
953
|
const publishedAt = ahead ? ahead.publishedAt : published.every((time) => time != null) ? published.sort().at(-1) : null;
|
|
@@ -943,6 +961,7 @@ async function runYieldCurve(rawArgs: string[], ctx: Parameters<CliCommandDef["e
|
|
|
943
961
|
}),
|
|
944
962
|
}, {
|
|
945
963
|
exportIdentity: (row) => ({ symbolOrSeries: String(row.seriesId), currencyOrUnit: "pct", interval: "daily" }),
|
|
964
|
+
...(closedDay ? { footnote: closedDay, exportNotes: [closedDay] } : {}),
|
|
946
965
|
textColumns: [
|
|
947
966
|
{ key: "tenor", header: "Tenor", value: (row) => YIELD_TENORS[String(row.seriesId)] ?? row.seriesId },
|
|
948
967
|
{ key: "value", header: "Yield %", align: "right", format: (value) => typeof value === "number" ? value.toFixed(2) : "-" },
|
|
@@ -56,7 +56,7 @@ import type { CompanyProfile, DeclaredDividendAction, FinancialStatement, Quote,
|
|
|
56
56
|
import { apiClient } from "../../api-client";
|
|
57
57
|
import { withBalanceSheetRate } from "../../market-data/quotes/balance-sheet-rate";
|
|
58
58
|
import { enterpriseValueBridgeNote, listingEnterpriseValue } from "../../market-data/quotes/listing-enterprise-value";
|
|
59
|
-
import {
|
|
59
|
+
import { regularSessionValuationPrice } from "../../market-data/quotes/regular-session-valuation";
|
|
60
60
|
import { computeTickerPriceReturns } from "../../market-data/ticker-price-returns";
|
|
61
61
|
import { instrumentTypeLabel, resolveTickerInstrumentKind } from "../../tickers/instrument-kind";
|
|
62
62
|
import { INDEX_POINTS_LABEL, isIndexLevel, reportedQuoteVolume } from "../../market-data/market/index-level";
|
|
@@ -106,7 +106,7 @@ import type { ReportFreshness } from "../pane-functions/freshness";
|
|
|
106
106
|
import { fundamentalsFreshness, quotesFreshness } from "../freshness";
|
|
107
107
|
import { distributionHistory, forwardDividendBasis, forwardDividendMayHaveLapsed, lapsedDividend, noCurrentDividend, TRAILING_DIVIDEND_BASIS, type DistributionHistory, type DividendLapse } from "../../utils/forward-dividend";
|
|
108
108
|
import { declaredDividends } from "../../utils/declared-dividends";
|
|
109
|
-
import { historyTrailingDividendYield, measuresTrailingYield } from "../../market-data/quotes/live-valuation";
|
|
109
|
+
import { atLivePriceEarnings, historyTrailingDividendYield, measuresTrailingYield } from "../../market-data/quotes/live-valuation";
|
|
110
110
|
import { loadOfferingFilings, loadStatementFilings, resultsReleaseText, statementPeriodText, type StatementFilingsReport } from "../statement-filings";
|
|
111
111
|
import type { BankFiguresPayload } from "../../api-client/bank-figures";
|
|
112
112
|
import { bankSection } from "../bank-section";
|
|
@@ -862,17 +862,19 @@ function fundamentalsMetrics(
|
|
|
862
862
|
): FundamentalsMetric[] {
|
|
863
863
|
const signed = (value: number) => colorBySign(formatPercent(value), value);
|
|
864
864
|
const receipt = fundamentals?.sharesOutstanding != null && sharesOutstandingInReceipts(quote, fundamentals, profile?.description);
|
|
865
|
+
const withdrawn = fundamentals?.notMeaningful ?? {};
|
|
865
866
|
return [
|
|
866
867
|
{ label: "Market Cap", ...marketCap },
|
|
867
868
|
{ label: "Enterprise Value", ...enterpriseValueFigure(enterpriseValue, withBankEnterpriseValue(fundamentals, profile)) },
|
|
868
|
-
// A multiple over a loss is N/M, even beside a positive one the source served from an older period
|
|
869
|
-
|
|
869
|
+
// A multiple over a loss is N/M, even beside a positive one the source served from an older period, and so is one
|
|
870
|
+
// withdrawn as no multiple of the share (a warrant's, an EPS that is not net income over the shares; share-multiples).
|
|
871
|
+
{ label: epsYear ? `P/E ${epsYear}` : "P/E (TTM)", ...multipleFigure(withdrawn.trailingPE ? NOT_MEANINGFUL : priceEarningsOnEarnings(fundamentals?.trailingPE, fundamentals?.eps)) },
|
|
870
872
|
// Next fiscal year's consensus, named by its year: `Forward P/E FY27`.
|
|
871
873
|
{
|
|
872
874
|
label: forwardLabel(fundamentals),
|
|
873
|
-
...multipleFigure(priceEarningsOnEarnings(fundamentals?.forwardPE, fundamentals?.forwardEps)),
|
|
875
|
+
...multipleFigure(withdrawn.forwardPE ? NOT_MEANINGFUL : priceEarningsOnEarnings(fundamentals?.forwardPE, fundamentals?.forwardEps)),
|
|
874
876
|
},
|
|
875
|
-
{ label: "PEG", ...multipleFigure(fundamentals?.pegRatio) },
|
|
877
|
+
{ label: "PEG", ...multipleFigure(withdrawn.pegRatio ? NOT_MEANINGFUL : fundamentals?.pegRatio) },
|
|
876
878
|
// EPS (TTM) is the last four filed quarters' (filed-trailing-eps), so its twelve months can end before those of
|
|
877
879
|
// the flows below, Gloom Cloud's trailing block; Gloom Cloud's EPS standing in is noted (trailingEpsSourceNote).
|
|
878
880
|
{ label: epsYear ? `EPS ${epsYear}` : "EPS (TTM)", ...reportedMoney(fundamentals?.eps, fundamentals?.epsCurrency?.trim() || reportingCurrency, true, codes) },
|
|
@@ -962,7 +964,8 @@ const TRAILING_MONEY_METRICS = new Set(["EPS (TTM)", "Revenue (TTM)", "Net Incom
|
|
|
962
964
|
* The notes under shown fundamentals: a market cap shown as the share count times the price and the provider's, how a labelled or
|
|
963
965
|
* withdrawn EV compares with market cap + debt - cash, what a converted TTM block was converted from, an EPS in
|
|
964
966
|
* another currency than the amounts beside it, and what a P/E on such an EPS divides. `priced` is the snapshot at
|
|
965
|
-
* the regular session price (
|
|
967
|
+
* the regular session price with the P/E the Overview shows (atLivePriceEarnings), the figures the lines show, so
|
|
968
|
+
* each note reads those.
|
|
966
969
|
*/
|
|
967
970
|
function fundamentalsNotes(
|
|
968
971
|
/** With the statements where the report has them: the balance sheet says what a bridge's cash holds. */
|
|
@@ -994,10 +997,32 @@ function fundamentalsNotes(
|
|
|
994
997
|
: undefined;
|
|
995
998
|
// A cap Gloom Cloud withheld says why, as RV and EQS do.
|
|
996
999
|
const withheld = withheldMarketCap(fundamentals)?.note;
|
|
997
|
-
return [withheld, shareBasis, enterpriseValue, conversion, eps, epsSource, priceEarnings,
|
|
1000
|
+
return [withheld, shareBasis, enterpriseValue, conversion, eps, epsSource, priceEarnings, withdrawnMultiplesNote(fundamentals, metrics),
|
|
1001
|
+
unsourcedCurrencyNote(metrics)]
|
|
998
1002
|
.filter((note): note is string => !!note);
|
|
999
1003
|
}
|
|
1000
1004
|
|
|
1005
|
+
/**
|
|
1006
|
+
* Why the P/E lines shown N/M are withdrawn (utils/share-multiples): "P/E (TTM) and Forward P/E are N/M: a warrant is
|
|
1007
|
+
* not the share the EPS is per." One reason for every line it withdraws; a loss's N/M needs none.
|
|
1008
|
+
*/
|
|
1009
|
+
function withdrawnMultiplesNote(fundamentals: TickerFinancials["fundamentals"], metrics: readonly FundamentalsMetric[]): string | undefined {
|
|
1010
|
+
const reasons = fundamentals?.notMeaningful;
|
|
1011
|
+
if (!reasons) return undefined;
|
|
1012
|
+
const lines = metrics.filter((metric) => metric.text === "N/M" && !metric.exportOnly).flatMap((metric) => {
|
|
1013
|
+
const name = metricName(metric.label);
|
|
1014
|
+
const field = name === "P/E (TTM)" ? "trailingPE" : name === "Forward P/E" ? "forwardPE" : name === "PEG" ? "pegRatio" : undefined;
|
|
1015
|
+
const reason = field && reasons[field];
|
|
1016
|
+
return reason ? [{ label: metric.label, reason }] : [];
|
|
1017
|
+
});
|
|
1018
|
+
const groups = new Map<string, string[]>();
|
|
1019
|
+
for (const { label, reason } of lines) groups.set(reason, [...groups.get(reason) ?? [], label]);
|
|
1020
|
+
return [...groups].map(([reason, labels]) => {
|
|
1021
|
+
const named = labels.length === 1 ? labels[0] : `${labels.slice(0, -1).join(", ")} and ${labels.at(-1)}`;
|
|
1022
|
+
return `${named} ${labels.length === 1 ? "is" : "are"} N/M: ${reason}.`;
|
|
1023
|
+
}).join(" ") || undefined;
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1001
1026
|
// The share count is the market cap's basis: the cap is the count times the price, or a note says why not.
|
|
1002
1027
|
const VALUATION_METRICS = new Set(["Market Cap", "Shares Outstanding", "Shares Outstanding As Of", "Enterprise Value", "P/E (TTM)", "Forward P/E", "PEG", "EPS (TTM)"]);
|
|
1003
1028
|
|
|
@@ -1106,11 +1131,11 @@ function valuationPriceMetrics(financials: FundamentalsReportData): Fundamentals
|
|
|
1106
1131
|
/**
|
|
1107
1132
|
* The lines `fundamentals` or `valuation` reports, the ones with a value.
|
|
1108
1133
|
* Market cap, the P/E multiples and the dividend yield are measured at the
|
|
1109
|
-
* regular session price
|
|
1110
|
-
*
|
|
1134
|
+
* regular session price, which `valuation` names in its first lines, and a P/E
|
|
1135
|
+
* is the one the Overview and EQS show for it (atLivePriceEarnings).
|
|
1111
1136
|
*/
|
|
1112
1137
|
function fundamentalsReportMetrics(snapshot: FundamentalsReportData, view: "fundamentals" | "valuation"): FundamentalsMetric[] {
|
|
1113
|
-
const financials =
|
|
1138
|
+
const financials = atLivePriceEarnings(snapshot);
|
|
1114
1139
|
const quote = financials.quote;
|
|
1115
1140
|
const fundamentals = financials.fundamentals;
|
|
1116
1141
|
const capitalization = viewMarketCapitalization(quote, fundamentals, regularSessionValuationPrice(quote));
|
|
@@ -1158,7 +1183,7 @@ export function renderFundamentalsReport(
|
|
|
1158
1183
|
const fund = fundFactsNote(symbol, financials.exchange || quote?.exchangeName, financials, null, financials.fundFacts);
|
|
1159
1184
|
if (lines.length === before) lines.push("", cliStyles.muted([`No ${view} reported for ${financials.symbol}.`, fund].filter(Boolean).join(" ")));
|
|
1160
1185
|
else if (fund) lines.push(cliStyles.muted(fund));
|
|
1161
|
-
for (const note of fundamentalsNotes(
|
|
1186
|
+
for (const note of fundamentalsNotes(atLivePriceEarnings(financials), metrics, quote?.currency, listingEnterpriseView(financials).note)) {
|
|
1162
1187
|
lines.push(cliStyles.muted(note));
|
|
1163
1188
|
}
|
|
1164
1189
|
if (view === "fundamentals") {
|
|
@@ -1235,7 +1260,7 @@ export function fundamentalsReportTables(
|
|
|
1235
1260
|
notes: [
|
|
1236
1261
|
...metrics.length === 0
|
|
1237
1262
|
? [`No ${view} reported for ${financials.symbol}.`]
|
|
1238
|
-
: fundamentalsNotes(
|
|
1263
|
+
: fundamentalsNotes(atLivePriceEarnings(financials), metrics, financials.quote?.currency, listingEnterpriseView(financials).note),
|
|
1239
1264
|
...fund ? [fund] : [],
|
|
1240
1265
|
...view === "fundamentals" ? statementFilingsNotes(financials.statementFilings) : [],
|
|
1241
1266
|
...bank?.notes ?? [],
|
|
@@ -1394,7 +1419,7 @@ export async function buildTickerReport({
|
|
|
1394
1419
|
}
|
|
1395
1420
|
|
|
1396
1421
|
// Market cap and the multiples are measured at the regular session price the Quote section heads with.
|
|
1397
|
-
const priced =
|
|
1422
|
+
const priced = atLivePriceEarnings(financials);
|
|
1398
1423
|
const capitalization = viewMarketCapitalization(priced.quote, priced.fundamentals, regularSessionValuationPrice(priced.quote));
|
|
1399
1424
|
// Market cap and EV read in the currency they are reported in, as the revenue and income beside them do,
|
|
1400
1425
|
// with the base currency's figure after them when it differs: 627.2B USD (878.15B CAD).
|
|
@@ -1613,7 +1638,7 @@ function buildTickerStructuredData({
|
|
|
1613
1638
|
const priceReturns = computeTickerPriceReturns(financials, tickerFile?.metadata.assetCategory);
|
|
1614
1639
|
const identity = listingIdentity(listing, quote);
|
|
1615
1640
|
// Market cap and the multiples at the regular session price, as the text report gives them.
|
|
1616
|
-
const priced =
|
|
1641
|
+
const priced = atLivePriceEarnings(financials);
|
|
1617
1642
|
const runway = cashRunway(financials);
|
|
1618
1643
|
return {
|
|
1619
1644
|
symbol,
|