@gloom-sh/terminal 0.20.17 → 0.20.19
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/cot.ts +5 -6
- package/src/api-client/data.ts +14 -3
- package/src/api-client/heard-from.ts +72 -0
- package/src/api-client/index.ts +64 -6
- package/src/api-client/mna.ts +18 -0
- package/src/api-client/request.ts +162 -40
- package/src/api-client/supply-chain.ts +9 -0
- package/src/api-client/types/billing.ts +35 -1
- package/src/api-client/types/news.ts +45 -0
- package/src/api-client/types/world-venues.ts +9 -0
- package/src/app/global-shortcuts.ts +5 -3
- package/src/app/pro-welcome/keys.ts +27 -0
- package/src/app/pro-welcome/model.ts +158 -0
- package/src/app/pro-welcome/row.tsx +176 -0
- package/src/app/pro-welcome/use-pro-welcome.ts +156 -0
- package/src/app/runtime/external-profile-changes.ts +135 -0
- package/src/app.tsx +37 -4
- package/src/architecture/core-builtin-allowlist.json +1 -1
- package/src/architecture/floating-promise-allowlist.json +1 -2
- package/src/architecture/shortcut-labels-allowlist.json +1 -0
- package/src/cli/alert-listing.ts +98 -0
- package/src/cli/commands/market.ts +191 -39
- 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/commands/ticker.ts +13 -6
- package/src/cli/context.ts +24 -5
- package/src/cli/csv-export.ts +2 -1
- package/src/cli/desktop-pane-shot-browser.ts +3 -1
- package/src/cli/desktop-pane-shot-view.ts +0 -1
- package/src/cli/desktop-pane-shot.ts +276 -52
- package/src/cli/errors.ts +3 -9
- package/src/cli/exit-codes.ts +1 -1
- package/src/cli/glossary.ts +65 -11
- package/src/cli/help.ts +1 -1
- package/src/cli/history-demergers.ts +117 -0
- package/src/cli/history-rows.ts +8 -4
- package/src/cli/index.ts +2 -1
- package/src/cli/known-gaps.ts +16 -0
- package/src/cli/known-us-stocks.ts +18 -0
- package/src/cli/listing-arg.ts +192 -38
- package/src/cli/pane-functions/catalog-snapshot-build.ts +83 -0
- package/src/cli/pane-functions/catalog-snapshot.json +877 -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 +54 -8
- package/src/cli/pane-functions/freshness.ts +39 -4
- package/src/cli/pane-functions/function-help.ts +3 -3
- package/src/cli/pane-functions/headless.ts +9 -1
- package/src/cli/pane-functions/index.ts +175 -50
- package/src/cli/pane-functions/report-notices.ts +10 -0
- package/src/cli/pane-functions/resolver.ts +11 -7
- package/src/cli/pane-functions/screenshot-assessment.ts +38 -10
- package/src/cli/pane-functions/screenshot-data-evidence.ts +7 -15
- package/src/cli/pane-functions/screenshot-payload.ts +36 -1
- package/src/cli/pane-functions/screenshot-render.ts +24 -9
- package/src/cli/pane-functions/screenshot-types.ts +9 -0
- package/src/cli/quote-answer.ts +33 -17
- package/src/cli/registry.ts +22 -2
- package/src/cli/result.ts +22 -4
- package/src/cli/scroll-truncation.ts +7 -2
- package/src/cli/series-search.ts +45 -6
- package/src/cli/shot-temp-dir.ts +4 -9
- package/src/cli/ticker-resolution.ts +1 -1
- package/src/cli/unreachable.ts +21 -0
- package/src/components/chart/composite/drawing-store.ts +11 -7
- package/src/components/chart/composite/format.ts +1 -0
- package/src/components/chart/composite/legend.tsx +48 -20
- package/src/components/chart/composite/panel-surface/panel-cursor.tsx +3 -3
- package/src/components/chart/composite/panel-surface/plot-gestures.ts +9 -2
- package/src/components/chart/composite/panel-surface.tsx +1 -1
- package/src/components/chart/composite/price-axis-labels.tsx +7 -5
- package/src/components/chart/composite/tools.ts +164 -39
- package/src/components/chart-table/header.tsx +11 -2
- package/src/components/chart-table/layout.ts +16 -17
- 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 +19 -4
- package/src/components/command-bar/routes/ticker-search/results.ts +5 -0
- package/src/components/command-bar/routes/ticker-search/route.ts +5 -0
- package/src/components/command-bar/selection-runtime.ts +29 -5
- package/src/components/command-bar/surface/index.tsx +4 -1
- package/src/components/command-bar/workflow/alert.ts +32 -13
- 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 +123 -17
- package/src/components/layout/pane/header.tsx +16 -2
- package/src/components/layout/pane/status-footer.ts +24 -0
- 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/price-performance.tsx +26 -8
- package/src/components/reader/article-reader.tsx +12 -5
- 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/opentui/index.tsx +7 -0
- 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 +34 -2
- 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 +122 -0
- package/src/market-data/coordinator/entries.ts +6 -4
- package/src/market-data/coordinator/index.ts +14 -3
- package/src/market-data/depositary-pair.ts +6 -2
- package/src/market-data/futures-board.ts +36 -29
- package/src/market-data/futures-contract.ts +37 -1
- package/src/market-data/hooks.tsx +33 -2
- package/src/market-data/market/change-basis.ts +11 -1
- package/src/market-data/market/header-market.ts +11 -0
- package/src/market-data/market/status.ts +40 -4
- package/src/market-data/performance.ts +127 -32
- package/src/market-data/quotes/time.ts +5 -2
- package/src/market-data/split-terms.ts +28 -0
- package/src/news/types.ts +28 -0
- package/src/notifications/app-badge.ts +2 -3
- package/src/notifications/app-notifier.ts +5 -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 +101 -48
- package/src/plugins/builtin/alerts/command.ts +39 -9
- package/src/plugins/builtin/alerts/constants.ts +10 -0
- package/src/plugins/builtin/alerts/earnings-listing.ts +20 -0
- package/src/plugins/builtin/alerts/event-rows.ts +9 -3
- package/src/plugins/builtin/alerts/events-pane.tsx +16 -10
- package/src/plugins/builtin/alerts/format.ts +24 -8
- package/src/plugins/builtin/alerts/headless.ts +12 -6
- package/src/plugins/builtin/alerts/index.tsx +97 -16
- package/src/plugins/builtin/alerts/move-checks.ts +7 -0
- package/src/plugins/builtin/alerts/option-contract.ts +197 -0
- package/src/plugins/builtin/alerts/pane.tsx +1 -1
- package/src/plugins/builtin/alerts/price.ts +30 -5
- package/src/plugins/builtin/alerts/pro-rules.ts +62 -0
- package/src/plugins/builtin/alerts/quotes.ts +26 -2
- package/src/plugins/builtin/alerts/research-builder.ts +5 -10
- package/src/plugins/builtin/alerts/scheduled.ts +6 -1
- package/src/plugins/builtin/alerts/types.ts +7 -0
- package/src/plugins/builtin/analytics/account-returns.ts +1 -1
- package/src/plugins/builtin/analytics/manual-value.ts +61 -0
- package/src/plugins/builtin/analytics/pane-model.ts +2 -2
- package/src/plugins/builtin/analytics/risk-book.ts +7 -7
- package/src/plugins/builtin/analytics/risk-client.ts +27 -14
- 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/buildout/company/pane.tsx +4 -14
- package/src/plugins/builtin/catalysts/model.ts +2 -1
- 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/chart-spec.ts +5 -0
- package/src/plugins/builtin/chart-composer/cli-options.ts +9 -5
- package/src/plugins/builtin/chart-composer/data-catalog-pane.tsx +2 -6
- package/src/plugins/builtin/chart-composer/headless-schema.ts +14 -10
- package/src/plugins/builtin/chart-composer/headless.ts +2 -0
- package/src/plugins/builtin/chart-composer/index.tsx +17 -5
- package/src/plugins/builtin/chart-composer/pane.tsx +19 -6
- package/src/plugins/builtin/chart-composer/viewport-labels.ts +2 -17
- package/src/plugins/builtin/chat/controller/notifications.ts +1 -0
- package/src/plugins/builtin/chat/index.tsx +0 -1
- 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/commodities-energy/index.tsx +1 -1
- package/src/plugins/builtin/company-kpis/headless.ts +10 -5
- package/src/plugins/builtin/company-kpis/latest.ts +45 -0
- package/src/plugins/builtin/company-kpis/model.ts +57 -15
- 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/congress-trades/model.ts +9 -5
- package/src/plugins/builtin/correlation/index.tsx +13 -17
- package/src/plugins/builtin/correlation/matrix/model.ts +18 -0
- package/src/plugins/builtin/cot/client.ts +2 -3
- package/src/plugins/builtin/cot/headless.ts +16 -16
- package/src/plugins/builtin/cot/index.tsx +6 -6
- package/src/plugins/builtin/cot/model.ts +25 -5
- package/src/plugins/builtin/cot/pane.tsx +11 -6
- package/src/plugins/builtin/cot/series.ts +11 -8
- package/src/plugins/builtin/cpi/model.ts +15 -4
- package/src/plugins/builtin/cpi/pane.tsx +29 -7
- 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/doe/model.ts +30 -0
- package/src/plugins/builtin/doe/pane.tsx +8 -2
- package/src/plugins/builtin/earnings/board-table.ts +9 -4
- package/src/plugins/builtin/earnings/fiscal-quarter.ts +39 -0
- package/src/plugins/builtin/earnings/headless.ts +16 -6
- package/src/plugins/builtin/earnings/history-model.ts +6 -4
- package/src/plugins/builtin/earnings/history-table.ts +7 -4
- package/src/plugins/builtin/earnings-calls/calendar.tsx +4 -3
- package/src/plugins/builtin/earnings-calls/pane.tsx +8 -2
- package/src/plugins/builtin/earnings-ripple/pane.tsx +2 -2
- package/src/plugins/builtin/econ/calendar-model.ts +16 -0
- package/src/plugins/builtin/econ/index.tsx +7 -2
- 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/futures/model.ts +14 -1
- package/src/plugins/builtin/futures/series.ts +1 -8
- 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 +25 -7
- package/src/plugins/builtin/fx-matrix/settings.ts +9 -4
- package/src/plugins/builtin/insider/detail.tsx +36 -7
- package/src/plugins/builtin/insider/filing-stories.ts +110 -0
- package/src/plugins/builtin/insider/headless.ts +37 -2
- package/src/plugins/builtin/insider/index.tsx +79 -10
- package/src/plugins/builtin/insider/model.ts +43 -5
- package/src/plugins/builtin/ipo-calendar/client.ts +11 -1
- package/src/plugins/builtin/ipo-calendar/model.ts +3 -7
- package/src/plugins/builtin/jobs/headless.ts +2 -1
- package/src/plugins/builtin/jobs/model.ts +6 -0
- package/src/plugins/builtin/jobs/pane.tsx +8 -3
- 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/detail-view.tsx +118 -10
- package/src/plugins/builtin/news/wire/news/footer.ts +3 -8
- package/src/plugins/builtin/news/wire/news/story-evidence.ts +178 -0
- package/src/plugins/builtin/options/analytics.ts +1 -1
- package/src/plugins/builtin/options/view.tsx +18 -11
- package/src/plugins/builtin/options-positioning/model.ts +11 -0
- package/src/plugins/builtin/options-positioning/pane.tsx +22 -1
- package/src/plugins/builtin/options-scenario/client.ts +49 -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/headless.ts +7 -3
- package/src/plugins/builtin/options-scenario/model.ts +33 -2
- package/src/plugins/builtin/options-scenario/pane.tsx +3 -4
- 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/perps/cascade.ts +4 -3
- package/src/plugins/builtin/perps/markets-section.tsx +5 -2
- package/src/plugins/builtin/perps/model.ts +4 -3
- 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/portfolio-list/table.tsx +3 -2
- package/src/plugins/builtin/relative-rotation/pane.tsx +2 -3
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +33 -14
- package/src/plugins/builtin/research/event-model.ts +43 -19
- package/src/plugins/builtin/research/headless.ts +8 -1
- package/src/plugins/builtin/research/relative-valuation-pane.tsx +19 -17
- package/src/plugins/builtin/research-search/index.tsx +3 -1
- package/src/plugins/builtin/scanner/denied.tsx +16 -4
- package/src/plugins/builtin/scanner/flow-pane.tsx +1 -1
- package/src/plugins/builtin/scanner/hilo-pane.tsx +1 -1
- package/src/plugins/builtin/sec/filing-display.tsx +14 -2
- package/src/plugins/builtin/sec/headless.ts +42 -4
- package/src/plugins/builtin/sec/index.tsx +21 -1
- package/src/plugins/builtin/sectors/index.tsx +6 -9
- package/src/plugins/builtin/sectors/sector-model.ts +1 -1
- package/src/plugins/builtin/shared/cloud-upgrade.ts +1 -1
- package/src/plugins/builtin/shared/earnings-report.ts +49 -5
- package/src/plugins/builtin/shared/options-pro-copy.ts +34 -0
- package/src/plugins/builtin/shared/report-freshness.ts +2 -3
- package/src/plugins/builtin/shared/statement-currency.ts +23 -0
- package/src/plugins/builtin/shared/ticker-surface.ts +1 -1
- 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 +79 -18
- package/src/plugins/builtin/themes/headless.ts +4 -4
- package/src/plugins/builtin/themes/model.ts +11 -8
- package/src/plugins/builtin/themes/pane.tsx +2 -2
- 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/financials/model.ts +22 -32
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +7 -9
- package/src/plugins/builtin/ticker-detail/headless-schema.ts +2 -0
- package/src/plugins/builtin/ticker-detail/headless.ts +28 -12
- package/src/plugins/builtin/ticker-detail/overview/board-lot.ts +21 -0
- package/src/plugins/builtin/ticker-detail/overview/model.ts +28 -2
- package/src/plugins/builtin/ticker-detail/overview/pane.tsx +8 -0
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +68 -13
- 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 +16 -7
- 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 +32 -18
- 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/model.ts +6 -1
- 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/builtin/world-venue-map/venue-header.tsx +5 -3
- package/src/plugins/catalog-browser.ts +10 -1
- 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/browser/activity.ts +16 -0
- package/src/renderers/browser/app-badge-host.ts +14 -0
- package/src/renderers/browser/main.tsx +5 -0
- package/src/renderers/browser/notifications.ts +103 -0
- package/src/renderers/browser/ui-host.tsx +4 -0
- package/src/renderers/desktop/window-layouts.ts +14 -0
- package/src/renderers/dom/data-table/index.tsx +27 -4
- 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/http-fetch.ts +3 -2
- 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 +22 -9
- package/src/sources/gloomberb-cloud/news.ts +35 -0
- package/src/sources/gloomberb-cloud/perpetuals.ts +60 -3
- package/src/sources/provider-errors.ts +34 -7
- package/src/sources/provider-router/financials.ts +20 -13
- package/src/sources/provider-router/history.ts +32 -6
- package/src/sources/provider-router/index.ts +4 -0
- package/src/sources/provider-router/search.ts +1 -0
- package/src/sync/collections-contributor.ts +3 -1
- package/src/sync/config-merge.ts +10 -1
- package/src/sync/sanitize.ts +26 -2
- package/src/tickers/company-name-listing.ts +16 -2
- package/src/tickers/listing-fate.ts +12 -8
- package/src/tickers/renamed-listings.ts +43 -10
- package/src/tickers/search/home-listing.ts +28 -0
- package/src/tickers/search/index.ts +19 -7
- package/src/tickers/terminal-codes.ts +11 -1
- package/src/time-series/base-series.ts +39 -6
- package/src/time-series/chart-seed.ts +2 -2
- package/src/time-series/history-quality.ts +4 -1
- package/src/time-series/hooks.ts +2 -0
- package/src/time-series/price-comparison.ts +17 -23
- package/src/time-series/reporting.ts +1 -1
- package/src/time-series/resolution.ts +13 -0
- package/src/time-series/resolve-context.ts +6 -0
- package/src/time-series/resolve.ts +42 -3
- package/src/time-series/spec.ts +2 -2
- package/src/time-series/types.ts +3 -2
- package/src/types/data-provider.ts +11 -0
- package/src/types/financials.ts +48 -4
- package/src/types/headless.ts +1 -0
- package/src/types/issuer-listings.ts +2 -0
- package/src/types/plugin-notifications.ts +3 -0
- package/src/types/price-history.ts +6 -4
- package/src/types/ticker.ts +10 -2
- package/src/ui/host.tsx +2 -0
- 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/exchange-announcements.ts +7 -2
- package/src/utils/forward-dividend.ts +4 -3
- package/src/utils/fundamentals.ts +40 -0
- package/src/utils/network-failure.ts +2 -0
- package/src/utils/price-history-integrity.ts +9 -1
- 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
package/src/sync/sanitize.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { AppConfig, BrokerInstanceConfig } from "../types/config";
|
|
|
2
2
|
import type { Portfolio, TickerPosition, Watchlist } from "../types/ticker";
|
|
3
3
|
import { isRecord } from "../utils/guards";
|
|
4
4
|
import { normalizeWatchlistGroups } from "../portfolio/watchlist-groups";
|
|
5
|
+
import { portfolioCashBalances, withKeptOtherCash } from "../portfolio/cash-balances";
|
|
5
6
|
|
|
6
7
|
const SENSITIVE_KEY_PATTERN = /(token|secret|password|credential|private|api[_-]?key|access[_-]?key|refresh[_-]?key|session|cookie|dataDir|path|directory|localPath)/i;
|
|
7
8
|
|
|
@@ -57,6 +58,7 @@ export function withLocalPluginSecrets(
|
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
export function sanitizePortfolio(portfolio: Portfolio): Portfolio {
|
|
61
|
+
const [cash, ...otherCash] = portfolioCashBalances(portfolio);
|
|
60
62
|
return {
|
|
61
63
|
id: portfolio.id,
|
|
62
64
|
name: portfolio.name,
|
|
@@ -66,8 +68,10 @@ export function sanitizePortfolio(portfolio: Portfolio): Portfolio {
|
|
|
66
68
|
brokerId: portfolio.brokerId,
|
|
67
69
|
lastSyncedAt: portfolio.lastSyncedAt,
|
|
68
70
|
// Cash and targets are the user's own entries: a pulled portfolio without
|
|
69
|
-
// them would erase them on this device.
|
|
70
|
-
|
|
71
|
+
// them would erase them on this device. `cash` is the first balance, as an
|
|
72
|
+
// older build reads it, and `otherCash` the other currencies'.
|
|
73
|
+
...(cash ? { cash } : {}),
|
|
74
|
+
...(otherCash.length > 0 ? { otherCash } : {}),
|
|
71
75
|
...(portfolio.targetWeights ? { targetWeights: { ...portfolio.targetWeights } } : {}),
|
|
72
76
|
...(portfolio.importedFrom ? {
|
|
73
77
|
importedFrom: {
|
|
@@ -78,6 +82,26 @@ export function sanitizePortfolio(portfolio: Portfolio): Portfolio {
|
|
|
78
82
|
};
|
|
79
83
|
}
|
|
80
84
|
|
|
85
|
+
/**
|
|
86
|
+
* Set on every payload this build pushes with portfolios: they carry their
|
|
87
|
+
* cash in other currencies (`otherCash`), so one without it holds cash in one
|
|
88
|
+
* currency at most. An older build strips `otherCash` from every push, and
|
|
89
|
+
* its portfolios taken as they came would erase those balances here and then
|
|
90
|
+
* everywhere this device pushes to.
|
|
91
|
+
*/
|
|
92
|
+
export const PORTFOLIOS_CARRY_OTHER_CASH = "portfoliosCarryOtherCash";
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Pulled portfolios, each one an older build pushed (no
|
|
96
|
+
* `PORTFOLIOS_CARRY_OTHER_CASH`) keeping the other currencies' cash it holds
|
|
97
|
+
* here (`withKeptOtherCash`); a build that sends them is taken as it came, so
|
|
98
|
+
* a balance cleared there is cleared here.
|
|
99
|
+
*/
|
|
100
|
+
export function withLocalOtherCash(pulled: unknown[], local: readonly Portfolio[], carriesOtherCash: boolean): Portfolio[] {
|
|
101
|
+
if (carriesOtherCash) return pulled as Portfolio[];
|
|
102
|
+
return pulled.map((entry) => withKeptOtherCash(entry, isRecord(entry) ? local.find((portfolio) => portfolio.id === entry.id) : null) as Portfolio);
|
|
103
|
+
}
|
|
104
|
+
|
|
81
105
|
/**
|
|
82
106
|
* Set on every payload this build pushes with watchlists: its lists carry their
|
|
83
107
|
* groups, so one without `groups` has none. An older build's lists never carry
|
|
@@ -95,6 +95,18 @@ function homeLineQuery(typed: string): string | null {
|
|
|
95
95
|
return words.length >= 3 ? words.slice(1).join(" ") : null;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
/** A word written as a ticker: capitals and digits, short, with a class or venue mark after a dot, dash, slash or colon. */
|
|
99
|
+
const TICKER_WORD = /^\$?[A-Z0-9]{1,6}(?:[.\-/:][A-Z0-9]{1,6})*$/;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Whether every word of a line is written as a ticker (`V MCO CPRT`, `0700 0005`), as a company's name, which has
|
|
103
|
+
* words longer than a ticker or in lower case (`Turk Hava Yollari`, `TURK HAVA YOLLARI`), is not.
|
|
104
|
+
*/
|
|
105
|
+
function wordsAreTickers(typed: string): boolean {
|
|
106
|
+
const words = typed.trim().split(/\s+/).filter(Boolean);
|
|
107
|
+
return words.length > 0 && words.every((word) => TICKER_WORD.test(word));
|
|
108
|
+
}
|
|
109
|
+
|
|
98
110
|
/** A list entry with a space inside is a company's name, never a symbol: "Whirlpool Corporation". */
|
|
99
111
|
export function isCompanyNameInput(input: string): boolean {
|
|
100
112
|
return /\S\s+\S/.test(input.trim());
|
|
@@ -150,9 +162,11 @@ export async function findListingOfCompanyName(
|
|
|
150
162
|
let results = answers.flatMap((answer) => Array.isArray(answer) ? answer : []);
|
|
151
163
|
let listed = rankCompanyLines(name, results, options);
|
|
152
164
|
// A company the answers list only abroad or by receipts (Türk Hava Yolları on Frankfurt and OTC) is searched again
|
|
153
|
-
// under its later words, which can list its home line: THYAO in Istanbul.
|
|
165
|
+
// under its later words, which can list its home line: THYAO in Istanbul. A line of tickers (`V MCO CPRT`) that
|
|
166
|
+
// search found nothing for names no company, abroad or at home, so a shorter line would find nothing either.
|
|
154
167
|
const lead = listed.find((listing) => listing.namesCompany);
|
|
155
|
-
const
|
|
168
|
+
const tickersOnly = results.length === 0 && wordsAreTickers(name);
|
|
169
|
+
const again = !options.oneWord && !tickersOnly && (!lead || (!lead.home && lead.rank[3]! > 1)) ? homeLineQuery(name) : null;
|
|
156
170
|
if (again && !queries.includes(again)) {
|
|
157
171
|
const more = await searchListings(dataProvider, again);
|
|
158
172
|
if (Array.isArray(more) && more.length) {
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
} from "./ticker-changes";
|
|
20
20
|
import { isQuoteBeforeLatestSession, isQuoteStaleForCurrentSession } from "../market-data/quotes/freshness";
|
|
21
21
|
import { formatMarketPriceWithCurrency, quoteFormatOptions } from "../market-data/market/format";
|
|
22
|
-
import { canonicalExchange, isUsListingExchange, parsePublicTickerKey, resolveExchangeTimeZone } from "../utils/exchanges";
|
|
22
|
+
import { canonicalExchange, exchangeLabel, isUsListingExchange, parsePublicTickerKey, resolveExchangeTimeZone } from "../utils/exchanges";
|
|
23
23
|
import { zonedDateKey } from "../utils/zoned-date-time";
|
|
24
24
|
import { delistingLabel } from "../market-data/quotes/delisting";
|
|
25
25
|
|
|
@@ -295,19 +295,23 @@ export function isVenueAbroad(venue: string): boolean {
|
|
|
295
295
|
}
|
|
296
296
|
|
|
297
297
|
/**
|
|
298
|
-
* "
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
*
|
|
302
|
-
*
|
|
298
|
+
* "Z74 has no US listing; it trades on Singapore Exchange (SGX), in SGD." for
|
|
299
|
+
* a bare symbol the data service read on its home listing abroad, as it reads
|
|
300
|
+
* a symbol with no US listing whose listings belong to one company or fund: a
|
|
301
|
+
* row that shows the symbol as typed says which listing it is, in the words
|
|
302
|
+
* `watchlist add` says it. Null for a named or saved venue, and for a venue
|
|
303
|
+
* the app does not place outside the US (a US exchange, OTC, a futures
|
|
304
|
+
* exchange).
|
|
303
305
|
*/
|
|
304
306
|
export function bareListingNote(
|
|
305
307
|
listing: { symbol: string; request: { exchange: string } },
|
|
306
|
-
quote: Pick<Quote, "listingExchangeName" | "exchangeName"> | null | undefined,
|
|
308
|
+
quote: Pick<Quote, "listingExchangeName" | "exchangeName" | "currency"> | null | undefined,
|
|
307
309
|
): string | null {
|
|
308
310
|
if (listing.request.exchange || !quote || !/^[A-Z0-9]{1,10}$/.test(listing.symbol)) return null;
|
|
309
311
|
const venue = canonicalExchange(quote.listingExchangeName || quote.exchangeName);
|
|
310
|
-
|
|
312
|
+
if (!isVenueAbroad(venue)) return null;
|
|
313
|
+
const unit = quote.currency?.trim();
|
|
314
|
+
return `${listing.symbol} has no US listing; it trades on ${exchangeLabel(venue)}${unit ? `, in ${unit}` : ""}.`;
|
|
311
315
|
}
|
|
312
316
|
|
|
313
317
|
/** `ListingFate` from a listing's quote (null when it has none) and its ticker changes. */
|
|
@@ -16,15 +16,27 @@ export interface RenamedListing {
|
|
|
16
16
|
exchange: string;
|
|
17
17
|
/** Its name now. */
|
|
18
18
|
name: string;
|
|
19
|
-
/**
|
|
20
|
-
|
|
19
|
+
/**
|
|
20
|
+
* The names people still search for, the one it went by first: its brand, then its legal name. Empty when the
|
|
21
|
+
* old name went with another company (Tata Motors Limited is now the demerged commercial-vehicle business), so
|
|
22
|
+
* only the old symbol, never a name, leads to this line.
|
|
23
|
+
*/
|
|
24
|
+
formerNames: readonly string[];
|
|
25
|
+
/** What the old line is called in a sentence when no former name leads to it: "Tata Motors". */
|
|
26
|
+
formerLabel?: string;
|
|
27
|
+
/** How the new line is written in the app's own key (`TMPV:NSE`), where the venue's suffix is not how it is read. */
|
|
28
|
+
shownAs?: string;
|
|
21
29
|
/** The day a class that no longer trades was converted into the `to` line (YYYY-MM-DD). */
|
|
22
30
|
convertedOn?: string;
|
|
31
|
+
/** The day the venue renamed the line, when its notice says so (YYYY-MM-DD). */
|
|
32
|
+
renamedOn?: string;
|
|
33
|
+
/** A business demerged out of the line around the rename, listed on its own: the old symbol is never that company. */
|
|
34
|
+
demerged?: { symbol: string; name: string; business: string };
|
|
23
35
|
}
|
|
24
36
|
|
|
25
37
|
/** The name it went by: "Eletrobras". */
|
|
26
38
|
function renamedListingFormerName(listing: RenamedListing): string {
|
|
27
|
-
return listing.formerNames[0];
|
|
39
|
+
return listing.formerNames[0] ?? listing.formerLabel ?? listing.from;
|
|
28
40
|
}
|
|
29
41
|
|
|
30
42
|
/**
|
|
@@ -40,10 +52,22 @@ function renamedListingFormerName(listing: RenamedListing): string {
|
|
|
40
52
|
*/
|
|
41
53
|
const ELETROBRAS = ["Eletrobras", "Centrais Elétricas Brasileiras"] as const;
|
|
42
54
|
const AXIA_PREFERRED_CONVERTED = "2026-06-05";
|
|
55
|
+
/**
|
|
56
|
+
* NSE renamed Tata Motors' line, TATAMOTORS, to TMPV (Tata Motors Passenger
|
|
57
|
+
* Vehicles Limited) effective 24 Oct 2025 (NSE circular CML70875; NSE's
|
|
58
|
+
* symbol change list has the same row), and BSE renamed it the same day. The
|
|
59
|
+
* commercial-vehicle business was demerged out of it (record date 14 Oct
|
|
60
|
+
* 2025) and listed as TMCV on 12 Nov 2025; that company took the legal name
|
|
61
|
+
* Tata Motors Limited, so the old code follows the line, TMPV, never the
|
|
62
|
+
* name, and no name leads here.
|
|
63
|
+
*/
|
|
64
|
+
const TATA_MOTORS = { to: "TMPV", name: "Tata Motors Passenger Vehicles", formerNames: [], formerLabel: "Tata Motors", renamedOn: "2025-10-24" } as const;
|
|
43
65
|
const RENAMED_LISTINGS: readonly RenamedListing[] = [
|
|
44
66
|
{ from: "ELET3", to: "AXIA3", suffix: ".SA", exchange: "B3", name: "AXIA Energia", formerNames: ELETROBRAS },
|
|
45
67
|
...["ELET6", "AXIA6", "ELET5", "AXIA5"].map((from): RenamedListing => ({ from, to: "AXIA3", suffix: ".SA", exchange: "B3",
|
|
46
68
|
name: "AXIA Energia", formerNames: ELETROBRAS, convertedOn: AXIA_PREFERRED_CONVERTED })),
|
|
69
|
+
{ ...TATA_MOTORS, from: "TATAMOTORS", suffix: ".NS", exchange: "NSE", shownAs: "TMPV:NSE", demerged: { symbol: "TMCV:NSE", name: "Tata Motors Limited", business: "commercial-vehicle" } },
|
|
70
|
+
{ ...TATA_MOTORS, from: "TATAMOTORS", suffix: ".BO", exchange: "BSE", shownAs: "TMPV:BSE", demerged: { symbol: "TMCV:BSE", name: "Tata Motors Limited", business: "commercial-vehicle" } },
|
|
47
71
|
];
|
|
48
72
|
|
|
49
73
|
/** "5 Jun 2026". */
|
|
@@ -53,7 +77,7 @@ function conversionDay(date: string): string {
|
|
|
53
77
|
|
|
54
78
|
/** `AXIA3.SA`: the new listing as `quote` takes it. */
|
|
55
79
|
export function renamedListingSymbol(listing: RenamedListing): string {
|
|
56
|
-
return `${listing.to}${listing.suffix}`;
|
|
80
|
+
return listing.shownAs ?? `${listing.to}${listing.suffix}`;
|
|
57
81
|
}
|
|
58
82
|
|
|
59
83
|
/**
|
|
@@ -78,9 +102,14 @@ export function renamedListingFor(query: string): RenamedListing | null {
|
|
|
78
102
|
export function renamedListingHint(listing: RenamedListing): string {
|
|
79
103
|
const now = renamedListingSymbol(listing);
|
|
80
104
|
const named = `${now} (${listing.name}, formerly ${renamedListingFormerName(listing)})`;
|
|
81
|
-
return listing.convertedOn
|
|
82
|
-
|
|
83
|
-
|
|
105
|
+
if (listing.convertedOn) return `It was converted into ${named} on ${conversionDay(listing.convertedOn)}: \`gloom quote ${now}\`.`;
|
|
106
|
+
return `It is now ${named}${listing.demerged ? `; ${demergedClause(listing)}` : ""}: \`gloom quote ${now}\`.`;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** "its commercial-vehicle business was demerged into TMCV:NSE (Tata Motors Limited)": the company the old code is not. */
|
|
110
|
+
function demergedClause(listing: RenamedListing): string {
|
|
111
|
+
const { business, symbol, name } = listing.demerged!;
|
|
112
|
+
return `its ${business} business was demerged into ${symbol} (${name})`;
|
|
84
113
|
}
|
|
85
114
|
|
|
86
115
|
/** What search says the new line was: "Eletrobras (ELET3)", or "Eletrobras (ELET6, converted 5 Jun 2026)". */
|
|
@@ -100,7 +129,11 @@ export function renamedListingReadAs(typed: string, listing: RenamedListing): st
|
|
|
100
129
|
// A name is quoted, as every name read as a listing is; the CLI puts it back in the user's spelling.
|
|
101
130
|
const shown = listing.formerNames.some((name) => normalizeSearchText(word) === normalizeSearchText(name)) ? `"${word}"` : word;
|
|
102
131
|
const now = renamedListingSymbol(listing);
|
|
103
|
-
return listing.convertedOn
|
|
104
|
-
|
|
105
|
-
|
|
132
|
+
if (listing.convertedOn) return `Read ${shown} as ${now}: those preferred shares were converted into ${listing.name}'s common shares on ${conversionDay(listing.convertedOn)}.`;
|
|
133
|
+
// One line: the rename, and the company the old code is not.
|
|
134
|
+
if (listing.renamedOn) {
|
|
135
|
+
return `Read ${shown} as ${now}: ${listing.exchange} renamed ${listing.from} ${listing.to} (${listing.name}) on ${conversionDay(listing.renamedOn)}`
|
|
136
|
+
+ `${listing.demerged ? `; ${demergedClause(listing)}` : ""}.`;
|
|
137
|
+
}
|
|
138
|
+
return `Read ${shown} as ${now}: ${renamedListingFormerName(listing)} is ${listing.name} now.`;
|
|
106
139
|
}
|
|
@@ -267,6 +267,34 @@ export function withNamedCompanyAfterUsLead<T extends TickerSearchCandidate>(ite
|
|
|
267
267
|
return [...items.slice(0, at), ...named, ...rest];
|
|
268
268
|
}
|
|
269
269
|
|
|
270
|
+
/**
|
|
271
|
+
* The lines the service marks with the word as typed (or whose code it is) on
|
|
272
|
+
* the user's own market, ahead of every other row but the saved ones: for a
|
|
273
|
+
* desk whose market is Hong Kong (the header's Hang Seng, the default of a
|
|
274
|
+
* machine in Hong Kong), "aia" is AIA Group's 1299 before the iShares Asia 50
|
|
275
|
+
* ETF's AIA, "mtr" MTR Corporation's 0066 before Mesa Royalty Trust, "hsbc"
|
|
276
|
+
* HSBC's 0005 before its London line and its New York receipt, "catl" CATL's
|
|
277
|
+
* 3750 before Catalyst Acquisition and its Shenzhen line. Only a company's own
|
|
278
|
+
* shares on that venue lead (no receipt, fund or line quoting shares listed
|
|
279
|
+
* elsewhere), behind the saved rows the list opens with, and only for a word
|
|
280
|
+
* typed without a venue: `AIA:NASDAQ` and
|
|
281
|
+
* `AIA US` ask for that line. A market in the US changes nothing: a US ticker
|
|
282
|
+
* already leads (`withNamedCompanyAfterUsLead`).
|
|
283
|
+
*/
|
|
284
|
+
export function withHomeVenueLead<T extends TickerSearchCandidate>(items: T[], query: string, homeVenue: string | null | undefined): T[] {
|
|
285
|
+
const venue = canonicalExchange(homeVenue ?? "");
|
|
286
|
+
if (!venue || isUsListingExchange(venue) || isQualifiedTickerQuery(query)) return items;
|
|
287
|
+
const typed = normalizeTickerSymbol(query);
|
|
288
|
+
const lead = items.filter((item) => isListedEquity(item) && item.instrumentClass === "equity" && !!item.result
|
|
289
|
+
&& candidateExchange(item) === venue && listingDistance(item) === 0
|
|
290
|
+
&& (namedByService(query, item.result) || normalizeTickerSymbol(item.symbol) === typed));
|
|
291
|
+
if (lead.length === 0) return items;
|
|
292
|
+
// Behind the saved rows the list opens with.
|
|
293
|
+
const rest = items.filter((item) => !lead.includes(item));
|
|
294
|
+
const at = rest.findIndex((item) => item.kind !== "ticker" && !item.saved);
|
|
295
|
+
return at < 0 ? [...rest, ...lead] : [...rest.slice(0, at), ...lead, ...rest.slice(at)];
|
|
296
|
+
}
|
|
297
|
+
|
|
270
298
|
/** `items` with `home` moved just ahead of `lead`. */
|
|
271
299
|
function moveAhead<T>(items: readonly T[], home: T, lead: T): T[] {
|
|
272
300
|
const rest = items.filter((item) => item !== home);
|
|
@@ -41,7 +41,7 @@ import { endsInLegalForm, readNearMissListing, readVenueFirstListing, readTermin
|
|
|
41
41
|
import { isProviderBusy, ProviderBusyError, SEARCH_BUSY_MESSAGE } from "../../sources/provider-errors";
|
|
42
42
|
import { settleWithin } from "../../utils/async-deadline";
|
|
43
43
|
import { companyNameExtraWords } from "../company-name";
|
|
44
|
-
import { withFundReceiptsAsFunds, withHomeListingLead, withNamedCompanyAfterUsLead } from "./home-listing";
|
|
44
|
+
import { withFundReceiptsAsFunds, withHomeListingLead, withHomeVenueLead, withNamedCompanyAfterUsLead } from "./home-listing";
|
|
45
45
|
import { answeredInFull, rememberSearchAnswer, withKnownListings } from "./listing-index";
|
|
46
46
|
import { savedAbroadForBareSymbol, savedUsListingOf } from "./bare-symbol";
|
|
47
47
|
import { delistingLabel, parseListingWithdrawal, withdrawalLabel } from "../../market-data/quotes/delisting";
|
|
@@ -284,6 +284,7 @@ export async function searchTickerCandidates({
|
|
|
284
284
|
totalLimit = 8,
|
|
285
285
|
includeOptionContracts = true,
|
|
286
286
|
onPartial,
|
|
287
|
+
homeVenue,
|
|
287
288
|
}: {
|
|
288
289
|
query: string;
|
|
289
290
|
tickers: ReadonlyMap<string, TickerRecord>;
|
|
@@ -292,6 +293,8 @@ export async function searchTickerCandidates({
|
|
|
292
293
|
localLimit?: number;
|
|
293
294
|
totalLimit?: number;
|
|
294
295
|
includeOptionContracts?: boolean;
|
|
296
|
+
/** The venue of the user's own market, whose lines of the company a word names lead (`withHomeVenueLead`). */
|
|
297
|
+
homeVenue?: string | null;
|
|
295
298
|
/** Called when a slower, richer source improves results already returned. */
|
|
296
299
|
onPartial?: (candidates: TickerSearchCandidate[]) => void;
|
|
297
300
|
}): Promise<TickerSearchCandidate[]> {
|
|
@@ -304,6 +307,7 @@ export async function searchTickerCandidates({
|
|
|
304
307
|
totalLimit,
|
|
305
308
|
// A search that hides contracts still shows them when asked: "AAPL OPT".
|
|
306
309
|
includeOptionContracts: includeOptionContracts || parseAssetClassQuery(query)?.code === "OPT",
|
|
310
|
+
homeVenue,
|
|
307
311
|
});
|
|
308
312
|
const renamed = renamedListingFor(rawQuery);
|
|
309
313
|
const [searched, renamedRow] = await Promise.all([
|
|
@@ -339,6 +343,7 @@ export function buildTickerSearchCandidates({
|
|
|
339
343
|
localLimit = 6,
|
|
340
344
|
totalLimit = 8,
|
|
341
345
|
includeOptionContracts = true,
|
|
346
|
+
homeVenue,
|
|
342
347
|
}: {
|
|
343
348
|
query: string;
|
|
344
349
|
tickers: ReadonlyMap<string, TickerRecord>;
|
|
@@ -346,6 +351,8 @@ export function buildTickerSearchCandidates({
|
|
|
346
351
|
localLimit?: number;
|
|
347
352
|
totalLimit?: number;
|
|
348
353
|
includeOptionContracts?: boolean;
|
|
354
|
+
/** The venue of the user's own market (`homeMarketVenue`): its lines of the company a word names lead (`withHomeVenueLead`). */
|
|
355
|
+
homeVenue?: string | null;
|
|
349
356
|
}): TickerSearchCandidate[] {
|
|
350
357
|
const filteredProviderResults = includeOptionContracts
|
|
351
358
|
? providerResults
|
|
@@ -363,10 +370,10 @@ export function buildTickerSearchCandidates({
|
|
|
363
370
|
);
|
|
364
371
|
// A receipt on a fund is the fund's line, never a company's primary listing over it (HK01 on SET for the Tracker Fund).
|
|
365
372
|
const providerItems = withFundReceiptsAsFunds(createProviderTickerSearchCandidates(filteredProviderResults, tickers, candidateOptions));
|
|
366
|
-
const ranked = withNamedCompanyAfterUsLead(
|
|
373
|
+
const ranked = withHomeVenueLead(withNamedCompanyAfterUsLead(
|
|
367
374
|
withHomeListingLead(withSuccessorFirst(rankTickerSearchItems([...localItems, ...providerItems], query), query), query),
|
|
368
375
|
query,
|
|
369
|
-
);
|
|
376
|
+
), query, homeVenue);
|
|
370
377
|
return limitTickerSearchCandidates(companyListingsFirst(assignTickerSearchCategories(ranked, query), query), totalLimit, localLimit);
|
|
371
378
|
}
|
|
372
379
|
|
|
@@ -816,7 +823,7 @@ async function searchProviderResults(
|
|
|
816
823
|
};
|
|
817
824
|
let busy = false;
|
|
818
825
|
let unreachable: unknown = null;
|
|
819
|
-
|
|
826
|
+
const ask = async (searchQuery: string, index: number) => {
|
|
820
827
|
try {
|
|
821
828
|
const results = await dataProvider.search(searchQuery, {
|
|
822
829
|
...searchContext,
|
|
@@ -838,7 +845,11 @@ async function searchProviderResults(
|
|
|
838
845
|
else if (isProviderBusy(error)) busy = true;
|
|
839
846
|
else logFailure("tickers-search", "Could not search ticker spelling")(error);
|
|
840
847
|
}
|
|
841
|
-
}
|
|
848
|
+
};
|
|
849
|
+
// A share class written without its mark (BRKB for BRK.B) is guessed at beside the symbol's own search, unless the
|
|
850
|
+
// symbol is known to be a US stock: NVDA is Nvidia, and NVD-A and NVD.A are two more searches for nothing.
|
|
851
|
+
const notAsked = dataProvider.knownUsStock?.(query) ? new Set(compactShareClassAliases(query)) : new Set<string>();
|
|
852
|
+
await Promise.all(searchQueries.map((searchQuery, index) => notAsked.has(searchQuery) ? null : ask(searchQuery, index)));
|
|
842
853
|
|
|
843
854
|
// Catalogues can omit exact market symbols or return a crypto pair from a
|
|
844
855
|
// different venue. Verify the requested quote before accepting an alias.
|
|
@@ -949,12 +960,13 @@ function buildProviderSearchQueries(query: string): string[] {
|
|
|
949
960
|
|
|
950
961
|
if (!symbolLike) queries.add(trimmedQuery);
|
|
951
962
|
for (const alias of buildSymbolAliases(trimmedQuery)) queries.add(alias);
|
|
952
|
-
for (const alias of
|
|
963
|
+
for (const alias of compactShareClassAliases(trimmedQuery)) queries.add(alias);
|
|
953
964
|
queries.add(trimmedQuery);
|
|
954
965
|
return [...queries].slice(0, 4);
|
|
955
966
|
}
|
|
956
967
|
|
|
957
|
-
|
|
968
|
+
/** The share-class spellings a four or five letter code with a class letter at its end may be (NVDA: NVD-A, NVD.A). */
|
|
969
|
+
function compactShareClassAliases(query: string): string[] {
|
|
958
970
|
const normalized = normalizeTickerSymbol(query);
|
|
959
971
|
if (!/^[A-Z]{4,5}$/.test(normalized)) return [];
|
|
960
972
|
const shareClass = normalized.slice(-1);
|
|
@@ -126,15 +126,25 @@ export const BLOOMBERG_MARKETS: Readonly<Record<string, BloombergMarket>> = {
|
|
|
126
126
|
PM: { venues: [], name: "Philippine Stock Exchange" },
|
|
127
127
|
AU: at("ASX"),
|
|
128
128
|
NZ: at("NZX"),
|
|
129
|
-
CN: at("TSX", "TSXV"),
|
|
129
|
+
CN: at("TSX", "TSXV", "CSE"),
|
|
130
130
|
CT: at("TSX"),
|
|
131
131
|
CV: at("TSXV"),
|
|
132
|
+
CF: at("CSE"),
|
|
132
133
|
MM: at("BMV"),
|
|
133
134
|
BZ: at("B3"),
|
|
134
135
|
BS: at("B3"),
|
|
135
136
|
AR: at("BYMA"),
|
|
136
137
|
SJ: at("JSE"),
|
|
137
138
|
IT: at("TASE"),
|
|
139
|
+
IR: at("ICEX"),
|
|
140
|
+
TI: at("BIST"),
|
|
141
|
+
AB: { venues: ["TADAWUL"], hint: "Bloomberg and Tadawul codes differ there: type the Tadawul code, such as 2222 AB for Saudi Aramco." },
|
|
142
|
+
QD: at("QE"),
|
|
143
|
+
BI: at("BHB"),
|
|
144
|
+
DB: at("DFM"),
|
|
145
|
+
OM: at("MSX"),
|
|
146
|
+
KK: at("KUWAIT"),
|
|
147
|
+
EY: at("EGX"),
|
|
138
148
|
};
|
|
139
149
|
|
|
140
150
|
/** Bloomberg's index tickers the quote sources carry, by the symbol each is quoted as. */
|
|
@@ -35,6 +35,7 @@ import type {
|
|
|
35
35
|
ChartSeriesSpec,
|
|
36
36
|
ChartSpec,
|
|
37
37
|
ResolvedSeries,
|
|
38
|
+
TimeSeriesPoint,
|
|
38
39
|
} from "./types";
|
|
39
40
|
import { instrumentLabel } from "./resolve-context";
|
|
40
41
|
import { finiteDate } from "./chart-bounds";
|
|
@@ -130,6 +131,34 @@ function quotedInstrumentLabel(
|
|
|
130
131
|
return index && quoted && !source.instrument.instrument ? source.instrument.symbol.trim() : instrumentLabel(source);
|
|
131
132
|
}
|
|
132
133
|
|
|
134
|
+
/** A bar's move from `reference`, in percent; undefined when either is not a price. */
|
|
135
|
+
function barMovePercent(bar: TimeSeriesPoint | undefined, reference: number): number | undefined {
|
|
136
|
+
const close = bar?.close ?? bar?.value;
|
|
137
|
+
return reference > 0 && typeof close === "number" && Number.isFinite(close) ? (close / reference - 1) * 100 : undefined;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* A bar's move from the close a quote's change is measured from (its price less
|
|
142
|
+
* its change), in percent; the quote's own percent when the quote states no
|
|
143
|
+
* change or the bar no close.
|
|
144
|
+
*/
|
|
145
|
+
function barChangePercent(bar: TimeSeriesPoint | undefined, display: { price: number; change?: number; changePercent?: number }): number | undefined {
|
|
146
|
+
const reference = typeof display.change === "number" && Number.isFinite(display.change) ? display.price - display.change : Number.NaN;
|
|
147
|
+
return barMovePercent(bar, reference) ?? display.changePercent;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* A one-day chart's price series with the prior close it draws as its
|
|
152
|
+
* reference line. The legend's move is then the last bar's from that line,
|
|
153
|
+
* the price and the move read off the chart itself, as a reader checks them
|
|
154
|
+
* (`$654.41 -0.39%` beside a 656.95 line); a series with no move to show (no
|
|
155
|
+
* quote stated one) keeps none.
|
|
156
|
+
*/
|
|
157
|
+
export function withPriorClose(series: ResolvedSeries, priorClose: number): ResolvedSeries {
|
|
158
|
+
const move = series.latestChangePercent === undefined ? undefined : barMovePercent(series.points.at(-1), priorClose);
|
|
159
|
+
return { ...series, priorClose, ...move !== undefined ? { latestChangePercent: move } : {} };
|
|
160
|
+
}
|
|
161
|
+
|
|
133
162
|
export function baseSecuritySeries(
|
|
134
163
|
spec: ChartSeriesSpec,
|
|
135
164
|
financials: TickerFinancials,
|
|
@@ -226,14 +255,18 @@ export function baseSecuritySeries(
|
|
|
226
255
|
const listingExchange = canonicalExchange(marketExchange) === "SMART" || usOption
|
|
227
256
|
? canonicalExchange(sessionExchange) || (routedUsListing ? "NYSE" : marketExchange)
|
|
228
257
|
: marketExchange;
|
|
229
|
-
// The move of the price the chart ends on
|
|
230
|
-
// once it is over, as `quote`
|
|
231
|
-
//
|
|
232
|
-
|
|
258
|
+
// The move of the price the chart ends on, from the close the quote measures
|
|
259
|
+
// it from: the regular session's (its close once it is over, as `quote`
|
|
260
|
+
// heads Last), or the latest print's, an after-hours one included, where the
|
|
261
|
+
// bars run into extended hours. The legend prints it beside the last bar, so
|
|
262
|
+
// it is that bar's close against the quote's reference, one observation: a
|
|
263
|
+
// quote read a moment apart from the bars would print another price's move.
|
|
264
|
+
const display = marketField && field.unit.startsWith("currency")
|
|
233
265
|
&& !unknownBondBasis
|
|
234
266
|
&& financials.quote && hasValidQuoteObservationTime(financials.quote)
|
|
235
|
-
? (extendedHours ? getActiveQuoteDisplay(financials.quote) : getRegularSessionDisplay(financials.quote))
|
|
236
|
-
:
|
|
267
|
+
? (extendedHours ? getActiveQuoteDisplay(financials.quote) : getRegularSessionDisplay(financials.quote))
|
|
268
|
+
: null;
|
|
269
|
+
const latestChangePercent = display ? barChangePercent(points.at(-1), display) : undefined;
|
|
237
270
|
const priceIssues = valuationPriceIssues(financials, spec.source);
|
|
238
271
|
// A source with closes only, such as a generic future, has flat bars (open,
|
|
239
272
|
// high and low filled from the close): nothing to draw as candles.
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
followLatestMarketObservation,
|
|
32
32
|
latestSessionView,
|
|
33
33
|
} from "./chart-bounds";
|
|
34
|
-
import { emptyFinancials, chartCalculationSeriesIds, baseSecuritySeries } from "./base-series";
|
|
34
|
+
import { emptyFinancials, chartCalculationSeriesIds, baseSecuritySeries, withPriorClose } from "./base-series";
|
|
35
35
|
import {
|
|
36
36
|
resolvePriceHistoryIntegrity,
|
|
37
37
|
assignAxes,
|
|
@@ -106,7 +106,7 @@ export function seedChartResolutionResult(
|
|
|
106
106
|
const primary = series[0]!;
|
|
107
107
|
if (sessionView?.priorClose != null && primary.transform === "raw"
|
|
108
108
|
&& primary.unitGroup.startsWith("price") && primary.unitGroup !== "price:unknown") {
|
|
109
|
-
series[0] =
|
|
109
|
+
series[0] = withPriorClose(primary, sessionView.priorClose);
|
|
110
110
|
}
|
|
111
111
|
const resolutionSupport = support.length === series.length ? intersectChartResolutionSupport(support) : [];
|
|
112
112
|
const priceComparison = resolvePriceComparison(spec, series, bounds, resolution, spec.viewport.dateWindow,
|
|
@@ -27,7 +27,10 @@ function isIsolatedOhlcOutlier(
|
|
|
27
27
|
return false;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
const tradedWick = (point.volume ?? 0) > 0
|
|
31
|
+
&& point.open != null && point.high != null && point.low != null
|
|
32
|
+
&& point.high >= Math.max(point.open, point.close) && point.low <= Math.min(point.open, point.close);
|
|
33
|
+
return (tradedWick ? [point.open] : [point.open, point.high, point.low]).some((value) => (
|
|
31
34
|
typeof value === "number"
|
|
32
35
|
&& Number.isFinite(value)
|
|
33
36
|
&& relativeDifference(value, point.close) > ISOLATED_OHLC_OUTLIER_RATIO
|
package/src/time-series/hooks.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { getSharedRegistry } from "../plugins/registry";
|
|
|
7
7
|
import { createChartSeriesResolver } from "../capabilities";
|
|
8
8
|
import { loadFuturesPriceUnit } from "../market-data/futures-contract";
|
|
9
9
|
import { loadDailyFxCloses } from "./currency-conversion";
|
|
10
|
+
import { loadStatementCurrency } from "../plugins/builtin/shared/statement-currency";
|
|
10
11
|
import { useAppSelector } from "../state/app/context";
|
|
11
12
|
import type { FredSeriesRequest } from "../sources/gloomberb-cloud/fred-series";
|
|
12
13
|
import type { TickerRecord } from "../types/ticker";
|
|
@@ -85,6 +86,7 @@ export function useResolvedChartSpec(
|
|
|
85
86
|
capabilityRefreshMs: registeredSeriesRefreshMs,
|
|
86
87
|
loadFuturesPriceUnit: (symbol: string) => loadFuturesPriceUnit(symbol),
|
|
87
88
|
loadFxCloses: (currency: string, startDate: string) => loadDailyFxCloses(currency, startDate, apiClient),
|
|
89
|
+
...(dataProvider ? { loadStatementCurrency: (target: string, currencies: readonly string[]) => loadStatementCurrency(target, currencies, { marketData: dataProvider }) } : {}),
|
|
88
90
|
}), [capabilityInvoker, dataProvider]);
|
|
89
91
|
return useChartResolution(hydratedSpec, sources, { ...options, snapshot });
|
|
90
92
|
}
|
|
@@ -66,10 +66,9 @@ export interface PriceComparison {
|
|
|
66
66
|
export interface PriceComparisonOptions {
|
|
67
67
|
/**
|
|
68
68
|
* The chart's untouched preset range; null for authored dates or a view
|
|
69
|
-
* panned or zoomed off it. A
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
* same date a range before (periodBaseDay), as RETURN is.
|
|
69
|
+
* panned or zoomed off it. A calendar range (1W to 5Y) is measured from
|
|
70
|
+
* the close on or before the same date a range before the shared end
|
|
71
|
+
* (periodBaseDay), as RETURN is.
|
|
73
72
|
*/
|
|
74
73
|
preset?: TimeRange | null;
|
|
75
74
|
now?: number;
|
|
@@ -328,11 +327,10 @@ interface ComparedLeg {
|
|
|
328
327
|
*
|
|
329
328
|
* Calendar bars compare by session date. An untouched preset range measures
|
|
330
329
|
* each leg from its own close on or before the same date a range before the
|
|
331
|
-
*
|
|
332
|
-
*
|
|
333
|
-
*
|
|
334
|
-
*
|
|
335
|
-
* is left out with its reason and the others still compare.
|
|
330
|
+
* last shared observation (periodBaseDay), the convention RETURN and every
|
|
331
|
+
* period return share. Authored dates and a panned view use a shared base.
|
|
332
|
+
* A daily bar that is still forming is comparable only if it is forming on
|
|
333
|
+
* every leg. A leg without a usable span is left out with its reason.
|
|
336
334
|
*/
|
|
337
335
|
export function resolvePriceComparison(
|
|
338
336
|
spec: ChartSpec,
|
|
@@ -390,12 +388,16 @@ export function resolvePriceComparison(
|
|
|
390
388
|
const dayOf = (leg: ComparedLeg, key: string) => calendarBars ? key : observationDate(Number(key), leg.entry);
|
|
391
389
|
const preset = options.preset ?? null;
|
|
392
390
|
const period = !dateWindow && isReturnPeriod(preset) ? preset : null;
|
|
393
|
-
const ownEnds = preset !== null && !dateWindow;
|
|
394
391
|
const shared = (keys: (leg: ComparedLeg) => readonly string[]) => {
|
|
395
392
|
const sets = legs.map((leg) => new Set(keys(leg)));
|
|
396
393
|
return legs.length ? keys(legs[0]!).filter((key) => sets.every((set) => set.has(key))) : [];
|
|
397
394
|
};
|
|
398
395
|
const sharedWindow = shared((leg) => leg.window);
|
|
396
|
+
const isForming = (leg: ComparedLeg, key: string): boolean => calendarBars && !options.closedEnds?.has(leg.id)
|
|
397
|
+
&& (leg.points.get(key)?.partial === true || isIntradayDailyBar(sessionDay(key), legVenue(leg.entry), now));
|
|
398
|
+
const sharedEnd = resolution === "1d"
|
|
399
|
+
? sharedWindow.findLast((key) => legs.every((leg) => isForming(leg, key) === isForming(legs[0]!, key)))
|
|
400
|
+
: sharedWindow.at(-1);
|
|
399
401
|
// Authored dates (`--from 2026-10-19`) measure from the close before the first date, as RETURN does: the last
|
|
400
402
|
// date the legs share before it. Weekly and monthly bars keep the bar the window starts in.
|
|
401
403
|
const authoredFrom = !preset && dateWindow && /^\d{4}-\d{2}-\d{2}$/.test(dateWindow.start) && (resolution === "1d" || !calendarBars)
|
|
@@ -406,10 +408,7 @@ export function resolvePriceComparison(
|
|
|
406
408
|
&& legs.every((leg) => nonzero(leg, key))).at(-1)
|
|
407
409
|
: undefined;
|
|
408
410
|
const sharedStart = authoredBase ?? sharedWindow.find((key) => legs.every((leg) => nonzero(leg, key)));
|
|
409
|
-
|
|
410
|
-
const anchor = period && legs.length
|
|
411
|
-
? legs.map((leg) => calendarBars ? sessionDay(leg.window.at(-1)!) : dayOf(leg, leg.window.at(-1)!)).sort().at(-1)!
|
|
412
|
-
: null;
|
|
411
|
+
const anchor = period && sharedEnd !== undefined ? (calendarBars ? sessionDay(sharedEnd) : dayOf(legs[0]!, sharedEnd)) : null;
|
|
413
412
|
const baseDay = anchor && period ? periodBaseDay(anchor, period) : null;
|
|
414
413
|
const closeDay = (leg: ComparedLeg, key: string) => calendarBars && resolution !== "1d" ? barCloseDay(key, resolution, legVenue(leg.entry)) : key;
|
|
415
414
|
// Intraday bars share their times, so their base is the last bar the legs share on or before the base day.
|
|
@@ -426,18 +425,14 @@ export function resolvePriceComparison(
|
|
|
426
425
|
// Without a close on or before the base day (a listing younger than the range), its first close in range.
|
|
427
426
|
return base !== undefined && nonzero(leg, base) ? base : leg.window.find((key) => nonzero(leg, key));
|
|
428
427
|
};
|
|
429
|
-
const
|
|
430
|
-
// Legs that share their dates compare over two of them or not at all; a leg that runs on its own is left out alone.
|
|
431
|
-
const sharedSpan = sharedStart !== undefined && sharedEnd !== undefined && order(sharedStart, sharedEnd) < 0;
|
|
432
|
-
const compared = baseDay || ownEnds || sharedSpan ? legs.flatMap((leg) => {
|
|
428
|
+
const compared = sharedEnd === undefined ? [] : legs.flatMap((leg) => {
|
|
433
429
|
const start = startOf(leg);
|
|
434
|
-
|
|
435
|
-
if (start !== undefined && end !== undefined && order(start, end) < 0) return [{ leg, start, end }];
|
|
430
|
+
if (start !== undefined && order(start, sharedEnd) < 0) return [{ leg, start, end: sharedEnd }];
|
|
436
431
|
if (baseDay || sharedStart !== undefined) {
|
|
437
432
|
dropped.push({ seriesId: leg.id, label: leg.label, reason: start === undefined ? "no nonzero price to measure from in this range" : "only one price in this range" });
|
|
438
433
|
}
|
|
439
434
|
return [];
|
|
440
|
-
})
|
|
435
|
+
});
|
|
441
436
|
// "Left out: VIX; EWJ (only one price in this range)."
|
|
442
437
|
const droppedText = dropped.length
|
|
443
438
|
? ` Left out: ${dropped.map((entry) => reported.has(entry.seriesId) ? entry.label : `${entry.label} (${entry.reason})`).join("; ")}.`
|
|
@@ -457,9 +452,8 @@ export function resolvePriceComparison(
|
|
|
457
452
|
const currentYear = new Date(now).getUTCFullYear();
|
|
458
453
|
const legDays = Object.fromEntries(compared.map(({ leg, start, end }) => {
|
|
459
454
|
const endDay = calendarBars ? sessionDay(end) : dayOf(leg, end);
|
|
460
|
-
// A daily bar of the session still trading, or a week or month running through it.
|
|
461
455
|
return [leg.id, { baseDay: calendarBars ? sessionDay(start) : dayOf(leg, start), endDay,
|
|
462
|
-
intraday:
|
|
456
|
+
intraday: isForming(leg, end) }];
|
|
463
457
|
}));
|
|
464
458
|
const span = calendarBars
|
|
465
459
|
? (() => {
|
|
@@ -112,7 +112,7 @@ export function summarizeResolvedSeries(series: ResolvedSeries) {
|
|
|
112
112
|
startValue: null, endValue: null, return: null,
|
|
113
113
|
unit: series.rawUnit ?? series.unit,
|
|
114
114
|
pointCount: series.points.length,
|
|
115
|
-
unavailableReason: inconsistentOhlc ? "
|
|
115
|
+
unavailableReason: inconsistentOhlc ? "Contradictory prices in the selected bars."
|
|
116
116
|
: "Invalid valuation price in the selected observations.",
|
|
117
117
|
};
|
|
118
118
|
}
|
|
@@ -181,6 +181,19 @@ export function chartBarSizeParts(size: unknown): { count: number; unit: ChartBa
|
|
|
181
181
|
return canonicalBarSize(count, unit) === size ? { count, unit } : null;
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
+
const BAR_SIZE_NAMES: Readonly<Record<ManualChartResolution, string>> = {
|
|
185
|
+
"1m": "1-minute", "5m": "5-minute", "15m": "15-minute", "30m": "30-minute", "45m": "45-minute",
|
|
186
|
+
"1h": "hourly", "1d": "daily", "1wk": "weekly", "1mo": "monthly",
|
|
187
|
+
};
|
|
188
|
+
const BAR_UNIT_NAMES: Readonly<Record<ChartBarSizeUnit, string>> = { m: "minute", h: "hour", d: "day", wk: "week", mo: "month" };
|
|
189
|
+
|
|
190
|
+
/** A bar size in words, as a sentence names it: `5-minute`, `daily`, a built one `4-hour`. */
|
|
191
|
+
export function chartBarSizeName(size: ChartBarSize): string {
|
|
192
|
+
if (isManualChartResolution(size)) return BAR_SIZE_NAMES[size];
|
|
193
|
+
const parts = chartBarSizeParts(size);
|
|
194
|
+
return parts ? `${parts.count}-${BAR_UNIT_NAMES[parts.unit]}` : size;
|
|
195
|
+
}
|
|
196
|
+
|
|
184
197
|
/** A stored bar size (`4h`, `2d`, `1wk`); `auto` is not one. */
|
|
185
198
|
function isChartBarSize(value: unknown): value is ChartBarSize {
|
|
186
199
|
return chartBarSizeParts(value) !== null;
|