@gloom-sh/terminal 0.20.12 → 0.20.14
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 +2 -1
- package/patches/@opentui%2Fcore@0.3.2.patch +22 -4
- package/src/account/auth-dialog.tsx +22 -4
- package/src/account/auth-form.tsx +6 -1
- package/src/account/billing.ts +3 -2
- package/src/account/checkout-handoff.tsx +7 -14
- package/src/account/device-signin-dialog.tsx +35 -24
- package/src/account/upgrade-dialog.tsx +8 -8
- package/src/api-client/crypto-markets.ts +10 -0
- package/src/api-client/errors.ts +3 -1
- package/src/api-client/index.ts +10 -2
- package/src/api-client/install-experiments.ts +146 -0
- package/src/api-client/money-markets.ts +7 -0
- package/src/api-client/request.ts +12 -2
- package/src/api-client/telemetry.ts +47 -0
- package/src/api-client/types/market.ts +4 -0
- package/src/api-client/types/news.ts +16 -0
- package/src/architecture/floating-promise-allowlist.json +17 -34
- package/src/brokers/signed-in/adapter.ts +2 -2
- package/src/brokers/signed-in/catalog.ts +13 -4
- package/src/brokers/signed-in/sign-in-dialog.tsx +38 -38
- package/src/cli/commands/market.ts +146 -55
- package/src/cli/commands/overview.ts +21 -7
- package/src/cli/commands/search.ts +103 -9
- package/src/cli/commands/ticker.ts +22 -13
- package/src/cli/earnings-calendar.ts +33 -53
- package/src/cli/errors.ts +3 -1
- package/src/cli/freshness.ts +7 -2
- package/src/cli/glossary.ts +10 -5
- package/src/cli/helpers.ts +8 -16
- package/src/cli/history-export.ts +4 -0
- package/src/cli/history-rows.ts +18 -1
- package/src/cli/known-gaps.ts +11 -2
- package/src/cli/listing-arg.ts +183 -28
- package/src/cli/not-a-ticker.ts +4 -0
- package/src/cli/pane-functions/catalog.ts +81 -12
- package/src/cli/pane-functions/dom.ts +8 -1
- package/src/cli/pane-functions/freshness.ts +2 -2
- package/src/cli/pane-functions/headless.ts +13 -10
- package/src/cli/pane-functions/index.ts +1 -1
- package/src/cli/pane-functions/options.ts +7 -0
- package/src/cli/pane-functions/report.ts +4 -1
- package/src/cli/pane-functions/resolver.ts +61 -15
- package/src/cli/perpetual-contract.ts +4 -4
- package/src/cli/quote-answer.ts +6 -2
- package/src/cli/result.ts +24 -5
- package/src/cli/symbol-args.ts +5 -3
- package/src/cli/symbol-list.ts +23 -10
- package/src/cli/symbol-rows.ts +135 -3
- package/src/cli/treasury-yields.ts +15 -1
- package/src/components/chart/composite/axis-overlays.tsx +5 -2
- package/src/components/chart/composite/composite-chart.tsx +1 -0
- package/src/components/chart/composite/format.ts +103 -16
- package/src/components/chart/composite/legend.tsx +60 -25
- package/src/components/chart/composite/panel-surface/axis-markers.ts +133 -0
- package/src/components/chart/composite/panel-surface/level-labels.tsx +78 -0
- package/src/components/chart/composite/panel-surface/overlays.ts +108 -0
- package/src/components/chart/composite/panel-surface/pan-coast.ts +54 -0
- package/src/components/chart/composite/panel-surface/panel-cursor.tsx +138 -0
- package/src/components/chart/composite/panel-surface/panel-levels.ts +47 -0
- package/src/components/chart/composite/panel-surface/plot-gestures.ts +403 -0
- package/src/components/chart/composite/panel-surface/plot-pointer.ts +65 -0
- package/src/components/chart/composite/panel-surface/plot-wheel.ts +102 -0
- package/src/components/chart/composite/panel-surface/pointer.ts +12 -0
- package/src/components/chart/composite/panel-surface/props.ts +79 -0
- package/src/components/chart/composite/panel-surface/tool-readout.ts +151 -0
- package/src/components/chart/composite/panel-surface/value-axis-gestures.ts +152 -0
- package/src/components/chart/composite/panel-surface.tsx +81 -1177
- package/src/components/chart/composite/time-axis.ts +51 -29
- package/src/components/chart/composite/toolbar.tsx +42 -6
- package/src/components/chart/curve/curve-surface.tsx +5 -5
- package/src/components/command-bar/commands/collection-list.ts +1 -0
- package/src/components/command-bar/list/badge.ts +8 -5
- package/src/components/command-bar/list/model.ts +0 -5
- package/src/components/command-bar/list/view.tsx +39 -2
- package/src/components/command-bar/routes/root/plugin-install.ts +4 -2
- package/src/components/command-bar/routes/root/provider-search.ts +23 -3
- package/src/components/command-bar/routes/root/results.ts +23 -11
- package/src/components/command-bar/routes/root/runtime.ts +3 -2
- package/src/components/command-bar/routes/root/selection.ts +3 -2
- package/src/components/command-bar/routes/root/shortcuts.ts +15 -0
- package/src/components/command-bar/routes/root/start-here.ts +1 -2
- package/src/components/command-bar/routes/ticker-search/actions.ts +2 -3
- package/src/components/command-bar/routes/ticker-search/results.ts +23 -4
- package/src/components/data-table/view.tsx +29 -6
- package/src/components/form-modal/host.tsx +1 -1
- package/src/components/layout/header.tsx +3 -2
- package/src/components/layout/market-summary.ts +3 -3
- package/src/components/layout/pane/error-boundary.tsx +2 -1
- package/src/components/layout/pane/title.ts +10 -4
- package/src/components/markdown-text.tsx +36 -0
- package/src/components/market-board/index.tsx +4 -3
- package/src/components/onboarding/first-run-workspace.ts +46 -11
- package/src/components/onboarding/onboarding-keyboard.ts +57 -5
- package/src/components/onboarding/onboarding-wizard.tsx +91 -24
- package/src/components/onboarding/portfolio-step/index.tsx +1 -0
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +36 -9
- package/src/components/onboarding/portfolio-step/types.ts +2 -0
- package/src/components/onboarding/tickers-step-model.ts +140 -0
- package/src/components/onboarding/tickers-step.tsx +116 -0
- package/src/components/onboarding/use-onboarding-broker-form.ts +1 -1
- package/src/components/onboarding/use-onboarding-progress.ts +100 -11
- package/src/components/onboarding/use-onboarding-upgrade.ts +3 -2
- package/src/components/onboarding/wizard-model.ts +3 -1
- package/src/components/onboarding/wizard-tickers.ts +139 -0
- package/src/components/pane-settings-dialog/tui.tsx +6 -3
- package/src/components/pane-settings-dialog.tsx +2 -1
- package/src/components/pane-template-wizard.tsx +2 -0
- package/src/components/price-performance.tsx +2 -2
- package/src/components/speedometer-gauge/model.ts +2 -1
- package/src/components/speedometer-gauge/terminal.tsx +13 -8
- package/src/components/ui/choice-dialog.tsx +102 -33
- package/src/components/ui/confirm-dialog.tsx +3 -2
- package/src/components/ui/frame.tsx +7 -3
- package/src/components/ui/icon.tsx +4 -2
- package/src/components/ui/list-view.tsx +8 -0
- package/src/components/ui/multi-select/dialog.tsx +1 -7
- package/src/components/ui/not-meaningful.ts +16 -0
- package/src/components/ui/number-prompt-dialog.tsx +2 -1
- package/src/components/ui/query-bar.tsx +16 -4
- package/src/components/ui/stat-grid.tsx +27 -6
- package/src/components/use-pane-notice-footer.tsx +3 -1
- package/src/data/config/store/normalize.ts +2 -0
- package/src/docs/snapshot.json +3 -3
- package/src/i18n/es.ts +6 -2
- package/src/i18n/ja.ts +6 -2
- package/src/i18n/ko.ts +6 -2
- package/src/i18n/zh-cn.ts +6 -2
- package/src/i18n/zh-tw.ts +6 -2
- package/src/layout-marketplace/model.ts +2 -1
- package/src/market-data/futures-contract.ts +2 -1
- package/src/market-data/hooks.tsx +1 -1
- package/src/market-data/market/change-basis.ts +27 -5
- package/src/market-data/market/format.ts +48 -14
- package/src/market-data/quotes/contributions.ts +13 -0
- package/src/market-data/quotes/export-identity.ts +36 -1
- package/src/market-data/quotes/listing-enterprise-value.ts +3 -3
- package/src/market-data/quotes/resolution.ts +16 -0
- package/src/market-data/quotes/time.ts +17 -10
- package/src/market-data/tax-equivalent.ts +3 -2
- package/src/news/aggregator.ts +19 -8
- package/src/news/hooks.ts +1 -1
- package/src/news/news-model.ts +49 -0
- package/src/news/types.ts +9 -0
- package/src/plugins/builtin/account-management/calendar-tab.tsx +8 -3
- package/src/plugins/builtin/account-management/pane.tsx +9 -8
- package/src/plugins/builtin/account-management/password-dialog.tsx +2 -2
- package/src/plugins/builtin/alerts/calendar-events.ts +4 -5
- package/src/plugins/builtin/alerts/format.ts +6 -5
- package/src/plugins/builtin/alerts/headless.ts +3 -2
- package/src/plugins/builtin/alerts/history.ts +2 -1
- package/src/plugins/builtin/alerts/pane.tsx +2 -1
- package/src/plugins/builtin/alerts/price-text.ts +2 -1
- package/src/plugins/builtin/alerts/scheduled.ts +6 -5
- package/src/plugins/builtin/analytics/account-returns.ts +6 -7
- package/src/plugins/builtin/analytics/display.ts +2 -1
- package/src/plugins/builtin/analytics/pane-model.ts +5 -9
- package/src/plugins/builtin/analytics/risk-client.ts +12 -2
- package/src/plugins/builtin/analytics/risk-headless.ts +66 -6
- package/src/plugins/builtin/analytics/risk-math.ts +23 -6
- package/src/plugins/builtin/analytics/risk-model.ts +26 -15
- package/src/plugins/builtin/analytics/risk-pane.tsx +8 -7
- package/src/plugins/builtin/analytics/view.tsx +5 -5
- package/src/plugins/builtin/attention/model.ts +6 -5
- package/src/plugins/builtin/attention/pane.tsx +5 -4
- package/src/plugins/builtin/awards/detail.tsx +5 -4
- package/src/plugins/builtin/awards/headless.ts +8 -7
- package/src/plugins/builtin/awards/model.ts +4 -3
- package/src/plugins/builtin/awards/pane.tsx +4 -4
- package/src/plugins/builtin/backtest/format.ts +3 -2
- package/src/plugins/builtin/backtest/report.ts +3 -2
- package/src/plugins/builtin/bond-calculator/headless.ts +2 -1
- package/src/plugins/builtin/bond-calculator/pane.tsx +2 -1
- package/src/plugins/builtin/broker-manager/add-flow.tsx +1 -1
- package/src/plugins/builtin/broker-trading/orders-data.ts +3 -3
- package/src/plugins/builtin/broker-trading/orders.tsx +3 -2
- package/src/plugins/builtin/broker-trading/ticket.tsx +2 -2
- package/src/plugins/builtin/buildout/cells.tsx +2 -1
- package/src/plugins/builtin/buildout/company/pane.tsx +4 -3
- package/src/plugins/builtin/buildout/data-runtime.ts +21 -23
- package/src/plugins/builtin/buildout/detail/values.ts +2 -1
- package/src/plugins/builtin/buildout/format.ts +4 -3
- package/src/plugins/builtin/buildout/pane/index.tsx +3 -3
- package/src/plugins/builtin/catalysts/detail.tsx +2 -1
- package/src/plugins/builtin/catalysts/model.ts +6 -5
- package/src/plugins/builtin/catalysts/pane.tsx +2 -1
- package/src/plugins/builtin/cds/headless.ts +3 -2
- package/src/plugins/builtin/cds/model.ts +8 -8
- package/src/plugins/builtin/cds/pane.tsx +3 -2
- package/src/plugins/builtin/central-bank-rates/headless.ts +2 -1
- package/src/plugins/builtin/central-bank-rates/model.ts +3 -2
- package/src/plugins/builtin/central-bank-rates/pane.tsx +5 -5
- package/src/plugins/builtin/changelog/index.tsx +2 -2
- package/src/plugins/builtin/chart-composer/catalog-inventory.ts +5 -2
- package/src/plugins/builtin/chart-composer/editor.tsx +1 -0
- package/src/plugins/builtin/chart-composer/index.tsx +4 -2
- package/src/plugins/builtin/chart-composer/pane.tsx +8 -4
- package/src/plugins/builtin/chart-composer/quick-add.tsx +4 -1
- package/src/plugins/builtin/chart-composer/series-catalog.ts +17 -1
- package/src/plugins/builtin/chart-composer/use-series-catalog.ts +3 -1
- package/src/plugins/builtin/chart-composer/user-series.ts +3 -1
- package/src/plugins/builtin/chat/attachments/desktop.tsx +2 -1
- package/src/plugins/builtin/chat/controller/utils.ts +2 -1
- package/src/plugins/builtin/clinical-trials/model.ts +4 -3
- package/src/plugins/builtin/clinical-trials/sponsor-tickers.ts +4 -2
- package/src/plugins/builtin/cloud/askg/lock-note.ts +16 -4
- package/src/plugins/builtin/cloud/askg/model.ts +2 -1
- package/src/plugins/builtin/cloud/askg/pane.tsx +35 -1
- package/src/plugins/builtin/cloud/company-picker.tsx +1 -3
- package/src/plugins/builtin/cloud/plugin.tsx +2 -0
- package/src/plugins/builtin/cloud/team/pane.tsx +12 -12
- package/src/plugins/builtin/cloud/thesis/detail.tsx +13 -8
- package/src/plugins/builtin/cloud/thesis/module.tsx +2 -0
- package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +6 -2
- package/src/plugins/builtin/cloud-tweets/model.ts +2 -2
- package/src/plugins/builtin/comment-letters/pane.tsx +2 -1
- package/src/plugins/builtin/commodity-balances/headless.ts +3 -2
- package/src/plugins/builtin/company-attention/app-rank.tsx +5 -4
- package/src/plugins/builtin/company-attention/building-model.ts +7 -7
- package/src/plugins/builtin/company-attention/headless.ts +6 -5
- package/src/plugins/builtin/company-attention/model.ts +4 -4
- package/src/plugins/builtin/company-attention/moves-model.ts +9 -9
- package/src/plugins/builtin/company-attention/signals-model.ts +9 -9
- package/src/plugins/builtin/company-kpis/headless.ts +2 -1
- package/src/plugins/builtin/company-kpis/model.ts +15 -10
- package/src/plugins/builtin/company-kpis/pane.tsx +2 -2
- package/src/plugins/builtin/congress-trades/detail.tsx +6 -5
- package/src/plugins/builtin/congress-trades/headless.ts +2 -1
- package/src/plugins/builtin/congress-trades/model.ts +6 -6
- package/src/plugins/builtin/congress-trades/table.tsx +7 -6
- package/src/plugins/builtin/connections/pane.tsx +5 -5
- package/src/plugins/builtin/correlation/headless.ts +2 -2
- package/src/plugins/builtin/correlation/index.tsx +4 -1
- package/src/plugins/builtin/correlation/matrix/selection.ts +2 -1
- package/src/plugins/builtin/correlation/relationship/view-model.ts +3 -3
- package/src/plugins/builtin/cot/headless.ts +3 -2
- package/src/plugins/builtin/cot/model.ts +2 -1
- package/src/plugins/builtin/cot/pane.tsx +4 -3
- package/src/plugins/builtin/cpi/headless.ts +10 -4
- package/src/plugins/builtin/cpi/model.ts +25 -7
- package/src/plugins/builtin/cpi/pane.tsx +3 -1
- package/src/plugins/builtin/credit-boards/cdx-pane.tsx +5 -4
- package/src/plugins/builtin/credit-boards/headless.ts +2 -1
- package/src/plugins/builtin/credit-boards/model.ts +5 -5
- package/src/plugins/builtin/credit-conditions/headless.ts +2 -1
- package/src/plugins/builtin/credit-conditions/index.tsx +2 -2
- package/src/plugins/builtin/credit-documents/model.ts +2 -2
- package/src/plugins/builtin/crypto-board/client.ts +6 -1
- package/src/plugins/builtin/crypto-board/defi-view.tsx +7 -7
- package/src/plugins/builtin/crypto-board/defi.ts +2 -2
- package/src/plugins/builtin/crypto-board/headless.ts +10 -2
- package/src/plugins/builtin/crypto-board/model.ts +93 -14
- package/src/plugins/builtin/crypto-board/pane.tsx +28 -13
- package/src/plugins/builtin/crypto-board/supply.ts +2 -2
- package/src/plugins/builtin/crypto-etf-flows/model.ts +4 -4
- package/src/plugins/builtin/custom-view/index.tsx +3 -1
- package/src/plugins/builtin/custom-view/pane.tsx +5 -1
- package/src/plugins/builtin/custom-view/view-spec.ts +11 -0
- package/src/plugins/builtin/debt-maturities/model.ts +3 -3
- package/src/plugins/builtin/debt-maturities/pane.tsx +2 -2
- package/src/plugins/builtin/dividend-yield/client.ts +31 -5
- package/src/plugins/builtin/dividend-yield/headless.ts +20 -13
- package/src/plugins/builtin/dividend-yield/pane.tsx +12 -10
- package/src/plugins/builtin/dividend-yield/ranking-view.tsx +4 -1
- package/src/plugins/builtin/dividend-yield/ranking.ts +21 -12
- package/src/plugins/builtin/dividend-yield/types.ts +4 -0
- package/src/plugins/builtin/dividend-yield/view.ts +8 -4
- package/src/plugins/builtin/docs/use-docs.ts +4 -2
- package/src/plugins/builtin/doe/headless.ts +2 -1
- package/src/plugins/builtin/doe/model.ts +12 -11
- package/src/plugins/builtin/earnings/board-model.ts +14 -8
- package/src/plugins/builtin/earnings/board-table.ts +13 -8
- package/src/plugins/builtin/earnings/calendar-model.ts +5 -5
- package/src/plugins/builtin/earnings/calendar.tsx +2 -1
- package/src/plugins/builtin/earnings/format.ts +16 -14
- package/src/plugins/builtin/earnings/headless.ts +57 -19
- package/src/plugins/builtin/earnings/history-model.ts +11 -7
- package/src/plugins/builtin/earnings/history-table.ts +22 -9
- package/src/plugins/builtin/earnings/history.tsx +4 -3
- package/src/plugins/builtin/earnings-calls/calendar.tsx +2 -1
- package/src/plugins/builtin/earnings-calls/format.ts +6 -5
- package/src/plugins/builtin/earnings-calls/upcoming.ts +5 -5
- package/src/plugins/builtin/earnings-ripple/headless.ts +2 -1
- package/src/plugins/builtin/earnings-ripple/index.tsx +2 -0
- package/src/plugins/builtin/earnings-ripple/model.ts +3 -2
- package/src/plugins/builtin/earnings-ripple/pane.tsx +6 -6
- package/src/plugins/builtin/econ/calendar-model.ts +19 -3
- package/src/plugins/builtin/econ/detail-view.tsx +2 -2
- package/src/plugins/builtin/econ/fred-catalog.ts +33 -4
- package/src/plugins/builtin/econ/index.tsx +7 -6
- package/src/plugins/builtin/econ-statistics/detail.tsx +2 -1
- package/src/plugins/builtin/econ-statistics/headless.ts +25 -4
- package/src/plugins/builtin/econ-statistics/pane.tsx +2 -2
- package/src/plugins/builtin/equity-screener/headless.ts +5 -5
- package/src/plugins/builtin/equity-screener/model.ts +6 -4
- package/src/plugins/builtin/equity-screener/pane.tsx +7 -7
- package/src/plugins/builtin/equity-screener/screen-check.ts +2 -1
- package/src/plugins/builtin/equity-screener/ticker-check.tsx +2 -1
- package/src/plugins/builtin/estimate-revisions/model.ts +3 -2
- package/src/plugins/builtin/estimate-revisions/pane.tsx +8 -8
- package/src/plugins/builtin/executives/format.ts +4 -4
- package/src/plugins/builtin/exposure/headless.ts +8 -8
- package/src/plugins/builtin/exposure/model.ts +4 -3
- package/src/plugins/builtin/exposure/pane.tsx +6 -5
- package/src/plugins/builtin/fear-greed/format.ts +7 -7
- package/src/plugins/builtin/fear-greed/headless.ts +2 -1
- package/src/plugins/builtin/filing-events/feed.ts +2 -1
- package/src/plugins/builtin/futures/table.tsx +8 -8
- package/src/plugins/builtin/futures-curve/headless.ts +18 -18
- package/src/plugins/builtin/futures-curve/model.ts +5 -5
- package/src/plugins/builtin/futures-curve/pane.tsx +8 -8
- package/src/plugins/builtin/fx-matrix/index.tsx +2 -2
- package/src/plugins/builtin/fx-matrix/pairs.ts +2 -1
- package/src/plugins/builtin/gpu/board.tsx +6 -5
- package/src/plugins/builtin/gpu/changes.tsx +2 -1
- package/src/plugins/builtin/gpu/equities.tsx +2 -2
- package/src/plugins/builtin/gpu/headless.ts +4 -3
- package/src/plugins/builtin/gpu/model.ts +8 -7
- package/src/plugins/builtin/help/functions-table.tsx +41 -9
- package/src/plugins/builtin/help/index.tsx +6 -3
- package/src/plugins/builtin/help/keybindings-editor.tsx +35 -7
- package/src/plugins/builtin/help/shortcut-table.tsx +19 -7
- package/src/plugins/builtin/help/table-cells.tsx +51 -0
- package/src/plugins/builtin/holders/pane.tsx +4 -1
- package/src/plugins/builtin/insider/base-values.ts +2 -2
- package/src/plugins/builtin/insider/display.ts +2 -1
- package/src/plugins/builtin/insider/headless.ts +16 -16
- package/src/plugins/builtin/insider/insider-data.ts +2 -1
- package/src/plugins/builtin/insider/signals-model.ts +3 -3
- package/src/plugins/builtin/insider/table-model.ts +27 -13
- package/src/plugins/builtin/insider/table.tsx +1 -1
- package/src/plugins/builtin/ipo-calendar/model.ts +4 -4
- package/src/plugins/builtin/iv-history/format.ts +8 -7
- package/src/plugins/builtin/iv-history/headless.ts +9 -8
- package/src/plugins/builtin/iv-history/pane.tsx +3 -2
- package/src/plugins/builtin/iv-history/screen-pane.tsx +5 -4
- package/src/plugins/builtin/jobs/headless.ts +11 -11
- package/src/plugins/builtin/jobs/model.ts +2 -2
- package/src/plugins/builtin/jobs/pane.tsx +5 -5
- package/src/plugins/builtin/jodi/model.ts +2 -2
- package/src/plugins/builtin/jodi/pane.tsx +2 -1
- package/src/plugins/builtin/kelly-sizer/headless.ts +4 -4
- package/src/plugins/builtin/kelly-sizer/model.ts +2 -1
- package/src/plugins/builtin/kelly-sizer/sections.tsx +2 -2
- package/src/plugins/builtin/macro-day/headless.ts +27 -15
- package/src/plugins/builtin/macro-day/model.ts +42 -4
- package/src/plugins/builtin/macro-day/pane.tsx +30 -12
- package/src/plugins/builtin/macro-day/releases.ts +24 -1
- package/src/plugins/builtin/market-halts/model.ts +11 -10
- package/src/plugins/builtin/market-halts/pane.tsx +2 -1
- package/src/plugins/builtin/market-heatmap/index.tsx +4 -4
- package/src/plugins/builtin/market-movers/session-table.ts +3 -3
- package/src/plugins/builtin/market-movers/session.ts +2 -1
- package/src/plugins/builtin/market-movers/table.ts +5 -5
- package/src/plugins/builtin/market-valuation/detail.tsx +2 -2
- package/src/plugins/builtin/market-valuation/headless.ts +7 -7
- package/src/plugins/builtin/market-valuation/pane.tsx +7 -7
- package/src/plugins/builtin/members/breadth-pane.tsx +5 -4
- package/src/plugins/builtin/members/headless.ts +2 -1
- package/src/plugins/builtin/members/model.ts +3 -2
- package/src/plugins/builtin/members/pane.tsx +10 -9
- package/src/plugins/builtin/mna/distress/model.ts +2 -1
- package/src/plugins/builtin/mna/model.ts +5 -5
- package/src/plugins/builtin/money-markets/client.ts +4 -1
- package/src/plugins/builtin/money-markets/headless.ts +17 -5
- package/src/plugins/builtin/money-markets/index.tsx +1 -1
- package/src/plugins/builtin/money-markets/model.ts +3 -2
- package/src/plugins/builtin/money-markets/pane.tsx +11 -5
- package/src/plugins/builtin/news/headless.ts +5 -2
- package/src/plugins/builtin/news/wire/breaking/notifications.ts +21 -19
- package/src/plugins/builtin/news/wire/news/row.ts +3 -1
- package/src/plugins/builtin/news/wire/news/table.tsx +3 -2
- package/src/plugins/builtin/news/wire/persisted-articles.ts +28 -3
- package/src/plugins/builtin/notes/headless.ts +2 -1
- package/src/plugins/builtin/notes/model.ts +2 -1
- package/src/plugins/builtin/openfda/pane.tsx +4 -3
- package/src/plugins/builtin/options/carry.ts +3 -2
- package/src/plugins/builtin/options/market-reference.ts +2 -1
- package/src/plugins/builtin/options/table.ts +48 -9
- package/src/plugins/builtin/options/view.tsx +47 -17
- package/src/plugins/builtin/options-calculator/headless.ts +3 -2
- package/src/plugins/builtin/options-calculator/pane.tsx +7 -7
- package/src/plugins/builtin/options-positioning/headless.ts +8 -7
- package/src/plugins/builtin/options-positioning/model.ts +10 -10
- package/src/plugins/builtin/options-positioning/pane.tsx +5 -5
- package/src/plugins/builtin/options-scenario/collar.ts +5 -4
- package/src/plugins/builtin/options-scenario/csp-screen-headless.ts +11 -10
- package/src/plugins/builtin/options-scenario/csp-screen-pane.tsx +15 -14
- package/src/plugins/builtin/options-scenario/csp-screen.ts +2 -1
- package/src/plugins/builtin/options-scenario/csp.ts +6 -5
- package/src/plugins/builtin/options-scenario/headless.ts +6 -5
- package/src/plugins/builtin/options-scenario/hedge.ts +3 -3
- package/src/plugins/builtin/options-scenario/pane.tsx +7 -6
- package/src/plugins/builtin/options-scenario/strategy-screen.ts +1 -1
- package/src/plugins/builtin/pe-band/headless.ts +9 -8
- package/src/plugins/builtin/pe-band/pane.tsx +7 -7
- package/src/plugins/builtin/perps/cascade.ts +3 -2
- package/src/plugins/builtin/perps/headless.ts +10 -9
- package/src/plugins/builtin/perps/model.ts +14 -14
- package/src/plugins/builtin/perps/pane.tsx +3 -2
- package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +4 -2
- package/src/plugins/builtin/portfolio-list/cli/period-report.ts +61 -11
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +11 -3
- package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +2 -0
- package/src/plugins/builtin/portfolio-list/header.tsx +2 -2
- package/src/plugins/builtin/portfolio-list/headless.ts +33 -6
- package/src/plugins/builtin/portfolio-list/index.tsx +3 -2
- package/src/plugins/builtin/portfolio-list/pane/futures-terms.ts +4 -2
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +5 -3
- package/src/plugins/builtin/portfolio-list/pane/period-pnl.ts +26 -7
- package/src/plugins/builtin/portfolio-list/pane/purchase-date-fx.ts +4 -2
- package/src/plugins/builtin/portfolio-list/period-pnl.ts +16 -1
- package/src/plugins/builtin/portfolio-list/quick-add/index.tsx +2 -2
- package/src/plugins/builtin/portfolio-list/settings.ts +4 -1
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +8 -5
- package/src/plugins/builtin/portfolio-list/summary/totals.ts +6 -4
- package/src/plugins/builtin/portfolio-list/table.tsx +25 -15
- package/src/plugins/builtin/power/detail.tsx +6 -5
- package/src/plugins/builtin/power/gas-model.ts +8 -7
- package/src/plugins/builtin/power/gas.tsx +2 -1
- package/src/plugins/builtin/power/headless.ts +7 -6
- package/src/plugins/builtin/power/model.ts +3 -2
- package/src/plugins/builtin/power/prices-headless.ts +10 -9
- package/src/plugins/builtin/power/prices-model.ts +3 -2
- package/src/plugins/builtin/power/prices.tsx +2 -1
- package/src/plugins/builtin/primary-dealers/model.ts +3 -3
- package/src/plugins/builtin/primary-dealers/pane.tsx +2 -2
- package/src/plugins/builtin/rate-path/headless.ts +8 -7
- package/src/plugins/builtin/rate-path/model.ts +6 -5
- package/src/plugins/builtin/rate-path/pane.tsx +6 -5
- package/src/plugins/builtin/realized-vol/fx-proxy.ts +2 -1
- package/src/plugins/builtin/realized-vol/headless.ts +11 -10
- package/src/plugins/builtin/realized-vol/pane.tsx +5 -4
- package/src/plugins/builtin/relative-rotation/headless.ts +2 -1
- package/src/plugins/builtin/relative-rotation/pane.tsx +6 -6
- package/src/plugins/builtin/research/analyst-headless.ts +5 -5
- package/src/plugins/builtin/research/analyst-model.ts +7 -7
- package/src/plugins/builtin/research/analyst-pane.tsx +7 -7
- package/src/plugins/builtin/research/client.ts +14 -0
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +40 -30
- package/src/plugins/builtin/research/event-model.ts +55 -22
- package/src/plugins/builtin/research/event-sources.ts +26 -8
- package/src/plugins/builtin/research/relative-valuation-columns.ts +20 -12
- package/src/plugins/builtin/research/relative-valuation-currency.ts +16 -0
- package/src/plugins/builtin/research/relative-valuation-headless.ts +33 -21
- package/src/plugins/builtin/research/relative-valuation-model.ts +31 -17
- package/src/plugins/builtin/research/relative-valuation-pane.tsx +29 -14
- package/src/plugins/builtin/research-search/model.ts +2 -1
- package/src/plugins/builtin/research-search/saved-view.tsx +4 -3
- package/src/plugins/builtin/revenue-breakdown/model.ts +4 -4
- package/src/plugins/builtin/reverse-dcf/headless.ts +7 -7
- package/src/plugins/builtin/reverse-dcf/model.ts +4 -4
- package/src/plugins/builtin/reverse-dcf/pane.tsx +2 -2
- package/src/plugins/builtin/scanner/flow-model.ts +7 -4
- package/src/plugins/builtin/scanner/flow-pane.tsx +1 -1
- package/src/plugins/builtin/scanner/headless.ts +3 -2
- package/src/plugins/builtin/scanner/hilo-model.ts +2 -1
- package/src/plugins/builtin/scanner/live-headless.ts +2 -2
- package/src/plugins/builtin/scanner/live-model.ts +3 -2
- package/src/plugins/builtin/scanner/live-pane.tsx +5 -5
- package/src/plugins/builtin/seasonality/headless.ts +2 -1
- package/src/plugins/builtin/seasonality/pane.tsx +4 -3
- package/src/plugins/builtin/sec/filing-display.tsx +12 -15
- package/src/plugins/builtin/sec/fund-facts.ts +2 -2
- package/src/plugins/builtin/sec/headless.ts +2 -1
- package/src/plugins/builtin/sec/index.tsx +6 -2
- package/src/plugins/builtin/sectors/headless.ts +4 -4
- package/src/plugins/builtin/sectors/index.tsx +7 -7
- package/src/plugins/builtin/shared/cloud-upgrade.ts +4 -2
- package/src/plugins/builtin/shared/cpi-year-gap.ts +67 -0
- package/src/plugins/builtin/shared/earnings-calendar.ts +90 -6
- package/src/plugins/builtin/shared/earnings-report.ts +13 -6
- package/src/plugins/builtin/shared/research-cells.tsx +2 -2
- package/src/plugins/builtin/shared/source-footer.ts +2 -1
- package/src/plugins/builtin/shared/trend.ts +2 -2
- package/src/plugins/builtin/shared/use-quote-board.ts +9 -8
- package/src/plugins/builtin/short-interest/headless.ts +6 -6
- package/src/plugins/builtin/short-interest/model.ts +9 -9
- package/src/plugins/builtin/short-interest/publications-model.ts +5 -5
- package/src/plugins/builtin/short-interest/publications-pane.tsx +3 -2
- package/src/plugins/builtin/short-interest/watch-headless.ts +5 -5
- package/src/plugins/builtin/short-interest/watch-pane.tsx +6 -6
- package/src/plugins/builtin/short-volume/model.ts +5 -5
- package/src/plugins/builtin/short-volume/pane.tsx +4 -4
- package/src/plugins/builtin/social-mentions/headless.ts +2 -1
- package/src/plugins/builtin/social-mentions/model.ts +4 -4
- package/src/plugins/builtin/supply-chain/graph-model.ts +2 -1
- package/src/plugins/builtin/supply-chain/graph-pane.tsx +2 -2
- package/src/plugins/builtin/supply-chain/headless.ts +3 -2
- package/src/plugins/builtin/supply-chain/model.ts +4 -4
- package/src/plugins/builtin/supply-chain/pane.tsx +2 -2
- package/src/plugins/builtin/supply-chain/row-evidence.tsx +2 -1
- package/src/plugins/builtin/themes/headless.ts +2 -1
- package/src/plugins/builtin/themes/model.ts +3 -2
- package/src/plugins/builtin/themes/pane.tsx +3 -2
- package/src/plugins/builtin/thirteenf/format.ts +9 -9
- package/src/plugins/builtin/thirteenf/headless.ts +3 -2
- package/src/plugins/builtin/thirteenf/model.ts +2 -1
- package/src/plugins/builtin/thirteenf/overlap-pane.tsx +2 -1
- package/src/plugins/builtin/thirteenf/pane.tsx +5 -4
- package/src/plugins/builtin/thirteenf/report-notes.ts +2 -1
- package/src/plugins/builtin/thirteenf/signals-pane.tsx +3 -2
- package/src/plugins/builtin/thirteenf/table.ts +6 -5
- package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +45 -2
- package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +4 -3
- package/src/plugins/builtin/ticker-detail/data-panes/historical-prices.tsx +4 -4
- package/src/plugins/builtin/ticker-detail/data-panes/returns-pane.tsx +3 -3
- package/src/plugins/builtin/ticker-detail/financials/model.ts +83 -35
- package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +3 -1
- package/src/plugins/builtin/ticker-detail/financials/ratios.ts +2 -2
- package/src/plugins/builtin/ticker-detail/financials/schema.ts +14 -18
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +8 -13
- package/src/plugins/builtin/ticker-detail/headless.ts +33 -6
- package/src/plugins/builtin/ticker-detail/overview/chart-scale.ts +52 -0
- package/src/plugins/builtin/ticker-detail/overview/components.tsx +8 -9
- package/src/plugins/builtin/ticker-detail/overview/model.ts +28 -14
- package/src/plugins/builtin/ticker-detail/overview/pane.tsx +6 -0
- package/src/plugins/builtin/ticker-detail/overview/tax-equivalent.ts +2 -1
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +43 -9
- package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +7 -5
- package/src/plugins/builtin/ticker-detail/quote-monitor/rows.ts +4 -4
- package/src/plugins/builtin/ticker-detail/settings.ts +17 -0
- package/src/plugins/builtin/time-sales/headless.ts +3 -2
- package/src/plugins/builtin/time-sales/model.ts +7 -5
- package/src/plugins/builtin/time-sales/pane.tsx +7 -6
- package/src/plugins/builtin/trace-bonds/model.ts +3 -2
- package/src/plugins/builtin/trace-bonds/pane.tsx +3 -2
- package/src/plugins/builtin/treasury-auctions/client.ts +2 -1
- package/src/plugins/builtin/treasury-auctions/headless.ts +6 -6
- package/src/plugins/builtin/treasury-auctions/hk-headless.ts +3 -2
- package/src/plugins/builtin/treasury-auctions/hk-view.tsx +10 -9
- package/src/plugins/builtin/treasury-auctions/hk.ts +5 -5
- package/src/plugins/builtin/treasury-auctions/model.ts +4 -4
- package/src/plugins/builtin/treasury-auctions/pane.tsx +18 -18
- package/src/plugins/builtin/treasury-auctions/treasury-direct.ts +2 -1
- package/src/plugins/builtin/treasury-daily/model.ts +2 -2
- package/src/plugins/builtin/vol-surface/events.ts +5 -4
- package/src/plugins/builtin/vol-surface/headless.ts +19 -18
- package/src/plugins/builtin/vol-surface/heat-grid.tsx +2 -1
- package/src/plugins/builtin/vol-surface/pane.tsx +8 -7
- package/src/plugins/builtin/vol-surface/stored.ts +2 -1
- package/src/plugins/builtin/vol-surface/tables.ts +4 -3
- package/src/plugins/builtin/volatility/headless.ts +5 -4
- package/src/plugins/builtin/volatility/pane.tsx +6 -6
- package/src/plugins/builtin/world-indices/headless.ts +7 -7
- package/src/plugins/builtin/world-indices/index.tsx +3 -1
- package/src/plugins/builtin/world-venue-map/headless.ts +2 -1
- package/src/plugins/builtin/world-venue-map/layered-pane.tsx +2 -1
- package/src/plugins/builtin/world-venue-map/layers.ts +3 -2
- package/src/plugins/builtin/world-venue-map/use-geo.ts +4 -2
- package/src/plugins/builtin/yield-curve/curves.ts +3 -3
- package/src/plugins/builtin/yield-curve/headless.ts +7 -6
- package/src/plugins/builtin/yield-curve/index.tsx +5 -4
- package/src/plugins/builtin/yield-curve/swaps.tsx +2 -1
- package/src/portfolio/allocation.ts +5 -5
- package/src/portfolio/collection-name.ts +2 -1
- package/src/portfolio/column-values.ts +61 -45
- package/src/portfolio/futures-positions.ts +2 -1
- package/src/portfolio/listed-symbol.ts +4 -2
- package/src/portfolio/period-pnl.ts +51 -1
- package/src/renderers/dom/dialog-host.tsx +5 -5
- package/src/renderers/electrobun/bun/desktop/backend-requests.ts +7 -1
- package/src/renderers/electrobun/view/remote/capability-invoker.ts +1 -1
- package/src/renderers/opentui/dialog-host.tsx +3 -4
- package/src/renderers/opentui/ui-host.tsx +32 -2
- package/src/renderers/share/layout-view.tsx +2 -1
- package/src/sources/gloomberb-cloud/news.ts +9 -0
- package/src/sources/gloomberb-cloud/normalizers.ts +7 -0
- package/src/sources/provider-router/history.ts +5 -2
- package/src/sources/provider-router/search.ts +15 -10
- package/src/state/hooks/inline-tickers.ts +3 -2
- package/src/state/hooks/quote-streaming.ts +9 -10
- package/src/team/collections-sync.ts +8 -3
- package/src/telemetry/usage-counts.ts +26 -0
- package/src/test-support/plugin-persistence.ts +12 -0
- package/src/tickers/company-name-listing.ts +6 -5
- package/src/tickers/company-name.ts +36 -2
- package/src/tickers/instrument-coverage.ts +27 -0
- package/src/tickers/listing-venues.ts +26 -1
- package/src/tickers/renamed-listings.ts +2 -1
- package/src/tickers/search/home-listing.ts +38 -1
- package/src/tickers/search/index.ts +22 -2
- package/src/tickers/search/ranking.ts +21 -2
- package/src/tickers/starter-symbols.ts +7 -0
- package/src/time-series/base-series.ts +4 -0
- package/src/time-series/fundamentals/statement-fields.ts +11 -14
- package/src/time-series/history-acquisition.ts +1 -1
- package/src/time-series/log-scale.ts +9 -0
- package/src/time-series/reporting.ts +3 -3
- package/src/time-series/resolve.ts +6 -4
- package/src/time-series/transforms.ts +10 -5
- package/src/time-series/types.ts +5 -2
- package/src/types/config.ts +9 -0
- package/src/types/data-provider.ts +3 -2
- package/src/types/financials.ts +28 -0
- package/src/types/headless.ts +2 -0
- package/src/types/instrument.ts +6 -0
- package/src/types/plugin-panes.ts +1 -1
- package/src/types/plugin-reports.ts +8 -0
- package/src/ui/dialog-stack.ts +17 -0
- package/src/ui/dialog.tsx +6 -2
- package/src/utils/crypto-pair.ts +9 -0
- package/src/utils/datetime-format.ts +74 -33
- package/src/utils/exchanges.ts +13 -0
- package/src/utils/financial-statements.ts +98 -17
- package/src/utils/format.ts +4 -9
- package/src/utils/fundamentals.ts +38 -16
- package/src/utils/futures-generic.ts +14 -0
- package/src/utils/growth.ts +67 -0
- package/src/utils/keyboard.ts +6 -0
- package/src/utils/options.ts +1 -1
- package/src/utils/report-timing.ts +2 -2
- package/src/utils/served-rates.ts +45 -0
- package/src/utils/text-wrap.ts +84 -3
- package/src/utils/trailing-dividend.ts +13 -3
- package/src/utils/zoned-date-time.ts +47 -22
|
@@ -2,6 +2,7 @@ import { useEffect, useMemo, useRef, useState } from "react";
|
|
|
2
2
|
import { apiClient } from "../../../../api-client";
|
|
3
3
|
import { loadPurchaseDateCostFx, purchaseDatesToRead, type PurchaseDateCostFx } from "../../../../portfolio/cost-fx";
|
|
4
4
|
import type { TickerRecord } from "../../../../types/ticker";
|
|
5
|
+
import { logFailure } from "../../../../utils/log-failure";
|
|
5
6
|
|
|
6
7
|
/** A past close does not change; a date that could not be read is tried again this often. */
|
|
7
8
|
const REFRESH_MS = 30 * 60_000;
|
|
@@ -36,9 +37,10 @@ export function usePurchaseDateCostFx(
|
|
|
36
37
|
useEffect(() => {
|
|
37
38
|
if (!key) return;
|
|
38
39
|
let cancelled = false;
|
|
39
|
-
|
|
40
|
+
// A date whose closes cannot be read is left out; anything else is logged.
|
|
41
|
+
loadPurchaseDateCostFx(tickersRef.current, { into, history: apiClient, portfolioId }).then((rates) => {
|
|
40
42
|
if (!cancelled) setState({ scope: `${into}|${portfolioId}`, rates });
|
|
41
|
-
});
|
|
43
|
+
}, logFailure("portfolio-list.purchase-date-fx", "Reading purchase date FX closes failed"));
|
|
42
44
|
return () => { cancelled = true; };
|
|
43
45
|
}, [into, key, portfolioId, refresh]);
|
|
44
46
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Quote } from "../../../types/financials";
|
|
2
2
|
import { loadCostFxRate, type CostFxHistoryClient } from "../../../portfolio/cost-fx";
|
|
3
3
|
import { withFuturesContractSize, isFuturesTicker, type PortfolioFuturesTerms } from "../../../portfolio/futures-positions";
|
|
4
|
-
import { periodCurrency, periodPnl, type PeriodClose, type PeriodPnl, type PeriodPnlHolding, type PeriodPnlRow } from "../../../portfolio/period-pnl";
|
|
4
|
+
import { periodCurrency, periodPnl, type PeriodClose, type PeriodCurrencyPnl, type PeriodPnl, type PeriodPnlHolding, type PeriodPnlRow } from "../../../portfolio/period-pnl";
|
|
5
5
|
import { getPortfolioPositionMetrics } from "../../../portfolio/position-metrics";
|
|
6
6
|
import { barSessionDay, periodDayText } from "../../../market-data/market/period-return";
|
|
7
7
|
import { quoteHeadlineTime } from "../../../market-data/market/status";
|
|
@@ -203,6 +203,21 @@ export function periodBasisText(result: LoadedPeriodPnl, { futuresHeld, now = Da
|
|
|
203
203
|
return `P&L from ${start} to ${end}${futures}, on the holdings held now`;
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
+
/**
|
|
207
|
+
* The book by currency, as a report of the period lists it: each currency's
|
|
208
|
+
* price P&L, FX and total once the book holds a currency other than its own,
|
|
209
|
+
* the book's own first. Empty for a book in one currency, whose total says it.
|
|
210
|
+
*/
|
|
211
|
+
export function periodCurrencyParts(result: Pick<PeriodPnl, "currencies">): PeriodCurrencyPnl[] {
|
|
212
|
+
const parts = result.currencies ?? [];
|
|
213
|
+
return parts.some((part) => !part.own) ? parts : [];
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/** An FX line's label, as every report of a period writes it: `FX (HKD)`. */
|
|
217
|
+
export function periodFxLabel(currency: string): string {
|
|
218
|
+
return `FX (${currency})`;
|
|
219
|
+
}
|
|
220
|
+
|
|
206
221
|
/** `No P&L for GC=F (contract size unknown), 2382 (no close before 2020-03-18). The total leaves them out.` Null when every holding has one. */
|
|
207
222
|
export function periodUnpricedText(result: LoadedPeriodPnl, label: (symbol: string) => string = (symbol) => symbol): string | null {
|
|
208
223
|
if (!result.unpricedReasons.length) return null;
|
|
@@ -11,7 +11,7 @@ import { getSharedRegistry } from "../../../registry";
|
|
|
11
11
|
import { usePluginAppActions } from "../../../runtime";
|
|
12
12
|
import { isDialogOpen } from "../../../../ui/dialog-stack";
|
|
13
13
|
import { colors, priceColor } from "../../../../theme/colors";
|
|
14
|
-
import { formatPercentRaw } from "../../../../utils/format";
|
|
14
|
+
import { MISSING_VALUE, formatPercentRaw } from "../../../../utils/format";
|
|
15
15
|
import { formatMarketPrice, quoteFormatOptions } from "../../../../market-data/market/format";
|
|
16
16
|
import { listingChoiceQuery, upsertTickerFromSearchResult } from "../../../../tickers/search";
|
|
17
17
|
import type { TickerRecord } from "../../../../types/ticker";
|
|
@@ -107,7 +107,7 @@ function QuickAddPreview({
|
|
|
107
107
|
?? (validation.resolved.kind === "provider" ? validation.resolved.result.type : undefined);
|
|
108
108
|
const priceText = quote?.price != null
|
|
109
109
|
? formatMarketPrice(quote.price, { ...quoteFormatOptions(quote, assetCategory), maxWidth: 12 })
|
|
110
|
-
:
|
|
110
|
+
: MISSING_VALUE;
|
|
111
111
|
const changeValue = quote?.changePercent;
|
|
112
112
|
const name = tickerNameFromValidation(validation);
|
|
113
113
|
const exchange = exchangeLabelFromValidation(validation);
|
|
@@ -416,7 +416,10 @@ export function buildPortfolioPaneSettingsDef(
|
|
|
416
416
|
type: "toggle",
|
|
417
417
|
});
|
|
418
418
|
return {
|
|
419
|
-
|
|
419
|
+
// Named for what the pane shows: a watchlist's settings are not a portfolio's.
|
|
420
|
+
title: activeCollectionId && !activeCollectionIsPortfolio && config.watchlists.some((watchlist) => watchlist.id === activeCollectionId)
|
|
421
|
+
? "Watchlist Settings"
|
|
422
|
+
: "Portfolio Settings",
|
|
420
423
|
values: {
|
|
421
424
|
...settings,
|
|
422
425
|
columnIds: [...settings.columnIds],
|
|
@@ -8,8 +8,8 @@ import type { BrokerConnectionStatus } from "../../../../types/broker";
|
|
|
8
8
|
import type { TickerFinancials } from "../../../../types/financials";
|
|
9
9
|
import type { Portfolio, TickerRecord } from "../../../../types/ticker";
|
|
10
10
|
import type { BrokerAccount, BrokerCashBalance } from "../../../../types/trading";
|
|
11
|
-
import { formatShortDate } from "../../../../utils/datetime-format";
|
|
12
|
-
import { displayWidth, formatPercentRaw } from "../../../../utils/format";
|
|
11
|
+
import { formatClockTime, formatShortDate } from "../../../../utils/datetime-format";
|
|
12
|
+
import { MISSING_VALUE, displayWidth, formatPercentRaw } from "../../../../utils/format";
|
|
13
13
|
import { getBrokerInstance } from "../../../../utils/broker-instances";
|
|
14
14
|
import {
|
|
15
15
|
resolvePortfolioAccountMetrics,
|
|
@@ -133,7 +133,7 @@ function formatSourceBadge(account: BrokerAccount, liveGateway: boolean): { labe
|
|
|
133
133
|
label: !syncedAt
|
|
134
134
|
? "Synced"
|
|
135
135
|
: today
|
|
136
|
-
? `Synced ${syncedAt
|
|
136
|
+
? `Synced ${formatClockTime(syncedAt)}`
|
|
137
137
|
: `Synced ${formatShortDate(syncedAt, { year: false })}`,
|
|
138
138
|
kind: "cloud",
|
|
139
139
|
};
|
|
@@ -256,8 +256,11 @@ export function buildPortfolioSummarySegments({
|
|
|
256
256
|
valuationBasis,
|
|
257
257
|
period = null,
|
|
258
258
|
cashInTable = false,
|
|
259
|
+
otherCurrencies = false,
|
|
259
260
|
}: {
|
|
260
261
|
totals: PortfolioSummaryTotals;
|
|
262
|
+
/** The book holds a currency other than its own: its amounts name theirs ($1,179,156), a bare one beside HK$ prices being unclear. */
|
|
263
|
+
otherCurrencies?: boolean;
|
|
261
264
|
/** The table shows the cash as its own row (with its target and trade), so the header leaves it out. */
|
|
262
265
|
cashInTable?: boolean;
|
|
263
266
|
/**
|
|
@@ -281,7 +284,7 @@ export function buildPortfolioSummarySegments({
|
|
|
281
284
|
/** Cash entered by hand, in the totals currency, with the total it is weighed against. */
|
|
282
285
|
manualCash?: (PortfolioCashLine & { total: number | null }) | null;
|
|
283
286
|
}): PortfolioSummarySegment[] {
|
|
284
|
-
const money = (value: number | undefined, signed = false) => formatPortfolioAmount(value, currency, { signed, baseCurrency });
|
|
287
|
+
const money = (value: number | undefined, signed = false) => formatPortfolioAmount(value, currency, { signed, baseCurrency, named: otherCurrencies });
|
|
285
288
|
if (!isPortfolioTab) {
|
|
286
289
|
return totals.watchlistCount > 0
|
|
287
290
|
? [createSummarySegment("avg-day", [
|
|
@@ -493,7 +496,7 @@ export function buildPortfolioFooterSegments({
|
|
|
493
496
|
// Where the quotes are from and the newest's time, as `quote` ends (`Gloom Cloud · 14:44 UTC · markets open`):
|
|
494
497
|
// a bare local time ("Thu 12:25") named neither.
|
|
495
498
|
const quoted = refreshingSize > 0 ? null : quoteSourceFooterSegment(quotes, { id: "refresh" });
|
|
496
|
-
const refresh: PaneFooterSegment = quoted ?? { id: "refresh", parts: [{ text: refreshingSize > 0 ? "Refreshing..." :
|
|
499
|
+
const refresh: PaneFooterSegment = quoted ?? { id: "refresh", parts: [{ text: refreshingSize > 0 ? "Refreshing..." : MISSING_VALUE, tone: "muted" }] };
|
|
497
500
|
return [...accountStatus, refresh];
|
|
498
501
|
}
|
|
499
502
|
|
|
@@ -104,16 +104,18 @@ function bookAmountText(value: number | undefined, currency: string, signed: boo
|
|
|
104
104
|
/**
|
|
105
105
|
* A total in the portfolio's currency (bookAmountText): never rounded to a
|
|
106
106
|
* hundred, as a compact 1.6k for $1,587.80 was. Bare when both it and the
|
|
107
|
-
* app's base currency are USD, as the pane has always shown it
|
|
108
|
-
*
|
|
107
|
+
* app's base currency are USD, as the pane has always shown it, unless the
|
|
108
|
+
* book holds another currency (`named`), beside whose prices a bare total
|
|
109
|
+
* would not say which it is in; otherwise it leads with the currency symbol,
|
|
110
|
+
* as prices do: A$108,612, +$600.12.
|
|
109
111
|
*/
|
|
110
112
|
export function formatPortfolioAmount(
|
|
111
113
|
value: number | undefined,
|
|
112
114
|
currency: string,
|
|
113
|
-
{ signed = false, baseCurrency = "USD" }: { signed?: boolean; baseCurrency?: string } = {},
|
|
115
|
+
{ signed = false, baseCurrency = "USD", named = false }: { signed?: boolean; baseCurrency?: string; named?: boolean } = {},
|
|
114
116
|
): string {
|
|
115
117
|
const text = bookAmountText(value, currency, signed);
|
|
116
|
-
const bare = currency === "USD" && (currencyCode(baseCurrency) ?? "USD") === "USD";
|
|
118
|
+
const bare = !named && currency === "USD" && (currencyCode(baseCurrency) ?? "USD") === "USD";
|
|
117
119
|
if (bare || value == null || !Number.isFinite(value)) return text;
|
|
118
120
|
const sign = text.startsWith("+") || text.startsWith("-") ? text.charAt(0) : "";
|
|
119
121
|
return `${sign}${getCurrencySymbol(currency)}${text.slice(sign.length)}`;
|
|
@@ -74,6 +74,12 @@ const COMPANY_COLUMN_IDS: ReadonlySet<string> = new Set([
|
|
|
74
74
|
* still gives.
|
|
75
75
|
*/
|
|
76
76
|
const NARROW_BOOK_DROP_ORDER = ["forward_pe", "pe", "dividend_yield", "market_cap", "cost_basis", PRICE_SPARKLINE_COLUMN_ID, "as_of"];
|
|
77
|
+
/**
|
|
78
|
+
* What a narrow book over a period gives up next, so the period's P&L and
|
|
79
|
+
* CONTRIB stay on screen: today's columns (the day's P&L, its change, the
|
|
80
|
+
* latest price) and the cost a period's P&L does not read.
|
|
81
|
+
*/
|
|
82
|
+
const NARROW_PERIOD_DROP_ORDER = [...NARROW_BOOK_DROP_ORDER, "day_pnl", "change_pct", "avg_cost", "price"];
|
|
77
83
|
/** Columns of a held position: a list that shows one is a book, whose value outranks its valuation. */
|
|
78
84
|
const POSITION_COLUMN_IDS: ReadonlySet<string> = new Set(["shares", "avg_cost", "cost_basis", "mkt_value", "weight", "day_pnl", "pnl", "pnl_pct"]);
|
|
79
85
|
|
|
@@ -109,13 +115,15 @@ export function fitPortfolioColumns(
|
|
|
109
115
|
rows: readonly { cell: (column: ColumnConfig) => string; settled: boolean }[],
|
|
110
116
|
width: number | undefined,
|
|
111
117
|
hidden: ReadonlySet<string> = new Set(),
|
|
118
|
+
/** The book shows P&L over a period: today's columns go before its P&L and CONTRIB. */
|
|
119
|
+
period = false,
|
|
112
120
|
): ColumnConfig[] {
|
|
113
121
|
const settled = rows.length > 0 && rows.every((row) => row.settled);
|
|
114
122
|
const figured = (column: ColumnConfig) => rows.some((row) => row.settled && !isEmptyCell(row.cell(column)));
|
|
115
123
|
const shown = columns.filter((column) => !COMPANY_COLUMN_IDS.has(column.id)
|
|
116
124
|
|| (settled ? figured(column) : !hidden.has(column.id) || figured(column)));
|
|
117
125
|
if (width == null || !shown.some((column) => POSITION_COLUMN_IDS.has(column.id))) return shown;
|
|
118
|
-
return dropColumnsToFit(shown, width - 1, NARROW_BOOK_DROP_ORDER);
|
|
126
|
+
return dropColumnsToFit(shown, width - 1, period ? NARROW_PERIOD_DROP_ORDER : NARROW_BOOK_DROP_ORDER);
|
|
119
127
|
}
|
|
120
128
|
|
|
121
129
|
/** A cell recomputes only when its row's records or a context input it reads change. */
|
|
@@ -304,11 +312,13 @@ export function PortfolioTickerTable({
|
|
|
304
312
|
tableFinancialsMap.get(ticker.metadata.ticker)?.quote?.yearRangeBasis === "daily-bars")
|
|
305
313
|
? rangeColumn.width + displayWidth(RANGE_FROM_BARS_NOTE) + 1
|
|
306
314
|
: 0, [rangeColumn, sortedTickers, tableFinancialsMap]);
|
|
307
|
-
// The Ticker column grows to its longest symbol, so ETH-USD and BA:LSE show whole beside their market-state dot
|
|
315
|
+
// The Ticker column grows to its longest symbol, so ETH-USD and BA:LSE show whole beside their market-state dot,
|
|
316
|
+
// and to a period's lines under the rows (HKD total).
|
|
317
|
+
const summaryLabels = columnContext.periodPnl?.lines?.map((line) => line.label).join("\n") ?? "";
|
|
308
318
|
const tickerWidth = useMemo(() => Math.min(MAX_TICKER_COLUMN_WIDTH, sortedTickers.reduce(
|
|
309
319
|
(widest, ticker) => Math.max(widest, TICKER_DOT_WIDTH + displayWidth(listedSymbol(ticker, tickerDisplayName(ticker), columnContext.homeMarket))),
|
|
310
|
-
0,
|
|
311
|
-
)), [columnContext.homeMarket, sortedTickers]);
|
|
320
|
+
summaryLabels ? Math.max(...summaryLabels.split("\n").map((label) => TICKER_DOT_WIDTH + displayWidth(label))) : 0,
|
|
321
|
+
)), [columnContext.homeMarket, sortedTickers, summaryLabels]);
|
|
312
322
|
// A book that holds a short weighs its positions against gross exposure, and the header says so.
|
|
313
323
|
const grossWeights = columnContext.portfolioWeightBasis === "gross";
|
|
314
324
|
// Market caps, values and P&L read in the book's currency, which their headers name (MKT VAL (CAD)), as the CLI's do.
|
|
@@ -338,34 +348,34 @@ export function PortfolioTickerTable({
|
|
|
338
348
|
cell: (column: ColumnConfig) => resolveCell(column, ticker, financials).text,
|
|
339
349
|
settled: companyDataSettled(financials, !!answeredSnapshots?.has(ticker.metadata.ticker)),
|
|
340
350
|
};
|
|
341
|
-
}), width, hiddenCompanyRef.current.ids).map((column) => column.id));
|
|
351
|
+
}), width, hiddenCompanyRef.current.ids, period).map((column) => column.id));
|
|
342
352
|
return sizedColumns.filter((column) => !shown.has(column.id)).map((column) => column.id).join(",");
|
|
343
|
-
}, [answeredSnapshots, resolveCell, sizedColumns, sortedTickers, tableFinancialsMap, width]);
|
|
353
|
+
}, [answeredSnapshots, period, resolveCell, sizedColumns, sortedTickers, tableFinancialsMap, width]);
|
|
344
354
|
hiddenCompanyRef.current.ids = new Set(hiddenColumnIds.split(",").filter((id) => COMPANY_COLUMN_IDS.has(id)));
|
|
345
355
|
const displayColumns = useMemo(() => {
|
|
346
356
|
const hidden = new Set(hiddenColumnIds.split(","));
|
|
347
357
|
return hiddenColumnIds ? sizedColumns.filter((column) => !hidden.has(column.id)) : sizedColumns;
|
|
348
358
|
}, [hiddenColumnIds, sizedColumns]);
|
|
349
|
-
// Over a period,
|
|
350
|
-
const
|
|
359
|
+
// Over a period, each currency's part under the rows, so P&L adds up to the header's total as portfolio show --from prints it.
|
|
360
|
+
const periodLines = columnContext.periodPnl?.lines ?? null;
|
|
351
361
|
const summaryRows = useMemo<TickerTableSummaryRow[] | undefined>(() => {
|
|
352
362
|
// A row's label goes in TICKER, or the first column when the pane shows none.
|
|
353
363
|
const labelColumn = displayColumns.some((column) => column.id === "ticker") ? "ticker" : displayColumns[0]?.id ?? "ticker";
|
|
354
364
|
const labelled = (row: TickerTableSummaryRow): TickerTableSummaryRow => labelColumn === "ticker" || !row.cells.ticker ? row
|
|
355
365
|
: { ...row, cells: { ...row.cells, [labelColumn]: row.cells.ticker } };
|
|
356
366
|
const rows = [
|
|
357
|
-
...(
|
|
358
|
-
id:
|
|
367
|
+
...(periodLines ?? []).map((line) => ({
|
|
368
|
+
id: line.id,
|
|
359
369
|
cells: {
|
|
360
|
-
ticker: { text:
|
|
361
|
-
pnl: periodPnlFigure(
|
|
362
|
-
pnl_pct: periodPnlFigure(
|
|
370
|
+
ticker: { text: line.label },
|
|
371
|
+
pnl: periodPnlFigure(line.pnl, "pnl"),
|
|
372
|
+
pnl_pct: periodPnlFigure(line.contribution, "contribution"),
|
|
363
373
|
},
|
|
364
|
-
}
|
|
374
|
+
})),
|
|
365
375
|
...(allocationRows ?? []),
|
|
366
376
|
].map(labelled);
|
|
367
377
|
return rows.length > 0 ? rows : undefined;
|
|
368
|
-
}, [allocationRows, displayColumns,
|
|
378
|
+
}, [allocationRows, displayColumns, periodLines]);
|
|
369
379
|
// The table offers "Sort by…" while it has a sort column. A watchlist starts
|
|
370
380
|
// unsorted and a third header click turns sorting off, so the unsorted state
|
|
371
381
|
// needs its own entry until TickerListTableView takes `sortable`.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MISSING_VALUE } from "../../../utils/format";
|
|
1
2
|
import { isAccessDenied } from "../../../api-client/errors";
|
|
2
3
|
import { useCallback, useEffect } from "react";
|
|
3
4
|
import type { PowerProject } from "../../../api-client/power";
|
|
@@ -20,12 +21,12 @@ function ProjectFacts({ row }: { row: PowerProject }) {
|
|
|
20
21
|
["Observed UTC", row.observedAt], ["Revision", row.revision], ["Confidence", powerPercent(row.confidence)],
|
|
21
22
|
];
|
|
22
23
|
return <>
|
|
23
|
-
{facts.map(([label, value]) => <KeyValueRow key={label} label={label} value={typeof value === "number" ? powerNumber(value) : value ??
|
|
24
|
+
{facts.map(([label, value]) => <KeyValueRow key={label} label={label} value={typeof value === "number" ? powerNumber(value) : value ?? MISSING_VALUE} detail={typeof value === "string" && ["Requested", "Proposed service", "Completed", "Withdrawn", "Published as of"].includes(label) ? /^\d{4}$/.test(value) ? "year precision" : /^\d{4}-Q[1-4]$/.test(value) ? "quarter precision" : /^\d{4}-\d{2}$/.test(value) ? "month precision" : /^\d{4}-\d{2}-\d{2}$/.test(value) ? "day precision" : undefined : undefined} labelWidth={20} />)}
|
|
24
25
|
{row.entities.length ? <SectionHeading title="Mapped companies" /> : null}
|
|
25
26
|
{row.entities.map((entity) => <KeyValueRow key={`${entity.entityId}:${entity.role}`} label={titleCase(entity.role)} value={entity.name}
|
|
26
27
|
detail={`${entity.tickers.map((t) => t.exchange ? `${t.ticker}:${t.exchange}` : t.ticker).join(", ")} · ${powerPercent(entity.confidence)} confidence`} labelWidth={20} />)}
|
|
27
28
|
{Object.keys(row.metrics).length ? <SectionHeading title="Reported context" /> : null}
|
|
28
|
-
{Object.entries(row.metrics).map(([label, value]) => <KeyValueRow key={label} label={label === "revenueUsd" ? "Retail revenue (USD)" : titleCase(label.replace(/([a-z])([A-Z])/g, "$1 $2"))} value={value === null ?
|
|
29
|
+
{Object.entries(row.metrics).map(([label, value]) => <KeyValueRow key={label} label={label === "revenueUsd" ? "Retail revenue (USD)" : titleCase(label.replace(/([a-z])([A-Z])/g, "$1 $2"))} value={value === null ? MISSING_VALUE : String(value)} labelWidth={24} />)}
|
|
29
30
|
<SectionHeading title="Primary evidence" />
|
|
30
31
|
<KeyValueRow label="Location in source" value={row.sourceLocator} labelWidth={20} />
|
|
31
32
|
<PaneLinkMenu><ExternalLinkText url={row.sourceUrl} label="Open primary document" /></PaneLinkMenu>
|
|
@@ -57,16 +58,16 @@ export function PowerDetailView({ row, scope, scrollRef, snapshot, focused, widt
|
|
|
57
58
|
{hasGeneration && view === "generation" ? <PowerGeneration project={project!} width={width} height={Math.max(3, height - 1)} focused={focused} /> : <DetailScrollBody ref={scrollRef} resetScrollKey={row.id}>
|
|
58
59
|
{denied ? <Text>Project evidence is unavailable for this account.</Text> : project ? <ProjectFacts row={project} /> : <>
|
|
59
60
|
{Object.entries(row.cells).filter(([, value]) => ["string", "number"].includes(typeof value) || value === null).map(([key, value]) =>
|
|
60
|
-
<KeyValueRow key={key} label={titleCase(key.replace(/([a-z])([A-Z])/g, "$1 $2"))} value={value == null ?
|
|
61
|
+
<KeyValueRow key={key} label={titleCase(key.replace(/([a-z])([A-Z])/g, "$1 $2"))} value={value == null ? MISSING_VALUE : /Rate$/.test(key) ? powerPercent(Number(value)) : String(value)} labelWidth={22} />)}
|
|
61
62
|
{row.history ? <>
|
|
62
63
|
<KeyValueRow label="History basis" value={row.history.basis === "published" ? "Published period" : "Observed snapshot"} labelWidth={22} />
|
|
63
|
-
<KeyValueRow label="Published as of" value={row.history.asOf ??
|
|
64
|
+
<KeyValueRow label="Published as of" value={row.history.asOf ?? MISSING_VALUE} labelWidth={22} />
|
|
64
65
|
<KeyValueRow label="Observed UTC" value={row.history.observedAt} labelWidth={22} />
|
|
65
66
|
<SectionHeading title="Primary evidence" />
|
|
66
67
|
<PaneLinkMenu>{row.history.sourceUrls.map((url, index) => <Box key={url} paddingBottom={1}><ExternalLinkText url={url} label={`Open primary document ${index + 1}`} /></Box>)}</PaneLinkMenu>
|
|
67
68
|
</> : null}
|
|
68
69
|
{row.exposure ? <>
|
|
69
|
-
<KeyValueRow label="Published as of" value={row.exposure.asOf ??
|
|
70
|
+
<KeyValueRow label="Published as of" value={row.exposure.asOf ?? MISSING_VALUE} labelWidth={22} />
|
|
70
71
|
<KeyValueRow label="Observed UTC" value={row.exposure.observedAt} labelWidth={22} />
|
|
71
72
|
<SectionHeading title="Primary evidence" />
|
|
72
73
|
<PaneLinkMenu>{row.exposure.sourceUrls.map((url, index) => <Box key={url} paddingBottom={1}><ExternalLinkText url={url} label={`Open primary document ${index + 1}`} /></Box>)}</PaneLinkMenu>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MISSING_VALUE } from "../../../utils/format";
|
|
1
2
|
import type { GasStorageHistory, GasStorageRow, GasStorageSeasonal } from "../../../api-client/europe-energy";
|
|
2
3
|
import { staticSeries } from "../../../components/chart/static/series";
|
|
3
4
|
import type { SeriesDefinition, SeriesLoadResult } from "../../../series/types";
|
|
@@ -55,18 +56,18 @@ export const GAS_PUBLISHER = "GIE AGSI+";
|
|
|
55
56
|
const fixed = (value: number, digits: number) => value.toLocaleString("en-US", { minimumFractionDigits: digits, maximumFractionDigits: digits });
|
|
56
57
|
const signed = (value: number, digits: number) => `${value > 0 ? "+" : ""}${fixed(value, digits)}`;
|
|
57
58
|
/** Percent full, to the hundredth AGSI+ publishes. */
|
|
58
|
-
export const formatGasFull = (value: number | null | undefined) => value == null ?
|
|
59
|
+
export const formatGasFull = (value: number | null | undefined) => value == null ? MISSING_VALUE : fixed(value, 2);
|
|
59
60
|
/** Percentage points. */
|
|
60
|
-
export const formatGasPoints = (value: number | null | undefined) => value == null ?
|
|
61
|
+
export const formatGasPoints = (value: number | null | undefined) => value == null ? MISSING_VALUE : signed(value, 2);
|
|
61
62
|
/** TWh to the tenth. */
|
|
62
|
-
export const formatGasTwh = (value: number | null | undefined) => value == null ?
|
|
63
|
+
export const formatGasTwh = (value: number | null | undefined) => value == null ? MISSING_VALUE : fixed(value, 1);
|
|
63
64
|
/** GWh/day, whole. */
|
|
64
|
-
export const formatGasFlow = (value: number | null | undefined) => value == null ?
|
|
65
|
+
export const formatGasFlow = (value: number | null | undefined) => value == null ? MISSING_VALUE : fixed(value, 0);
|
|
65
66
|
|
|
66
67
|
/** Where the day sits in its five-year range: a percentile-like 0 to 100, or below and above it. */
|
|
67
68
|
export function gasRangePosition(row: GasStorageRow): { value: number | null; text: string } {
|
|
68
69
|
const position = row.fiveYear?.position;
|
|
69
|
-
if (position == null) return { value: null, text:
|
|
70
|
+
if (position == null) return { value: null, text: MISSING_VALUE };
|
|
70
71
|
if (position < 0) return { value: 0, text: "below" };
|
|
71
72
|
if (position > 100) return { value: 100, text: "above" };
|
|
72
73
|
return { value: Math.round(position), text: `${Math.round(position)}%` };
|
|
@@ -77,7 +78,7 @@ export const gasRangeLabel = (years: number) => `${years > 0 && years < 5 ? year
|
|
|
77
78
|
|
|
78
79
|
/** A gas day and its flag, the way a row is dated: `2026-10-12 est`. */
|
|
79
80
|
export const gasDayText = (row: Pick<GasStorageRow, "gasDay" | "status">) =>
|
|
80
|
-
row.gasDay ? `${row.gasDay}${row.status === "estimated" ? " est" : ""}` :
|
|
81
|
+
row.gasDay ? `${row.gasDay}${row.status === "estimated" ? " est" : ""}` : MISSING_VALUE;
|
|
81
82
|
|
|
82
83
|
/** The benchmark areas a search lists first; the rest follow by name. */
|
|
83
84
|
const LEAD_AREAS = ["EU", "DE", "IT", "FR", "NL", "AT"];
|
|
@@ -181,7 +182,7 @@ export function gasYearAxis(year: number) {
|
|
|
181
182
|
ticks: [0, 3, 6, 9].map((month) => ({ label: MONTHS[month]!, ratio: ratio(Date.UTC(year, month, 1)) })),
|
|
182
183
|
formatCursor: (xRatio: number) => {
|
|
183
184
|
const date = new Date(start + Math.round((xRatio * span) / DAY_MS) * DAY_MS);
|
|
184
|
-
return `${
|
|
185
|
+
return `${date.getUTCDate()} ${MONTHS[date.getUTCMonth()]}`;
|
|
185
186
|
},
|
|
186
187
|
},
|
|
187
188
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MISSING_VALUE } from "../../../utils/format";
|
|
1
2
|
import { logFailure } from "../../../utils/log-failure";
|
|
2
3
|
import { useCallback, useMemo } from "react";
|
|
3
4
|
import type { GasStorageRow } from "../../../api-client/europe-energy";
|
|
@@ -72,7 +73,7 @@ function GasDetail({ row, width, height, focused }: { row: GasStorageRow; width:
|
|
|
72
73
|
{ id: "change", label: "1D pp", value: formatGasPoints(row.change), ...(row.previousGasDay ? { detail: `vs ${row.previousGasDay}` } : {}) },
|
|
73
74
|
{ id: "year", label: "1Y ago %", value: formatGasFull(row.yearAgo?.full), ...(row.yearAgo ? { detail: row.yearAgo.gasDay } : {}) },
|
|
74
75
|
{ id: "range", label: `${gasRangeLabel(five?.years.length ?? 0)} range %`,
|
|
75
|
-
value: five ? `${formatGasFull(five.min)} to ${formatGasFull(five.max)}` :
|
|
76
|
+
value: five ? `${formatGasFull(five.min)} to ${formatGasFull(five.max)}` : MISSING_VALUE,
|
|
76
77
|
...(five ? { detail: `avg ${formatGasFull(five.average)}${five.years.length < 5 ? `, ${five.years.length} of 5 years` : ""}` } : {}) },
|
|
77
78
|
];
|
|
78
79
|
return <StatChartDetail items={items} width={width} height={height} empty={!history.loading && (series[0]?.points.length ?? 0) < 2}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MISSING_VALUE } from "../../../utils/format";
|
|
1
2
|
import type { DataTableColumn } from "../../../components";
|
|
2
3
|
import type { HeadlessPaneColumn, HeadlessPaneDefinition, HeadlessPaneRow } from "../../../types/plugin";
|
|
3
4
|
import { withoutQuietColumns } from "../shared/research-cells";
|
|
@@ -18,8 +19,8 @@ const isGasQuery = (input: string | undefined) => /^(?:gas|storage)\b/i.test(inp
|
|
|
18
19
|
const GRAPHIC_COLUMNS = new Set(["outcome", "pipeline"]);
|
|
19
20
|
/** Columns that only repeat a default on every row, as the pane leaves them out. */
|
|
20
21
|
const QUIET_COLUMNS: Record<string, readonly string[]> = { scope: ["Project"], unknownCapacity: ["0"], unknown: ["0"], fuel: ["Load"], role: ["Direct"], kind: ["Queue"] };
|
|
21
|
-
const text = (value: unknown) => value == null || value === "" ?
|
|
22
|
-
const coded = (value: unknown) => typeof value === "string" && value ? titleCase(value) :
|
|
22
|
+
const text = (value: unknown) => value == null || value === "" ? MISSING_VALUE : String(value);
|
|
23
|
+
const coded = (value: unknown) => typeof value === "string" && value ? titleCase(value) : MISSING_VALUE;
|
|
23
24
|
|
|
24
25
|
/** The tabs that list records, a page at a time. */
|
|
25
26
|
const RECORD_TABS: readonly PowerTab[] = ["queue", "loads", "capacity"];
|
|
@@ -47,16 +48,16 @@ function reportColumns(tab: PowerTab, context: unknown): HeadlessPaneColumn[] {
|
|
|
47
48
|
const columns: DataTableColumn[] = tab === "capacity" && context === "generation" ? GENERATION_COLUMNS : tab === "capacity" && context === "utility" ? UTILITY_COLUMNS
|
|
48
49
|
: ["queue", "loads", "capacity"].includes(tab) ? PROJECT_COLUMNS : tab === "history" ? HISTORY_COLUMNS : tab === "outcomes" ? RATE_COLUMNS : tab === "utilities" ? EXPOSURE_COLUMNS : COVERAGE_COLUMNS;
|
|
49
50
|
// The coverage list names its register by its own id; everything else by the record's source.
|
|
50
|
-
const region = (value: unknown, row: HeadlessPaneRow) => typeof value !== "string" ?
|
|
51
|
+
const region = (value: unknown, row: HeadlessPaneRow) => typeof value !== "string" ? MISSING_VALUE
|
|
51
52
|
: tab === "utilities" ? value : powerRegion(value, String((tab === "coverage" ? row.id : row.sourceId) ?? ""));
|
|
52
53
|
const format = (column: DataTableColumn): HeadlessPaneColumn["format"] => {
|
|
53
54
|
if (column.id === "region") return region;
|
|
54
55
|
if (["fuel", "status", "kind", "role"].includes(column.id)) return coded;
|
|
55
56
|
if (column.id === "ticker") return (value) => typeof value === "string" && value ? value : UNMAPPED;
|
|
56
57
|
if (column.id === "developer") return (value, row) => text(value ?? row.utility);
|
|
57
|
-
if (column.id === "observedAt") return (value) => typeof value === "string" ? value.slice(0, 16).replace("T", " ") :
|
|
58
|
-
if (/Rate$/.test(column.id)) return (value) => typeof value === "number" ? powerPercent(value) :
|
|
59
|
-
if (column.align === "right") return (value) => typeof value === "number" ? `${column.id === "changeMw" && value > 0 ? "+" : ""}${powerNumber(value)}` :
|
|
58
|
+
if (column.id === "observedAt") return (value) => typeof value === "string" ? value.slice(0, 16).replace("T", " ") : MISSING_VALUE;
|
|
59
|
+
if (/Rate$/.test(column.id)) return (value) => typeof value === "number" ? powerPercent(value) : MISSING_VALUE;
|
|
60
|
+
if (column.align === "right") return (value) => typeof value === "number" ? `${column.id === "changeMw" && value > 0 ? "+" : ""}${powerNumber(value)}` : MISSING_VALUE;
|
|
60
61
|
return text;
|
|
61
62
|
};
|
|
62
63
|
// The pane groups outcomes under region headings; the report names the region on each row.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MISSING_VALUE } from "../../../utils/format";
|
|
1
2
|
import type { PowerAggregate, PowerBoard, PowerCoverage, PowerExposure, PowerHistoryPoint, PowerProject, PowerRates } from "../../../api-client/power";
|
|
2
3
|
import { staticSeries, type DataTableColumn } from "../../../components";
|
|
3
4
|
|
|
@@ -34,8 +35,8 @@ export function powerLoadedSources(tab: PowerTab, coverage: readonly PowerCovera
|
|
|
34
35
|
return tab === "capacity" ? "US EIA generation and utility filings" : names([...loaded.filter((c) => c.country === "US"), ...loaded.filter((c) => c.country !== "US")]);
|
|
35
36
|
}
|
|
36
37
|
export const titleCase = (value: string) => value.replace(/(^|[ _-])\w/g, (match) => match.toUpperCase());
|
|
37
|
-
export const powerNumber = (n: number | null | undefined) => n == null ?
|
|
38
|
-
export const powerPercent = (n: number | null) => n == null ?
|
|
38
|
+
export const powerNumber = (n: number | null | undefined) => n == null ? MISSING_VALUE : n.toLocaleString("en-US", { maximumFractionDigits: 1 });
|
|
39
|
+
export const powerPercent = (n: number | null) => n == null ? MISSING_VALUE : `${(n * 100).toFixed(1)}%`;
|
|
39
40
|
/** The listed companies a record names, or null when its register names none: the ticker map. */
|
|
40
41
|
export const tickerLabel = (row: { entities: PowerProject["entities"] }) => [...new Set(row.entities.flatMap((e) => e.tickers.map((t) => t.ticker)))].join(", ") || null;
|
|
41
42
|
/** What the ticker column says for a record no listed company is mapped to. */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MISSING_VALUE } from "../../../utils/format";
|
|
1
2
|
import { apiClient } from "../../../api-client";
|
|
2
3
|
import type { CarbonBoard, EuropePowerBoard, GasStorageBoard, GasStorageRow, PowerPriceRow } from "../../../api-client/europe-energy";
|
|
3
4
|
import type { HeadlessBundleResult, HeadlessBundleSection, HeadlessPaneColumn, HeadlessPaneDefinition } from "../../../types/plugin";
|
|
@@ -11,21 +12,21 @@ import {
|
|
|
11
12
|
type PricesClient = Pick<typeof apiClient, "getCloudEuropePower" | "getCloudEuropePowerHistory" | "getCloudEuropeCarbon"
|
|
12
13
|
| "getCloudEuropeGas" | "getCloudEuropeGasHistory">;
|
|
13
14
|
|
|
14
|
-
const price = (value: unknown) => typeof value === "number" ? formatPowerPrice(value) :
|
|
15
|
-
const text = (value: unknown) => typeof value === "string" && value ? value :
|
|
15
|
+
const price = (value: unknown) => typeof value === "number" ? formatPowerPrice(value) : MISSING_VALUE;
|
|
16
|
+
const text = (value: unknown) => typeof value === "string" && value ? value : MISSING_VALUE;
|
|
16
17
|
|
|
17
18
|
/** A board's columns, in its words: prices to the cent in the board's unit, each row dated by its own day. */
|
|
18
19
|
const boardColumns = (unit: string, label = "Market"): HeadlessPaneColumn[] => [
|
|
19
20
|
{ key: "market", header: label },
|
|
20
21
|
{ key: "date", header: "As of", format: text, shrink: false },
|
|
21
22
|
{ key: "price", header: unit, align: "right", format: price },
|
|
22
|
-
{ key: "change", header: "1D", align: "right", format: (value) => typeof value === "number" ? formatPowerChange(value) :
|
|
23
|
+
{ key: "change", header: "1D", align: "right", format: (value) => typeof value === "number" ? formatPowerChange(value) : MISSING_VALUE },
|
|
23
24
|
{ key: "average7", header: "7D avg", align: "right", format: price },
|
|
24
25
|
{ key: "average30", header: "30D avg", align: "right", format: price },
|
|
25
26
|
{ key: "yearAgo", header: "1Y ago", align: "right", format: price },
|
|
26
27
|
{ key: "low52w", header: "52W low", align: "right", format: price },
|
|
27
28
|
{ key: "high52w", header: "52W high", align: "right", format: price },
|
|
28
|
-
{ key: "range", header: "In 1Y range", align: "right", format: (value) => typeof value === "number" ? `${value}%` :
|
|
29
|
+
{ key: "range", header: "In 1Y range", align: "right", format: (value) => typeof value === "number" ? `${value}%` : MISSING_VALUE },
|
|
29
30
|
];
|
|
30
31
|
const COLUMNS = boardColumns(POWER_PRICE_UNIT);
|
|
31
32
|
const AUCTION_COLUMNS: HeadlessPaneColumn[] = [
|
|
@@ -33,9 +34,9 @@ const AUCTION_COLUMNS: HeadlessPaneColumn[] = [
|
|
|
33
34
|
{ key: "zone", header: "Zone", format: text },
|
|
34
35
|
{ key: "status", header: "Status" },
|
|
35
36
|
{ key: "price", header: CARBON_PRICE_UNIT, align: "right", format: price },
|
|
36
|
-
{ key: "volume", header: "Volume tCO2", align: "right", format: (value) => typeof value === "number" ? value.toLocaleString("en-US") :
|
|
37
|
-
{ key: "coverRatio", header: "Cover", align: "right", format: (value) => typeof value === "number" ? `${value.toFixed(2)}x` :
|
|
38
|
-
{ key: "bidders", header: "Bidders", align: "right", format: (value) => typeof value === "number" ? String(value) :
|
|
37
|
+
{ key: "volume", header: "Volume tCO2", align: "right", format: (value) => typeof value === "number" ? value.toLocaleString("en-US") : MISSING_VALUE },
|
|
38
|
+
{ key: "coverRatio", header: "Cover", align: "right", format: (value) => typeof value === "number" ? `${value.toFixed(2)}x` : MISSING_VALUE },
|
|
39
|
+
{ key: "bidders", header: "Bidders", align: "right", format: (value) => typeof value === "number" ? String(value) : MISSING_VALUE },
|
|
39
40
|
];
|
|
40
41
|
|
|
41
42
|
function reportRow(row: Omit<PowerPriceRow, "code"> & { code: string }) {
|
|
@@ -82,7 +83,7 @@ function freshness(board: EuropePowerBoard | null, carbon: CarbonBoard | null, m
|
|
|
82
83
|
|
|
83
84
|
const failure = (error: unknown) => error instanceof Error ? error.message : String(error);
|
|
84
85
|
|
|
85
|
-
const number = (format: (value: number | null) => string) => (value: unknown) => typeof value === "number" ? format(value) :
|
|
86
|
+
const number = (format: (value: number | null) => string) => (value: unknown) => typeof value === "number" ? format(value) : MISSING_VALUE;
|
|
86
87
|
const GAS_COLUMNS: HeadlessPaneColumn[] = [
|
|
87
88
|
{ key: "area", header: "Area" },
|
|
88
89
|
{ key: "gasDay", header: "Gas day", format: text, shrink: false },
|
|
@@ -96,7 +97,7 @@ const GAS_COLUMNS: HeadlessPaneColumn[] = [
|
|
|
96
97
|
{ key: "fiveYearLow", header: "5Y low", align: "right", format: number(formatGasFull) },
|
|
97
98
|
{ key: "fiveYearAverage", header: "5Y avg", align: "right", format: number(formatGasFull) },
|
|
98
99
|
{ key: "fiveYearHigh", header: "5Y high", align: "right", format: number(formatGasFull) },
|
|
99
|
-
{ key: "fiveYearYears", header: "5Y years", align: "right", format: (value) => typeof value === "number" ? String(value) :
|
|
100
|
+
{ key: "fiveYearYears", header: "5Y years", align: "right", format: (value) => typeof value === "number" ? String(value) : MISSING_VALUE },
|
|
100
101
|
{ key: "range", header: "In 5Y range", align: "right", format: text },
|
|
101
102
|
];
|
|
102
103
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MISSING_VALUE } from "../../../utils/format";
|
|
1
2
|
import type { PowerPriceRow } from "../../../api-client/europe-energy";
|
|
2
3
|
import type { SeriesDefinition } from "../../../series/types";
|
|
3
4
|
import { fetchCarbonHistory, fetchPowerPriceHistory } from "./prices-client";
|
|
@@ -50,9 +51,9 @@ export const isCarbonQuery = (input: string | null | undefined) =>
|
|
|
50
51
|
export const DEFAULT_PRICE_MARKET = "DE";
|
|
51
52
|
|
|
52
53
|
export const POWER_PRICE_UNIT = "EUR/MWh";
|
|
53
|
-
export const formatPowerPrice = (value: number | null | undefined) => value == null ?
|
|
54
|
+
export const formatPowerPrice = (value: number | null | undefined) => value == null ? MISSING_VALUE : value.toFixed(2);
|
|
54
55
|
export const formatPowerChange = (value: number | null | undefined) =>
|
|
55
|
-
value == null ?
|
|
56
|
+
value == null ? MISSING_VALUE : `${value > 0 ? "+" : ""}${value.toFixed(2)}`;
|
|
56
57
|
/** Where the latest price sits in its 52-week range, 0 at the low and 100 at the high. */
|
|
57
58
|
export function powerRangePosition(row: PowerPriceRow): number | null {
|
|
58
59
|
if (row.price == null || row.low52w == null || row.high52w == null || row.high52w <= row.low52w) return null;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MISSING_VALUE } from "../../../utils/format";
|
|
1
2
|
import { logFailure } from "../../../utils/log-failure";
|
|
2
3
|
import { useCallback, useMemo } from "react";
|
|
3
4
|
import type { CarbonBoard, PowerPriceRow } from "../../../api-client/europe-energy";
|
|
@@ -33,7 +34,7 @@ function boardRow(row: PowerPriceRow): PriceBoardRow {
|
|
|
33
34
|
return {
|
|
34
35
|
id: row.code, label: row.name, value: row.price, valueText: formatPowerPrice(row.price),
|
|
35
36
|
change: row.change, changeText: formatPowerChange(row.change),
|
|
36
|
-
percentile: position, percentileText: position == null ?
|
|
37
|
+
percentile: position, percentileText: position == null ? MISSING_VALUE : `${position}%`,
|
|
37
38
|
asOf: row.date, status: row.price == null ? "unavailable" : "available",
|
|
38
39
|
history: row.trail.map((point) => ({ date: new Date(`${point.date}T00:00:00Z`), close: point.value })),
|
|
39
40
|
price: row,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DataTableColumn } from "../../../components";
|
|
2
2
|
import { fitChartTableColumns } from "../../../components/chart-table";
|
|
3
|
-
import { formatNumber } from "../../../utils/format";
|
|
3
|
+
import { MISSING_VALUE, formatNumber } from "../../../utils/format";
|
|
4
4
|
|
|
5
5
|
export const PRIMARY_DEALERS_PANE_ID = "primary-dealers";
|
|
6
6
|
|
|
@@ -215,14 +215,14 @@ export function pointsInRange(points: readonly SeriesPoint[], range: DealerRange
|
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
export function formatLevel(value: number | null): string {
|
|
218
|
-
if (value == null || !Number.isFinite(value)) return
|
|
218
|
+
if (value == null || !Number.isFinite(value)) return MISSING_VALUE;
|
|
219
219
|
const decimals = Number.isInteger(value) ? 0 : 2;
|
|
220
220
|
const text = formatNumber(Math.abs(value) === 0 ? 0 : value, decimals);
|
|
221
221
|
return text === "-0" ? "0" : text;
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
export function formatChange(value: number | null): string {
|
|
225
|
-
if (value == null || !Number.isFinite(value)) return
|
|
225
|
+
if (value == null || !Number.isFinite(value)) return MISSING_VALUE;
|
|
226
226
|
const text = formatLevel(Math.abs(value));
|
|
227
227
|
if (text === "0") return "0";
|
|
228
228
|
return value > 0 ? `+${text}` : `-${text}`;
|
|
@@ -19,7 +19,7 @@ import { useAsyncResource } from "../../../react/async-resource";
|
|
|
19
19
|
import { colors } from "../../../theme/colors";
|
|
20
20
|
import type { PaneProps } from "../../../types/plugin";
|
|
21
21
|
import { Box, TextAttributes } from "../../../ui";
|
|
22
|
-
import { formatNumber } from "../../../utils/format";
|
|
22
|
+
import { MISSING_VALUE, formatNumber } from "../../../utils/format";
|
|
23
23
|
import { isPlainKeyboardEvent } from "../../../utils/keyboard";
|
|
24
24
|
import { usePluginPaneState } from "../../runtime";
|
|
25
25
|
import { cachedDealerHistory, fetchPrimaryDealers, hasDealerHistory, loadDealerHistory } from "./client";
|
|
@@ -187,7 +187,7 @@ export function PrimaryDealersPane({ focused, width, height }: PaneProps) {
|
|
|
187
187
|
attributes: row.depth === 0 ? TextAttributes.BOLD : undefined,
|
|
188
188
|
};
|
|
189
189
|
case "asOf":
|
|
190
|
-
return { text: row.asOf ??
|
|
190
|
+
return { text: row.asOf ?? MISSING_VALUE, color: colors.textMuted };
|
|
191
191
|
case "latest":
|
|
192
192
|
return { text: formatLevel(row.latest), value: row.latest, color: colors.text };
|
|
193
193
|
case "previous":
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MISSING_VALUE } from "../../../utils/format";
|
|
1
2
|
import type { RateMeeting, RatePathPayload } from "../../../api-client/rates";
|
|
2
3
|
import type { HeadlessPaneColumn, HeadlessPaneDefinition } from "../../../types/plugin";
|
|
3
4
|
import { fetchRatePath } from "./client";
|
|
@@ -5,10 +6,10 @@ import { meetingMoves, moveOddsText, movesPriced, movesText, rateText } from "./
|
|
|
5
6
|
import { finiteOrNull } from "../../../utils/guards";
|
|
6
7
|
|
|
7
8
|
const rate = (value: unknown) => rateText(finiteOrNull(value));
|
|
8
|
-
const pctl = (value: unknown) => finiteOrNull(value)?.toFixed(0) ??
|
|
9
|
+
const pctl = (value: unknown) => finiteOrNull(value)?.toFixed(0) ?? MISSING_VALUE;
|
|
9
10
|
const bps = (value: unknown) => {
|
|
10
11
|
const bp = finiteOrNull(value);
|
|
11
|
-
return bp == null ?
|
|
12
|
+
return bp == null ? MISSING_VALUE : `${bp > 0 ? "+" : ""}${bp.toFixed(1)}bp`;
|
|
12
13
|
};
|
|
13
14
|
/** What a text report calls each current policy rate; JSON keeps the keys. */
|
|
14
15
|
const POLICY_LABELS: Record<string, string> = {
|
|
@@ -17,11 +18,11 @@ const POLICY_LABELS: Record<string, string> = {
|
|
|
17
18
|
targetUpper: "Target range upper",
|
|
18
19
|
};
|
|
19
20
|
const policyLabel = (value: unknown) => POLICY_LABELS[String(value)] ?? String(value);
|
|
20
|
-
const yesNo = (value: unknown) => value === true ? "yes" : value === false ? "no" :
|
|
21
|
-
const timestamp = (value: unknown) => typeof value === "string" ? value.replace("T", " ").slice(0, 16) :
|
|
21
|
+
const yesNo = (value: unknown) => value === true ? "yes" : value === false ? "no" : MISSING_VALUE;
|
|
22
|
+
const timestamp = (value: unknown) => typeof value === "string" ? value.replace("T", " ").slice(0, 16) : MISSING_VALUE;
|
|
22
23
|
const probabilities = (value: unknown) => {
|
|
23
24
|
const outcomes = Array.isArray(value) ? value as RateMeeting["probabilities"] : [];
|
|
24
|
-
return outcomes.length === 0 ?
|
|
25
|
+
return outcomes.length === 0 ? MISSING_VALUE
|
|
25
26
|
: outcomes.map((outcome) => `${outcome.targetMidpoint.toFixed(3)}% ${(outcome.probability * 100).toFixed(0)}%`).join(" / ");
|
|
26
27
|
};
|
|
27
28
|
|
|
@@ -30,7 +31,7 @@ const STALE_COLUMN: HeadlessPaneColumn = { key: "stale", header: "Data stale", s
|
|
|
30
31
|
// then moves the month under each row.
|
|
31
32
|
const contractColumns: HeadlessPaneColumn[] = [
|
|
32
33
|
{ key: "symbol", header: "Symbol", shrink: false }, { key: "month", header: "Month", shrink: false, stackPriority: 1 },
|
|
33
|
-
{ key: "price", header: "Price", align: "right", format: (value) => finiteOrNull(value)?.toFixed(3) ??
|
|
34
|
+
{ key: "price", header: "Price", align: "right", format: (value) => finiteOrNull(value)?.toFixed(3) ?? MISSING_VALUE },
|
|
34
35
|
{ key: "impliedRate", header: "Implied rate", align: "right", format: rate },
|
|
35
36
|
{ key: "percentile", header: "Pctl 1Y", align: "right", stackPriority: 4, stackRows: 0, format: pctl },
|
|
36
37
|
{ key: "samples", header: "Samples", align: "right", stackPriority: 6, stackRows: 0 },
|
|
@@ -88,7 +89,7 @@ export const ratePathHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
88
89
|
{ key: "moves", header: "Moves", align: "right", format: (value) => movesText(finiteOrNull(value)) },
|
|
89
90
|
{ key: "moveOdds", header: "P(move)", align: "right", format: (value) => moveOddsText(finiteOrNull(value)) },
|
|
90
91
|
{ key: "impliedRate", header: "Implied rate", align: "right", stackPriority: 3, stackRows: 0, format: rate },
|
|
91
|
-
{ key: "targetMidpoint", header: "Target midpoint", align: "right", stackPriority: 6, stackRows: 0, format: (value) => finiteOrNull(value)?.toFixed(3) ??
|
|
92
|
+
{ key: "targetMidpoint", header: "Target midpoint", align: "right", stackPriority: 6, stackRows: 0, format: (value) => finiteOrNull(value)?.toFixed(3) ?? MISSING_VALUE },
|
|
92
93
|
{ key: "changeBps", header: "Change", align: "right", format: bps },
|
|
93
94
|
{ key: "percentile", header: "Pctl 1Y", align: "right", stackPriority: 7, stackRows: 0, format: pctl },
|
|
94
95
|
{ key: "samples", header: "Samples", align: "right", stackPriority: 8, stackRows: 0 },
|