@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
|
@@ -10,7 +10,8 @@ import { heldCurrencyUnit } from "../../../../utils/currency-units";
|
|
|
10
10
|
import type { TickerResearchTabProps } from "../../../../types/plugin";
|
|
11
11
|
import { Box } from "../../../../ui";
|
|
12
12
|
import { useOpenDescription } from "../../shared/open-description";
|
|
13
|
-
import { adrPairComparison, adrPairFigures, adrPairInputRows, adrPairLegs, type AdrPairInputRow } from "./model";
|
|
13
|
+
import { adrPairComparison, adrPairFigures, adrPairInputRows, adrPairLegs, adrPairQuotes, ahPairFigures, ahPairInputRows, type AdrPairInputRow } from "./model";
|
|
14
|
+
import { useAhPair } from "./ah";
|
|
14
15
|
|
|
15
16
|
// The price and its time first: a narrow pane keeps them and drops the role.
|
|
16
17
|
const COLUMNS: DataTableColumn[] = [
|
|
@@ -29,43 +30,57 @@ function renderCell(row: AdrPairInputRow, column: DataTableColumn): DataTableCel
|
|
|
29
30
|
* DES "ADR vs home": a receipt beside its home line, for a listing Gloom
|
|
30
31
|
* Cloud pairs with one. The ratio, both prices, the dollar rate they imply
|
|
31
32
|
* (home × ratio / ADR), spot, and the receipt's premium or discount at spot,
|
|
32
|
-
* each price dated, and a note when the two were not set together.
|
|
33
|
+
* each price dated, and a note when the two were not set together. A line of
|
|
34
|
+
* an A+H company adds its other line: the H price over the A price at spot,
|
|
35
|
+
* the A price in Hong Kong dollars and the yuan's rate, each price in its own
|
|
36
|
+
* currency and dated (`useAhPair`).
|
|
33
37
|
*/
|
|
34
38
|
export function AdrPairResearchTab({ width, height, focused }: TickerResearchTabProps) {
|
|
35
39
|
const { symbol, ticker, financials } = usePaneTicker();
|
|
36
40
|
const legs = adrPairLegs(financials, ticker, symbol);
|
|
37
41
|
// Both legs through the quote path, so each is read alike whichever side the pane is on.
|
|
38
|
-
const ownEntry = useQuoteEntry(
|
|
42
|
+
const ownEntry = useQuoteEntry(ticker?.metadata.ticker ?? symbol, ticker);
|
|
39
43
|
const otherEntry = useQuoteEntry(legs?.otherKey ?? null, null);
|
|
44
|
+
const quotes = legs
|
|
45
|
+
? adrPairQuotes(legs, { own: resolveEntryData(ownEntry), other: resolveEntryData(otherEntry) }, financials?.quote)
|
|
46
|
+
: { receipt: null, home: null };
|
|
47
|
+
const receiptQuote = quotes.receipt;
|
|
48
|
+
const homeQuote = quotes.home;
|
|
40
49
|
const [receiptEntry, homeEntry] = legs?.receiptSide ? [ownEntry, otherEntry] : [otherEntry, ownEntry];
|
|
41
|
-
const receiptQuote = resolveEntryData(receiptEntry);
|
|
42
|
-
const homeQuote = resolveEntryData(homeEntry);
|
|
43
50
|
// The home price's currency, a minor unit read as its own (GBp as GBP), as the comparison reads it.
|
|
44
51
|
const homeCurrency = homeQuote?.currency ? heldCurrencyUnit(homeQuote.currency).currency : "";
|
|
45
52
|
const observed = useFxRateObservations([homeCurrency]).get(homeCurrency);
|
|
46
53
|
const spot = spotFromUsdValue(observed?.rate, observed?.asOf);
|
|
47
54
|
const comparison = legs ? adrPairComparison(legs, { receipt: receiptQuote, home: homeQuote }, spot) : null;
|
|
55
|
+
const ah = useAhPair(ticker?.metadata.ticker ?? symbol, ticker?.metadata.exchange || financials?.quote?.listingExchangeName,
|
|
56
|
+
resolveEntryData(ownEntry) ?? financials?.quote);
|
|
57
|
+
const ahComparison = ah?.comparison ?? null;
|
|
48
58
|
const openDescription = useOpenDescription();
|
|
49
59
|
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
50
60
|
|
|
51
|
-
const
|
|
52
|
-
const
|
|
61
|
+
const adrRows = comparison ? adrPairInputRows(comparison, { receipt: receiptQuote, home: homeQuote }) : [];
|
|
62
|
+
const stats: StatItem[] = [...comparison ? adrPairFigures(comparison) : [], ...ahComparison && ah ? ahPairFigures(ahComparison, ah.quotes.h) : []];
|
|
63
|
+
const rows = [...adrRows, ...ahComparison && ah ? ahPairInputRows(ahComparison, ah.quotes, adrRows.map((row) => row.listing)) : []];
|
|
53
64
|
|
|
54
|
-
if (!legs) return <EmptyState title="No ADR pair for this listing." />;
|
|
65
|
+
if (!legs && !ah) return <EmptyState title="No ADR pair for this listing." />;
|
|
55
66
|
const pending = (entry: typeof receiptEntry) => !entry || entry.phase === "loading" || entry.phase === "idle";
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
?
|
|
67
|
+
// A leg with a quote is not waiting on its read.
|
|
68
|
+
const loading = legs
|
|
69
|
+
? !comparison && ((!receiptQuote && pending(receiptEntry)) || (!homeQuote && pending(homeEntry)))
|
|
70
|
+
: !ahComparison && !!ah?.loading;
|
|
71
|
+
const error = rows.length === 0 && !loading
|
|
72
|
+
? `Prices unavailable for ${legs ? !receiptQuote ? legs.receiptKey : legs.homeKey : ah!.side === "h" ? ah!.pair.a : ah!.pair.h}.`
|
|
59
73
|
: null;
|
|
60
|
-
|
|
61
|
-
|
|
74
|
+
const notes = [comparison?.timingNote, ahComparison?.timingNote].filter((note): note is string => !!note);
|
|
75
|
+
// Each note wraps to the pane's width, less its inset.
|
|
76
|
+
const noteRows = notes.reduce((total, note) => total + Math.ceil(note.length / Math.max(1, width - 2)), 0);
|
|
62
77
|
const tableHeight = Math.max(3, height - statGridRows(stats, width) - noteRows);
|
|
63
78
|
|
|
64
79
|
return <Box width={width} height={height} flexDirection="column" overflow="hidden">
|
|
65
|
-
<PaneStatusBody subject="ADR pair" loading={loading} error={error} width={width} height={height}>
|
|
66
|
-
{
|
|
80
|
+
<PaneStatusBody subject={legs ? "ADR pair" : "A+H pair"} loading={loading} error={error} width={width} height={height}>
|
|
81
|
+
{rows.length > 0 ? <>
|
|
67
82
|
<StatGrid items={stats} width={width} />
|
|
68
|
-
{
|
|
83
|
+
{notes.map((note) => <Box key={note} paddingX={1} flexShrink={0}><Notice>{note}</Notice></Box>)}
|
|
69
84
|
<DataTableView<AdrPairInputRow>
|
|
70
85
|
focused={focused}
|
|
71
86
|
columns={COLUMNS}
|
|
@@ -6,7 +6,7 @@ import { NOT_MEANINGFUL_TEXT } from "../../../../utils/growth";
|
|
|
6
6
|
import type { ServedRate } from "../../../../utils/served-rates";
|
|
7
7
|
import type { CedearRatio, CompanyProfile, DepositaryPair, NextEarnings, Quote, TickerFinancials } from "../../../../types/financials";
|
|
8
8
|
import { adrRatioText } from "../../../../utils/depositary-receipt";
|
|
9
|
-
import { cedearRatioText, ratioCount } from "../../../../market-data/depositary-pair";
|
|
9
|
+
import { cedearRatioText, premiumText, ratioCount } from "../../../../market-data/depositary-pair";
|
|
10
10
|
import { ADR_PAIR_TAB_ID, ADR_PAIR_TEMPLATE_ID } from "../adr-pair/model";
|
|
11
11
|
import type { Portfolio, TickerPosition, TickerRecord } from "../../../../types/ticker";
|
|
12
12
|
import type { BrokerInstanceConfig } from "../../../../types/config";
|
|
@@ -158,6 +158,7 @@ export function buildOverviewStats({
|
|
|
158
158
|
nextEarnings,
|
|
159
159
|
depositaryReceipt = false,
|
|
160
160
|
depositaryPair = null,
|
|
161
|
+
ahPair = null,
|
|
161
162
|
cedearRatio = null,
|
|
162
163
|
today,
|
|
163
164
|
dividend,
|
|
@@ -179,6 +180,11 @@ export function buildOverviewStats({
|
|
|
179
180
|
depositaryReceipt?: boolean;
|
|
180
181
|
/** The receipt pair the listing is a side of, as Gloom Cloud serves it; `receiptSide` when the listing is the receipt. */
|
|
181
182
|
depositaryPair?: { pair: DepositaryPair; receiptSide: boolean } | null;
|
|
183
|
+
/**
|
|
184
|
+
* An A+H company's other line (`useAhPair`): the A share on the H line's DES, the H share on the A line's, with
|
|
185
|
+
* the H price over the A price at spot. `linked` when this DES has the ADR vs Home tab that shows them.
|
|
186
|
+
*/
|
|
187
|
+
ahPair?: { other: string; side: "h" | "a"; premiumPercent: number | null; linked: boolean } | null;
|
|
182
188
|
/** A Buenos Aires CEDEAR's ratio in its company's shares, as Gloom Cloud serves it. */
|
|
183
189
|
cedearRatio?: CedearRatio | null;
|
|
184
190
|
/** The listing's calendar day, YYYY-MM-DD; dates before it are left out. */
|
|
@@ -255,6 +261,16 @@ export function buildOverviewStats({
|
|
|
255
261
|
? { label: "ADR Ratio", value: `1:${count}`, detail: [adrRatioText(pair.ratio, pair.ordinary[0])!, `${count} sh per ADR`], link: ADR_PAIR }
|
|
256
262
|
: { label: "ADR", value: pair.receipt, detail: [`1 ADR = ${count} of these shares`, `1:${count}`], link: ADR_PAIR });
|
|
257
263
|
}
|
|
264
|
+
// An A+H company's other line, and the H price over the A price at spot, as ADR vs Home shows them.
|
|
265
|
+
if (ahPair) {
|
|
266
|
+
const premium = ahPair.premiumPercent == null ? null : premiumText(ahPair.premiumPercent);
|
|
267
|
+
stats.push({
|
|
268
|
+
label: ahPair.side === "h" ? "A Share" : "H Share",
|
|
269
|
+
value: ahPair.other,
|
|
270
|
+
...(premium ? { detail: [`H ${premium} at spot`, `H ${premium.replace(/ (?:premium|discount|at par)$/, "")}`] } : {}),
|
|
271
|
+
...(ahPair.linked ? { link: ADR_PAIR } : {}),
|
|
272
|
+
});
|
|
273
|
+
}
|
|
258
274
|
if (cedearRatio) {
|
|
259
275
|
const receipts = ratioCount(cedearRatio.receipts);
|
|
260
276
|
const shares = ratioCount(cedearRatio.shares);
|
|
@@ -18,6 +18,7 @@ import { OverviewTab } from "../overview-tab";
|
|
|
18
18
|
import { useOpenResearchTab } from "../research-tab-navigation";
|
|
19
19
|
import type { OverviewFunctionLink } from "./types";
|
|
20
20
|
import { useOverviewDividend } from "./dividend";
|
|
21
|
+
import { useAhPair } from "../adr-pair/ah";
|
|
21
22
|
import { useTickerSnapshotState } from "../../../../market-data/hooks";
|
|
22
23
|
import { taxRatesFromSettings } from "../../../../market-data/tax-equivalent";
|
|
23
24
|
import { PaneLinkMenu } from "../../../../components";
|
|
@@ -38,6 +39,8 @@ export function OverviewResearchTab({ width, height, focused }: TickerResearchTa
|
|
|
38
39
|
const openResearchTab = useOpenResearchTab();
|
|
39
40
|
const { createPaneFromTemplate } = usePluginAppActions();
|
|
40
41
|
const dividend = useOverviewDividend(ticker?.metadata.ticker ?? null, ticker?.metadata.exchange ?? "", financials?.fundamentals);
|
|
42
|
+
// An A+H company's other line and the premium between them, beside the ADR row.
|
|
43
|
+
const ah = useAhPair(ticker?.metadata.ticker ?? null, ticker?.metadata.exchange || financials?.quote?.listingExchangeName, financials?.quote);
|
|
41
44
|
// A pane locked to one tab has nowhere to go.
|
|
42
45
|
const lockedToOneTab = getTickerResearchPaneSettings(paneInstance?.settings).hideTabs;
|
|
43
46
|
// The chart's scale, once set from the pane menu, holds for every ticker the pane shows.
|
|
@@ -63,6 +66,7 @@ export function OverviewResearchTab({ width, height, focused }: TickerResearchTa
|
|
|
63
66
|
onOpenChart={paneId && !lockedToOneTab ? openChart : undefined}
|
|
64
67
|
onOpenFunction={openFunction}
|
|
65
68
|
dividend={dividend}
|
|
69
|
+
ah={ah}
|
|
66
70
|
snapshot={snapshot}
|
|
67
71
|
tax={taxRatesFromSettings(paneInstance?.settings)}
|
|
68
72
|
chartScale={parseOverviewChartScaleChoice(chartScale)}
|
|
@@ -12,7 +12,7 @@ import { CompanyLogo, resolveCompanyLogoSrc } from "../../../components/company-
|
|
|
12
12
|
import { bodyLineInk, FigureText, figureLineInk, useFigureCells } from "../../../components/ui/figure";
|
|
13
13
|
import { PriceReturnStrip } from "../../../components/price-performance";
|
|
14
14
|
import { t } from "../../../i18n";
|
|
15
|
-
import { useFxRateObservations, type TickerSnapshotState } from "../../../market-data/hooks";
|
|
15
|
+
import { useFxRateObservations, useTickerChangeNote, type TickerSnapshotState } from "../../../market-data/hooks";
|
|
16
16
|
import { formatMarketPriceWithCurrency, formatSignedMarketPrice, liveQuoteFormatOptions } from "../../../market-data/market/format";
|
|
17
17
|
import { priceSeriesUnit } from "../../../market-data/market/index-level";
|
|
18
18
|
import {
|
|
@@ -78,6 +78,7 @@ import { currentListingName } from "../../../tickers/listing-name";
|
|
|
78
78
|
import { isYieldIndexSymbol } from "../../../tickers/index-roots";
|
|
79
79
|
import { coinPriceVenueText, quoteStatsBasisText } from "../../../market-data/quotes/export-identity";
|
|
80
80
|
import { hiddenOnLogScale, logScaleHiddenWarning } from "../../../time-series/log-scale";
|
|
81
|
+
import type { AhPairState } from "./adr-pair/ah";
|
|
81
82
|
import {
|
|
82
83
|
autoOverviewChartScale, resolveOverviewChartScale, toggledOverviewChartScale, type OverviewChartScaleChoice,
|
|
83
84
|
} from "./overview/chart-scale";
|
|
@@ -119,6 +120,8 @@ interface OverviewTabProps {
|
|
|
119
120
|
onOpenFunction?: (link: OverviewFunctionLink) => void;
|
|
120
121
|
/** The history the dividend yield reads (useOverviewDividend): a trailing one's cash, a forward one's lapse; without it the yield stands. */
|
|
121
122
|
dividend?: OverviewDividendState;
|
|
123
|
+
/** An A+H company's other line and how the two prices compare (useAhPair); none for any other listing. */
|
|
124
|
+
ah?: AhPairState | null;
|
|
122
125
|
/** Where the ticker's snapshot load stands (useTickerSnapshotState), for the state shown before anything of it is in. */
|
|
123
126
|
snapshot?: TickerSnapshotState;
|
|
124
127
|
/** The rates `fn DES --tax-rate` set (taxRatesFromSettings): a fund's tax-equivalent yield and muni/Treasury ratio follow its facts. */
|
|
@@ -159,7 +162,7 @@ export function OverviewTab(props: OverviewTabProps) {
|
|
|
159
162
|
const FUND_FACTS_LINK: OverviewFunctionLink = { name: "Fund Facts", templateId: "sec-etf-pane" };
|
|
160
163
|
|
|
161
164
|
function ResolvedOverviewTab({
|
|
162
|
-
width, height, focused = false, ticker, financials, onOpenChart, onOpenFunction, perpetuals, news, dividend, tax = null,
|
|
165
|
+
width, height, focused = false, ticker, financials, onOpenChart, onOpenFunction, perpetuals, news, dividend, ah = null, tax = null,
|
|
163
166
|
chartScale: chartScaleChoice = "auto", onChartScaleChange,
|
|
164
167
|
}: OverviewTabProps & { ticker: TickerRecord }) {
|
|
165
168
|
const trade = useResearchTrading();
|
|
@@ -288,9 +291,12 @@ function ResolvedOverviewTab({
|
|
|
288
291
|
// A converted TTM block names what it was converted from, at the pane's rate and its time.
|
|
289
292
|
const ttmNote = [shownFundamentals?.revenue, shownFundamentals?.netIncome, shownFundamentals?.freeCashFlow].some((value) => value != null)
|
|
290
293
|
? ttmConversionNote(shownFundamentals) : undefined;
|
|
294
|
+
// FB lists a fund now, and Meta trades as META: said for someone who typed FB meaning the company, as `quote FB` says it.
|
|
295
|
+
const changeNote = useTickerChangeNote(ticker.metadata.ticker, ticker, quote);
|
|
291
296
|
usePaneNoticeFooter({
|
|
292
297
|
registrationId: "overview-notices",
|
|
293
298
|
notices: [
|
|
299
|
+
...(changeNote ? [changeNote] : []),
|
|
294
300
|
...(!quote && financials ? [t("Current quote unavailable. Other research data is still available.")] : []),
|
|
295
301
|
...(runwayOfferingNote ? [runwayOfferingNote] : []),
|
|
296
302
|
...(runway?.trailingGap === "short-history" ? [`Runway TTM: ${SHORT_RUNWAY_HISTORY}.`] : []),
|
|
@@ -432,6 +438,7 @@ function ResolvedOverviewTab({
|
|
|
432
438
|
const contractGridColumns = futuresFields.length > 0 ? contractColumns : textGridColumns(optionFields, contentWidth);
|
|
433
439
|
const depositaryPair = listingDepositaryPair(financials);
|
|
434
440
|
const stats = buildOverviewStats({
|
|
441
|
+
ahPair: ah ? { other: ah.side === "h" ? ah.pair.a : ah.pair.h, side: ah.side, premiumPercent: ah.comparison?.premiumPercent ?? null, linked: !!depositaryPair } : null,
|
|
435
442
|
quote,
|
|
436
443
|
fundamentals: shownFundamentals,
|
|
437
444
|
financialCurrency: financials?.financialCurrency,
|
|
@@ -66,6 +66,9 @@ function extendedLineParts(
|
|
|
66
66
|
|
|
67
67
|
const DESKTOP_DETAIL_TEXT_STYLE = { fontSize: "var(--gloom-type-ui)", lineHeight: "14px", whiteSpace: "nowrap" };
|
|
68
68
|
|
|
69
|
+
/** A desktop card row: its line's height at least, more only as its line needs. */
|
|
70
|
+
const CARD_LINE_ROW = "minmax(min-content, auto)";
|
|
71
|
+
|
|
69
72
|
/** The desktop card's muted lines: the name under its symbol, and what the price is as of. */
|
|
70
73
|
/** A line set over the sparkline, backed in the card's colour (the theme's, as drawn) so the line does not run through it. */
|
|
71
74
|
function backedLineStyle() {
|
|
@@ -304,8 +307,12 @@ export function QuoteMonitorCard({
|
|
|
304
307
|
display: "grid",
|
|
305
308
|
// The symbol and the price keep their natural widths; the name gives way first.
|
|
306
309
|
gridTemplateColumns: "minmax(min-content, 1fr) auto",
|
|
307
|
-
// The symbol and price, what the price is as of, an extended print, the range, a perpetual.
|
|
308
|
-
|
|
310
|
+
// The symbol and price, what the price is as of, an extended print, the range, a perpetual. Each row
|
|
311
|
+
// keeps its line's height however short the card: a line cut for width (overflow hidden) counts for
|
|
312
|
+
// no height in an `auto` row, and on a narrow board the as-of, after-hours and range lines drew over
|
|
313
|
+
// one another ("After-Hours $155.90 -0." under the range, the as-of half hidden). The board gives the
|
|
314
|
+
// card that height (QuoteMonitorPane).
|
|
315
|
+
gridTemplateRows: `${CARD_LINE_ROW} ${CARD_LINE_ROW} minmax(min-content, 1fr) ${CARD_LINE_ROW} ${CARD_LINE_ROW}`,
|
|
309
316
|
columnGap: "var(--gloom-space-md)",
|
|
310
317
|
width: "100%",
|
|
311
318
|
height: "100%",
|
|
@@ -285,11 +285,14 @@ export function QuoteMonitorPane({ paneId, focused, width, height }: PaneProps)
|
|
|
285
285
|
<Box
|
|
286
286
|
flexGrow={1}
|
|
287
287
|
backgroundColor={colors.bg}
|
|
288
|
-
overflow="hidden"
|
|
289
288
|
style={{
|
|
290
289
|
display: "grid",
|
|
291
290
|
gridTemplateColumns: `repeat(${desktopColumns}, minmax(0, 1fr))`,
|
|
292
|
-
|
|
291
|
+
// The rows share the board, each at least as tall as its cards' lines: a board too short for every card
|
|
292
|
+
// scrolls rather than draw a card's lines over one another.
|
|
293
|
+
gridAutoRows: "minmax(min-content, 1fr)",
|
|
294
|
+
overflowX: "hidden",
|
|
295
|
+
overflowY: "auto",
|
|
293
296
|
alignItems: "stretch",
|
|
294
297
|
alignContent: "stretch",
|
|
295
298
|
width: "100%",
|
|
@@ -5,7 +5,7 @@ import type { TapeRange, TapeSnapshot } from "../../../api-client/tape";
|
|
|
5
5
|
import { fetchTape } from "./client";
|
|
6
6
|
import { newestFirst, quoteSpread, tapePrice, tapePriceDigits, tapeStatistics, tapeTimeKey } from "./model";
|
|
7
7
|
import { REPORT_ROWS } from "../shared/headless-options";
|
|
8
|
-
import { inTapeRange, normalizeTapeClock, parseTapeClock, servedWindow, sessionDay, tapeMoment, tapeWindowRange } from "./window";
|
|
8
|
+
import { inTapeRange, lastSessionNote, normalizeTapeClock, parseTapeClock, servedWindow, sessionDay, tapeMoment, tapeWindowRange } from "./window";
|
|
9
9
|
|
|
10
10
|
type Format = NonNullable<HeadlessPaneColumn["format"]>;
|
|
11
11
|
const fixedPrice = (digits: number): Format => (value) => tapePrice(typeof value === "number" ? value : null, digits);
|
|
@@ -109,6 +109,9 @@ export const timeSalesHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
109
109
|
const price = fixedPrice(tapePriceDigits(data.trades.map((row) => row.price)));
|
|
110
110
|
const trades = ordered(data.trades).slice(0, limit).map((row) => ({ ...row, conditions: row.conditions.join(" ") }));
|
|
111
111
|
const notes = windowed ? [...windowed.notes, ...listedNote(windowed.range, data.trades.length, trades.length)] : [];
|
|
112
|
+
const lastSession = lastSessionNote(data);
|
|
113
|
+
if (!windowed && lastSession) notes.unshift(lastSession);
|
|
114
|
+
if (!windowed && trades.length < data.trades.length) notes.push(`Listing the first ${trades.length} of ${data.trades.length} observed trades, newest first; --limit takes up to 1000.`);
|
|
112
115
|
// SIP prints, real-time or fifteen minutes delayed by entitlement, dated by the newest print.
|
|
113
116
|
const freshness = data.feed === "sip"
|
|
114
117
|
? { status: "live" as const, cadence: "daily" as const }
|
|
@@ -15,6 +15,7 @@ import { isCloudSessionRequired, useResearchCloudSession } from "../shared/resea
|
|
|
15
15
|
import { newestFirst, quoteKey, quoteSpread, stickyTapePriceDigits, tapeClockNewYork, tapeConditionWords, tapePrice, tapeQuantity, tapeStampNewYork, tapeStatistics, tapeTicks, tapeTime, tapeAfter, tapeMomentKey, tapeRowAtOrBefore, tapeVenue, tradeKey, type TapeDigits } from "./model";
|
|
16
16
|
import { usePinnedMoment } from "../../../components/use-pinned-moment";
|
|
17
17
|
import { useTape } from "./use-tape";
|
|
18
|
+
import { lastSessionNote } from "./window";
|
|
18
19
|
|
|
19
20
|
const TABS = [{ value: "trades", label: "Trades" }, { value: "quotes", label: "NBBO" }];
|
|
20
21
|
const TRADES: DataTableColumn[] = [
|
|
@@ -121,6 +122,7 @@ function TimeSalesView({ width, height, focused, symbol, exchange }: PaneProps &
|
|
|
121
122
|
...(pinnedBeforeTape ? [`The pinned moment is before this tape's first ${tab === "quotes" ? "quote" : "print"}, ${tapeStampNewYork(rowTime(rows.at(-1)!))}.`] : [])] });
|
|
122
123
|
usePaneStatusFooter({ registrationId: "time-sales:status", loading: resource.loading, error: resource.error,
|
|
123
124
|
info: data ? [...splitDelayedStatus({ id: "feed", quoteStatus: true, parts: [{ text: `${data.feed === "sip" ? "real-time" : "15m delayed"} · ${tapeStampNewYork(data.asOf)}`, tone: "muted" }] }),
|
|
125
|
+
...(lastSessionNote(data) ? [{ id: "last-session", parts: [{ text: lastSessionNote(data)!, tone: "muted" as const }] }] : []),
|
|
124
126
|
...(frozen ? [{ id: "paused", parts: [{ text: "paused", tone: "warning" as const }] }] : []),
|
|
125
127
|
...(!data.connected || resource.snapshotOnly ? [{ id: "snapshot", parts: [{ text: "snapshot", tone: "warning" as const }] }] : [])] : [] });
|
|
126
128
|
const quoteColumns = useMemo(() => dropColumnsToFit(QUOTES, width - 1, QUOTE_DROP_ORDER), [width]);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { TapeRange, TapeSnapshot } from "../../../api-client/tape";
|
|
2
|
+
import { isVenueTradingDay } from "../../../market-data/market/freshness";
|
|
2
3
|
import { formatUtcDayTime } from "../../../utils/utc-time";
|
|
3
4
|
import { tapeTimeKey } from "./model";
|
|
4
5
|
|
|
@@ -96,6 +97,17 @@ export function servedWindow(snapshot: Pick<TapeSnapshot, "session" | "generated
|
|
|
96
97
|
return { date, from, to: Math.min(close, cutoff), cutoff: cutoff < close, delayMinutes: Math.round(snapshot.delaySeconds / 60) };
|
|
97
98
|
}
|
|
98
99
|
|
|
100
|
+
export function lastSessionNote(snapshot: Pick<TapeSnapshot, "session" | "generatedAt" | "delaySeconds" | "asOf">): string | null {
|
|
101
|
+
const served = servedWindow(snapshot);
|
|
102
|
+
if (!served) return null;
|
|
103
|
+
const now = newYorkParts(Date.parse(snapshot.generatedAt));
|
|
104
|
+
const observedDay = snapshot.asOf ? newYorkParts(Date.parse(snapshot.asOf)).date : served.date;
|
|
105
|
+
if (observedDay > served.date) return null;
|
|
106
|
+
if (now.date <= served.date && served.cutoff) return null;
|
|
107
|
+
const closed = !isVenueTradingDay("NYSE", now.date) || now.seconds < SIP_OPEN || now.seconds >= SIP_CLOSE;
|
|
108
|
+
return `${closed ? "Market closed; last session" : "Last available session"} ${sessionDay(served.date)}.`;
|
|
109
|
+
}
|
|
110
|
+
|
|
99
111
|
/** What TAS serves, for a window it cannot read: `Fri 16 Oct 2026, 04:00:00 ET (08:00:00 UTC) to ...`. */
|
|
100
112
|
function servedWindowText(served: ServedWindow): string {
|
|
101
113
|
const end = served.cutoff ? `${tapeMoment(served.to)}, the feed cutoff${served.delayMinutes ? ` (${served.delayMinutes} min delayed)` : ""}` : tapeMoment(served.to);
|
|
@@ -66,9 +66,13 @@ export interface AuctionQuery {
|
|
|
66
66
|
pageSize?: number;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
// A query that has not answered in 15 s does not answer the second time
|
|
70
|
+
// either: the source stalls for a minute at a time. The board then stands on
|
|
71
|
+
// TreasuryDirect and the saved copy (cache.ts) at once, not after 48 s of retries.
|
|
69
72
|
const TREASURY_FETCH = createThrottledFetch({
|
|
70
73
|
requestsPerMinute: 20,
|
|
71
74
|
maxRetries: 2,
|
|
75
|
+
retryTimeouts: false,
|
|
72
76
|
timeoutMs: 15_000,
|
|
73
77
|
backoffBaseMs: 800,
|
|
74
78
|
defaultHeaders: { Accept: "application/json" },
|
|
@@ -22,9 +22,11 @@ export const DIRECT_LOOKBACK_DAYS = 60;
|
|
|
22
22
|
/** Announced auctions are listed days to two weeks ahead; a month leaves none out. */
|
|
23
23
|
const DIRECT_LOOKAHEAD_DAYS = 30;
|
|
24
24
|
|
|
25
|
+
// As Fiscal Data's (client.ts): a stalled search is not waited out twice more.
|
|
25
26
|
const DIRECT_FETCH = createThrottledFetch({
|
|
26
27
|
requestsPerMinute: 20,
|
|
27
28
|
maxRetries: 2,
|
|
29
|
+
retryTimeouts: false,
|
|
28
30
|
timeoutMs: 20_000,
|
|
29
31
|
backoffBaseMs: 800,
|
|
30
32
|
defaultHeaders: { Accept: "application/json" },
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { signalWithTimeout } from "../../../utils/async-deadline";
|
|
1
2
|
import { httpFetch } from "../../../utils/http-transport";
|
|
2
3
|
import { numericOrNull, scalarTextOrNull } from "../../../utils/guards";
|
|
3
4
|
import { cashLineLabel, type CashAccount, type DebtDay, type OperatingCash, type TgaClose } from "./model";
|
|
@@ -100,13 +101,21 @@ function parseDebtToPenny(payload: unknown): DebtDay[] {
|
|
|
100
101
|
.slice(0, DEBT_DAYS);
|
|
101
102
|
}
|
|
102
103
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
104
|
+
/**
|
|
105
|
+
* One statement read, bounded whoever asks: a caller's signal (a command's)
|
|
106
|
+
* ends it sooner, never later, so a source that does not answer is an error
|
|
107
|
+
* in seconds rather than whenever its gateway gives up.
|
|
108
|
+
*/
|
|
109
|
+
async function readJson(url: string, label: string, signal: AbortSignal | undefined, timeoutMs: number): Promise<unknown> {
|
|
110
|
+
const deadline = signalWithTimeout(signal, timeoutMs);
|
|
111
|
+
try {
|
|
112
|
+
const response = await httpFetch(url, { headers: { Accept: "application/json" }, signal: deadline });
|
|
113
|
+
if (!response.ok) throw new Error(`${label} request failed (${response.status})`);
|
|
114
|
+
return await response.json() as unknown;
|
|
115
|
+
} catch (error) {
|
|
116
|
+
if (deadline.aborted && !signal?.aborted) throw new Error(`${label} request timed out after ${Math.round(timeoutMs / 1000)} s`);
|
|
117
|
+
throw error;
|
|
118
|
+
}
|
|
110
119
|
}
|
|
111
120
|
|
|
112
121
|
/**
|
|
@@ -114,11 +123,14 @@ async function readJson(url: string, label: string, signal?: AbortSignal): Promi
|
|
|
114
123
|
* closing balance history unless `history` is off (a report that does not draw it).
|
|
115
124
|
* A history that cannot be read leaves the figures as they are.
|
|
116
125
|
*/
|
|
117
|
-
export async function fetchTreasuryDaily(
|
|
126
|
+
export async function fetchTreasuryDaily(
|
|
127
|
+
signal?: AbortSignal,
|
|
128
|
+
{ history = true, timeoutMs = FETCH_TIMEOUT_MS }: { history?: boolean; timeoutMs?: number } = {},
|
|
129
|
+
): Promise<TreasuryDaily> {
|
|
118
130
|
const [cash, debt, tga] = await Promise.all([
|
|
119
|
-
readJson(CASH_URL, "Treasury cash", signal),
|
|
120
|
-
readJson(DEBT_URL, "Treasury debt", signal),
|
|
121
|
-
history ? readJson(TGA_HISTORY_URL, "Treasury account history", signal).then(parseTgaHistory).then(
|
|
131
|
+
readJson(CASH_URL, "Treasury cash", signal, timeoutMs),
|
|
132
|
+
readJson(DEBT_URL, "Treasury debt", signal, timeoutMs),
|
|
133
|
+
history ? readJson(TGA_HISTORY_URL, "Treasury account history", signal, timeoutMs).then(parseTgaHistory).then(
|
|
122
134
|
(closes) => ({ closes }),
|
|
123
135
|
(error: unknown) => ({ closes: [] as TgaClose[], error: error instanceof Error ? error.message : String(error) }),
|
|
124
136
|
) : { closes: [] as TgaClose[] },
|
|
@@ -442,6 +442,23 @@ export function buildVolatilityTermHistory(inputs: VolatilityInputs): Volatility
|
|
|
442
442
|
return termHistory([boardTermSource(spot, threeMonth), fredTermSource(fredHistory(inputs.fred))]);
|
|
443
443
|
}
|
|
444
444
|
|
|
445
|
+
/** What a curve point says of itself (`no close aligned to …`), from the curve's warnings that name it. */
|
|
446
|
+
export function curvePointWarnings(data: Pick<VolatilityData, "curve">, label: string): string[] {
|
|
447
|
+
return data.curve.warnings.flatMap((warning) => warning.startsWith(`${label}: `) ? [warning.slice(label.length + 2)] : []);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* The warnings that concern the whole pane, for its footer: the data's
|
|
452
|
+
* warnings less a board row's and a curve point's own, which their rows say.
|
|
453
|
+
*/
|
|
454
|
+
export function volatilityPaneWarnings(data: VolatilityData): string[] {
|
|
455
|
+
const rows = new Set([
|
|
456
|
+
...data.board.flatMap((row) => row.warnings.map((warning) => `${row.label}: ${warning}`)),
|
|
457
|
+
...data.curve.points.flatMap((point) => curvePointWarnings(data, point.label).map((warning) => `${point.label}: ${warning}`)),
|
|
458
|
+
]);
|
|
459
|
+
return data.warnings.filter((warning) => !rows.has(warning));
|
|
460
|
+
}
|
|
461
|
+
|
|
445
462
|
/** Curve values share one date and source family; board rows keep their own dates. */
|
|
446
463
|
export function buildVolatilityData(inputs: VolatilityInputs): VolatilityData {
|
|
447
464
|
const fred = fredHistory(inputs.fred);
|
|
@@ -24,7 +24,7 @@ import { useIndexCloseSettled, useLiveSessionRefresh, useThrottledValue } from "
|
|
|
24
24
|
import { DAY_SO_FAR_TEXT } from "../../../time-series/session-bar";
|
|
25
25
|
import { getCachedVolatilityData, loadVolatilityData, type VolatilityLoadResult } from "./client";
|
|
26
26
|
import { VOLATILITY_CURVE_INDICES, VOLATILITY_INDICES } from "../shared/volatility-indices";
|
|
27
|
-
import { boardOrder, buildVolatilityData, IMPLIED_CORRELATION_ROWS, termStateLabel, volatilityCurveLookbacks, withLiveVolatilityLevels, type VolatilityBoardRow, type VolatilityIndexId, type VolatilityLiveLevel } from "./model";
|
|
27
|
+
import { boardOrder, buildVolatilityData, curvePointWarnings, IMPLIED_CORRELATION_ROWS, termStateLabel, volatilityCurveLookbacks, volatilityPaneWarnings, withLiveVolatilityLevels, type VolatilityBoardRow, type VolatilityIndexId, type VolatilityLiveLevel } from "./model";
|
|
28
28
|
import { VolatilityHistoryChart, VolatilityIndexHistoryChart } from "./charts";
|
|
29
29
|
import { volatilityCurveRows, volatilityCurveSeries, type VolatilityCurveRow } from "./chart-model";
|
|
30
30
|
import { useVolatilityEvidence } from "./evidence";
|
|
@@ -141,8 +141,9 @@ export function VolatilityPane({ focused, width, height }: PaneProps) {
|
|
|
141
141
|
}, [data?.board, sort, loading]);
|
|
142
142
|
const selected = rows.find((row) => row.id === selectedId) ?? rows[0] ?? null;
|
|
143
143
|
useVolatilityEvidence(result, tab, selected, resource.loading);
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
// The footer's notes are the pane's; a board row's or a curve point's are that row's (rowNote).
|
|
145
|
+
const notices = [resource.error, levelRefresh.error, ...(result?.errors ?? []), ...(data ? volatilityPaneWarnings(data) : [])]
|
|
146
|
+
.filter((notice): notice is string => !!notice);
|
|
146
147
|
usePaneNoticeFooter({ registrationId: "volatility-notices", notices, focused });
|
|
147
148
|
// From the tab the press finds, so the footer's hint never holds an old one.
|
|
148
149
|
const cycleTab = useCallback(() => setTab((current) =>
|
|
@@ -216,6 +217,10 @@ export function VolatilityPane({ focused, width, height }: PaneProps) {
|
|
|
216
217
|
emptyStateTitle="VIX curve unavailable." getItemKey={curveRowKey}
|
|
217
218
|
selection={{ kind: "id", selectedId: curveSelectedId, getId: curveRowKey, onChange: setSelectedId }}
|
|
218
219
|
onActivate={(row) => { setSelectedId(row.id); setTab("board"); }}
|
|
220
|
+
rowNote={(row) => {
|
|
221
|
+
const notes = curvePointWarnings(data, row.label);
|
|
222
|
+
return notes.length ? `${row.label}: ${notes.join("; ")}.` : null;
|
|
223
|
+
}}
|
|
219
224
|
sortColumnId={null} sortDirection="asc"
|
|
220
225
|
getExportMetadata={() => [["as of", data.curve.date], ["source", data.curve.source === "fred" ? "FRED" : "Cboe"], ["units", "IV percent"], ["warnings", ...notices]]}
|
|
221
226
|
renderCell={(row, column) => {
|
|
@@ -237,11 +242,15 @@ export function VolatilityPane({ focused, width, height }: PaneProps) {
|
|
|
237
242
|
<DataTableView<VolatilityBoardRow> focused={focused} columns={boardColumns} items={rows} rootWidth={width} rootHeight={boardHeight}
|
|
238
243
|
emptyStateTitle="Volatility indices unavailable." getItemKey={(row) => row.id} selection={{ kind: "id", selectedId: selected?.id ?? null, getId: (row) => row.id, onChange: setSelectedId }}
|
|
239
244
|
onActivate={(row) => setSelectedId(row.id)} sortable
|
|
245
|
+
rowNote={(row) => row.warnings.length ? `${row.label}: ${row.warnings.join("; ")}.` : null}
|
|
240
246
|
sortColumnId={sort.columnId} sortDirection={sort.direction}
|
|
241
247
|
onHeaderClick={(id) => setSort((current) => nextHeaderSort(current, id, { resetTo: { columnId: null, direction: "asc" } }))}
|
|
242
248
|
onSortChange={(columnId, direction) => setSort({ columnId, direction })}
|
|
243
249
|
getExportMetadata={() => [["basis", "daily history; sparse observations retain their timestamp"], ["percentile", "one year, at least 200 observations and 300 calendar days"], ["warnings", ...notices]]}
|
|
244
|
-
renderCell={(row, column) =>
|
|
250
|
+
renderCell={(row, column) => column.id === "id" && row.warnings.length
|
|
251
|
+
// A row with a note under the table when selected says so on its symbol.
|
|
252
|
+
? { text: row.id.toUpperCase(), color: colors.warning }
|
|
253
|
+
: ({ text: column.id === "id" ? row.id.toUpperCase()
|
|
245
254
|
: column.id === "label" ? row.label
|
|
246
255
|
: column.id === "percentile1y" ? percentile(row.percentile1y)
|
|
247
256
|
: ["value", "change1d", "change1dPercent"].includes(column.id)
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
createWorldIndexColumns,
|
|
24
24
|
renderWorldIndexCell,
|
|
25
25
|
usesSessionText,
|
|
26
|
+
worldIndexRowNote,
|
|
26
27
|
type WorldIndexColumn,
|
|
27
28
|
} from "./table";
|
|
28
29
|
|
|
@@ -139,6 +140,7 @@ function WorldIndicesPane({ focused, width, height }: PaneProps) {
|
|
|
139
140
|
onVisibleRangeChange={setVisibleRange}
|
|
140
141
|
renderSectionHeader={renderRegionHeader}
|
|
141
142
|
renderCell={renderCell}
|
|
143
|
+
rowNote={(row) => worldIndexRowNote(row, quotes)}
|
|
142
144
|
selectedTextOverridesCellColor
|
|
143
145
|
emptyStateTitle="No market data provider connected."
|
|
144
146
|
/>
|
|
@@ -72,6 +72,18 @@ function isUnavailableInFeed(state: BoardQuoteState | undefined): boolean {
|
|
|
72
72
|
return !!state && !state.quote && !state.loading && isFeedGap(state.error);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
/** Why an index's quote failed to load (a timeout, an outage), not a gap in the feed; null while it has one or is loading. */
|
|
76
|
+
function quoteFailure(state: BoardQuoteState | undefined): string | null {
|
|
77
|
+
return state && !state.quote && !state.loading && state.error && !isFeedGap(state.error) ? state.error : null;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** The selected index's failure in full, under the table: its row says `no quote` (WorldIndicesPane `rowNote`). */
|
|
81
|
+
export function worldIndexRowNote(row: WorldIndexTableRow, quotes: BoardQuoteMap): string | null {
|
|
82
|
+
if (row.type !== "row") return null;
|
|
83
|
+
const failure = quoteFailure(quotes.get(row.entry.symbol));
|
|
84
|
+
return failure ? `${row.entry.shortName}: ${failure}` : null;
|
|
85
|
+
}
|
|
86
|
+
|
|
75
87
|
export function renderWorldIndexCell(
|
|
76
88
|
row: WorldIndexTableRow,
|
|
77
89
|
column: WorldIndexColumn,
|
|
@@ -83,6 +95,7 @@ export function renderWorldIndexCell(
|
|
|
83
95
|
const { entry } = row;
|
|
84
96
|
// The figures are blank and the name cell says why, ahead of the name so a narrow pane clips the name, not the reason.
|
|
85
97
|
const unavailable = isUnavailableInFeed(quotes.get(entry.symbol));
|
|
98
|
+
const failed = !!quoteFailure(quotes.get(entry.symbol));
|
|
86
99
|
switch (column.id) {
|
|
87
100
|
case "symbol":
|
|
88
101
|
return {
|
|
@@ -93,6 +106,8 @@ export function renderWorldIndexCell(
|
|
|
93
106
|
case "name":
|
|
94
107
|
return unavailable
|
|
95
108
|
? { text: `${NOT_IN_FEED} · ${entry.name}`, color: colors.textDim }
|
|
109
|
+
// A quote that failed to load says so in a few words; its reason is under the table when selected.
|
|
110
|
+
: failed ? { text: `no quote · ${entry.name}`, color: colors.warning }
|
|
96
111
|
: { text: entry.name };
|
|
97
112
|
default:
|
|
98
113
|
if (unavailable) return { text: "" };
|
|
@@ -7,7 +7,8 @@ import { useRemoteUiNode } from "../../../remote/semantic-tree";
|
|
|
7
7
|
import { isRecord } from "../../../utils/guards";
|
|
8
8
|
import type { GeoLayerState } from "./feed";
|
|
9
9
|
import { WORLD_VENUE_MAP_PANE_ID } from "./ids";
|
|
10
|
-
import { parseLayerTokens } from "./layers";
|
|
10
|
+
import { parseLayerTokens, parseMapPreset } from "./layers";
|
|
11
|
+
import { peekGeoCatalog } from "../../../api-client/geo";
|
|
11
12
|
|
|
12
13
|
interface WorldMapEvidenceLayer {
|
|
13
14
|
id: string;
|
|
@@ -51,7 +52,7 @@ export function useWorldMapEvidence(tokens: readonly string[], states: readonly
|
|
|
51
52
|
|
|
52
53
|
function requestedTokens(request: Parameters<PaneScreenshotEvidenceHook["mismatches"]>[1]): string[] {
|
|
53
54
|
const fromOption = parseLayerTokens(request.resolved.options.layer);
|
|
54
|
-
return fromOption.length ? fromOption :
|
|
55
|
+
return fromOption.length ? fromOption : parseMapPreset(request.resolved.createOptions?.arg, peekGeoCatalog()?.layers)?.layers ?? [];
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
export const worldMapScreenshotEvidence: PaneScreenshotEvidenceHook<WorldMapEvidence> = {
|