@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
|
@@ -36,6 +36,7 @@ import { glossaryFunctionsNamed, glossaryNamesFunction, renderGlossaryEntries, t
|
|
|
36
36
|
import { renderSeriesMatches, type SeriesMatch } from "../series-search";
|
|
37
37
|
import { typoDistance } from "../../utils/typo-distance";
|
|
38
38
|
import { FUNCTION_HELP } from "./function-help";
|
|
39
|
+
import { functionQueryTerms as queryTerms, matchesFunctionPhrase as containsPhrase } from "../../utils/function-search";
|
|
39
40
|
import { ratesQuestionFunctions } from "./rates-question";
|
|
40
41
|
import { tickerQuestion, type TickerQuestion } from "./ticker-question";
|
|
41
42
|
import { quotedSearchCommand } from "../commands/news-search";
|
|
@@ -439,14 +440,6 @@ function namesShownTerm(entry: Pick<PaneCatalogEntry, "token" | "shortcut" | "al
|
|
|
439
440
|
return [entry.token, entry.shortcut, ...entry.aliases].some((code) => !!code && glossaryNamesFunction(code, query));
|
|
440
441
|
}
|
|
441
442
|
|
|
442
|
-
/** The phrase starting a word of the text, so "funding rate" finds "funding rates" but "rate" is not found in "separate". */
|
|
443
|
-
function containsPhrase(text: string, phrase: string): boolean {
|
|
444
|
-
for (let at = text.indexOf(phrase); at >= 0; at = text.indexOf(phrase, at + 1)) {
|
|
445
|
-
if (at === 0 || !/[a-z0-9]/.test(text[at - 1]!)) return true;
|
|
446
|
-
}
|
|
447
|
-
return false;
|
|
448
|
-
}
|
|
449
|
-
|
|
450
443
|
// A multi-word query ranks a function carrying the whole phrase in its name or keywords first, then in its
|
|
451
444
|
// description, then one carrying every word in its name or description, then every word counting its flags;
|
|
452
445
|
// the rest rank by how many words they match.
|
|
@@ -475,16 +468,6 @@ function phraseBand(entry: PaneCatalogEntry, phrase: string): number {
|
|
|
475
468
|
return descriptions.some((description) => containsPhrase(description, phrase)) ? PHRASE_IN_DESCRIPTION_BAND : 0;
|
|
476
469
|
}
|
|
477
470
|
|
|
478
|
-
/** Words that join a topic without naming it: "year to date" is year and date. */
|
|
479
|
-
const QUERY_STOP_WORDS = new Set(["a", "an", "and", "at", "by", "for", "from", "in", "is", "of", "on", "or", "the", "to", "with"]);
|
|
480
|
-
|
|
481
|
-
/** The words of a query that name something; a query of only joining words keeps them. */
|
|
482
|
-
function queryTerms(query: string): string[] {
|
|
483
|
-
const words = query.toLowerCase().split(/\s+/).map((term) => term.trim()).filter(Boolean);
|
|
484
|
-
const named = words.filter((word) => !QUERY_STOP_WORDS.has(word));
|
|
485
|
-
return named.length > 0 ? named : words;
|
|
486
|
-
}
|
|
487
|
-
|
|
488
471
|
/** The texts that say what a function is called and does, apart from its flags, each on its own. */
|
|
489
472
|
function nameAndDescriptionFields(entry: PaneCatalogEntry): string[] {
|
|
490
473
|
return [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { logFailure } from "../../utils/log-failure";
|
|
2
|
-
import type { TickerFinancials } from "../../types/financials";
|
|
2
|
+
import type { PricePoint, TickerFinancials } from "../../types/financials";
|
|
3
3
|
import type { TickerRecord } from "../../types/ticker";
|
|
4
4
|
export { clipPriceHistoryToRange } from "../../time-series/history-window";
|
|
5
5
|
import { CHART_COMPOSER_PANE_ID, LEGACY_TICKER_DETAIL_PANE_ID } from "../../types/config";
|
|
@@ -105,21 +105,25 @@ export async function withShotPriceHistory(
|
|
|
105
105
|
* SEAS reads monthly closes, and its Weekdays tab daily ones. Captured history
|
|
106
106
|
* answers every request, so the weekly seed would stand in for them and price
|
|
107
107
|
* each month at a week's close. The pane's own load fetches the shot tab's
|
|
108
|
-
* cadence, tagged so no other cadence is answered.
|
|
108
|
+
* cadence, tagged so no other cadence is answered. Beside monthly closes it
|
|
109
|
+
* also reads a month of daily ones, which name the close the running month
|
|
110
|
+
* runs to: those are returned as `daily`, for the capture to answer that
|
|
111
|
+
* request with.
|
|
109
112
|
*/
|
|
110
113
|
export async function withShotSeasonalityHistory(
|
|
111
114
|
context: MarketContext,
|
|
112
115
|
instrument: InstrumentRef,
|
|
113
116
|
resolved: ResolvedPaneFunction,
|
|
114
117
|
financials: TickerFinancials,
|
|
115
|
-
): Promise<TickerFinancials> {
|
|
118
|
+
): Promise<{ financials: TickerFinancials; daily: PricePoint[] }> {
|
|
116
119
|
const cadence = resolved.options.tab === "weekdays" ? "daily" : "monthly";
|
|
117
120
|
const history = await loadSeasonalityHistory({ instrument, cadence, forceRefresh: context.refresh }, context.dataProvider);
|
|
118
121
|
if (history.error || history.stale) {
|
|
119
122
|
throw new Error(`${instrument.symbol}: ${history.error ?? `${cadence} price history is stale`}`);
|
|
120
123
|
}
|
|
121
124
|
// The bars as served: the pane closes a continuous future's rolls itself, from its daily bars.
|
|
122
|
-
return { ...financials, priceHistory: history.served.points, priceHistoryResolution: history.served.resolution }
|
|
125
|
+
return { financials: { ...financials, priceHistory: history.served.points, priceHistoryResolution: history.served.resolution },
|
|
126
|
+
daily: history.served.daily ?? [] };
|
|
123
127
|
}
|
|
124
128
|
|
|
125
129
|
/**
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { TickerFinancials } from "../../types/financials";
|
|
2
|
+
import { apiClient } from "../../api-client";
|
|
2
3
|
import type { DesktopPaneShotPayload, DesktopPaneShotRenderResult } from "../desktop-pane-shot";
|
|
3
4
|
import type { ResolvedPaneFunction } from "./resolver";
|
|
4
|
-
import { createValuationCurrencyContext } from "../../time-series/valuation-currency";
|
|
5
|
+
import { createValuationCurrencyContext, loadValuationFx } from "../../time-series/valuation-currency";
|
|
5
6
|
import {
|
|
6
7
|
resolveFinancialPeriod,
|
|
7
8
|
resolveFinancialPeriodOption,
|
|
@@ -12,7 +13,9 @@ import {
|
|
|
12
13
|
findRatioTab,
|
|
13
14
|
formatRatioInput,
|
|
14
15
|
formatRatioValue,
|
|
16
|
+
oldestRatioPeriodEnd,
|
|
15
17
|
ratioPeriodEnd,
|
|
18
|
+
ratioStatements,
|
|
16
19
|
ratioTableForFinancials,
|
|
17
20
|
resolveFinancialSectionKey,
|
|
18
21
|
type RatioTabDef,
|
|
@@ -49,10 +52,21 @@ export function shotFinancialPeriod(resolved: ResolvedPaneFunction, financials:
|
|
|
49
52
|
|
|
50
53
|
interface RatioShot {
|
|
51
54
|
symbol: string;
|
|
52
|
-
financials: TickerFinancials;
|
|
53
55
|
tab: RatioTabDef;
|
|
54
56
|
period: FinancialPeriod;
|
|
55
57
|
model: RatioTableModel;
|
|
58
|
+
currencies: ReturnType<typeof createValuationCurrencyContext>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export async function loadShotValuationFx(resolved: ResolvedPaneFunction, financials?: TickerFinancials): Promise<DesktopPaneShotPayload["valuationFx"]> {
|
|
62
|
+
if (!financials || shotRatioTab(resolved)?.key !== "valuation") return;
|
|
63
|
+
const statements = ratioStatements(financials, shotFinancialPeriod(resolved, financials));
|
|
64
|
+
const since = oldestRatioPeriodEnd(statements);
|
|
65
|
+
if (!since) return;
|
|
66
|
+
const codes = createValuationCurrencyContext(financials).fxCurrencies(statements);
|
|
67
|
+
if (!codes.length) return;
|
|
68
|
+
const fx = await loadValuationFx(codes, since, apiClient);
|
|
69
|
+
return [...fx.values()].map((series) => ({ ...series, closes: [...series.closes] }));
|
|
56
70
|
}
|
|
57
71
|
|
|
58
72
|
/** The table the page computes from the captured data, with every ratio expanded. */
|
|
@@ -64,7 +78,9 @@ function ratioShot(resolved: ResolvedPaneFunction, payload: DesktopPaneShotPaylo
|
|
|
64
78
|
// The page answers Valuation's daily request only from a daily capture.
|
|
65
79
|
const history = tab.key === "valuation" && financials.priceHistoryResolution === PERIOD_END_HISTORY_RESOLUTION
|
|
66
80
|
? financials.priceHistory : null;
|
|
67
|
-
|
|
81
|
+
const fx = new Map(payload.valuationFx?.map((series) => [series.currency, { ...series, closes: new Map(series.closes) }]));
|
|
82
|
+
const currencies = createValuationCurrencyContext(financials, fx);
|
|
83
|
+
return { symbol, tab, period, currencies, model: ratioTableForFinancials(financials, tab, period, history, undefined, currencies) };
|
|
68
84
|
}
|
|
69
85
|
|
|
70
86
|
const hasRatio = ({ model }: RatioShot, index: number) => model.ratios.some((def) => (
|
|
@@ -77,9 +93,8 @@ export function financialRatioShotGap(resolved: ResolvedPaneFunction, payload: D
|
|
|
77
93
|
if (!shot) return null;
|
|
78
94
|
if (shot.tab.key === "valuation") {
|
|
79
95
|
const unpriced = shot.model.periods.flatMap(({ statement, price }) => typeof price === "number" ? [] : [statement]);
|
|
80
|
-
// A close in another currency than the statements prices nothing; the pane's footer says so.
|
|
81
96
|
if (unpriced.length) {
|
|
82
|
-
return
|
|
97
|
+
return shot.currencies.warning(unpriced, ratioPeriodEnd)
|
|
83
98
|
?? `Valuation has no period-end close for ${unpriced.map(ratioPeriodEnd).join(", ")}, so those columns read "no price".`;
|
|
84
99
|
}
|
|
85
100
|
}
|
|
@@ -14,6 +14,7 @@ import { isRecord } from "../../utils/guards";
|
|
|
14
14
|
import { latestRegularSessionClose, readIndexSession, regularSessionCloseOn, sessionCalendarTimeZone } from "../../market-data/market/freshness";
|
|
15
15
|
import {
|
|
16
16
|
reportMarketSession,
|
|
17
|
+
shownSessionList,
|
|
17
18
|
reportVenueMarkets,
|
|
18
19
|
reportVenueSessionDates,
|
|
19
20
|
type ReportMarket,
|
|
@@ -21,7 +22,7 @@ import {
|
|
|
21
22
|
type VenueMarket,
|
|
22
23
|
type VenueSessionDate,
|
|
23
24
|
} from "./market-session";
|
|
24
|
-
import { savedCopyShownAt } from "../../data/saved-copies";
|
|
25
|
+
import { savedCopyShownAt, servedCopiesAt } from "../../data/saved-copies";
|
|
25
26
|
import { releasedText } from "../../utils/release-date";
|
|
26
27
|
|
|
27
28
|
/**
|
|
@@ -66,6 +67,7 @@ export interface ReportFreshness {
|
|
|
66
67
|
ageMinutes?: number;
|
|
67
68
|
/** When only some rows are stale: how many, of the rows that say whether they are... */
|
|
68
69
|
staleCount?: number;
|
|
70
|
+
staleSymbol?: string;
|
|
69
71
|
observationCount?: number;
|
|
70
72
|
/**
|
|
71
73
|
* How many of those rows are at a nominal price, nothing having traded
|
|
@@ -87,6 +89,8 @@ export interface ReportFreshness {
|
|
|
87
89
|
periodToDate?: { period: "week" | "month"; through?: string };
|
|
88
90
|
/** The local date of the session close `asOf` is, when the newest observation is its venue's latest close. */
|
|
89
91
|
asOfClose?: string;
|
|
92
|
+
/** A session list of a part of `asOfClose`'s session (declared `sessionList.part`), named in its place: `pre-market`. */
|
|
93
|
+
asOfSessionPart?: "pre-market" | "after-hours";
|
|
90
94
|
/**
|
|
91
95
|
* `asOf` is the last print of a session that has closed since, taken
|
|
92
96
|
* before its close (a feed that stopped early): `last print 12:14 UTC`,
|
|
@@ -156,7 +160,8 @@ export interface ReportFreshness {
|
|
|
156
160
|
/** Who published the figures, when the data names them. */
|
|
157
161
|
publisher?: string;
|
|
158
162
|
/** When the publisher released the data, an ISO instant in UTC or an ISO date, when the data states it. */
|
|
159
|
-
publishedAt?: string;
|
|
163
|
+
publishedAt?: string | null;
|
|
164
|
+
fredUpdatedAt?: string;
|
|
160
165
|
/** When this report was built. */
|
|
161
166
|
retrievedAt: string;
|
|
162
167
|
/**
|
|
@@ -179,9 +184,28 @@ export interface ReportFreshness {
|
|
|
179
184
|
* reads `couldn't refresh; saved copy from 21:49 UTC` instead of live or delayed.
|
|
180
185
|
*/
|
|
181
186
|
export function withSavedCopy<F extends ReportFreshness | undefined>(freshness: F, shown: unknown): F {
|
|
182
|
-
if (!freshness || freshness.savedAt) return freshness;
|
|
187
|
+
if (!freshness || freshness.savedAt) return withServedCopies(freshness);
|
|
183
188
|
const savedAt = savedCopyShownAt(shown);
|
|
184
|
-
return savedAt == null ? freshness : { ...freshness, savedAt: new Date(savedAt).toISOString() };
|
|
189
|
+
return withServedCopies(savedAt == null ? freshness : { ...freshness, savedAt: new Date(savedAt).toISOString() });
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* The freshness of a report built while the command was served copies of
|
|
194
|
+
* datasets read earlier (`servedCopiesAt`): retrieved when the oldest of them
|
|
195
|
+
* was read, not when the report was built, and a saved copy when a failed
|
|
196
|
+
* refresh fell back to one. A report whose rows were rebuilt from such a read
|
|
197
|
+
* (INS's trades from a filing list) carries no mark of it, so it is dated so.
|
|
198
|
+
*/
|
|
199
|
+
function withServedCopies<F extends ReportFreshness | undefined>(freshness: F): F {
|
|
200
|
+
if (!freshness || freshness.unreached) return freshness;
|
|
201
|
+
const { retrievedAt, savedAt } = servedCopiesAt();
|
|
202
|
+
if (retrievedAt == null) return freshness;
|
|
203
|
+
const built = Date.parse(freshness.retrievedAt);
|
|
204
|
+
return {
|
|
205
|
+
...freshness,
|
|
206
|
+
...(Number.isFinite(built) && retrievedAt < built ? { retrievedAt: new Date(retrievedAt).toISOString() } : {}),
|
|
207
|
+
...(savedAt != null && !freshness.savedAt ? { savedAt: new Date(savedAt).toISOString() } : {}),
|
|
208
|
+
};
|
|
185
209
|
}
|
|
186
210
|
|
|
187
211
|
/** One source's newest observation: an ISO instant in UTC. */
|
|
@@ -215,6 +239,7 @@ interface FeedSignals {
|
|
|
215
239
|
/** Rows and series that carry a `stale` flag, and the times of those that are stale... */
|
|
216
240
|
flagged: number;
|
|
217
241
|
staleTimes: Array<ReportTime | null>;
|
|
242
|
+
staleSymbol?: string;
|
|
218
243
|
/** ...and how many of them are at a nominal price instead (`nominal`). */
|
|
219
244
|
nominal: number;
|
|
220
245
|
/** Rows that name the venue whose sessions they follow (`sessionExchange`), with their time. */
|
|
@@ -302,7 +327,10 @@ function readUnitStale(record: Record<string, unknown>, time: ReportTime | null,
|
|
|
302
327
|
if (typeof record.stale !== "boolean") return;
|
|
303
328
|
signals.flagged += 1;
|
|
304
329
|
if (record.nominal === true) signals.nominal += 1;
|
|
305
|
-
else if (record.stale)
|
|
330
|
+
else if (record.stale) {
|
|
331
|
+
signals.staleTimes.push(time);
|
|
332
|
+
signals.staleSymbol = signals.staleTimes.length === 1 && typeof record.quoteSymbol === "string" ? record.quoteSymbol : undefined;
|
|
333
|
+
}
|
|
306
334
|
}
|
|
307
335
|
|
|
308
336
|
function observedTime(record: Record<string, unknown>, now: number, keys: readonly string[] = OBSERVATION_KEYS): ReportTime | null {
|
|
@@ -508,7 +536,12 @@ function readPeriodToDate(declared: HeadlessPaneFreshness["periodToDate"], now:
|
|
|
508
536
|
return { period: declared.period, through: through?.dateOnly && through.time <= now + FUTURE_TOLERANCE_MS ? through : null };
|
|
509
537
|
}
|
|
510
538
|
|
|
511
|
-
|
|
539
|
+
/** A report's freshness, dated by the dataset copies the command was served where it read them (`withServedCopies`). */
|
|
540
|
+
function resolveFreshness(inputs: FreshnessInputs): ReportFreshness {
|
|
541
|
+
return withServedCopies(resolveReadFreshness(inputs));
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
function resolveReadFreshness({ declared, signals, observations, now }: FreshnessInputs): ReportFreshness {
|
|
512
545
|
const sources = declaredSources(declared, now);
|
|
513
546
|
// Sources date the data by their own observations, as a declared as-of does.
|
|
514
547
|
const declaredAsOf = observedTime({ asOf: declared.asOf }, now, ["asOf"]) ?? newest(sources.map(({ time }) => time));
|
|
@@ -579,13 +612,18 @@ function resolveFreshness({ declared, signals, observations, now }: FreshnessInp
|
|
|
579
612
|
}
|
|
580
613
|
}
|
|
581
614
|
}
|
|
582
|
-
const
|
|
615
|
+
const rowsSession = reportMarketSession(signals.sessions, now);
|
|
616
|
+
// A list of one market taken once its session closed names that session, and where the market stands now.
|
|
617
|
+
const listed = declared.sessionList && asOf && !asOf.dateOnly ? shownSessionList(declared.sessionList, asOf.time, now) : null;
|
|
618
|
+
const { closeDate, closeMarket } = listed ?? rowsSession;
|
|
619
|
+
const market = listed?.market ?? rowsSession.market;
|
|
620
|
+
const lastPrint = !listed && rowsSession.lastPrint;
|
|
583
621
|
const venueSessions = declared.datesEachVenue && !declaredAsOf ? reportVenueSessionDates(signals.sessions, now) : [];
|
|
584
622
|
// Each market's own state and open, when they are not all one: `LSE opens 08:00 UTC · US 13:30 UTC`.
|
|
585
623
|
const venueMarkets = declared.datesEachVenue ? reportVenueMarkets(signals.sessions, now) : [];
|
|
586
624
|
const markets = venueMarkets.length > 0 && !sameMarketText(venueMarkets, now) ? venueMarkets : [];
|
|
587
625
|
// The close wording dates the newest observation, so only when that is what `asOf` is.
|
|
588
|
-
const asOfClose = closeDate && asOf && !declaredAsOf ? closeDate : null;
|
|
626
|
+
const asOfClose = closeDate && asOf && (!declaredAsOf || listed) ? closeDate : null;
|
|
589
627
|
const asOfLastPrint = lastPrint && asOf && !asOf.dateOnly && !declaredAsOf;
|
|
590
628
|
const tradingDayMarket = asOfClose ? closeMarket
|
|
591
629
|
: asOf?.dateOnly ? declared.tradingDayMarket?.trim() || null : null;
|
|
@@ -611,6 +649,7 @@ function resolveFreshness({ declared, signals, observations, now }: FreshnessInp
|
|
|
611
649
|
const scheduleVariants = schedule ? (declared.scheduleVariants ?? []).map((variant) => variant.trim()).filter((variant) => variant && variant !== schedule) : [];
|
|
612
650
|
const publisher = declared.publisher?.trim();
|
|
613
651
|
const publishedAt = parseReportTime(declared.publishedAt);
|
|
652
|
+
const fredUpdatedAt = parseReportTime(declared.fredUpdatedAt);
|
|
614
653
|
// A figure dated by the period it covers is as of its release: September's permits
|
|
615
654
|
// are dated 1 Sep and were released 20 Oct. Age, staleness and the oldest stay the observation's.
|
|
616
655
|
const released = asOf?.dateOnly && !declared.dataset && !periodToDate
|
|
@@ -620,7 +659,7 @@ function resolveFreshness({ declared, signals, observations, now }: FreshnessInp
|
|
|
620
659
|
const oldestPeriodicity = declared.oldestPeriodicity !== undefined ? declared.oldestPeriodicity
|
|
621
660
|
: oldestRelease ? oldestRelease.periodicity ?? null : unitRelease?.periodicity ? null : undefined;
|
|
622
661
|
// Series that each end on their own day name the oldest one's day even a day apart (`oldestAnyDay`).
|
|
623
|
-
const namesOldest = !!asOf && !!oldestTime && (asOf.time - oldestTime.time > OLDEST_GAP_MS
|
|
662
|
+
const namesOldest = !listed && !!asOf && !!oldestTime && (asOf.time - oldestTime.time > OLDEST_GAP_MS
|
|
624
663
|
|| (declared.oldestAnyDay === true && declared.oldest != null && isoTime(oldestTime).slice(0, 10) < isoTime(asOf).slice(0, 10)));
|
|
625
664
|
return {
|
|
626
665
|
// A declared null source says the data has no name to give, which is left out rather than called Gloom Cloud.
|
|
@@ -638,11 +677,13 @@ function resolveFreshness({ declared, signals, observations, now }: FreshnessInp
|
|
|
638
677
|
...(minDelayMinutes != null && minDelayMinutes > 0 ? { minDelayMinutes } : {}),
|
|
639
678
|
...(status === "stale" && staleAt ? { ageMinutes: Math.max(0, Math.floor((now - staleAt.time) / 60_000)) } : {}),
|
|
640
679
|
...(partial ?? {}),
|
|
680
|
+
...(partial && signals.staleSymbol ? { staleSymbol: signals.staleSymbol } : {}),
|
|
641
681
|
...(signals.nominal > 0 ? { nominalCount: signals.nominal, observationCount: signals.flagged } : {}),
|
|
642
682
|
...(status === "not-a-feed" && declared.basis ? { basis: declared.basis } : {}),
|
|
643
683
|
...(periodicity ? { periodicity } : {}),
|
|
644
684
|
...(periodToDate && !declaredAsOf ? { periodToDate: { period: periodToDate.period, ...(periodToDate.through ? { through: isoTime(periodToDate.through) } : {}) } } : {}),
|
|
645
685
|
...(asOfClose ? { asOfClose } : {}),
|
|
686
|
+
...(asOfClose && listed?.part ? { asOfSessionPart: listed.part } : {}),
|
|
646
687
|
...(asOfLastPrint ? { asOfLastPrint: true as const } : {}),
|
|
647
688
|
...(tradingDayMarket ? { tradingDayMarket } : {}),
|
|
648
689
|
...(market ? { market } : {}),
|
|
@@ -663,7 +704,8 @@ function resolveFreshness({ declared, signals, observations, now }: FreshnessInp
|
|
|
663
704
|
...(schedule ? { schedule } : {}),
|
|
664
705
|
...(scheduleVariants.length > 0 ? { scheduleVariants } : {}),
|
|
665
706
|
...(publisher ? { publisher } : {}),
|
|
666
|
-
...(publishedAt ? { publishedAt: isoTime(publishedAt) } : {}),
|
|
707
|
+
...(publishedAt ? { publishedAt: isoTime(publishedAt) } : declared.publishedAt === null ? { publishedAt: null } : {}),
|
|
708
|
+
...(fredUpdatedAt ? { fredUpdatedAt: isoTime(fredUpdatedAt) } : {}),
|
|
667
709
|
retrievedAt: declaredRetrieval(declared.retrievedAt, now) ?? new Date(now).toISOString(),
|
|
668
710
|
};
|
|
669
711
|
}
|
|
@@ -859,8 +901,9 @@ function ageText(minutes: number): string {
|
|
|
859
901
|
* when `short`. Null when the report does not count them. One wording for a
|
|
860
902
|
* report's status line, a capture's and the status a capture prints.
|
|
861
903
|
*/
|
|
862
|
-
export function staleRowsText(freshness: Pick<ReportFreshness, "staleCount" | "observationCount">, short = false): string | null {
|
|
904
|
+
export function staleRowsText(freshness: Pick<ReportFreshness, "staleCount" | "staleSymbol" | "observationCount">, short = false): string | null {
|
|
863
905
|
if (freshness.staleCount == null || freshness.observationCount == null) return null;
|
|
906
|
+
if (freshness.staleCount === 1 && freshness.staleSymbol) return `${freshness.staleSymbol} stale`;
|
|
864
907
|
return `${short ? freshness.staleCount : `${freshness.staleCount} of ${freshness.observationCount}`} stale`;
|
|
865
908
|
}
|
|
866
909
|
|
|
@@ -981,7 +1024,7 @@ function asOfText(freshness: ReportFreshness, short: boolean, local: boolean, un
|
|
|
981
1024
|
: freshness.periodToDate ? periodToDateText(freshness.periodToDate, freshness.asOf)
|
|
982
1025
|
: period ? `${periodText(freshness.asOf, period)} (${period})`
|
|
983
1026
|
: freshness.asOfClose
|
|
984
|
-
? `${tradingDayText(freshness.asOfClose, market)} close`
|
|
1027
|
+
? `${tradingDayText(freshness.asOfClose, market)} ${freshness.asOfSessionPart ?? "close"}`
|
|
985
1028
|
: freshness.asOfLastPrint && time && !time.dateOnly
|
|
986
1029
|
? `last print ${undated && onRetrievalDay(new Date(time.time).toISOString(), freshness.retrievedAt)
|
|
987
1030
|
? `${new Date(time.time).toISOString().slice(11, 16)} UTC` : timeText(freshness.asOf, local)}`
|
|
@@ -1441,6 +1484,8 @@ export interface CaptureStatusLine {
|
|
|
1441
1484
|
* `as of` dates; null when it dates nothing it can name.
|
|
1442
1485
|
*/
|
|
1443
1486
|
dates: "data" | "quotes" | null;
|
|
1487
|
+
/** The view dates its data in its own footer (`rendersOwnStatus`), which the capture keeps beside the line. */
|
|
1488
|
+
ownStatus?: true;
|
|
1444
1489
|
}
|
|
1445
1490
|
|
|
1446
1491
|
/**
|
|
@@ -362,8 +362,8 @@ export const FUNCTION_HELP: Readonly<Record<string, FunctionHelp>> = {
|
|
|
362
362
|
bloomberg: [],
|
|
363
363
|
},
|
|
364
364
|
MDAY: {
|
|
365
|
-
summary: "
|
|
366
|
-
usage: ["MDAY SPY", "MDAY FRED:T10Y2Y"],
|
|
365
|
+
summary: "Compare up to four tickers or FRED series side by side on CPI, jobs report and central-bank release days. Daily close-to-close moves are in bp for yields or rates and % otherwise. With one ticker, compare its release-day moves to a normal day.",
|
|
366
|
+
usage: ["MDAY SPY", "MDAY SPY,UUP,^TNX,GLD", "MDAY FRED:T10Y2Y"],
|
|
367
367
|
keys: [],
|
|
368
368
|
data: DAILY_CLOSES,
|
|
369
369
|
bloomberg: [],
|
|
@@ -633,9 +633,12 @@ function observationCount(series: HeadlessSeries): number {
|
|
|
633
633
|
return series.points.filter((point) => point.value != null || point.close != null).length;
|
|
634
634
|
}
|
|
635
635
|
|
|
636
|
+
/** The averages, and the change with what it is against: the year-ago mean and the days it is of. */
|
|
636
637
|
const TRAILING_COLUMNS: HeadlessPaneColumn[] = [
|
|
637
638
|
{ key: "avg7", header: "7D avg", literalHeader: true, align: "right" },
|
|
638
639
|
{ key: "avg28", header: "28D avg", literalHeader: true, align: "right" },
|
|
640
|
+
{ key: "yearAgoAvg28", header: "Yr-ago 28D avg", literalHeader: true, align: "right" },
|
|
641
|
+
{ key: "yearAgoWindow", header: "Yr-ago days", literalHeader: true, shrink: false },
|
|
639
642
|
{ key: "vsYearAgo", header: "28D vs yr ago", literalHeader: true, align: "right" },
|
|
640
643
|
];
|
|
641
644
|
|
|
@@ -643,9 +646,12 @@ function trailingCells(trailing: HeadlessSeries["trailing"]): Record<string, str
|
|
|
643
646
|
if (!trailing) return {};
|
|
644
647
|
const mean = (value: number | null) => (value == null ? MISSING_VALUE : value.toFixed(1));
|
|
645
648
|
const change = trailing.changeVsYearAgoPct;
|
|
649
|
+
const days = trailing.yearAgoWindow;
|
|
646
650
|
return {
|
|
647
651
|
avg7: mean(trailing.avg7),
|
|
648
652
|
avg28: mean(trailing.avg28),
|
|
653
|
+
yearAgoAvg28: mean(trailing.yearAgoAvg28),
|
|
654
|
+
yearAgoWindow: days ? `${days.start} to ${days.end}` : MISSING_VALUE,
|
|
649
655
|
vsYearAgo: change == null || !Number.isFinite(change) ? MISSING_VALUE : `${change > 0 ? "+" : ""}${change.toFixed(1)}%`,
|
|
650
656
|
};
|
|
651
657
|
}
|
|
@@ -25,8 +25,8 @@ import {
|
|
|
25
25
|
type ParsedPaneFunctionArgs,
|
|
26
26
|
} from "./options";
|
|
27
27
|
import {
|
|
28
|
-
applyListingArgument, findPaneFunction, parsePaneFunctionArgsFor, resolvePaneFunction, UnknownPaneFunctionError,
|
|
29
|
-
type PluginCodeStopFinder, type ResolvedPaneFunction,
|
|
28
|
+
applyListingArgument, findPaneFunction, parsePaneFunctionArgsFor, resolvePaneFunction, typedFunctionCode, UnknownPaneFunctionError,
|
|
29
|
+
withRenamedTickers, type PluginCodeStopFinder, type ResolvedPaneFunction,
|
|
30
30
|
} from "./resolver";
|
|
31
31
|
import { idleCliPlugins, installedPluginCount } from "../registry";
|
|
32
32
|
import { pluginSupportsTarget } from "../../plugins/plugin-export";
|
|
@@ -95,6 +95,12 @@ async function withPaneRuntime<T>(
|
|
|
95
95
|
let parsed = await applyListingArgument(registry, context, parsePaneFunctionArgsFor(registry, args, ctx.cliOptions), settings.command);
|
|
96
96
|
const resolution = { ...settings, seriesSources: () => ctx.plugins, pluginStop: pluginStopFor(ctx, context) };
|
|
97
97
|
let resolved = await resolvePaneFunction(registry, context, parsed, resolution);
|
|
98
|
+
// A ticker whose company moved (SQ) is read as its new symbol (XYZ) before the function asks for anything.
|
|
99
|
+
const renamed = await withRenamedTickers(context, parsed, resolved, isTickerLinkPeer(resolved.instance, registry.panes));
|
|
100
|
+
if (renamed) {
|
|
101
|
+
parsed = renamed;
|
|
102
|
+
resolved = await resolvePaneFunction(registry, context, parsed, resolution);
|
|
103
|
+
}
|
|
98
104
|
// A function that widens its argument (RV's --peers) runs, reports and captures the widened one.
|
|
99
105
|
const expansion = await expandResolvedArgument(resolved, context, parsed.arg);
|
|
100
106
|
if (expansion) {
|
|
@@ -468,7 +474,8 @@ export async function runPaneFunction(args: string[], ctx: CliCommandContext) {
|
|
|
468
474
|
const fate = listing && quoteAnswer && isTickerLinkPeer(resolved.instance, registry.panes)
|
|
469
475
|
? listingFateLoader(listing, context, quoteAnswer().then((answer) => answer.quote), { successor: true })
|
|
470
476
|
: null;
|
|
471
|
-
|
|
477
|
+
// The retry starts with the code typed (`fn DES SQ` suggests `gloom fn DES XYZ`, not T).
|
|
478
|
+
const moved = { command: "fn", retry: (key: string) => `gloom fn ${typedFunctionCode(parsed.target, resolved)} ${key}` };
|
|
472
479
|
// A report that fails or comes back empty for an exchange the symbol is not listed on says so.
|
|
473
480
|
// A report written to a file is drawn for it as it is built: no colour and no terminal width, as a redirect gets it.
|
|
474
481
|
const buildReport = () => buildFunctionReport(resolved, context, parsed.arg, registry);
|
|
@@ -691,7 +698,7 @@ async function capturePaneScreenshot(args: string[], ctx: CliCommandContext, onS
|
|
|
691
698
|
// A bare code several companies list asks which, as `fn` does.
|
|
692
699
|
if (parsed.listing && !quote) {
|
|
693
700
|
await failUnchosenListing(parsed.listing, context, ctx,
|
|
694
|
-
{ command: "shot", noun: "data", retry: (key) => `gloom shot ${resolved
|
|
701
|
+
{ command: "shot", noun: "data", retry: (key) => `gloom shot ${typedFunctionCode(parsed.target, resolved)} ${key}` }, quoteError);
|
|
695
702
|
}
|
|
696
703
|
const stop = parsed.listing && !quote ? await notATickerStop(quoteError, parsed.listing, context) : null;
|
|
697
704
|
throw stop ? new Error(stop) : error;
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
nextRegularSessionOpen,
|
|
11
11
|
} from "../../market-data/market/freshness";
|
|
12
12
|
import { futuresWeekendClosure } from "../../market-data/market/futures-week";
|
|
13
|
+
import { shownSessionDay } from "../../market-data/market/venue-session";
|
|
13
14
|
import { currentFxClosureStart, isFxWeekClosePrint, nextFxWeekOpen } from "../../utils/fx-market-hours";
|
|
14
15
|
import { zonedDateKey } from "../../utils/zoned-date-time";
|
|
15
16
|
import type { ReportTime } from "../../utils/utc-time";
|
|
@@ -360,3 +361,27 @@ export function reportMarketSession(
|
|
|
360
361
|
closeMarket: closeDate && newest ? closeMarketOf(newest.exchange, newest.session) : null,
|
|
361
362
|
};
|
|
362
363
|
}
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* A declared session list's session (`sessionList`), once its market is
|
|
367
|
+
* shut: the trading day the list taken at `at` shows (`shownSessionDay`, or
|
|
368
|
+
* the day the list states), whose trading day that is, and where the market
|
|
369
|
+
* stands now. Null while the market trades, or for a list taken during a
|
|
370
|
+
* regular session.
|
|
371
|
+
*/
|
|
372
|
+
export function shownSessionList(
|
|
373
|
+
list: { exchange: string; session?: string; part?: "pre-market" | "after-hours" },
|
|
374
|
+
at: number,
|
|
375
|
+
now: number,
|
|
376
|
+
): { closeDate: string; closeMarket: string; market: ReportMarket | null; part?: "pre-market" | "after-hours" } | null {
|
|
377
|
+
const exchange = canonicalExchange(list.exchange);
|
|
378
|
+
const shown = exchange ? shownSessionDay(exchange, at, now) : null;
|
|
379
|
+
if (!shown) return null;
|
|
380
|
+
const stated = list.session && /^\d{4}-\d{2}-\d{2}$/.test(list.session) && list.session <= shown ? list.session : null;
|
|
381
|
+
return {
|
|
382
|
+
closeDate: stated ?? shown,
|
|
383
|
+
closeMarket: isUsListingExchange(exchange) ? "US" : exchange,
|
|
384
|
+
market: reportMarketSession([{ exchange, time: null }], now).market,
|
|
385
|
+
...(list.part ? { part: list.part } : {}),
|
|
386
|
+
};
|
|
387
|
+
}
|
|
@@ -54,6 +54,16 @@ export function renderedReportFailure(semanticUi: readonly RemoteUiNodeSnapshot[
|
|
|
54
54
|
return details ? { message, details } : { message };
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
/**
|
|
58
|
+
* Whether the rendered view dates its data in its own footer, which the
|
|
59
|
+
* quotes the page loaded do not date (`own-status`): a DES research tab such
|
|
60
|
+
* as Ownership, whose holdings the listing's quote says nothing of. A capture
|
|
61
|
+
* of it keeps that footer, and its status line is never the quotes'.
|
|
62
|
+
*/
|
|
63
|
+
export function rendersOwnStatus(semanticUi: readonly RemoteUiNodeSnapshot[]): boolean {
|
|
64
|
+
return semanticUi.some((node) => node.role === "own-status");
|
|
65
|
+
}
|
|
66
|
+
|
|
57
67
|
/**
|
|
58
68
|
* The load a rendered pane says failed, from the `pane-load-error` node its
|
|
59
69
|
* status footer publishes (usePaneStatusFooter): the error the footer shows.
|
|
@@ -20,6 +20,8 @@ import {
|
|
|
20
20
|
import { uncoveredInstrumentKind, uncoveredInstrumentMessage, uncoveredInstrumentsMessage } from "../../tickers/instrument-coverage";
|
|
21
21
|
import { uncoveredInstrumentCommand } from "../uncovered-instrument";
|
|
22
22
|
import { listingAbroadVenue } from "../../utils/sec";
|
|
23
|
+
import { parsePublicTickerKey } from "../../utils/exchanges";
|
|
24
|
+
import { movedListing, movedListingNote } from "../../tickers/listing-fate";
|
|
23
25
|
import { splitSymbolArgs, stripStrayEdges } from "../symbol-args";
|
|
24
26
|
import { readNameEntries } from "../name-entries";
|
|
25
27
|
import { bankFigurePointer, bankWordPointer } from "../known-gaps";
|
|
@@ -276,9 +278,16 @@ export async function applyListingArgument(
|
|
|
276
278
|
// A long list is a batch of tickers: its words cost no quote each to be read as companies' names, nor its codes
|
|
277
279
|
// no source quotes to be read on their listings abroad.
|
|
278
280
|
const companyWord = typed.length <= MAX_CHOICE_LOOKUPS;
|
|
279
|
-
let listings = named ? [named] : await Promise.all(typed.map((raw) =>
|
|
280
|
-
|
|
281
|
-
|
|
281
|
+
let listings = named ? [named] : await Promise.all(typed.map((raw): Promise<CliListing> => {
|
|
282
|
+
const series = !exchange && headless?.fredSeriesArgument ? fredSeriesArgument(raw) : null;
|
|
283
|
+
if (series) {
|
|
284
|
+
const symbol = `FRED:${series}`;
|
|
285
|
+
return Promise.resolve({ symbol, key: symbol, exchange: "", saved: null, request: { symbol, exchange: "" } });
|
|
286
|
+
}
|
|
287
|
+
return resolveCliListing(raw, exchange, context, {
|
|
288
|
+
ownExchangeWins: typed.length > 1, venueSuffix: true, companyWord, listingAbroad: companyWord,
|
|
289
|
+
});
|
|
290
|
+
}));
|
|
282
291
|
// A separator stuck to the end of a pasted list (`UPST;`) is not part of a symbol; it is named.
|
|
283
292
|
const notes: string[] = takesOneTicker ? [] : stripStrayEdges(args.arg).notes;
|
|
284
293
|
notes.push(...aliases.flatMap((alias) => alias ? [alias.note] : []));
|
|
@@ -363,6 +372,69 @@ export async function applyListingArgument(
|
|
|
363
372
|
};
|
|
364
373
|
}
|
|
365
374
|
|
|
375
|
+
/**
|
|
376
|
+
* `fn CSP SQ` is `fn CSP XYZ`: a ticker whose company moved (SQ became XYZ on
|
|
377
|
+
* 2025-01-21), with nothing new listed under it, is read as the symbol the
|
|
378
|
+
* company trades as now before the function asks for anything, and the report
|
|
379
|
+
* says so. Without this a function that reads a company's data by symbol
|
|
380
|
+
* answers the old one's dead end: a stale quote, no earnings, or a 13F source
|
|
381
|
+
* that gives up after 20 s. A pane that shows one ticker as Ticker Research
|
|
382
|
+
* does (`isTickerLinkPeer`), and a function that reads each symbol's fate
|
|
383
|
+
* itself (`readsSymbolFate`), refuse such a ticker instead and name the new
|
|
384
|
+
* one; a list longer than a few lookups is read as typed. Null when nothing
|
|
385
|
+
* moved.
|
|
386
|
+
*/
|
|
387
|
+
export async function withRenamedTickers(
|
|
388
|
+
context: MarketContext,
|
|
389
|
+
args: ParsedPaneFunctionArgs,
|
|
390
|
+
resolved: Pick<ResolvedPaneFunction, "headless" | "template" | "instance">,
|
|
391
|
+
linkPeer: boolean,
|
|
392
|
+
): Promise<ParsedPaneFunctionArgs | null> {
|
|
393
|
+
const kind = resolved.headless?.argument.kind ?? resolved.template?.shortcut?.argKind;
|
|
394
|
+
if (linkPeer || resolved.headless?.readsSymbolFate || !args.arg.trim()
|
|
395
|
+
|| !(kind === "ticker" || kind === "tickers" || kind === "symbol-list" || kind === "ticker-list")) return null;
|
|
396
|
+
const keys = kind === "ticker" ? [args.arg.trim()] : splitSymbolArgs([args.arg]);
|
|
397
|
+
if (keys.length === 0 || keys.length > MAX_CHOICE_LOOKUPS) return null;
|
|
398
|
+
const moved = await Promise.all(keys.map((key) => {
|
|
399
|
+
if (resolved.headless?.fredSeriesArgument && fredSeriesArgument(key)) return null;
|
|
400
|
+
// One ticker is asked for as the function will ask for it (on its saved venue); a list's by key.
|
|
401
|
+
const { symbol, exchange } = keys.length === 1 && args.listing ? args.listing.request : parsePublicTickerKey(key);
|
|
402
|
+
return movedListing({ symbol, exchange: exchange ?? "" }, context.dataProvider)
|
|
403
|
+
.catch(logFailure("cli.pane-functions-resolver", "Read whether a ticker moved failed", null));
|
|
404
|
+
}));
|
|
405
|
+
if (!moved.some(Boolean)) return null;
|
|
406
|
+
const listings = await Promise.all(keys.map(async (key, index) => {
|
|
407
|
+
const change = moved[index];
|
|
408
|
+
return change ? resolveCliListing(change.tradesAs, undefined, context)
|
|
409
|
+
.catch(logFailure("cli.pane-functions-resolver", "Read a moved ticker's new symbol failed", null)) : null;
|
|
410
|
+
}));
|
|
411
|
+
const read = keys.map((key, index) => listings[index]?.key ?? moved[index]?.tradesAs ?? key);
|
|
412
|
+
// The same company typed twice (SQ,XYZ) is read once.
|
|
413
|
+
const arg = [...new Set(read)].join(", ");
|
|
414
|
+
// One moved ticker is read on its new symbol's listing, or by that symbol alone when it could not be
|
|
415
|
+
// resolved: never on the old symbol's listing under the new symbol.
|
|
416
|
+
const { listing: typed, ...rest } = args;
|
|
417
|
+
const listing = keys.length === 1 ? listings[0] : typed;
|
|
418
|
+
return {
|
|
419
|
+
...rest,
|
|
420
|
+
arg,
|
|
421
|
+
...(listing ? { listing } : {}),
|
|
422
|
+
listingNotes: [...args.listingNotes ?? [], ...moved.flatMap((change) => change ? [movedListingNote(change)] : [])],
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* The function's code as typed when it is one of the function's codes (`DES`
|
|
428
|
+
* for Ticker Research, whose code is T), else its own: what a command line
|
|
429
|
+
* the report suggests (a renamed ticker's retry) starts with.
|
|
430
|
+
*/
|
|
431
|
+
export function typedFunctionCode(typed: string, resolved: Pick<ResolvedPaneFunction, "token" | "template">): string {
|
|
432
|
+
const word = typed.trim().toUpperCase();
|
|
433
|
+
const shortcut = resolved.template?.shortcut;
|
|
434
|
+
const codes = [shortcut?.prefix, ...shortcut?.aliases ?? []].filter((code): code is string => !!code);
|
|
435
|
+
return codes.some((code) => code.toUpperCase() === word) ? word : resolved.token;
|
|
436
|
+
}
|
|
437
|
+
|
|
366
438
|
/**
|
|
367
439
|
* A chart's series typed in quotes that is a terminal's code for one listing
|
|
368
440
|
* (`fn G "VOD LN"`, `"MC FP Equity"`) is that listing, as `quote`, `history`,
|
|
@@ -270,6 +270,7 @@ export function shotSemanticRowCount(
|
|
|
270
270
|
): number {
|
|
271
271
|
const evidenceHook = paneScreenshotEvidenceHook(resolved);
|
|
272
272
|
if (evidenceHook) return renderedPaneEvidence(evidenceHook, semanticUi)?.plottedValueCount ?? 0;
|
|
273
|
+
if (resolved.pane?.id === "quick-notes") return semanticUi.filter((node) => node.role === "report-note").length;
|
|
273
274
|
if (resolved.capability.id === "chart-composer") {
|
|
274
275
|
const metadata = semanticUi.find((node) => (
|
|
275
276
|
node.role === "chart-data" && node.metadata?.kind === "chart-composer"
|