@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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { apiClient } from "../../../api-client";
|
|
2
|
-
import { getSharedMarketDataCoordinator, MarketDataCoordinator, resolveEntryValue } from "../../../market-data/coordinator";
|
|
2
|
+
import { entryFailedTransiently, getSharedMarketDataCoordinator, MarketDataCoordinator, resolveEntryValue } from "../../../market-data/coordinator";
|
|
3
3
|
import type { InstrumentRef, OptionsRequest } from "../../../market-data/request-types";
|
|
4
4
|
import type { QueryEntry } from "../../../market-data/result-types";
|
|
5
5
|
import type { DataProvider } from "../../../types/data-provider";
|
|
@@ -18,6 +18,9 @@ import { loadModelDividendYield, type ModelDividendYield } from "../../../market
|
|
|
18
18
|
import { abortable, abortError } from "../../../utils/async-deadline";
|
|
19
19
|
import { extendedSession, modelSpotStamp, modelSpotStampVariants, type OptionModelSpot } from "../options/model-spot";
|
|
20
20
|
import { errorMessage } from "../../../utils/errors";
|
|
21
|
+
import { isTransientFailure } from "../../../api-client/errors";
|
|
22
|
+
import { isTransientSourceFailure, serviceDidNotAnswerMessage } from "../../../sources/provider-errors";
|
|
23
|
+
import { DATA_SERVICE_UNREACHABLE_MESSAGE, isNetworkFailure } from "../../../utils/network-failure";
|
|
21
24
|
import { dateOptionError, dateOptionFormatsOr, readCalendarDate } from "../../../utils/calendar-date";
|
|
22
25
|
|
|
23
26
|
export interface ScenarioMarketSnapshot {
|
|
@@ -42,6 +45,11 @@ export interface ScenarioMarketSnapshot {
|
|
|
42
45
|
warnings: string[];
|
|
43
46
|
/** Why the requested expiry has no chain, naming the listed dates nearest it. */
|
|
44
47
|
missingExpiry?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Why the chain read failed: the data service did not answer, with when to
|
|
50
|
+
* ask again, or none is listed (`chainReadFailure`). Absent from older snapshots.
|
|
51
|
+
*/
|
|
52
|
+
chainUnavailable?: string;
|
|
45
53
|
}
|
|
46
54
|
|
|
47
55
|
export interface ScenarioLoaderDependencies {
|
|
@@ -129,6 +137,7 @@ export async function loadScenarioMarket(
|
|
|
129
137
|
});
|
|
130
138
|
if (request.signal?.aborted) throw abortError(CANCELLED);
|
|
131
139
|
if (!dividend) warnings.push("Dividend yield unavailable; supply an explicit assumption");
|
|
140
|
+
let chainRejection: unknown = chainResult.status === "rejected" ? chainResult.reason ?? new Error("Options chain read failed") : undefined;
|
|
132
141
|
let chainEntry = entry(chainResult, "Options chain");
|
|
133
142
|
let chain = chainEntry ? resolveEntryValue(chainEntry) : null;
|
|
134
143
|
if (chain && !symbolMatches(chain.underlyingSymbol, symbol)) {
|
|
@@ -146,8 +155,9 @@ export async function loadScenarioMarket(
|
|
|
146
155
|
&& !chain.calls.length && !chain.puts.length ? listedExpiration : undefined);
|
|
147
156
|
if (reload != null) {
|
|
148
157
|
// Or a source that keys chains by its exact stamp answered the midnight request empty.
|
|
158
|
+
chainRejection = undefined;
|
|
149
159
|
chainEntry = await abortable(dependencies.loadOptions({ instrument: request.instrument, expirationDate: reload }, options)
|
|
150
|
-
.catch((error: unknown) => { warnings.push(`Options chain: ${errorMessage(error)}`); return null; }), request.signal, CANCELLED);
|
|
160
|
+
.catch((error: unknown) => { warnings.push(`Options chain: ${errorMessage(error)}`); chainRejection = error ?? new Error("Options chain read failed"); return null; }), request.signal, CANCELLED);
|
|
151
161
|
if (request.signal?.aborted) throw abortError(CANCELLED);
|
|
152
162
|
if (chainEntry?.error) warnings.push(`Options chain: ${chainEntry.error.message}`);
|
|
153
163
|
chain = chainEntry ? resolveEntryValue(chainEntry) : null;
|
|
@@ -166,6 +176,14 @@ export async function loadScenarioMarket(
|
|
|
166
176
|
} else if (chain && (listedExpiration ?? liveDefault) != null && !onExpiry(chain, (listedExpiration ?? liveDefault)!)) {
|
|
167
177
|
warnings.push("Selected expiration unavailable in the returned options chain"); chain = null;
|
|
168
178
|
}
|
|
179
|
+
// A read that failed says why: a service that did not answer is asked again, a chain none lists is not.
|
|
180
|
+
const chainUnavailable = !missingExpiry && (!chain || chainEntry?.error)
|
|
181
|
+
? chainReadFailure(symbol, chainRejection, chainEntry, chain != null) : undefined;
|
|
182
|
+
if (chainUnavailable && chainUnavailable !== `No options chain is listed for ${symbol}.`) {
|
|
183
|
+
// The router's "No options provider available" of a read that timed out reads as no chain at all.
|
|
184
|
+
for (let index = warnings.length - 1; index >= 0; index -= 1) if (warnings[index]!.startsWith("Options chain: ")) warnings.splice(index, 1);
|
|
185
|
+
warnings.push(chainUnavailable);
|
|
186
|
+
}
|
|
169
187
|
if (!chain) warnings.push("Options chain unavailable");
|
|
170
188
|
else if (chainEntry?.error || (chainEntry?.staleAt != null && chainEntry.staleAt <= now)) warnings.push("Options chain is stale");
|
|
171
189
|
const rateExpiration = request.rateExpiration ?? (expired ? undefined : request.expiration) ?? expirationDates[0];
|
|
@@ -186,9 +204,36 @@ export async function loadScenarioMarket(
|
|
|
186
204
|
source: quoteCurrent ? quoteEntry?.source ?? quote!.providerId ?? null : null,
|
|
187
205
|
underlyingQuote: quoteCurrent ? quote : null, rateAsOf: rate.asOf, warnings: [...new Set(warnings)],
|
|
188
206
|
...(missingExpiry ? { missingExpiry } : {}),
|
|
207
|
+
...(chainUnavailable ? { chainUnavailable } : {}),
|
|
189
208
|
};
|
|
190
209
|
}
|
|
191
210
|
|
|
211
|
+
/**
|
|
212
|
+
* Why a chain read that failed left no current chain: the data service could
|
|
213
|
+
* not be reached or did not answer in time, which asking again may get past
|
|
214
|
+
* and is said with that advice, or it answered with none it lists. `kept` is
|
|
215
|
+
* a chain an earlier read left, which only a failure worth retrying explains.
|
|
216
|
+
* Undefined when the read did not fail.
|
|
217
|
+
*/
|
|
218
|
+
function chainReadFailure(symbol: string, rejection: unknown, entry: QueryEntry<OptionsChain> | null, kept: boolean): string | undefined {
|
|
219
|
+
if (rejection === undefined && !entry?.error) return undefined;
|
|
220
|
+
const what = `the ${symbol} options chain`;
|
|
221
|
+
const message = rejection !== undefined ? errorMessage(rejection) : entry!.error!.message;
|
|
222
|
+
if (isNetworkFailure(rejection) || message === DATA_SERVICE_UNREACHABLE_MESSAGE || isNetworkFailure(message)) {
|
|
223
|
+
return `${DATA_SERVICE_UNREACHABLE_MESSAGE} for ${what}. Try again in a moment.`;
|
|
224
|
+
}
|
|
225
|
+
// A rate limit, or a read the service failed twice, already says when to ask again.
|
|
226
|
+
if (/\btry again\b/i.test(message)) return message;
|
|
227
|
+
const transient = rejection !== undefined ? isTransientFailure(rejection) || isTransientSourceFailure(rejection) : entryFailedTransiently(entry);
|
|
228
|
+
if (transient) return serviceDidNotAnswerMessage(what);
|
|
229
|
+
return kept ? undefined : `No options chain is listed for ${symbol}.`;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/** What a strategy seed says when the market holds no current chain to seed it from. */
|
|
233
|
+
function seedChainError(market: Pick<ScenarioMarketSnapshot, "missingExpiry" | "chainUnavailable"> | null | undefined): Error {
|
|
234
|
+
return new Error(market?.missingExpiry ?? market?.chainUnavailable ?? "A current options chain is required to seed a strategy");
|
|
235
|
+
}
|
|
236
|
+
|
|
192
237
|
const sentence = (text: string) => text.charAt(0).toUpperCase() + text.slice(1);
|
|
193
238
|
|
|
194
239
|
const cents = (value: number) => value.toFixed(2);
|
|
@@ -309,9 +354,7 @@ export function scenarioPositionFromSettings(
|
|
|
309
354
|
let shareEntry: number | null | undefined;
|
|
310
355
|
if (!legs.length && supplied(settings.strategy)) {
|
|
311
356
|
if (!isScenarioStrategy(settings.strategy)) throw new Error("strategy must be vertical, straddle, put, csp or collar");
|
|
312
|
-
if (!market?.chain || market.warnings.includes("Options chain is stale"))
|
|
313
|
-
throw new Error(market?.missingExpiry ?? "A current options chain is required to seed a strategy");
|
|
314
|
-
}
|
|
357
|
+
if (!market?.chain || market.warnings.includes("Options chain is stale")) throw seedChainError(market);
|
|
315
358
|
if (spot == null) throw new Error("A current underlying price or explicit --spot is required");
|
|
316
359
|
// Leg IVs are solved at the market's own spot and time, never at a what-if override.
|
|
317
360
|
const pricing = market.spot != null && rate != null ? { spot: market.spot, asOf: market.asOf, rate, dividendYield: dividendYield ?? 0 } : null;
|
|
@@ -583,9 +626,7 @@ export function seedScreenPosition(
|
|
|
583
626
|
pick: (quoted: QuotedChain, pricing: StrategyPricing, unusable: UnusableChainText) => ScreenSeed,
|
|
584
627
|
merged?: OptionsChain,
|
|
585
628
|
): ScenarioPosition {
|
|
586
|
-
if (!market.chain || market.warnings.includes("Options chain is stale"))
|
|
587
|
-
throw new Error(market.missingExpiry ?? "A current options chain is required to seed a strategy");
|
|
588
|
-
}
|
|
629
|
+
if (!market.chain || market.warnings.includes("Options chain is stale")) throw seedChainError(market);
|
|
589
630
|
const chain = merged ?? market.chain;
|
|
590
631
|
if (market.spot == null) throw new Error("A current underlying price is required");
|
|
591
632
|
if (market.rate == null) throw new Error("Choosing legs by delta needs the Treasury rate");
|
|
@@ -89,6 +89,9 @@ const tradeDropOrder = (strategy: ScreenFamily) => strategyFamilyDef(strategy).n
|
|
|
89
89
|
? ["maxGain", "breakEven", "rank", "maxLoss", "earnings", "spread"]
|
|
90
90
|
: ["maxLoss", "breakEven", "rank", "maxGain", "earnings", "spread"];
|
|
91
91
|
|
|
92
|
+
/** The cells a name's state takes (`no price`, `no chain`, `no trade`). */
|
|
93
|
+
const STATE_WIDTH = 8;
|
|
94
|
+
|
|
92
95
|
const DELTA_OPTIONS = ["0.10", "0.15", "0.20", "0.25", "0.30", "0.35", "0.40", "0.50"];
|
|
93
96
|
const WING_OPTIONS = ["0.05", "0.10", "0.15", "0.20", "0.25", "0.30", "0.35", "0.40"];
|
|
94
97
|
const DAYS_OPTIONS = ["7", "14", "21", "30", "45", "60", "90"];
|
|
@@ -189,10 +192,10 @@ export function CspScreenPane({ width, height, focused }: PaneProps) {
|
|
|
189
192
|
const [selected, setSelected] = useState<string | null>(null);
|
|
190
193
|
const screen = data?.screen;
|
|
191
194
|
const rankedBy = strategy === "csp" ? undefined : strategyRankedBy(strategy);
|
|
195
|
+
// What concerns one name is on its row (rowState, rowNote); the footer's notes are the screen's.
|
|
192
196
|
const notices = [criteria.error, data ? null : resource.error,
|
|
193
197
|
leftOut.length ? `Ranks the first ${CSP_SCREEN_LIMIT} symbols; ${leftOut.length} left out: ${leftOut.join(", ")}` : null,
|
|
194
198
|
...(screen?.ivRankError ? [`IV rank unavailable: ${screen.ivRankError}`] : []),
|
|
195
|
-
...(screen?.rows ?? []).flatMap((row) => row.note ? [`${row.symbol}: ${row.note}`] : []),
|
|
196
199
|
...(screen ? cspScreenNotes(screen, rankedBy).slice(1) : [])].filter((value): value is string => !!value);
|
|
197
200
|
usePaneNoticeFooter({ registrationId: "csp-screen-notices", notices, focused });
|
|
198
201
|
// The bar names the delta and the expiry; the footer says only what changes.
|
|
@@ -219,7 +222,12 @@ export function CspScreenPane({ width, height, focused }: PaneProps) {
|
|
|
219
222
|
resource.reload();
|
|
220
223
|
event.preventDefault?.(); event.stopPropagation?.(); return true;
|
|
221
224
|
};
|
|
222
|
-
|
|
225
|
+
/** A name with nothing to rank says why in its first column with room for it, in a few words; the rest of its row stays blank. */
|
|
226
|
+
const stateCell = (row: { source: { state: string | null } }, id: string, stateColumn: string | undefined): DataTableCell | null =>
|
|
227
|
+
row.source.state && id === stateColumn ? { text: row.source.state, color: colors.warning } : null;
|
|
228
|
+
const putCell = (row: ScreenRow, id: string): DataTableCell => {
|
|
229
|
+
const state = row.source.csp ? null : stateCell(row, id, putStateColumn);
|
|
230
|
+
if (state) return state;
|
|
223
231
|
switch (id) {
|
|
224
232
|
case "rank": return { text: row.rank == null ? "" : String(row.rank), color: colors.textDim };
|
|
225
233
|
case "symbol": return { text: row.symbol, color: colors.textBright };
|
|
@@ -239,6 +247,8 @@ export function CspScreenPane({ width, height, focused }: PaneProps) {
|
|
|
239
247
|
}
|
|
240
248
|
};
|
|
241
249
|
const tradeCell = (row: TradeRow, id: string): DataTableCell => {
|
|
250
|
+
const state = row.source.trade ? null : stateCell(row, id, "trade");
|
|
251
|
+
if (state) return state;
|
|
242
252
|
switch (id) {
|
|
243
253
|
case "rank": return { text: row.rank == null ? "" : String(row.rank), color: colors.textDim };
|
|
244
254
|
case "symbol": return { text: row.symbol, color: colors.textBright };
|
|
@@ -297,11 +307,17 @@ export function CspScreenPane({ width, height, focused }: PaneProps) {
|
|
|
297
307
|
};
|
|
298
308
|
// Whole columns give way, least needed first, so nothing scrolls sideways; a vertical scrollbar takes a cell.
|
|
299
309
|
const putColumns = useMemo(() => dropColumnsToFit(COLUMNS, width - 1, PUT_DROP_ORDER), [width]);
|
|
310
|
+
// The first column past the symbol wide enough for a state's few words.
|
|
311
|
+
const putStateColumn = putColumns.find((column) => column.id !== "rank" && column.id !== "symbol" && (column.width ?? 0) >= STATE_WIDTH)?.id;
|
|
300
312
|
const tradeColumnWidth = tradeWidth(tradeRows);
|
|
301
313
|
const shownTradeColumns = useMemo(() => strategy === "csp" ? [] : dropColumnsToFit(tradeColumns(strategy, tradeColumnWidth), width - 1,
|
|
302
314
|
tradeDropOrder(strategy)), [strategy, tradeColumnWidth, width]);
|
|
303
|
-
const
|
|
304
|
-
const
|
|
315
|
+
const shownRows: Array<ScreenRow | TradeRow> = strategy === "csp" ? putRows : tradeRows;
|
|
316
|
+
const firstSymbol = shownRows[0]?.symbol ?? "";
|
|
317
|
+
const selectedSymbol = selected ?? firstSymbol;
|
|
318
|
+
const selection = { kind: "id" as const, selectedId: selectedSymbol, getId: (row: { symbol: string }) => row.symbol, onChange: (id: string) => setSelected(id) };
|
|
319
|
+
// The selected name's whole reason, under the table: the row has room for its few words only.
|
|
320
|
+
const rowNote = (row: ScreenRow | TradeRow) => row.source.note ? `${row.symbol}: ${row.source.note}` : null;
|
|
305
321
|
return <Box width={width} height={height} flexDirection="column" overflow="hidden">
|
|
306
322
|
{tabStrip}
|
|
307
323
|
<QueryBar width={width} filters={filters} meta={strategy === "csp" ? undefined : STRATEGY_MONEY_UNIT} />
|
|
@@ -309,9 +325,9 @@ export function CspScreenPane({ width, height, focused }: PaneProps) {
|
|
|
309
325
|
error={criteria.error && !ready ? criteria.error : !data ? resource.error : null}>
|
|
310
326
|
{strategy === "csp"
|
|
311
327
|
? <DataTableView<ScreenRow> {...table} columns={putColumns} items={putRows} selection={selection}
|
|
312
|
-
renderCell={(row, column) => putCell(row, column.id)} />
|
|
328
|
+
renderCell={(row, column) => putCell(row, column.id)} rowNote={rowNote} />
|
|
313
329
|
: <DataTableView<TradeRow> {...table} columns={shownTradeColumns} items={tradeRows} selection={selection}
|
|
314
|
-
renderCell={(row, column) => tradeCell(row, column.id)} />}
|
|
330
|
+
renderCell={(row, column) => tradeCell(row, column.id)} rowNote={rowNote} />}
|
|
315
331
|
</PaneStatusBody>
|
|
316
332
|
</Box>;
|
|
317
333
|
}
|
|
@@ -50,6 +50,8 @@ export interface CspScreenRow {
|
|
|
50
50
|
wideSpread: boolean;
|
|
51
51
|
/** Why the name has no put to rank. */
|
|
52
52
|
note: string | null;
|
|
53
|
+
/** That reason as its row's few words (`no price`, `no chain`). */
|
|
54
|
+
state: string | null;
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
export interface CspScreen {
|
|
@@ -163,11 +165,33 @@ export async function loadScreenMarket(
|
|
|
163
165
|
}
|
|
164
166
|
const expiration = nearestListedExpiry(first.expirationDates, target);
|
|
165
167
|
if (expiration == null) {
|
|
166
|
-
throw new
|
|
168
|
+
throw new ScreenNameError(first.warnings.find((warning) => warning.startsWith("Options chain")) ?? "No listed option expiries", "no chain");
|
|
167
169
|
}
|
|
168
170
|
const loaded = first.chain ? [...first.chain.puts, ...first.chain.calls][0]?.expiration : undefined;
|
|
169
|
-
return loaded != null && expiryIsoDate(loaded) === expiryIsoDate(expiration)
|
|
170
|
-
? first : await loadScenarioMarket({ instrument, expiration, signal }, dependencies);
|
|
171
|
+
return requireScreenInputs(loaded != null && expiryIsoDate(loaded) === expiryIsoDate(expiration)
|
|
172
|
+
? first : await loadScenarioMarket({ instrument, expiration, signal }, dependencies));
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Why a screened name has nothing to rank, in full (`note`) and as its row's
|
|
177
|
+
* few words (`state`). The screens type no spot, rate or yield, so a missing
|
|
178
|
+
* one is said as what the market lacks, never as OSA's flag to supply it.
|
|
179
|
+
*/
|
|
180
|
+
export class ScreenNameError extends Error {
|
|
181
|
+
constructor(message: string, readonly state: string) {
|
|
182
|
+
super(message);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** The market a name's trade is valued at, or why it cannot be: its chain, price, Treasury rate and dividend yield, in that order. */
|
|
187
|
+
function requireScreenInputs(market: ScenarioMarketSnapshot): ScenarioMarketSnapshot {
|
|
188
|
+
if (!market.chain || market.warnings.includes("Options chain is stale")) {
|
|
189
|
+
throw new ScreenNameError(market.missingExpiry ?? "No current options chain", "no chain");
|
|
190
|
+
}
|
|
191
|
+
if (market.spot == null) throw new ScreenNameError("No current price for the underlying", "no price");
|
|
192
|
+
if (market.rate == null) throw new ScreenNameError("No Treasury rate to value its options at", "no rate");
|
|
193
|
+
if (market.dividendYield == null) throw new ScreenNameError("No dividend yield to value its options at", "no yield");
|
|
194
|
+
return market;
|
|
171
195
|
}
|
|
172
196
|
|
|
173
197
|
/** One name's put: OSA's csp seed at `--delta` on the listed expiry nearest the target, read as OSA reads it. */
|
|
@@ -215,8 +239,8 @@ function screenFreshness(markets: readonly ScenarioMarketSnapshot[], now: number
|
|
|
215
239
|
};
|
|
216
240
|
}
|
|
217
241
|
|
|
218
|
-
/** One name of a screen: what it found, or why it found nothing, with its IV rank either way. */
|
|
219
|
-
interface ScreenedName<T> { symbol: string; ivRank: number | null; value: T | null; note: string | null }
|
|
242
|
+
/** One name of a screen: what it found, or why it found nothing (in full and in a few words), with its IV rank either way. */
|
|
243
|
+
interface ScreenedName<T> { symbol: string; ivRank: number | null; value: T | null; note: string | null; state: string | null }
|
|
220
244
|
|
|
221
245
|
export interface ScreenedNames<T> {
|
|
222
246
|
names: ScreenedName<T>[];
|
|
@@ -229,10 +253,12 @@ export interface ScreenedNames<T> {
|
|
|
229
253
|
* Each name screened by `screen`, four at a time: one IV rank request, one
|
|
230
254
|
* earnings calendar request and one Treasury curve for all of them. A name
|
|
231
255
|
* `screen` throws on is kept with the error as its note (`fallback` when the
|
|
232
|
-
* error has no message)
|
|
256
|
+
* error has no message) and its state (a ScreenNameError's, else
|
|
257
|
+
* `fallbackState`). `screen` returns the market that dates its row.
|
|
233
258
|
*/
|
|
234
259
|
export async function screenNames<T>(
|
|
235
|
-
instruments: readonly InstrumentRef[], dependencies: CspScreenDependencies, signal: AbortSignal | undefined,
|
|
260
|
+
instruments: readonly InstrumentRef[], dependencies: CspScreenDependencies, signal: AbortSignal | undefined,
|
|
261
|
+
{ fallback, fallbackState }: { fallback: string; fallbackState: string },
|
|
236
262
|
screen: (instrument: InstrumentRef, earningsDate: string | null, scenario: ScenarioLoaderDependencies) => Promise<{ value: T; market: ScenarioMarketSnapshot }>,
|
|
237
263
|
): Promise<ScreenedNames<T>> {
|
|
238
264
|
const now = dependencies.scenario.now?.() ?? Date.now();
|
|
@@ -259,10 +285,11 @@ export async function screenNames<T>(
|
|
|
259
285
|
const reason = ivRankReason(ivRow);
|
|
260
286
|
missingRanks.push(reason ? `${symbol} (${reason})` : symbol);
|
|
261
287
|
}
|
|
262
|
-
return { symbol, ivRank, value: screened.value, note: null };
|
|
288
|
+
return { symbol, ivRank, value: screened.value, note: null, state: null };
|
|
263
289
|
} catch (error) {
|
|
264
290
|
if (signal?.aborted) throw error;
|
|
265
|
-
return { symbol, ivRank, value: null, note: errorMessage(error) ?? fallback
|
|
291
|
+
return { symbol, ivRank, value: null, note: errorMessage(error) ?? fallback,
|
|
292
|
+
state: error instanceof ScreenNameError ? error.state : fallbackState };
|
|
266
293
|
}
|
|
267
294
|
});
|
|
268
295
|
return { names, missingRanks: missingRanks.sort(), ivRankError: ivRanks.error, freshness: screenFreshness(markets, now) };
|
|
@@ -273,13 +300,13 @@ export async function loadCspScreen(
|
|
|
273
300
|
instruments: readonly InstrumentRef[], criteria: CspScreenCriteria, dependencies: CspScreenDependencies, signal?: AbortSignal,
|
|
274
301
|
): Promise<CspScreen> {
|
|
275
302
|
const target = cspTargetDate(criteria, dependencies.scenario.now?.() ?? Date.now());
|
|
276
|
-
const screened = await screenNames(instruments, dependencies, signal, "No put to sell", async (instrument, earningsDate, scenario) => {
|
|
303
|
+
const screened = await screenNames(instruments, dependencies, signal, { fallback: "No put to sell", fallbackState: "no put" }, async (instrument, earningsDate, scenario) => {
|
|
277
304
|
const put = await screenPut(instrument, criteria, scenario, target, earningsDate, signal);
|
|
278
305
|
return { value: put, market: put.market };
|
|
279
306
|
});
|
|
280
|
-
const rows = screened.names.map(({ symbol, ivRank, value, note }): Omit<CspScreenRow, "rank"> => ({
|
|
307
|
+
const rows = screened.names.map(({ symbol, ivRank, value, note, state }): Omit<CspScreenRow, "rank"> => ({
|
|
281
308
|
symbol, csp: value?.csp ?? null, delta: value?.delta ?? null, ivRank,
|
|
282
|
-
wideSpread: value ? cspWideSpread(value.csp, criteria.maxSpreadPercent) : false, note }));
|
|
309
|
+
wideSpread: value ? cspWideSpread(value.csp, criteria.maxSpreadPercent) : false, note, state }));
|
|
283
310
|
return { rows: rankCspScreen(rows), criteria, missingRanks: screened.missingRanks, ivRankError: screened.ivRankError,
|
|
284
311
|
freshness: screened.freshness };
|
|
285
312
|
}
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
import { scenarioFreshness } from "./freshness";
|
|
14
14
|
import { cashSecuredPut, cspReportEntries, loadNextEarningsDate } from "./csp";
|
|
15
15
|
import { formatSpotTime } from "../options/model-spot";
|
|
16
|
-
import { amountUnit, buildScenario, currencyLabel, exportPercent, parseLegs, scenarioValueUnit } from "./model";
|
|
16
|
+
import { amountUnit, buildScenario, currencyLabel, exportPercent, parseLegs, scenarioDateLabels, scenarioValueUnit } from "./model";
|
|
17
17
|
import { hedgeInputsFromSettings, hedgeReportEntries, scenarioHedgeBudget, seededLegQuotes } from "./hedge";
|
|
18
18
|
import { collarReportEntries, scenarioCollar } from "./collar";
|
|
19
19
|
import { modelDividendYieldNote } from "../../../market-data/model-dividend-yield";
|
|
@@ -168,7 +168,11 @@ export const optionsScenarioHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
168
168
|
formatted: `${money(lastPrint)} ${PRICE_UNIT}${lastSession && lastSession !== "last price" ? ` (${scenarioSpotStamp(lastSession, market.asOf)})` : ""}` }] : []),
|
|
169
169
|
...(position!.underlying ? [{ key: "shares", label: "Shares held", value: position!.underlying.quantity, unit: "shares",
|
|
170
170
|
formatted: `${position!.underlying.quantity.toLocaleString("en-US")} at ${money(position!.underlying.price)} ${PRICE_UNIT}` }] : []),
|
|
171
|
-
|
|
171
|
+
// The figures are valued at the scenario date; its spot, IVs and rate are as of the position's own time.
|
|
172
|
+
...(scenario.controls.date !== position!.asOf ? [
|
|
173
|
+
{ key: "asOf", label: "As of", value: new Date(position!.asOf).toISOString(), formatted: formatSpotTime(position!.asOf) },
|
|
174
|
+
{ key: "valuedAt", label: "Valued at", value: new Date(scenario.controls.date).toISOString(), formatted: formatSpotTime(scenario.controls.date) },
|
|
175
|
+
] : [{ key: "asOf", label: "Valued at", value: new Date(position!.asOf).toISOString(), formatted: formatSpotTime(position!.asOf) }]),
|
|
172
176
|
{ key: "rate", label: "Rate", value: exportPercent(position!.rate), unit: "%", formatted: percent(position!.rate) },
|
|
173
177
|
// A yield read as 0 because no dividend was paid, or the dividend stopped, says so; a stated or typed one is the figure alone.
|
|
174
178
|
{ key: "dividendYield", label: "Dividend yield", value: exportPercent(position!.dividendYield), unit: "%", formatted: percent(position!.dividendYield)
|
|
@@ -191,7 +195,7 @@ export const optionsScenarioHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
191
195
|
{ title: `Scenario grid (P&L, ${per})`, columns: [
|
|
192
196
|
{ key: "spot", header: "Spot/share", format: money },
|
|
193
197
|
{ key: "move", header: "Move", format: (value) => typeof value === "number" && Number.isFinite(value) ? `${(value * 100).toFixed(1)}%` : MISSING_VALUE },
|
|
194
|
-
...scenario.dates.map((
|
|
198
|
+
...scenarioDateLabels(scenario.dates).map((label, index) => ({ key: `date${index}`, header: label, format: money })),
|
|
195
199
|
], rows: scenario.grid.map((row) => ({ spot: row.spot, move: row.move,
|
|
196
200
|
...Object.fromEntries(row.values.map((value, index) => [`date${index}`, value])) })) },
|
|
197
201
|
] : [],
|
|
@@ -357,6 +357,38 @@ export function expiryRisk(position: ScenarioPosition): ScenarioExpiryRisk {
|
|
|
357
357
|
maxLoss: unlimitedLoss ? null : Math.max(0, -Math.min(...values)), unlimitedProfit, unlimitedLoss, reason: null };
|
|
358
358
|
}
|
|
359
359
|
|
|
360
|
+
const utcDay = (time: number) => new Date(time).toISOString().slice(0, 10);
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* The grid's dates: the origin, the scenario date the valuation is at, the
|
|
364
|
+
* first expiration close, and up to three even steps between the origin and
|
|
365
|
+
* the close, each on a day no other column is on. A three-day position reads
|
|
366
|
+
* the 17th, 18th, 19th and the 20th's close, never two 20ths.
|
|
367
|
+
*/
|
|
368
|
+
function scenarioGridDates(asOf: number, expiry: number, selected: number): number[] {
|
|
369
|
+
if (asOf === expiry) return [asOf];
|
|
370
|
+
const fixed = [...new Set([asOf, selected, expiry])];
|
|
371
|
+
const days = new Set(fixed.map(utcDay));
|
|
372
|
+
const steps = [1, 2, 3].map((index) => asOf + (expiry - asOf) * index / 4).filter((date) => {
|
|
373
|
+
const day = utcDay(date);
|
|
374
|
+
if (days.has(day)) return false;
|
|
375
|
+
days.add(day);
|
|
376
|
+
return true;
|
|
377
|
+
});
|
|
378
|
+
return [...fixed, ...steps].sort((a, b) => a - b);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* Each grid date as its column heads it: the UTC day, with the time where
|
|
383
|
+
* another column is on the same day (a position valued on its expiry day:
|
|
384
|
+
* `2026-11-20 14:30` and `2026-11-20 21:00`), so no two columns read alike.
|
|
385
|
+
*/
|
|
386
|
+
export function scenarioDateLabels(dates: readonly number[]): string[] {
|
|
387
|
+
const days = dates.map(utcDay);
|
|
388
|
+
return dates.map((date, index) => days.indexOf(days[index]!) !== days.lastIndexOf(days[index]!)
|
|
389
|
+
? `${days[index]} ${new Date(date).toISOString().slice(11, 16)}` : days[index]!);
|
|
390
|
+
}
|
|
391
|
+
|
|
360
392
|
export function buildScenario(position: ScenarioPosition, input: Partial<ScenarioControls> = {}): ScenarioModel {
|
|
361
393
|
const prepared = prepare(position);
|
|
362
394
|
const date = input.date ?? position.asOf;
|
|
@@ -372,8 +404,7 @@ export function buildScenario(position: ScenarioPosition, input: Partial<Scenari
|
|
|
372
404
|
const risk = expiryRisk(position);
|
|
373
405
|
if (risk.reason) warnings.push(risk.reason);
|
|
374
406
|
if (position.spot === 0) warnings.push("Spot is zero; percentage moves are unavailable.");
|
|
375
|
-
const dates = position.asOf
|
|
376
|
-
: Array.from({ length: 5 }, (_, index) => position.asOf + (prepared.expiryDate - position.asOf) * index / 4);
|
|
407
|
+
const dates = scenarioGridDates(position.asOf, prepared.expiryDate, controls.date);
|
|
377
408
|
const anchor = position.spot || Math.max(...position.legs.map((leg) => leg.strike));
|
|
378
409
|
const low = Math.max(0, position.spot * (1 - spotRange));
|
|
379
410
|
const high = anchor * (1 + spotRange);
|
|
@@ -35,7 +35,7 @@ import { collarStatItems, scenarioCollar } from "./collar";
|
|
|
35
35
|
import { useAssetData } from "../../runtime";
|
|
36
36
|
import { extendedSession, formatSpotTime } from "../options/model-spot";
|
|
37
37
|
import { useRemoteUiNode } from "../../../remote/semantic-tree";
|
|
38
|
-
import { buildScenario, currencyLabel, scenarioCurrency, scenarioValueUnit, UNKNOWN_CURRENCY, type ScenarioLeg, type ScenarioPosition,
|
|
38
|
+
import { buildScenario, currencyLabel, scenarioCurrency, scenarioDateLabels, scenarioValueUnit, UNKNOWN_CURRENCY, type ScenarioLeg, type ScenarioPosition,
|
|
39
39
|
type ScenarioControls, validatePosition } from "./model";
|
|
40
40
|
import { EMPTY_SAVED_STRATEGIES, restoreSavedStrategies, type SavedScenarioStrategy } from "./state";
|
|
41
41
|
import { useScenarioEvidence } from "./evidence";
|
|
@@ -385,7 +385,7 @@ export function OptionsScenarioPane({ width, height, focused }: PaneProps) {
|
|
|
385
385
|
emptyStateTitle="No scenario values." getItemKey={(row) => `${row.landmark ?? "step"}:${row.spot}`}
|
|
386
386
|
columns={[{ id: "spot", label: `Spot ${position?.currency ?? ""}`, width: 14, align: "right" }, { id: "move", label: "Move %", width: 10, align: "right" },
|
|
387
387
|
{ id: "mark", label: "", width: 10, align: "left" },
|
|
388
|
-
...scenario.dates.map((
|
|
388
|
+
...scenarioDateLabels(scenario.dates).map((label, i) => ({ id: String(i), label: label.slice(5), width: 13, align: "right" as const }))]}
|
|
389
389
|
renderCell={(row, column) => {
|
|
390
390
|
const atSpot = row.move != null && Math.abs(row.move) < 1e-9;
|
|
391
391
|
if (column.id === "spot") return { text: money(row.spot), color: row.landmark ? colors.warning : atSpot ? colors.textBright : colors.text };
|
|
@@ -413,8 +413,7 @@ export function OptionsScenarioPane({ width, height, focused }: PaneProps) {
|
|
|
413
413
|
width={width}
|
|
414
414
|
filters={[
|
|
415
415
|
{ id: "date", label: "Scenario date", controlRef: dateControl, value: String(scenario.controls.date),
|
|
416
|
-
options:
|
|
417
|
-
.map((date) => ({ value: String(date), label: `${dateLabel(date)} +${((date - scenario.position.asOf) / 86_400_000).toFixed(1)}d` })),
|
|
416
|
+
options: scenario.dates.map((date) => ({ value: String(date), label: `${dateLabel(date)} +${((date - scenario.position.asOf) / 86_400_000).toFixed(1)}d` })),
|
|
418
417
|
onChange: (value: string) => setControls({ ...scenario.controls, date: Number(value) }) },
|
|
419
418
|
// No shift reads as the "0" placeholder, so the field offers its reset only once there is a shift.
|
|
420
419
|
{ id: "vol", kind: "text", label: "Vol shift (pts)", width: 12, placeholder: "0", debounceMs: 0,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./client";
|
|
10
10
|
import { calendarDaysToExpiry, earningsBeforeExpiry, type CspEarnings } from "./csp";
|
|
11
11
|
import {
|
|
12
|
-
cspTargetDate, loadScreenMarket, nearestListedExpiry, readCspScreenCriteria, readNumber, screenNames, supplied,
|
|
12
|
+
cspTargetDate, loadScreenMarket, nearestListedExpiry, readCspScreenCriteria, readNumber, ScreenNameError, screenNames, supplied,
|
|
13
13
|
type CspScreen, type CspScreenCriteria, type CspScreenDependencies,
|
|
14
14
|
} from "./csp-screen";
|
|
15
15
|
import { seededLegQuotes } from "./hedge";
|
|
@@ -441,6 +441,8 @@ export interface StrategyScreenRow {
|
|
|
441
441
|
wideSpread: boolean;
|
|
442
442
|
/** Why the name has no trade. */
|
|
443
443
|
note: string | null;
|
|
444
|
+
/** That reason as its row's few words (`no price`, `no chain`). */
|
|
445
|
+
state: string | null;
|
|
444
446
|
}
|
|
445
447
|
|
|
446
448
|
export interface StrategyScreen extends Omit<CspScreen, "rows" | "criteria"> {
|
|
@@ -489,7 +491,7 @@ async function screenStrategy(
|
|
|
489
491
|
if (far == null) throw new Error(`No expiry listed after ${expiryIsoDate(near)} to buy`);
|
|
490
492
|
const back = await loadScenarioMarket({ instrument, expiration: far, signal }, dependencies);
|
|
491
493
|
if (!back.chain || back.warnings.includes("Options chain is stale")) {
|
|
492
|
-
throw new
|
|
494
|
+
throw new ScreenNameError(back.missingExpiry ?? `No current ${expiryIsoDate(far)} chain to buy the calendar on`, "no chain");
|
|
493
495
|
}
|
|
494
496
|
// The bought contracts by the date they are listed on in the catalogue.
|
|
495
497
|
const backExpiration = [...back.chain.calls, ...back.chain.puts][0]?.expiration ?? far;
|
|
@@ -505,10 +507,10 @@ export async function loadStrategyScreen(
|
|
|
505
507
|
instruments: readonly InstrumentRef[], criteria: StrategyScreenCriteria, dependencies: CspScreenDependencies, signal?: AbortSignal,
|
|
506
508
|
): Promise<StrategyScreen> {
|
|
507
509
|
const target = cspTargetDate(criteria, dependencies.scenario.now?.() ?? Date.now());
|
|
508
|
-
const screened = await screenNames(instruments, dependencies, signal, "No trade on this chain", async (instrument, earningsDate, scenario) =>
|
|
510
|
+
const screened = await screenNames(instruments, dependencies, signal, { fallback: "No trade on this chain", fallbackState: "no trade" }, async (instrument, earningsDate, scenario) =>
|
|
509
511
|
screenStrategy(instrument, criteria, scenario, target, earningsDate, signal));
|
|
510
|
-
const rows = screened.names.map(({ symbol, ivRank, value, note }): Omit<StrategyScreenRow, "rank"> => ({
|
|
511
|
-
symbol, trade: value, ivRank, note,
|
|
512
|
+
const rows = screened.names.map(({ symbol, ivRank, value, note, state }): Omit<StrategyScreenRow, "rank"> => ({
|
|
513
|
+
symbol, trade: value, ivRank, note, state,
|
|
512
514
|
wideSpread: value?.quote != null && value.quote.spreadOfMid * 100 > criteria.maxSpreadPercent }));
|
|
513
515
|
return { rows: rankStrategyScreen(rows, criteria.strategy), criteria, missingRanks: screened.missingRanks,
|
|
514
516
|
ivRankError: screened.ivRankError, freshness: screened.freshness };
|
|
@@ -16,6 +16,12 @@ import { reportDatesFrom, type ReportDate } from "./report-dates";
|
|
|
16
16
|
export interface PeBandInputs {
|
|
17
17
|
financials: TickerFinancials | null;
|
|
18
18
|
history: PricePoint[];
|
|
19
|
+
/**
|
|
20
|
+
* Daily closes as far back as they are served (PE_BAND_DAILY_RANGE): what
|
|
21
|
+
* dates a weekly bar's close and prices a figure on the day it became
|
|
22
|
+
* known. Empty when they failed; the weekly bars stand alone then.
|
|
23
|
+
*/
|
|
24
|
+
daily: PricePoint[];
|
|
19
25
|
stale: boolean;
|
|
20
26
|
/** Fundamentals failed: there is no EPS to price. */
|
|
21
27
|
error: string | null;
|
|
@@ -33,6 +39,8 @@ export interface PeBandInputs {
|
|
|
33
39
|
const CANCELLED = "P/E band load was cancelled";
|
|
34
40
|
/** Weekly bars: daily history is only served to 5Y, and the band covers every year of statements on record. */
|
|
35
41
|
const PE_BAND_HISTORY_RESOLUTION: ManualChartResolution = "1wk";
|
|
42
|
+
/** Daily closes are served this far back: a figure known within it is priced at its own day's close. */
|
|
43
|
+
const PE_BAND_DAILY_RANGE = "5Y";
|
|
36
44
|
/** The most reports the server returns for one company: about ten years of quarters. */
|
|
37
45
|
const REPORT_LIMIT = 40;
|
|
38
46
|
/** Report dates only refine the figures' dates, so the pane does not wait longer than this for them. */
|
|
@@ -96,7 +104,7 @@ export async function loadPeBandInputs(
|
|
|
96
104
|
const { instrument } = request;
|
|
97
105
|
// Asked alongside the statements when the instrument names a US exchange; otherwise once the quote has said where it lists.
|
|
98
106
|
const early = isUsListingExchange(instrument.exchange) ? loadReportDates(instrument.symbol, cloud) : null;
|
|
99
|
-
const [financials, chart] = await abortable(Promise.allSettled([
|
|
107
|
+
const [financials, chart, dailyChart] = await abortable(Promise.allSettled([
|
|
100
108
|
marketData.getTickerFinancials(instrument.symbol, instrument.exchange ?? "", {
|
|
101
109
|
brokerId: instrument.instrument?.brokerId ?? instrument.brokerId,
|
|
102
110
|
brokerInstanceId: instrument.instrument?.brokerInstanceId ?? instrument.brokerInstanceId,
|
|
@@ -106,12 +114,15 @@ export async function loadPeBandInputs(
|
|
|
106
114
|
}),
|
|
107
115
|
coordinator.loadChart({ instrument, bufferRange: "ALL", granularity: "resolution", resolution: PE_BAND_HISTORY_RESOLUTION },
|
|
108
116
|
{ forceRefresh: request.forceRefresh }),
|
|
117
|
+
coordinator.loadChart({ instrument, bufferRange: PE_BAND_DAILY_RANGE, granularity: "resolution", resolution: "1d" },
|
|
118
|
+
{ forceRefresh: request.forceRefresh }),
|
|
109
119
|
]), request.signal, CANCELLED).catch((error: unknown) => {
|
|
110
120
|
throw request.signal?.aborted || (error instanceof Error && error.name === "AbortError") ? abortError(CANCELLED) : error;
|
|
111
121
|
});
|
|
112
122
|
const value = financials.status === "fulfilled" ? financials.value : null;
|
|
113
123
|
const entry = chart.status === "fulfilled" ? chart.value : null;
|
|
114
124
|
const history = entry ? resolveEntryValue(entry) ?? [] : [];
|
|
125
|
+
const daily = dailyChart.status === "fulfilled" && !dailyChart.value.error ? resolveEntryValue(dailyChart.value) ?? [] : [];
|
|
115
126
|
const quote = value?.quote;
|
|
116
127
|
const [reports, fx] = await abortable(Promise.all([
|
|
117
128
|
early ?? (isUsListingExchange(quote?.listingExchangeName ?? quote?.exchangeName ?? quote?.fullExchangeName)
|
|
@@ -121,6 +132,7 @@ export async function loadPeBandInputs(
|
|
|
121
132
|
return {
|
|
122
133
|
financials: value,
|
|
123
134
|
history,
|
|
135
|
+
daily,
|
|
124
136
|
reports,
|
|
125
137
|
fx: fx.fx,
|
|
126
138
|
fxError: fx.error,
|
|
@@ -15,7 +15,7 @@ export const peBandHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
15
15
|
freshness: { ...DAILY_CLOSES, basis: "daily closes and reported EPS" },
|
|
16
16
|
describe: (args) => `PEB ${args.symbols[0] ?? ""}`,
|
|
17
17
|
discovery: { screenshotReadiness: "live-dom", limitations: [
|
|
18
|
-
"Weekly closes. EPS reported in another currency than a dollar price is converted at daily FX closes; other currency pairs are not computed.",
|
|
18
|
+
"Weekly closes; each EPS figure is priced at the close of the day it became known where daily closes reach. EPS reported in another currency than a dollar price is converted at daily FX closes; other currency pairs are not computed.",
|
|
19
19
|
] },
|
|
20
20
|
options: [
|
|
21
21
|
{ key: "lookbackYears", type: "integer", minimum: 0, maximum: 30, defaultValue: 10, description: "Years of history; 0 for all on record" },
|
|
@@ -26,7 +26,7 @@ export const peBandHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
26
26
|
ctx.signal.throwIfAborted();
|
|
27
27
|
const lookbackYears = Number(args.options.lookbackYears ?? 10);
|
|
28
28
|
const model = projectPeBand(inputs.financials, inputs.history, { symbol: instrument.symbol, lookbackYears, reports: inputs.reports,
|
|
29
|
-
fx: inputs.fx, fxError: inputs.fxError });
|
|
29
|
+
fx: inputs.fx, fxError: inputs.fxError, daily: inputs.daily });
|
|
30
30
|
const current = model.current;
|
|
31
31
|
const conversion = model.conversion;
|
|
32
32
|
const pairQuote = (rate: number) => {
|