@gloom-sh/terminal 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
|
@@ -61,20 +61,27 @@ type PriceEarningsField = "trailingPE" | "forwardPE" | "pegRatio";
|
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
63
|
* Why each earnings multiple of a fundamentals block is not meaningful, if it
|
|
64
|
-
* is not:
|
|
65
|
-
*
|
|
66
|
-
*
|
|
64
|
+
* is not: one withdrawn as no multiple of the share (`notMeaningful`,
|
|
65
|
+
* utils/share-multiples: a warrant, a receipt with no ratio, an EPS that is
|
|
66
|
+
* not net income over the shares), a trailing or forward EPS at or below
|
|
67
|
+
* zero, or a multiple that is itself at or below zero. Forward P/E is judged
|
|
68
|
+
* on its own estimate only, so a trailing loss leaves a positive forward
|
|
69
|
+
* multiple alone.
|
|
67
70
|
*/
|
|
68
71
|
export function notMeaningfulMultiples(
|
|
69
|
-
fundamentals: Pick<Fundamentals, PriceEarningsField | "eps" | "forwardEps"> | undefined,
|
|
72
|
+
fundamentals: Pick<Fundamentals, PriceEarningsField | "eps" | "forwardEps" | "notMeaningful"> | undefined,
|
|
70
73
|
): Partial<Record<PriceEarningsField, string>> {
|
|
71
|
-
const reasons: Partial<Record<PriceEarningsField, string>> = {};
|
|
74
|
+
const reasons: Partial<Record<PriceEarningsField, string>> = { ...fundamentals?.notMeaningful };
|
|
72
75
|
if (!fundamentals) return reasons;
|
|
73
|
-
if (
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if (
|
|
76
|
+
if (!reasons.trailingPE) {
|
|
77
|
+
if (nonPositive(fundamentals.eps)) reasons.trailingPE = "trailing EPS is not positive";
|
|
78
|
+
else if (nonPositive(fundamentals.trailingPE)) reasons.trailingPE = "trailing earnings are not positive";
|
|
79
|
+
}
|
|
80
|
+
if (!reasons.forwardPE) {
|
|
81
|
+
if (nonPositive(fundamentals.forwardEps)) reasons.forwardPE = "forward EPS is not positive";
|
|
82
|
+
else if (nonPositive(fundamentals.forwardPE)) reasons.forwardPE = "forward earnings are not positive";
|
|
83
|
+
}
|
|
84
|
+
if (!reasons.pegRatio && nonPositive(fundamentals.pegRatio)) reasons.pegRatio = "P/E or expected growth is not positive";
|
|
78
85
|
return reasons;
|
|
79
86
|
}
|
|
80
87
|
|
|
@@ -61,6 +61,21 @@ export function pricePointIntegrityFlags(point: PricePoint): string[] {
|
|
|
61
61
|
/** What a bar whose open alone contradicts its range is flagged with, in `history` and HP. */
|
|
62
62
|
export const OPEN_WITHHELD_FLAG = "open withheld";
|
|
63
63
|
|
|
64
|
+
/** A currency pair's bar whose close the server rebuilt from the next session's open: the source repeated its open as its close. */
|
|
65
|
+
export const CLOSE_REBUILT_FLAG = "close rebuilt";
|
|
66
|
+
/** A currency pair's bar whose source repeated its open as its close, which no next open in its week rebuilds. */
|
|
67
|
+
export const CLOSE_COPIED_FLAG = "close copied";
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Whether a bar's close is its source's copy of its open, which no next open
|
|
71
|
+
* in its week rebuilds (a Friday's, or one the next open is outside the range
|
|
72
|
+
* of): no day's close. A return into or out of it is no day's move, so
|
|
73
|
+
* return-based functions leave the bar out.
|
|
74
|
+
*/
|
|
75
|
+
export function pricePointCloseCopied(point: Pick<PricePoint, "closeCopied">): boolean {
|
|
76
|
+
return point.closeCopied === true;
|
|
77
|
+
}
|
|
78
|
+
|
|
64
79
|
/**
|
|
65
80
|
* Whether a bar's open alone contradicts its range: above its high or under
|
|
66
81
|
* its low, while the high, low and close agree. MTN on the JSE, 30 Oct 2026:
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reason codes are a data service's words for a machine: why it has nothing
|
|
3
|
+
* (NO_DATA, NOT_FOUND) or could not answer (UPSTREAM_ERROR, TIMEOUT). An
|
|
4
|
+
* error built from such an answer often carries one as its whole message, or
|
|
5
|
+
* after a symbol ("AAPL: UPSTREAM_ERROR"). Nothing shows one as it is: the
|
|
6
|
+
* shared states, table bodies, pane footers and the CLI read text through
|
|
7
|
+
* here, the one place a code becomes words.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const BUSY = "the source is busy, try again shortly";
|
|
11
|
+
const NO_ANSWER = "the source did not answer";
|
|
12
|
+
|
|
13
|
+
/** What each code the data service sends means, as a clause. */
|
|
14
|
+
const CLAUSES: Readonly<Record<string, string>> = {
|
|
15
|
+
UPSTREAM_ERROR: NO_ANSWER,
|
|
16
|
+
SOURCE_REFUSED_STORED_COPY: NO_ANSWER,
|
|
17
|
+
TIMEOUT: "the source timed out",
|
|
18
|
+
RATE_LIMITED: BUSY,
|
|
19
|
+
UPSTREAM_RATE_LIMIT: BUSY,
|
|
20
|
+
NO_DATA: "no data",
|
|
21
|
+
NOT_FOUND: "nothing found",
|
|
22
|
+
BAD_MAPPING: "nothing found",
|
|
23
|
+
UNSUPPORTED_RANGE: "not available for this range",
|
|
24
|
+
PRO_REQUIRED: "needs Gloom Pro",
|
|
25
|
+
STALE_HISTORY: "the source's history is behind",
|
|
26
|
+
MALFORMED_HISTORY: "the source's history could not be read",
|
|
27
|
+
HISTORY_RETENTION: "older than the history kept",
|
|
28
|
+
AMBIGUOUS_TICKER: "the symbol is listed in several places, name the exchange",
|
|
29
|
+
AMBIGUOUS_EXCHANGE: "the symbol is listed in several places, name the exchange",
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// Capitals joined by underscores, the shape of every code the service sends but TIMEOUT.
|
|
33
|
+
const CODE_SHAPE = /^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)+$/;
|
|
34
|
+
// A known code, or a source's failure (YAHOO_RATE_LIMIT, ..._ERROR), inside a longer text.
|
|
35
|
+
const EMBEDDED_CODE = /\b[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)+\b/g;
|
|
36
|
+
|
|
37
|
+
/** Whether `text` is a reason code on its own (UPSTREAM_ERROR), not words. */
|
|
38
|
+
export function isReasonCode(text: string | null | undefined): boolean {
|
|
39
|
+
const trimmed = text?.trim() ?? "";
|
|
40
|
+
return Object.hasOwn(CLAUSES, trimmed) || CODE_SHAPE.test(trimmed);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* What a reason code says happened, as a clause to follow a colon or stand in
|
|
45
|
+
* a footer: "the source did not answer". An unknown code reads as a failure.
|
|
46
|
+
*/
|
|
47
|
+
function reasonCodeClause(code: string): string {
|
|
48
|
+
const trimmed = code.trim();
|
|
49
|
+
if (Object.hasOwn(CLAUSES, trimmed)) return CLAUSES[trimmed]!;
|
|
50
|
+
if (/RATE_?LIMIT/.test(trimmed)) return BUSY;
|
|
51
|
+
if (/TIMEOUT|TIMED_OUT/.test(trimmed)) return CLAUSES.TIMEOUT!;
|
|
52
|
+
if (/NOT_FOUND$/.test(trimmed)) return CLAUSES.NOT_FOUND!;
|
|
53
|
+
return NO_ANSWER;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function embeddedCode(token: string): boolean {
|
|
57
|
+
return Object.hasOwn(CLAUSES, token) || /(?:_ERROR|RATE_?LIMIT)$/.test(token);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function withEmbeddedCodes(text: string): string {
|
|
61
|
+
return text.replace(EMBEDDED_CODE, (token) => embeddedCode(token) ? reasonCodeClause(token) : token);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Text fit to show as a state's title or a CLI error: a bare reason code as
|
|
66
|
+
* a sentence ("The source did not answer."), a known code inside a longer
|
|
67
|
+
* text as its clause ("AAPL: the source did not answer"), anything else as
|
|
68
|
+
* it is.
|
|
69
|
+
*/
|
|
70
|
+
export function readableError(text: string): string {
|
|
71
|
+
if (!isReasonCode(text)) return withEmbeddedCodes(text);
|
|
72
|
+
const clause = reasonCodeClause(text);
|
|
73
|
+
return `${clause.charAt(0).toUpperCase()}${clause.slice(1)}.`;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** The same for a footer status, which reads as a clause: "the source did not answer". */
|
|
77
|
+
export function readableStatus(text: string): string {
|
|
78
|
+
return isReasonCode(text) ? reasonCodeClause(text) : withEmbeddedCodes(text);
|
|
79
|
+
}
|