gloomberb 0.20.2 → 0.20.3
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/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/package.json +2 -1
- package/src/account/auth-form.tsx +13 -8
- package/src/account/upgrade-dialog.tsx +1 -1
- package/src/api-client/central-bank-rates.ts +5 -0
- package/src/api-client/data.ts +17 -4
- package/src/api-client/debt-maturities.ts +45 -2
- package/src/api-client/earnings.ts +4 -2
- package/src/api-client/errors.ts +21 -11
- package/src/api-client/index.ts +1 -0
- package/src/api-client/paths.ts +9 -1
- package/src/api-client/social-mentions.ts +47 -0
- package/src/api-client/types/econ.ts +4 -0
- package/src/app.tsx +11 -1
- package/src/cli/command-options.ts +2 -1
- package/src/cli/commands/market.ts +111 -29
- package/src/cli/commands/options-chain.ts +23 -6
- package/src/cli/commands/overview.ts +13 -5
- package/src/cli/commands/plugins.ts +49 -18
- package/src/cli/commands/search.ts +25 -6
- package/src/cli/commands/ticker.ts +4 -2
- package/src/cli/fx-quote-rate.ts +49 -1
- package/src/cli/glossary.ts +95 -15
- package/src/cli/history-rows.ts +9 -25
- package/src/cli/index.ts +6 -38
- package/src/cli/known-gaps.ts +3 -3
- package/src/cli/listing-arg.ts +78 -18
- package/src/cli/name-entries.ts +3 -2
- package/src/cli/not-a-ticker.ts +6 -2
- package/src/cli/pane-functions/capabilities.ts +12 -1
- package/src/cli/pane-functions/function-help.ts +23 -11
- package/src/cli/pane-functions/headless.ts +3 -1
- package/src/cli/pane-functions/index.ts +32 -4
- package/src/cli/pane-functions/market-session.ts +8 -3
- package/src/cli/pane-functions/resolver.ts +18 -11
- package/src/cli/pane-functions/screenshot-payload.ts +36 -6
- package/src/cli/pane-functions/screenshot-render.ts +4 -0
- package/src/cli/quote-answer.ts +10 -0
- package/src/cli/report-tables.ts +22 -2
- package/src/cli/result.ts +7 -3
- package/src/cli/spreadsheet-hint.ts +43 -0
- package/src/cli/symbol-list.ts +58 -4
- package/src/cli/symbol-rows.ts +49 -2
- package/src/cli/ticker-resolution.ts +98 -5
- package/src/cli/unknown-command.ts +88 -0
- package/src/components/command-bar/assist/model.ts +6 -1
- package/src/components/command-bar/commands/direct/index.ts +9 -1
- package/src/components/command-bar/commands/registry.ts +18 -0
- package/src/components/command-bar/pane-actions.ts +30 -13
- package/src/components/command-bar/panel/index.tsx +6 -3
- package/src/components/command-bar/panel/prompt-binding.ts +4 -0
- package/src/components/command-bar/panel/types.ts +3 -0
- package/src/components/command-bar/routes/header-market.ts +108 -0
- package/src/components/command-bar/routes/root/command-items.ts +5 -0
- package/src/components/command-bar/routes/root/provider-search.ts +190 -32
- package/src/components/command-bar/routes/root/results.ts +3 -0
- package/src/components/command-bar/routes/root/runtime.ts +28 -5
- package/src/components/command-bar/routes/ticker-search/results.ts +53 -6
- package/src/components/command-bar/routing/list-state.ts +38 -0
- package/src/components/command-bar/selection-hint.ts +28 -0
- package/src/components/command-bar/surface/index.tsx +41 -3
- package/src/components/command-bar/view-model.ts +15 -0
- package/src/components/command-bar/workflow/tickers.ts +3 -2
- package/src/components/company-logo.tsx +20 -2
- package/src/components/data-table/export.ts +13 -8
- package/src/components/feedback-dialog.tsx +2 -1
- package/src/components/form-modal/field-row.tsx +2 -1
- package/src/components/input-search-bar.tsx +2 -2
- package/src/components/layout/double-escape-close.ts +8 -5
- package/src/components/layout/header.tsx +75 -44
- package/src/components/layout/market-summary.ts +322 -116
- package/src/components/layout/pane/footer/index.tsx +26 -8
- package/src/components/layout/pane/footer/model.ts +46 -20
- package/src/components/layout/pane/header.tsx +3 -2
- package/src/components/layout/shell/chrome.ts +15 -15
- package/src/components/layout/status-bar.tsx +8 -7
- package/src/components/layout/status-widget-space.ts +8 -0
- package/src/components/markdown-editor.tsx +2 -2
- package/src/components/onboarding/account-step/form-panel.tsx +0 -3
- package/src/components/onboarding/onboarding-keyboard.ts +15 -6
- package/src/components/onboarding/onboarding-wizard.tsx +61 -11
- package/src/components/onboarding/portfolio-step/broker-fields-panel.tsx +0 -1
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +0 -2
- package/src/components/price-sparkline/model.ts +26 -10
- package/src/components/ticker/list-table-view.tsx +29 -4
- package/src/components/ui/button.tsx +13 -2
- package/src/components/ui/column-grid.tsx +18 -9
- package/src/components/ui/data-table/index.tsx +1 -1
- package/src/components/ui/data-table/opentui/index.tsx +2 -1
- package/src/components/ui/data-table/types.ts +18 -0
- package/src/components/ui/delayed-mark.tsx +3 -2
- package/src/components/ui/field-grid.tsx +0 -2
- package/src/components/ui/fields.tsx +7 -4
- package/src/components/ui/inline-quick-add.tsx +2 -2
- package/src/components/ui/key-hint-words.ts +153 -0
- package/src/components/ui/key-hints.tsx +73 -0
- package/src/components/ui/menu.tsx +3 -1
- package/src/components/ui/message-composer.tsx +2 -2
- package/src/components/ui/shortcut-hint.tsx +28 -3
- package/src/components/ui/tabs.tsx +7 -0
- package/src/components/ui/text-prompt-dialog.tsx +2 -1
- package/src/core/state/app/command-bar-launch.ts +3 -0
- package/src/data/config/store/normalize.ts +6 -0
- package/src/docs/snapshot.json +120 -69
- package/src/i18n/es.ts +24 -1
- package/src/i18n/ja.ts +24 -1
- package/src/i18n/ko.ts +24 -1
- package/src/i18n/zh-cn.ts +24 -1
- package/src/i18n/zh-tw.ts +24 -1
- package/src/layout/pane-manager/gridlock.ts +11 -0
- package/src/market-data/bars-per-year.ts +27 -9
- package/src/market-data/coordinator/quotes.ts +22 -3
- package/src/market-data/futures-board.ts +80 -0
- package/src/market-data/futures-contract.ts +9 -3
- package/src/market-data/market/change-basis.ts +2 -2
- package/src/market-data/market/dated-previous-close.ts +163 -47
- package/src/market-data/market/format.ts +14 -3
- package/src/market-data/market/freshness.ts +24 -7
- package/src/market-data/market/header-market.ts +154 -0
- package/src/market-data/market/index-level.ts +29 -0
- package/src/market-data/market/index-session-venues.ts +44 -0
- package/src/market-data/market/status.ts +7 -2
- package/src/market-data/market/venue-session.ts +72 -0
- package/src/market-data/model-dividend-yield.ts +23 -8
- package/src/market-data/options-alternatives.ts +39 -4
- package/src/market-data/published-apac-sessions.ts +40 -2
- package/src/market-data/quotes/export-identity.ts +76 -0
- package/src/market-data/quotes/freshness.ts +22 -0
- package/src/market-data/quotes/time.ts +42 -1
- package/src/market-data/realized-volatility.ts +11 -7
- package/src/market-data/tax-equivalent.ts +145 -27
- package/src/plugins/builtin/account-management/pane.tsx +2 -2
- package/src/plugins/builtin/alerts/alert-engine.ts +12 -6
- package/src/plugins/builtin/alerts/alert-log.ts +6 -2
- package/src/plugins/builtin/alerts/calendar-events.ts +74 -12
- package/src/plugins/builtin/alerts/cli-forms.ts +11 -1
- package/src/plugins/builtin/alerts/cli-move.ts +234 -0
- package/src/plugins/builtin/alerts/cli.ts +224 -33
- package/src/plugins/builtin/alerts/command.ts +33 -6
- package/src/plugins/builtin/alerts/event-rows.ts +18 -4
- package/src/plugins/builtin/alerts/events-pane.tsx +6 -2
- package/src/plugins/builtin/alerts/events.ts +9 -0
- package/src/plugins/builtin/alerts/format.ts +40 -15
- package/src/plugins/builtin/alerts/headless.ts +31 -18
- package/src/plugins/builtin/alerts/history.ts +1 -0
- package/src/plugins/builtin/alerts/index.tsx +86 -12
- package/src/plugins/builtin/alerts/live.ts +2 -1
- package/src/plugins/builtin/alerts/move-checks.ts +155 -0
- package/src/plugins/builtin/alerts/move.ts +160 -0
- package/src/plugins/builtin/alerts/pane.tsx +52 -22
- package/src/plugins/builtin/alerts/price-text.ts +62 -0
- package/src/plugins/builtin/alerts/price.ts +17 -0
- package/src/plugins/builtin/alerts/quotes.ts +84 -3
- package/src/plugins/builtin/alerts/scheduled-check.ts +7 -1
- package/src/plugins/builtin/alerts/storage.ts +20 -7
- package/src/plugins/builtin/alerts/types.ts +13 -0
- package/src/plugins/builtin/analytics/risk-client.ts +60 -39
- package/src/plugins/builtin/analytics/risk-episodes.ts +18 -0
- package/src/plugins/builtin/analytics/risk-headless.ts +20 -4
- package/src/plugins/builtin/analytics/risk-model.ts +68 -1
- package/src/plugins/builtin/analytics/risk-pane.tsx +15 -3
- package/src/plugins/builtin/backtest/engine.ts +4 -2
- package/src/plugins/builtin/backtest/window.ts +3 -1
- package/src/plugins/builtin/broker-manager/sign-in-end.ts +1 -1
- package/src/plugins/builtin/central-bank-rates/client.ts +4 -0
- package/src/plugins/builtin/central-bank-rates/headless.ts +1 -1
- package/src/plugins/builtin/central-bank-rates/model.ts +18 -8
- package/src/plugins/builtin/central-bank-rates/pane.tsx +6 -3
- package/src/plugins/builtin/chart-composer/cli-options.ts +5 -0
- package/src/plugins/builtin/chart-composer/headless-schema.ts +17 -1
- package/src/plugins/builtin/chart-composer/headless.ts +2 -0
- package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +9 -2
- package/src/plugins/builtin/crypto-board/headless.ts +82 -17
- package/src/plugins/builtin/crypto-board/index.tsx +24 -2
- package/src/plugins/builtin/crypto-board/model.ts +5 -2
- package/src/plugins/builtin/crypto-board/pane.tsx +4 -1
- package/src/plugins/builtin/debt-maturities/client.ts +111 -6
- package/src/plugins/builtin/debt-maturities/headless.ts +84 -1
- package/src/plugins/builtin/debt-maturities/model.ts +97 -14
- package/src/plugins/builtin/debt-maturities/pane.tsx +165 -15
- package/src/plugins/builtin/debt-maturities/series.ts +3 -1
- package/src/plugins/builtin/dividend-yield/client.ts +22 -6
- package/src/plugins/builtin/dividend-yield/headless.ts +113 -46
- package/src/plugins/builtin/dividend-yield/model.ts +5 -2
- package/src/plugins/builtin/dividend-yield/pane.tsx +6 -3
- package/src/plugins/builtin/dividend-yield/ranking-reads.ts +11 -4
- package/src/plugins/builtin/dividend-yield/ranking.ts +113 -18
- package/src/plugins/builtin/dividend-yield/types.ts +2 -0
- package/src/plugins/builtin/dividend-yield/view.ts +3 -0
- package/src/plugins/builtin/econ/calendar-model.ts +21 -3
- package/src/plugins/builtin/econ/detail-view.tsx +5 -3
- package/src/plugins/builtin/econ/figures.ts +13 -0
- package/src/plugins/builtin/econ/fred-catalog.ts +6 -3
- package/src/plugins/builtin/econ/index.tsx +5 -3
- package/src/plugins/builtin/econ/types.ts +5 -0
- package/src/plugins/builtin/equity-screener/footer.ts +45 -0
- package/src/plugins/builtin/equity-screener/pane.tsx +4 -18
- package/src/plugins/builtin/equity-screener/ticker-check.tsx +2 -1
- package/src/plugins/builtin/fixed-income/model.ts +1 -0
- package/src/plugins/builtin/futures/table.tsx +1 -1
- package/src/plugins/builtin/futures-curve/model.ts +3 -10
- package/src/plugins/builtin/help/function-card.tsx +2 -1
- package/src/plugins/builtin/help/function-index.ts +1 -0
- package/src/plugins/builtin/insider/client.ts +31 -14
- package/src/plugins/builtin/insider/signals-model.ts +2 -7
- package/src/plugins/builtin/iv-history/headless.ts +1 -2
- package/src/plugins/builtin/iv-history/model.ts +33 -23
- package/src/plugins/builtin/iv-history/screen-pane.tsx +0 -3
- package/src/plugins/builtin/kelly-sizer/headless.ts +64 -16
- package/src/plugins/builtin/kelly-sizer/history.ts +37 -28
- package/src/plugins/builtin/kelly-sizer/pane.tsx +43 -10
- package/src/plugins/builtin/kelly-sizer/sections.tsx +7 -2
- package/src/plugins/builtin/kelly-sizer/units.ts +29 -0
- package/src/plugins/builtin/news/index.tsx +7 -13
- package/src/plugins/builtin/news/overview-headlines.tsx +117 -0
- package/src/plugins/builtin/news/ticker-news.ts +35 -0
- package/src/plugins/builtin/news/wire/news/detail-view.tsx +8 -6
- package/src/plugins/builtin/news/wire/news/row.ts +49 -0
- package/src/plugins/builtin/news/wire/news/table.tsx +9 -20
- package/src/plugins/builtin/options/analytics.ts +7 -2
- package/src/plugins/builtin/options/live-quotes.ts +6 -1
- package/src/plugins/builtin/options/table.ts +3 -2
- package/src/plugins/builtin/options/view.tsx +11 -9
- package/src/plugins/builtin/options-scenario/client.ts +3 -0
- package/src/plugins/builtin/options-scenario/headless.ts +1 -1
- package/src/plugins/builtin/perps/client.ts +5 -4
- package/src/plugins/builtin/perps/headless.ts +134 -124
- package/src/plugins/builtin/perps/markets-section.tsx +2 -2
- package/src/plugins/builtin/perps/model.ts +8 -4
- package/src/plugins/builtin/perps/open-market.ts +4 -4
- package/src/plugins/builtin/perps/venue-markets.ts +3 -6
- package/src/plugins/builtin/portfolio-list/cell-version.ts +1 -0
- package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +34 -10
- package/src/plugins/builtin/portfolio-list/cli/period-report.ts +28 -2
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +7 -3
- package/src/plugins/builtin/portfolio-list/cli/render.ts +66 -22
- package/src/plugins/builtin/portfolio-list/grid.tsx +5 -3
- package/src/plugins/builtin/portfolio-list/pane/data.ts +34 -1
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +6 -0
- package/src/plugins/builtin/portfolio-list/pane/streaming.ts +15 -6
- package/src/plugins/builtin/portfolio-list/quick-add/resolution.ts +19 -7
- package/src/plugins/builtin/portfolio-list/table.tsx +30 -4
- package/src/plugins/builtin/realized-vol/evidence.ts +33 -6
- package/src/plugins/builtin/realized-vol/fx-proxy.ts +135 -0
- package/src/plugins/builtin/realized-vol/headless.ts +44 -8
- package/src/plugins/builtin/realized-vol/model.ts +9 -5
- package/src/plugins/builtin/realized-vol/pane.tsx +49 -15
- package/src/plugins/builtin/sec/headless.ts +48 -6
- package/src/plugins/builtin/sec/index.tsx +6 -4
- package/src/plugins/builtin/sec/model.ts +4 -1
- package/src/plugins/builtin/shared/earnings-calendar.ts +2 -0
- package/src/plugins/builtin/shared/market-cap-bands.ts +12 -0
- package/src/plugins/builtin/shared/report-freshness.ts +3 -1
- package/src/plugins/builtin/shared/use-quote-board.ts +5 -3
- package/src/plugins/builtin/shared/volatility/options.ts +63 -2
- package/src/plugins/builtin/social-mentions/headless.ts +72 -3
- package/src/plugins/builtin/social-mentions/index.tsx +8 -4
- package/src/plugins/builtin/social-mentions/lock-note.ts +6 -2
- package/src/plugins/builtin/social-mentions/outliers-client.ts +101 -0
- package/src/plugins/builtin/social-mentions/outliers-model.ts +162 -0
- package/src/plugins/builtin/social-mentions/outliers-names.ts +51 -0
- package/src/plugins/builtin/social-mentions/outliers.tsx +276 -0
- package/src/plugins/builtin/social-mentions/pane.tsx +32 -3
- package/src/plugins/builtin/supply-chain/graph-pane.tsx +2 -2
- package/src/plugins/builtin/thirteenf/api.ts +36 -2
- package/src/plugins/builtin/thirteenf/data.ts +4 -1
- package/src/plugins/builtin/thirteenf/headless.ts +14 -6
- package/src/plugins/builtin/thirteenf/model.ts +56 -1
- package/src/plugins/builtin/thirteenf/pane.tsx +8 -8
- package/src/plugins/builtin/thirteenf/report-notes.ts +11 -0
- package/src/plugins/builtin/thirteenf/table.ts +2 -1
- package/src/plugins/builtin/thirteenf/types.ts +6 -0
- package/src/plugins/builtin/ticker-detail/data-panes/historical-prices.tsx +23 -3
- package/src/plugins/builtin/ticker-detail/financials/model.ts +5 -0
- package/src/plugins/builtin/ticker-detail/headless-schema.ts +2 -1
- package/src/plugins/builtin/ticker-detail/headless.ts +21 -66
- package/src/plugins/builtin/ticker-detail/index.tsx +5 -0
- package/src/plugins/builtin/ticker-detail/overview/components.tsx +13 -1
- package/src/plugins/builtin/ticker-detail/overview/model.ts +6 -4
- package/src/plugins/builtin/ticker-detail/overview/pane.tsx +15 -0
- package/src/plugins/builtin/ticker-detail/overview/tax-equivalent.ts +69 -0
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +41 -6
- package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +47 -24
- package/src/plugins/builtin/ticker-detail/quote-monitor/export.ts +46 -0
- package/src/plugins/builtin/ticker-detail/quote-monitor/index.tsx +20 -1
- package/src/plugins/builtin/ticker-detail/quote-monitor/rows.ts +120 -0
- package/src/plugins/builtin/ticker-detail/research-tabs.ts +1 -5
- package/src/plugins/builtin/ticker-detail/settings.ts +6 -6
- package/src/plugins/builtin/treasury-auctions/cache.ts +85 -19
- package/src/plugins/builtin/treasury-auctions/index.tsx +22 -11
- package/src/plugins/builtin/treasury-auctions/model.ts +23 -0
- package/src/plugins/builtin/treasury-auctions/treasury-direct.ts +128 -0
- package/src/plugins/builtin/world-indices/client.ts +2 -0
- package/src/plugins/compat.ts +15 -0
- package/src/plugins/host-link.ts +6 -1
- package/src/plugins/installer.ts +8 -3
- package/src/portfolio/column-values.ts +14 -4
- package/src/portfolio/listed-symbol.ts +78 -0
- package/src/portfolio/real-return.ts +172 -0
- package/src/public/__snapshots__/public-api.test.ts.snap +1 -0
- package/src/renderers/browser/config-host.ts +56 -15
- package/src/renderers/browser/main.tsx +3 -1
- package/src/renderers/browser/ui-host.tsx +1 -0
- package/src/renderers/cloudflare/http-proxy.ts +1 -0
- package/src/renderers/dom/boot-frame.ts +2 -2
- package/src/renderers/dom/data-table/row.tsx +4 -1
- package/src/renderers/dom/desktop/controls.tsx +4 -4
- package/src/renderers/dom/desktop/dialog-actions.tsx +60 -41
- package/src/renderers/dom/dom-ui-host.tsx +3 -1
- package/src/renderers/dom/host/input.tsx +4 -1
- package/src/renderers/dom/host/tabs.tsx +10 -1
- package/src/renderers/dom/styles.css +33 -13
- package/src/renderers/electrobun/bun/desktop/app-name.ts +1 -1
- package/src/renderers/opentui/host.tsx +2 -1
- package/src/sources/gloomberb-cloud/fred-series.ts +12 -0
- package/src/sources/gloomberb-cloud/index.ts +31 -2
- package/src/sources/gloomberb-cloud/normalizers.ts +29 -3
- package/src/sources/provider-router/cached-routes.ts +19 -7
- package/src/state/pane-table-export-registry.ts +19 -6
- package/src/test-support/preload.ts +5 -1
- package/src/theme/colors.ts +9 -1
- package/src/theme/themes.ts +62 -15
- package/src/theme/tone-contrast.ts +40 -0
- package/src/theme/ui-tokens.ts +23 -3
- package/src/tickers/batched-lookups.ts +57 -8
- package/src/tickers/company-name-listing.ts +156 -14
- package/src/tickers/company-name.ts +30 -6
- package/src/tickers/list.ts +7 -0
- package/src/tickers/search/home-listing.ts +31 -9
- package/src/tickers/search/index.ts +13 -3
- package/src/tickers/search/listing-index.ts +558 -0
- package/src/tickers/search/major-listings.chunk.ts +10 -0
- package/src/tickers/search/major-listings.json +3346 -0
- package/src/tickers/search/ranking.ts +68 -1
- package/src/tickers/search/types.ts +4 -0
- package/src/tickers/terminal-codes.ts +26 -1
- package/src/time-series/calendar-month-returns.ts +47 -0
- package/src/time-series/currency-conversion.ts +130 -0
- package/src/time-series/hooks.ts +2 -0
- package/src/time-series/price-comparison.ts +34 -11
- package/src/time-series/resolve-context.ts +3 -0
- package/src/time-series/resolve.ts +14 -2
- package/src/time-series/spec.ts +1 -0
- package/src/time-series/studies/indicators.ts +4 -1
- package/src/time-series/types.ts +8 -0
- package/src/types/config.ts +8 -0
- package/src/types/data-provider.ts +28 -0
- package/src/types/financials.ts +20 -2
- package/src/types/headless.ts +12 -0
- package/src/ui/host.tsx +8 -0
- package/src/utils/datetime-format.ts +17 -3
- package/src/utils/display-number.ts +15 -0
- package/src/utils/double-escape-close.ts +61 -16
- package/src/utils/float32-price.ts +24 -0
- package/src/utils/forward-dividend.ts +81 -16
- package/src/utils/fx-market-hours.ts +11 -0
- package/src/utils/plugin-proxy-hosts.json +2 -1
- package/src/utils/price-history.ts +7 -6
- package/src/utils/report-timing.ts +62 -0
- package/src/utils/sec-filings.ts +32 -0
- package/src/utils/utc-time.ts +5 -0
|
@@ -21,7 +21,8 @@ import {
|
|
|
21
21
|
import { t } from "../../../../i18n";
|
|
22
22
|
import { isQuoteStaleForCurrentSession } from "../../../../market-data/quotes/freshness";
|
|
23
23
|
import { delistingLabel, delistingStateLabel } from "../../../../market-data/quotes/delisting";
|
|
24
|
-
import { formatQuoteNavAsOf } from "../../../../market-data/quotes/time";
|
|
24
|
+
import { formatQuoteNavAsOf, formatQuoteSessionAsOf } from "../../../../market-data/quotes/time";
|
|
25
|
+
import { ClippedText } from "../../../../components/ui/display";
|
|
25
26
|
import { useQuoteFlashDirection } from "../../../../components/quote-flash";
|
|
26
27
|
import { followLiveSparklinePrice } from "../../../../components/price-sparkline/model";
|
|
27
28
|
import {
|
|
@@ -62,6 +63,21 @@ function extendedLineParts(
|
|
|
62
63
|
|
|
63
64
|
const DESKTOP_DETAIL_TEXT_STYLE = { fontSize: "var(--gloom-type-ui)", lineHeight: "14px", whiteSpace: "nowrap" };
|
|
64
65
|
|
|
66
|
+
/** The desktop card's muted lines: the name under its symbol, and what the price is as of. */
|
|
67
|
+
/** 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. */
|
|
68
|
+
function backedLineStyle() {
|
|
69
|
+
return { alignSelf: "start", maxWidth: "100%", backgroundColor: colors.bg, boxShadow: `0 0 0 2px ${colors.bg}`, paddingRight: 2 };
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const DESKTOP_META_LINE_STYLE = {
|
|
73
|
+
fontSize: "var(--gloom-type-ui)",
|
|
74
|
+
lineHeight: "14px",
|
|
75
|
+
maxWidth: "100%",
|
|
76
|
+
overflow: "hidden",
|
|
77
|
+
textOverflow: "ellipsis",
|
|
78
|
+
whiteSpace: "nowrap",
|
|
79
|
+
};
|
|
80
|
+
|
|
65
81
|
function ExtendedSessionLine({
|
|
66
82
|
parts,
|
|
67
83
|
color,
|
|
@@ -170,6 +186,10 @@ export function QuoteMonitorCard({
|
|
|
170
186
|
const quoteStatus = resolveQuoteStatus(quoteEntry, symbol, quote);
|
|
171
187
|
const quoteFailed = quoteStatus.failed && !!display;
|
|
172
188
|
const navAsOf = formatQuoteNavAsOf(quote);
|
|
189
|
+
// Each card says what its own price is as of (`CLOSED · 08:09 UTC` beside `15 min delayed · 21:20 UTC`);
|
|
190
|
+
// a fund says its NAV's date instead.
|
|
191
|
+
const sessionAsOf = quoteStatus.ended ? null : formatQuoteSessionAsOf(quote);
|
|
192
|
+
const desktopAsOf = nativePaneChrome ? navAsOf ?? sessionAsOf : null;
|
|
173
193
|
const changeColor = quoteFailed ? colors.textDim : priceColor(display?.change ?? 0);
|
|
174
194
|
const flashing = !!flashDirection && !headlineHolds;
|
|
175
195
|
const currency = quote?.currency || ticker?.metadata.currency || "USD";
|
|
@@ -206,8 +226,12 @@ export function QuoteMonitorCard({
|
|
|
206
226
|
const trend = quoteTrend(display?.change);
|
|
207
227
|
const terminalSparklineHeight = !nativePaneChrome && !stacked && height >= 4 ? 2 : 1;
|
|
208
228
|
const statusRows = (quoteFailed && !compactQuoteFailure ? 1 : 0) + (navAsOf && !compactNavAsOf ? 1 : 0);
|
|
229
|
+
const headerRows = stacked ? 3 : 2;
|
|
209
230
|
const showTerminalSparkline = (!quoteFailed && !navAsOf)
|
|
210
|
-
|| height >=
|
|
231
|
+
|| height >= headerRows + statusRows + terminalSparklineHeight;
|
|
232
|
+
// The terminal gives the as-of line a row only where the card has one to spare: the sparkline keeps its rows.
|
|
233
|
+
const showTerminalSessionAsOf = !!sessionAsOf
|
|
234
|
+
&& height >= headerRows + statusRows + (perpetuals ? 1 : 0) + (showTerminalSparkline ? terminalSparklineHeight : 0) + 1;
|
|
211
235
|
// Figures sit over the sparkline, so the desktop rings them in the card colour.
|
|
212
236
|
const figureHalo = { textShadow: `0 1px 2px ${colors.bg}` };
|
|
213
237
|
// The card's title: a heading over the app's 12px name, under the 20px price.
|
|
@@ -272,7 +296,8 @@ export function QuoteMonitorCard({
|
|
|
272
296
|
display: "grid",
|
|
273
297
|
// The name gives way first; the price keeps its natural width.
|
|
274
298
|
gridTemplateColumns: "minmax(0, 1fr) auto",
|
|
275
|
-
|
|
299
|
+
// The symbol and price, what the price is as of, an extended print, the range, a perpetual.
|
|
300
|
+
gridTemplateRows: "auto auto 1fr auto auto",
|
|
276
301
|
columnGap: "var(--gloom-space-md)",
|
|
277
302
|
width: "100%",
|
|
278
303
|
height: "100%",
|
|
@@ -283,7 +308,7 @@ export function QuoteMonitorCard({
|
|
|
283
308
|
minWidth={0}
|
|
284
309
|
style={{
|
|
285
310
|
gridColumn: "1",
|
|
286
|
-
gridRow: extendedParts || endedRow ? "1" : "1 / span
|
|
311
|
+
gridRow: extendedParts || endedRow || desktopAsOf ? "1" : "1 / span 3",
|
|
287
312
|
minWidth: 0,
|
|
288
313
|
overflow: "hidden",
|
|
289
314
|
}}
|
|
@@ -297,25 +322,10 @@ export function QuoteMonitorCard({
|
|
|
297
322
|
</Text>
|
|
298
323
|
)}
|
|
299
324
|
{!quoteFailed && ticker?.metadata.name && (
|
|
300
|
-
<Text
|
|
301
|
-
fg={colors.textDim}
|
|
302
|
-
style={{
|
|
303
|
-
fontSize: "var(--gloom-type-ui)",
|
|
304
|
-
lineHeight: "14px",
|
|
305
|
-
maxWidth: "100%",
|
|
306
|
-
overflow: "hidden",
|
|
307
|
-
textOverflow: "ellipsis",
|
|
308
|
-
whiteSpace: "nowrap",
|
|
309
|
-
}}
|
|
310
|
-
>
|
|
325
|
+
<Text fg={colors.textDim} style={DESKTOP_META_LINE_STYLE}>
|
|
311
326
|
{ticker.metadata.name}
|
|
312
327
|
</Text>
|
|
313
328
|
)}
|
|
314
|
-
{navAsOf && (
|
|
315
|
-
<Text fg={colors.textDim} style={{ fontSize: "var(--gloom-type-ui)", lineHeight: "14px" }}>
|
|
316
|
-
{navAsOf}
|
|
317
|
-
</Text>
|
|
318
|
-
)}
|
|
319
329
|
</Box>
|
|
320
330
|
|
|
321
331
|
<Box
|
|
@@ -339,6 +349,16 @@ export function QuoteMonitorCard({
|
|
|
339
349
|
</Box>
|
|
340
350
|
</Box>
|
|
341
351
|
|
|
352
|
+
{desktopAsOf && (
|
|
353
|
+
// Across the card under the name and the price, so the time is never cut beside a wide price.
|
|
354
|
+
<Text
|
|
355
|
+
fg={colors.textDim}
|
|
356
|
+
style={{ ...DESKTOP_META_LINE_STYLE, gridColumn: "1 / -1", gridRow: "2", justifySelf: "start", ...backedLineStyle() }}
|
|
357
|
+
>
|
|
358
|
+
{desktopAsOf}
|
|
359
|
+
</Text>
|
|
360
|
+
)}
|
|
361
|
+
|
|
342
362
|
{endedRow && (
|
|
343
363
|
// Under the price, across the card, so the date is never cut on a narrow card;
|
|
344
364
|
// backed like the price so the sparkline does not run through it.
|
|
@@ -346,7 +366,7 @@ export function QuoteMonitorCard({
|
|
|
346
366
|
fg={colors.warning}
|
|
347
367
|
style={{
|
|
348
368
|
gridColumn: "1 / -1",
|
|
349
|
-
gridRow: "
|
|
369
|
+
gridRow: "3",
|
|
350
370
|
justifySelf: "start",
|
|
351
371
|
alignSelf: "start",
|
|
352
372
|
fontSize: "var(--gloom-type-ui)",
|
|
@@ -368,7 +388,7 @@ export function QuoteMonitorCard({
|
|
|
368
388
|
dim={extendedDim}
|
|
369
389
|
desktopStyle={{
|
|
370
390
|
gridColumn: "1 / -1",
|
|
371
|
-
gridRow: "
|
|
391
|
+
gridRow: "3",
|
|
372
392
|
justifySelf: "start",
|
|
373
393
|
alignSelf: "start",
|
|
374
394
|
maxWidth: "100%",
|
|
@@ -380,13 +400,13 @@ export function QuoteMonitorCard({
|
|
|
380
400
|
/>
|
|
381
401
|
)}
|
|
382
402
|
|
|
383
|
-
{perpetuals && <Box style={{ gridColumn: "1 / -1", gridRow: "
|
|
403
|
+
{perpetuals && <Box style={{ gridColumn: "1 / -1", gridRow: "5", alignSelf: "end" }}>{perpetuals}</Box>}
|
|
384
404
|
{rangeLabel && (
|
|
385
405
|
<Text
|
|
386
406
|
fg={colors.textDim}
|
|
387
407
|
style={{
|
|
388
408
|
gridColumn: "2",
|
|
389
|
-
gridRow: "
|
|
409
|
+
gridRow: "4",
|
|
390
410
|
justifySelf: "end",
|
|
391
411
|
alignSelf: "end",
|
|
392
412
|
fontSize: "var(--gloom-type-ui)",
|
|
@@ -466,6 +486,9 @@ export function QuoteMonitorCard({
|
|
|
466
486
|
{navAsOf && !compactNavAsOf && (
|
|
467
487
|
<Box height={1} overflow="hidden"><Text fg={colors.textDim}>{navAsOf}</Text></Box>
|
|
468
488
|
)}
|
|
489
|
+
{showTerminalSessionAsOf && (
|
|
490
|
+
<Box height={1} overflow="hidden"><ClippedText text={sessionAsOf!} width={Math.max(1, width - 2)} fg={colors.textDim} /></Box>
|
|
491
|
+
)}
|
|
469
492
|
{perpetuals}
|
|
470
493
|
{showTerminalSparkline && <Box height={terminalSparklineHeight} flexDirection="row" alignItems="center" gap={1}>
|
|
471
494
|
<PriceSparkline
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Quote } from "../../../../types/financials";
|
|
2
|
+
import type { HeadlessPaneRow } from "../../../../types/headless";
|
|
3
|
+
import { EXCEL_CSV_BOM } from "../../../../utils/csv";
|
|
4
|
+
import { exportedListingSymbol } from "../../../../portfolio/listed-symbol";
|
|
5
|
+
import type { BrokerNameOf } from "../../../../market-data/quotes/export-identity";
|
|
6
|
+
import { exportRowsTable, renderReportCsv } from "../../../../cli/report-tables";
|
|
7
|
+
import { deriveHeadlessFreshness } from "../../../../cli/pane-functions/freshness";
|
|
8
|
+
import { quoteMonitorColumns, quoteMonitorRow } from "./rows";
|
|
9
|
+
|
|
10
|
+
export interface QuoteMonitorExportEntry {
|
|
11
|
+
/** The symbol as the board shows it (0005.HK). */
|
|
12
|
+
symbol: string;
|
|
13
|
+
/** The listing it was read as, when the board knows its venue. */
|
|
14
|
+
instrument: { symbol: string; exchange?: string } | null;
|
|
15
|
+
quote: Quote | null | undefined;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** A card with no quote: its ticker and why the row is empty, as `fn QQ` names a symbol it found nothing for. */
|
|
19
|
+
function unquotedRow(symbol: string): HeadlessPaneRow {
|
|
20
|
+
return { symbol, name: "", price: null, change: null, changePercent: null, unit: null, updatedAt: null, source: "" };
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The board's Export CSV, the file `fn QQ --csv` writes for the same tickers:
|
|
25
|
+
* each card's listing with its venue (0005:HKEX), name, Last, the change and
|
|
26
|
+
* percent change to the digits the board shows, what the move is from, its
|
|
27
|
+
* session and feed, a yield's move in bp, then its unit, source and the time
|
|
28
|
+
* its own price was observed. The closing source lines are left out, as every
|
|
29
|
+
* pane export leaves them.
|
|
30
|
+
*/
|
|
31
|
+
export function quoteMonitorCsv(entries: readonly QuoteMonitorExportEntry[], now = Date.now(), brokerName?: BrokerNameOf): string {
|
|
32
|
+
const rows = entries.map(({ symbol, instrument, quote }) => {
|
|
33
|
+
const listing = instrument ? exportedListingSymbol(instrument.symbol, instrument.exchange, quote?.instrumentType) : symbol;
|
|
34
|
+
return quote ? quoteMonitorRow(listing, quote, now, brokerName) : unquotedRow(listing);
|
|
35
|
+
});
|
|
36
|
+
const table = exportRowsTable("Quote Monitor", quoteMonitorColumns(rows), rows, { status: true, rowUnitKey: "unit" });
|
|
37
|
+
const text = (value: unknown) => typeof value === "string" ? value : null;
|
|
38
|
+
const rowIdentities = rows.map((row) => ({
|
|
39
|
+
symbolOrSeries: text(row.symbol),
|
|
40
|
+
currencyOrUnit: text(row.unit),
|
|
41
|
+
asOf: typeof row.updatedAt === "number" && Number.isFinite(row.updatedAt) ? new Date(row.updatedAt).toISOString() : null,
|
|
42
|
+
source: text(row.source),
|
|
43
|
+
}));
|
|
44
|
+
const freshness = deriveHeadlessFreshness({ shape: "rows", freshness: { datesEachVenue: true } }, { rows }, now);
|
|
45
|
+
return `${EXCEL_CSV_BOM}${renderReportCsv({ tables: [{ ...table, rowIdentities }], footer: [] }, freshness)}`;
|
|
46
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { logFailure } from "../../../../utils/log-failure";
|
|
2
2
|
import { PerpEquityRow } from "../../perps/equity-row";
|
|
3
3
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
4
|
-
import { Box, useUiCapabilities } from "../../../../ui";
|
|
4
|
+
import { Box, useRendererHost, useUiCapabilities } from "../../../../ui";
|
|
5
5
|
import type { PaneProps } from "../../../../types/plugin";
|
|
6
6
|
import { TICKER_RESEARCH_PANE_ID } from "../../../../types/config";
|
|
7
7
|
import type { QuoteSubscriptionTarget } from "../../../../types/data-provider";
|
|
@@ -21,6 +21,9 @@ import { useShortcut, type KeyEventLike } from "../../../../react/input";
|
|
|
21
21
|
import { isPlainKey } from "../../../../utils/keyboard";
|
|
22
22
|
import { QuoteMonitorCard } from "./card";
|
|
23
23
|
import { useLiveStreamingSetting } from "../../../../state/hooks/live-streaming";
|
|
24
|
+
import { registerPaneTableExporter } from "../../../../state/pane-table-export-registry";
|
|
25
|
+
import { quoteMonitorCsv } from "./export";
|
|
26
|
+
import { getSharedRegistry } from "../../../registry";
|
|
24
27
|
|
|
25
28
|
interface BoardEntry {
|
|
26
29
|
symbol: string;
|
|
@@ -176,6 +179,22 @@ export function QuoteMonitorPane({ paneId, focused, width, height }: PaneProps)
|
|
|
176
179
|
if (!coordinator || !liveStreaming || boardInstruments.length === 0) return;
|
|
177
180
|
void coordinator.loadQuotesBatch(boardInstruments).catch(logFailure("ticker-detail.quote-monitor", "Warm quote monitor board failed"));
|
|
178
181
|
}, [boardInstrumentKey, liveStreaming]);
|
|
182
|
+
// Export CSV writes the board's quotes as `fn QQ --csv` does, each card its own as-of and session.
|
|
183
|
+
const renderer = useRendererHost();
|
|
184
|
+
const exportCsvRef = useRef<() => string>(() => "");
|
|
185
|
+
exportCsvRef.current = () => quoteMonitorCsv(boardEntries.map((entry) => ({
|
|
186
|
+
symbol: entry.symbol,
|
|
187
|
+
instrument: entry.instrument,
|
|
188
|
+
quote: (entry.quoteKey ? resolveEntryData(quoteEntries.get(entry.quoteKey)) : null) ?? financialsBySymbol.get(entry.symbol)?.quote,
|
|
189
|
+
})), Date.now(), (providerId) => getSharedRegistry()?.getBrokerAdapter(providerId)?.name);
|
|
190
|
+
useEffect(() => {
|
|
191
|
+
if (!renderer.saveTextFile) return;
|
|
192
|
+
return registerPaneTableExporter(paneId, (filename) => renderer.saveTextFile!({
|
|
193
|
+
name: filename,
|
|
194
|
+
text: exportCsvRef.current(),
|
|
195
|
+
mimeType: "text/csv;charset=utf-8",
|
|
196
|
+
}));
|
|
197
|
+
}, [paneId, renderer]);
|
|
179
198
|
const { pinTicker } = usePluginTickerActions();
|
|
180
199
|
const { openPaneSettings } = usePluginAppActions();
|
|
181
200
|
const { nativePaneChrome } = useUiCapabilities();
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import type { Quote } from "../../../../types/financials";
|
|
2
|
+
import type { HeadlessPaneColumn, HeadlessPaneRow } from "../../../../types/headless";
|
|
3
|
+
import { EXTENDED_SESSION_LABELS, getQuoteSessionFields, quoteHeadlineTime, quoteSessionStateLabel, type ExtendedSession } from "../../../../market-data/market/status";
|
|
4
|
+
import { changeBasisLabel, quoteChangeBasis } from "../../../../market-data/market/change-basis";
|
|
5
|
+
import {
|
|
6
|
+
formatMarketChangeWithCurrency, formatMarketPrice, formatMarketPriceWithCurrency, resolveAssetDisplayKind, withCurrencyMinorDigits,
|
|
7
|
+
type MarketFormatOptions,
|
|
8
|
+
} from "../../../../market-data/market/format";
|
|
9
|
+
import { quoteExportFeed, quoteExportUnit, quoteSourceName, type BrokerNameOf } from "../../../../market-data/quotes/export-identity";
|
|
10
|
+
import { isYieldIndexSymbol } from "../../../../tickers/index-roots";
|
|
11
|
+
import { toBasisPoints } from "../../../../utils/basis-points";
|
|
12
|
+
import { formatPercentRaw } from "../../../../utils/format";
|
|
13
|
+
import { parsePublicTickerKey } from "../../../../utils/exchanges";
|
|
14
|
+
import { quoteFreshnessFields } from "../../shared/report-freshness";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The Quote Monitor's rows as `fn QQ` reports them and the pane's Export CSV
|
|
18
|
+
* writes them: one model, so the board's file and the CLI's agree cell for cell.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/** A price or move in the row's own currency, as the cards draw it. */
|
|
22
|
+
function quoteAmount(value: unknown, row: Record<string, unknown>, signed = false): string {
|
|
23
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return "—";
|
|
24
|
+
const currency = typeof row.currency === "string" && row.currency.trim() ? row.currency : undefined;
|
|
25
|
+
const base: MarketFormatOptions = { assetCategory: typeof row.instrumentType === "string" ? row.instrumentType : undefined,
|
|
26
|
+
priceBasis: row.priceBasis === "per-unit" || row.priceBasis === "percent-of-par" ? row.priceBasis : undefined };
|
|
27
|
+
// Par quotes keep two decimals; money pads to its currency's minor unit (none for JPY).
|
|
28
|
+
const options = base.priceBasis === "percent-of-par" ? { ...base, minimumFractionDigits: 2 } : withCurrencyMinorDigits(base, currency);
|
|
29
|
+
// A currency pair's move is written at the pair's precision, as its price is (-$0.00108 on EUR/USD 1.16023).
|
|
30
|
+
if (signed && currency && typeof row.price === "number" && resolveAssetDisplayKind(options) === "cash") {
|
|
31
|
+
return formatMarketChangeWithCurrency(value, currency, options, row.price);
|
|
32
|
+
}
|
|
33
|
+
const amount = currency
|
|
34
|
+
? formatMarketPriceWithCurrency(value, currency, options)
|
|
35
|
+
: formatMarketPrice(value, options);
|
|
36
|
+
return amount === "—" ? amount : `${signed && value >= 0 ? "+" : ""}${amount}`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function percentCell(value: unknown): string {
|
|
40
|
+
return formatPercentRaw(typeof value === "number" && Number.isFinite(value) ? value : undefined);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Last and Change are in each row's own unit, which an export names in `currency_or_unit` and leaves out of the figures.
|
|
44
|
+
// An export writes the move to the digits the board shows (-315.12, -1.27), and Last whole, as `quote --csv` does
|
|
45
|
+
// (a yield's 4.859, which the board draws 4.86); JSON keeps every figure whole.
|
|
46
|
+
const QUOTE_MONITOR_COLUMNS: HeadlessPaneColumn[] = [
|
|
47
|
+
{ key: "symbol", header: "Ticker" },
|
|
48
|
+
{ key: "name", header: "Name" },
|
|
49
|
+
{ key: "price", header: "Last", align: "right", unitKey: "unit", format: (value, row) => quoteAmount(value, row) },
|
|
50
|
+
{ key: "change", header: "Change", align: "right", unitKey: "unit", exportAsShown: true, format: (value, row) => quoteAmount(value, row, true) },
|
|
51
|
+
{ key: "changePercent", header: "Change %", align: "right", exportAsShown: true, format: percentCell },
|
|
52
|
+
];
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* What each row's figures are as of, as `quote --csv` says it: the session
|
|
56
|
+
* (CLOSED, REGULAR, PRE-MKT), whether the feed is live, delayed or stale, and
|
|
57
|
+
* what the move is from. A narrow terminal drops them before it cuts a name.
|
|
58
|
+
*/
|
|
59
|
+
const QUOTE_MONITOR_SESSION_COLUMNS: HeadlessPaneColumn[] = [
|
|
60
|
+
{ key: "changeBasis", header: "Chg Basis", optional: true, dropPriority: 1 },
|
|
61
|
+
{ key: "session", header: "Session", optional: true, dropPriority: 3 },
|
|
62
|
+
{ key: "feed", header: "Feed", optional: true, dropPriority: 2 },
|
|
63
|
+
];
|
|
64
|
+
|
|
65
|
+
/** A Cboe yield's move in basis points, the figure its card reads (+2.2bp), as `quote --csv` exports it. */
|
|
66
|
+
const CHANGE_BP_COLUMN: HeadlessPaneColumn = {
|
|
67
|
+
key: "changeBasisPoints", header: "Chg bp", align: "right", optional: true, dropPriority: 0,
|
|
68
|
+
format: (value) => typeof value === "number" && Number.isFinite(value) ? `${value >= 0 ? "+" : ""}${value.toFixed(1)}` : "",
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/** The pre-market, after-hours or overnight print and its move from the regular close, for the rows that have one. */
|
|
72
|
+
function extendedSessionColumn(session: ExtendedSession): HeadlessPaneColumn {
|
|
73
|
+
return {
|
|
74
|
+
key: "extendedPrice", header: EXTENDED_SESSION_LABELS[session], align: "right",
|
|
75
|
+
format: (value, row) => row.extendedSession === session
|
|
76
|
+
? `${quoteAmount(value, row)} ${percentCell(row.extendedChangePercent)}`
|
|
77
|
+
: "—",
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** Every column a board's rows draw: an extended session's only when a row has its print, Chg bp only beside a yield. */
|
|
82
|
+
export function quoteMonitorColumns(rows: readonly HeadlessPaneRow[]): HeadlessPaneColumn[] {
|
|
83
|
+
const extended = (["PRE", "POST", "OVERNIGHT"] as const)
|
|
84
|
+
.filter((session) => rows.some((row) => row.extendedSession === session))
|
|
85
|
+
.map(extendedSessionColumn);
|
|
86
|
+
const yields = rows.some((row) => row.changeBasisPoints != null);
|
|
87
|
+
return [...QUOTE_MONITOR_COLUMNS, ...extended, ...QUOTE_MONITOR_SESSION_COLUMNS, ...yields ? [CHANGE_BP_COLUMN] : []];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** The columns a board starts with, before its rows say which sessions and yields it holds. */
|
|
91
|
+
export const QUOTE_MONITOR_BASE_COLUMNS: HeadlessPaneColumn[] = [...QUOTE_MONITOR_COLUMNS, ...QUOTE_MONITOR_SESSION_COLUMNS];
|
|
92
|
+
|
|
93
|
+
/** The row fields an export reads each row's identity from: its listing, unit, source and as-of. */
|
|
94
|
+
export const QUOTE_MONITOR_ROW_KEYS = { rowSymbolKey: "symbol", rowUnitKey: "unit", rowAsOfKey: "updatedAt", rowSourceKey: "source" } as const;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* One card as a row: the regular session's Last, change and percent change,
|
|
98
|
+
* any extended print, what the move is from, the session and feed, and each
|
|
99
|
+
* row's own as-of (Hong Kong's close beside New York's), its unit and source.
|
|
100
|
+
* `symbol` is the listing with its venue (0005:HKEX).
|
|
101
|
+
*/
|
|
102
|
+
export function quoteMonitorRow(symbol: string, quote: Quote, now = Date.now(), brokerName?: BrokerNameOf): HeadlessPaneRow {
|
|
103
|
+
// As the pane's cards show them: the regular session, then any extended print from its close.
|
|
104
|
+
const { price, change, changePercent, ...extended } = getQuoteSessionFields(quote);
|
|
105
|
+
const basis = quoteChangeBasis(quote);
|
|
106
|
+
const yieldIndex = isYieldIndexSymbol(parsePublicTickerKey(symbol).symbol);
|
|
107
|
+
return {
|
|
108
|
+
symbol, name: quote.name ?? "", price, currency: quote.currency, unit: quoteExportUnit(symbol, quote),
|
|
109
|
+
...(quote.instrumentType ? { instrumentType: quote.instrumentType } : {}),
|
|
110
|
+
...(quote.priceBasis ? { priceBasis: quote.priceBasis } : {}),
|
|
111
|
+
change, changePercent, ...extended,
|
|
112
|
+
...(yieldIndex && change != null && Number.isFinite(change) ? { changeBasisPoints: toBasisPoints(change, 1) } : {}),
|
|
113
|
+
session: quoteSessionStateLabel(quote, now) ?? "",
|
|
114
|
+
feed: quoteExportFeed(quote, now),
|
|
115
|
+
changeBasis: basis ? changeBasisLabel(basis, now) : "",
|
|
116
|
+
source: quoteSourceName(quote, brokerName),
|
|
117
|
+
marketCap: quote.marketCap ?? null, updatedAt: quoteHeadlineTime(quote),
|
|
118
|
+
...quoteFreshnessFields(quote, now),
|
|
119
|
+
};
|
|
120
|
+
}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import type { TickerFinancials } from "../../../types/financials";
|
|
2
1
|
import type { TickerResearchTabDef } from "../../../types/plugin";
|
|
3
2
|
import { FinancialsResearchTab } from "./financials/pane";
|
|
4
3
|
import { OverviewResearchTab } from "./overview/pane";
|
|
5
4
|
import { AdrPairResearchTab } from "./adr-pair/tab";
|
|
6
5
|
import { ADR_PAIR_TAB_ID } from "./adr-pair/model";
|
|
7
6
|
import { listingDepositaryPair } from "../../../market-data/depositary-pair";
|
|
8
|
-
|
|
9
|
-
function hasStatementFinancials(financials: TickerFinancials | null | undefined): boolean {
|
|
10
|
-
return (financials?.annualStatements.length ?? 0) > 0 || (financials?.quarterlyStatements.length ?? 0) > 0;
|
|
11
|
-
}
|
|
7
|
+
import { hasStatementFinancials } from "./financials/model";
|
|
12
8
|
|
|
13
9
|
/**
|
|
14
10
|
* Tabs this module owns. They are registered through `setup()` like any other
|
|
@@ -4,7 +4,7 @@ import type { TickerRecord } from "../../../types/ticker";
|
|
|
4
4
|
import type { AppConfig } from "../../../types/config";
|
|
5
5
|
import type { PriceSparklinePeriod } from "../../../components/price-sparkline/view";
|
|
6
6
|
import { getSharedRegistry } from "../../registry";
|
|
7
|
-
import { formatTickerListInput,
|
|
7
|
+
import { formatTickerListInput, parseTickerListInput, QUOTE_MONITOR_MAX_TICKERS } from "../../../tickers/list";
|
|
8
8
|
import { resolveTickerInstrumentKind } from "../../../tickers/instrument-kind";
|
|
9
9
|
import { groupTickerResearchTabs, type TickerResearchTabSummary } from "./research-groups";
|
|
10
10
|
|
|
@@ -95,9 +95,9 @@ function coerceQuoteMonitorSymbols(value: unknown): string[] {
|
|
|
95
95
|
if (!Array.isArray(value)) return [];
|
|
96
96
|
const parsed = value.filter((entry): entry is string => typeof entry === "string");
|
|
97
97
|
try {
|
|
98
|
-
return parseTickerListInput(parsed.join(", "),
|
|
98
|
+
return parseTickerListInput(parsed.join(", "), QUOTE_MONITOR_MAX_TICKERS);
|
|
99
99
|
} catch {
|
|
100
|
-
return parsed.slice(0,
|
|
100
|
+
return parsed.slice(0, QUOTE_MONITOR_MAX_TICKERS);
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
|
|
@@ -118,7 +118,7 @@ export function getQuoteMonitorPaneSettings(
|
|
|
118
118
|
|
|
119
119
|
if (symbols.length === 0 && storedText.trim().length > 0) {
|
|
120
120
|
try {
|
|
121
|
-
symbols = parseTickerListInput(storedText,
|
|
121
|
+
symbols = parseTickerListInput(storedText, QUOTE_MONITOR_MAX_TICKERS);
|
|
122
122
|
} catch {
|
|
123
123
|
// Intentional ignore: unparseable saved ticker text falls back to the legacy symbol or the pane's ticker.
|
|
124
124
|
symbols = [];
|
|
@@ -126,7 +126,7 @@ export function getQuoteMonitorPaneSettings(
|
|
|
126
126
|
}
|
|
127
127
|
if (symbols.length === 0 && legacySymbol) {
|
|
128
128
|
try {
|
|
129
|
-
symbols = parseTickerListInput(legacySymbol,
|
|
129
|
+
symbols = parseTickerListInput(legacySymbol, QUOTE_MONITOR_MAX_TICKERS);
|
|
130
130
|
} catch {
|
|
131
131
|
symbols = [legacySymbol.toUpperCase()];
|
|
132
132
|
}
|
|
@@ -157,7 +157,7 @@ export function buildQuoteMonitorSettingsDef(settings: Record<string, unknown> |
|
|
|
157
157
|
{
|
|
158
158
|
key: "symbolsText",
|
|
159
159
|
label: "Tickers",
|
|
160
|
-
description: `Enter up to ${
|
|
160
|
+
description: `Enter up to ${QUOTE_MONITOR_MAX_TICKERS} tickers separated by commas.`,
|
|
161
161
|
type: "text",
|
|
162
162
|
placeholder: "AAPL, MSFT, NVDA",
|
|
163
163
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createPluginCache, savedCopyForTransientFailure } from "../../../data/plugin-cache";
|
|
1
|
+
import { createPluginCache, savedCopyForTransientFailure, type PluginCacheResult } from "../../../data/plugin-cache";
|
|
2
2
|
import { servedFromSavedCopy } from "../../../data/saved-copies";
|
|
3
3
|
import type { ConnectionHealthRegistry } from "../../../core/connection-health";
|
|
4
4
|
import type { PluginPersistence } from "../../../types/plugin";
|
|
@@ -6,16 +6,20 @@ import {
|
|
|
6
6
|
AUCTION_ARCHIVE_PAGE_SIZE, AUCTION_HISTORY_ALL, AUCTION_HISTORY_DAYS, AUCTION_HISTORY_START, auctionArchiveBoundary,
|
|
7
7
|
auctionWindowQuery, fetchTreasuryAuctions, type AuctionHistoryWindow, type AuctionQuery,
|
|
8
8
|
} from "./client";
|
|
9
|
+
import { mergeAuctionSources } from "./model";
|
|
10
|
+
import { DIRECT_LOOKBACK_DAYS, fetchDirectAuctions } from "./treasury-direct";
|
|
9
11
|
import type { TreasuryAuction } from "./types";
|
|
10
12
|
|
|
11
13
|
const CACHE_KIND = "treasury-auctions";
|
|
12
14
|
const CACHE_SOURCE = "treasury-fiscal-data";
|
|
15
|
+
const DIRECT_CACHE_SOURCE = "treasury-direct";
|
|
13
16
|
/**
|
|
14
17
|
* 3: every reported page was validated before this board was cached.
|
|
15
18
|
* 4: boards carry direct takedown and bill discount rates, which a v3 board lacks.
|
|
16
19
|
*/
|
|
17
20
|
const CACHE_SCHEMA_VERSION = 4;
|
|
18
21
|
export const TREASURY_FISCAL_DATA_CONNECTION_ID = "treasury-fiscal-data";
|
|
22
|
+
export const TREASURY_DIRECT_CONNECTION_ID = "treasury-direct";
|
|
19
23
|
/**
|
|
20
24
|
* Refresh the auction board hourly; the week-long expiry keeps an offline
|
|
21
25
|
* start usable without treating the cached observations as a current fetch.
|
|
@@ -53,47 +57,109 @@ const cache = createPluginCache<TreasuryAuction[]>({
|
|
|
53
57
|
const archiveCache = createPluginCache<TreasuryAuction[]>({
|
|
54
58
|
kind: CACHE_KIND, source: CACHE_SOURCE, schemaVersion: CACHE_SCHEMA_VERSION, policy: ARCHIVE_CACHE_POLICY, decode,
|
|
55
59
|
});
|
|
60
|
+
/** TreasuryDirect's last weeks and announcements, refreshed as often as the board they are merged into. */
|
|
61
|
+
const directCache = createPluginCache<TreasuryAuction[]>({
|
|
62
|
+
kind: CACHE_KIND, source: DIRECT_CACHE_SOURCE, schemaVersion: 1, policy: CACHE_POLICY, decode,
|
|
63
|
+
});
|
|
56
64
|
let connectionHealth: ConnectionHealthRegistry | null = null;
|
|
57
65
|
|
|
58
66
|
export function attachTreasuryAuctionsPersistence(next: PluginPersistence, health?: ConnectionHealthRegistry): void {
|
|
59
67
|
cache.attach(next);
|
|
60
68
|
archiveCache.attach(next);
|
|
69
|
+
directCache.attach(next);
|
|
61
70
|
connectionHealth = health ?? null;
|
|
62
71
|
}
|
|
63
72
|
|
|
64
73
|
export function resetTreasuryAuctionsPersistence(): void {
|
|
65
74
|
cache.reset();
|
|
66
75
|
archiveCache.reset();
|
|
76
|
+
directCache.reset();
|
|
67
77
|
connectionHealth = null;
|
|
68
78
|
}
|
|
69
79
|
|
|
70
80
|
type AuctionLoader = (query: AuctionQuery) => Promise<TreasuryAuction[]>;
|
|
81
|
+
/** The auctions of the last `days` days and the announced ones, from TreasuryDirect. */
|
|
82
|
+
type DirectLoader = (days: number) => Promise<TreasuryAuction[]>;
|
|
71
83
|
|
|
72
84
|
/** One walk, reported through Connections; an empty one is invalid and must never replace the last good board. */
|
|
73
|
-
function walk(
|
|
85
|
+
function walk(source: { id: string; name: string }, load: () => Promise<TreasuryAuction[]>) {
|
|
74
86
|
return async () => {
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if (auctions.length === 0) throw new Error("Treasury Fiscal Data returned no auctions");
|
|
87
|
+
const auctions = await (connectionHealth?.hasSource(source.id)
|
|
88
|
+
? connectionHealth.track(source.id, "fetchAuctions", load)
|
|
89
|
+
: load());
|
|
90
|
+
if (auctions.length === 0) throw new Error(`${source.name} returned no auctions`);
|
|
80
91
|
return auctions;
|
|
81
92
|
};
|
|
82
93
|
}
|
|
83
94
|
|
|
95
|
+
const FISCAL_DATA = { id: TREASURY_FISCAL_DATA_CONNECTION_ID, name: "Treasury Fiscal Data" };
|
|
96
|
+
const TREASURY_DIRECT = { id: TREASURY_DIRECT_CONNECTION_ID, name: "TreasuryDirect" };
|
|
97
|
+
|
|
98
|
+
/** One source's answer, or why it gave none: the other source's board stands in for it. */
|
|
99
|
+
type Answer = { read: PluginCacheResult<TreasuryAuction[]> } | { failed: unknown };
|
|
100
|
+
|
|
101
|
+
async function answer(read: Promise<PluginCacheResult<TreasuryAuction[]>>): Promise<Answer> {
|
|
102
|
+
try {
|
|
103
|
+
return { read: savedCopyForTransientFailure(await read) };
|
|
104
|
+
} catch (failed) {
|
|
105
|
+
return { failed };
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const failureMessage = (failed: unknown) => failed instanceof Error ? failed.message : String(failed);
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* The recent auctions from both sources: Fiscal Data's walk of `fiscalKey`
|
|
113
|
+
* and TreasuryDirect's last weeks and announcements, each cached and refreshed
|
|
114
|
+
* on its own, then merged (`mergeAuctionSources`). One source that gives
|
|
115
|
+
* nothing, for lack of an answer and a saved copy or for a refusal, leaves the
|
|
116
|
+
* board to the other and says so as a refresh error; both failing is Fiscal
|
|
117
|
+
* Data's failure, as before TreasuryDirect was read. With no `direct` loader
|
|
118
|
+
* (a test's stand-in for the whole board) only the first is read.
|
|
119
|
+
*/
|
|
120
|
+
async function loadRecentBoard(
|
|
121
|
+
force: boolean,
|
|
122
|
+
fiscalKey: string,
|
|
123
|
+
fiscal: () => Promise<TreasuryAuction[]>,
|
|
124
|
+
direct: { days: number; load: DirectLoader } | null,
|
|
125
|
+
from: () => string,
|
|
126
|
+
): Promise<TreasuryAuctionsResult> {
|
|
127
|
+
const [primary, supplement] = await Promise.all([
|
|
128
|
+
answer(cache.load(fiscalKey, walk(FISCAL_DATA, fiscal), { force })),
|
|
129
|
+
direct ? answer(directCache.load(`direct:${direct.days}`, walk(TREASURY_DIRECT, () => direct.load(direct.days)), { force })) : null,
|
|
130
|
+
]);
|
|
131
|
+
if ("failed" in primary && (!supplement || "failed" in supplement)) throw primary.failed;
|
|
132
|
+
|
|
133
|
+
const answers = [primary, supplement].filter((entry): entry is { read: PluginCacheResult<TreasuryAuction[]> } => !!entry && "read" in entry);
|
|
134
|
+
const failed = [primary, supplement].find((entry): entry is { failed: unknown } => !!entry && "failed" in entry);
|
|
135
|
+
const saved = answers.filter(({ read }) => read.source === "stale-fallback");
|
|
136
|
+
const refreshError = answers.find(({ read }) => read.refreshError)?.read.refreshError ?? (failed ? failureMessage(failed.failed) : undefined);
|
|
137
|
+
return {
|
|
138
|
+
auctions: mergeAuctionSources("read" in primary ? primary.read.data : [], supplement && "read" in supplement ? supplement.read.data : [], from()),
|
|
139
|
+
// The oldest part: how old what is shown can be.
|
|
140
|
+
fetchedAt: Math.min(...answers.map(({ read }) => read.fetchedAt)),
|
|
141
|
+
stale: !!failed || answers.some(({ read }) => read.stale),
|
|
142
|
+
...(saved.length ? { savedAt: Math.min(...saved.map(({ read }) => read.fetchedAt)) } : {}),
|
|
143
|
+
...(refreshError ? { refreshError } : {}),
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
|
|
84
147
|
export async function loadTreasuryAuctions(
|
|
85
148
|
force = false,
|
|
86
149
|
loader: AuctionLoader = fetchTreasuryAuctions,
|
|
87
150
|
window: AuctionHistoryWindow = AUCTION_HISTORY_DAYS,
|
|
151
|
+
// A loader of the caller's own stands for the whole board.
|
|
152
|
+
direct: DirectLoader | null = loader === fetchTreasuryAuctions ? fetchDirectAuctions : null,
|
|
88
153
|
): Promise<TreasuryAuctionsResult> {
|
|
89
|
-
if (window === AUCTION_HISTORY_ALL) return loadAllTreasuryAuctions(force, loader);
|
|
154
|
+
if (window === AUCTION_HISTORY_ALL) return loadAllTreasuryAuctions(force, loader, direct);
|
|
90
155
|
// A saved board answers only for a failure asking again may get past; a refusal or an invalid page is the error.
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
156
|
+
return answered(await loadRecentBoard(
|
|
157
|
+
force,
|
|
158
|
+
`recent:${window}`,
|
|
159
|
+
() => loader(auctionWindowQuery(window)),
|
|
160
|
+
direct && { days: Math.min(window, DIRECT_LOOKBACK_DAYS), load: direct },
|
|
161
|
+
() => auctionWindowQuery(window).from,
|
|
162
|
+
));
|
|
97
163
|
}
|
|
98
164
|
|
|
99
165
|
/** A board a saved copy answered: marked as one, so a command ends by saying when it was saved, not with its failure. */
|
|
@@ -107,18 +173,18 @@ function answered(result: TreasuryAuctionsResult): TreasuryAuctionsResult {
|
|
|
107
173
|
* a refresh only refetches what can still change. Both must load; a board
|
|
108
174
|
* missing its archive would pass for the full history.
|
|
109
175
|
*/
|
|
110
|
-
async function loadAllTreasuryAuctions(force: boolean, loader: AuctionLoader): Promise<TreasuryAuctionsResult> {
|
|
176
|
+
async function loadAllTreasuryAuctions(force: boolean, loader: AuctionLoader, direct: DirectLoader | null): Promise<TreasuryAuctionsResult> {
|
|
111
177
|
const boundary = auctionArchiveBoundary();
|
|
112
178
|
const [recent, archive] = await Promise.all([
|
|
113
|
-
|
|
114
|
-
archiveCache.load(`archive:${boundary}`, walk(
|
|
179
|
+
loadRecentBoard(force, `since:${boundary}`, () => loader({ from: boundary }), direct && { days: DIRECT_LOOKBACK_DAYS, load: direct }, () => boundary),
|
|
180
|
+
archiveCache.load(`archive:${boundary}`, walk(FISCAL_DATA, () => loader({
|
|
115
181
|
from: AUCTION_HISTORY_START, before: boundary, pageSize: AUCTION_ARCHIVE_PAGE_SIZE,
|
|
116
182
|
}))).then(savedCopyForTransientFailure),
|
|
117
183
|
]);
|
|
118
184
|
const seen = new Set<string>();
|
|
119
|
-
const auctions = [...recent.
|
|
185
|
+
const auctions = [...recent.auctions, ...archive.data].filter((auction) => !seen.has(auction.id) && Boolean(seen.add(auction.id)));
|
|
120
186
|
const refreshError = recent.refreshError ?? archive.refreshError;
|
|
121
|
-
const savedAt = Math.min(
|
|
187
|
+
const savedAt = Math.min(recent.savedAt ?? Infinity, archive.source === "stale-fallback" ? archive.fetchedAt : Infinity);
|
|
122
188
|
return answered({
|
|
123
189
|
auctions, fetchedAt: recent.fetchedAt, stale: recent.stale || archive.stale,
|
|
124
190
|
...(Number.isFinite(savedAt) ? { savedAt } : {}),
|