@gloom-sh/terminal 0.20.17 → 0.20.18
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 +3 -1
- package/src/account/auth-dialog.tsx +19 -1
- package/src/account/billing.ts +2 -1
- package/src/account/heard-from-question.tsx +235 -0
- package/src/account/heard-from.ts +97 -0
- package/src/api-client/data.ts +3 -2
- package/src/api-client/heard-from.ts +72 -0
- package/src/api-client/index.ts +63 -6
- package/src/api-client/mna.ts +18 -0
- package/src/api-client/supply-chain.ts +9 -0
- package/src/api-client/types/billing.ts +35 -1
- package/src/app/global-shortcuts.ts +5 -3
- package/src/app/pro-welcome/keys.ts +27 -0
- package/src/app/pro-welcome/model.ts +158 -0
- package/src/app/pro-welcome/row.tsx +176 -0
- package/src/app/pro-welcome/use-pro-welcome.ts +156 -0
- package/src/app/runtime/external-profile-changes.ts +135 -0
- package/src/app.tsx +33 -2
- package/src/architecture/core-builtin-allowlist.json +1 -1
- package/src/architecture/floating-promise-allowlist.json +0 -1
- package/src/architecture/shortcut-labels-allowlist.json +1 -0
- package/src/cli/alert-listing.ts +98 -0
- package/src/cli/commands/market.ts +138 -22
- package/src/cli/commands/overview.ts +7 -1
- package/src/cli/commands/plugins.ts +3 -2
- package/src/cli/commands/search.ts +30 -6
- package/src/cli/context.ts +16 -5
- package/src/cli/csv-export.ts +2 -1
- package/src/cli/desktop-pane-shot.ts +72 -9
- package/src/cli/glossary.ts +64 -10
- package/src/cli/history-demergers.ts +117 -0
- package/src/cli/history-rows.ts +6 -2
- package/src/cli/index.ts +1 -0
- package/src/cli/known-gaps.ts +16 -0
- package/src/cli/known-us-stocks.ts +18 -0
- package/src/cli/listing-arg.ts +105 -15
- package/src/cli/pane-functions/catalog-snapshot-build.ts +83 -0
- package/src/cli/pane-functions/catalog-snapshot.json +866 -0
- package/src/cli/pane-functions/catalog-snapshot.ts +62 -0
- package/src/cli/pane-functions/catalog.ts +50 -16
- package/src/cli/pane-functions/data.ts +16 -4
- package/src/cli/pane-functions/dom.ts +24 -6
- package/src/cli/pane-functions/freshness.ts +17 -1
- package/src/cli/pane-functions/index.ts +100 -42
- package/src/cli/pane-functions/resolver.ts +8 -5
- package/src/cli/pane-functions/screenshot-assessment.ts +30 -7
- package/src/cli/pane-functions/screenshot-payload.ts +21 -0
- package/src/cli/pane-functions/screenshot-render.ts +3 -1
- package/src/cli/quote-answer.ts +32 -16
- package/src/cli/registry.ts +22 -2
- package/src/cli/result.ts +5 -4
- package/src/cli/series-search.ts +45 -6
- package/src/cli/shot-temp-dir.ts +4 -9
- package/src/components/chart/composite/legend.tsx +43 -18
- package/src/components/chart/composite/panel-surface/panel-cursor.tsx +3 -3
- package/src/components/chart/composite/price-axis-labels.tsx +7 -5
- package/src/components/chart-table/header.tsx +9 -0
- package/src/components/chart-table/layout.ts +11 -11
- package/src/components/command-bar/pane-templates/items.ts +17 -1
- package/src/components/command-bar/routes/root/provider-search.ts +10 -1
- package/src/components/command-bar/routes/root/results.ts +34 -2
- package/src/components/command-bar/routes/root/runtime.ts +8 -1
- package/src/components/command-bar/routes/ticker-search/route.ts +5 -0
- package/src/components/command-bar/workflow/alert.ts +19 -8
- package/src/components/data-table/view.tsx +15 -2
- package/src/components/form-modal/content.tsx +9 -4
- package/src/components/index.ts +1 -1
- package/src/components/layout/header.tsx +9 -5
- package/src/components/layout/pane/capture-status.ts +6 -0
- package/src/components/layout/pane/footer/index.tsx +2 -0
- package/src/components/layout/pane/footer/model.ts +113 -15
- package/src/components/layout/pane/header.tsx +16 -2
- package/src/components/market-board/index.tsx +4 -2
- package/src/components/onboarding/onboarding-frame.tsx +6 -2
- package/src/components/onboarding/onboarding-keyboard.ts +7 -1
- package/src/components/onboarding/onboarding-wizard.tsx +3 -1
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +24 -15
- package/src/components/onboarding/setup-cards.ts +36 -0
- package/src/components/onboarding/use-onboarding-progress.ts +22 -1
- package/src/components/onboarding/wizard-account.ts +6 -1
- package/src/components/onboarding/wizard-model.ts +32 -6
- package/src/components/onboarding/wizard-positions.ts +1 -1
- package/src/components/sign-in-gate.tsx +3 -1
- package/src/components/toggle-list.tsx +6 -8
- package/src/components/ui/confirm-dialog.tsx +47 -7
- package/src/components/ui/data-table/types.ts +8 -0
- package/src/components/ui/display.tsx +17 -2
- package/src/components/ui/index.ts +1 -1
- package/src/components/ui/stat-grid.tsx +4 -0
- package/src/components/ui/status.tsx +13 -1
- package/src/components/ui/table-layout.ts +2 -1
- package/src/components/use-pane-notice-footer.tsx +16 -3
- package/src/data/config/store/index.ts +31 -0
- package/src/data/config/store/node.ts +61 -11
- package/src/data/config/store/normalize.ts +4 -6
- package/src/data/config/store/shared-file.ts +309 -0
- package/src/data/profile-merge.ts +299 -0
- package/src/data/sqlite/checkpointer.ts +11 -1
- package/src/data/sqlite/database.ts +1 -1
- package/src/data/ticker-repository.ts +134 -10
- package/src/data/ticker-store.ts +67 -0
- package/src/data/ticker-writes.ts +5 -0
- package/src/i18n/es.ts +27 -0
- package/src/i18n/ja.ts +27 -0
- package/src/i18n/ko.ts +27 -0
- package/src/i18n/zh-cn.ts +27 -0
- package/src/i18n/zh-tw.ts +27 -0
- package/src/layout-marketplace/gallery-desktop.tsx +2 -2
- package/src/market-data/ah-pair.ts +103 -0
- package/src/market-data/depositary-pair.ts +6 -2
- package/src/market-data/hooks.tsx +33 -2
- package/src/market-data/market/change-basis.ts +2 -1
- package/src/market-data/market/header-market.ts +11 -0
- package/src/market-data/split-terms.ts +28 -0
- package/src/plugins/builtin/account-management/footer.ts +1 -1
- package/src/plugins/builtin/account-management/keyboard.ts +4 -0
- package/src/plugins/builtin/account-management/model.ts +1 -0
- package/src/plugins/builtin/account-management/pane.tsx +75 -7
- package/src/plugins/builtin/account-management/payment-recovery-row.tsx +12 -5
- package/src/plugins/builtin/account-management/pro-cancel.tsx +197 -0
- package/src/plugins/builtin/account-management/trial-cancel.ts +1 -1
- package/src/plugins/builtin/alerts/cli-move.ts +2 -2
- package/src/plugins/builtin/alerts/cli.ts +36 -30
- package/src/plugins/builtin/alerts/constants.ts +10 -0
- package/src/plugins/builtin/alerts/earnings-listing.ts +20 -0
- package/src/plugins/builtin/alerts/format.ts +24 -8
- package/src/plugins/builtin/alerts/index.tsx +38 -9
- package/src/plugins/builtin/alerts/move-checks.ts +7 -0
- package/src/plugins/builtin/alerts/pane.tsx +1 -1
- package/src/plugins/builtin/alerts/quotes.ts +26 -2
- package/src/plugins/builtin/alerts/scheduled.ts +6 -1
- package/src/plugins/builtin/alerts/types.ts +7 -0
- package/src/plugins/builtin/analytics/manual-value.ts +61 -0
- package/src/plugins/builtin/analytics/risk-book.ts +7 -7
- package/src/plugins/builtin/analytics/risk-client.ts +26 -13
- package/src/plugins/builtin/analytics/risk-headless.ts +13 -8
- package/src/plugins/builtin/analytics/risk-model.ts +92 -4
- package/src/plugins/builtin/analytics/risk-pane.tsx +85 -38
- package/src/plugins/builtin/awards/pane.tsx +1 -1
- package/src/plugins/builtin/broker-trading/orders.tsx +2 -2
- package/src/plugins/builtin/central-bank-rates/model.ts +8 -2
- package/src/plugins/builtin/central-bank-rates/pane.tsx +5 -3
- package/src/plugins/builtin/chart-composer/cli-options.ts +4 -2
- package/src/plugins/builtin/chart-composer/data-catalog-pane.tsx +2 -6
- package/src/plugins/builtin/chart-composer/pane.tsx +5 -2
- package/src/plugins/builtin/cloud/auth-actions.tsx +11 -6
- package/src/plugins/builtin/cloud/company-picker.tsx +5 -3
- package/src/plugins/builtin/cloud/upgrade-command.ts +1 -1
- package/src/plugins/builtin/company-kpis/headless.ts +9 -4
- package/src/plugins/builtin/company-kpis/latest.ts +45 -0
- package/src/plugins/builtin/company-kpis/model.ts +38 -8
- package/src/plugins/builtin/company-kpis/pane.tsx +22 -8
- package/src/plugins/builtin/composite/alt-data.ts +20 -0
- package/src/plugins/builtin/composite/application.ts +14 -0
- package/src/plugins/builtin/composite/broker.ts +12 -0
- package/src/plugins/builtin/composite/credit.ts +33 -0
- package/src/plugins/builtin/composite/crypto.ts +10 -0
- package/src/plugins/builtin/composite/earnings.ts +12 -0
- package/src/plugins/builtin/composite/filings.ts +13 -0
- package/src/plugins/builtin/composite/futures-commodities.ts +23 -0
- package/src/plugins/builtin/composite/global-markets.ts +12 -0
- package/src/plugins/builtin/composite/options-volatility.ts +23 -0
- package/src/plugins/builtin/composite/ownership.ts +23 -0
- package/src/plugins/builtin/composite/portfolio.ts +10 -0
- package/src/plugins/builtin/composite/quant.ts +15 -0
- package/src/plugins/builtin/composite/rates-macro.ts +30 -0
- package/src/plugins/builtin/composite/screeners.ts +11 -0
- package/src/plugins/builtin/composite/shared.ts +11 -0
- package/src/plugins/builtin/composite/ticker-core.ts +36 -0
- package/src/plugins/builtin/congress-trades/headless.ts +31 -3
- package/src/plugins/builtin/correlation/index.tsx +13 -17
- package/src/plugins/builtin/correlation/matrix/model.ts +18 -0
- package/src/plugins/builtin/dividend-yield/client.ts +57 -16
- package/src/plugins/builtin/dividend-yield/headless.ts +17 -11
- package/src/plugins/builtin/dividend-yield/model.ts +4 -3
- package/src/plugins/builtin/dividend-yield/pane.tsx +22 -18
- package/src/plugins/builtin/dividend-yield/ranking.ts +1 -1
- package/src/plugins/builtin/dividend-yield/types.ts +4 -0
- package/src/plugins/builtin/dividend-yield/view.ts +23 -12
- package/src/plugins/builtin/earnings/fiscal-quarter.ts +39 -0
- package/src/plugins/builtin/earnings/headless.ts +7 -4
- package/src/plugins/builtin/earnings/history-model.ts +6 -4
- package/src/plugins/builtin/earnings/history-table.ts +4 -3
- package/src/plugins/builtin/earnings-calls/pane.tsx +8 -2
- package/src/plugins/builtin/econ/calendar-model.ts +16 -0
- package/src/plugins/builtin/econ/index.tsx +3 -0
- package/src/plugins/builtin/equity-screener/headless.ts +4 -1
- package/src/plugins/builtin/equity-screener/model.ts +7 -6
- package/src/plugins/builtin/estimate-revisions/headless.ts +1 -1
- package/src/plugins/builtin/exposure/model.ts +10 -0
- package/src/plugins/builtin/exposure/pane.tsx +10 -3
- package/src/plugins/builtin/fx-matrix/amount.ts +15 -1
- package/src/plugins/builtin/fx-matrix/headless.ts +12 -6
- package/src/plugins/builtin/fx-matrix/index.tsx +23 -5
- package/src/plugins/builtin/fx-matrix/settings.ts +9 -4
- package/src/plugins/builtin/kelly-sizer/pane.tsx +9 -4
- package/src/plugins/builtin/market-valuation/pane.tsx +22 -10
- package/src/plugins/builtin/mna/detail.tsx +67 -6
- package/src/plugins/builtin/mna/headless.ts +128 -13
- package/src/plugins/builtin/mna/model.ts +219 -16
- package/src/plugins/builtin/mna/pane.tsx +34 -6
- package/src/plugins/builtin/money-markets/model.ts +14 -5
- package/src/plugins/builtin/money-markets/pane.tsx +4 -3
- package/src/plugins/builtin/news/wire/news/footer.ts +3 -8
- package/src/plugins/builtin/options-scenario/csp-screen-pane.tsx +22 -6
- package/src/plugins/builtin/options-scenario/csp-screen.ts +39 -12
- package/src/plugins/builtin/options-scenario/strategy-screen.ts +7 -5
- package/src/plugins/builtin/pe-band/client.ts +13 -1
- package/src/plugins/builtin/pe-band/headless.ts +2 -2
- package/src/plugins/builtin/pe-band/model.ts +63 -10
- package/src/plugins/builtin/pe-band/pane.tsx +5 -5
- package/src/plugins/builtin/portfolio-list/allocation-rows.ts +26 -7
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +66 -13
- package/src/plugins/builtin/portfolio-list/cli/render.ts +76 -33
- package/src/plugins/builtin/portfolio-list/headless.ts +69 -22
- package/src/plugins/builtin/portfolio-list/pane/data.ts +3 -3
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +29 -14
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +2 -2
- package/src/plugins/builtin/relative-rotation/pane.tsx +2 -3
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +5 -1
- package/src/plugins/builtin/research/event-model.ts +31 -13
- package/src/plugins/builtin/research/headless.ts +8 -1
- package/src/plugins/builtin/research/relative-valuation-pane.tsx +19 -17
- package/src/plugins/builtin/sectors/index.tsx +6 -9
- package/src/plugins/builtin/shared/cloud-upgrade.ts +1 -1
- package/src/plugins/builtin/shared/earnings-report.ts +19 -4
- package/src/plugins/builtin/shared/report-freshness.ts +2 -3
- package/src/plugins/builtin/supply-chain/client.ts +34 -9
- package/src/plugins/builtin/supply-chain/evidence.ts +3 -2
- package/src/plugins/builtin/supply-chain/flow.tsx +4 -3
- package/src/plugins/builtin/supply-chain/graph-model.ts +14 -7
- package/src/plugins/builtin/supply-chain/graph-pane.tsx +3 -1
- package/src/plugins/builtin/supply-chain/graph.tsx +6 -3
- package/src/plugins/builtin/supply-chain/headless.ts +19 -4
- package/src/plugins/builtin/supply-chain/model.ts +50 -6
- package/src/plugins/builtin/supply-chain/pane.tsx +76 -16
- package/src/plugins/builtin/ticker-detail/adr-pair/ah.ts +62 -0
- package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +119 -20
- package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +51 -1
- package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +25 -14
- package/src/plugins/builtin/ticker-detail/overview/model.ts +17 -1
- package/src/plugins/builtin/ticker-detail/overview/pane.tsx +4 -0
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +9 -2
- package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +9 -2
- package/src/plugins/builtin/ticker-detail/quote-monitor/index.tsx +5 -2
- package/src/plugins/builtin/volatility/model.ts +17 -0
- package/src/plugins/builtin/volatility/pane.tsx +13 -4
- package/src/plugins/builtin/world-indices/index.tsx +2 -0
- package/src/plugins/builtin/world-indices/table.tsx +15 -0
- package/src/plugins/builtin/world-venue-map/evidence.ts +3 -2
- package/src/plugins/builtin/world-venue-map/headless.ts +28 -16
- package/src/plugins/builtin/world-venue-map/index.ts +19 -6
- package/src/plugins/builtin/world-venue-map/layered-pane.tsx +9 -5
- package/src/plugins/builtin/world-venue-map/layers.ts +33 -11
- package/src/plugins/builtin/world-venue-map/map.tsx +12 -0
- package/src/plugins/builtin/world-venue-map/pane.tsx +35 -6
- package/src/plugins/builtin/world-venue-map/place.ts +119 -0
- package/src/plugins/catalog-data.ts +20 -0
- package/src/plugins/catalog-lazy.ts +51 -0
- package/src/plugins/catalog-ui.ts +16 -18
- package/src/plugins/host-smoke.ts +5 -2
- package/src/portfolio/allocation.ts +79 -19
- package/src/portfolio/cash-balances.ts +76 -0
- package/src/portfolio/mutations.ts +43 -8
- package/src/public/__snapshots__/public-api.test.ts.snap +1 -0
- package/src/renderers/desktop/window-layouts.ts +14 -0
- package/src/renderers/dom/data-table/row.tsx +2 -0
- package/src/renderers/dom/host/tabs.tsx +57 -8
- package/src/renderers/dom/styles.css +13 -5
- package/src/renderers/electrobun/bun/desktop/backend-requests.ts +4 -0
- package/src/renderers/electrobun/bun/desktop/backend.ts +22 -1
- package/src/renderers/electrobun/bun/window/native-min-size.ts +6 -1
- package/src/renderers/electrobun/shared/protocol.ts +4 -0
- package/src/renderers/electrobun/view/cli-pane-shot-frame.tsx +50 -12
- package/src/renderers/electrobun/view/remote/ticker-repository.ts +10 -0
- package/src/series/standalone-catalog.ts +5 -4
- package/src/series/standalone.ts +13 -7
- package/src/sources/gloomberb-cloud/index.ts +14 -3
- package/src/sources/gloomberb-cloud/perpetuals.ts +60 -3
- package/src/sources/provider-router/financials.ts +20 -13
- package/src/sources/provider-router/index.ts +4 -0
- package/src/sources/provider-router/search.ts +1 -0
- package/src/sync/collections-contributor.ts +3 -1
- package/src/sync/config-merge.ts +10 -1
- package/src/sync/sanitize.ts +26 -2
- package/src/tickers/company-name-listing.ts +16 -2
- package/src/tickers/listing-fate.ts +12 -8
- package/src/tickers/renamed-listings.ts +43 -10
- package/src/tickers/search/home-listing.ts +28 -0
- package/src/tickers/search/index.ts +19 -7
- package/src/tickers/terminal-codes.ts +11 -1
- package/src/time-series/resolve.ts +3 -1
- package/src/time-series/spec.ts +2 -2
- package/src/time-series/types.ts +1 -1
- package/src/types/data-provider.ts +11 -0
- package/src/types/financials.ts +39 -3
- package/src/types/ticker.ts +10 -2
- package/src/utils/cli-output.ts +1 -1
- package/src/utils/declared-dividends.ts +13 -1
- package/src/utils/dividend-cash.ts +5 -1
- package/src/utils/forward-dividend.ts +4 -3
- package/src/utils/remove-folder.ts +37 -0
- package/src/utils/trailing-dividend.ts +1 -1
- package/src/plugins/builtin/composite-plugins.ts +0 -285
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { EarningsFiscalAnchor } from "../../../api-client/earnings";
|
|
2
2
|
import { addDays } from "./board-model";
|
|
3
|
+
import { quarterLabel } from "../shared/earnings-report";
|
|
3
4
|
|
|
4
5
|
/** A quarter as the company names it: NVIDIA's October 2026 quarter is Q3 of fiscal 2027. */
|
|
5
6
|
export interface FiscalQuarter {
|
|
@@ -28,6 +29,40 @@ export function fiscalQuarterOf(period: string | null | undefined, anchor: Earni
|
|
|
28
29
|
return { fiscalYear: Math.floor(index / 4), fiscalQuarter: (index % 4) + 1 };
|
|
29
30
|
}
|
|
30
31
|
|
|
32
|
+
/**
|
|
33
|
+
* The month a period ends in, from a YYYY-MM month or a YYYY-MM-DD end. A
|
|
34
|
+
* 52/53-week period that ends in a month's first week (Feb 1, 2026) closes
|
|
35
|
+
* the month before, as its filer counts it.
|
|
36
|
+
*/
|
|
37
|
+
function closingMonth(period: string | null | undefined): number | null {
|
|
38
|
+
const day = period ? /^(\d{4}-\d{2})-(\d{2})/.exec(period) : null;
|
|
39
|
+
const month = monthIndex(day ? day[1] : period);
|
|
40
|
+
return month != null && day && Number(day[2]) <= 7 ? month - 1 : month;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The quarter ending in `period` on a fiscal year that ends in `yearEndMonth`
|
|
45
|
+
* (1 to 12, from the company's annual statements), where no calls name the
|
|
46
|
+
* company's quarters: Visa's December 2026 quarter is Q1 FY2027, its year
|
|
47
|
+
* ending in September. A fiscal year is named by the calendar year it ends
|
|
48
|
+
* in. Null off that year's quarters, or without a year end.
|
|
49
|
+
*/
|
|
50
|
+
export function fiscalQuarterInYear(period: string | null | undefined, yearEndMonth: number | null | undefined): FiscalQuarter | null {
|
|
51
|
+
const month = closingMonth(period);
|
|
52
|
+
if (month == null || yearEndMonth == null || yearEndMonth < 1 || yearEndMonth > 12) return null;
|
|
53
|
+
const calendarMonth = (month % 12) + 1;
|
|
54
|
+
const offset = (calendarMonth - yearEndMonth + 12) % 12;
|
|
55
|
+
if (offset % 3 !== 0) return null;
|
|
56
|
+
const year = Math.floor(month / 12);
|
|
57
|
+
return { fiscalYear: calendarMonth <= yearEndMonth ? year : year + 1, fiscalQuarter: offset === 0 ? 4 : offset / 3 };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** "FY2027" for a period that ends a fiscal year ending in `yearEndMonth`; null for any other. */
|
|
61
|
+
export function fiscalYearText(period: string | null | undefined, yearEndMonth: number | null | undefined): string | null {
|
|
62
|
+
const quarter = fiscalQuarterInYear(period, yearEndMonth);
|
|
63
|
+
return quarter?.fiscalQuarter === 4 ? `FY${quarter.fiscalYear}` : null;
|
|
64
|
+
}
|
|
65
|
+
|
|
31
66
|
/**
|
|
32
67
|
* The quarter-end month a report with none on record announces: the last on
|
|
33
68
|
* the company's cycle that ended 5 to 100 days before it, as Gloom Cloud
|
|
@@ -52,3 +87,7 @@ export function fiscalQuarterText(quarter: FiscalQuarter | null | undefined, sho
|
|
|
52
87
|
if (!quarter) return null;
|
|
53
88
|
return `Q${quarter.fiscalQuarter} FY${short ? String(quarter.fiscalYear).slice(-2) : quarter.fiscalYear}`;
|
|
54
89
|
}
|
|
90
|
+
|
|
91
|
+
export function fiscalPeriodText(period: string | null | undefined, quarter?: FiscalQuarter | null, short = false): string {
|
|
92
|
+
return fiscalQuarterText(quarter, short) ?? quarterLabel(period ?? undefined);
|
|
93
|
+
}
|
|
@@ -17,9 +17,9 @@ import { fetchEarningsCalendar, fetchEarningsHistory, noHistoryAbroad, sameHisto
|
|
|
17
17
|
import { loadEarningsCalendar } from "./data/cache";
|
|
18
18
|
import { epsText, impliedText, moneyText, moveSize, signedPercent, TIMING_LABEL } from "./format";
|
|
19
19
|
import { historyRows, periodText } from "./history-model";
|
|
20
|
-
import { fiscalQuarterText } from "./fiscal-quarter";
|
|
20
|
+
import { fiscalPeriodText, fiscalQuarterText } from "./fiscal-quarter";
|
|
21
21
|
import { loadNoEarningsText } from "./no-earnings";
|
|
22
|
-
import { EPS_BASIS_NOTE, epsBasisName, PROVISIONAL_NOTE, showsEpsBasis } from "../shared/earnings-report";
|
|
22
|
+
import { EPS_BASIS_NOTE, epsBasisName, lacksConsensus, NO_CONSENSUS, PROVISIONAL_NOTE, showsEpsBasis } from "../shared/earnings-report";
|
|
23
23
|
import { lastReportOnRecord, listingDay, noNextReportText } from "../shared/earnings-calendar";
|
|
24
24
|
import { commandWord } from "../../../utils/shell-word";
|
|
25
25
|
import { listingAbroadVenue } from "../../../utils/sec";
|
|
@@ -96,8 +96,9 @@ const HISTORY_COLUMNS: HeadlessPaneColumn[] = [
|
|
|
96
96
|
{ key: "dateStatus", header: "Status" },
|
|
97
97
|
{ key: "timing", header: "When" },
|
|
98
98
|
// The quarter as the company names it; its end month where the company's calls do not say. Exports keep both.
|
|
99
|
-
{ key: "fiscalQuarter", header: "Quarter", format: (value, row) => typeof value === "string" ? value : typeof row.fiscalPeriod === "string" ? row.fiscalPeriod :
|
|
100
|
-
|
|
99
|
+
{ key: "fiscalQuarter", header: "Quarter", format: (value, row) => typeof value === "string" ? value : fiscalPeriodText(typeof row.fiscalPeriod === "string" ? row.fiscalPeriod : undefined) },
|
|
100
|
+
// A reported quarter with no consensus on record says so (exports: in the status column), never a bare blank.
|
|
101
|
+
{ key: "epsEstimate", header: "EPS est", align: right, format: (value, row) => lacksConsensus({ epsActual: num(row.epsActual), epsEstimate: num(value) }) ? NO_CONSENSUS : epsText(num(value)) },
|
|
101
102
|
{ key: "epsAnalysts", header: "Ests", align: right },
|
|
102
103
|
{ key: "epsActual", header: "EPS act", align: right, format: (value) => epsText(num(value)) },
|
|
103
104
|
BASIS_COLUMN,
|
|
@@ -245,6 +246,8 @@ async function boardRows(args: HeadlessPaneLoadArgs, context: HeadlessPaneContex
|
|
|
245
246
|
return {
|
|
246
247
|
columns: BOARD_COLUMNS,
|
|
247
248
|
rows,
|
|
249
|
+
complete: rows.length === all.length && cloud.status !== "rejected",
|
|
250
|
+
...(rows.length < all.length ? { notes: [`Showing ${rows.length} of ${all.length} reports. Retrieve all with --limit ${all.length}.`] } : {}),
|
|
248
251
|
errors: cloud.status === "rejected" ? [String(cloud.reason instanceof Error ? cloud.reason.message : cloud.reason)] : undefined,
|
|
249
252
|
metadata: {
|
|
250
253
|
...(ticker ? { notices: [ticker.notice], highlight: { symbol: highlight, onBoard: ticker.date != null, date: ticker.date, row: ticker.row } } : {}),
|
|
@@ -7,8 +7,8 @@ import type { EarningsDateStatus, EarningsEpsBasis } from "../../../types/financ
|
|
|
7
7
|
import { earningsDateStatus, earningsEpsBasis, isProvisionalActual } from "../shared/earnings-report";
|
|
8
8
|
import { resolveReportRows, type ReportRowAdapter } from "../shared/earnings-calendar";
|
|
9
9
|
import { addDays, MIN_AVERAGE_REPORTS } from "./board-model";
|
|
10
|
-
import { fiscalQuarterOf,
|
|
11
|
-
import { datedYear, fiscalMonth, impliedText, moveSize, shortDate, surprise, TIMING_LABEL, type Surprise } from "./format";
|
|
10
|
+
import { fiscalQuarterOf, fiscalPeriodText, placedPeriod, type FiscalQuarter } from "./fiscal-quarter";
|
|
11
|
+
import { datedYear, epsText, fiscalMonth, impliedText, moveSize, shortDate, surprise, TIMING_LABEL, type Surprise } from "./format";
|
|
12
12
|
|
|
13
13
|
export interface HistoryRow {
|
|
14
14
|
key: string;
|
|
@@ -67,7 +67,7 @@ export function periodText(
|
|
|
67
67
|
row: Pick<HistoryRow, "periodKind" | "periodMonths" | "periodFiscalYear" | "fiscalHalf" | "fiscalQuarter" | "fiscalPeriod">,
|
|
68
68
|
short = true,
|
|
69
69
|
): string {
|
|
70
|
-
if (row.periodKind === "quarter") return
|
|
70
|
+
if (row.periodKind === "quarter") return fiscalPeriodText(row.fiscalPeriod, row.fiscalQuarter, short);
|
|
71
71
|
const year = row.periodFiscalYear == null ? null : `FY${short ? String(row.periodFiscalYear).slice(-2) : row.periodFiscalYear}`;
|
|
72
72
|
if (row.periodKind === "year" && year) return year;
|
|
73
73
|
if (row.periodKind === "half" && year && row.fiscalHalf != null) return `H${row.fiscalHalf} ${year}`;
|
|
@@ -262,11 +262,13 @@ export function historyFigures(rows: readonly HistoryRow[], today: string): Stat
|
|
|
262
262
|
const beats = past.filter((row) => row.epsSurprise != null && row.epsActual != null && row.epsEstimate != null);
|
|
263
263
|
const figures: StatItem[] = [];
|
|
264
264
|
if (next) {
|
|
265
|
+
const estimate = next.epsEstimate == null ? null : `EPS est ${epsText(next.epsEstimate)}${next.currency ? ` ${next.currency}` : ""}`;
|
|
265
266
|
figures.push({
|
|
266
267
|
id: "next",
|
|
267
268
|
label: "Next report",
|
|
268
269
|
value: `${shortDate(next.date)}${next.timing ? ` ${TIMING_LABEL[next.timing]}` : ""}`,
|
|
269
|
-
detail: [next.dateStatus === "reported" ? null : next.dateStatus, daysUntil(next.date, today)].filter(Boolean).join(", "),
|
|
270
|
+
detail: [estimate, next.dateStatus === "reported" ? null : next.dateStatus, daysUntil(next.date, today)].filter(Boolean).join(", "),
|
|
271
|
+
...(estimate ? { detailVariants: [estimate] } : {}),
|
|
270
272
|
});
|
|
271
273
|
if (next.implied != null) {
|
|
272
274
|
figures.push({
|
|
@@ -6,7 +6,7 @@ import { notMeaningfulCell } from "../../../components/ui/not-meaningful";
|
|
|
6
6
|
import { isNotMeaningful } from "../../../utils/growth";
|
|
7
7
|
import { TextAttributes } from "../../../ui";
|
|
8
8
|
import { datedYear, epsText, impliedText, moneyText, signedPercent, TIMING_LABEL, type Surprise } from "./format";
|
|
9
|
-
import { epsBasisShort, showsEpsBasis } from "../shared/earnings-report";
|
|
9
|
+
import { epsBasisShort, lacksConsensus, NO_CONSENSUS_SHORT, showsEpsBasis } from "../shared/earnings-report";
|
|
10
10
|
import { periodText, type HistoryRow } from "./history-model";
|
|
11
11
|
|
|
12
12
|
type HistoryColumnId =
|
|
@@ -18,7 +18,7 @@ export type HistoryColumn = DataTableColumn & { id: HistoryColumnId };
|
|
|
18
18
|
const ALL_COLUMNS: HistoryColumn[] = [
|
|
19
19
|
{ id: "date", label: "DATE", width: 10, align: "left" },
|
|
20
20
|
{ id: "when", label: "WHEN", width: 4, align: "left" },
|
|
21
|
-
{ id: "period", label: "QTR", width:
|
|
21
|
+
{ id: "period", label: "QTR", width: 8, align: "left" },
|
|
22
22
|
{ id: "epsEstimate", label: "EPS EST", width: 7, align: "right" },
|
|
23
23
|
{ id: "analysts", label: "ESTS", width: 4, align: "right" },
|
|
24
24
|
{ id: "epsActual", label: "EPS ACT", width: 7, align: "right" },
|
|
@@ -117,7 +117,8 @@ export function renderHistoryCell(row: HistoryRow, column: HistoryColumn, liveMo
|
|
|
117
117
|
case "period":
|
|
118
118
|
return { text: periodText(row), color: dim };
|
|
119
119
|
case "epsEstimate":
|
|
120
|
-
|
|
120
|
+
// A reported quarter with no consensus on record says so; its surprise stays blank.
|
|
121
|
+
return { text: lacksConsensus(row) ? NO_CONSENSUS_SHORT : inCurrency(epsText(row.epsEstimate), row), color: dim };
|
|
121
122
|
case "analysts":
|
|
122
123
|
return { text: row.epsAnalysts == null ? MISSING_VALUE : String(row.epsAnalysts), color: dim };
|
|
123
124
|
case "epsActual":
|
|
@@ -278,6 +278,10 @@ function CallsListView({
|
|
|
278
278
|
});
|
|
279
279
|
|
|
280
280
|
const [calls, setCalls] = useState<CloudEarningsCallPayload[]>(initialShelf?.calls ?? []);
|
|
281
|
+
// The binding the shelf was read for. A dual-listed company's calls carry its
|
|
282
|
+
// home line's ticker (CALLS 1088:HKEX lists 601088:SSE's), so a call on this
|
|
283
|
+
// binding's shelf is its own whatever ticker it carries.
|
|
284
|
+
const [shelfTicker, setShelfTicker] = useState(() => symbol ? symbol.toUpperCase() : null);
|
|
281
285
|
const [listStatus, setListStatus] = useState<"idle" | "loading" | "loaded" | "error">(initialShelf ? "loaded" : "idle");
|
|
282
286
|
const [listError, setListError] = useState<{ message: string; status?: number } | null>(null);
|
|
283
287
|
const [stale, setStale] = useState(initialShelf?.stale === true);
|
|
@@ -345,6 +349,7 @@ function CallsListView({
|
|
|
345
349
|
.then((result) => {
|
|
346
350
|
if (request !== listRequestVersion.current) return;
|
|
347
351
|
setCalls(result.calls);
|
|
352
|
+
setShelfTicker(ticker);
|
|
348
353
|
setNextOffset(result.calls.length);
|
|
349
354
|
setHasMore(result.sourceLimitReached === true);
|
|
350
355
|
setStale(result.stale);
|
|
@@ -416,6 +421,7 @@ function CallsListView({
|
|
|
416
421
|
firstShelfLoadRef.current = false;
|
|
417
422
|
const held = cachedEarningsCalls(ticker, { limit: CALL_PAGE_SIZE, exchange: listingVenue, name: listingName });
|
|
418
423
|
setCalls(held?.calls ?? []);
|
|
424
|
+
setShelfTicker(ticker);
|
|
419
425
|
setHasMore(held?.sourceLimitReached === true);
|
|
420
426
|
setLoadingMore(false);
|
|
421
427
|
setNextOffset(held?.calls.length ?? 0);
|
|
@@ -660,7 +666,7 @@ function CallsListView({
|
|
|
660
666
|
if (!detailOpen || !selectedCallId || selectedUpcoming || !access.emailVerified || !access.hasProAccess) return;
|
|
661
667
|
// A binding change clears selection in an effect; do not start a request
|
|
662
668
|
// for that previous selection during the same render's effect pass.
|
|
663
|
-
if (ticker && selected?.ticker.toUpperCase() !== ticker) return;
|
|
669
|
+
if (ticker && selected?.ticker.toUpperCase() !== ticker && shelfTicker !== ticker) return;
|
|
664
670
|
let cancelled = false;
|
|
665
671
|
let timer: ReturnType<typeof setTimeout> | null = null;
|
|
666
672
|
setTranscriptError(null);
|
|
@@ -705,7 +711,7 @@ function CallsListView({
|
|
|
705
711
|
};
|
|
706
712
|
// The call's identity is what matters; list refreshes must not restart this.
|
|
707
713
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
708
|
-
}, [detailOpen, selectedCallId, selectedUpcoming, ticker, access.emailVerified, access.hasProAccess]);
|
|
714
|
+
}, [detailOpen, selectedCallId, selectedUpcoming, ticker, shelfTicker, access.emailVerified, access.hasProAccess]);
|
|
709
715
|
|
|
710
716
|
const scrollTranscriptBy = useCallback((delta: number) => {
|
|
711
717
|
if (transcriptScrollRef.current) scrollByLines(transcriptScrollRef.current, delta);
|
|
@@ -530,6 +530,22 @@ export function figureGap(
|
|
|
530
530
|
return releaseIn ? "none" : "awaiting";
|
|
531
531
|
}
|
|
532
532
|
|
|
533
|
+
/**
|
|
534
|
+
* Whether a row's ACTUAL is blank with no figure missing: the release is
|
|
535
|
+
* still to come (by its time, or by its day where it has none), or it prints
|
|
536
|
+
* no figure at all (a speech, a meeting, with neither forecast nor prior).
|
|
537
|
+
* A release past its time with a figure due is not: figureGap says it is
|
|
538
|
+
* awaited for a day, and its blank after that is a figure the source lost.
|
|
539
|
+
*/
|
|
540
|
+
export function actualMayBeBlank(
|
|
541
|
+
event: Pick<EconEvent, "actual" | "forecast" | "prior" | "date" | "time" | "timeNote">,
|
|
542
|
+
now: number,
|
|
543
|
+
): boolean {
|
|
544
|
+
if (event.actual?.trim()) return false;
|
|
545
|
+
if (!event.forecast?.trim() && !event.prior?.trim()) return true;
|
|
546
|
+
return now < event.date.getTime() + (hasNoReleaseTime(event) ? AWAITING_FIGURE_MS : 0);
|
|
547
|
+
}
|
|
548
|
+
|
|
533
549
|
/** What a release awaiting its figure says in place of it: "due 07:00 UTC, awaiting figure". */
|
|
534
550
|
function awaitingFigureText(event: Pick<EconEvent, "date">): string {
|
|
535
551
|
return `due ${timeLabel(event.date)} ${CALENDAR_TIME_ZONE_LABEL}, awaiting figure`;
|
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
FILTER_CYCLE,
|
|
37
37
|
attachEconCalendarPersistence,
|
|
38
38
|
actualColor,
|
|
39
|
+
actualMayBeBlank,
|
|
39
40
|
AWAITING_FIGURE_CELL,
|
|
40
41
|
awaitsConsensus,
|
|
41
42
|
figureGap,
|
|
@@ -506,6 +507,8 @@ function EconCalendarPane({ focused, width, height }: PaneProps) {
|
|
|
506
507
|
return {
|
|
507
508
|
text: figureWithCurrency(ev.actual, ev.currency) ?? MISSING_VALUE,
|
|
508
509
|
color: actualColor(ev.actual, ev.forecast),
|
|
510
|
+
// A release still to come, or one with no figure to print: its dash is no figure lost.
|
|
511
|
+
...(actualMayBeBlank(ev, now) ? { mayBeBlank: true } : {}),
|
|
509
512
|
};
|
|
510
513
|
case "forecast":
|
|
511
514
|
return { text: figureWithCurrency(ev.forecast, ev.currency) ?? MISSING_VALUE, color: colors.textDim };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { HeadlessPaneDefinition } from "../../../types/plugin";
|
|
2
|
+
import { isProLock } from "../../../cli/pane-functions/access-gate";
|
|
2
3
|
import type { HeadlessPaneColumn, HeadlessPaneContext } from "../../../types/headless";
|
|
3
4
|
import {
|
|
4
5
|
KPI_FIELDS,
|
|
@@ -387,7 +388,9 @@ export const equityScreenerHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
387
388
|
const extra = extraScreenColumns(metrics, data.definition.sort.field);
|
|
388
389
|
const states = new Set(rows.map((row) => row.metrics[metric].state));
|
|
389
390
|
const legend = STATE_LEGEND.filter(({ state }) => states.has(state)).map(({ text }) => text);
|
|
390
|
-
const
|
|
391
|
+
const locked = rows.some((row) => metrics.some((field) => row.metrics[field]?.access === "pro"));
|
|
392
|
+
const notes = [...watchlistRead.notes, ...listingReadNotes(data.listings, data.definition.currency), ...kpiGaps, ...legend,
|
|
393
|
+
...(locked && !errors.some(isProLock) ? ["Locked figures require Gloom Pro access."] : [])];
|
|
391
394
|
// Payload status also counts ordinary per-field sparsity; only generation
|
|
392
395
|
// warnings are failures, and more pages are not an error.
|
|
393
396
|
return {
|
|
@@ -73,7 +73,7 @@ export const SHORT_LABELS: Record<NumericField, string> = {
|
|
|
73
73
|
revenueGrowthPercent: "FY REV GR%",
|
|
74
74
|
earningsGrowthPercent: "FY EARN GR%",
|
|
75
75
|
grossMarginPercent: "FY GROSS MGN%",
|
|
76
|
-
payoutRatioPercent: "FY PAYOUT%",
|
|
76
|
+
payoutRatioPercent: "FY CASH PAYOUT%",
|
|
77
77
|
dividendGrowth1YPercent: "DIV GR 1Y%",
|
|
78
78
|
dividendGrowth3YPercent: "DIV CAGR 3Y%",
|
|
79
79
|
operatingMarginPercent: "FY OP MGN%",
|
|
@@ -257,15 +257,16 @@ export function formatScreenValue(field: NumericField, value: number | null): st
|
|
|
257
257
|
}
|
|
258
258
|
|
|
259
259
|
/** A row's metric as a cell prints it: N/M for a multiple that is not meaningful, as RV and `valuation` print it. */
|
|
260
|
-
export function formatScreenMetric(field: NumericField, metric: Pick<ScreenMetric, "value" | "notMeaningful">): string {
|
|
261
|
-
|
|
260
|
+
export function formatScreenMetric(field: NumericField, metric: Pick<ScreenMetric, "value" | "notMeaningful"> & Partial<Pick<ScreenMetric, "reason">>): string {
|
|
261
|
+
const text = metric.value == null && metric.notMeaningful ? formatPriceEarnings(NOT_MEANINGFUL) : formatScreenValue(field, metric.value);
|
|
262
|
+
return field === "dividendGrowthYears" && metric.value != null && /^At least \d+: the stored history starts \d{4}-\d{2}-\d{2}$/.test(metric.reason ?? "") ? `${text}+` : text;
|
|
262
263
|
}
|
|
263
264
|
|
|
264
265
|
/** A metric as a company's detail prints it: with its unit, but a grade or the composite reads as itself (B+, 4.72 Top). */
|
|
265
|
-
export function screenDetailValue(field: NumericField, metric: Pick<ScreenMetric, "value" | "notMeaningful" | "unit">): string {
|
|
266
|
+
export function screenDetailValue(field: NumericField, metric: Pick<ScreenMetric, "value" | "notMeaningful" | "unit"> & Partial<Pick<ScreenMetric, "reason">>): string {
|
|
266
267
|
// A missing value is just "--", without the unit it would have had; N/M says so.
|
|
267
268
|
if (metric.value == null) return metric.notMeaningful ? formatScreenMetric(field, metric) : formatScreenValue(field, null);
|
|
268
|
-
const text =
|
|
269
|
+
const text = formatScreenMetric(field, metric);
|
|
269
270
|
if (GRADE_DISPLAY_FIELDS.has(field)) return text;
|
|
270
271
|
// A count of one is singular: 1 year, 1 day.
|
|
271
272
|
const unit = metric.value === 1 && COUNT_UNITS.has(metric.unit) ? metric.unit.slice(0, -1) : metric.unit;
|
|
@@ -484,7 +485,7 @@ export const screenLabel = (field: string) =>
|
|
|
484
485
|
dividendYieldPercent: "Dividend yield %",
|
|
485
486
|
xPostsPerDay: "X posts per day",
|
|
486
487
|
xPostsVsMedian: "X posts vs median",
|
|
487
|
-
payoutRatioPercent: "
|
|
488
|
+
payoutRatioPercent: "FY cash dividends / parent net income %",
|
|
488
489
|
dividendGrowth1YPercent: "Dividend growth 1Y %",
|
|
489
490
|
dividendGrowth3YPercent: "Dividend growth 3Y CAGR %",
|
|
490
491
|
wikiViewsPerDay: "Wikipedia views per day",
|
|
@@ -30,7 +30,7 @@ export const estimateRevisionsHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
30
30
|
],
|
|
31
31
|
discovery: {
|
|
32
32
|
aliases: ["EM", "GUID", "EEO"],
|
|
33
|
-
dataRequirements: ["
|
|
33
|
+
dataRequirements: ["Verified Gloom sign-in", "Gloom Cloud analyst snapshots"],
|
|
34
34
|
limitations: [
|
|
35
35
|
"Actual collection days and provider backfills remain separate.",
|
|
36
36
|
"Range dispersion is not standard deviation.",
|
|
@@ -104,6 +104,16 @@ function shockLabel(data: ExposurePayload, id: string): string {
|
|
|
104
104
|
return shock ? shockText(shock) : id;
|
|
105
105
|
}
|
|
106
106
|
/** The scenario as the pane's scenario picker names it, with its one shock when it has one: Taiwan disruption (TW -100%). */
|
|
107
|
+
/**
|
|
108
|
+
* What the analysis says of the whole portfolio, for the footer: the
|
|
109
|
+
* payload's unknowns less each holding's own, which the service repeats there
|
|
110
|
+
* as `AAPL: …` and which that holding's rows (`Estimated 6 gaps`) and detail say.
|
|
111
|
+
*/
|
|
112
|
+
export function analysisNotes(data: Pick<ExposurePayload, "unknowns" | "holdings">): string[] {
|
|
113
|
+
const holdings = data.holdings.map((holding) => `${holding.symbol}: `);
|
|
114
|
+
return data.unknowns.filter((note) => !holdings.some((prefix) => note.startsWith(prefix)));
|
|
115
|
+
}
|
|
116
|
+
|
|
107
117
|
export function scenarioTitle(scenario: ExposureScenario): string {
|
|
108
118
|
return `${scenario.label}${scenario.shocks.length === 1 ? ` (${shockText(scenario.shocks[0]!)})` : ""}`;
|
|
109
119
|
}
|
|
@@ -21,7 +21,7 @@ import { ExposurePathDiagram, ExposureRanges } from "./charts";
|
|
|
21
21
|
import { fetchExposure, fetchScenarios, validateExposure } from "./client";
|
|
22
22
|
import { ExposureEditor, type ExposureInputs } from "./editor";
|
|
23
23
|
import { portfolioHoldings, watchlistHoldings } from "./holdings";
|
|
24
|
-
import { basisLabel, DEFAULT_SCENARIO, exposureCellText, fraction, hopsText, parseCustomScenario, parseHoldings, pathRows, periodText, portfolioRows, rangeText, tableRows, TABS, type ExposureRow } from "./model";
|
|
24
|
+
import { analysisNotes, basisLabel, DEFAULT_SCENARIO, exposureCellText, fraction, hopsText, parseCustomScenario, parseHoldings, pathRows, periodText, portfolioRows, rangeText, tableRows, TABS, type ExposureRow } from "./model";
|
|
25
25
|
import { useExposureEvidence } from "./evidence";
|
|
26
26
|
import { driverRows, driverScope, driverUnits, driverValue } from "./drivers";
|
|
27
27
|
|
|
@@ -36,6 +36,12 @@ function EvidenceItem({ item }: { item: ExposureEvidence }) {
|
|
|
36
36
|
{item.url ? <ActionRow label="Open primary evidence" onPress={() => void host.openExternal(item.url!)} /> : null}
|
|
37
37
|
</Box>;
|
|
38
38
|
}
|
|
39
|
+
/** How many things a row's evidence could not see, beside its evidence word (`Estimated 3 gaps`); its detail lists them. */
|
|
40
|
+
function gapsNote(row: ExposureRow): { note?: string } {
|
|
41
|
+
const gaps = new Set(row.unknowns).size;
|
|
42
|
+
return gaps ? { note: `${gaps} gap${gaps === 1 ? "" : "s"}` } : {};
|
|
43
|
+
}
|
|
44
|
+
|
|
39
45
|
function ExposureDetail({ row, data, width }: { row: ExposureRow | null; data: ExposurePayload; width: number }) {
|
|
40
46
|
const colors = useThemeColors();
|
|
41
47
|
const unknowns = row ? row.unknowns : [...data.unknowns, ...data.holdings.flatMap(h => h.unknowns.map(u => `${h.symbol}: ${u}`))];
|
|
@@ -181,7 +187,8 @@ export function ExposurePane({ width, height, focused }: PaneProps) {
|
|
|
181
187
|
];
|
|
182
188
|
usePaneStatusFooter({ registrationId: "exposure", loading: resource.loading, error: inputError ?? (data ? resource.error : null), hints,
|
|
183
189
|
info: data ? [{ id: "asof", parts: [{ text: `analyzed ${data.evaluatedAt.slice(0, 10)}`, tone: "muted" as const }] }] : [] });
|
|
184
|
-
|
|
190
|
+
// The footer's notes are the analysis's; what one holding's rows could not see is on those rows (gapsNote) and in their detail.
|
|
191
|
+
usePaneNoticeFooter({ registrationId: "exposure:notices", focused, notices: [...(library.error ? [library.error] : []), ...(data ? analysisNotes(data) : [])] });
|
|
185
192
|
const sources = [{ value: "typed", label: "Typed holdings" }, ...config.portfolios.map(p => ({ value: `PORT:${p.id}`, label: `PORT · ${p.name}` })), ...config.watchlists.map(w => ({ value: `WATCH:${w.id}`, label: `Watchlist · ${w.name}` }))];
|
|
186
193
|
const bodyHeight = Math.max(3, height - tabRows);
|
|
187
194
|
const concentration = tab === "portfolio" && view !== "stress";
|
|
@@ -222,7 +229,7 @@ export function ExposurePane({ width, height, focused }: PaneProps) {
|
|
|
222
229
|
case "basis": return row.basis ? { text: exposureCellText(row, "basis"), color: colors.textDim } : missingCell(colors);
|
|
223
230
|
case "exposure": return row.exposure ? { text: exposureCellText(row, "exposure"), value: row.exposure.high, color: colors.textBright } : { text: exposureCellText(row, "exposure"), value: null, color: colors.textMuted };
|
|
224
231
|
// Disclosed figures stand out; estimates read plainly, and the word says which is which.
|
|
225
|
-
case "classification": return { text: exposureCellText(row, "classification"),
|
|
232
|
+
case "classification": return { text: exposureCellText(row, "classification"), ...gapsNote(row),
|
|
226
233
|
color: row.classification === "disclosed" ? colors.borderFocused : unknown ? colors.textMuted : colors.textDim, keepColorWhenSelected: row.classification === "disclosed" };
|
|
227
234
|
case "impact": return !row.impact ? missingCell(colors) : { text: exposureCellText(row, "impact"), value: row.impact.low,
|
|
228
235
|
color: row.concentration ? colors.text : row.impact.high < 0 ? colors.negative : row.impact.low > 0 ? colors.positive : colors.text };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { parseFxArgs, parseFxRequest } from "../../../cli/fx-pair";
|
|
2
2
|
import { currencyMinorDigits } from "../../../market-data/market/format";
|
|
3
3
|
import { parseTypedNumber } from "../../../utils/decimal-comma";
|
|
4
|
-
import { isFxCurrency, type FxCurrency } from "./pairs";
|
|
4
|
+
import { CURRENCY_SETS, isFxCurrency, type FxCurrency } from "./pairs";
|
|
5
5
|
|
|
6
6
|
/** An amount of one of the board's currencies, shown in every currency it lists. */
|
|
7
7
|
export interface FxBoardAmount {
|
|
@@ -63,6 +63,20 @@ export function parseFxBoardAmount(text: string): FxBoardAmountRequest | { error
|
|
|
63
63
|
return { amount, currency, to: target === currency ? null : target };
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
/**
|
|
67
|
+
* Currencies typed for the board with no amount, to add to it: `TRY`,
|
|
68
|
+
* `USD,TRY`, `usd try`, a set's name (`emea`), separated by commas or spaces,
|
|
69
|
+
* in order without repeats. Null for anything else: an amount, a pair written
|
|
70
|
+
* as one (`EUR/USD`, `eur to usd`, one unit of it), a word that is neither.
|
|
71
|
+
*/
|
|
72
|
+
export function parseFxBoardCurrencies(text: string): FxCurrency[] | null {
|
|
73
|
+
const tokens = text.trim().split(/[\s,;]+/).filter(Boolean);
|
|
74
|
+
if (tokens.length === 0 || /[\d/]/.test(text)) return null;
|
|
75
|
+
const codes = tokens.map((token) => CURRENCY_SETS.find((set) => set.id === token.toLowerCase())?.currencies
|
|
76
|
+
?? (isFxCurrency(token.toUpperCase()) ? [token.toUpperCase() as FxCurrency] : null));
|
|
77
|
+
return codes.every((code) => code !== null) ? [...new Set(codes.flat())] : null;
|
|
78
|
+
}
|
|
79
|
+
|
|
66
80
|
/** An amount as its currency writes it, grouped: 2,500,000 and 2,500,000.50 in EUR, 445,000,000 in JPY. */
|
|
67
81
|
export function formatAmountFigure(amount: number, currency: string): string {
|
|
68
82
|
const digits = currencyMinorDigits(currency);
|
|
@@ -7,7 +7,7 @@ import { servedFromSavedCopy } from "../../../data/saved-copies";
|
|
|
7
7
|
import { fxPairObservation, fxRateObservations } from "../shared/fx-rate-freshness";
|
|
8
8
|
import { loadFxBoard, type FxLegReading } from "./client";
|
|
9
9
|
import { crossMovePercent } from "./direction";
|
|
10
|
-
import { formatAmountFigure, formatFxBoardAmount, parseFxBoardAmount, withAmountCurrencies, type FxBoardAmount } from "./amount";
|
|
10
|
+
import { formatAmountFigure, formatFxBoardAmount, parseFxBoardAmount, parseFxBoardCurrencies, withAmountCurrencies, type FxBoardAmount } from "./amount";
|
|
11
11
|
import { FX_CURRENCY_KEYWORDS, formatRate, resolveCurrencies, type FxCurrency } from "./pairs";
|
|
12
12
|
import { FX_MATRIX_REPORT_OPTIONS, fxMatrixReportNotices } from "./settings";
|
|
13
13
|
|
|
@@ -42,16 +42,22 @@ function crossColumns(basis: string | null, amount: boolean): HeadlessPaneColumn
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
/** `fn FXC 2500000 EUR`: the amount typed after the function, as the pane's Amount field reads it; null for none. */
|
|
45
|
+
const typedArgument = (argument: string | string[] | null | undefined) => Array.isArray(argument) ? argument.join(" ") : argument ?? "";
|
|
46
|
+
|
|
45
47
|
function reportAmount(argument: string | string[] | null | undefined): FxBoardAmount & { to: FxCurrency | null } | null {
|
|
46
|
-
const typed =
|
|
48
|
+
const typed = typedArgument(argument);
|
|
49
|
+
// Currencies alone (`fn FXC TRY`) are added to the board, as `FXC TRY` adds them in the app: no amount.
|
|
50
|
+
if (parseFxBoardCurrencies(typed)) return null;
|
|
47
51
|
const request = parseFxBoardAmount(typed);
|
|
48
52
|
if (request && "error" in request) throw new Error(request.error);
|
|
49
53
|
return request;
|
|
50
54
|
}
|
|
51
55
|
|
|
52
|
-
/** The board a report reads: its currencies, with the ones its
|
|
56
|
+
/** The board a report reads: its currencies, with the ones its argument names added at the end as the pane adds them. */
|
|
53
57
|
function reportCurrencies(args: { argument?: string | string[] | null; options: Record<string, unknown> }): FxCurrency[] {
|
|
54
58
|
const currencies = resolveCurrencies(args.options.currencies);
|
|
59
|
+
const added = parseFxBoardCurrencies(typedArgument(args.argument));
|
|
60
|
+
if (added) return [...currencies, ...added.filter((code) => !currencies.includes(code))];
|
|
55
61
|
const amount = reportAmount(args.argument);
|
|
56
62
|
return amount ? withAmountCurrencies(currencies, amount) : currencies;
|
|
57
63
|
}
|
|
@@ -171,8 +177,8 @@ export function projectFxCrosses(
|
|
|
171
177
|
export const fxMatrixHeadless: HeadlessPaneDefinition<"rows"> = {
|
|
172
178
|
shape: "rows",
|
|
173
179
|
argument: {
|
|
174
|
-
kind: "free-text", optional: true, placeholder: "amount",
|
|
175
|
-
description: "An amount to convert into each currency, as the pane's Amount field takes it
|
|
180
|
+
kind: "free-text", optional: true, placeholder: "amount or currencies",
|
|
181
|
+
description: "An amount to convert into each currency, as the pane's Amount field takes it (2500000 EUR, 2,500,000 EUR/USD), or currencies to add to the board (TRY, USD,TRY).",
|
|
176
182
|
},
|
|
177
183
|
description: "Cross rates between currencies, one row per ordered pair, each with its move since the previous close, observation time and stale flag.",
|
|
178
184
|
freshness: { source: "Gloom Cloud" },
|
|
@@ -212,6 +218,6 @@ export const fxMatrixHeadless: HeadlessPaneDefinition<"rows"> = {
|
|
|
212
218
|
if (legs.length > 0 && legs.every((reading) => reading.entry == null)) {
|
|
213
219
|
throw new Error(`Exchange rates unavailable for ${legs.map(({ leg }) => leg.currency).join(", ")}: ${legs[0]!.error}`);
|
|
214
220
|
}
|
|
215
|
-
return projectFxCrosses(currencies, readings, { notices: fxMatrixReportNotices(args.options), amount });
|
|
221
|
+
return projectFxCrosses(currencies, readings, { notices: fxMatrixReportNotices(args.options, currencies), amount });
|
|
216
222
|
},
|
|
217
223
|
};
|
|
@@ -43,7 +43,8 @@ import { fxMatrixSettings } from "./settings";
|
|
|
43
43
|
import { createFxExportMetadata } from "./export";
|
|
44
44
|
import { fxMatrixHeadless } from "./headless";
|
|
45
45
|
import {
|
|
46
|
-
formatAmountFigure, formatFxBoardAmount, parseFxBoardAmount, parseFxBoardAmountEdit, readFxBoardAmount, storedFxBoardAmount,
|
|
46
|
+
formatAmountFigure, formatFxBoardAmount, parseFxBoardAmount, parseFxBoardAmountEdit, parseFxBoardCurrencies, readFxBoardAmount, storedFxBoardAmount,
|
|
47
|
+
withAmountCurrencies,
|
|
47
48
|
type FxBoardAmount,
|
|
48
49
|
} from "./amount";
|
|
49
50
|
|
|
@@ -454,9 +455,20 @@ function openFxBoard(context: PaneTemplateContext) {
|
|
|
454
455
|
* `FXC 2,500,000 EUR`, `fx 2500000 EUR/USD`, `convert 100 eur to usd`: the
|
|
455
456
|
* board open already takes the amount (one board, switched in place), with
|
|
456
457
|
* the currencies it names added when it does not list them; with none open a
|
|
457
|
-
* board opens on it.
|
|
458
|
+
* board opens on it. `FXC TRY` and `FXC USD,TRY` add those currencies to the
|
|
459
|
+
* board the same way, its amount kept. Without either the board opens as it is.
|
|
458
460
|
*/
|
|
459
461
|
function createFxBoardInstance(context: PaneTemplateContext, options?: PaneTemplateCreateOptions): PaneTemplateInstanceConfig {
|
|
462
|
+
const added = parseFxBoardCurrencies(options?.arg ?? "");
|
|
463
|
+
if (added) {
|
|
464
|
+
const open = openFxBoard(context);
|
|
465
|
+
const listed = resolveCurrencies(open?.settings?.currencies);
|
|
466
|
+
const amount = open?.settings?.amount;
|
|
467
|
+
return {
|
|
468
|
+
...(open ? { instanceId: open.instanceId } : {}),
|
|
469
|
+
settings: { ...(typeof amount === "string" && amount ? { amount } : {}), currencies: [...listed, ...added.filter((code) => !listed.includes(code))] },
|
|
470
|
+
};
|
|
471
|
+
}
|
|
460
472
|
const request = parseFxBoardAmount(options?.arg ?? "");
|
|
461
473
|
if (!request || "error" in request) return {};
|
|
462
474
|
const open = openFxBoard(context);
|
|
@@ -534,16 +546,22 @@ export const fxMatrixModule: PluginModule = {
|
|
|
534
546
|
label: "FX Cross Rates",
|
|
535
547
|
description: "Currency cross-rate matrix for major FX pairs, and an amount converted into each currency.",
|
|
536
548
|
keywords: ["fx", "forex", "currency", "exchange", "rates", "cross", "matrix", "convert", "converter", "conversion", "calculator"],
|
|
537
|
-
// `FXC 2,500,000 EUR` opens the board on the amount, as `fx 2500000 EUR/USD` converts it (fxConvertRows)
|
|
549
|
+
// `FXC 2,500,000 EUR` opens the board on the amount, as `fx 2500000 EUR/USD` converts it (fxConvertRows);
|
|
550
|
+
// `FXC TRY` and `FXC USD,TRY` add those currencies to it.
|
|
538
551
|
shortcut: {
|
|
539
552
|
prefix: "FXC",
|
|
540
553
|
argKind: "text",
|
|
541
|
-
argPlaceholder: "amount",
|
|
554
|
+
argPlaceholder: "amount or currencies",
|
|
542
555
|
argOptional: true,
|
|
543
556
|
openWithoutArg: true,
|
|
544
557
|
argError: (arg) => {
|
|
558
|
+
if (parseFxBoardCurrencies(arg)) return null;
|
|
545
559
|
const request = parseFxBoardAmount(arg);
|
|
546
|
-
|
|
560
|
+
if (!request || !("error" in request)) return null;
|
|
561
|
+
// Words with no figure were currencies to add: say which is not on the board.
|
|
562
|
+
return /\d/.test(arg)
|
|
563
|
+
? { message: `${arg.trim()} is no amount to convert`, detail: request.error.replace(/\.$/, "") }
|
|
564
|
+
: { message: `${arg.trim()} is no currency on the board`, detail: "Type codes such as USD,TRY, or an amount such as 2,500,000 EUR" };
|
|
547
565
|
},
|
|
548
566
|
},
|
|
549
567
|
createInstance: createFxBoardInstance,
|
|
@@ -117,8 +117,13 @@ export const FX_MATRIX_REPORT_OPTIONS: readonly PaneReportOptionDef[] = [{
|
|
|
117
117
|
normalize: parseCurrenciesOption,
|
|
118
118
|
}];
|
|
119
119
|
|
|
120
|
-
/**
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
120
|
+
/**
|
|
121
|
+
* A report of the default board says it is only the majors, and how to add
|
|
122
|
+
* others: by code after FXC, as the app's command bar takes them too, or a
|
|
123
|
+
* whole list with --currencies.
|
|
124
|
+
*/
|
|
125
|
+
export function fxMatrixReportNotices(settings: Readonly<Record<string, unknown>>, currencies: readonly string[] = MAJOR_CURRENCIES): string[] {
|
|
126
|
+
if (settings.currencies != null || currencies.length !== MAJOR_CURRENCIES.length || currencies.some((code, index) => code !== MAJOR_CURRENCIES[index])) return [];
|
|
127
|
+
return [`Showing the ${MAJOR_CURRENCIES.length} majors. Add others with fn FXC TRY (FXC TRY in the app), or choose them with --currencies USD,ZAR,NGN; `
|
|
128
|
+
+ `gloom catalog FXC lists all ${FX_CURRENCIES.length}.`];
|
|
124
129
|
}
|
|
@@ -239,13 +239,15 @@ export function KellySizerPane({ focused, width, height }: PaneProps) {
|
|
|
239
239
|
? portfolioFinancials.get(requestedSymbol!) ?? null
|
|
240
240
|
: financials;
|
|
241
241
|
const { accountState } = usePortfolioAccountState(activePortfolio, { brokerAccounts, config });
|
|
242
|
-
// Cash entered by hand counts toward a manual portfolio's bankroll; a broker's is in its Net Liq.
|
|
242
|
+
// Cash entered by hand, in every currency it is held in, counts toward a manual portfolio's bankroll; a broker's is in its Net Liq.
|
|
243
243
|
const manualCash = accountState ? null : resolvePortfolioCash(activePortfolio, null);
|
|
244
|
+
const manualCashKey = manualCash?.balances.map((balance) => balance.currency).join(",") ?? "";
|
|
245
|
+
const manualCashCurrencies = useMemo(() => (manualCashKey ? manualCashKey.split(",") : []), [manualCashKey]);
|
|
244
246
|
// The sized ticker's own currency too: its units are counted at the base currency's rate to it.
|
|
245
247
|
const sizedCurrency = financials?.quote?.currency || ticker?.metadata.currency || null;
|
|
246
248
|
const trackedCurrencies = useMemo(
|
|
247
|
-
() => [...buildTrackedCurrencies(portfolioTickers, portfolioFinancials, accountState, config.baseCurrency,
|
|
248
|
-
[accountState, config.baseCurrency,
|
|
249
|
+
() => [...buildTrackedCurrencies(portfolioTickers, portfolioFinancials, accountState, config.baseCurrency, manualCashCurrencies), sizedCurrency],
|
|
250
|
+
[accountState, config.baseCurrency, manualCashCurrencies, portfolioFinancials, portfolioTickers, sizedCurrency],
|
|
249
251
|
);
|
|
250
252
|
const exchangeRates = useFxRatesMap(trackedCurrencies);
|
|
251
253
|
const portfolioSummary = useMemo(
|
|
@@ -270,7 +272,10 @@ export function KellySizerPane({ focused, width, height }: PaneProps) {
|
|
|
270
272
|
netLiquidation,
|
|
271
273
|
brokerPortfolio: !!activePortfolio?.brokerInstanceId,
|
|
272
274
|
holdings: portfolioSummary.allocationHoldings ?? [],
|
|
273
|
-
|
|
275
|
+
// Each balance converted once; one without a rate leaves the sum, and so the bankroll, unknown.
|
|
276
|
+
cashValue: manualCash
|
|
277
|
+
? manualCash.balances.reduce((sum, balance) => sum + convertCurrency(balance.amount, balance.currency, config.baseCurrency, exchangeRates), 0)
|
|
278
|
+
: null,
|
|
274
279
|
});
|
|
275
280
|
const sourceCurrentValue = getPortfolioPositionValue({
|
|
276
281
|
ticker,
|