gloomberb 0.20.9 → 0.20.10
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/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/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/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/command-bar/list/model.ts +13 -0
- 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/table-pane.ts +3 -1
- package/src/components/layout/pane/footer/model.ts +26 -1
- package/src/components/metric-treemap/heat-surface.tsx +2 -1
- package/src/components/metric-treemap/index.tsx +3 -2
- package/src/components/ui/confirm-dialog.tsx +253 -7
- package/src/components/ui/data-table/index.tsx +1 -1
- package/src/components/ui/data-table/types.ts +7 -0
- package/src/components/ui/list-view.tsx +4 -3
- package/src/components/ui/status.tsx +9 -6
- package/src/docs/snapshot.json +36 -0
- package/src/i18n/es.ts +12 -0
- package/src/i18n/ja.ts +12 -0
- package/src/i18n/ko.ts +12 -0
- package/src/i18n/zh-cn.ts +12 -0
- package/src/i18n/zh-tw.ts +12 -0
- 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/live-valuation.ts +25 -2
- 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/cloud/askg/pane-session.ts +94 -0
- package/src/plugins/builtin/cloud/askg/pane.tsx +40 -83
- 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/help/index.tsx +1 -1
- package/src/plugins/builtin/ipo-calendar/model.ts +3 -3
- package/src/plugins/builtin/iv-history/headless.ts +12 -10
- package/src/plugins/builtin/macro-day/headless.ts +15 -5
- 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/pe-band/model.ts +4 -0
- 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 +2 -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 +13 -1
- 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/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/yield-curve/headless.ts +5 -1
- package/src/plugins/builtin/yield-curve/index.tsx +5 -0
- package/src/portfolio/column-values.ts +47 -14
- package/src/portfolio/return-metrics.ts +4 -2
- package/src/renderers/dom/host/image-surface.tsx +19 -9
- package/src/renderers/dom/host/input.tsx +4 -0
- package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +23 -1
- 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/pane-session.ts +145 -0
- 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/resolve.ts +1 -0
- package/src/types/financials.ts +20 -0
- package/src/types/headless.ts +9 -0
- package/src/ui/host.tsx +2 -0
- package/src/utils/exchanges.ts +13 -8
- 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 +889 -0
- package/src/utils/share-multiples.ts +254 -0
- package/src/utils/untrusted-text.ts +11 -0
package/package.json
CHANGED
package/src/api-client/auth.ts
CHANGED
|
@@ -16,6 +16,7 @@ import type {
|
|
|
16
16
|
DeviceAuthTokenResponse,
|
|
17
17
|
McpKeyScope,
|
|
18
18
|
PersistedAuthUser,
|
|
19
|
+
ReferralInvite,
|
|
19
20
|
} from "./types";
|
|
20
21
|
|
|
21
22
|
type CloudApiRequest = <T>(path: string, options?: RequestInit, canApplySession?: () => boolean) => Promise<T>;
|
|
@@ -285,6 +286,11 @@ export class CloudAuthApi {
|
|
|
285
286
|
);
|
|
286
287
|
}
|
|
287
288
|
|
|
289
|
+
/** The account's invite link and the free months it has earned. */
|
|
290
|
+
async getReferralInvite(): Promise<ReferralInvite> {
|
|
291
|
+
return this.options.request<ReferralInvite>("/account/referral", { method: "GET" });
|
|
292
|
+
}
|
|
293
|
+
|
|
288
294
|
/** The private calendar feed link, or null until it is first created. */
|
|
289
295
|
async getCalendarFeed(): Promise<CalendarFeed | null> {
|
|
290
296
|
const result = await this.options.request<{ feed: CalendarFeed | null }>(
|
package/src/api-client/data.ts
CHANGED
|
@@ -559,6 +559,7 @@ export class CloudDataApi {
|
|
|
559
559
|
const params = new URLSearchParams({ from: query.from, to: query.to });
|
|
560
560
|
if (query.perDay != null) params.set("perDay", String(query.perDay));
|
|
561
561
|
if (query.symbols?.length) params.set("symbols", query.symbols.join(","));
|
|
562
|
+
if (query.markets) params.set("markets", query.markets);
|
|
562
563
|
return this.request<EarningsCalendarPayload>(`/cloud/earnings/calendar?${params}`, { signal: AbortSignal.timeout(30_000) });
|
|
563
564
|
}
|
|
564
565
|
|
|
@@ -68,6 +68,14 @@ export interface EarningsReport {
|
|
|
68
68
|
epsBasis?: EarningsEpsBasis | null;
|
|
69
69
|
/** ISO currency of every amount on the report, a listing abroad's (CNY for Tencent); absent for US listings, whose figures are dollars. */
|
|
70
70
|
currency?: string | null;
|
|
71
|
+
/**
|
|
72
|
+
* A listing abroad's board row: the company's lines on its markets, the one
|
|
73
|
+
* shown first (601939:SSE, 0939:HKEX for China Construction Bank). Its
|
|
74
|
+
* market cap is in dollars, as every company's on the board. On a US line
|
|
75
|
+
* shown instead of its company's listing abroad the day both report (BABA
|
|
76
|
+
* for 9988:HKEX), that listing's lines. Absent for other US listings.
|
|
77
|
+
*/
|
|
78
|
+
listings?: string[];
|
|
71
79
|
}
|
|
72
80
|
|
|
73
81
|
export interface EarningsCalendarReport extends EarningsReport {
|
|
@@ -140,4 +148,11 @@ export interface EarningsCalendarQuery {
|
|
|
140
148
|
/** Largest companies kept per day; the listed symbols are always kept. */
|
|
141
149
|
perDay?: number;
|
|
142
150
|
symbols?: readonly string[];
|
|
151
|
+
/**
|
|
152
|
+
* `all` adds the Hong Kong, China A and Singapore top 100's reports, each
|
|
153
|
+
* in its own currency, and keeps a listing there named in `symbols`
|
|
154
|
+
* (0700:HKEX). Without it the board is US listings'. Only a view that
|
|
155
|
+
* shows each report's currency asks for it.
|
|
156
|
+
*/
|
|
157
|
+
markets?: "all";
|
|
143
158
|
}
|
package/src/api-client/index.ts
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
} from "../layout-marketplace/cloud";
|
|
16
16
|
import { SyncRevisionConflictError, type SyncSnapshot } from "../sync/types";
|
|
17
17
|
import { withDeadline } from "../utils/async-deadline";
|
|
18
|
+
import { sliceWholeCharacters } from "../utils/untrusted-text";
|
|
18
19
|
import { CloudASKGApi } from "./askg";
|
|
19
20
|
import { CloudAuthApi } from "./auth";
|
|
20
21
|
import { CloudChatApi } from "./chat";
|
|
@@ -35,6 +36,7 @@ import type {
|
|
|
35
36
|
AssistCommandDescriptor,
|
|
36
37
|
AssistCommandResponse,
|
|
37
38
|
AuthUser,
|
|
39
|
+
CloudCancelFeedback,
|
|
38
40
|
CloudSyncPushResponse,
|
|
39
41
|
CloudSyncSnapshotResponse,
|
|
40
42
|
PersistedAuthUser
|
|
@@ -65,6 +67,8 @@ const ASSIST_QUERY_MAX_LENGTH = 200;
|
|
|
65
67
|
const ASSIST_COMMAND_LIMIT = 150;
|
|
66
68
|
/** The futures curve's root list is the longest a command sends: 76. */
|
|
67
69
|
export const ASSIST_ARG_OPTION_LIMIT = 128;
|
|
70
|
+
/** The longest cancel note the server keeps, in UTF-16 units as its schema counts them. */
|
|
71
|
+
export const CLOUD_CANCEL_COMMENT_MAX = 500;
|
|
68
72
|
const ASSIST_ARG_OPTION_VALUE_MAX_LENGTH = 40;
|
|
69
73
|
const ASSIST_ARG_OPTION_LABEL_MAX_LENGTH = 60;
|
|
70
74
|
const ASSIST_REQUEST_TIMEOUT_MS = 6_000;
|
|
@@ -605,12 +609,18 @@ class GloomApiClient {
|
|
|
605
609
|
* Ends the Pro trial and Pro now, unbilled. Call it only once the person
|
|
606
610
|
* confirmed a warning that says so. `endedNow` is false when the server
|
|
607
611
|
* scheduled the cancel at the period end instead: the subscription was no
|
|
608
|
-
* longer in its trial, or the server predates ending a trial early.
|
|
612
|
+
* longer in its trial, or the server predates ending a trial early. The
|
|
613
|
+
* reason and note, when given, go to the billing provider with the cancel.
|
|
609
614
|
*/
|
|
610
|
-
async endCloudTrial(): Promise<{ canceled: boolean; endedNow?: boolean }> {
|
|
615
|
+
async endCloudTrial(feedback: CloudCancelFeedback = {}): Promise<{ canceled: boolean; endedNow?: boolean }> {
|
|
616
|
+
const comment = feedback.comment === undefined ? undefined : sliceWholeCharacters(feedback.comment.trim(), CLOUD_CANCEL_COMMENT_MAX);
|
|
611
617
|
return this.request<{ canceled: boolean; endedNow?: boolean }>("/stripe/subscription/cancel", {
|
|
612
618
|
method: "POST",
|
|
613
|
-
body: JSON.stringify({
|
|
619
|
+
body: JSON.stringify({
|
|
620
|
+
...(feedback.reason ? { reason: feedback.reason } : {}),
|
|
621
|
+
...(comment ? { comment } : {}),
|
|
622
|
+
endTrialNow: true,
|
|
623
|
+
}),
|
|
614
624
|
});
|
|
615
625
|
}
|
|
616
626
|
|
|
@@ -634,6 +644,7 @@ class GloomApiClient {
|
|
|
634
644
|
getBuildoutAccount = this.auth.getBuildoutAccount.bind(this.auth);
|
|
635
645
|
getBuildoutToken = this.auth.getBuildoutToken.bind(this.auth);
|
|
636
646
|
updateAccountProfile = this.auth.updateAccountProfile.bind(this.auth);
|
|
647
|
+
getReferralInvite = this.auth.getReferralInvite.bind(this.auth);
|
|
637
648
|
getCalendarFeed = this.auth.getCalendarFeed.bind(this.auth);
|
|
638
649
|
ensureCalendarFeed = this.auth.ensureCalendarFeed.bind(this.auth);
|
|
639
650
|
rotateCalendarFeed = this.auth.rotateCalendarFeed.bind(this.auth);
|
|
@@ -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;
|
|
@@ -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,
|