@gloom-sh/terminal 0.20.17 → 0.20.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -1
- package/src/account/auth-dialog.tsx +19 -1
- package/src/account/billing.ts +2 -1
- package/src/account/heard-from-question.tsx +235 -0
- package/src/account/heard-from.ts +97 -0
- package/src/api-client/data.ts +3 -2
- package/src/api-client/heard-from.ts +72 -0
- package/src/api-client/index.ts +63 -6
- package/src/api-client/mna.ts +18 -0
- package/src/api-client/supply-chain.ts +9 -0
- package/src/api-client/types/billing.ts +35 -1
- package/src/app/global-shortcuts.ts +5 -3
- package/src/app/pro-welcome/keys.ts +27 -0
- package/src/app/pro-welcome/model.ts +158 -0
- package/src/app/pro-welcome/row.tsx +176 -0
- package/src/app/pro-welcome/use-pro-welcome.ts +156 -0
- package/src/app/runtime/external-profile-changes.ts +135 -0
- package/src/app.tsx +33 -2
- package/src/architecture/core-builtin-allowlist.json +1 -1
- package/src/architecture/floating-promise-allowlist.json +0 -1
- package/src/architecture/shortcut-labels-allowlist.json +1 -0
- package/src/cli/alert-listing.ts +98 -0
- package/src/cli/commands/market.ts +138 -22
- package/src/cli/commands/overview.ts +7 -1
- package/src/cli/commands/plugins.ts +3 -2
- package/src/cli/commands/search.ts +30 -6
- package/src/cli/context.ts +16 -5
- package/src/cli/csv-export.ts +2 -1
- package/src/cli/desktop-pane-shot.ts +72 -9
- package/src/cli/glossary.ts +64 -10
- package/src/cli/history-demergers.ts +117 -0
- package/src/cli/history-rows.ts +6 -2
- package/src/cli/index.ts +1 -0
- package/src/cli/known-gaps.ts +16 -0
- package/src/cli/known-us-stocks.ts +18 -0
- package/src/cli/listing-arg.ts +105 -15
- package/src/cli/pane-functions/catalog-snapshot-build.ts +83 -0
- package/src/cli/pane-functions/catalog-snapshot.json +866 -0
- package/src/cli/pane-functions/catalog-snapshot.ts +62 -0
- package/src/cli/pane-functions/catalog.ts +50 -16
- package/src/cli/pane-functions/data.ts +16 -4
- package/src/cli/pane-functions/dom.ts +24 -6
- package/src/cli/pane-functions/freshness.ts +17 -1
- package/src/cli/pane-functions/index.ts +100 -42
- package/src/cli/pane-functions/resolver.ts +8 -5
- package/src/cli/pane-functions/screenshot-assessment.ts +30 -7
- package/src/cli/pane-functions/screenshot-payload.ts +21 -0
- package/src/cli/pane-functions/screenshot-render.ts +3 -1
- package/src/cli/quote-answer.ts +32 -16
- package/src/cli/registry.ts +22 -2
- package/src/cli/result.ts +5 -4
- package/src/cli/series-search.ts +45 -6
- package/src/cli/shot-temp-dir.ts +4 -9
- package/src/components/chart/composite/legend.tsx +43 -18
- package/src/components/chart/composite/panel-surface/panel-cursor.tsx +3 -3
- package/src/components/chart/composite/price-axis-labels.tsx +7 -5
- package/src/components/chart-table/header.tsx +9 -0
- package/src/components/chart-table/layout.ts +11 -11
- package/src/components/command-bar/pane-templates/items.ts +17 -1
- package/src/components/command-bar/routes/root/provider-search.ts +10 -1
- package/src/components/command-bar/routes/root/results.ts +34 -2
- package/src/components/command-bar/routes/root/runtime.ts +8 -1
- package/src/components/command-bar/routes/ticker-search/route.ts +5 -0
- package/src/components/command-bar/workflow/alert.ts +19 -8
- package/src/components/data-table/view.tsx +15 -2
- package/src/components/form-modal/content.tsx +9 -4
- package/src/components/index.ts +1 -1
- package/src/components/layout/header.tsx +9 -5
- package/src/components/layout/pane/capture-status.ts +6 -0
- package/src/components/layout/pane/footer/index.tsx +2 -0
- package/src/components/layout/pane/footer/model.ts +113 -15
- package/src/components/layout/pane/header.tsx +16 -2
- package/src/components/market-board/index.tsx +4 -2
- package/src/components/onboarding/onboarding-frame.tsx +6 -2
- package/src/components/onboarding/onboarding-keyboard.ts +7 -1
- package/src/components/onboarding/onboarding-wizard.tsx +3 -1
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +24 -15
- package/src/components/onboarding/setup-cards.ts +36 -0
- package/src/components/onboarding/use-onboarding-progress.ts +22 -1
- package/src/components/onboarding/wizard-account.ts +6 -1
- package/src/components/onboarding/wizard-model.ts +32 -6
- package/src/components/onboarding/wizard-positions.ts +1 -1
- package/src/components/sign-in-gate.tsx +3 -1
- package/src/components/toggle-list.tsx +6 -8
- package/src/components/ui/confirm-dialog.tsx +47 -7
- package/src/components/ui/data-table/types.ts +8 -0
- package/src/components/ui/display.tsx +17 -2
- package/src/components/ui/index.ts +1 -1
- package/src/components/ui/stat-grid.tsx +4 -0
- package/src/components/ui/status.tsx +13 -1
- package/src/components/ui/table-layout.ts +2 -1
- package/src/components/use-pane-notice-footer.tsx +16 -3
- package/src/data/config/store/index.ts +31 -0
- package/src/data/config/store/node.ts +61 -11
- package/src/data/config/store/normalize.ts +4 -6
- package/src/data/config/store/shared-file.ts +309 -0
- package/src/data/profile-merge.ts +299 -0
- package/src/data/sqlite/checkpointer.ts +11 -1
- package/src/data/sqlite/database.ts +1 -1
- package/src/data/ticker-repository.ts +134 -10
- package/src/data/ticker-store.ts +67 -0
- package/src/data/ticker-writes.ts +5 -0
- package/src/i18n/es.ts +27 -0
- package/src/i18n/ja.ts +27 -0
- package/src/i18n/ko.ts +27 -0
- package/src/i18n/zh-cn.ts +27 -0
- package/src/i18n/zh-tw.ts +27 -0
- package/src/layout-marketplace/gallery-desktop.tsx +2 -2
- package/src/market-data/ah-pair.ts +103 -0
- package/src/market-data/depositary-pair.ts +6 -2
- package/src/market-data/hooks.tsx +33 -2
- package/src/market-data/market/change-basis.ts +2 -1
- package/src/market-data/market/header-market.ts +11 -0
- package/src/market-data/split-terms.ts +28 -0
- package/src/plugins/builtin/account-management/footer.ts +1 -1
- package/src/plugins/builtin/account-management/keyboard.ts +4 -0
- package/src/plugins/builtin/account-management/model.ts +1 -0
- package/src/plugins/builtin/account-management/pane.tsx +75 -7
- package/src/plugins/builtin/account-management/payment-recovery-row.tsx +12 -5
- package/src/plugins/builtin/account-management/pro-cancel.tsx +197 -0
- package/src/plugins/builtin/account-management/trial-cancel.ts +1 -1
- package/src/plugins/builtin/alerts/cli-move.ts +2 -2
- package/src/plugins/builtin/alerts/cli.ts +36 -30
- package/src/plugins/builtin/alerts/constants.ts +10 -0
- package/src/plugins/builtin/alerts/earnings-listing.ts +20 -0
- package/src/plugins/builtin/alerts/format.ts +24 -8
- package/src/plugins/builtin/alerts/index.tsx +38 -9
- package/src/plugins/builtin/alerts/move-checks.ts +7 -0
- package/src/plugins/builtin/alerts/pane.tsx +1 -1
- package/src/plugins/builtin/alerts/quotes.ts +26 -2
- package/src/plugins/builtin/alerts/scheduled.ts +6 -1
- package/src/plugins/builtin/alerts/types.ts +7 -0
- package/src/plugins/builtin/analytics/manual-value.ts +61 -0
- package/src/plugins/builtin/analytics/risk-book.ts +7 -7
- package/src/plugins/builtin/analytics/risk-client.ts +26 -13
- package/src/plugins/builtin/analytics/risk-headless.ts +13 -8
- package/src/plugins/builtin/analytics/risk-model.ts +92 -4
- package/src/plugins/builtin/analytics/risk-pane.tsx +85 -38
- package/src/plugins/builtin/awards/pane.tsx +1 -1
- package/src/plugins/builtin/broker-trading/orders.tsx +2 -2
- package/src/plugins/builtin/central-bank-rates/model.ts +8 -2
- package/src/plugins/builtin/central-bank-rates/pane.tsx +5 -3
- package/src/plugins/builtin/chart-composer/cli-options.ts +4 -2
- package/src/plugins/builtin/chart-composer/data-catalog-pane.tsx +2 -6
- package/src/plugins/builtin/chart-composer/pane.tsx +5 -2
- package/src/plugins/builtin/cloud/auth-actions.tsx +11 -6
- package/src/plugins/builtin/cloud/company-picker.tsx +5 -3
- package/src/plugins/builtin/cloud/upgrade-command.ts +1 -1
- package/src/plugins/builtin/company-kpis/headless.ts +9 -4
- package/src/plugins/builtin/company-kpis/latest.ts +45 -0
- package/src/plugins/builtin/company-kpis/model.ts +38 -8
- package/src/plugins/builtin/company-kpis/pane.tsx +22 -8
- package/src/plugins/builtin/composite/alt-data.ts +20 -0
- package/src/plugins/builtin/composite/application.ts +14 -0
- package/src/plugins/builtin/composite/broker.ts +12 -0
- package/src/plugins/builtin/composite/credit.ts +33 -0
- package/src/plugins/builtin/composite/crypto.ts +10 -0
- package/src/plugins/builtin/composite/earnings.ts +12 -0
- package/src/plugins/builtin/composite/filings.ts +13 -0
- package/src/plugins/builtin/composite/futures-commodities.ts +23 -0
- package/src/plugins/builtin/composite/global-markets.ts +12 -0
- package/src/plugins/builtin/composite/options-volatility.ts +23 -0
- package/src/plugins/builtin/composite/ownership.ts +23 -0
- package/src/plugins/builtin/composite/portfolio.ts +10 -0
- package/src/plugins/builtin/composite/quant.ts +15 -0
- package/src/plugins/builtin/composite/rates-macro.ts +30 -0
- package/src/plugins/builtin/composite/screeners.ts +11 -0
- package/src/plugins/builtin/composite/shared.ts +11 -0
- package/src/plugins/builtin/composite/ticker-core.ts +36 -0
- package/src/plugins/builtin/congress-trades/headless.ts +31 -3
- package/src/plugins/builtin/correlation/index.tsx +13 -17
- package/src/plugins/builtin/correlation/matrix/model.ts +18 -0
- package/src/plugins/builtin/dividend-yield/client.ts +57 -16
- package/src/plugins/builtin/dividend-yield/headless.ts +17 -11
- package/src/plugins/builtin/dividend-yield/model.ts +4 -3
- package/src/plugins/builtin/dividend-yield/pane.tsx +22 -18
- package/src/plugins/builtin/dividend-yield/ranking.ts +1 -1
- package/src/plugins/builtin/dividend-yield/types.ts +4 -0
- package/src/plugins/builtin/dividend-yield/view.ts +23 -12
- package/src/plugins/builtin/earnings/fiscal-quarter.ts +39 -0
- package/src/plugins/builtin/earnings/headless.ts +7 -4
- package/src/plugins/builtin/earnings/history-model.ts +6 -4
- package/src/plugins/builtin/earnings/history-table.ts +4 -3
- package/src/plugins/builtin/earnings-calls/pane.tsx +8 -2
- package/src/plugins/builtin/econ/calendar-model.ts +16 -0
- package/src/plugins/builtin/econ/index.tsx +3 -0
- package/src/plugins/builtin/equity-screener/headless.ts +4 -1
- package/src/plugins/builtin/equity-screener/model.ts +7 -6
- package/src/plugins/builtin/estimate-revisions/headless.ts +1 -1
- package/src/plugins/builtin/exposure/model.ts +10 -0
- package/src/plugins/builtin/exposure/pane.tsx +10 -3
- package/src/plugins/builtin/fx-matrix/amount.ts +15 -1
- package/src/plugins/builtin/fx-matrix/headless.ts +12 -6
- package/src/plugins/builtin/fx-matrix/index.tsx +23 -5
- package/src/plugins/builtin/fx-matrix/settings.ts +9 -4
- package/src/plugins/builtin/kelly-sizer/pane.tsx +9 -4
- package/src/plugins/builtin/market-valuation/pane.tsx +22 -10
- package/src/plugins/builtin/mna/detail.tsx +67 -6
- package/src/plugins/builtin/mna/headless.ts +128 -13
- package/src/plugins/builtin/mna/model.ts +219 -16
- package/src/plugins/builtin/mna/pane.tsx +34 -6
- package/src/plugins/builtin/money-markets/model.ts +14 -5
- package/src/plugins/builtin/money-markets/pane.tsx +4 -3
- package/src/plugins/builtin/news/wire/news/footer.ts +3 -8
- package/src/plugins/builtin/options-scenario/csp-screen-pane.tsx +22 -6
- package/src/plugins/builtin/options-scenario/csp-screen.ts +39 -12
- package/src/plugins/builtin/options-scenario/strategy-screen.ts +7 -5
- package/src/plugins/builtin/pe-band/client.ts +13 -1
- package/src/plugins/builtin/pe-band/headless.ts +2 -2
- package/src/plugins/builtin/pe-band/model.ts +63 -10
- package/src/plugins/builtin/pe-band/pane.tsx +5 -5
- package/src/plugins/builtin/portfolio-list/allocation-rows.ts +26 -7
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +66 -13
- package/src/plugins/builtin/portfolio-list/cli/render.ts +76 -33
- package/src/plugins/builtin/portfolio-list/headless.ts +69 -22
- package/src/plugins/builtin/portfolio-list/pane/data.ts +3 -3
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +29 -14
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +2 -2
- package/src/plugins/builtin/relative-rotation/pane.tsx +2 -3
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +5 -1
- package/src/plugins/builtin/research/event-model.ts +31 -13
- package/src/plugins/builtin/research/headless.ts +8 -1
- package/src/plugins/builtin/research/relative-valuation-pane.tsx +19 -17
- package/src/plugins/builtin/sectors/index.tsx +6 -9
- package/src/plugins/builtin/shared/cloud-upgrade.ts +1 -1
- package/src/plugins/builtin/shared/earnings-report.ts +19 -4
- package/src/plugins/builtin/shared/report-freshness.ts +2 -3
- package/src/plugins/builtin/supply-chain/client.ts +34 -9
- package/src/plugins/builtin/supply-chain/evidence.ts +3 -2
- package/src/plugins/builtin/supply-chain/flow.tsx +4 -3
- package/src/plugins/builtin/supply-chain/graph-model.ts +14 -7
- package/src/plugins/builtin/supply-chain/graph-pane.tsx +3 -1
- package/src/plugins/builtin/supply-chain/graph.tsx +6 -3
- package/src/plugins/builtin/supply-chain/headless.ts +19 -4
- package/src/plugins/builtin/supply-chain/model.ts +50 -6
- package/src/plugins/builtin/supply-chain/pane.tsx +76 -16
- package/src/plugins/builtin/ticker-detail/adr-pair/ah.ts +62 -0
- package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +119 -20
- package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +51 -1
- package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +25 -14
- package/src/plugins/builtin/ticker-detail/overview/model.ts +17 -1
- package/src/plugins/builtin/ticker-detail/overview/pane.tsx +4 -0
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +9 -2
- package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +9 -2
- package/src/plugins/builtin/ticker-detail/quote-monitor/index.tsx +5 -2
- package/src/plugins/builtin/volatility/model.ts +17 -0
- package/src/plugins/builtin/volatility/pane.tsx +13 -4
- package/src/plugins/builtin/world-indices/index.tsx +2 -0
- package/src/plugins/builtin/world-indices/table.tsx +15 -0
- package/src/plugins/builtin/world-venue-map/evidence.ts +3 -2
- package/src/plugins/builtin/world-venue-map/headless.ts +28 -16
- package/src/plugins/builtin/world-venue-map/index.ts +19 -6
- package/src/plugins/builtin/world-venue-map/layered-pane.tsx +9 -5
- package/src/plugins/builtin/world-venue-map/layers.ts +33 -11
- package/src/plugins/builtin/world-venue-map/map.tsx +12 -0
- package/src/plugins/builtin/world-venue-map/pane.tsx +35 -6
- package/src/plugins/builtin/world-venue-map/place.ts +119 -0
- package/src/plugins/catalog-data.ts +20 -0
- package/src/plugins/catalog-lazy.ts +51 -0
- package/src/plugins/catalog-ui.ts +16 -18
- package/src/plugins/host-smoke.ts +5 -2
- package/src/portfolio/allocation.ts +79 -19
- package/src/portfolio/cash-balances.ts +76 -0
- package/src/portfolio/mutations.ts +43 -8
- package/src/public/__snapshots__/public-api.test.ts.snap +1 -0
- package/src/renderers/desktop/window-layouts.ts +14 -0
- package/src/renderers/dom/data-table/row.tsx +2 -0
- package/src/renderers/dom/host/tabs.tsx +57 -8
- package/src/renderers/dom/styles.css +13 -5
- package/src/renderers/electrobun/bun/desktop/backend-requests.ts +4 -0
- package/src/renderers/electrobun/bun/desktop/backend.ts +22 -1
- package/src/renderers/electrobun/bun/window/native-min-size.ts +6 -1
- package/src/renderers/electrobun/shared/protocol.ts +4 -0
- package/src/renderers/electrobun/view/cli-pane-shot-frame.tsx +50 -12
- package/src/renderers/electrobun/view/remote/ticker-repository.ts +10 -0
- package/src/series/standalone-catalog.ts +5 -4
- package/src/series/standalone.ts +13 -7
- package/src/sources/gloomberb-cloud/index.ts +14 -3
- package/src/sources/gloomberb-cloud/perpetuals.ts +60 -3
- package/src/sources/provider-router/financials.ts +20 -13
- package/src/sources/provider-router/index.ts +4 -0
- package/src/sources/provider-router/search.ts +1 -0
- package/src/sync/collections-contributor.ts +3 -1
- package/src/sync/config-merge.ts +10 -1
- package/src/sync/sanitize.ts +26 -2
- package/src/tickers/company-name-listing.ts +16 -2
- package/src/tickers/listing-fate.ts +12 -8
- package/src/tickers/renamed-listings.ts +43 -10
- package/src/tickers/search/home-listing.ts +28 -0
- package/src/tickers/search/index.ts +19 -7
- package/src/tickers/terminal-codes.ts +11 -1
- package/src/time-series/resolve.ts +3 -1
- package/src/time-series/spec.ts +2 -2
- package/src/time-series/types.ts +1 -1
- package/src/types/data-provider.ts +11 -0
- package/src/types/financials.ts +39 -3
- package/src/types/ticker.ts +10 -2
- package/src/utils/cli-output.ts +1 -1
- package/src/utils/declared-dividends.ts +13 -1
- package/src/utils/dividend-cash.ts +5 -1
- package/src/utils/forward-dividend.ts +4 -3
- package/src/utils/remove-folder.ts +37 -0
- package/src/utils/trailing-dividend.ts +1 -1
- package/src/plugins/builtin/composite-plugins.ts +0 -285
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
compareDepositaryPair, dollarPairLabel, formatPairRate, isReceiptSide, listingDepositaryPair, pairPriceInput, pairTimeText,
|
|
11
11
|
premiumText, ratioCount, spotRateKind, type DepositaryPairComparison, type PairPriceInput, type PairSpotInput,
|
|
12
12
|
} from "../../../../market-data/depositary-pair";
|
|
13
|
+
import { AH_SPOT_LABEL, ahListingKey, type AhComparison } from "../../../../market-data/ah-pair";
|
|
13
14
|
|
|
14
15
|
/** The DES tab a listing with a known receipt pair gets, and the function that opens DES on it. */
|
|
15
16
|
export const ADR_PAIR_TAB_ID = "adr-vs-home";
|
|
@@ -112,7 +113,7 @@ export function adrPairFigures(comparison: DepositaryPairComparison): AdrPairFig
|
|
|
112
113
|
}
|
|
113
114
|
|
|
114
115
|
export interface AdrPairInputRow {
|
|
115
|
-
id: "home" | "receipt" | "spot";
|
|
116
|
+
id: "home" | "receipt" | "spot" | "h-share" | "a-share" | "ah-spot";
|
|
116
117
|
listing: string;
|
|
117
118
|
role: string;
|
|
118
119
|
price: string;
|
|
@@ -167,3 +168,52 @@ export function adrPairInputRows(
|
|
|
167
168
|
}] : [],
|
|
168
169
|
];
|
|
169
170
|
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* The figures an A+H company's two lines add: the H price over the A price at
|
|
174
|
+
* spot, the A price in Hong Kong dollars (to the decimals of `hQuote`, the H
|
|
175
|
+
* line's), and the spot rate it is read at.
|
|
176
|
+
*/
|
|
177
|
+
export function ahPairFigures(comparison: AhComparison, hQuote?: Quote | null): AdrPairFigure[] {
|
|
178
|
+
const { premiumPercent, aInHkd, spot } = comparison;
|
|
179
|
+
return [
|
|
180
|
+
{
|
|
181
|
+
id: "ah-premium", label: "H vs A",
|
|
182
|
+
value: premiumPercent == null ? MISSING_VALUE : premiumText(premiumPercent),
|
|
183
|
+
...(premiumPercent == null ? {} : { detail: "at spot" }),
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
id: "ah-a-in-hkd", label: "A in HKD",
|
|
187
|
+
// To the H price's own decimals, which it is read beside.
|
|
188
|
+
value: aInHkd == null ? MISSING_VALUE
|
|
189
|
+
: formatMarketPriceWithCurrency(aInHkd, "HKD", { ...legPriceOptions(comparison.h, hQuote), currencyCode: true }),
|
|
190
|
+
...(aInHkd == null ? {} : { detail: "A × spot" }),
|
|
191
|
+
},
|
|
192
|
+
{ id: "ah-spot", label: `Spot ${AH_SPOT_LABEL}`, value: spot ? formatPairRate(spot.rate) : MISSING_VALUE },
|
|
193
|
+
];
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* The A+H prices, each in its own currency and dated, and the spot rate,
|
|
198
|
+
* leaving out a line `listed` already holds (the H line that is a receipt's
|
|
199
|
+
* home line).
|
|
200
|
+
*/
|
|
201
|
+
export function ahPairInputRows(
|
|
202
|
+
comparison: AhComparison,
|
|
203
|
+
quotes: { h: Quote | null | undefined; a: Quote | null | undefined },
|
|
204
|
+
listed: readonly string[] = [],
|
|
205
|
+
now = Date.now(),
|
|
206
|
+
): AdrPairInputRow[] {
|
|
207
|
+
const { h, a, spot } = comparison;
|
|
208
|
+
const time = (value: number | null) => value == null ? MISSING_VALUE : pairTimeText(value, now).replace(/ UTC$/, "");
|
|
209
|
+
const leg = (id: "h-share" | "a-share", role: string, input: PairPriceInput, quote: Quote | null | undefined): AdrPairInputRow => ({
|
|
210
|
+
id, listing: input.symbol, role,
|
|
211
|
+
price: formatMarketPriceWithCurrency(input.price, input.currency, { ...legPriceOptions(input, quote), currencyCode: true }),
|
|
212
|
+
asOf: time(input.observedAt), session: sessionText(input), opens: input.symbol,
|
|
213
|
+
});
|
|
214
|
+
return [
|
|
215
|
+
...listed.some((key) => ahListingKey(key) === h.symbol) ? [] : [leg("h-share", "H share", h, quotes.h)],
|
|
216
|
+
leg("a-share", "A share", a, quotes.a),
|
|
217
|
+
...spot ? [{ id: "ah-spot" as const, listing: AH_SPOT_LABEL, role: "Spot", price: formatPairRate(spot.rate), asOf: time(spot.observedAt), session: "", opens: null }] : [],
|
|
218
|
+
];
|
|
219
|
+
}
|
|
@@ -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, adrPairQuotes, 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,13 +30,16 @@ 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);
|
|
40
44
|
const quotes = legs
|
|
41
45
|
? adrPairQuotes(legs, { own: resolveEntryData(ownEntry), other: resolveEntryData(otherEntry) }, financials?.quote)
|
|
@@ -48,28 +52,35 @@ export function AdrPairResearchTab({ width, height, focused }: TickerResearchTab
|
|
|
48
52
|
const observed = useFxRateObservations([homeCurrency]).get(homeCurrency);
|
|
49
53
|
const spot = spotFromUsdValue(observed?.rate, observed?.asOf);
|
|
50
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;
|
|
51
58
|
const openDescription = useOpenDescription();
|
|
52
59
|
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
53
60
|
|
|
54
|
-
const
|
|
55
|
-
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)) : []];
|
|
56
64
|
|
|
57
|
-
if (!legs) return <EmptyState title="No ADR pair for this listing." />;
|
|
65
|
+
if (!legs && !ah) return <EmptyState title="No ADR pair for this listing." />;
|
|
58
66
|
const pending = (entry: typeof receiptEntry) => !entry || entry.phase === "loading" || entry.phase === "idle";
|
|
59
67
|
// A leg with a quote is not waiting on its read.
|
|
60
|
-
const loading =
|
|
61
|
-
|
|
62
|
-
|
|
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}.`
|
|
63
73
|
: null;
|
|
64
|
-
|
|
65
|
-
|
|
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);
|
|
66
77
|
const tableHeight = Math.max(3, height - statGridRows(stats, width) - noteRows);
|
|
67
78
|
|
|
68
79
|
return <Box width={width} height={height} flexDirection="column" overflow="hidden">
|
|
69
|
-
<PaneStatusBody subject="ADR pair" loading={loading} error={error} width={width} height={height}>
|
|
70
|
-
{
|
|
80
|
+
<PaneStatusBody subject={legs ? "ADR pair" : "A+H pair"} loading={loading} error={error} width={width} height={height}>
|
|
81
|
+
{rows.length > 0 ? <>
|
|
71
82
|
<StatGrid items={stats} width={width} />
|
|
72
|
-
{
|
|
83
|
+
{notes.map((note) => <Box key={note} paddingX={1} flexShrink={0}><Notice>{note}</Notice></Box>)}
|
|
73
84
|
<DataTableView<AdrPairInputRow>
|
|
74
85
|
focused={focused}
|
|
75
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%",
|
|
@@ -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> = {
|
|
@@ -8,9 +8,10 @@ import { getGeoEntities, loadGeoCatalog, type GeoColumn, type GeoEntitiesPayload
|
|
|
8
8
|
import type { HeadlessPaneColumn, HeadlessPaneContext, HeadlessPaneDefinition, HeadlessPaneFreshness, HeadlessPaneRow, HeadlessRowsResult } from "../../../types/headless";
|
|
9
9
|
import { formatUtcDayTime } from "../../../utils/utc-time";
|
|
10
10
|
import { REFERENCE_DATA } from "../shared/report-freshness";
|
|
11
|
-
import { columnValue, formatGeoValue, isChangeColumn, layerCoverageNote, parseLayerTokens, plainGeoValue, resolveActiveLayers, tickerLinkKey } from "./layers";
|
|
11
|
+
import { columnValue, formatGeoValue, isChangeColumn, layerCoverageNote, parseLayerTokens, parseMapPreset, plainGeoValue, resolveActiveLayers, tickerLinkKey } from "./layers";
|
|
12
12
|
import { filterWorldVenues, formatVenueLocalTime } from "./model";
|
|
13
13
|
import { REPORT_FILTER, REPORT_ROWS } from "../shared/headless-options";
|
|
14
|
+
import { mapHomeArea, mapPlaceBbox, nearestPlaces, resolveMapPlace, type MapStart } from "./place";
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* A layer's status from its own cadence, as the pane's footer shows it. The
|
|
@@ -32,12 +33,12 @@ export function contextGeoRequest(context: HeadlessPaneContext): GeoRequest {
|
|
|
32
33
|
return <T>(path: string, init?: RequestInit) => context.apiClient.geo<T>(path, { ...init, signal: init?.signal ?? context.signal });
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
function tokensFor(args: { argument: unknown; options: Record<string, unknown> }, settings: Record<string, unknown> | undefined): string[] {
|
|
36
|
+
function tokensFor(args: { argument: unknown; options: Record<string, unknown> }, settings: Record<string, unknown> | undefined, catalog: readonly GeoLayerInfo[]): string[] {
|
|
36
37
|
const fromOption = parseLayerTokens(args.options.layer);
|
|
37
38
|
if (fromOption.length) return fromOption;
|
|
38
39
|
const fromSettings = parseLayerTokens(settings?.layers);
|
|
39
40
|
if (fromSettings.length) return fromSettings;
|
|
40
|
-
return
|
|
41
|
+
return parseMapPreset(typeof args.argument === "string" ? args.argument : "", catalog)?.layers ?? [];
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
const VENUE_COLUMNS: HeadlessPaneColumn[] = [
|
|
@@ -49,13 +50,13 @@ const VENUE_COLUMNS: HeadlessPaneColumn[] = [
|
|
|
49
50
|
{ key: "localTime", header: "Local" },
|
|
50
51
|
];
|
|
51
52
|
|
|
52
|
-
async function venueRows(context: HeadlessPaneContext, query: string): Promise<HeadlessRowsResult> {
|
|
53
|
+
async function venueRows(context: HeadlessPaneContext, query: string, start: MapStart): Promise<HeadlessRowsResult> {
|
|
53
54
|
const response = await context.apiClient.getCloudWorldVenues();
|
|
54
55
|
if (!response.data) throw new Error(response.reasonCode ?? "World venue data unavailable");
|
|
55
56
|
const now = Date.now();
|
|
56
57
|
return {
|
|
57
58
|
columns: VENUE_COLUMNS,
|
|
58
|
-
rows: filterWorldVenues(response.data.venues, query).map((venue) => ({
|
|
59
|
+
rows: nearestPlaces(filterWorldVenues(response.data.venues, query), start.place, (venue) => venue).map((venue) => ({
|
|
59
60
|
mic: venue.mic,
|
|
60
61
|
name: venue.title,
|
|
61
62
|
city: venue.city,
|
|
@@ -66,7 +67,8 @@ async function venueRows(context: HeadlessPaneContext, query: string): Promise<H
|
|
|
66
67
|
lat: venue.latitude,
|
|
67
68
|
})),
|
|
68
69
|
freshness: REFERENCE_DATA,
|
|
69
|
-
|
|
70
|
+
errors: start.note ? [start.note] : [],
|
|
71
|
+
metadata: { layer: "venues", stale: response.stale === true, ...(start.place ? { place: start.place } : {}) },
|
|
70
72
|
};
|
|
71
73
|
}
|
|
72
74
|
|
|
@@ -141,9 +143,9 @@ export const mapHeadless = {
|
|
|
141
143
|
description: "Trading venues with open status and local time, or one map layer's entities (ships, chokepoints, ports, airports, pipelines, fields, terminals) with their fields and linked tickers.",
|
|
142
144
|
argument: {
|
|
143
145
|
kind: "free-text",
|
|
144
|
-
placeholder: "layers",
|
|
146
|
+
placeholder: "layers [place or lat,lon]",
|
|
145
147
|
optional: true,
|
|
146
|
-
description: "
|
|
148
|
+
description: "Layers (ships, ports, energy, air), then an optional place or latitude,longitude; home area when no place is given.",
|
|
147
149
|
},
|
|
148
150
|
options: [
|
|
149
151
|
{ key: "layer", aliases: ["layers"], settingKey: "layers", description: "Layer id or group to list, such as vessels or energy.", type: "string" },
|
|
@@ -156,18 +158,27 @@ export const mapHeadless = {
|
|
|
156
158
|
screenshotReadiness: "ready",
|
|
157
159
|
},
|
|
158
160
|
describe: (args, result) => {
|
|
159
|
-
const tokens = parseLayerTokens(args.options.layer
|
|
160
|
-
|
|
161
|
+
const tokens = parseLayerTokens(args.options.layer).length ? parseLayerTokens(args.options.layer) : parseMapPreset(typeof args.argument === "string" ? args.argument : "")?.layers ?? [];
|
|
162
|
+
const place = result?.metadata?.place as { label?: string } | undefined;
|
|
163
|
+
const near = place?.label ? ` | near ${place.label}` : "";
|
|
164
|
+
if (!tokens.length) return `World Map | venues${near}`;
|
|
161
165
|
// A layer of 7-day sums names the week they end on, which its source line dates without saying so.
|
|
162
166
|
const weekEnding = typeof result?.metadata?.weekEnding === "string" ? ` | week ending ${formatUtcDayTime({ time: Date.parse(result.metadata.weekEnding), dateOnly: true })}` : "";
|
|
163
|
-
return `World Map | ${tokens.join(", ")}${weekEnding}`;
|
|
167
|
+
return `World Map | ${tokens.join(", ")}${near}${weekEnding}`;
|
|
164
168
|
},
|
|
165
169
|
async load(args, context) {
|
|
166
170
|
const query = typeof args.options.query === "string" ? args.options.query : "";
|
|
167
|
-
const tokens = tokensFor(args, context.settings);
|
|
168
|
-
if (!tokens.length) return venueRows(context, query);
|
|
169
171
|
const request = contextGeoRequest(context);
|
|
170
172
|
const catalog = await loadGeoCatalog(request, { signal: context.signal });
|
|
173
|
+
const tokens = tokensFor(args, context.settings, catalog?.layers ?? []);
|
|
174
|
+
const typedPlace = parseMapPreset(typeof args.argument === "string" ? args.argument : "", catalog?.layers)?.place
|
|
175
|
+
?? (typeof context.settings?.place === "string" ? context.settings.place : mapHomeArea(context.config));
|
|
176
|
+
const start = await resolveMapPlace(typedPlace, {
|
|
177
|
+
request,
|
|
178
|
+
signal: context.signal,
|
|
179
|
+
venues: async () => (await context.apiClient.getCloudWorldVenues()).data?.venues ?? [],
|
|
180
|
+
});
|
|
181
|
+
if (!tokens.length) return venueRows(context, query, start);
|
|
171
182
|
const layers = resolveActiveLayers(tokens, catalog?.layers);
|
|
172
183
|
const layer = layers[0];
|
|
173
184
|
if (!layer) {
|
|
@@ -177,9 +188,9 @@ export const mapHeadless = {
|
|
|
177
188
|
const limit = typeof args.options.limit === "number" ? args.options.limit : 100;
|
|
178
189
|
const page = layer.status === "unavailable"
|
|
179
190
|
? { rows: [], total: 0, asOf: null, columns: layer.columns }
|
|
180
|
-
: await getGeoEntities(request, layer.id, { q: query, limit }, context.signal);
|
|
191
|
+
: await getGeoEntities(request, layer.id, { q: query, limit, ...(start.place ? { bbox: mapPlaceBbox(start.place) } : {}) }, context.signal);
|
|
181
192
|
const columns = page.columns?.length ? page.columns : layer.columns;
|
|
182
|
-
const rows: HeadlessPaneRow[] = page.rows.map((row) => ({
|
|
193
|
+
const rows: HeadlessPaneRow[] = nearestPlaces(page.rows, start.place, (row) => ({ longitude: row.lon, latitude: row.lat })).map((row) => ({
|
|
183
194
|
id: row.id,
|
|
184
195
|
...Object.fromEntries(columns.map((column) => [column.key, plainGeoValue(columnValue(row, column))])),
|
|
185
196
|
ticker: row.tickers?.[0] ? tickerLinkKey(row.tickers[0]) : null,
|
|
@@ -198,7 +209,7 @@ export const mapHeadless = {
|
|
|
198
209
|
...(empty ? { empty } : {}),
|
|
199
210
|
freshness: layerFreshness(layer),
|
|
200
211
|
complete: layer.status === "ok",
|
|
201
|
-
errors: layer.status === "unavailable" ? [`${layer.name}: ${layer.statusNote ?? "unavailable"}`] : [],
|
|
212
|
+
errors: [...(start.note ? [start.note] : []), ...(layer.status === "unavailable" ? [`${layer.name}: ${layer.statusNote ?? "unavailable"}`] : [])],
|
|
202
213
|
metadata: {
|
|
203
214
|
layer: layer.id,
|
|
204
215
|
name: layer.name,
|
|
@@ -206,6 +217,7 @@ export const mapHeadless = {
|
|
|
206
217
|
status: layer.status,
|
|
207
218
|
asOf,
|
|
208
219
|
total: page.total ?? null,
|
|
220
|
+
...(start.place ? { place: start.place, bbox: mapPlaceBbox(start.place) } : {}),
|
|
209
221
|
...("totals" in page && page.totals ? { totals: page.totals } : {}),
|
|
210
222
|
...("matched" in page && page.matched ? { matched: page.matched } : {}),
|
|
211
223
|
...(weekEnding ? { weekEnding } : {}),
|