@gloom-sh/terminal 0.20.16 → 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 +16 -5
- 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/api-client/types/econ.ts +3 -0
- 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/fred-series.ts +3 -1
- package/src/cli/commands/market.ts +138 -22
- package/src/cli/commands/overview.ts +72 -14
- 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 +74 -0
- package/src/cli/desktop-pane-shot.ts +75 -11
- package/src/cli/glossary.ts +64 -10
- package/src/cli/help.ts +4 -2
- 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/headless.ts +7 -2
- package/src/cli/pane-functions/index.ts +102 -44
- 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-bridge.ts +4 -2
- 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/report-tables.ts +17 -3
- package/src/cli/result.ts +8 -10
- package/src/cli/series-search.ts +45 -6
- package/src/cli/shot-temp-dir.ts +4 -9
- package/src/components/chart/composite/legend.tsx +80 -25
- 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/display-columns.ts +4 -1
- package/src/components/ui/data-table/hooks.ts +2 -3
- package/src/components/ui/data-table/index.tsx +4 -1
- package/src/components/ui/data-table/types.ts +19 -4
- package/src/components/ui/data-table/visible-range.ts +11 -1
- 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 +7 -3
- 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 +9 -3
- 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/credit-conditions/series.ts +2 -2
- 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/board-model.ts +12 -0
- package/src/plugins/builtin/earnings/board-table.ts +7 -4
- package/src/plugins/builtin/earnings/board.tsx +2 -2
- package/src/plugins/builtin/earnings/fiscal-quarter.ts +39 -0
- package/src/plugins/builtin/earnings/headless.ts +7 -4
- package/src/plugins/builtin/earnings/highlight.ts +1 -1
- 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 +18 -0
- package/src/plugins/builtin/econ/fred-catalog.ts +1 -256
- package/src/plugins/builtin/econ/index.tsx +3 -0
- package/src/plugins/builtin/econ-statistics/cache.ts +1 -1
- package/src/plugins/builtin/econ-statistics/client.ts +11 -10
- package/src/plugins/builtin/econ-statistics/detail.tsx +1 -0
- package/src/plugins/builtin/econ-statistics/headless.ts +42 -6
- package/src/plugins/builtin/econ-statistics/index.tsx +1 -0
- package/src/plugins/builtin/econ-statistics/pane.tsx +7 -2
- package/src/plugins/builtin/econ-statistics/stats.ts +2 -1
- package/src/plugins/builtin/econ-statistics/view.ts +9 -3
- 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/fred-catalog.ts +256 -0
- package/src/plugins/builtin/shared/report-freshness.ts +2 -3
- package/src/plugins/builtin/shared/series-cache.ts +3 -0
- package/src/plugins/builtin/shared/series-detail-chart.tsx +3 -0
- package/src/plugins/builtin/short-interest/watch-pane.tsx +7 -7
- 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 +67 -1
- package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +31 -16
- 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/time-sales/headless.ts +4 -1
- package/src/plugins/builtin/time-sales/pane.tsx +2 -0
- package/src/plugins/builtin/time-sales/window.ts +12 -0
- package/src/plugins/builtin/treasury-auctions/client.ts +4 -0
- package/src/plugins/builtin/treasury-auctions/treasury-direct.ts +2 -0
- package/src/plugins/builtin/treasury-daily/client.ts +23 -11
- 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-entry.tsx +2 -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/fred-publisher.ts +25 -0
- package/src/sources/gloomberb-cloud/fred-series.ts +1 -1
- 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/base-series.ts +3 -0
- package/src/time-series/ice-credit.ts +1 -0
- package/src/time-series/resolve.ts +3 -1
- package/src/time-series/spec.ts +2 -2
- package/src/time-series/types.ts +2 -1
- package/src/types/data-provider.ts +11 -0
- package/src/types/financials.ts +39 -3
- package/src/types/headless.ts +4 -2
- 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/throttled-fetch.ts +15 -1
- package/src/utils/trailing-dividend.ts +1 -1
- package/src/plugins/builtin/composite-plugins.ts +0 -285
|
@@ -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,
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
2
|
import {
|
|
3
3
|
DELAYED_SEGMENT,
|
|
4
|
-
PaneStatusBody, type DataTableCell,
|
|
4
|
+
PaneStatusBody, RowNote, type DataTableCell,
|
|
5
5
|
type DataTableColumn,
|
|
6
6
|
type PaneFooterSegment
|
|
7
7
|
} from "../../../components";
|
|
8
8
|
import { useAsyncResource } from "../../../react/async-resource";
|
|
9
|
+
import { Box } from "../../../ui";
|
|
10
|
+
import { wrapTextLines } from "../../../utils/text-wrap";
|
|
9
11
|
import { usePaneSettingValue } from "../../../state/app/context";
|
|
10
12
|
import { colors } from "../../../theme/colors";
|
|
11
13
|
import type { PaneProps } from "../../../types/plugin";
|
|
@@ -102,6 +104,17 @@ function cellsFor(row: IndicatorRow): Record<ColumnId, DataTableCell> {
|
|
|
102
104
|
};
|
|
103
105
|
}
|
|
104
106
|
|
|
107
|
+
/** The selected indicator, its own limitation (a stale or missing latest reading) said above its chart. */
|
|
108
|
+
function SelectedIndicatorDetail({ view, note, width, height, focused }: {
|
|
109
|
+
view: IndicatorViewModel; note: string | null; width: number; height: number; focused?: boolean;
|
|
110
|
+
}) {
|
|
111
|
+
const noteRows = note ? wrapTextLines(note, Math.max(1, width - 2)).length : 0;
|
|
112
|
+
return <Box flexDirection="column" width={width} height={height}>
|
|
113
|
+
<RowNote>{note}</RowNote>
|
|
114
|
+
<IndicatorDetail view={view} width={width} height={Math.max(1, height - noteRows)} focused={focused} />
|
|
115
|
+
</Box>;
|
|
116
|
+
}
|
|
117
|
+
|
|
105
118
|
export function MarketValuationPane({ focused, width, height }: PaneProps) {
|
|
106
119
|
const [indicatorId, setIndicatorId] = usePaneSettingValue<string>(
|
|
107
120
|
"indicator",
|
|
@@ -137,15 +150,14 @@ export function MarketValuationPane({ focused, width, height }: PaneProps) {
|
|
|
137
150
|
const { selected } = list;
|
|
138
151
|
const selectedView = selected?.view;
|
|
139
152
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
const sourceError = bundle?.errors.find((entry) => !
|
|
145
|
-
const unavailableCount =
|
|
153
|
+
// The footer says what concerns the whole board: a failure no indicator owns, else how many cannot be read. An
|
|
154
|
+
// indicator's own reason is its row's ("Unavailable") and its detail's.
|
|
155
|
+
const ownedByRow = (entry: string) => rows.some(({ indicator }) => [indicator.label, ...indicatorSeries(indicator).map((def) => def.key)]
|
|
156
|
+
.some((prefix) => entry.startsWith(`${prefix}:`)));
|
|
157
|
+
const sourceError = bundle?.errors.find((entry) => !ownedByRow(entry));
|
|
158
|
+
const unavailableCount = rows.filter((row) => row.error && !row.view).length;
|
|
146
159
|
const bodyError = resource.error ?? sourceError ?? null;
|
|
147
|
-
const error = bodyError ??
|
|
148
|
-
?? (unavailableCount ? `${unavailableCount} unavailable` : null);
|
|
160
|
+
const error = bodyError ?? (unavailableCount ? `${unavailableCount} unavailable` : null);
|
|
149
161
|
const footerInfo = useMemo<PaneFooterSegment[]>(() => {
|
|
150
162
|
if (!selectedView) return [];
|
|
151
163
|
const info: PaneFooterSegment[] = [
|
|
@@ -196,7 +208,7 @@ export function MarketValuationPane({ focused, width, height }: PaneProps) {
|
|
|
196
208
|
getRowId={indicatorKey}
|
|
197
209
|
renderCell={renderIndicatorCell}
|
|
198
210
|
emptyStateTitle={list.normalizedQuery ? "No indicator matches." : error ?? "No indicators."}
|
|
199
|
-
renderDetail={(size) => selectedView ? <
|
|
211
|
+
renderDetail={(size) => selectedView ? <SelectedIndicatorDetail view={selectedView} note={selected.error} {...size} /> : (
|
|
200
212
|
<PaneStatusBody
|
|
201
213
|
error={selected.error ?? "No data."}
|
|
202
214
|
errorTitle={`${selected.indicator.label} unavailable`}
|
|
@@ -34,11 +34,18 @@ import {
|
|
|
34
34
|
formatPrice,
|
|
35
35
|
inQuoteCurrency,
|
|
36
36
|
isElection,
|
|
37
|
+
legsApart,
|
|
37
38
|
MISSING,
|
|
38
39
|
offerSeries,
|
|
40
|
+
outsideDateParts,
|
|
41
|
+
printWhen,
|
|
42
|
+
spreadBasisLabel,
|
|
39
43
|
stageLabel,
|
|
40
44
|
termsLabel,
|
|
45
|
+
type SpreadLeg,
|
|
41
46
|
} from "./model";
|
|
47
|
+
import { formatFeedTime } from "../../../utils/datetime-format";
|
|
48
|
+
import { quoteAgeText } from "../../../market-data/quotes/freshness";
|
|
42
49
|
|
|
43
50
|
/** "ACV Auctions Inc. ← Copart, Inc.": the target, then who is buying it. */
|
|
44
51
|
export function mnaDealTitle(deal: MnaDeal): string {
|
|
@@ -102,6 +109,29 @@ function useDealHistory(deal: MnaDeal | null, leg: "cash" | "stock" | null) {
|
|
|
102
109
|
return history?.key === key ? history : null;
|
|
103
110
|
}
|
|
104
111
|
|
|
112
|
+
/** A print's time on the reader's clock: `04:24` today, `Mon 19:47` this week. */
|
|
113
|
+
const printClock = (at: number) => formatFeedTime(at);
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* A leg's latest print as its figure says it: when it traded, after its
|
|
117
|
+
* session when that is not the regular one, and how old it is
|
|
118
|
+
* (`pre-market 04:24 · 2h 50m old`); in a narrow cell the session and time,
|
|
119
|
+
* which are never dropped.
|
|
120
|
+
*/
|
|
121
|
+
function legFigure(entry: SpreadLeg, now: number): StatItem {
|
|
122
|
+
if (entry.at == null) return { id: `leg:${entry.symbol}`, label: entry.symbol, value: formatPrice(entry.price) };
|
|
123
|
+
const when = printWhen(entry.at, entry.session, printClock);
|
|
124
|
+
return {
|
|
125
|
+
id: `leg:${entry.symbol}`,
|
|
126
|
+
label: entry.symbol,
|
|
127
|
+
value: formatPrice(entry.price),
|
|
128
|
+
detail: `${when} · ${quoteAgeText(entry.at, now)}`,
|
|
129
|
+
detailVariants: [when],
|
|
130
|
+
// A row of its own, so its age is never what a narrow cell drops.
|
|
131
|
+
wide: true,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
105
135
|
export function MnaDealDetail({ id, seed, focused, width, height }: {
|
|
106
136
|
id: string;
|
|
107
137
|
/** The list's copy, drawn while the full deal loads. */
|
|
@@ -153,13 +183,26 @@ export function MnaDealDetail({ id, seed, focused, width, height }: {
|
|
|
153
183
|
const stock = deal.terms.exchangeRatio != null;
|
|
154
184
|
const currency = targetQuote?.currency ?? null;
|
|
155
185
|
items.push({ id: "offer", label: "Offer", value: formatPerShare(spread.offer, currency, 2), detail: stock ? terms : undefined });
|
|
186
|
+
// The spread says what its prices are: a session's closes, or two trades and when (or how far apart).
|
|
187
|
+
const basis = spreadBasisLabel(spread.basis, printClock);
|
|
156
188
|
items.push({
|
|
157
189
|
id: "spread",
|
|
158
190
|
label: "Spread",
|
|
159
191
|
value: formatPercentShort(spread.spread),
|
|
160
|
-
detail: formatPerShare(Math.abs(spread.offer - spread.price), currency, 2)
|
|
161
|
-
|
|
192
|
+
detail: `${formatPerShare(Math.abs(spread.offer - spread.price), currency, 2)} · ${basis}`,
|
|
193
|
+
detailVariants: [basis],
|
|
194
|
+
tone: spread.spread < 0 || legsApart(spread.basis) ? "warning" : undefined,
|
|
162
195
|
});
|
|
196
|
+
// Beside a close, the spread at the trades since it (pre-market, after hours), with when or how far apart.
|
|
197
|
+
if (spread.latest) {
|
|
198
|
+
items.push({
|
|
199
|
+
id: "latest",
|
|
200
|
+
label: "Latest",
|
|
201
|
+
value: formatPercentShort(spread.latest.spread),
|
|
202
|
+
detail: spreadBasisLabel(spread.latest.basis, printClock),
|
|
203
|
+
tone: legsApart(spread.latest.basis) ? "warning" : undefined,
|
|
204
|
+
});
|
|
205
|
+
}
|
|
163
206
|
if (spread.annualized != null) items.push({ id: "ann", label: "Ann.", value: formatPercentShort(spread.annualized) });
|
|
164
207
|
if (unaffected && unaffected.close > 0 && (deal.terms.exchangeRatio == null || leg === "cash")) {
|
|
165
208
|
items.push({
|
|
@@ -182,8 +225,23 @@ export function MnaDealDetail({ id, seed, focused, width, height }: {
|
|
|
182
225
|
items.push({ id: "closed", label: deal.status === "completed" ? "Closed" : "Ended", value: deal.closed ? formatListDate(deal.closed) : MISSING });
|
|
183
226
|
} else {
|
|
184
227
|
items.push({ id: "close", label: "Close", value: formatExpectedClose(deal.expectedClose) });
|
|
228
|
+
// The agreement's deadline, with the later one it moves to and on what, and the filing it is read from.
|
|
229
|
+
if (deal.outsideDate) {
|
|
230
|
+
const outside = outsideDateParts(deal.outsideDate);
|
|
231
|
+
items.push({
|
|
232
|
+
id: "outside",
|
|
233
|
+
label: "Outside",
|
|
234
|
+
value: outside.date,
|
|
235
|
+
detail: [outside.extension, outside.source].filter(Boolean).join(" · "),
|
|
236
|
+
detailVariants: [outside.extension ?? outside.source, ""],
|
|
237
|
+
wide: true,
|
|
238
|
+
});
|
|
239
|
+
}
|
|
185
240
|
if (spread) items.push({ id: "stage", label: "Stage", value: stageLabel(deal) });
|
|
186
241
|
}
|
|
242
|
+
// Each leg's latest print: price, session and age.
|
|
243
|
+
const now = Date.now();
|
|
244
|
+
for (const entry of spread?.legs ?? []) items.push(legFigure(entry, now));
|
|
187
245
|
return items;
|
|
188
246
|
}, [deal, leg, spread, targetQuote?.currency, unaffected]);
|
|
189
247
|
|
|
@@ -193,20 +251,23 @@ export function MnaDealDetail({ id, seed, focused, width, height }: {
|
|
|
193
251
|
const offer = leg === "stock"
|
|
194
252
|
? offerSeries(deal, history.ratio, days, leg, (close) => inQuoteCurrency(close, ratioQuote?.currency ?? null, targetQuote?.currency))
|
|
195
253
|
: offerSeries(deal, history.ratio, days, leg);
|
|
254
|
+
// Daily closes, so the legend leads with the day its values are (`16 Nov`): the
|
|
255
|
+
// spread beside it says its own basis, and the two are read on the same day's terms.
|
|
256
|
+
const daily = (series: ReturnType<typeof staticSeries>) => ({ ...series, observationKind: "dataset" as const });
|
|
196
257
|
const priced = [
|
|
197
|
-
staticSeries(
|
|
258
|
+
daily(staticSeries(
|
|
198
259
|
history.target.map((point) => ({ date: point.date, observedAt: point.date, value: point.close })),
|
|
199
260
|
{ id: "target", label: deal.target.symbol, color: colors.text, calendarSpaced: true },
|
|
200
|
-
),
|
|
261
|
+
)),
|
|
201
262
|
];
|
|
202
263
|
if (offer.length >= 2) {
|
|
203
|
-
priced.push(staticSeries(
|
|
264
|
+
priced.push(daily(staticSeries(
|
|
204
265
|
offer.map((row) => {
|
|
205
266
|
const date = new Date(`${row.day}T00:00:00Z`);
|
|
206
267
|
return { date, observedAt: date, value: row.value };
|
|
207
268
|
}),
|
|
208
269
|
{ id: "offer", label: "Offer", color: colors.positive, calendarSpaced: true },
|
|
209
|
-
));
|
|
270
|
+
)));
|
|
210
271
|
}
|
|
211
272
|
return priced;
|
|
212
273
|
}, [colors.positive, colors.text, deal, history, leg, ratioQuote?.currency, targetQuote?.currency]);
|
|
@@ -1,24 +1,128 @@
|
|
|
1
|
-
import type { MnaDealsParams, MnaRegionFilter, MnaStatusFilter, MnaTargetFilter } from "../../../api-client/mna";
|
|
2
|
-
import type { HeadlessPaneColumn, HeadlessPaneDefinition } from "../../../types/plugin";
|
|
1
|
+
import type { MnaDeal, MnaDealsParams, MnaOutsideDate, MnaRegionFilter, MnaStatusFilter, MnaTargetFilter } from "../../../api-client/mna";
|
|
2
|
+
import type { HeadlessPaneColumn, HeadlessPaneContext, HeadlessPaneDefinition } from "../../../types/plugin";
|
|
3
|
+
import type { Quote } from "../../../types/financials";
|
|
3
4
|
import { fetchMnaDeals } from "./client";
|
|
4
5
|
import { companyDataNotes } from "../../../types/company-from";
|
|
5
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
apartText,
|
|
8
|
+
closeBasisLabel,
|
|
9
|
+
dealSpread,
|
|
10
|
+
dealsSymbol,
|
|
11
|
+
formatDealValue,
|
|
12
|
+
formatExpectedClose,
|
|
13
|
+
formatPercentShort,
|
|
14
|
+
legsApart,
|
|
15
|
+
outsideDateParts,
|
|
16
|
+
printWhen,
|
|
17
|
+
stageLabel,
|
|
18
|
+
termsLabel,
|
|
19
|
+
type DealSpread,
|
|
20
|
+
type SpreadBasis,
|
|
21
|
+
} from "./model";
|
|
6
22
|
import { REPORT_ROWS } from "../shared/headless-options";
|
|
23
|
+
import { formatUtcTime } from "../../../utils/utc-time";
|
|
24
|
+
import { MISSING_VALUE } from "../../../utils/format";
|
|
7
25
|
|
|
8
26
|
const text = (value: unknown) => (typeof value === "string" ? value : "");
|
|
9
27
|
|
|
28
|
+
const percent = (value: unknown) => (typeof value === "number" ? formatPercentShort(value) : MISSING_VALUE);
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* What a spread's prices are, as the report says it: a session's closes
|
|
32
|
+
* dated in full (`Mon 16 Nov close`), or the older trade's time in UTC after
|
|
33
|
+
* its session when that is not the regular one, or how far apart two trades
|
|
34
|
+
* are too far apart to be one moment's (`trades 8h apart`).
|
|
35
|
+
*/
|
|
36
|
+
function reportBasisText(basis: SpreadBasis): string {
|
|
37
|
+
if (basis.kind === "close") return closeBasisLabel(basis.session, Date.now(), { dated: true });
|
|
38
|
+
if (legsApart(basis)) return `trades ${apartText(basis.apartMs!)} apart`;
|
|
39
|
+
return basis.at == null ? MISSING_VALUE : printWhen(basis.at, basis.session, formatUtcTime);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const ANNOUNCED: HeadlessPaneColumn = { key: "announced", header: "Announced" };
|
|
43
|
+
const TARGET: HeadlessPaneColumn = { key: "target", header: "Target" };
|
|
44
|
+
const SYMBOL: HeadlessPaneColumn = { key: "targetSymbol", header: "Symbol" };
|
|
45
|
+
const ACQUIRER: HeadlessPaneColumn = { key: "acquirer", header: "Acquirer" };
|
|
46
|
+
const TERMS: HeadlessPaneColumn = { key: "terms", header: "Terms" };
|
|
47
|
+
const VALUE: HeadlessPaneColumn = { key: "value", header: "Value", align: "right" };
|
|
48
|
+
const STAGE: HeadlessPaneColumn = { key: "stage", header: "Stage" };
|
|
49
|
+
const CLOSE: HeadlessPaneColumn = { key: "expectedClose", header: "Close", format: (value) => formatExpectedClose(text(value) || null) };
|
|
50
|
+
const CLOSED: HeadlessPaneColumn = { key: "closed", header: "Closed" };
|
|
51
|
+
// A pending listed deal's spread, at the prices `spreadAsOf` names; the latest trades' beside a close.
|
|
52
|
+
const SPREAD: HeadlessPaneColumn = { key: "spread", header: "Spread", align: "right", format: percent, exportLast: true };
|
|
53
|
+
const SPREAD_AS_OF: HeadlessPaneColumn = { key: "spreadAsOf", header: "As of", exportLast: true };
|
|
54
|
+
const LATEST: HeadlessPaneColumn = {
|
|
55
|
+
key: "latestSpread", header: "Latest", align: "right", format: percent, exportLast: true,
|
|
56
|
+
textFormat: (value, row) => typeof value === "number" ? `${percent(value)} (${text(row.latestAsOf)})` : MISSING_VALUE,
|
|
57
|
+
};
|
|
58
|
+
const LATEST_AS_OF: HeadlessPaneColumn = { key: "latestAsOf", header: "Latest as of", exportLast: true };
|
|
59
|
+
// The agreement's deadline as a filing states it, with the later one it moves to.
|
|
60
|
+
const OUTSIDE: HeadlessPaneColumn = {
|
|
61
|
+
key: "outsideDate", header: "Outside", exportLast: true,
|
|
62
|
+
format: (value) => {
|
|
63
|
+
if (!value || typeof value !== "object") return MISSING_VALUE;
|
|
64
|
+
const outside = outsideDateParts(value as MnaOutsideDate);
|
|
65
|
+
return outside.extension ? `${outside.date}, ${outside.extension}` : outside.date;
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* CSV and NDJSON keep the columns an earlier export had where they were; the
|
|
71
|
+
* spread's and the outside date's come after them (`exportLast`).
|
|
72
|
+
*/
|
|
10
73
|
const COLUMNS: HeadlessPaneColumn[] = [
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
{ key: "stage", header: "Stage" },
|
|
18
|
-
{ key: "expectedClose", header: "Close", format: (value) => formatExpectedClose(text(value) || null) },
|
|
19
|
-
{ key: "closed", header: "Closed" },
|
|
74
|
+
ANNOUNCED, TARGET, SYMBOL, ACQUIRER, TERMS, VALUE, STAGE, CLOSE, CLOSED,
|
|
75
|
+
SPREAD, SPREAD_AS_OF, LATEST, LATEST_AS_OF, OUTSIDE,
|
|
76
|
+
];
|
|
77
|
+
/** The text report reads the spread beside the terms it prices, its latest trades' basis in its cell. */
|
|
78
|
+
const TEXT_COLUMNS: HeadlessPaneColumn[] = [
|
|
79
|
+
ANNOUNCED, TARGET, SYMBOL, ACQUIRER, TERMS, VALUE, SPREAD, SPREAD_AS_OF, LATEST, STAGE, CLOSE, OUTSIDE, CLOSED,
|
|
20
80
|
];
|
|
21
81
|
|
|
82
|
+
/** The quotes of the listings pending deals' spreads are priced at, by symbol; none when the batch fails or is not offered. */
|
|
83
|
+
async function legQuotes(deals: readonly MnaDeal[], ctx: HeadlessPaneContext): Promise<Map<string, Quote>> {
|
|
84
|
+
const symbols = new Set<string>();
|
|
85
|
+
for (const deal of deals) {
|
|
86
|
+
if (deal.status !== "pending" || !deal.target.symbol) continue;
|
|
87
|
+
symbols.add(deal.target.symbol);
|
|
88
|
+
if (deal.terms.exchangeRatio != null && deal.terms.ratioSymbol) symbols.add(deal.terms.ratioSymbol);
|
|
89
|
+
}
|
|
90
|
+
const provider = ctx.marketData;
|
|
91
|
+
if (!provider?.getQuotesBatch || symbols.size === 0) return new Map();
|
|
92
|
+
try {
|
|
93
|
+
const results = await provider.getQuotesBatch([...symbols].map((symbol) => ({ symbol, exchange: "" })), { forceRefresh: ctx.refresh, signal: ctx.signal });
|
|
94
|
+
return new Map(results.flatMap((result) => result.quote ? [[result.target.symbol, result.quote] as const] : []));
|
|
95
|
+
} catch {
|
|
96
|
+
// Intentional ignore: the deals still list without spreads when the quotes do not come.
|
|
97
|
+
return new Map();
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** A row's spread fields: the spread and its basis, the latest trades' beside a close, and each leg's print. */
|
|
102
|
+
function spreadFields(spread: DealSpread | null): Record<string, unknown> {
|
|
103
|
+
if (!spread) return { spread: null, spreadAsOf: null, latestSpread: null, latestAsOf: null, legs: [] };
|
|
104
|
+
return {
|
|
105
|
+
spread: spread.spread,
|
|
106
|
+
spreadAsOf: reportBasisText(spread.basis),
|
|
107
|
+
spreadBasis: spread.basis,
|
|
108
|
+
offerValue: spread.offer,
|
|
109
|
+
latestSpread: spread.latest?.spread ?? null,
|
|
110
|
+
latestAsOf: spread.latest ? reportBasisText(spread.latest.basis) : null,
|
|
111
|
+
legs: spread.legs.map((entry) => ({ symbol: entry.symbol, price: entry.price, at: entry.at == null ? null : new Date(entry.at).toISOString(), session: entry.session })),
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* What a company's empty deal list says: the pane's "No deals involving X.",
|
|
117
|
+
* with the status and search asked for. Newer deals a free account waits for
|
|
118
|
+
* are the report's Pro line.
|
|
119
|
+
*/
|
|
120
|
+
function emptyDealsText(symbol: string, params: MnaDealsParams): string {
|
|
121
|
+
const status = params.status && params.status !== "all" ? `${params.status} ` : "";
|
|
122
|
+
const query = params.query ? ` matching "${params.query}"` : "";
|
|
123
|
+
return `No ${status}deals involving ${symbol}${query}.`;
|
|
124
|
+
}
|
|
125
|
+
|
|
22
126
|
export const mnaHeadless: HeadlessPaneDefinition<"rows"> = {
|
|
23
127
|
shape: "rows",
|
|
24
128
|
freshness: { status: "not-a-feed", basis: "reported deals" },
|
|
@@ -32,7 +136,7 @@ export const mnaHeadless: HeadlessPaneDefinition<"rows"> = {
|
|
|
32
136
|
dataRequirements: ["Gloom Cloud M&A deals read from news stories, press releases and SEC filings"],
|
|
33
137
|
limitations: [
|
|
34
138
|
"Free accounts see deals 7 days after they were first reported.",
|
|
35
|
-
"
|
|
139
|
+
"A spread is at the legs' closes of one session while a venue is out of its regular session, at their last trades in it; As of says which, and Latest gives the trades since a close.",
|
|
36
140
|
"A private or non-US deal completes only when a story reports it.",
|
|
37
141
|
],
|
|
38
142
|
},
|
|
@@ -68,8 +172,17 @@ export const mnaHeadless: HeadlessPaneDefinition<"rows"> = {
|
|
|
68
172
|
limit: Number(args.options.limit ?? 50),
|
|
69
173
|
};
|
|
70
174
|
const payload = await fetchMnaDeals(params, ctx.apiClient);
|
|
175
|
+
const quotes = await legQuotes(payload.deals, ctx);
|
|
176
|
+
const spreadOf = (deal: MnaDeal) => quotes.size === 0 || !deal.target.symbol ? null
|
|
177
|
+
: dealSpread(deal, quotes.get(deal.target.symbol) ?? null, deal.terms.ratioSymbol ? quotes.get(deal.terms.ratioSymbol) ?? null : null);
|
|
178
|
+
// No deal involving a company is the list's answer for it, as the pane says, never a company MA does not cover.
|
|
179
|
+
const none = payload.deals.length === 0 && symbol
|
|
180
|
+
? { empty: emptyDealsText(filed || symbol, params), unavailableSymbols: [] }
|
|
181
|
+
: {};
|
|
71
182
|
return {
|
|
183
|
+
...none,
|
|
72
184
|
columns: COLUMNS,
|
|
185
|
+
textColumns: TEXT_COLUMNS,
|
|
73
186
|
rows: payload.deals.map((deal) => ({
|
|
74
187
|
id: deal.id,
|
|
75
188
|
announced: deal.announced,
|
|
@@ -89,8 +202,10 @@ export const mnaHeadless: HeadlessPaneDefinition<"rows"> = {
|
|
|
89
202
|
value: formatDealValue(deal.value, deal.valueCurrency),
|
|
90
203
|
valueUsd: deal.valueUsd,
|
|
91
204
|
expectedClose: deal.expectedClose,
|
|
205
|
+
outsideDate: deal.outsideDate ?? null,
|
|
92
206
|
closed: deal.closed,
|
|
93
207
|
headline: deal.headline,
|
|
208
|
+
...spreadFields(spreadOf(deal)),
|
|
94
209
|
})),
|
|
95
210
|
errors: payload.lockedDeals > 0 ? [`${payload.lockedDeals} deals from the last ${payload.delayDays} days need Gloom Pro`] : [],
|
|
96
211
|
...(payload.companyFrom ? { notes: companyDataNotes(payload.companyFrom) } : {}),
|