gloomberb 0.20.2 → 0.20.4
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-dialog.tsx +17 -0
- 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 +23 -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/fx-interventions.ts +64 -0
- package/src/api-client/index.ts +2 -0
- package/src/api-client/paths.ts +9 -1
- package/src/api-client/release-summaries.ts +21 -0
- package/src/api-client/social-mentions.ts +47 -0
- package/src/api-client/types/econ.ts +4 -0
- package/src/app/keybindings/actions.ts +2 -2
- package/src/app/pane-runtime/ticker-open-runtime.ts +245 -66
- package/src/app.tsx +11 -1
- package/src/cli/command-options.ts +2 -1
- package/src/cli/commands/market.ts +188 -30
- package/src/cli/commands/news-search.ts +1 -3
- package/src/cli/commands/options-chain.ts +23 -6
- package/src/cli/commands/overview.ts +13 -5
- package/src/cli/commands/plugins.ts +76 -23
- package/src/cli/commands/search.ts +25 -6
- package/src/cli/commands/system.ts +19 -3
- package/src/cli/commands/ticker.ts +64 -21
- 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 +14 -46
- 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 +26 -14
- 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 +40 -8
- package/src/cli/result.ts +21 -9
- 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/types.ts +2 -0
- package/src/cli/unknown-command.ts +88 -0
- package/src/components/chart/composite/axis-overlays.tsx +22 -0
- package/src/components/chart/composite/composite-chart.tsx +54 -13
- package/src/components/chart/composite/event-captions.ts +109 -0
- package/src/components/chart/composite/event-guides.ts +74 -0
- package/src/components/chart/composite/rasterizer.ts +2 -0
- package/src/components/chart/composite/text-renderer.ts +2 -0
- package/src/components/chart/composite/types.ts +31 -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/layout-items/focused-pane.ts +5 -5
- 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 +192 -33
- 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 +104 -6
- package/src/components/command-bar/routes/ticker-search/route.ts +3 -2
- 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/detached-pane-shell.tsx +1 -1
- package/src/components/layout/double-escape-close.ts +8 -5
- package/src/components/layout/floating-pane.tsx +5 -1
- 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 +44 -19
- package/src/components/layout/pane/footer/model.ts +52 -20
- package/src/components/layout/pane/header.tsx +3 -2
- package/src/components/layout/shell/action-menu-overlay.tsx +10 -5
- package/src/components/layout/shell/active-drag.ts +149 -105
- package/src/components/layout/shell/chrome.ts +15 -15
- package/src/components/layout/shell/drag/drop-zones.ts +162 -0
- package/src/components/layout/shell/drag/index.ts +47 -218
- package/src/components/layout/shell/drag/live.ts +10 -3
- package/src/components/layout/shell/drag/overlays.tsx +182 -5
- package/src/components/layout/shell/drag/runtime.ts +29 -6
- package/src/components/layout/shell/drag/shared-edges.ts +156 -0
- package/src/components/layout/shell/index.tsx +11 -6
- package/src/components/layout/shell/menu.ts +11 -2
- package/src/components/layout/shell/native/pointer-runtime.ts +25 -0
- package/src/components/layout/shell/native/window-state.ts +2 -2
- package/src/components/layout/shell/pane/layers.tsx +71 -7
- package/src/components/layout/shell/terminal-pointer-runtime.ts +18 -9
- package/src/components/layout/shell/window-mode/index.ts +8 -10
- package/src/components/layout/status-bar.tsx +8 -7
- package/src/components/layout/status-widget-space.ts +8 -0
- package/src/components/layout/window-edit/mode.ts +39 -7
- package/src/components/layout/window-edit/presentation.ts +1 -1
- 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 +19 -6
- package/src/components/onboarding/onboarding-wizard.tsx +69 -14
- 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 +15 -2
- package/src/components/ui/choice-dialog.tsx +1 -0
- package/src/components/ui/column-grid.tsx +18 -9
- package/src/components/ui/data-table/index.tsx +5 -4
- 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/list-view.tsx +7 -12
- package/src/components/ui/loading.tsx +10 -3
- package/src/components/ui/menu.tsx +9 -3
- package/src/components/ui/message-composer.tsx +2 -2
- package/src/components/ui/quote.ts +14 -1
- 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/layout.ts +5 -2
- package/src/data/config/store/normalize.ts +6 -0
- package/src/docs/snapshot.json +149 -74
- package/src/i18n/es.ts +33 -9
- package/src/i18n/ja.ts +33 -9
- package/src/i18n/ko.ts +33 -9
- package/src/i18n/zh-cn.ts +33 -9
- package/src/i18n/zh-tw.ts +33 -9
- package/src/layout/pane-manager/floating-actions.ts +17 -0
- package/src/layout/pane-manager/floating-stack.ts +187 -0
- package/src/layout/pane-manager/floating.ts +4 -2
- package/src/layout/pane-manager/gridlock.ts +16 -1
- package/src/layout/pane-manager/index.ts +11 -0
- package/src/layout/pane-manager/layout-state.ts +10 -3
- 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 +126 -1
- package/src/market-data/futures-contract.ts +21 -6
- package/src/market-data/fx-interventions.ts +270 -0
- 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/news/news-model.ts +44 -2
- 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 +223 -32
- 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 +39 -15
- package/src/plugins/builtin/alerts/headless.ts +30 -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 +161 -0
- package/src/plugins/builtin/alerts/move.ts +181 -0
- package/src/plugins/builtin/alerts/pane.tsx +50 -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 +22 -7
- package/src/plugins/builtin/alerts/types.ts +25 -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/changelog/index.tsx +292 -101
- package/src/plugins/builtin/changelog/versions.ts +293 -0
- 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/chart-composer/intervention-events.ts +105 -0
- package/src/plugins/builtin/chart-composer/pane.tsx +21 -7
- package/src/plugins/builtin/chat/message/render-state.ts +2 -5
- package/src/plugins/builtin/cloud/askg/attached-pane.tsx +10 -5
- package/src/plugins/builtin/cloud/askg/controller.ts +141 -5
- package/src/plugins/builtin/cloud/askg/executor.ts +113 -4
- package/src/plugins/builtin/cloud/askg/manifest.ts +28 -13
- package/src/plugins/builtin/cloud/askg/model.ts +14 -4
- package/src/plugins/builtin/cloud/askg/pane.tsx +70 -46
- package/src/plugins/builtin/cloud/askg/turn-parts.tsx +70 -0
- package/src/plugins/builtin/cloud/terminal-relay/engine.ts +50 -130
- package/src/plugins/builtin/cloud/terminal-relay/policy.ts +327 -7
- package/src/plugins/builtin/cloud/terminal-relay/prompts.tsx +2 -1
- package/src/plugins/builtin/cloud/terminal-relay/redact.ts +47 -6
- package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +9 -2
- package/src/plugins/builtin/commodities-energy/index.tsx +1 -3
- package/src/plugins/builtin/commodities-energy/view-state.ts +3 -0
- package/src/plugins/builtin/cot/headless.ts +14 -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/earnings/index.tsx +2 -2
- 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/index.tsx +25 -4
- package/src/plugins/builtin/futures/model.ts +28 -32
- package/src/plugins/builtin/futures/series.ts +4 -3
- package/src/plugins/builtin/futures/table.tsx +17 -10
- package/src/plugins/builtin/futures/use-board-terms.ts +3 -3
- 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/help/index.tsx +3 -3
- package/src/plugins/builtin/help/keybindings-editor.tsx +18 -4
- 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/layout-manager/index.tsx +8 -8
- package/src/plugins/builtin/news/headless.ts +2 -2
- package/src/plugins/builtin/news/index.tsx +10 -16
- 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 +7 -4
- 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/plugin-marketplace/pane.tsx +11 -11
- 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/summary/index.tsx +3 -1
- 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/research/event-model.ts +9 -1
- package/src/plugins/builtin/research/event-sources.ts +22 -0
- package/src/plugins/builtin/research/headless.ts +3 -3
- 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/cloud-upgrade.ts +27 -3
- 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 +67 -6
- 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 +69 -19
- package/src/plugins/builtin/ticker-detail/pane.tsx +7 -2
- 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 +53 -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/remote/resources.ts +12 -1
- package/src/remote/schema.ts +1 -0
- package/src/remote/semantic-helpers.ts +29 -1
- package/src/remote/semantic-tree.tsx +32 -15
- 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/cloudflare/worker.ts +16 -1
- 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 +73 -19
- package/src/renderers/electrobun/bun/desktop/app-name.ts +1 -1
- package/src/renderers/opentui/host.tsx +2 -1
- package/src/renderers/share/layout-view.tsx +1 -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/news.ts +35 -12
- package/src/sources/gloomberb-cloud/normalizers.ts +29 -3
- package/src/sources/provider-router/cached-routes.ts +19 -7
- package/src/state/opening-ticker-panes.ts +47 -0
- package/src/state/pane-table-export-registry.ts +19 -6
- package/src/test-support/cli-context.ts +2 -0
- package/src/test-support/preload.ts +8 -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/instrument-kind.ts +23 -3
- 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 +13 -0
- package/src/types/context-menu.ts +2 -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/types/plugin-commands.ts +140 -0
- package/src/types/plugin-context.ts +125 -0
- package/src/types/plugin-contributions.ts +55 -0
- package/src/types/plugin-definition.ts +234 -0
- package/src/types/plugin-notifications.ts +38 -0
- package/src/types/plugin-pane-settings.ts +114 -0
- package/src/types/plugin-pane-templates.ts +160 -0
- package/src/types/plugin-panes.ts +221 -0
- package/src/types/plugin-reports.ts +35 -0
- package/src/types/plugin-shared.ts +14 -0
- package/src/types/plugin-state.ts +71 -0
- package/src/types/plugin.ts +14 -1169
- package/src/ui/host.tsx +8 -0
- package/src/ui/index.tsx +14 -3
- package/src/updater/github-releases.ts +23 -0
- package/src/utils/cli-output.ts +22 -9
- 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
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
upsertTickerFromSearchResult,
|
|
16
16
|
type ResolvedTickerSearch,
|
|
17
17
|
} from "../tickers/search";
|
|
18
|
-
import { canonicalExchange, parsePublicTickerKey } from "../utils/exchanges";
|
|
18
|
+
import { canonicalExchange, isUsListingExchange, parsePublicTickerKey } from "../utils/exchanges";
|
|
19
19
|
import {
|
|
20
20
|
chosenListingNote,
|
|
21
21
|
isNoProviderError,
|
|
@@ -25,6 +25,10 @@ import {
|
|
|
25
25
|
listingVenues,
|
|
26
26
|
movedSymbolLine,
|
|
27
27
|
notTradedMessage,
|
|
28
|
+
oneWordCompanyName,
|
|
29
|
+
serviceNamedCompany,
|
|
30
|
+
isTitleCaseWord,
|
|
31
|
+
titleCaseCompanyName,
|
|
28
32
|
parseListingArg,
|
|
29
33
|
quoteBareListing,
|
|
30
34
|
resolveCliListing,
|
|
@@ -56,7 +60,7 @@ import { coinElsewhereNote, savedListingCoinNote } from "./commands/crypto-hints
|
|
|
56
60
|
import { NotASymbolError, notASymbolError } from "./symbol-cells";
|
|
57
61
|
import { kindFromListingSyntax } from "../tickers/instrument-kind";
|
|
58
62
|
import { classifyInstrumentKind, normalizeTickerSymbol } from "../tickers/search/ranking";
|
|
59
|
-
import { companyNameQueries, findFormerIssuerOfName, isCompanyNameInput } from "../tickers/company-name-listing";
|
|
63
|
+
import { companyNameQueries, findFormerIssuerOfName, isCompanyNameInput, settledTerminalCode } from "../tickers/company-name-listing";
|
|
60
64
|
|
|
61
65
|
/** The saved ticker for a symbol (`SAN:EPA`, or `SAN` with `--exchange EPA`), saving it from search first if needed. */
|
|
62
66
|
export async function resolveTickerForCli(
|
|
@@ -315,6 +319,15 @@ export async function resolveCliTicker(
|
|
|
315
319
|
return withChange({ ...ended, otherVenues: bareNote ? bareVenues : null, ...uncheckedIf(listing, local, ended.ended) }, local.quote ? tradingListing(local.quote) : { name: local.ticker.metadata.name });
|
|
316
320
|
}
|
|
317
321
|
|
|
322
|
+
// A bare word no quote of its own placed, which search read on a listing abroad, is the company the service marks
|
|
323
|
+
// with the word, as `quote` reads it: VISA is V:NYSE (Visa Inc.), not a receipt on Toronto; SHELL is SHEL:LSE.
|
|
324
|
+
const abroad = !listing.exchange && !!listing.typed && !isUsListingExchange(canonicalExchange(resolved.result.exchange));
|
|
325
|
+
const marked = abroad ? await serviceNamedCompany(listing.typed!, deps)
|
|
326
|
+
.catch(logFailure("cli.ticker-resolution", "Read a word the service marks as a name failed", null)) : null;
|
|
327
|
+
if (marked) {
|
|
328
|
+
const found = await resolveCliTicker(marked.key, store, dataProvider, undefined, options);
|
|
329
|
+
return { ...found, readAs: marked.readAs ?? found.readAs };
|
|
330
|
+
}
|
|
318
331
|
const { ticker, created } = await upsertTickerFromSearchResult(store, resolved.result);
|
|
319
332
|
// A listing saved before (by an earlier look at a list) is read again too: its quote says whether it still trades.
|
|
320
333
|
const named = created || !bareQuote ? await nameFromListingQuote(ticker, store, dataProvider, bareQuote) : { ticker, quote: bareQuote };
|
|
@@ -599,6 +612,9 @@ function lookAgain(entry: CliTickerResolution): boolean {
|
|
|
599
612
|
function listLookupPlan(input: string, exchange: string | undefined): ListLookupPlan {
|
|
600
613
|
// What cannot be a symbol is refused without a request.
|
|
601
614
|
if (notASymbolError(input)) return { searches: [], changes: null };
|
|
615
|
+
// A terminal's code abroad (`VOD LN`) is its listing as written: it asks only for its quote.
|
|
616
|
+
const code = settledTerminalCode(input);
|
|
617
|
+
if (code) return { searches: [], changes: null };
|
|
602
618
|
// A company's name searches what its reading searched (`readNameEntries`), answered by the same batch.
|
|
603
619
|
if (isCompanyNameInput(input)) return { searches: companyNameQueries(input), changes: null };
|
|
604
620
|
try {
|
|
@@ -644,7 +660,7 @@ export async function resolveTickersForCli(
|
|
|
644
660
|
}: Pick<CliTickerOptions, "retry" | "askWhenAmbiguous"> & {
|
|
645
661
|
/** Told before each new look, with how many symbols and how long it waits first. */
|
|
646
662
|
onRetry?: (count: number, waitMs: number) => void;
|
|
647
|
-
/** Told
|
|
663
|
+
/** Told (0, total) as the first look starts, then as each of its symbols is settled, with how many are and how many there are. */
|
|
648
664
|
onProgress?: (looked: number, total: number) => void;
|
|
649
665
|
retryWaitsMs?: readonly number[];
|
|
650
666
|
} = {},
|
|
@@ -652,9 +668,16 @@ export async function resolveTickersForCli(
|
|
|
652
668
|
const plans = new Map(symbols.map((input) => [input, listLookupPlan(input, exchange)] as const));
|
|
653
669
|
let settled = 0;
|
|
654
670
|
const progress = onProgress ? () => onProgress(++settled, symbols.length) : undefined;
|
|
671
|
+
// Told before any answer, so a slow first answer is said to be awaited.
|
|
672
|
+
onProgress?.(0, symbols.length);
|
|
673
|
+
// Symbols every search and own quote of which the service answered in some look: one found nothing for is not
|
|
674
|
+
// found, whatever it refused the others, so it is neither looked up again nor offered to try again.
|
|
675
|
+
const told = new Set<string>();
|
|
676
|
+
const notFound = (entry: CliTickerResolution) => entry.error instanceof TickerNotFoundError && told.has(entry.input);
|
|
655
677
|
// Each look asks for its symbols' searches and changes in batches first.
|
|
656
678
|
const look = async (inputs: readonly string[], concurrency: number, looked?: () => void): Promise<Map<string, CliTickerResolution>> => {
|
|
657
679
|
const batched = await batchedListLookups(dataProvider, inputs.map((input) => plans.get(input)!));
|
|
680
|
+
for (const input of inputs) if (batched.settled(plans.get(input)!)) told.add(input);
|
|
658
681
|
const resolve = (symbol: string) => resolveCliTicker(symbol, store, batched.dataProvider, exchange, {
|
|
659
682
|
retry, askWhenAmbiguous, ownExchangeWins: true, changeGraceMs: LOOKUP_TIMEOUT_MS,
|
|
660
683
|
});
|
|
@@ -672,7 +695,7 @@ export async function resolveTickersForCli(
|
|
|
672
695
|
let failing = failedRequests.count() > 0 || lookups.some(busyLookup);
|
|
673
696
|
for (const waitMs of retryWaitsMs) {
|
|
674
697
|
// A match whose quote was refused is looked at again too, so it gets the check a first look gives.
|
|
675
|
-
const failed = lookups.filter(lookAgain).map((entry) => entry.input);
|
|
698
|
+
const failed = lookups.filter((entry) => lookAgain(entry) && !notFound(entry)).map((entry) => entry.input);
|
|
676
699
|
if (!failing || failed.length === 0) break;
|
|
677
700
|
onRetry?.(failed.length, waitMs);
|
|
678
701
|
await new Promise((resolveWait) => setTimeout(resolveWait, waitMs));
|
|
@@ -681,13 +704,83 @@ export async function resolveTickersForCli(
|
|
|
681
704
|
lookups = lookups.map((entry) => again.get(entry.input) ?? entry);
|
|
682
705
|
failing = failedRequests.count() > before || [...again.values()].some(busyLookup);
|
|
683
706
|
}
|
|
707
|
+
// A company's name typed as one word (Canon, ADVANTEST) that no listing trades as is read as `quote` reads it.
|
|
708
|
+
lookups = await withOneWordNames(lookups, store, dataProvider, { retry, askWhenAmbiguous });
|
|
709
|
+
// One written as a name (Aeon) that went to another company's ticker is the company of that name.
|
|
710
|
+
lookups = await withTitleCaseNames(lookups, store, dataProvider, { retry, askWhenAmbiguous });
|
|
684
711
|
if (!failing) return lookups;
|
|
685
712
|
// Still refused after the last wait: a failure may only be the refusal, so none is called not found,
|
|
686
713
|
// and a match whose quote was refused is not taken as trading.
|
|
687
|
-
return lookups.map((entry) => lookAgain(entry)
|
|
714
|
+
return lookups.map((entry) => lookAgain(entry) && !notFound(entry)
|
|
688
715
|
? { input: entry.input, error: new LookupUnansweredError(entry.input) }
|
|
689
716
|
: entry);
|
|
690
717
|
} finally {
|
|
691
718
|
failedRequests.stop();
|
|
692
719
|
}
|
|
693
720
|
}
|
|
721
|
+
|
|
722
|
+
/** Names of one word looked up at once: each is a search and a quote. */
|
|
723
|
+
const NAME_CONCURRENCY = 4;
|
|
724
|
+
|
|
725
|
+
/**
|
|
726
|
+
* The lookups, each word no listing trades as (`TickerNotFoundError`) that
|
|
727
|
+
* names a company read as that company's listing, as `quote` reads it
|
|
728
|
+
* (`oneWordCompanyName`): CANON is 7751:JPX, and its row says so ("Read
|
|
729
|
+
* "CANON" as 7751:JPX (Canon Inc.)."). A word that names none keeps its own
|
|
730
|
+
* error.
|
|
731
|
+
*/
|
|
732
|
+
async function withOneWordNames(
|
|
733
|
+
lookups: CliTickerResolution[],
|
|
734
|
+
store: AppTickerRepositoryPort,
|
|
735
|
+
dataProvider: DataProvider,
|
|
736
|
+
options: Pick<CliTickerOptions, "retry" | "askWhenAmbiguous">,
|
|
737
|
+
): Promise<CliTickerResolution[]> {
|
|
738
|
+
const words = lookups.filter((entry) => entry.error instanceof TickerNotFoundError && !entry.error.successor && ONE_WORD.test(entry.input));
|
|
739
|
+
if (words.length === 0) return lookups;
|
|
740
|
+
const read = new Map((await mapWithConcurrency(words, NAME_CONCURRENCY, async (entry): Promise<CliTickerResolution> => {
|
|
741
|
+
try {
|
|
742
|
+
const named = await oneWordCompanyName(entry.input, { dataProvider });
|
|
743
|
+
if (!named) return entry;
|
|
744
|
+
const found = await resolveCliTicker(named.key, store, dataProvider, undefined, { ...options, ownExchangeWins: true, changeGraceMs: LOOKUP_TIMEOUT_MS });
|
|
745
|
+
return { input: entry.input, ...found, readAs: named.readAs ?? found.readAs };
|
|
746
|
+
} catch (error) {
|
|
747
|
+
// A name that cannot be read keeps the word's own "not found".
|
|
748
|
+
logFailure("cli.ticker-resolution", "Read a word as a company's name failed")(error);
|
|
749
|
+
return entry;
|
|
750
|
+
}
|
|
751
|
+
})).map((entry) => [entry.input, entry] as const));
|
|
752
|
+
return lookups.map((entry) => read.get(entry.input) ?? entry);
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
/**
|
|
756
|
+
* The lookups, each word written as a company's name (`Aeon`) that went to
|
|
757
|
+
* another company's ticker read as the company of that name, as `quote`
|
|
758
|
+
* reads it (`titleCaseCompanyName`): "Aeon" is 8267:JPX (Aeon Co., Ltd.), not
|
|
759
|
+
* AEON Biopharma's AEON, and its row says so. A word that names no such
|
|
760
|
+
* company keeps its ticker.
|
|
761
|
+
*/
|
|
762
|
+
async function withTitleCaseNames(
|
|
763
|
+
lookups: CliTickerResolution[],
|
|
764
|
+
store: AppTickerRepositoryPort,
|
|
765
|
+
dataProvider: DataProvider,
|
|
766
|
+
options: Pick<CliTickerOptions, "retry" | "askWhenAmbiguous">,
|
|
767
|
+
): Promise<CliTickerResolution[]> {
|
|
768
|
+
const words = lookups.filter((entry) => !entry.error && !entry.readAs && isTitleCaseWord(entry.input));
|
|
769
|
+
if (words.length === 0) return lookups;
|
|
770
|
+
const read = new Map((await mapWithConcurrency(words, NAME_CONCURRENCY, async (entry): Promise<CliTickerResolution> => {
|
|
771
|
+
try {
|
|
772
|
+
const named = await titleCaseCompanyName(entry.input, { symbol: entry.ticker!.metadata.ticker, name: entry.ticker!.metadata.name }, { dataProvider });
|
|
773
|
+
if (!named) return entry;
|
|
774
|
+
const found = await resolveCliTicker(named.key, store, dataProvider, undefined, { ...options, ownExchangeWins: true, changeGraceMs: LOOKUP_TIMEOUT_MS });
|
|
775
|
+
return { input: entry.input, ...found, readAs: named.readAs ?? found.readAs };
|
|
776
|
+
} catch (error) {
|
|
777
|
+
// A name that cannot be read keeps the ticker the word went to.
|
|
778
|
+
logFailure("cli.ticker-resolution", "Read a word written as a name failed")(error);
|
|
779
|
+
return entry;
|
|
780
|
+
}
|
|
781
|
+
})).map((entry) => [entry.input, entry] as const));
|
|
782
|
+
return lookups.map((entry) => read.get(entry.input) ?? entry);
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
/** A word that can be a company's name: letters, three and more, as a pasted name is (`Canon`, `ENEOS`). */
|
|
786
|
+
const ONE_WORD = /^\p{L}[\p{L}&'-]{2,}$/u;
|
package/src/cli/types.ts
CHANGED
|
@@ -29,6 +29,8 @@ export type MarketContext = ConfigContext & {
|
|
|
29
29
|
statementSources?: StatementReportSources;
|
|
30
30
|
/** Daily FX closes (`fx --date`, converted INS values); Gloom Cloud unless a test stands in for it. */
|
|
31
31
|
fxHistory?: FxHistoryClient;
|
|
32
|
+
/** Japan's intervention record for a yen pair's notes; Gloom Cloud unless a test stands in for it. */
|
|
33
|
+
fxInterventions?: () => Promise<import("../api-client/fx-interventions").FxInterventionsPayload | null>;
|
|
32
34
|
};
|
|
33
35
|
|
|
34
36
|
export type CliServicesContext = {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { bankFigurePointer, exportCommandPointer } from "./known-gaps";
|
|
2
|
+
|
|
1
3
|
/** A function the catalog finds for a word typed as a command (`comps`, `peers`). */
|
|
2
4
|
export interface CatalogCommandHit {
|
|
3
5
|
code: string;
|
|
@@ -86,3 +88,89 @@ export function catalogPointer(token: string, hits: readonly CatalogCommandHit[]
|
|
|
86
88
|
`Search the catalog: ${more}`,
|
|
87
89
|
].join("\n");
|
|
88
90
|
}
|
|
91
|
+
|
|
92
|
+
/** A command's name and the usage lines its help gives, as `gloom help` prints them. */
|
|
93
|
+
export interface CommandUsage {
|
|
94
|
+
name: string;
|
|
95
|
+
usage: readonly string[];
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* What a subcommand typed on its own (`gloom position set Izmir THYAO 100 280`)
|
|
100
|
+
* is answered with: the command it belongs to, run with what was typed after
|
|
101
|
+
* it (`gloom portfolio position set Izmir THYAO 100 280`), or each command it
|
|
102
|
+
* belongs to when several share it (`add`). Read from the commands' usage
|
|
103
|
+
* lines; null when no usage line has the word after a command's name.
|
|
104
|
+
*/
|
|
105
|
+
export function subcommandPointer(
|
|
106
|
+
token: string,
|
|
107
|
+
args: readonly string[],
|
|
108
|
+
commands: readonly CommandUsage[],
|
|
109
|
+
): { owners: string[]; run: string[] } | null {
|
|
110
|
+
const word = token.trim().toLowerCase();
|
|
111
|
+
if (!/^[a-z][a-z-]*$/.test(word)) return null;
|
|
112
|
+
const owners = commands.filter((command) => command.usage.some((line) => {
|
|
113
|
+
const [name, sub] = line.trim().split(/\s+/);
|
|
114
|
+
return name === command.name && sub === word;
|
|
115
|
+
}));
|
|
116
|
+
if (owners.length === 0) return null;
|
|
117
|
+
const typed = [word, ...args].map(shellWord).join(" ");
|
|
118
|
+
return { owners: owners.map((command) => command.name), run: owners.map((command) => `gloom ${command.name} ${typed}`) };
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface UnknownCommandPointers {
|
|
122
|
+
/** The word is a function's code: the command that runs it. */
|
|
123
|
+
fn: { code: string; command: string } | null;
|
|
124
|
+
/** The word is a slip from one function's code (RCDF for RDCF), read only when it is no code, no command is close to it and the catalog finds nothing for it. */
|
|
125
|
+
nearFn: { code: string; label: string; command: string } | null;
|
|
126
|
+
/** Functions the catalog finds for the word, read only when it is no code and no command is close to it. */
|
|
127
|
+
hits: CatalogCommandHit[];
|
|
128
|
+
/** What the reader typed after the word, which a pointer runs the function with. */
|
|
129
|
+
args: readonly string[];
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* What an unknown command word is answered with, the first that fits: a
|
|
134
|
+
* function's code is pointed at `fn`; a bank figure's name (`nim JPM`) at the
|
|
135
|
+
* Bank section; a subcommand typed without its command (`position set`) at
|
|
136
|
+
* the command it belongs to, unless the word is `export` (a flag, `--csv` or
|
|
137
|
+
* `--json`) or written as a ticker (`CASH`), which keep their own answers; a
|
|
138
|
+
* slip from a function's code (`RCDF`) at that function; a typo of a command
|
|
139
|
+
* (`suggestion`) at the command; and a word the catalog knows (`comps`) at the
|
|
140
|
+
* functions it finds. A word written as a ticker is also pointed at `quote`
|
|
141
|
+
* and `search`.
|
|
142
|
+
*/
|
|
143
|
+
export function unknownCommandReply(
|
|
144
|
+
token: string,
|
|
145
|
+
commands: readonly CommandUsage[],
|
|
146
|
+
pointers: UnknownCommandPointers,
|
|
147
|
+
suggestion: string | null,
|
|
148
|
+
): { message: string; details?: string } {
|
|
149
|
+
if (pointers.fn) return { message: `${pointers.fn.code} is a function: ${pointers.fn.command}` };
|
|
150
|
+
// A bank figure's name (`nim JPM`, `deposits WFC`) is where it is: the Bank section of fundamentals, NIM in EQS.
|
|
151
|
+
const bank = bankFigurePointer(token, pointers.args[0] ?? "");
|
|
152
|
+
if (bank) return { message: `Unknown command "${token}": a bank's figures are in the Bank section of fundamentals.`, details: bank.details };
|
|
153
|
+
const ticker = tickerPointer(token);
|
|
154
|
+
// Exporting is a flag, not a command: `export LMT` says how, rather than listing functions that mention exports.
|
|
155
|
+
const exported = exportCommandPointer(token, pointers.args);
|
|
156
|
+
const subcommand = exported || ticker ? null : subcommandPointer(token, pointers.args, commands);
|
|
157
|
+
if (subcommand) {
|
|
158
|
+
const owners = subcommand.owners.length > 1
|
|
159
|
+
? `${subcommand.owners.slice(0, -1).join(", ")} and ${subcommand.owners.at(-1)}` : subcommand.owners[0];
|
|
160
|
+
return {
|
|
161
|
+
message: `Unknown command "${token}": it is a subcommand of ${owners}.`,
|
|
162
|
+
details: subcommand.run.map((command) => `Run: ${command}`).join("\n"),
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
if (!suggestion && pointers.nearFn) {
|
|
166
|
+
return {
|
|
167
|
+
message: `Unknown command "${token}". Did you mean the function ${pointers.nearFn.code} (${pointers.nearFn.label})?`,
|
|
168
|
+
details: [`Run: ${pointers.nearFn.command}`, ticker].filter(Boolean).join("\n"),
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
const catalog = suggestion ? null : exported ?? catalogPointer(token, pointers.hits, pointers.args);
|
|
172
|
+
const help = suggestion
|
|
173
|
+
? `Did you mean ${suggestion}? Run gloom help to see every command.`
|
|
174
|
+
: catalog ? `${catalog}\nRun gloom help to see every command.` : "Run gloom help to see every command.";
|
|
175
|
+
return { message: `Unknown command "${token}".`, details: ticker ? `${ticker}\n${help}` : help };
|
|
176
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { memo } from "react";
|
|
2
2
|
import { Box, Text, useUiCapabilities } from "../../../ui";
|
|
3
3
|
import type { CompositeChartXMarker } from "./types";
|
|
4
|
+
import type { EventCaptionPlacement } from "./event-captions";
|
|
4
5
|
|
|
5
6
|
export interface StaticChartXAxisLabel {
|
|
6
7
|
label: string;
|
|
@@ -493,3 +494,24 @@ export function StaticXMarkerLabels({
|
|
|
493
494
|
</Box>
|
|
494
495
|
);
|
|
495
496
|
}
|
|
497
|
+
|
|
498
|
+
/** Events' captions in the row under the axis, laid out by `layoutEventCaptions`. */
|
|
499
|
+
export function EventCaptions({
|
|
500
|
+
captions,
|
|
501
|
+
width,
|
|
502
|
+
color,
|
|
503
|
+
}: {
|
|
504
|
+
captions: readonly EventCaptionPlacement[];
|
|
505
|
+
width: number;
|
|
506
|
+
color?: string;
|
|
507
|
+
}) {
|
|
508
|
+
return (
|
|
509
|
+
<Box position="relative" width={width} height={1}>
|
|
510
|
+
{captions.map(({ id, left, text }) => (
|
|
511
|
+
<Box key={id} position="absolute" left={left} top={0} width={text.length} height={1} overflow="hidden" zIndex={2}>
|
|
512
|
+
<Text fg={color}>{text}</Text>
|
|
513
|
+
</Box>
|
|
514
|
+
))}
|
|
515
|
+
</Box>
|
|
516
|
+
);
|
|
517
|
+
}
|
|
@@ -48,7 +48,8 @@ import { reuseResolvedSeriesList } from "./panel-series";
|
|
|
48
48
|
import { consumeChartMouseEvent, type ChartMouseEvent } from "../core/pointer";
|
|
49
49
|
import { useChartViewResetListener } from "../core/view-reset";
|
|
50
50
|
import { useShowChartTextFallback } from "../native/use-chart-text-fallback";
|
|
51
|
-
import { StaticXAxisLabels, StaticXMarkerLabels, StaticXMarkerOverlay } from "./axis-overlays";
|
|
51
|
+
import { EventCaptions, StaticXAxisLabels, StaticXMarkerLabels, StaticXMarkerOverlay } from "./axis-overlays";
|
|
52
|
+
import { layoutEventCaptions } from "./event-captions";
|
|
52
53
|
import { formatCompositeCursorAxisDate } from "./format";
|
|
53
54
|
import {
|
|
54
55
|
createCompositeCursorSource,
|
|
@@ -64,7 +65,7 @@ import {
|
|
|
64
65
|
} from "./interactions";
|
|
65
66
|
import { NO_VALUE_SCALES, resolveAxisDragSpanFactor } from "./value-scale";
|
|
66
67
|
import { useCompositeValueScales } from "./use-composite-value-scales";
|
|
67
|
-
import { COMPOSITE_RIGHT_OFFSET_RATIO } from "./time-scale";
|
|
68
|
+
import { COMPOSITE_RIGHT_OFFSET_RATIO, projectCompositeTimestamp } from "./time-scale";
|
|
68
69
|
import {
|
|
69
70
|
allocateCompositePanelHeights,
|
|
70
71
|
buildCompositeChartScene,
|
|
@@ -77,7 +78,9 @@ import type {
|
|
|
77
78
|
CompositeChartColors,
|
|
78
79
|
CompositeChartProps,
|
|
79
80
|
CompositeChartScene,
|
|
81
|
+
CompositeChartEvent,
|
|
80
82
|
CompositeChartXMarker,
|
|
83
|
+
CompositeEventGuide,
|
|
81
84
|
CompositePanelScene,
|
|
82
85
|
} from "./types";
|
|
83
86
|
|
|
@@ -104,6 +107,8 @@ function chartWatermarkScale(plotWidthPx: number, plotHeightPx: number): number
|
|
|
104
107
|
}
|
|
105
108
|
|
|
106
109
|
const NO_X_MARKERS: readonly CompositeChartXMarker[] = [];
|
|
110
|
+
const NO_EVENTS: readonly CompositeChartEvent[] = [];
|
|
111
|
+
const NO_PROJECTED_EVENTS: readonly { event: CompositeChartEvent; guide: CompositeEventGuide }[] = [];
|
|
107
112
|
const subscribeToNothing = () => () => {};
|
|
108
113
|
const holdsNothing = () => false;
|
|
109
114
|
|
|
@@ -207,6 +212,8 @@ function ThemedCompositeChart({
|
|
|
207
212
|
panelRules = !navigable,
|
|
208
213
|
formatAxisValue,
|
|
209
214
|
xAxis,
|
|
215
|
+
events,
|
|
216
|
+
mergeEventCaptions,
|
|
210
217
|
remoteKind,
|
|
211
218
|
allowHistoricalBackfill = false,
|
|
212
219
|
axisWidth = 9,
|
|
@@ -336,8 +343,16 @@ function ThemedCompositeChart({
|
|
|
336
343
|
// The pane's range control asks for this when its selected range is chosen again.
|
|
337
344
|
useChartViewResetListener(resetView, interactive);
|
|
338
345
|
const timeAxisRows = showTimeAxis ? 1 : 0;
|
|
339
|
-
const
|
|
340
|
-
|
|
346
|
+
const axisMarkers = xAxis?.markers ?? NO_X_MARKERS;
|
|
347
|
+
// Events in the view; their captions' row is kept whenever the chart has any, so panning never moves the plot.
|
|
348
|
+
const viewStart = effectiveViewport?.start.getTime() ?? null;
|
|
349
|
+
const viewEnd = effectiveViewport?.end.getTime() ?? null;
|
|
350
|
+
const timedEvents = !xAxis && events?.length ? events : NO_EVENTS;
|
|
351
|
+
const eventsInView = useMemo(() => (
|
|
352
|
+
timedEvents.length === 0 || viewStart === null || viewEnd === null ? NO_EVENTS
|
|
353
|
+
: timedEvents.filter((event) => event.time <= viewEnd && (event.endTime ?? event.time) >= viewStart)
|
|
354
|
+
), [timedEvents, viewEnd, viewStart]);
|
|
355
|
+
const xMarkerRows = axisMarkers.some((marker) => marker.label) || timedEvents.some((event) => event.captions?.length) ? 1 : 0;
|
|
341
356
|
const panelCount = new Set(panelSeries.map((entry) => entry.panelId)).size;
|
|
342
357
|
// One legend line, or up to a few when its entries cannot share one and each
|
|
343
358
|
// panel keeps a readable plot: the legend says how many it needs while no
|
|
@@ -493,18 +508,40 @@ function ThemedCompositeChart({
|
|
|
493
508
|
1,
|
|
494
509
|
Math.round(plotWidth * cellWidthPx * Math.max(1, pixelRatio)),
|
|
495
510
|
);
|
|
511
|
+
// An event is a guide at its time on the scale the bars are drawn on, so it sits on its bar.
|
|
512
|
+
const projectedEvents = useMemo(() => {
|
|
513
|
+
if (eventsInView.length === 0 || !projectedScene) return NO_PROJECTED_EVENTS;
|
|
514
|
+
const projected = eventsInView.flatMap((event) => {
|
|
515
|
+
const ratio = projectCompositeTimestamp(projectedScene.timeScale, event.time)?.ratio;
|
|
516
|
+
const end = event.endTime === undefined ? undefined : projectCompositeTimestamp(projectedScene.timeScale, event.endTime)?.ratio;
|
|
517
|
+
if (ratio == null || event.endTime !== undefined && end == null) return [];
|
|
518
|
+
if (end === undefined ? ratio < 0 || ratio > 1 : end! < 0 || ratio > 1) return [];
|
|
519
|
+
const guide: CompositeEventGuide = { xRatio: ratio, ...(end !== undefined ? { endXRatio: end! } : {}), dotted: event.dotted === true };
|
|
520
|
+
return [{ event, guide }];
|
|
521
|
+
});
|
|
522
|
+
return projected.length > 0 ? projected : NO_PROJECTED_EVENTS;
|
|
523
|
+
}, [eventsInView, projectedScene]);
|
|
496
524
|
const baseScene = useMemo<CompositeChartScene | null>(() => {
|
|
497
525
|
if (!projectedScene || !layoutPanels) return null;
|
|
526
|
+
const eventGuides = projectedEvents.length > 0 ? projectedEvents.map(({ guide }) => guide) : null;
|
|
498
527
|
const laidOut: CompositeChartScene = {
|
|
499
528
|
...projectedScene,
|
|
500
529
|
width: plotWidth,
|
|
501
530
|
height: layoutPanels.reduce((sum, panel) => sum + panel.height, 0),
|
|
502
|
-
panels: layoutPanels,
|
|
531
|
+
panels: eventGuides ? layoutPanels.map((panel) => ({ ...panel, eventGuides })) : layoutPanels,
|
|
503
532
|
// A panel with the whole plot still leaves the legend every series' value.
|
|
504
533
|
...(maximizedPanelId ? { cursorPanels: projectedScene.panels } : {}),
|
|
505
534
|
};
|
|
506
535
|
return downsampleCompositeChartScene(laidOut, downsampleWidth);
|
|
507
|
-
}, [downsampleWidth, layoutPanels, maximizedPanelId, plotWidth, projectedScene]);
|
|
536
|
+
}, [downsampleWidth, layoutPanels, maximizedPanelId, plotWidth, projectedEvents, projectedScene]);
|
|
537
|
+
// The events' captions, in the row under the axis, each beside its guide.
|
|
538
|
+
const eventCaptions = useMemo(() => {
|
|
539
|
+
if (projectedEvents.length === 0) return [];
|
|
540
|
+
const column = (ratio: number) => Math.round(Math.min(1, Math.max(0, ratio)) * Math.max(0, plotWidth - 1));
|
|
541
|
+
return layoutEventCaptions(projectedEvents.map(({ event, guide }) => ({
|
|
542
|
+
event, from: column(guide.xRatio), to: column(guide.endXRatio ?? guide.xRatio),
|
|
543
|
+
})), plotWidth, mergeEventCaptions);
|
|
544
|
+
}, [mergeEventCaptions, plotWidth, projectedEvents]);
|
|
508
545
|
// The cursor shown: the chart's own, or else the owner's.
|
|
509
546
|
const currentCursorTimestamp = useCallback(
|
|
510
547
|
() => (ownsCursor ? ownCursor.get() : null) ?? ownerCursorTimestamp,
|
|
@@ -1207,7 +1244,7 @@ function ThemedCompositeChart({
|
|
|
1207
1244
|
<AsciiText text="Gloomberb" font="wordmark" scale={watermarkScale} color={resolvedColors.textDim} />
|
|
1208
1245
|
</Box>
|
|
1209
1246
|
) : null}
|
|
1210
|
-
{
|
|
1247
|
+
{axisMarkers.length > 0 ? (
|
|
1211
1248
|
<Box
|
|
1212
1249
|
position="absolute"
|
|
1213
1250
|
left={leftPadding}
|
|
@@ -1218,7 +1255,7 @@ function ThemedCompositeChart({
|
|
|
1218
1255
|
style={isDesktopWeb ? { ...plotInsetStyle, pointerEvents: "none" } : undefined}
|
|
1219
1256
|
>
|
|
1220
1257
|
<StaticXMarkerOverlay
|
|
1221
|
-
markers={
|
|
1258
|
+
markers={axisMarkers}
|
|
1222
1259
|
width={plotWidth}
|
|
1223
1260
|
height={plotHeight}
|
|
1224
1261
|
fallbackColor={resolvedColors.textDim}
|
|
@@ -1255,11 +1292,15 @@ function ThemedCompositeChart({
|
|
|
1255
1292
|
{xMarkerRows > 0 ? (
|
|
1256
1293
|
<Box flexDirection="row" width={totalWidth} height={1} style={isDesktopWeb ? DESKTOP_FULL_ROW : undefined}>
|
|
1257
1294
|
{leftPadding > 0 ? <Box width={leftPadding} /> : null}
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1295
|
+
{axisMarkers.length > 0 ? (
|
|
1296
|
+
<StaticXMarkerLabels
|
|
1297
|
+
markers={axisMarkers}
|
|
1298
|
+
width={plotWidth}
|
|
1299
|
+
fallbackColor={resolvedColors.textDim}
|
|
1300
|
+
/>
|
|
1301
|
+
) : (
|
|
1302
|
+
<EventCaptions captions={eventCaptions} width={plotWidth} color={resolvedColors.textDim} />
|
|
1303
|
+
)}
|
|
1263
1304
|
{rightPadding > 0 ? <Box width={rightPadding} /> : null}
|
|
1264
1305
|
</Box>
|
|
1265
1306
|
) : null}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type { CompositeChartEvent } from "./types";
|
|
2
|
+
|
|
3
|
+
/** A caption never sits further than this many cells from its guide. */
|
|
4
|
+
const NEAR_CELLS = 2;
|
|
5
|
+
|
|
6
|
+
/** An event in view, with the plot columns its guide (or its period) covers. */
|
|
7
|
+
export interface EventCaptionAnchor {
|
|
8
|
+
event: CompositeChartEvent;
|
|
9
|
+
from: number;
|
|
10
|
+
to: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** A caption laid out in the row under the axis. */
|
|
14
|
+
export interface EventCaptionPlacement {
|
|
15
|
+
id: string;
|
|
16
|
+
left: number;
|
|
17
|
+
text: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface Group {
|
|
21
|
+
events: CompositeChartEvent[];
|
|
22
|
+
from: number;
|
|
23
|
+
to: number;
|
|
24
|
+
captions: readonly string[];
|
|
25
|
+
/** The caption shown: an index into `captions`, longest first. */
|
|
26
|
+
level: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface Placed {
|
|
30
|
+
group: Group;
|
|
31
|
+
left: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Where a caption goes: centred on its guide, inside the plot, ending at
|
|
36
|
+
* `limit` at the latest, and never more than two cells from its guide; null
|
|
37
|
+
* when it cannot.
|
|
38
|
+
*/
|
|
39
|
+
function captionLeft(group: Group, text: string, width: number, limit: number): number | null {
|
|
40
|
+
const length = text.length;
|
|
41
|
+
if (length === 0 || length > width) return null;
|
|
42
|
+
const centred = Math.round((group.from + group.to) / 2 - (length - 1) / 2);
|
|
43
|
+
const left = Math.min(Math.max(0, Math.min(width - length, centred)), limit - length + 1);
|
|
44
|
+
if (left < 0) return null;
|
|
45
|
+
const right = left + length - 1;
|
|
46
|
+
const gap = group.to < left ? left - group.to : group.from > right ? group.from - right : 0;
|
|
47
|
+
return gap <= NEAR_CELLS ? left : null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** The longest caption of `group` from its level on that fits before `limit`. */
|
|
51
|
+
function fit(group: Group, width: number, limit: number): Placed | null {
|
|
52
|
+
for (let level = group.level; level < group.captions.length; level += 1) {
|
|
53
|
+
const left = captionLeft(group, group.captions[level]!, width, limit);
|
|
54
|
+
if (left !== null) return { group: { ...group, level }, left };
|
|
55
|
+
}
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The events' captions in one row, newest first so the latest keeps the most
|
|
61
|
+
* room. Each is the longest of its captions that fits beside its guide; when
|
|
62
|
+
* two collide, the older one takes a shorter caption, then the newer one
|
|
63
|
+
* does, then the two share one caption (`merge`), and without one, or with
|
|
64
|
+
* no room even for that, the older is left out. A caption is never moved away
|
|
65
|
+
* from its guide to find room.
|
|
66
|
+
*/
|
|
67
|
+
export function layoutEventCaptions(
|
|
68
|
+
anchors: readonly EventCaptionAnchor[],
|
|
69
|
+
width: number,
|
|
70
|
+
merge?: (events: readonly CompositeChartEvent[]) => readonly string[],
|
|
71
|
+
): EventCaptionPlacement[] {
|
|
72
|
+
const groups = anchors
|
|
73
|
+
.filter((anchor) => anchor.event.captions?.length)
|
|
74
|
+
.map((anchor): Group => ({ events: [anchor.event], from: anchor.from, to: anchor.to, captions: anchor.event.captions!, level: 0 }))
|
|
75
|
+
.sort((left, right) => left.from - right.from || left.to - right.to);
|
|
76
|
+
const placed: Placed[] = [];
|
|
77
|
+
// The last column free for a caption left of those placed, a blank cell between two.
|
|
78
|
+
const limit = () => (placed.length > 0 ? placed.at(-1)!.left - 2 : width - 1);
|
|
79
|
+
for (let index = groups.length - 1; index >= 0; index -= 1) {
|
|
80
|
+
const group = groups[index]!;
|
|
81
|
+
for (;;) {
|
|
82
|
+
const own = fit(group, width, limit());
|
|
83
|
+
if (own) {
|
|
84
|
+
placed.push(own);
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
const right = placed.at(-1);
|
|
88
|
+
if (!right) break;
|
|
89
|
+
if (right.group.level < right.group.captions.length - 1) {
|
|
90
|
+
placed.pop();
|
|
91
|
+
const shorter = fit({ ...right.group, level: right.group.level + 1 }, width, limit());
|
|
92
|
+
placed.push(shorter ?? right);
|
|
93
|
+
if (shorter) continue;
|
|
94
|
+
}
|
|
95
|
+
if (merge) {
|
|
96
|
+
placed.pop();
|
|
97
|
+
const events = [...group.events, ...right.group.events];
|
|
98
|
+
const shared = fit({ events, from: group.from, to: Math.max(group.to, right.group.to), captions: merge(events), level: 0 }, width, limit());
|
|
99
|
+
placed.push(shared ?? right);
|
|
100
|
+
}
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return placed.reverse().map(({ group, left }) => ({
|
|
105
|
+
id: group.events.map((event) => event.id).join("+"),
|
|
106
|
+
left,
|
|
107
|
+
text: group.captions[group.level]!,
|
|
108
|
+
}));
|
|
109
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { fillRect, parseHex } from "../native/raster/primitives";
|
|
2
|
+
import { clamp } from "../../../utils/math";
|
|
3
|
+
import type { CompositeEventGuide } from "./types";
|
|
4
|
+
|
|
5
|
+
const GUIDE_OPACITY = 0.55;
|
|
6
|
+
/** A period's span, as faint as extended hours' shading. */
|
|
7
|
+
const SPAN_OPACITY = 0.08;
|
|
8
|
+
const DOT_PIXELS = 3;
|
|
9
|
+
const GAP_PIXELS = 3;
|
|
10
|
+
/** The text plot's guide, and a dotted one: glyphs no candle, cursor or session break draws. */
|
|
11
|
+
const EVENT_GUIDE_CHAR = "╎";
|
|
12
|
+
const DOTTED_EVENT_GUIDE_CHAR = "┆";
|
|
13
|
+
|
|
14
|
+
/** The guide's edges inside the plot: its own x, or a period's first and last. */
|
|
15
|
+
function edges(guide: CompositeEventGuide): number[] {
|
|
16
|
+
const ratios = guide.endXRatio === undefined ? [guide.xRatio] : [guide.xRatio, guide.endXRatio];
|
|
17
|
+
return ratios.filter((ratio) => ratio >= 0 && ratio <= 1);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Dated events' guides in a panel's bitmap, painted before the marks so a bar
|
|
22
|
+
* on the event's day still reads across its own guide: one pixel wide on the
|
|
23
|
+
* bar's centre, dotted for an event whose day is not known yet. A period is
|
|
24
|
+
* shaded from its first day to its last, a guide at each end.
|
|
25
|
+
*/
|
|
26
|
+
export function paintEventGuides(
|
|
27
|
+
data: Uint8Array,
|
|
28
|
+
width: number,
|
|
29
|
+
height: number,
|
|
30
|
+
guides: readonly CompositeEventGuide[],
|
|
31
|
+
color: string,
|
|
32
|
+
): void {
|
|
33
|
+
const tint = parseHex(color);
|
|
34
|
+
const maxX = Math.max(width - 1, 0);
|
|
35
|
+
for (const guide of guides) {
|
|
36
|
+
if (guide.endXRatio !== undefined) {
|
|
37
|
+
const from = Math.round(clamp(guide.xRatio, 0, 1) * maxX), to = Math.round(clamp(guide.endXRatio, 0, 1) * maxX);
|
|
38
|
+
if (to > from) fillRect(data, width, height, from, 0, to, height - 1, tint, SPAN_OPACITY);
|
|
39
|
+
}
|
|
40
|
+
for (const ratio of edges(guide)) {
|
|
41
|
+
const x = Math.round(ratio * maxX);
|
|
42
|
+
if (!guide.dotted) {
|
|
43
|
+
fillRect(data, width, height, x, 0, x, height - 1, tint, GUIDE_OPACITY);
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
for (let y = 0; y < height; y += DOT_PIXELS + GAP_PIXELS) {
|
|
47
|
+
fillRect(data, width, height, x, y, x, Math.min(y + DOT_PIXELS - 1, height - 1), tint, GUIDE_OPACITY);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const open = (cell: string | undefined) => cell === undefined || cell === " " || cell === "·";
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The text plot's guides, `╎`, or `┆` for an event whose day is not known
|
|
57
|
+
* yet (at each end of its period), in blank and grid cells only, and never
|
|
58
|
+
* in the cell just above or below a mark, so the day's candle keeps its high
|
|
59
|
+
* and low readable.
|
|
60
|
+
*/
|
|
61
|
+
export function writeEventGuidesText(rows: string[][], width: number, guides: readonly CompositeEventGuide[]): void {
|
|
62
|
+
const maxX = Math.max(width - 1, 0);
|
|
63
|
+
const writes: { row: number; x: number; char: string }[] = [];
|
|
64
|
+
for (const guide of guides) {
|
|
65
|
+
const char = guide.dotted ? DOTTED_EVENT_GUIDE_CHAR : EVENT_GUIDE_CHAR;
|
|
66
|
+
for (const ratio of edges(guide)) {
|
|
67
|
+
const x = clamp(Math.round(ratio * maxX), 0, maxX);
|
|
68
|
+
rows.forEach((row, index) => {
|
|
69
|
+
if (open(row[x]) && open(rows[index - 1]?.[x]) && open(rows[index + 1]?.[x])) writes.push({ row: index, x, char });
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
for (const { row, x, char } of writes) rows[row]![x] = char;
|
|
74
|
+
}
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
type CompositeColumnGroupCenter,
|
|
15
15
|
type CompositeColumnLayout,
|
|
16
16
|
} from "./column-layout";
|
|
17
|
+
import { paintEventGuides } from "./event-guides";
|
|
17
18
|
import { compositeGridRatios } from "./format";
|
|
18
19
|
import { projectCompositeValue } from "./scene";
|
|
19
20
|
import { paintVolumeProfile } from "./volume-profile-paint";
|
|
@@ -553,6 +554,7 @@ export function renderCompositePanelBitmap(
|
|
|
553
554
|
fillRect(data, width, height, 0, y, width - 1, y + 0.6, grid, 0.42);
|
|
554
555
|
}
|
|
555
556
|
if (panel.volumeProfile) paintVolumeProfile(data, width, height, panel.volumeProfile);
|
|
557
|
+
if (panel.eventGuides) paintEventGuides(data, width, height, panel.eventGuides, options.colors.textDim);
|
|
556
558
|
// Under the bars, which read across it.
|
|
557
559
|
if (panel.priorClose) {
|
|
558
560
|
drawDashedLevel(data, width, height, panel.priorClose.yRatio, parseHex(options.colors.textDim),
|