gloomberb 0.20.18 → 0.20.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/api-client/cot.ts +5 -6
- package/src/api-client/data.ts +11 -1
- package/src/api-client/index.ts +1 -0
- package/src/api-client/request.ts +162 -40
- package/src/api-client/types/news.ts +45 -0
- package/src/api-client/types/world-venues.ts +9 -0
- package/src/app.tsx +4 -2
- package/src/architecture/floating-promise-allowlist.json +1 -1
- package/src/cli/commands/market.ts +53 -17
- package/src/cli/commands/ticker.ts +13 -6
- package/src/cli/context.ts +8 -0
- package/src/cli/desktop-pane-shot-browser.ts +3 -1
- package/src/cli/desktop-pane-shot-view.ts +0 -1
- package/src/cli/desktop-pane-shot.ts +204 -43
- package/src/cli/errors.ts +3 -9
- package/src/cli/exit-codes.ts +1 -1
- package/src/cli/glossary.ts +1 -1
- package/src/cli/help.ts +1 -1
- package/src/cli/history-rows.ts +2 -2
- package/src/cli/index.ts +1 -1
- package/src/cli/listing-arg.ts +87 -23
- package/src/cli/pane-functions/catalog-snapshot.json +17 -6
- package/src/cli/pane-functions/dom.ts +30 -2
- package/src/cli/pane-functions/freshness.ts +23 -4
- package/src/cli/pane-functions/function-help.ts +3 -3
- package/src/cli/pane-functions/headless.ts +9 -1
- package/src/cli/pane-functions/index.ts +77 -10
- package/src/cli/pane-functions/report-notices.ts +10 -0
- package/src/cli/pane-functions/resolver.ts +3 -2
- package/src/cli/pane-functions/screenshot-assessment.ts +10 -5
- package/src/cli/pane-functions/screenshot-data-evidence.ts +7 -15
- package/src/cli/pane-functions/screenshot-payload.ts +24 -10
- package/src/cli/pane-functions/screenshot-render.ts +21 -8
- package/src/cli/pane-functions/screenshot-types.ts +9 -0
- package/src/cli/quote-answer.ts +1 -1
- package/src/cli/result.ts +17 -0
- package/src/cli/scroll-truncation.ts +7 -2
- package/src/cli/ticker-resolution.ts +1 -1
- package/src/cli/unreachable.ts +21 -0
- package/src/components/chart/composite/drawing-store.ts +11 -7
- package/src/components/chart/composite/format.ts +1 -0
- package/src/components/chart/composite/legend.tsx +5 -2
- package/src/components/chart/composite/panel-surface/plot-gestures.ts +9 -2
- package/src/components/chart/composite/panel-surface.tsx +1 -1
- package/src/components/chart/composite/tools.ts +164 -39
- package/src/components/chart-table/header.tsx +2 -2
- package/src/components/chart-table/layout.ts +5 -6
- package/src/components/command-bar/routes/root/runtime.ts +11 -3
- package/src/components/command-bar/routes/ticker-search/results.ts +5 -0
- package/src/components/command-bar/selection-runtime.ts +29 -5
- package/src/components/command-bar/surface/index.tsx +4 -1
- package/src/components/command-bar/workflow/alert.ts +13 -5
- package/src/components/layout/pane/footer/model.ts +10 -2
- package/src/components/layout/pane/status-footer.ts +24 -0
- package/src/components/price-performance.tsx +26 -8
- package/src/components/reader/article-reader.tsx +12 -5
- package/src/components/ui/data-table/opentui/index.tsx +7 -0
- package/src/components/ui/table-layout.ts +32 -1
- package/src/market-data/ah-pair.ts +19 -0
- package/src/market-data/coordinator/entries.ts +6 -4
- package/src/market-data/coordinator/index.ts +14 -3
- package/src/market-data/futures-board.ts +36 -29
- package/src/market-data/futures-contract.ts +37 -1
- package/src/market-data/market/change-basis.ts +9 -0
- package/src/market-data/market/status.ts +40 -4
- package/src/market-data/performance.ts +127 -32
- package/src/market-data/quotes/time.ts +5 -2
- package/src/news/types.ts +28 -0
- package/src/notifications/app-badge.ts +2 -3
- package/src/notifications/app-notifier.ts +5 -0
- package/src/plugins/builtin/alerts/cli.ts +65 -18
- package/src/plugins/builtin/alerts/command.ts +39 -9
- package/src/plugins/builtin/alerts/event-rows.ts +9 -3
- package/src/plugins/builtin/alerts/events-pane.tsx +16 -10
- package/src/plugins/builtin/alerts/headless.ts +12 -6
- package/src/plugins/builtin/alerts/index.tsx +60 -8
- package/src/plugins/builtin/alerts/option-contract.ts +197 -0
- package/src/plugins/builtin/alerts/price.ts +30 -5
- package/src/plugins/builtin/alerts/pro-rules.ts +62 -0
- package/src/plugins/builtin/alerts/research-builder.ts +5 -10
- package/src/plugins/builtin/analytics/account-returns.ts +1 -1
- package/src/plugins/builtin/analytics/pane-model.ts +2 -2
- package/src/plugins/builtin/analytics/risk-client.ts +1 -1
- package/src/plugins/builtin/buildout/company/pane.tsx +4 -14
- package/src/plugins/builtin/catalysts/model.ts +2 -1
- package/src/plugins/builtin/chart-composer/chart-spec.ts +5 -0
- package/src/plugins/builtin/chart-composer/cli-options.ts +5 -3
- package/src/plugins/builtin/chart-composer/headless-schema.ts +14 -10
- package/src/plugins/builtin/chart-composer/headless.ts +2 -0
- package/src/plugins/builtin/chart-composer/index.tsx +17 -5
- package/src/plugins/builtin/chart-composer/pane.tsx +14 -4
- package/src/plugins/builtin/chart-composer/viewport-labels.ts +2 -17
- package/src/plugins/builtin/chat/controller/notifications.ts +1 -0
- package/src/plugins/builtin/chat/index.tsx +0 -1
- package/src/plugins/builtin/commodities-energy/index.tsx +1 -1
- package/src/plugins/builtin/company-kpis/headless.ts +1 -1
- package/src/plugins/builtin/company-kpis/model.ts +21 -9
- package/src/plugins/builtin/congress-trades/model.ts +9 -5
- package/src/plugins/builtin/cot/client.ts +2 -3
- package/src/plugins/builtin/cot/headless.ts +16 -16
- package/src/plugins/builtin/cot/index.tsx +6 -6
- package/src/plugins/builtin/cot/model.ts +25 -5
- package/src/plugins/builtin/cot/pane.tsx +11 -6
- package/src/plugins/builtin/cot/series.ts +11 -8
- package/src/plugins/builtin/cpi/model.ts +15 -4
- package/src/plugins/builtin/cpi/pane.tsx +29 -7
- package/src/plugins/builtin/doe/model.ts +30 -0
- package/src/plugins/builtin/doe/pane.tsx +8 -2
- package/src/plugins/builtin/earnings/board-table.ts +9 -4
- package/src/plugins/builtin/earnings/headless.ts +10 -3
- package/src/plugins/builtin/earnings/history-table.ts +4 -2
- package/src/plugins/builtin/earnings-calls/calendar.tsx +4 -3
- package/src/plugins/builtin/earnings-ripple/pane.tsx +2 -2
- package/src/plugins/builtin/econ/index.tsx +4 -2
- package/src/plugins/builtin/futures/model.ts +14 -1
- package/src/plugins/builtin/futures/series.ts +1 -8
- package/src/plugins/builtin/fx-matrix/index.tsx +2 -2
- package/src/plugins/builtin/insider/detail.tsx +36 -7
- package/src/plugins/builtin/insider/filing-stories.ts +110 -0
- package/src/plugins/builtin/insider/headless.ts +37 -2
- package/src/plugins/builtin/insider/index.tsx +79 -10
- package/src/plugins/builtin/insider/model.ts +43 -5
- package/src/plugins/builtin/ipo-calendar/client.ts +11 -1
- package/src/plugins/builtin/ipo-calendar/model.ts +3 -7
- package/src/plugins/builtin/jobs/headless.ts +2 -1
- package/src/plugins/builtin/jobs/model.ts +6 -0
- package/src/plugins/builtin/jobs/pane.tsx +8 -3
- package/src/plugins/builtin/news/wire/news/detail-view.tsx +118 -10
- package/src/plugins/builtin/news/wire/news/story-evidence.ts +178 -0
- package/src/plugins/builtin/options/analytics.ts +1 -1
- package/src/plugins/builtin/options/view.tsx +18 -11
- package/src/plugins/builtin/options-positioning/model.ts +11 -0
- package/src/plugins/builtin/options-positioning/pane.tsx +22 -1
- package/src/plugins/builtin/options-scenario/client.ts +49 -8
- package/src/plugins/builtin/options-scenario/headless.ts +7 -3
- package/src/plugins/builtin/options-scenario/model.ts +33 -2
- package/src/plugins/builtin/options-scenario/pane.tsx +3 -4
- package/src/plugins/builtin/perps/cascade.ts +4 -3
- package/src/plugins/builtin/perps/markets-section.tsx +5 -2
- package/src/plugins/builtin/perps/model.ts +4 -3
- package/src/plugins/builtin/portfolio-list/table.tsx +3 -2
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +29 -14
- package/src/plugins/builtin/research/event-model.ts +12 -6
- package/src/plugins/builtin/research-search/index.tsx +3 -1
- package/src/plugins/builtin/scanner/denied.tsx +16 -4
- package/src/plugins/builtin/scanner/flow-pane.tsx +1 -1
- package/src/plugins/builtin/scanner/hilo-pane.tsx +1 -1
- package/src/plugins/builtin/sec/filing-display.tsx +14 -2
- package/src/plugins/builtin/sec/headless.ts +42 -4
- package/src/plugins/builtin/sec/index.tsx +21 -1
- package/src/plugins/builtin/sectors/sector-model.ts +1 -1
- package/src/plugins/builtin/shared/earnings-report.ts +32 -3
- package/src/plugins/builtin/shared/options-pro-copy.ts +34 -0
- package/src/plugins/builtin/shared/statement-currency.ts +23 -0
- package/src/plugins/builtin/shared/ticker-surface.ts +1 -1
- package/src/plugins/builtin/supply-chain/pane.tsx +4 -3
- package/src/plugins/builtin/themes/headless.ts +4 -4
- package/src/plugins/builtin/themes/model.ts +11 -8
- package/src/plugins/builtin/themes/pane.tsx +2 -2
- package/src/plugins/builtin/ticker-detail/financials/model.ts +22 -32
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +7 -9
- package/src/plugins/builtin/ticker-detail/headless-schema.ts +2 -0
- package/src/plugins/builtin/ticker-detail/headless.ts +28 -12
- package/src/plugins/builtin/ticker-detail/overview/board-lot.ts +21 -0
- package/src/plugins/builtin/ticker-detail/overview/model.ts +11 -1
- package/src/plugins/builtin/ticker-detail/overview/pane.tsx +4 -0
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +61 -13
- package/src/plugins/builtin/volatility/pane.tsx +3 -3
- package/src/plugins/builtin/world-venue-map/headless.ts +4 -2
- package/src/plugins/builtin/world-venue-map/model.ts +6 -1
- package/src/plugins/builtin/world-venue-map/venue-header.tsx +5 -3
- package/src/plugins/catalog-browser.ts +10 -1
- package/src/renderers/browser/activity.ts +16 -0
- package/src/renderers/browser/app-badge-host.ts +14 -0
- package/src/renderers/browser/main.tsx +5 -0
- package/src/renderers/browser/notifications.ts +103 -0
- package/src/renderers/browser/ui-host.tsx +4 -0
- package/src/renderers/dom/data-table/index.tsx +27 -4
- package/src/renderers/electrobun/view/http-fetch.ts +3 -2
- package/src/sources/gloomberb-cloud/index.ts +8 -6
- package/src/sources/gloomberb-cloud/news.ts +35 -0
- package/src/sources/provider-errors.ts +34 -7
- package/src/sources/provider-router/history.ts +32 -6
- package/src/time-series/base-series.ts +39 -6
- package/src/time-series/chart-seed.ts +2 -2
- package/src/time-series/history-quality.ts +4 -1
- package/src/time-series/hooks.ts +2 -0
- package/src/time-series/price-comparison.ts +17 -23
- package/src/time-series/reporting.ts +1 -1
- package/src/time-series/resolution.ts +13 -0
- package/src/time-series/resolve-context.ts +6 -0
- package/src/time-series/resolve.ts +39 -2
- package/src/time-series/types.ts +2 -1
- package/src/types/financials.ts +9 -1
- package/src/types/headless.ts +1 -0
- package/src/types/issuer-listings.ts +2 -0
- package/src/types/plugin-notifications.ts +3 -0
- package/src/types/price-history.ts +6 -4
- package/src/ui/host.tsx +2 -0
- package/src/utils/exchange-announcements.ts +7 -2
- package/src/utils/fundamentals.ts +40 -0
- package/src/utils/network-failure.ts +2 -0
- package/src/utils/price-history-integrity.ts +9 -1
|
@@ -25,12 +25,15 @@ import type {
|
|
|
25
25
|
} from "../../types/financials";
|
|
26
26
|
import { currencyPriceMinDigits, formatMarketPrice, formatMarketPriceWithCurrency, nearParCoinPriceDigits, penceFigure, quoteFormatOptions, withCurrencyMinorDigits } from "../../market-data/market/format";
|
|
27
27
|
import { INDEX_POINTS_EXPORT_UNIT, indexBarVolume, isIndexLevel, reportedQuoteVolume, YIELD_INDEX_EXPORT_UNIT } from "../../market-data/market/index-level";
|
|
28
|
-
import { changeBasisJson, changeBasisLabel, changeBasisNote, futuresQuoteFromSettle, printPredatesChangeBasis, quoteChangeBasis, quotePreviousCloseDate, quoteSettleText } from "../../market-data/market/change-basis";
|
|
28
|
+
import { changeBasisJson, changeBasisLabel, changeBasisNote, closeDayLabel, futuresQuoteFromSettle, printPredatesChangeBasis, quoteChangeBasis, quotePreviousCloseDate, quoteSettleText } from "../../market-data/market/change-basis";
|
|
29
|
+
import { asOfClock } from "../../market-data/quotes/time";
|
|
29
30
|
import {
|
|
30
31
|
EXTENDED_SESSION_LABELS,
|
|
32
|
+
extendedPrintTime,
|
|
31
33
|
getExtendedSessionDisplay,
|
|
32
34
|
getQuoteSessionFields,
|
|
33
35
|
getRegularSessionDisplay,
|
|
36
|
+
headlineCloseDate,
|
|
34
37
|
quoteHeadlineTime,
|
|
35
38
|
quoteSessionLabel,
|
|
36
39
|
quoteSessionStateLabel,
|
|
@@ -81,6 +84,7 @@ import { createBaseConverter } from "../base-converter";
|
|
|
81
84
|
import { loadStatementFilings } from "../statement-filings";
|
|
82
85
|
import { loadBankFigures } from "../bank-section";
|
|
83
86
|
import { latestFinancialPeriod } from "../../utils/latest-financial-period";
|
|
87
|
+
import { commandWord } from "../../utils/shell-word";
|
|
84
88
|
import type { FuturesContractTermsPayload } from "../../api-client/futures-curve";
|
|
85
89
|
import { currencyCodeLabel, currencyUnitLabel, resolveCurrencyUnit } from "../../utils/currency-units";
|
|
86
90
|
import { fxRateDigits, quotedFxPair } from "../../utils/currency-pair";
|
|
@@ -124,7 +128,7 @@ import { apiClient } from "../../api-client";
|
|
|
124
128
|
import { CLOUD_QUOTE_DELAY_MINUTES } from "../../api-client/plan-rules";
|
|
125
129
|
import type { ExchangeAnnouncementsPayload } from "../../api-client/exchange-announcements";
|
|
126
130
|
import {
|
|
127
|
-
|
|
131
|
+
listingAnnouncementsPage, exchangeAnnouncementsPublisher, isRoutineReturn, listsExchangeAnnouncements, type ExchangeAnnouncementsPage,
|
|
128
132
|
} from "../../utils/exchange-announcements";
|
|
129
133
|
import { dailyFxLeg, fxCloseOnDate, fxCloseOnOrBefore, loadDailyFxCloses, type FxCloseReading } from "../../market-data/fx-closes";
|
|
130
134
|
import { zonedDateTimeParts } from "../../utils/zoned-date-time";
|
|
@@ -697,9 +701,10 @@ function extendedColumn(session: ExtendedSession) {
|
|
|
697
701
|
header: EXTENDED_SESSION_LABELS[session],
|
|
698
702
|
align: "right" as const,
|
|
699
703
|
value: (row: QuoteRow) => row.extendedSession === session ? exportFigure(row.rawExtendedPrice) : null,
|
|
704
|
+
// Beside a close, the print says when it was observed (`$161.72 +4.02% 00:10 UTC`), Updated dating the close.
|
|
700
705
|
format: (_value: unknown, row: QuoteRow) => (
|
|
701
706
|
row.extendedSession === session && row.extendedPrice
|
|
702
|
-
? [price(row), formatChangePercentCell(row.extendedChangePercent)].join(" ").trim()
|
|
707
|
+
? [price(row), formatChangePercentCell(row.extendedChangePercent), row.extendedAt ? cliStyles.muted(row.extendedAt) : ""].join(" ").trim()
|
|
703
708
|
: ""
|
|
704
709
|
),
|
|
705
710
|
};
|
|
@@ -954,6 +959,10 @@ function quoteRows(results: QuoteCliRecord[], now = Date.now()) {
|
|
|
954
959
|
const per = display.price != null ? futuresPricePer(result.futuresContract, quote?.currency) : "";
|
|
955
960
|
const previousClose = display.price != null && display.change != null ? display.price - display.change : quote?.previousClose;
|
|
956
961
|
const last = price(display.price);
|
|
962
|
+
// A completed session's close shown beside a later extended print: two prices, two times.
|
|
963
|
+
const closeDate = extended && !result.futuresContract && !quote?.nominalPrice && !quote?.dailyClose ? headlineCloseDate(quote) : null;
|
|
964
|
+
const printedAt = closeDate ? extendedPrintTime(quote) : null;
|
|
965
|
+
const closeBesidePrint = closeDate && printedAt != null ? { date: closeDate, printedAt } : null;
|
|
957
966
|
return {
|
|
958
967
|
symbol: quoteRowSymbol(result),
|
|
959
968
|
name: quote?.name || result.listing?.name || "",
|
|
@@ -986,9 +995,11 @@ function quoteRows(results: QuoteCliRecord[], now = Date.now()) {
|
|
|
986
995
|
dayRange: quote?.low != null && quote.high != null
|
|
987
996
|
? indexPoints ? `${price(quote.low)}-${price(quote.high)}` : formatPriceRange(quote.low, quote.high, quote.currency, options, "-")
|
|
988
997
|
: "",
|
|
989
|
-
// An index's 0 is volume nobody counts
|
|
998
|
+
// An index's 0 is volume nobody counts.
|
|
990
999
|
volume: reportedQuoteVolume(quote),
|
|
991
|
-
currency
|
|
1000
|
+
// The currency the service gives, an index's too (^MERV's ARS, ^N225's JPY), whether the row is current or
|
|
1001
|
+
// stale: its level stays in points, and the export's currency_or_unit says so.
|
|
1002
|
+
currency: quote?.currency ?? "",
|
|
992
1003
|
providerId: quote?.providerId ?? "",
|
|
993
1004
|
source: quote?.dataSource ?? quote?.providerId ?? "",
|
|
994
1005
|
feed: quoteFeedState(quote, now),
|
|
@@ -1005,6 +1016,9 @@ function quoteRows(results: QuoteCliRecord[], now = Date.now()) {
|
|
|
1005
1016
|
...quote?.nominalPrice ? { nominalLabel: nominalSessionLabel(quote) ?? undefined } : {},
|
|
1006
1017
|
// A price with no live quote behind it, the close of the latest daily bar, names that session.
|
|
1007
1018
|
...quote?.dailyClose ? { nominalLabel: dailyCloseSessionLabel(quote) ?? undefined } : {},
|
|
1019
|
+
// Last as a completed session's close beside an extended print: Updated names the close's day (Tue 17 Nov
|
|
1020
|
+
// close), the print its own time, so neither price reads as the other's. JSON keeps updatedAt as it was.
|
|
1021
|
+
...closeBesidePrint ? { nominalLabel: closeDayLabel(closeBesidePrint.date, now), extendedAt: asOfClock(Math.min(closeBesidePrint.printedAt, now), now) } : {},
|
|
1008
1022
|
};
|
|
1009
1023
|
});
|
|
1010
1024
|
}
|
|
@@ -1270,11 +1284,11 @@ async function runQuote(rawArgs: string[], ctx: Parameters<CliCommandDef["execut
|
|
|
1270
1284
|
}
|
|
1271
1285
|
// With several symbols, --exchange is for the ones that name no exchange of their own, and one that names no
|
|
1272
1286
|
// listing (EQT:NYSE:US) is named in a line while the others are quoted.
|
|
1273
|
-
// A word that names a company
|
|
1287
|
+
// A word that names a company, and a code no source quotes, are read once its quote says no listing trades as it (answerQuote).
|
|
1274
1288
|
const resolvedListings = await Promise.all(symbols.filter((symbol) => !notASymbolError(symbol)).map(async (symbol) => {
|
|
1275
|
-
if (symbols.length === 1) return { symbol, listing: await requireCliListing(symbol, exchange, market, ctx, { companyWord: false }) };
|
|
1289
|
+
if (symbols.length === 1) return { symbol, listing: await requireCliListing(symbol, exchange, market, ctx, { companyWord: false, listingAbroad: false }) };
|
|
1276
1290
|
try {
|
|
1277
|
-
return { symbol, listing: await resolveCliListing(symbol, exchange, market, { ownExchangeWins: true, companyWord: false }) };
|
|
1291
|
+
return { symbol, listing: await resolveCliListing(symbol, exchange, market, { ownExchangeWins: true, companyWord: false, listingAbroad: false }) };
|
|
1278
1292
|
} catch (error) {
|
|
1279
1293
|
if (error instanceof ListingArgError) return { symbol, error };
|
|
1280
1294
|
throw error;
|
|
@@ -1500,12 +1514,12 @@ async function runQuote(rawArgs: string[], ctx: Parameters<CliCommandDef["execut
|
|
|
1500
1514
|
),
|
|
1501
1515
|
}, {
|
|
1502
1516
|
rows: quoteRows,
|
|
1503
|
-
// An index row's Cur is
|
|
1517
|
+
// An index row's Cur is the index's currency, but its level is in points (or a yield in percent): the export names that.
|
|
1504
1518
|
exportIdentity: (row) => ({
|
|
1505
1519
|
symbolOrSeries: row.symbol,
|
|
1506
1520
|
// A pair's rate is its quote currency per base: JPY per USD, as `history` and `fx` export it.
|
|
1507
|
-
currencyOrUnit: (row.
|
|
1508
|
-
|
|
1521
|
+
currencyOrUnit: isIndexLevel(row.instrumentType) ? row.yieldIndex ? YIELD_INDEX_EXPORT_UNIT : INDEX_POINTS_EXPORT_UNIT
|
|
1522
|
+
: (row.currency && pairExportUnit(row.symbol, row.currency)) || row.currency || (row.yieldIndex ? YIELD_INDEX_EXPORT_UNIT : null),
|
|
1509
1523
|
// Each row as of its own price (^TNX's 19:59 beside ^VIX's 21:15), as Updated says; a row with none is blank.
|
|
1510
1524
|
asOf: row.updatedAt || null,
|
|
1511
1525
|
// Beside a coin priced by one exchange's own trade, which is cited to that exchange, each row names its own.
|
|
@@ -1796,6 +1810,23 @@ function financialsOptionHint(flag: string, args: readonly string[]): string | n
|
|
|
1796
1810
|
+ `or gloom fn FA ${symbol} --period quarterly (the statements).`;
|
|
1797
1811
|
}
|
|
1798
1812
|
|
|
1813
|
+
/**
|
|
1814
|
+
* What `financials` says when it has no fiscal year to list, in place of a
|
|
1815
|
+
* bare "No results.": a listing with quarters but no full year reported
|
|
1816
|
+
* (O8A:FWB2) names its latest quarter and the command that lists them, as
|
|
1817
|
+
* `financials --quarterly` points to it; one whose years carry only balance
|
|
1818
|
+
* sheet figures points at those; one with nothing says so.
|
|
1819
|
+
*/
|
|
1820
|
+
function noFiscalYearsNote(key: string, financials: Pick<TickerFinancials, "annualStatements" | "quarterlyStatements">): string {
|
|
1821
|
+
const symbol = commandWord(key);
|
|
1822
|
+
if (financials.annualStatements.length > 0) {
|
|
1823
|
+
return `No fiscal-year revenue, income or EPS on record for ${key}. Its balance sheets: gloom fn FA ${symbol} --statement balance`;
|
|
1824
|
+
}
|
|
1825
|
+
const quarter = latestFinancialPeriod(financials.quarterlyStatements, (row) => row.date)?.date;
|
|
1826
|
+
if (!quarter) return `No fiscal-year or quarterly statements on record for ${key}.`;
|
|
1827
|
+
return `No fiscal-year statements on record for ${key}; its quarterly statements run to ${quarter}: gloom fn FA ${symbol} --period quarterly`;
|
|
1828
|
+
}
|
|
1829
|
+
|
|
1799
1830
|
function historyOptionHint(flag: string, args: readonly string[]): string | null {
|
|
1800
1831
|
if (DATE_WINDOW_OPTIONS.has(flag)) {
|
|
1801
1832
|
return `history takes dates as --from and --to (or --start and --end), each a year or a date (--from 2007 --to 2009), or a --range: ${HISTORY_RANGES.join(", ")}.`;
|
|
@@ -2864,7 +2895,7 @@ async function runHistoryList(
|
|
|
2864
2895
|
// A catalog series is no listing: it is read as a series below.
|
|
2865
2896
|
if (catalogSeriesId(symbol)) return { typed: symbol, listing: null, error: null };
|
|
2866
2897
|
try {
|
|
2867
|
-
const listing = await resolveCliListing(symbol, exchange, market, { ownExchangeWins: true, companyWord: lookups && typedList });
|
|
2898
|
+
const listing = await resolveCliListing(symbol, exchange, market, { ownExchangeWins: true, companyWord: lookups && typedList, listingAbroad: lookups });
|
|
2868
2899
|
return { typed: symbol, listing };
|
|
2869
2900
|
} catch (error) {
|
|
2870
2901
|
return { typed: symbol, listing: null, error };
|
|
@@ -3197,11 +3228,14 @@ async function runFinancials(rawArgs: string[], ctx: Parameters<CliCommandDef["e
|
|
|
3197
3228
|
const older = await hasOlderStatements(() => market.dataProvider.getTickerFinancials(listing.request.symbol, listing.request.exchange,
|
|
3198
3229
|
{ statementHistory: "extended" }), "annual", dates);
|
|
3199
3230
|
const historyNotes = [...stale ? [stale] : [], ...filled ? [filled] : [], ...statementHistoryNotes("annual", dates, listing.key, older)];
|
|
3231
|
+
// No year to list says why, and where its quarters are, rather than "No results.".
|
|
3232
|
+
const empty = rows.length === 0 ? noFiscalYearsNote(listing.key, financials) : null;
|
|
3233
|
+
const notes = empty ? [...historyNotes, empty] : historyNotes;
|
|
3200
3234
|
// NDJSON keeps the raw statement rows it always wrote; CSV gets the table and its closing lines.
|
|
3201
3235
|
const tables = tabular
|
|
3202
3236
|
? selectTables({
|
|
3203
3237
|
tables: [exportRowsTable("Annual statements", STATEMENT_COLUMNS, rows)],
|
|
3204
|
-
footer: reportFooterLines({ freshness, notes
|
|
3238
|
+
footer: reportFooterLines({ freshness, notes }),
|
|
3205
3239
|
})
|
|
3206
3240
|
: undefined;
|
|
3207
3241
|
ctx.printResult({
|
|
@@ -3213,7 +3247,7 @@ async function runFinancials(rawArgs: string[], ctx: Parameters<CliCommandDef["e
|
|
|
3213
3247
|
quarterlyStatements: financials.quarterlyStatements.length,
|
|
3214
3248
|
fundamentals: exportedFundamentals(financials.fundamentals),
|
|
3215
3249
|
profile: financials.profile,
|
|
3216
|
-
...(
|
|
3250
|
+
...(notes.length > 0 ? { notes } : {}),
|
|
3217
3251
|
},
|
|
3218
3252
|
freshness,
|
|
3219
3253
|
...(choice.length > 0 ? { warnings: choice } : {}),
|
|
@@ -3221,7 +3255,9 @@ async function runFinancials(rawArgs: string[], ctx: Parameters<CliCommandDef["e
|
|
|
3221
3255
|
heading: listingHeading(identity),
|
|
3222
3256
|
rows: () => rows,
|
|
3223
3257
|
columns: STATEMENT_COLUMNS,
|
|
3224
|
-
...(
|
|
3258
|
+
...(empty ? { empty } : {}),
|
|
3259
|
+
...(historyNotes.length > 0 ? { footnote: historyNotes.join("\n") } : {}),
|
|
3260
|
+
...(notes.length > 0 ? { exportNotes: notes } : {}),
|
|
3225
3261
|
...(tables && ctx.cliOptions.format === "csv" ? { tables } : {}),
|
|
3226
3262
|
// Annual statements in the company's reporting currency.
|
|
3227
3263
|
exportIdentity: { symbolOrSeries: listing.key, currencyOrUnit: rows.find((row) => row.currency)?.currency ?? null, interval: "annual" },
|
|
@@ -3576,7 +3612,7 @@ async function runFilings(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
3576
3612
|
const quotePromise = loadListingQuote(market.dataProvider, listing);
|
|
3577
3613
|
const identity = nonUsSecListingVenue(symbol, exchange) ? listingIdentity(listing, await quotePromise) : null;
|
|
3578
3614
|
// Where a listing abroad publishes its announcements, whatever the SEC holds for it.
|
|
3579
|
-
const page = identity ?
|
|
3615
|
+
const page = identity ? listingAnnouncementsPage(identity.symbol, identity.exchange) : null;
|
|
3580
3616
|
const pageLine = page ? `${page.name}: ${page.url}` : null;
|
|
3581
3617
|
try {
|
|
3582
3618
|
const context = identity?.name ? { listingName: identity.name } : undefined;
|
|
@@ -4817,7 +4853,7 @@ async function runEarnings(rawArgs: string[], ctx: Parameters<CliCommandDef["exe
|
|
|
4817
4853
|
await withCliServices(ctx, async (services) => {
|
|
4818
4854
|
const symbols = await readSymbols(entries, services.dataProvider);
|
|
4819
4855
|
const listings = await Promise.all(symbols.map((symbol) => requireCliListing(
|
|
4820
|
-
symbol, exchangeOption, services, ctx, { ownExchangeWins: symbols.length > 1, companyWord: symbols.length <= MAX_CHOICE_LOOKUPS },
|
|
4856
|
+
symbol, exchangeOption, services, ctx, { ownExchangeWins: symbols.length > 1, companyWord: symbols.length <= MAX_CHOICE_LOOKUPS, listingAbroad: symbols.length <= MAX_CHOICE_LOOKUPS },
|
|
4821
4857
|
)));
|
|
4822
4858
|
const keys = listings.map((listing) => listing.key);
|
|
4823
4859
|
// Each bare symbol's venues cost a search, so a long list (a portfolio check, not a lookup) names none.
|
|
@@ -5,7 +5,7 @@ import { formatReportedMoney, REPORTING_CURRENCY_NOT_SOURCED } from "../../utils
|
|
|
5
5
|
import {
|
|
6
6
|
appTtmRate, computedEnterpriseValueNote, convertedPriceEarningsNote, enterpriseValueLabel,
|
|
7
7
|
enterpriseValueReconciliationNote,
|
|
8
|
-
epsConversionNote, financialEnterpriseValue, fundamentalsCurrency, isFinancialEnterpriseValueReason, reportedEnterpriseValue, trailingEpsFiscalYear, trailingEpsSourceNote, ttmAtAppRate, ttmConversionNote,
|
|
8
|
+
epsConversionNote, financialEnterpriseValue, fundamentalsCurrency, isFinancialEnterpriseValueReason, reportedEnterpriseValue, trailingEpsFiscalYear, trailingEpsSourceNote, trailingPeriodNote, ttmAtAppRate, ttmConversionNote,
|
|
9
9
|
withFinancialEnterpriseValue,
|
|
10
10
|
} from "../../utils/fundamentals";
|
|
11
11
|
import { latestFinancialPeriod } from "../../utils/latest-financial-period";
|
|
@@ -38,15 +38,17 @@ import {
|
|
|
38
38
|
import {
|
|
39
39
|
EXTENDED_SESSION_LABELS,
|
|
40
40
|
exchangeShortName,
|
|
41
|
+
extendedPrintTime,
|
|
41
42
|
getExtendedSessionDisplay,
|
|
42
43
|
getQuoteSessionFields,
|
|
43
44
|
getRegularSessionDisplay,
|
|
45
|
+
headlineCloseDate,
|
|
44
46
|
quoteBookSessionLabel,
|
|
45
47
|
quoteHeadlineTime,
|
|
46
48
|
quoteMarketStateLabel,
|
|
47
49
|
} from "../../market-data/market/status";
|
|
48
50
|
import type { FuturesContractTermsPayload } from "../../api-client/futures-curve";
|
|
49
|
-
import { changeBasisJson, futuresQuoteFromSettle, quoteChangeBasis, quotePreviousCloseDate, quoteSettleText } from "../../market-data/market/change-basis";
|
|
51
|
+
import { changeBasisJson, closeDayLabel, futuresQuoteFromSettle, quoteChangeBasis, quotePreviousCloseDate, quoteSettleText } from "../../market-data/market/change-basis";
|
|
50
52
|
import {
|
|
51
53
|
futuresContractLines, futuresPricePer, futuresTickOption, isFuturesInstrument, loadFuturesContractTerms, loadUsdPerMmbtu, usdPerMmbtuText, type UsdPerMmbtu,
|
|
52
54
|
} from "../../market-data/futures-contract";
|
|
@@ -1004,6 +1006,8 @@ function fundamentalsNotes(
|
|
|
1004
1006
|
? marketCapBasisNote(viewMarketCapitalization(priced.quote, fundamentals, regularSessionValuationPrice(priced.quote)))
|
|
1005
1007
|
: undefined;
|
|
1006
1008
|
const conversion = [...TRAILING_MONEY_METRICS].some(shown) ? ttmConversionNote(fundamentals) : undefined;
|
|
1009
|
+
// Which twelve months the revenue, net income and margin are, as Financials' TTM column names them.
|
|
1010
|
+
const period = shown("Revenue (TTM)") || shown("Net Income (TTM)") ? trailingPeriodNote(fundamentals) : undefined;
|
|
1007
1011
|
const eps = metrics.some((metric) => metricName(metric.label) === "EPS (TTM)" && metric.text !== "—") ? epsConversionNote(fundamentals) : undefined;
|
|
1008
1012
|
const epsSource = trailingEpsSourceNote(fundamentals, { eps: shown("EPS (TTM)"), pe: shown("P/E (TTM)") });
|
|
1009
1013
|
const priceEarnings = metrics.some((metric) => metricName(metric.label) === "P/E (TTM)" && typeof metric.value === "number")
|
|
@@ -1019,7 +1023,7 @@ function fundamentalsNotes(
|
|
|
1019
1023
|
: undefined;
|
|
1020
1024
|
// A cap Gloom Cloud withheld says why, as RV and EQS do.
|
|
1021
1025
|
const withheld = withheldMarketCap(fundamentals)?.note;
|
|
1022
|
-
return [withheld, shareBasis, enterpriseValue, conversion, eps, epsSource, priceEarnings, withdrawnMultiplesNote(fundamentals, metrics),
|
|
1026
|
+
return [withheld, shareBasis, enterpriseValue, conversion, period, eps, epsSource, priceEarnings, withdrawnMultiplesNote(fundamentals, metrics),
|
|
1023
1027
|
unsourcedCurrencyNote(metrics)]
|
|
1024
1028
|
.filter((note): note is string => !!note);
|
|
1025
1029
|
}
|
|
@@ -1473,11 +1477,14 @@ export async function buildTickerReport({
|
|
|
1473
1477
|
// As the Overview reads it: the regular session, then the extended-hours print against its close.
|
|
1474
1478
|
const session = getRegularSessionDisplay(quote)!;
|
|
1475
1479
|
const extended = getExtendedSessionDisplay(quote);
|
|
1480
|
+
// Each price says when it is from: Last a completed session's close by its day, the extended print by its time.
|
|
1481
|
+
const closeDate = futuresContract ? null : headlineCloseDate(quote);
|
|
1482
|
+
const extendedTime = extendedPrintTime(quote);
|
|
1476
1483
|
const extendedRow = (kind: "PRE" | "POST") => extended?.session === kind
|
|
1477
|
-
? colorBySign(
|
|
1484
|
+
? `${colorBySign(
|
|
1478
1485
|
`${formatMarketPriceWithCurrency(extended.price, quote.currency, quoteOptions)} (${formatPercentRaw(extended.changePercent)})`,
|
|
1479
1486
|
extended.change,
|
|
1480
|
-
)
|
|
1487
|
+
)}${extendedTime != null ? cliStyles.muted(` at ${formatTimestamp(extendedTime)}`) : ""}`
|
|
1481
1488
|
: "—";
|
|
1482
1489
|
const volume = reportedQuoteVolume(quote);
|
|
1483
1490
|
// A coin's volume is traded value in its quote currency (BTC-USD: US dollars), not a count of coins, and its
|
|
@@ -1491,7 +1498,7 @@ export async function buildTickerReport({
|
|
|
1491
1498
|
// A futures price is its latest trade; the exchange settlement is its own row, dated by its session.
|
|
1492
1499
|
appendMetricSection(lines, "Quote", [
|
|
1493
1500
|
// A price in cents says what it is per: 314.95¢/lb.
|
|
1494
|
-
["Last", colorBySign(`${formatMarketPriceWithCurrency(session.price, quote.currency, quoteOptions)}${futuresPricePer(futuresContract, quote.currency)}`, session.change)],
|
|
1501
|
+
["Last", `${colorBySign(`${formatMarketPriceWithCurrency(session.price, quote.currency, quoteOptions)}${futuresPricePer(futuresContract, quote.currency)}`, session.change)}${closeDate ? cliStyles.muted(` (${closeDayLabel(closeDate)})`) : ""}`],
|
|
1495
1502
|
...futuresContract
|
|
1496
1503
|
? [["Settle", quoteSettleText(quote, futuresContract)] as [string, string]]
|
|
1497
1504
|
: [],
|
package/src/cli/context.ts
CHANGED
|
@@ -19,6 +19,11 @@ import { isKnownUsStock } from "./known-us-stocks";
|
|
|
19
19
|
import { resolvePersistedCloudSessionToken } from "./pane-functions/cloud-session";
|
|
20
20
|
import { cloudStatementReportSources } from "./statement-filings";
|
|
21
21
|
import type { ConfigContext, MarketContext } from "./types";
|
|
22
|
+
import { attachFuturesTermsPersistence } from "../market-data/futures-contract";
|
|
23
|
+
import { createCommandPluginPersistence } from "./saved-copy-persistence";
|
|
24
|
+
|
|
25
|
+
/** Where a command keeps the futures terms it read, beside the app's other saved copies. */
|
|
26
|
+
const FUTURES_TERMS_NAMESPACE = "market:futures-terms";
|
|
22
27
|
|
|
23
28
|
export { withCliServices, withConfigData, withMarketData } from "./scoped-context";
|
|
24
29
|
|
|
@@ -119,6 +124,8 @@ function applyPersistedCloudSession(context: Pick<MarketContext, "persistence">)
|
|
|
119
124
|
export async function initMarketData(options: CliContextOptions = {}): Promise<MarketContext> {
|
|
120
125
|
const context = await initConfigData();
|
|
121
126
|
applyPersistedCloudSession(context);
|
|
127
|
+
// The futures terms a command reads are kept in the profile, so a later run the service cannot answer still has them.
|
|
128
|
+
attachFuturesTermsPersistence(createCommandPluginPersistence(context.persistence.resources, FUTURES_TERMS_NAMESPACE));
|
|
122
129
|
const plugins: SeriesPlugins = options.plugins ?? (() => (require("../plugins/catalog") as typeof import("../plugins/catalog")).getLoadablePlugins());
|
|
123
130
|
const capabilities = resolveCliCapabilities(context.config, options.dataPlugins ?? (typeof plugins === "function" ? plugins() : plugins));
|
|
124
131
|
// A lookup of a symbol the shipped listings show to be a US stock asks for no perpetual contracts.
|
|
@@ -159,6 +166,7 @@ export async function initCliServices(options: CliServicesOptions = {}) {
|
|
|
159
166
|
services.providerRouter.setBackgroundRevalidation(false);
|
|
160
167
|
await ensureCliServicesReady(services);
|
|
161
168
|
applyPersistedCloudSession(services);
|
|
169
|
+
attachFuturesTermsPersistence(createCommandPluginPersistence(services.persistence.resources, FUTURES_TERMS_NAMESPACE));
|
|
162
170
|
return {
|
|
163
171
|
config,
|
|
164
172
|
dataDir,
|
|
@@ -151,7 +151,9 @@ const CHROME_ARGS = [
|
|
|
151
151
|
"--disable-default-apps",
|
|
152
152
|
"--disable-extensions",
|
|
153
153
|
"--disable-popup-blocking",
|
|
154
|
-
"--
|
|
154
|
+
"--mute-audio",
|
|
155
|
+
// The profile is throwaway: on macOS Chrome's first start would otherwise store a key in the keychain, and with none to hold it that opens a dialog.
|
|
156
|
+
"--use-mock-keychain",
|
|
155
157
|
"--no-first-run",
|
|
156
158
|
"--no-default-browser-check",
|
|
157
159
|
"--allow-file-access-from-files",
|
|
@@ -63,7 +63,6 @@ export async function packShotView(dir: string): Promise<Uint8Array> {
|
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
65
|
* Serve the page from the archive at `archivePath` rather than building it.
|
|
66
|
-
* @knipignore Called by the entry scripts/build.ts writes for the release binary.
|
|
67
66
|
*/
|
|
68
67
|
export function usePrebuiltShotView(archivePath: string): void {
|
|
69
68
|
prebuiltArchive = archivePath;
|