@gloom-sh/terminal 0.20.20 → 0.20.21
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/api-client/data.ts +1 -1
- package/src/api-client/equity-screener.ts +17 -0
- package/src/api-client/futures-curve.ts +5 -0
- package/src/api-client/market-discovery.ts +8 -0
- package/src/api-client/members.ts +2 -0
- package/src/api-client/paths.ts +3 -0
- package/src/api-client/perps.ts +20 -0
- package/src/api-client/request.ts +53 -7
- package/src/api-client/types/filings-and-calls.ts +2 -0
- package/src/app/pane-runtime/plugin-bindings.ts +6 -4
- package/src/app/pro-welcome/model.ts +15 -11
- package/src/app/pro-welcome/row.tsx +3 -3
- package/src/app/pro-welcome/use-pro-welcome.ts +2 -2
- package/src/app/runtime/startup.ts +3 -2
- package/src/app.tsx +3 -2
- package/src/capabilities/asset-data-inputs.ts +5 -0
- package/src/capabilities/factories.ts +8 -3
- package/src/capabilities/registry.ts +1 -0
- package/src/capabilities/types.ts +1 -0
- package/src/cli/commands/market.ts +68 -35
- package/src/cli/commands/options-chain.ts +2 -2
- package/src/cli/commands/overview.ts +10 -9
- package/src/cli/commands/ticker.ts +19 -4
- package/src/cli/desktop-pane-shot.ts +11 -3
- package/src/cli/export-source.ts +35 -2
- package/src/cli/glossary.ts +3 -2
- package/src/cli/helpers.ts +2 -1
- package/src/cli/history-demergers.ts +41 -10
- package/src/cli/history-rows.ts +3 -1
- package/src/cli/known-gaps.ts +21 -7
- package/src/cli/listing-arg.ts +22 -11
- package/src/cli/pane-functions/capabilities.ts +4 -9
- package/src/cli/pane-functions/catalog-snapshot.json +29 -29
- package/src/cli/pane-functions/catalog.ts +1 -18
- package/src/cli/pane-functions/data.ts +8 -4
- package/src/cli/pane-functions/financial-ratio-shot.ts +20 -5
- package/src/cli/pane-functions/freshness.ts +57 -12
- package/src/cli/pane-functions/function-help.ts +2 -2
- package/src/cli/pane-functions/headless.ts +6 -0
- package/src/cli/pane-functions/index.ts +11 -4
- package/src/cli/pane-functions/market-session.ts +25 -0
- package/src/cli/pane-functions/report-notices.ts +10 -0
- package/src/cli/pane-functions/resolver.ts +75 -3
- package/src/cli/pane-functions/screenshot-bridge.ts +1 -0
- package/src/cli/pane-functions/screenshot-data-evidence.ts +1 -0
- package/src/cli/pane-functions/screenshot-payload.ts +38 -5
- package/src/cli/pane-functions/screenshot-render.ts +20 -7
- package/src/cli/perpetual-contract.ts +14 -1
- package/src/cli/report-tables.ts +11 -2
- package/src/cli/result.ts +6 -1
- package/src/components/chart-table/layout.ts +8 -4
- package/src/components/command-bar/list/model.ts +2 -0
- package/src/components/command-bar/pane-templates/items.ts +5 -25
- package/src/components/command-bar/panel/index.tsx +7 -4
- package/src/components/command-bar/routes/root/provider-search.ts +4 -4
- package/src/components/command-bar/routes/root/results.ts +6 -2
- package/src/components/command-bar/routes/ticker-search/results.ts +19 -0
- package/src/components/command-bar/routes/ticker-search/route.ts +3 -3
- package/src/components/command-bar/routes/ticker-search/title.ts +23 -0
- package/src/components/command-bar/routing/list-state.ts +17 -5
- package/src/components/command-bar/selection-runtime.ts +3 -2
- package/src/components/command-bar/surface/index.tsx +2 -0
- package/src/components/command-bar/workflow/alert.ts +6 -4
- package/src/components/command-bar/workflow/collection-actions.ts +2 -1
- package/src/components/layout/pane/footer/index.tsx +1 -0
- package/src/components/layout/pane/footer/model.ts +20 -7
- package/src/components/layout/pane/title.ts +11 -2
- package/src/components/price-selector-dialog.tsx +8 -4
- package/src/components/ticker/badge/list.tsx +4 -3
- package/src/components/ticker/list-table-view.tsx +12 -1
- package/src/components/ui/query-bar.tsx +20 -14
- package/src/data/cached-query.ts +20 -4
- package/src/data/news-pane-snapshots.ts +2 -1
- package/src/data/plugin-cache.ts +5 -1
- package/src/data/saved-copies.ts +68 -2
- package/src/docs/snapshot.json +65 -14
- package/src/docs/topics.ts +11 -9
- package/src/i18n/es.ts +1 -0
- package/src/i18n/ja.ts +1 -0
- package/src/i18n/ko.ts +1 -0
- package/src/i18n/zh-cn.ts +1 -0
- package/src/i18n/zh-tw.ts +1 -0
- package/src/market-data/coordinator/index.ts +25 -5
- package/src/market-data/depositary-pair.ts +27 -10
- package/src/market-data/futures-roll-returns.ts +54 -7
- package/src/market-data/fx-closes.ts +14 -0
- package/src/market-data/market/futures-product-hours.ts +113 -0
- package/src/market-data/market/futures-week.ts +2 -0
- package/src/market-data/market/globex-day.ts +9 -2
- package/src/market-data/market/status.ts +32 -25
- package/src/market-data/market/venue-session.ts +18 -0
- package/src/market-data/options-alternatives.ts +49 -7
- package/src/market-data/perpetual-open-interest.ts +41 -0
- package/src/market-data/quotes/contributions.ts +4 -2
- package/src/market-data/quotes/export-identity.ts +11 -3
- package/src/market-data/quotes/freshness.ts +3 -2
- package/src/market-data/quotes/resolution.ts +9 -2
- package/src/market-data/quotes/tick-range.ts +22 -1
- package/src/market-data/quotes/time.ts +34 -4
- package/src/market-data/split-terms.ts +3 -2
- package/src/news/aggregator.ts +1 -0
- package/src/news/news-model.ts +12 -2
- package/src/news/types.ts +15 -0
- package/src/plugins/builtin/alerts/alert-engine.ts +2 -0
- package/src/plugins/builtin/alerts/cli-forms.ts +3 -2
- package/src/plugins/builtin/alerts/cli-move.ts +5 -2
- package/src/plugins/builtin/alerts/cli.ts +50 -25
- package/src/plugins/builtin/alerts/command.ts +51 -3
- package/src/plugins/builtin/alerts/event-rows.ts +1 -1
- package/src/plugins/builtin/alerts/events-pane.tsx +1 -1
- package/src/plugins/builtin/alerts/format.ts +67 -8
- package/src/plugins/builtin/alerts/headless.ts +22 -6
- package/src/plugins/builtin/alerts/index.tsx +26 -25
- package/src/plugins/builtin/alerts/move-checks.ts +1 -0
- package/src/plugins/builtin/alerts/pane.tsx +15 -6
- package/src/plugins/builtin/alerts/pro-rules.ts +9 -4
- package/src/plugins/builtin/alerts/quotes.ts +10 -5
- package/src/plugins/builtin/alerts/session.ts +28 -0
- package/src/plugins/builtin/alerts/types.ts +1 -0
- package/src/plugins/builtin/analytics/pane-model.ts +2 -1
- package/src/plugins/builtin/analytics/risk-model.ts +2 -2
- package/src/plugins/builtin/attention/headless.ts +2 -2
- package/src/plugins/builtin/attention/model.ts +7 -2
- package/src/plugins/builtin/attention/pane.tsx +2 -1
- package/src/plugins/builtin/awards/headless.ts +1 -1
- package/src/plugins/builtin/broker-trading/ticket.tsx +13 -5
- package/src/plugins/builtin/buildout/detail/company.tsx +0 -1
- package/src/plugins/builtin/buildout/detail/ui.tsx +7 -5
- package/src/plugins/builtin/buildout/model/normalizers.ts +0 -1
- package/src/plugins/builtin/buildout/model/types.ts +0 -1
- package/src/plugins/builtin/buildout/pane/index.tsx +9 -0
- package/src/plugins/builtin/buildout/pane/status.tsx +11 -0
- package/src/plugins/builtin/catalysts/headless.ts +1 -1
- package/src/plugins/builtin/chart-composer/headless.ts +14 -6
- package/src/plugins/builtin/chart-composer/pane.tsx +2 -1
- package/src/plugins/builtin/chart-composer/session-history.ts +14 -2
- package/src/plugins/builtin/chat/controller/index.ts +5 -3
- package/src/plugins/builtin/chat/controller/session-runtime.ts +18 -8
- package/src/plugins/builtin/chat/index.tsx +1 -1
- package/src/plugins/builtin/cloud/auth-actions.tsx +4 -2
- package/src/plugins/builtin/cloud/mcp-connect/dialog.tsx +4 -1
- package/src/plugins/builtin/cloud/thesis/ticker-tab.tsx +2 -1
- package/src/plugins/builtin/company-attention/headless.ts +2 -1
- package/src/plugins/builtin/company-kpis/headless.ts +1 -1
- package/src/plugins/builtin/correlation/headless.ts +3 -3
- package/src/plugins/builtin/correlation/history.ts +1 -0
- package/src/plugins/builtin/correlation/index.tsx +7 -5
- package/src/plugins/builtin/correlation/matrix/selection.ts +21 -3
- package/src/plugins/builtin/correlation/relationship/model.ts +5 -0
- package/src/plugins/builtin/correlation/relationship/pane.tsx +3 -2
- package/src/plugins/builtin/correlation/relationship/view-model.ts +3 -2
- package/src/plugins/builtin/credit-documents/headless.ts +1 -1
- package/src/plugins/builtin/dividend-yield/client.ts +81 -10
- package/src/plugins/builtin/dividend-yield/headless.ts +21 -10
- package/src/plugins/builtin/dividend-yield/model.ts +1 -1
- package/src/plugins/builtin/dividend-yield/pane.tsx +9 -5
- package/src/plugins/builtin/dividend-yield/ranking.ts +15 -5
- package/src/plugins/builtin/dividend-yield/reference-price.ts +3 -0
- package/src/plugins/builtin/dividend-yield/types.ts +12 -0
- package/src/plugins/builtin/dividend-yield/view.ts +30 -7
- package/src/plugins/builtin/doe/headless.ts +1 -1
- package/src/plugins/builtin/doe/pane.tsx +16 -7
- package/src/plugins/builtin/earnings-calls/data.ts +8 -5
- package/src/plugins/builtin/earnings-ripple/headless.ts +1 -1
- package/src/plugins/builtin/econ/calendar-model.ts +1 -1
- package/src/plugins/builtin/econ/index.tsx +26 -18
- package/src/plugins/builtin/equity-screener/client.ts +1 -1
- package/src/plugins/builtin/equity-screener/headless.ts +149 -31
- package/src/plugins/builtin/equity-screener/live.ts +23 -5
- package/src/plugins/builtin/equity-screener/model.ts +27 -12
- package/src/plugins/builtin/equity-screener/pane.tsx +5 -5
- package/src/plugins/builtin/exposure/headless.ts +1 -1
- package/src/plugins/builtin/exposure/holdings.ts +2 -2
- package/src/plugins/builtin/futures/index.tsx +29 -1
- package/src/plugins/builtin/futures/model.ts +93 -10
- package/src/plugins/builtin/futures/returns.ts +54 -1
- package/src/plugins/builtin/futures/table.tsx +14 -2
- package/src/plugins/builtin/futures/use-front-returns.ts +20 -3
- package/src/plugins/builtin/futures-curve/client.ts +1 -1
- package/src/plugins/builtin/futures-curve/headless.ts +9 -3
- package/src/plugins/builtin/futures-curve/model.ts +19 -5
- package/src/plugins/builtin/futures-curve/pane.tsx +12 -6
- package/src/plugins/builtin/gpu/headless.ts +1 -1
- package/src/plugins/builtin/gpu/model.ts +1 -1
- package/src/plugins/builtin/help/function-index.ts +16 -8
- package/src/plugins/builtin/help/functions-table.tsx +6 -4
- package/src/plugins/builtin/help/shortcut-model.ts +7 -2
- package/src/plugins/builtin/holders/headless.ts +16 -5
- package/src/plugins/builtin/holders/pane.tsx +43 -5
- package/src/plugins/builtin/insider/client.ts +118 -11
- package/src/plugins/builtin/insider/filing-stories.ts +36 -20
- package/src/plugins/builtin/insider/issuer.ts +5 -2
- package/src/plugins/builtin/iv-history/headless.ts +2 -0
- package/src/plugins/builtin/macro-day/client.ts +2 -3
- package/src/plugins/builtin/macro-day/comparison.ts +58 -0
- package/src/plugins/builtin/macro-day/headless.ts +47 -3
- package/src/plugins/builtin/macro-day/index.tsx +32 -9
- package/src/plugins/builtin/macro-day/model.ts +1 -1
- package/src/plugins/builtin/macro-day/pane.tsx +99 -12
- package/src/plugins/builtin/market-heatmap/index.tsx +2 -2
- package/src/plugins/builtin/market-movers/footer.ts +29 -3
- package/src/plugins/builtin/market-movers/headless.ts +12 -5
- package/src/plugins/builtin/market-movers/index.tsx +3 -3
- package/src/plugins/builtin/market-movers/session-body.tsx +6 -3
- package/src/plugins/builtin/market-valuation/detail.tsx +3 -3
- package/src/plugins/builtin/market-valuation/headless.ts +6 -6
- package/src/plugins/builtin/market-valuation/pane.tsx +2 -3
- package/src/plugins/builtin/market-valuation/view.ts +6 -8
- package/src/plugins/builtin/members/client.ts +9 -2
- package/src/plugins/builtin/members/headless.ts +8 -10
- package/src/plugins/builtin/members/model.ts +29 -17
- package/src/plugins/builtin/members/pane.tsx +10 -12
- package/src/plugins/builtin/money-markets/headless.ts +1 -1
- package/src/plugins/builtin/news/headless.ts +4 -0
- package/src/plugins/builtin/news/index.tsx +3 -1
- package/src/plugins/builtin/news/wire/industry-pane.tsx +2 -1
- package/src/plugins/builtin/news/wire/news/preset-pane.tsx +1 -1
- package/src/plugins/builtin/news/wire/persisted-articles.ts +8 -4
- package/src/plugins/builtin/notes/headless.ts +7 -0
- package/src/plugins/builtin/notes/index.tsx +1 -1
- package/src/plugins/builtin/notes/quick-notes-pane.tsx +18 -2
- package/src/plugins/builtin/options/view.tsx +7 -6
- package/src/plugins/builtin/options-positioning/headless.ts +4 -4
- package/src/plugins/builtin/options-positioning/pane.tsx +7 -3
- package/src/plugins/builtin/options-scenario/client.ts +20 -4
- package/src/plugins/builtin/options-scenario/headless.ts +1 -1
- package/src/plugins/builtin/pe-band/client.ts +5 -9
- package/src/plugins/builtin/pe-band/headless.ts +11 -13
- package/src/plugins/builtin/pe-band/model.ts +39 -60
- package/src/plugins/builtin/pe-band/pane.tsx +14 -15
- package/src/plugins/builtin/perps/equity-row.tsx +3 -1
- package/src/plugins/builtin/perps/freshness.ts +16 -9
- package/src/plugins/builtin/perps/headless.ts +4 -1
- package/src/plugins/builtin/perps/markets-section.tsx +16 -10
- package/src/plugins/builtin/perps/model.ts +33 -2
- package/src/plugins/builtin/perps/pane.tsx +3 -2
- package/src/plugins/builtin/perps/status-line.ts +12 -3
- package/src/plugins/builtin/perps/venue-markets.ts +38 -0
- package/src/plugins/builtin/plugin-marketplace/pane.tsx +4 -3
- package/src/plugins/builtin/portfolio-list/cell-version.ts +1 -1
- package/src/plugins/builtin/portfolio-list/cli/render.ts +46 -7
- package/src/plugins/builtin/portfolio-list/headless.ts +31 -8
- package/src/plugins/builtin/portfolio-list/settings.ts +3 -0
- package/src/plugins/builtin/portfolio-list/table.tsx +7 -1
- package/src/plugins/builtin/power/headless.ts +1 -1
- package/src/plugins/builtin/realized-vol/headless.ts +1 -1
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +27 -13
- package/src/plugins/builtin/scanner/feed.ts +7 -4
- package/src/plugins/builtin/scanner/flow-pane.tsx +8 -4
- package/src/plugins/builtin/scanner/headless.ts +57 -26
- package/src/plugins/builtin/scanner/hilo-pane.tsx +6 -3
- package/src/plugins/builtin/scanner/lock-note.ts +3 -2
- package/src/plugins/builtin/scanner/us-session.ts +9 -0
- package/src/plugins/builtin/seasonality/client.ts +46 -10
- package/src/plugins/builtin/seasonality/headless.ts +29 -11
- package/src/plugins/builtin/seasonality/model.ts +101 -24
- package/src/plugins/builtin/seasonality/pane.tsx +10 -6
- package/src/plugins/builtin/sec/filing-content.ts +13 -0
- package/src/plugins/builtin/sec/index.tsx +16 -11
- package/src/plugins/builtin/sectors/client.ts +27 -5
- package/src/plugins/builtin/sectors/headless.ts +2 -1
- package/src/plugins/builtin/sectors/index.tsx +22 -10
- package/src/plugins/builtin/shared/cloud-resource.ts +3 -3
- package/src/plugins/builtin/shared/extended-print.ts +38 -0
- package/src/plugins/builtin/shared/pro-feature-wall.tsx +1 -1
- package/src/plugins/builtin/shared/report-freshness.ts +7 -3
- package/src/plugins/builtin/shared/scanner-capture.ts +16 -3
- package/src/plugins/builtin/shared/ticker-company.ts +17 -8
- package/src/plugins/builtin/shared/use-quote-board.ts +11 -4
- package/src/plugins/builtin/social-mentions/client.ts +7 -3
- package/src/plugins/builtin/social-mentions/outliers.tsx +9 -2
- package/src/plugins/builtin/thirteenf/api.ts +24 -3
- package/src/plugins/builtin/thirteenf/data.ts +21 -8
- package/src/plugins/builtin/thirteenf/headless.ts +7 -3
- package/src/plugins/builtin/thirteenf/signals-pane.tsx +10 -3
- package/src/plugins/builtin/thirteenf/signals.ts +22 -1
- package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +4 -2
- package/src/plugins/builtin/ticker-detail/financials/model.ts +7 -0
- package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +15 -6
- package/src/plugins/builtin/ticker-detail/financials/ratios.ts +5 -4
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +14 -5
- package/src/plugins/builtin/ticker-detail/headless.ts +32 -26
- package/src/plugins/builtin/ticker-detail/index.tsx +1 -1
- package/src/plugins/builtin/ticker-detail/overview/components.tsx +8 -3
- package/src/plugins/builtin/ticker-detail/overview/model.ts +28 -5
- package/src/plugins/builtin/ticker-detail/overview/pane.tsx +14 -1
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +9 -8
- package/src/plugins/builtin/ticker-detail/pane.tsx +16 -9
- package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +41 -23
- package/src/plugins/builtin/ticker-detail/quote-monitor/rows.ts +30 -13
- package/src/plugins/builtin/ticker-detail/settings.ts +9 -2
- package/src/plugins/builtin/time-sales/headless.ts +49 -13
- package/src/plugins/builtin/time-sales/model.ts +2 -2
- package/src/plugins/builtin/time-sales/window.ts +84 -10
- package/src/plugins/builtin/vol-surface/charts.tsx +4 -2
- package/src/plugins/builtin/vol-surface/events.ts +12 -5
- package/src/plugins/builtin/vol-surface/headless.ts +1 -1
- package/src/plugins/builtin/vol-surface/pane.tsx +15 -7
- package/src/plugins/builtin/world-indices/footer.ts +1 -1
- package/src/plugins/builtin/world-venue-map/chokepoint-report.ts +3 -1
- package/src/plugins/builtin/world-venue-map/headless.ts +27 -13
- package/src/plugins/builtin/yield-curve/client.ts +3 -1
- package/src/plugins/duplicates.ts +60 -0
- package/src/plugins/loader.ts +12 -3
- package/src/plugins/marketplace/model.ts +10 -1
- package/src/portfolio/column-values.ts +52 -5
- package/src/react/async-resource.ts +8 -7
- package/src/renderers/browser/bundled-plugins.ts +2 -1
- package/src/renderers/dom/build-assets.ts +20 -0
- package/src/renderers/dom/data-table/index.tsx +36 -2
- package/src/renderers/dom/es2023-array-methods.ts +57 -0
- package/src/renderers/dom/host/surface-fit.ts +64 -13
- package/src/renderers/dom/styles.css +6 -1
- package/src/renderers/electrobun/bun/external-plugins.ts +16 -6
- package/src/renderers/electrobun/shared/protocol.ts +2 -0
- package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +31 -7
- package/src/renderers/electrobun/view/cli-pane-shot-frame.tsx +15 -8
- package/src/renderers/electrobun/view/external-plugins.ts +1 -0
- package/src/renderers/electrobun/view/remote/asset-data-client.ts +1 -0
- package/src/series/types.ts +1 -0
- package/src/sources/gloomberb-cloud/fred-attribution.ts +6 -5
- package/src/sources/gloomberb-cloud/index.ts +42 -5
- package/src/sources/gloomberb-cloud/news.ts +15 -2
- package/src/sources/gloomberb-cloud/normalizers.ts +9 -0
- package/src/sources/history-result.ts +2 -1
- package/src/sources/history-retention.ts +14 -2
- package/src/sources/listing-symbols.ts +1 -1
- package/src/sources/provider-router/cache.ts +32 -3
- package/src/sources/provider-router/cached-routes.ts +25 -0
- package/src/sources/provider-router/connection-health.ts +1 -0
- package/src/sources/provider-router/history.ts +2 -2
- package/src/sources/provider-router/index.ts +14 -0
- package/src/sources/provider-router/sec-filings-page.ts +25 -0
- package/src/sources/sec-edgar/content.ts +67 -36
- package/src/tickers/listing-fate.ts +28 -0
- package/src/tickers/search/home-listing.ts +3 -0
- package/src/tickers/search/index-root-lead.ts +40 -0
- package/src/tickers/terminal-codes.ts +7 -4
- package/src/time-series/base-series.ts +17 -8
- package/src/time-series/fundamentals/historical-valuation.ts +2 -2
- package/src/time-series/fundamentals/series.ts +15 -12
- package/src/time-series/history-acquisition.ts +2 -0
- package/src/time-series/market.ts +3 -1
- package/src/time-series/price-comparison.ts +3 -1
- package/src/time-series/resolve-context.ts +8 -0
- package/src/time-series/resolve.ts +50 -10
- package/src/time-series/types.ts +1 -0
- package/src/time-series/use-chart-resolution.ts +2 -2
- package/src/time-series/valuation-currency.ts +40 -12
- package/src/types/data-provider.ts +30 -1
- package/src/types/financials.ts +23 -0
- package/src/types/headless.ts +23 -0
- package/src/types/instrument.ts +1 -0
- package/src/utils/crypto-pair.ts +16 -0
- package/src/utils/exchange-announcements.ts +2 -1
- package/src/utils/exchange-notation.generated.ts +58 -1
- package/src/utils/exchanges.ts +43 -1
- package/src/utils/format.ts +37 -2
- package/src/utils/function-search.ts +38 -0
- package/src/utils/fuzzy-search.ts +10 -6
- package/src/utils/option-choice.ts +15 -0
- package/src/utils/price-history.ts +15 -1
- package/src/utils/reason-codes.ts +6 -3
- package/src/utils/trailing-dividend.ts +241 -28
|
@@ -13,7 +13,11 @@ import { isValuationMultiple, screenRowId } from "./model";
|
|
|
13
13
|
* cap are the regular session's, and a pre-market, after-hours or overnight
|
|
14
14
|
* print rides beside them in `extended`, measured from that session's close.
|
|
15
15
|
*/
|
|
16
|
-
export type LiveScreenRow = ScreenRow & {
|
|
16
|
+
export type LiveScreenRow = ScreenRow & {
|
|
17
|
+
extended?: ExtendedSessionDisplay;
|
|
18
|
+
/** The quote's providerPriceDivisor (100 for a line quoted in pence): its price keeps the decimals it trades in. */
|
|
19
|
+
quotedUnitDivisor?: number;
|
|
20
|
+
};
|
|
17
21
|
|
|
18
22
|
function metricTime(metric: ScreenMetric | undefined): number | null {
|
|
19
23
|
const stamp = metric?.observedAt ?? metric?.asOf ?? null;
|
|
@@ -26,8 +30,14 @@ function screenRowQuoteKey(row: Pick<ScreenRow, "symbol" | "exchange">): string
|
|
|
26
30
|
return buildQuoteKey({ symbol: row.symbol, exchange: row.exchange });
|
|
27
31
|
}
|
|
28
32
|
|
|
33
|
+
/**
|
|
34
|
+
* The quote's figure in place of the snapshot's. A snapshot figure that was a
|
|
35
|
+
* last price on record goes with its print time and the reason it was stale;
|
|
36
|
+
* any other reason (a cap's share count) still holds.
|
|
37
|
+
*/
|
|
29
38
|
function liveMetric(metric: ScreenMetric, value: number, asOf: string, observedAt: string): ScreenMetric {
|
|
30
|
-
|
|
39
|
+
const { printedAt: _printedAt, ...rest } = metric;
|
|
40
|
+
return { ...rest, value, asOf, observedAt, state: "available", ...(metric.state === "stale" ? { reason: null } : {}) };
|
|
31
41
|
}
|
|
32
42
|
|
|
33
43
|
/**
|
|
@@ -37,10 +47,18 @@ function liveMetric(metric: ScreenMetric, value: number, asOf: string, observedA
|
|
|
37
47
|
*/
|
|
38
48
|
const PRICE_MULTIPLE_FIELDS = ["trailingPE", "forwardPE", "priceToBook"] as const;
|
|
39
49
|
|
|
40
|
-
/**
|
|
41
|
-
|
|
50
|
+
/**
|
|
51
|
+
* The company's name as its quote gives it, so a row reads as `quote` does
|
|
52
|
+
* (the snapshot's without one), and the unit its quote is in: a line quoted
|
|
53
|
+
* in pence keeps its pence decimals (GCP's £0.828).
|
|
54
|
+
*/
|
|
55
|
+
function quoteNamed(row: ScreenRow, quote: Quote): LiveScreenRow {
|
|
42
56
|
const name = quote.name?.trim();
|
|
43
|
-
|
|
57
|
+
const divisor = quote.providerPriceDivisor;
|
|
58
|
+
const quoted = divisor != null && Number.isFinite(divisor) && divisor > 1 && (!row.currency || quote.currency?.trim() === row.currency);
|
|
59
|
+
return name && name !== row.name || quoted
|
|
60
|
+
? { ...row, ...name && name !== row.name ? { name } : {}, ...quoted ? { quotedUnitDivisor: divisor } : {} }
|
|
61
|
+
: row;
|
|
44
62
|
}
|
|
45
63
|
|
|
46
64
|
/**
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
SCORE_FIELDS,
|
|
16
16
|
SOCIAL_FIELDS,
|
|
17
17
|
TECHNICAL_FIELDS,
|
|
18
|
+
TRAILING_YIELD_FIELDS,
|
|
18
19
|
VOLATILITY_FIELDS,
|
|
19
20
|
type NumericField,
|
|
20
21
|
type ScreenMetric,
|
|
@@ -28,8 +29,9 @@ import {
|
|
|
28
29
|
} from "../../../api-client/equity-screener";
|
|
29
30
|
import { yearToDateBaseLabel } from "../../../market-data/market/year-to-date";
|
|
30
31
|
import { canonicalExchange, isUsListingExchange, parsePublicTickerKey } from "../../../utils/exchanges";
|
|
31
|
-
import { LATEST_DISTRIBUTION, TRAILING_DIVIDEND_BASIS } from "../../../utils/forward-dividend";
|
|
32
|
+
import { LATEST_DISTRIBUTION, TRAILING_DIVIDEND_BASIS, UNEVEN_REGULAR_PAYMENTS } from "../../../utils/forward-dividend";
|
|
32
33
|
import { MISSING_VALUE, formatCompact, formatNumber, formatPercentRaw } from "../../../utils/format";
|
|
34
|
+
import { formatMarketPrice } from "../../../market-data/market/format";
|
|
33
35
|
import { formatPriceEarnings, NOT_MEANINGFUL } from "../../../utils/price-earnings";
|
|
34
36
|
import { ATTENTION_LISTED } from "../attention/listing";
|
|
35
37
|
import { kpiFreeLimitNote } from "../company-kpis/model";
|
|
@@ -70,6 +72,7 @@ export const SHORT_LABELS: Record<NumericField, string> = {
|
|
|
70
72
|
forwardPE: "FWD P/E",
|
|
71
73
|
enterpriseToRevenue: "EV/REV",
|
|
72
74
|
dividendYieldPercent: "DIV YLD%",
|
|
75
|
+
trailingDividendYieldPercent: "TTM YLD%",
|
|
73
76
|
revenueGrowthPercent: "FY REV GR%",
|
|
74
77
|
earningsGrowthPercent: "FY EARN GR%",
|
|
75
78
|
grossMarginPercent: "FY GROSS MGN%",
|
|
@@ -239,8 +242,14 @@ const MEMBERSHIP = new Set<NumericField>(MEMBERSHIP_FIELDS);
|
|
|
239
242
|
/** Shown after the screen's own criteria when the pane has room. */
|
|
240
243
|
const CONTEXT_FIELDS: NumericField[] = ["marketCap", "price", "changePercent", "trailingPE", "revenueGrowthPercent", "operatingMarginPercent", "dividendYieldPercent"];
|
|
241
244
|
|
|
242
|
-
|
|
245
|
+
/**
|
|
246
|
+
* A value as a cell prints it. A price of a line quoted in a sub-unit
|
|
247
|
+
* (`quotedUnitDivisor`, 100 for pence) keeps the decimals it trades in, as
|
|
248
|
+
* `quote` prints it: GCP's 82.8p is 0.828, not 0.83.
|
|
249
|
+
*/
|
|
250
|
+
export function formatScreenValue(field: NumericField, value: number | null, quotedUnitDivisor?: number): string {
|
|
243
251
|
if (value == null || !Number.isFinite(value)) return MISSING_VALUE;
|
|
252
|
+
if (field === "price" && quotedUnitDivisor != null && quotedUnitDivisor > 1) return formatMarketPrice(value, { quotedUnitDivisor, minimumFractionDigits: 2 });
|
|
244
253
|
if (COMPACT.has(field)) return formatCompact(value, { fixedDecimals: true });
|
|
245
254
|
if (DAILY_COUNTS.has(field)) return value < 1_000 ? value.toFixed(0) : formatCompact(value, { fixedDecimals: true });
|
|
246
255
|
if (RATIOS.has(field)) return `${value.toFixed(1)}x`;
|
|
@@ -257,16 +266,16 @@ export function formatScreenValue(field: NumericField, value: number | null): st
|
|
|
257
266
|
}
|
|
258
267
|
|
|
259
268
|
/** A row's metric as a cell prints it: N/M for a multiple that is not meaningful, as RV and `valuation` print it. */
|
|
260
|
-
export function formatScreenMetric(field: NumericField, metric: Pick<ScreenMetric, "value" | "notMeaningful"> & Partial<Pick<ScreenMetric, "reason"
|
|
261
|
-
const text = metric.value == null && metric.notMeaningful ? formatPriceEarnings(NOT_MEANINGFUL) : formatScreenValue(field, metric.value);
|
|
269
|
+
export function formatScreenMetric(field: NumericField, metric: Pick<ScreenMetric, "value" | "notMeaningful"> & Partial<Pick<ScreenMetric, "reason">>, quotedUnitDivisor?: number): string {
|
|
270
|
+
const text = metric.value == null && metric.notMeaningful ? formatPriceEarnings(NOT_MEANINGFUL) : formatScreenValue(field, metric.value, quotedUnitDivisor);
|
|
262
271
|
return field === "dividendGrowthYears" && metric.value != null && /^At least \d+: the stored history starts \d{4}-\d{2}-\d{2}$/.test(metric.reason ?? "") ? `${text}+` : text;
|
|
263
272
|
}
|
|
264
273
|
|
|
265
274
|
/** A metric as a company's detail prints it: with its unit, but a grade or the composite reads as itself (B+, 4.72 Top). */
|
|
266
|
-
export function screenDetailValue(field: NumericField, metric: Pick<ScreenMetric, "value" | "notMeaningful" | "unit"> & Partial<Pick<ScreenMetric, "reason"
|
|
275
|
+
export function screenDetailValue(field: NumericField, metric: Pick<ScreenMetric, "value" | "notMeaningful" | "unit"> & Partial<Pick<ScreenMetric, "reason">>, quotedUnitDivisor?: number): string {
|
|
267
276
|
// A missing value is just "--", without the unit it would have had; N/M says so.
|
|
268
277
|
if (metric.value == null) return metric.notMeaningful ? formatScreenMetric(field, metric) : formatScreenValue(field, null);
|
|
269
|
-
const text = formatScreenMetric(field, metric);
|
|
278
|
+
const text = formatScreenMetric(field, metric, quotedUnitDivisor);
|
|
270
279
|
if (GRADE_DISPLAY_FIELDS.has(field)) return text;
|
|
271
280
|
// A count of one is singular: 1 year, 1 day.
|
|
272
281
|
const unit = metric.value === 1 && COUNT_UNITS.has(metric.unit) ? metric.unit.slice(0, -1) : metric.unit;
|
|
@@ -294,13 +303,16 @@ export function gradeRankText(metric: Pick<ScreenMetric, "source">): string | nu
|
|
|
294
303
|
|
|
295
304
|
/**
|
|
296
305
|
* A row's dividend yield basis, in the words `ticker` and `DVD` use. Gloom
|
|
297
|
-
* Cloud serves
|
|
298
|
-
*
|
|
299
|
-
*
|
|
306
|
+
* Cloud serves the forward yield DVD and DES show, and names it in the
|
|
307
|
+
* metric's reason: the latest distribution annualized, or an uneven year's
|
|
308
|
+
* regular payments summed. A company with no forward rate has no value (its
|
|
309
|
+
* reason names its trailing yield). An older server's trailing row still
|
|
310
|
+
* reads as trailing; a row whose basis is not stated gets none.
|
|
300
311
|
*/
|
|
301
312
|
export function dividendYieldBasis(metric: ScreenMetric): string | null {
|
|
302
313
|
if (metric.value == null) return null;
|
|
303
|
-
if (/^forward yield\b/i.test(metric.reason ?? ""))
|
|
314
|
+
if (/^forward yield\b/i.test(metric.reason ?? ""))
|
|
315
|
+
return (metric.reason ?? "").includes(`(${UNEVEN_REGULAR_PAYMENTS})`) ? UNEVEN_REGULAR_PAYMENTS : LATEST_DISTRIBUTION;
|
|
304
316
|
if (/^trailing yield\b/i.test(metric.reason ?? "")) return TRAILING_DIVIDEND_BASIS;
|
|
305
317
|
return null;
|
|
306
318
|
}
|
|
@@ -357,6 +369,7 @@ export function screenYtdBase(rows: readonly ScreenRow[], assembledAt?: string |
|
|
|
357
369
|
* the pane is short of room.
|
|
358
370
|
*/
|
|
359
371
|
export function screenColumnLabel(field: NumericField, ytdBase: string | null, form: "report" | "pane" | "compact" = "pane"): string {
|
|
372
|
+
if (field === "beta") return form === "compact" ? "Beta 2Y wkly SPY" : "Beta 2Y weekly vs SPY";
|
|
360
373
|
if (field !== "returnYtdPercent" || !ytdBase) return SHORT_LABELS[field];
|
|
361
374
|
return form === "compact" ? `YTD% ${ytdBase}` : `YTD% vs ${ytdBase}${form === "report" ? " close" : ""}`;
|
|
362
375
|
}
|
|
@@ -483,6 +496,7 @@ export const screenLabel = (field: string) =>
|
|
|
483
496
|
changePercent: "Change %",
|
|
484
497
|
daysToCover: "Days to cover",
|
|
485
498
|
dividendYieldPercent: "Dividend yield %",
|
|
499
|
+
trailingDividendYieldPercent: "Trailing dividend yield %",
|
|
486
500
|
xPostsPerDay: "X posts per day",
|
|
487
501
|
xPostsVsMedian: "X posts vs median",
|
|
488
502
|
payoutRatioPercent: "FY cash dividends / parent net income %",
|
|
@@ -1016,8 +1030,9 @@ export function validateScreenPayload(value: unknown): ScreenPayload {
|
|
|
1016
1030
|
ids.add(screenRowId(row));
|
|
1017
1031
|
for (const field of NUMERIC_FIELDS) {
|
|
1018
1032
|
// A server from before social, research, volatility, dividend, technical, option volatility, ownership, quality,
|
|
1019
|
-
// score or
|
|
1020
|
-
|
|
1033
|
+
// score, grade or trailing yield fields omits them; they read as unavailable. A Pro field it left out was held back
|
|
1034
|
+
// from this caller.
|
|
1035
|
+
if (!row.metrics[field] && ([...SOCIAL_FIELDS, ...RESEARCH_FIELDS, ...VOLATILITY_FIELDS, ...TECHNICAL_FIELDS, ...OPTION_VOLATILITY_FIELDS, ...OWNERSHIP_FIELDS, ...QUALITY_FIELDS, ...SCORE_FIELDS, ...GRADE_FIELDS, ...ATTENTION_FIELDS, ...HIRING_APP_FIELDS, ...KPI_FIELDS, ...DIVIDEND_FIELDS, ...TRAILING_YIELD_FIELDS] as readonly string[]).includes(field))
|
|
1021
1036
|
row.metrics[field] = PRO_FIELDS.has(field) ? withheldMetric() : unavailableMetric();
|
|
1022
1037
|
const metric = row.metrics[field];
|
|
1023
1038
|
if (
|
|
@@ -108,7 +108,7 @@ import { liveScreenPlaces, overlayLiveScreenRows, placeLiveScreenRows, screenExt
|
|
|
108
108
|
import { useLiveQuoteEntries } from "../../../state/hooks/quote-streaming";
|
|
109
109
|
import { buildScreenerQuoteTargets } from "../../../market-data/quotes/screener-live-quotes";
|
|
110
110
|
import { useLiveStreamingSetting } from "../../../state/hooks/live-streaming";
|
|
111
|
-
import { getTableWidth } from "../../../components/ui/table-layout";
|
|
111
|
+
import { dropColumnsToFit, getTableWidth } from "../../../components/ui/table-layout";
|
|
112
112
|
|
|
113
113
|
/** How often a live sort re-reads the figures it orders by. */
|
|
114
114
|
const LIVE_ORDER_SAMPLE_MS = 5_000;
|
|
@@ -185,7 +185,7 @@ export function resultColumns(
|
|
|
185
185
|
const exchange = fits(build(compact.slice(0, shown), true, false, "compact"));
|
|
186
186
|
const sector = exchange && fits(build(compact.slice(0, shown), true, true, "compact"));
|
|
187
187
|
const named = build(extras("pane").slice(0, shown), exchange, sector, "pane");
|
|
188
|
-
return fits(named) ? named : build(compact.slice(0, shown), exchange, sector, "compact");
|
|
188
|
+
return fits(named) ? named : dropColumnsToFit(build(compact.slice(0, shown), exchange, sector, "compact"), width - 1, ["name", "percentile"]);
|
|
189
189
|
}
|
|
190
190
|
const loadFields = () => fetchScreenFields();
|
|
191
191
|
const criterionRowId = (row: { id: string }) => row.id;
|
|
@@ -236,7 +236,7 @@ function ScreenDetail({
|
|
|
236
236
|
<KeyValueRow
|
|
237
237
|
label={screenLabel(field)}
|
|
238
238
|
labelWidth={24}
|
|
239
|
-
value={screenDetailValue(field, metric)}
|
|
239
|
+
value={screenDetailValue(field, metric, row.quotedUnitDivisor)}
|
|
240
240
|
detail={
|
|
241
241
|
metric.value === null
|
|
242
242
|
? (reason ?? "unavailable")
|
|
@@ -252,7 +252,7 @@ function ScreenDetail({
|
|
|
252
252
|
<KeyValueRow
|
|
253
253
|
label={EXTENDED_SESSION_LABELS[extended.session]}
|
|
254
254
|
labelWidth={24}
|
|
255
|
-
value={`${formatScreenValue("price", extended.price)} ${row.metrics.price.unit}`}
|
|
255
|
+
value={`${formatScreenValue("price", extended.price, row.quotedUnitDivisor)} ${row.metrics.price.unit}`}
|
|
256
256
|
detail={`${formatPercentRaw(extended.changePercent)}${extended.mark ? " mid" : ""}`}
|
|
257
257
|
/>
|
|
258
258
|
) : null}
|
|
@@ -1127,7 +1127,7 @@ function EquityScreenView({
|
|
|
1127
1127
|
const sign = screenSignValue(field, observation.value);
|
|
1128
1128
|
const change = sign == null ? undefined : priceColor(sign, colors);
|
|
1129
1129
|
return {
|
|
1130
|
-
text: formatScreenMetric(field, observation),
|
|
1130
|
+
text: formatScreenMetric(field, observation, row.quotedUnitDivisor),
|
|
1131
1131
|
color: observation.state === "stale" ? colors.warning : change,
|
|
1132
1132
|
};
|
|
1133
1133
|
}
|
|
@@ -236,7 +236,7 @@ export const exposureHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
236
236
|
{ key: "depth", type: "integer", settingKey: "depth", defaultValue: 2, minimum: 1, maximum: 4, description: "Maximum relationship hops." },
|
|
237
237
|
{ key: "nav", type: "string", settingKey: "nav", description: "Positive portfolio NAV in its configured currency; required for PORT." },
|
|
238
238
|
{ key: "cash", type: "string", settingKey: "cash", description: "Explicit cash weight as NAV fraction; no normalization." },
|
|
239
|
-
{ key: "tab", type: "enum", settingKey: "tab", defaultValue: "table", values: TABS
|
|
239
|
+
{ key: "tab", type: "enum", settingKey: "tab", defaultValue: "table", values: [...TABS], description: "Pane tab." },
|
|
240
240
|
{ key: "view", type: "enum", settingKey: "view", defaultValue: "stress", values: ["stress", "country", "supplier", "customer"].map(value => ({ value })), description: "Portfolio stress or concentration grouping." },
|
|
241
241
|
],
|
|
242
242
|
describe: (args, result) => {
|
|
@@ -2,7 +2,7 @@ import type { ExposureHolding } from "../../../api-client/exposure";
|
|
|
2
2
|
import type { DataProvider } from "../../../types/data-provider";
|
|
3
3
|
import type { Quote } from "../../../types/financials";
|
|
4
4
|
import type { Portfolio, TickerRecord } from "../../../types/ticker";
|
|
5
|
-
import { publicTickerKey } from "../../../utils/exchanges";
|
|
5
|
+
import { displayTickerKey, publicTickerKey } from "../../../utils/exchanges";
|
|
6
6
|
import { resolveCurrencyUnit } from "../../../utils/currency-units";
|
|
7
7
|
import { convertCurrency } from "../../../utils/format";
|
|
8
8
|
import { logFailure } from "../../../utils/log-failure";
|
|
@@ -67,7 +67,7 @@ export async function portfolioHoldings(portfolio: Portfolio, tickers: TickerRec
|
|
|
67
67
|
}, quote);
|
|
68
68
|
const active = getPortfolioQuoteDisplay(metrics, quote);
|
|
69
69
|
const value = resolvePortfolioMarketValue(metrics, active ? convertCurrency(active.price, currency, portfolio.currency, rates) : null);
|
|
70
|
-
if (!value || !Number.isFinite(value.net)) throw new Error(`Market value unavailable for ${ticker.metadata.ticker}; no partial portfolio was reweighted.`);
|
|
70
|
+
if (!value || !Number.isFinite(value.net)) throw new Error(`Market value unavailable for ${displayTickerKey(ticker.metadata.ticker)}; no partial portfolio was reweighted.`);
|
|
71
71
|
holdings.push({ symbol: publicTickerKey(ticker.metadata.ticker, ticker.metadata.exchange), weight: value.net / nav });
|
|
72
72
|
}
|
|
73
73
|
return holdings;
|
|
@@ -41,6 +41,7 @@ import {
|
|
|
41
41
|
import {
|
|
42
42
|
FUTURES_BOARD_ROWS,
|
|
43
43
|
FUTURES_SECTOR_LABELS,
|
|
44
|
+
futuresBoardCode,
|
|
44
45
|
futuresBoardContract,
|
|
45
46
|
getContractsBySector,
|
|
46
47
|
type FuturesSector,
|
|
@@ -53,7 +54,9 @@ import {
|
|
|
53
54
|
futuresBoardQuotes,
|
|
54
55
|
futuresNoMatchFailure,
|
|
55
56
|
futuresReturnBaseText,
|
|
57
|
+
futuresReturnGapNotes,
|
|
56
58
|
futuresRowId,
|
|
59
|
+
futuresRowReturnGapText,
|
|
57
60
|
futuresSessionQuote,
|
|
58
61
|
type FuturesColumnId,
|
|
59
62
|
type FuturesSortPreference,
|
|
@@ -64,6 +67,7 @@ import {
|
|
|
64
67
|
DEFAULT_FUTURES_COLUMN_IDS,
|
|
65
68
|
FUTURES_COLUMN_DEFS,
|
|
66
69
|
FUTURES_REPORT_COLUMNS,
|
|
70
|
+
futuresClosePriceKind,
|
|
67
71
|
renderFuturesCell,
|
|
68
72
|
resolveFuturesColumnIds,
|
|
69
73
|
usesSessionText,
|
|
@@ -173,10 +177,26 @@ export function FuturesPane({ focused, width, height }: PaneProps) {
|
|
|
173
177
|
label: "Return base dates",
|
|
174
178
|
getMetadata: () => ({ text: `Returns: ${[...returnBases.values()].join("; ")}.` }),
|
|
175
179
|
} : null);
|
|
180
|
+
// Why a drawn return is a dash, every row that has one: a contract listed since the base close, or one whose history starts later.
|
|
181
|
+
const drawnHorizons = useMemo(() => columns.flatMap((column) => FUTURES_RETURN_COLUMNS[column.id] ?? []), [columns]);
|
|
182
|
+
const returnGapNotes = useMemo(() => futuresReturnGapNotes(listedContracts, returns, drawnHorizons),
|
|
183
|
+
[drawnHorizons, listedContracts, returns]);
|
|
184
|
+
useRemoteUiNode(returnGapNotes.length > 0 ? {
|
|
185
|
+
role: "report-notice",
|
|
186
|
+
label: "Empty returns",
|
|
187
|
+
getMetadata: () => ({ text: returnGapNotes.join(" ") }),
|
|
188
|
+
} : null);
|
|
176
189
|
// The unit a price counts and the month a symbol rolled past, as `quote` reads them.
|
|
177
190
|
const terms = useFuturesBoardTerms(listedContracts, !!dataProvider && paneVisible);
|
|
178
191
|
// Each move measured as `quote` measures it with the row's terms, so a row never flips between references at the reopen.
|
|
179
192
|
const shownQuotes = useMemo(() => futuresBoardQuotes(quotes, terms), [quotes, terms]);
|
|
193
|
+
const showPriceBasis = listedContracts.some((contract) => futuresClosePriceKind(contract, shownQuotes.get(contract.symbol)?.quote) != null);
|
|
194
|
+
const priceBasisNote = showPriceBasis ? "Price: S = settlement, T = last trade (settlement unconfirmed)" : null;
|
|
195
|
+
useRemoteUiNode(priceBasisNote ? {
|
|
196
|
+
role: "report-notice",
|
|
197
|
+
label: "Price basis",
|
|
198
|
+
getMetadata: () => ({ text: priceBasisNote }),
|
|
199
|
+
} : null);
|
|
180
200
|
|
|
181
201
|
const visibleCollapsed = effectiveCollapsedSectors(collapsedSectors, searchQuery);
|
|
182
202
|
const rows = useMemo(
|
|
@@ -212,7 +232,7 @@ export function FuturesPane({ focused, width, height }: PaneProps) {
|
|
|
212
232
|
return [
|
|
213
233
|
state?.loading, state?.stale,
|
|
214
234
|
quote?.price, quote?.change, quote?.changePercent, quote?.previousClose, quote?.volume, quote?.lastUpdated, quote?.symbol, quote?.name,
|
|
215
|
-
futuresSessionQuote(row.contract, quote)?.marketState,
|
|
235
|
+
futuresSessionQuote(row.contract, quote)?.marketState, quote?.futuresPriceKind,
|
|
216
236
|
values?.loading, ...Object.values(values?.values ?? {}),
|
|
217
237
|
contract?.loading, contract?.terms?.spec?.unit, contract?.terms?.deliveryMonth, contract?.terms?.nearest?.contract,
|
|
218
238
|
contract?.terms?.nearest?.lastTrade,
|
|
@@ -269,6 +289,9 @@ export function FuturesPane({ focused, width, height }: PaneProps) {
|
|
|
269
289
|
const [picked, setPicked] = useState(false);
|
|
270
290
|
const [, setCurveRoot] = usePaneSettingValue<string | undefined>("root", undefined);
|
|
271
291
|
const selectedRow = rows.find((row) => row.type === "row" && futuresRowId(row) === selectedId);
|
|
292
|
+
// The selected row's empty returns, and why, beside the board's status.
|
|
293
|
+
const selectedGapText = selectedRow?.type === "row" ? futuresRowReturnGapText(returns.get(selectedRow.contract.symbol)?.gaps, drawnHorizons) : null;
|
|
294
|
+
const selectedReturnGap = selectedRow?.type === "row" && selectedGapText ? `${futuresBoardCode(selectedRow.contract)} ${selectedGapText}` : null;
|
|
272
295
|
const marketInView = paneInstance?.paneId === COMMODITIES_ENERGY_PANE_ID && (picked || searchQuery.trim()) && selectedRow?.type === "row"
|
|
273
296
|
? selectedRow.contract.code : null;
|
|
274
297
|
useEffect(() => {
|
|
@@ -333,6 +356,8 @@ export function FuturesPane({ focused, width, height }: PaneProps) {
|
|
|
333
356
|
const info: PaneFooterSegment[] = quoteBoardFooterInfo(status);
|
|
334
357
|
if (errorMessage) info.push({ id: "reason", parts: [{ text: errorMessage, tone: "warning" }] });
|
|
335
358
|
if (quoteDelay) info.push(quoteDelay);
|
|
359
|
+
if (priceBasisNote) info.push({ id: "price-basis", parts: [{ text: priceBasisNote, tone: "muted" }] });
|
|
360
|
+
if (selectedReturnGap) info.push({ id: "return-gap", parts: [{ text: selectedReturnGap, tone: "muted" }] });
|
|
336
361
|
return {
|
|
337
362
|
info,
|
|
338
363
|
hints: [{ id: "search", key: "/", label: "search", onPress: focusSearch }],
|
|
@@ -342,10 +367,13 @@ export function FuturesPane({ focused, width, height }: PaneProps) {
|
|
|
342
367
|
focusSearch,
|
|
343
368
|
noQuotes,
|
|
344
369
|
quoteDelay,
|
|
370
|
+
priceBasisNote,
|
|
371
|
+
selectedReturnGap,
|
|
345
372
|
status.latestTs,
|
|
346
373
|
status.loading,
|
|
347
374
|
status.savedAt,
|
|
348
375
|
status.stale,
|
|
376
|
+
status.staleSymbol,
|
|
349
377
|
status.unavailable,
|
|
350
378
|
]);
|
|
351
379
|
|
|
@@ -11,9 +11,10 @@ import { CONTRACT_MONTH_NAME, futuresPriceUnit } from "../../../market-data/futu
|
|
|
11
11
|
import { contractMonthLabel } from "../../../utils/contract-month";
|
|
12
12
|
import { quoteDotMarketState } from "../../../market-data/market/status";
|
|
13
13
|
import { futuresQuoteFromSettle } from "../../../market-data/market/change-basis";
|
|
14
|
+
import { futuresProductOpen } from "../../../market-data/market/futures-product-hours";
|
|
14
15
|
import { globexDayOpen } from "../../../market-data/market/globex-day";
|
|
15
16
|
import { periodBaseDay, periodBaseText, periodDayText } from "../../../market-data/market/period-return";
|
|
16
|
-
import type { FuturesReturnHorizon } from "./returns";
|
|
17
|
+
import type { FuturesReturnGap, FuturesReturnGaps, FuturesReturnHorizon } from "./returns";
|
|
17
18
|
import type { FuturesTermsMap } from "./use-board-terms";
|
|
18
19
|
import type { FrontReturnsMap } from "./use-front-returns";
|
|
19
20
|
|
|
@@ -231,19 +232,100 @@ export function futuresReturnBaseText(
|
|
|
231
232
|
return `${horizon} from each contract's close on or before ${periodDayText(asked, new Date(now).getUTCFullYear())}`;
|
|
232
233
|
}
|
|
233
234
|
|
|
234
|
-
/**
|
|
235
|
-
|
|
235
|
+
/** Why a row's return is empty, after the horizons it is empty for: "ZTZ26's daily history starts Tue 31 Mar". */
|
|
236
|
+
function futuresReturnGapText(gap: FuturesReturnGap, now = Date.now()): string {
|
|
237
|
+
const year = new Date(now).getUTCFullYear();
|
|
238
|
+
switch (gap.kind) {
|
|
239
|
+
case "generic": return "a VIX generic's listed contract has no daily history here (CTM VX has each contract's 1W and 1M)";
|
|
240
|
+
case "no-contract": return "the quote names no contract to measure";
|
|
241
|
+
case "failed": return "the contract's daily history did not load";
|
|
242
|
+
case "no-history": return `${gap.contract} has no daily history`;
|
|
243
|
+
case "starts-later": return `${gap.contract}'s daily history starts ${periodDayText(gap.firstDay, year)}`;
|
|
244
|
+
case "no-base": return `${gap.contract} has no close in the two weeks to ${periodDayText(gap.baseDay, year)}`;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/** "1W, 1M or YTD", after "no". */
|
|
249
|
+
function horizonList(horizons: readonly FuturesReturnHorizon[]): string {
|
|
250
|
+
return horizons.length <= 1 ? horizons.join("") : `${horizons.slice(0, -1).join(", ")} or ${horizons.at(-1)}`;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/** One row's empty returns among `horizons` and why: "no 1W, 1M or YTD: EMDZ26's daily history starts Fri 20 Nov". */
|
|
254
|
+
export function futuresRowReturnGapText(
|
|
255
|
+
gaps: FuturesReturnGaps | undefined,
|
|
256
|
+
horizons: readonly FuturesReturnHorizon[],
|
|
257
|
+
now = Date.now(),
|
|
258
|
+
): string | null {
|
|
259
|
+
const groups = new Map<string, FuturesReturnHorizon[]>();
|
|
260
|
+
for (const horizon of horizons) {
|
|
261
|
+
const gap = gaps?.[horizon];
|
|
262
|
+
if (!gap) continue;
|
|
263
|
+
const text = futuresReturnGapText(gap, now);
|
|
264
|
+
groups.set(text, [...groups.get(text) ?? [], horizon]);
|
|
265
|
+
}
|
|
266
|
+
return groups.size ? [...groups].map(([text, group]) => `no ${horizonList(group)}: ${text}`).join("; ") : null;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Every row's empty returns among the drawn `horizons`, rows that share a
|
|
271
|
+
* reason together: "No 1W, 1M or YTD for EMD, SXO: their contract's daily
|
|
272
|
+
* history starts Fri 20 Nov". A dash in a return column always has a line.
|
|
273
|
+
*/
|
|
274
|
+
export function futuresReturnGapNotes(
|
|
275
|
+
contracts: readonly FuturesContract[],
|
|
276
|
+
returns: FrontReturnsMap,
|
|
277
|
+
horizons: readonly FuturesReturnHorizon[],
|
|
278
|
+
now = Date.now(),
|
|
279
|
+
): string[] {
|
|
280
|
+
const year = new Date(now).getUTCFullYear();
|
|
281
|
+
const groups = new Map<string, string[]>();
|
|
282
|
+
for (const contract of contracts) {
|
|
283
|
+
const gaps = returns.get(contract.symbol)?.gaps;
|
|
284
|
+
const byReason = new Map<string, FuturesReturnHorizon[]>();
|
|
285
|
+
for (const horizon of horizons) {
|
|
286
|
+
const gap = gaps?.[horizon];
|
|
287
|
+
if (!gap) continue;
|
|
288
|
+
// Rows share a line by the reason, not the contract it names.
|
|
289
|
+
const reason = gap.kind === "starts-later" ? `their contract's daily history starts ${periodDayText(gap.firstDay, year)}`
|
|
290
|
+
: gap.kind === "no-history" ? "their contract has no daily history"
|
|
291
|
+
: gap.kind === "no-base" ? `their contract has no close in the two weeks to ${periodDayText(gap.baseDay, year)}`
|
|
292
|
+
: futuresReturnGapText(gap, now);
|
|
293
|
+
byReason.set(reason, [...byReason.get(reason) ?? [], horizon]);
|
|
294
|
+
}
|
|
295
|
+
for (const [reason, group] of byReason) {
|
|
296
|
+
const key = `${horizonList(group)}\u001f${reason}`;
|
|
297
|
+
groups.set(key, [...groups.get(key) ?? [], futuresBoardCode(contract)]);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
return [...groups].map(([key, codes]) => {
|
|
301
|
+
const [list, reason = ""] = key.split("\u001f");
|
|
302
|
+
return `No ${list} for ${codes.join(", ")}: ${codes.length === 1 ? reason.replace(/^their /, "its ") : reason}.`;
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Sectors whose contracts trade CME Globex's whole day, 17:00 to 16:00
|
|
308
|
+
* Central, and VIX futures, which keep the same day on Cboe Futures; grains,
|
|
309
|
+
* softs, lumber and livestock keep shorter hours (futuresProductOpen).
|
|
310
|
+
*/
|
|
311
|
+
const GLOBEX_DAY_SECTORS: ReadonlySet<FuturesSector> = new Set(["equity-index", "equity-sectors", "rates", "energy", "metals", "currencies", "volatility"]);
|
|
236
312
|
|
|
237
313
|
/**
|
|
238
|
-
* The row's quote in the session
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
*
|
|
314
|
+
* The row's quote in the session its product's clock gives it: CME Globex's
|
|
315
|
+
* whole day for a contract that trades it (globexDayOpen), a grain's,
|
|
316
|
+
* soft's, livestock's or lumber's own shorter hours for the rest
|
|
317
|
+
* (futuresProductOpen). Open from the reopen, before a delayed feed shows a
|
|
318
|
+
* trade, and closed in a break or outside the hours, whatever its last print
|
|
319
|
+
* or its venue's quote says: corn read OPEN from Globex's Sunday 17:00 reopen,
|
|
320
|
+
* two hours before its own. A day the calendar cannot vouch for, and a row
|
|
321
|
+
* whose hours are not known, keep the state the quote reports.
|
|
243
322
|
*/
|
|
244
323
|
export function futuresSessionQuote(contract: FuturesContract, quote: Quote | null | undefined, now = Date.now()): Quote | null | undefined {
|
|
245
|
-
|
|
246
|
-
|
|
324
|
+
// A generic quoted at the exchange's settlement (VX1) states no session: the clock gives it one.
|
|
325
|
+
if (!quote || (!quote.marketState && !contract.generic) || quote.delisting) return quote;
|
|
326
|
+
const open = GLOBEX_DAY_SECTORS.has(contract.sector)
|
|
327
|
+
? globexDayOpen(contract.venue, now)
|
|
328
|
+
: futuresProductOpen(contract.symbol, contract.venue, now);
|
|
247
329
|
if (open == null) return quote;
|
|
248
330
|
const state = open ? "REGULAR" : "CLOSED";
|
|
249
331
|
return quote.marketState === state ? quote : { ...quote, marketState: state };
|
|
@@ -259,6 +341,7 @@ export function futuresSessionQuote(contract: FuturesContract, quote: Quote | nu
|
|
|
259
341
|
export function futuresBoardQuotes(quotes: BoardQuoteMap, terms: FuturesTermsMap): BoardQuoteMap {
|
|
260
342
|
let next: BoardQuoteMap | null = null;
|
|
261
343
|
for (const [symbol, state] of quotes) {
|
|
344
|
+
if (state.quote?.futuresPriceKind) continue;
|
|
262
345
|
const quote = futuresQuoteFromSettle(state.quote, terms.get(symbol)?.terms);
|
|
263
346
|
if (quote === state.quote) continue;
|
|
264
347
|
next ??= new Map(quotes);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PricePoint, Quote } from "../../../types/financials";
|
|
2
|
-
import { periodReturn } from "../../../market-data/market/period-return";
|
|
2
|
+
import { periodBaseDay, periodReturn } from "../../../market-data/market/period-return";
|
|
3
3
|
import type { FuturesContract } from "../../../market-data/futures-board";
|
|
4
4
|
import { quotedContractMonth } from "./model";
|
|
5
5
|
|
|
@@ -48,6 +48,59 @@ export function frontContractCandidates(contract: FuturesContract, quote: Quote
|
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
/**
|
|
52
|
+
* Why a row's return is empty: a generic (VX1) that names no listed contract
|
|
53
|
+
* the history reads cover, a quote that names no contract to measure, a
|
|
54
|
+
* contract with no daily history, a read that failed, or a contract whose
|
|
55
|
+
* daily history starts after the close the return runs from (a contract
|
|
56
|
+
* listed since, or a source holding only its latest session).
|
|
57
|
+
*/
|
|
58
|
+
export type FuturesReturnGap =
|
|
59
|
+
| { kind: "generic" }
|
|
60
|
+
| { kind: "no-contract" }
|
|
61
|
+
| { kind: "failed" }
|
|
62
|
+
| { kind: "no-history"; contract: string }
|
|
63
|
+
| { kind: "starts-later"; contract: string; firstDay: string }
|
|
64
|
+
| { kind: "no-base"; contract: string; baseDay: string };
|
|
65
|
+
|
|
66
|
+
export type FuturesReturnGaps = Readonly<Partial<Record<FuturesReturnHorizon, FuturesReturnGap>>>;
|
|
67
|
+
|
|
68
|
+
/** The same gap for every horizon. */
|
|
69
|
+
export function allReturnGaps(gap: FuturesReturnGap): FuturesReturnGaps {
|
|
70
|
+
return Object.fromEntries(HORIZONS.map((horizon) => [horizon, gap]));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** ESZ26 for ESZ26.CME: the contract as its row's month names it. */
|
|
74
|
+
export const contractCode = (symbol: string) => symbol.replace(/\.[A-Z]+$/, "");
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Why each empty return of a contract with a history read is empty: its
|
|
78
|
+
* first close comes after the day the return runs from, or it has no close
|
|
79
|
+
* near that day.
|
|
80
|
+
*/
|
|
81
|
+
export function frontContractReturnGaps(
|
|
82
|
+
symbol: string,
|
|
83
|
+
history: readonly PricePoint[],
|
|
84
|
+
values: FuturesReturnValues,
|
|
85
|
+
price: number | null | undefined,
|
|
86
|
+
asOf: number | null | undefined,
|
|
87
|
+
): FuturesReturnGaps {
|
|
88
|
+
const contract = contractCode(symbol);
|
|
89
|
+
const closes = dailyCloses(history);
|
|
90
|
+
const first = closes[0]?.day;
|
|
91
|
+
const live = price != null && Number.isFinite(price) && asOf != null && Number.isFinite(asOf);
|
|
92
|
+
const end = (live ? utcDay(asOf) : null) ?? closes.at(-1)?.day;
|
|
93
|
+
const gaps: Partial<Record<FuturesReturnHorizon, FuturesReturnGap>> = {};
|
|
94
|
+
for (const horizon of HORIZONS) {
|
|
95
|
+
if (values[horizon] != null) continue;
|
|
96
|
+
const baseDay = end ? periodBaseDay(end, horizon) : null;
|
|
97
|
+
gaps[horizon] = !first ? { kind: "no-history", contract }
|
|
98
|
+
: baseDay && first > baseDay ? { kind: "starts-later", contract, firstDay: first }
|
|
99
|
+
: { kind: "no-base", contract, baseDay: baseDay ?? first };
|
|
100
|
+
}
|
|
101
|
+
return gaps;
|
|
102
|
+
}
|
|
103
|
+
|
|
51
104
|
interface DailyClose {
|
|
52
105
|
day: string;
|
|
53
106
|
close: number;
|
|
@@ -25,7 +25,7 @@ export const FUTURES_COLUMN_DEFS: readonly FuturesColumnDef[] = [
|
|
|
25
25
|
{ id: "status", label: "Session", description: "Live trading session indicator." },
|
|
26
26
|
{ id: "code", label: "Symbol", description: "Exchange contract code." },
|
|
27
27
|
{ id: "name", label: "Contract", description: "Contract name." },
|
|
28
|
-
{ id: "price", label: "
|
|
28
|
+
{ id: "price", label: "Price", description: "Last trade or official settlement." },
|
|
29
29
|
{ id: "unit", label: "Unit", description: "What a price counts, as the exchange quotes it (USD / barrel)." },
|
|
30
30
|
{ id: "change", label: "Change", description: "Change on the session." },
|
|
31
31
|
{ id: "changePercent", label: "Change %", description: "Percent change on the session." },
|
|
@@ -128,7 +128,7 @@ const FUTURES_HEADER_LABELS: Record<DrawnColumnId, string> = {
|
|
|
128
128
|
status: "",
|
|
129
129
|
code: "SYM",
|
|
130
130
|
name: "CONTRACT",
|
|
131
|
-
price: "
|
|
131
|
+
price: "PRICE",
|
|
132
132
|
unit: "UNIT",
|
|
133
133
|
change: "CHG",
|
|
134
134
|
changePercent: "CHG%",
|
|
@@ -237,6 +237,12 @@ function formatContractChange(quote: Quote, contract: FuturesContract): string {
|
|
|
237
237
|
return `${quote.change >= 0 ? "+" : "-"}${prefix}${text}${suffix}`;
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
+
export function futuresClosePriceKind(contract: FuturesContract, quote: Quote | null | undefined, now?: number): "S" | "T" | null {
|
|
241
|
+
if (quote?.futuresPriceKind === "settlement") return "S";
|
|
242
|
+
if (quote?.futuresPriceKind === "last-trade" || futuresSessionQuote(contract, quote, now)?.marketState === "CLOSED") return "T";
|
|
243
|
+
return null;
|
|
244
|
+
}
|
|
245
|
+
|
|
240
246
|
export function renderFuturesCell(
|
|
241
247
|
row: FuturesTableRow,
|
|
242
248
|
column: FuturesColumn,
|
|
@@ -256,6 +262,12 @@ export function renderFuturesCell(
|
|
|
256
262
|
color: colors.textBright,
|
|
257
263
|
attributes: TextAttributes.BOLD,
|
|
258
264
|
};
|
|
265
|
+
case "price": {
|
|
266
|
+
const cell = renderQuoteBoardCell("price", state, { formatPrice: (quoted) => formatContractPrice(quoted, contract),
|
|
267
|
+
formatChange: (quoted) => formatContractChange(quoted, contract) });
|
|
268
|
+
const kind = typeof cell.value === "number" ? futuresClosePriceKind(contract, quote, options?.now) : null;
|
|
269
|
+
return kind ? { ...cell, text: `${cell.text} ${kind}` } : cell;
|
|
270
|
+
}
|
|
259
271
|
case "name":
|
|
260
272
|
return futuresContractHeadline(contract, quote, options?.terms?.get(contract.symbol)?.terms, column.width);
|
|
261
273
|
case "unit": {
|
|
@@ -11,11 +11,16 @@ import { boardReadGate } from "./board-reads";
|
|
|
11
11
|
import type { BoardQuoteMap } from "../shared/use-quote-board";
|
|
12
12
|
import type { FuturesContract } from "../../../market-data/futures-board";
|
|
13
13
|
import {
|
|
14
|
+
allReturnGaps,
|
|
15
|
+
contractCode,
|
|
14
16
|
frontContractCandidates,
|
|
15
17
|
frontContractPeriodReturns,
|
|
18
|
+
frontContractReturnGaps,
|
|
16
19
|
NO_FUTURES_RETURNS,
|
|
17
20
|
pickFrontContract,
|
|
18
21
|
type FuturesReturnBases,
|
|
22
|
+
type FuturesReturnGap,
|
|
23
|
+
type FuturesReturnGaps,
|
|
19
24
|
type FuturesReturnValues,
|
|
20
25
|
} from "./returns";
|
|
21
26
|
|
|
@@ -25,6 +30,8 @@ interface FrontReturnsState {
|
|
|
25
30
|
values: FuturesReturnValues;
|
|
26
31
|
/** The day each return's base close is from, once the contract's history is read. */
|
|
27
32
|
bases?: FuturesReturnBases;
|
|
33
|
+
/** Why each empty return is empty, once the row has loaded. */
|
|
34
|
+
gaps?: FuturesReturnGaps;
|
|
28
35
|
}
|
|
29
36
|
|
|
30
37
|
export type FrontReturnsMap = ReadonlyMap<string, FrontReturnsState>;
|
|
@@ -154,9 +161,19 @@ export function useFrontContractReturns(
|
|
|
154
161
|
const available = loaded.flatMap((entry) => entry.history ? [{ symbol: entry.symbol, history: entry.history }] : []);
|
|
155
162
|
const front = pickFrontContract(available, quote?.price);
|
|
156
163
|
const history = available.find((entry) => entry.symbol === front)?.history;
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
164
|
+
if (history && front) {
|
|
165
|
+
const returns = frontContractPeriodReturns(history, quote?.price, quote?.lastUpdated);
|
|
166
|
+
result.set(contract.symbol, { loading: false, ...returns,
|
|
167
|
+
gaps: frontContractReturnGaps(front, history, returns.values, quote?.price, quote?.lastUpdated) });
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
// Each empty row says why: a generic names no contract read here, a quote may name none, and a contract
|
|
171
|
+
// may have no history or a read that failed.
|
|
172
|
+
const gap: FuturesReturnGap = contract.generic ? { kind: "generic" }
|
|
173
|
+
: loaded.some((entry) => entry.failed) ? { kind: "failed" }
|
|
174
|
+
: symbols.length === 1 ? { kind: "no-history", contract: contractCode(symbols[0]!) }
|
|
175
|
+
: { kind: "no-contract" };
|
|
176
|
+
result.set(contract.symbol, { loading: false, values: NO_FUTURES_RETURNS, ...(quote ? { gaps: allReturnGaps(gap) } : {}) });
|
|
160
177
|
}
|
|
161
178
|
return result;
|
|
162
179
|
// `version` re-reads the history cache as loads land.
|
|
@@ -46,7 +46,7 @@ export function validateFuturesCurve(data: FuturesCurvePayload, root: string): F
|
|
|
46
46
|
|| !rank(row.percentile) || !Number.isInteger(row.samples) || row.samples < 0
|
|
47
47
|
|| row.asOf !== null && !timestamp(row.asOf)
|
|
48
48
|
|| ![row.volume, row.openInterest, row.delayMinutes].every((value) => finiteOrNull(value) && (value === null || value >= 0))
|
|
49
|
-
|| row.settlement !== undefined && !finiteOrNull(row.settlement) || !optionalDate(row.lastTrade) || !optionalDate(row.firstNotice)
|
|
49
|
+
|| row.settlement !== undefined && !finiteOrNull(row.settlement) || !optionalDate(row.lastTrade) || !optionalDate(row.firstNotice) || !optionalDate(row.openInterestAsOf)
|
|
50
50
|
|| row.inDelivery !== undefined && typeof row.inDelivery !== "boolean" || !validContractSpot(row.spot)) {
|
|
51
51
|
throw new Error("The server returned an invalid futures contract");
|
|
52
52
|
}
|