gloomberb 0.20.2 → 0.20.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/package.json +2 -1
- package/src/account/auth-form.tsx +13 -8
- package/src/account/upgrade-dialog.tsx +1 -1
- package/src/api-client/central-bank-rates.ts +5 -0
- package/src/api-client/data.ts +17 -4
- package/src/api-client/debt-maturities.ts +45 -2
- package/src/api-client/earnings.ts +4 -2
- package/src/api-client/errors.ts +21 -11
- package/src/api-client/index.ts +1 -0
- package/src/api-client/paths.ts +9 -1
- package/src/api-client/social-mentions.ts +47 -0
- package/src/api-client/types/econ.ts +4 -0
- package/src/app.tsx +11 -1
- package/src/cli/command-options.ts +2 -1
- package/src/cli/commands/market.ts +111 -29
- package/src/cli/commands/options-chain.ts +23 -6
- package/src/cli/commands/overview.ts +13 -5
- package/src/cli/commands/plugins.ts +49 -18
- package/src/cli/commands/search.ts +25 -6
- package/src/cli/commands/ticker.ts +4 -2
- package/src/cli/fx-quote-rate.ts +49 -1
- package/src/cli/glossary.ts +95 -15
- package/src/cli/history-rows.ts +9 -25
- package/src/cli/index.ts +6 -38
- package/src/cli/known-gaps.ts +3 -3
- package/src/cli/listing-arg.ts +78 -18
- package/src/cli/name-entries.ts +3 -2
- package/src/cli/not-a-ticker.ts +6 -2
- package/src/cli/pane-functions/capabilities.ts +12 -1
- package/src/cli/pane-functions/function-help.ts +23 -11
- package/src/cli/pane-functions/headless.ts +3 -1
- package/src/cli/pane-functions/index.ts +32 -4
- package/src/cli/pane-functions/market-session.ts +8 -3
- package/src/cli/pane-functions/resolver.ts +18 -11
- package/src/cli/pane-functions/screenshot-payload.ts +36 -6
- package/src/cli/pane-functions/screenshot-render.ts +4 -0
- package/src/cli/quote-answer.ts +10 -0
- package/src/cli/report-tables.ts +22 -2
- package/src/cli/result.ts +7 -3
- package/src/cli/spreadsheet-hint.ts +43 -0
- package/src/cli/symbol-list.ts +58 -4
- package/src/cli/symbol-rows.ts +49 -2
- package/src/cli/ticker-resolution.ts +98 -5
- package/src/cli/unknown-command.ts +88 -0
- package/src/components/command-bar/assist/model.ts +6 -1
- package/src/components/command-bar/commands/direct/index.ts +9 -1
- package/src/components/command-bar/commands/registry.ts +18 -0
- package/src/components/command-bar/pane-actions.ts +30 -13
- package/src/components/command-bar/panel/index.tsx +6 -3
- package/src/components/command-bar/panel/prompt-binding.ts +4 -0
- package/src/components/command-bar/panel/types.ts +3 -0
- package/src/components/command-bar/routes/header-market.ts +108 -0
- package/src/components/command-bar/routes/root/command-items.ts +5 -0
- package/src/components/command-bar/routes/root/provider-search.ts +190 -32
- package/src/components/command-bar/routes/root/results.ts +3 -0
- package/src/components/command-bar/routes/root/runtime.ts +28 -5
- package/src/components/command-bar/routes/ticker-search/results.ts +53 -6
- package/src/components/command-bar/routing/list-state.ts +38 -0
- package/src/components/command-bar/selection-hint.ts +28 -0
- package/src/components/command-bar/surface/index.tsx +41 -3
- package/src/components/command-bar/view-model.ts +15 -0
- package/src/components/command-bar/workflow/tickers.ts +3 -2
- package/src/components/company-logo.tsx +20 -2
- package/src/components/data-table/export.ts +13 -8
- package/src/components/feedback-dialog.tsx +2 -1
- package/src/components/form-modal/field-row.tsx +2 -1
- package/src/components/input-search-bar.tsx +2 -2
- package/src/components/layout/double-escape-close.ts +8 -5
- package/src/components/layout/header.tsx +75 -44
- package/src/components/layout/market-summary.ts +322 -116
- package/src/components/layout/pane/footer/index.tsx +26 -8
- package/src/components/layout/pane/footer/model.ts +46 -20
- package/src/components/layout/pane/header.tsx +3 -2
- package/src/components/layout/shell/chrome.ts +15 -15
- package/src/components/layout/status-bar.tsx +8 -7
- package/src/components/layout/status-widget-space.ts +8 -0
- package/src/components/markdown-editor.tsx +2 -2
- package/src/components/onboarding/account-step/form-panel.tsx +0 -3
- package/src/components/onboarding/onboarding-keyboard.ts +15 -6
- package/src/components/onboarding/onboarding-wizard.tsx +61 -11
- package/src/components/onboarding/portfolio-step/broker-fields-panel.tsx +0 -1
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +0 -2
- package/src/components/price-sparkline/model.ts +26 -10
- package/src/components/ticker/list-table-view.tsx +29 -4
- package/src/components/ui/button.tsx +13 -2
- package/src/components/ui/column-grid.tsx +18 -9
- package/src/components/ui/data-table/index.tsx +1 -1
- package/src/components/ui/data-table/opentui/index.tsx +2 -1
- package/src/components/ui/data-table/types.ts +18 -0
- package/src/components/ui/delayed-mark.tsx +3 -2
- package/src/components/ui/field-grid.tsx +0 -2
- package/src/components/ui/fields.tsx +7 -4
- package/src/components/ui/inline-quick-add.tsx +2 -2
- package/src/components/ui/key-hint-words.ts +153 -0
- package/src/components/ui/key-hints.tsx +73 -0
- package/src/components/ui/menu.tsx +3 -1
- package/src/components/ui/message-composer.tsx +2 -2
- package/src/components/ui/shortcut-hint.tsx +28 -3
- package/src/components/ui/tabs.tsx +7 -0
- package/src/components/ui/text-prompt-dialog.tsx +2 -1
- package/src/core/state/app/command-bar-launch.ts +3 -0
- package/src/data/config/store/normalize.ts +6 -0
- package/src/docs/snapshot.json +120 -69
- package/src/i18n/es.ts +24 -1
- package/src/i18n/ja.ts +24 -1
- package/src/i18n/ko.ts +24 -1
- package/src/i18n/zh-cn.ts +24 -1
- package/src/i18n/zh-tw.ts +24 -1
- package/src/layout/pane-manager/gridlock.ts +11 -0
- package/src/market-data/bars-per-year.ts +27 -9
- package/src/market-data/coordinator/quotes.ts +22 -3
- package/src/market-data/futures-board.ts +80 -0
- package/src/market-data/futures-contract.ts +9 -3
- package/src/market-data/market/change-basis.ts +2 -2
- package/src/market-data/market/dated-previous-close.ts +163 -47
- package/src/market-data/market/format.ts +14 -3
- package/src/market-data/market/freshness.ts +24 -7
- package/src/market-data/market/header-market.ts +154 -0
- package/src/market-data/market/index-level.ts +29 -0
- package/src/market-data/market/index-session-venues.ts +44 -0
- package/src/market-data/market/status.ts +7 -2
- package/src/market-data/market/venue-session.ts +72 -0
- package/src/market-data/model-dividend-yield.ts +23 -8
- package/src/market-data/options-alternatives.ts +39 -4
- package/src/market-data/published-apac-sessions.ts +40 -2
- package/src/market-data/quotes/export-identity.ts +76 -0
- package/src/market-data/quotes/freshness.ts +22 -0
- package/src/market-data/quotes/time.ts +42 -1
- package/src/market-data/realized-volatility.ts +11 -7
- package/src/market-data/tax-equivalent.ts +145 -27
- package/src/plugins/builtin/account-management/pane.tsx +2 -2
- package/src/plugins/builtin/alerts/alert-engine.ts +12 -6
- package/src/plugins/builtin/alerts/alert-log.ts +6 -2
- package/src/plugins/builtin/alerts/calendar-events.ts +74 -12
- package/src/plugins/builtin/alerts/cli-forms.ts +11 -1
- package/src/plugins/builtin/alerts/cli-move.ts +234 -0
- package/src/plugins/builtin/alerts/cli.ts +224 -33
- package/src/plugins/builtin/alerts/command.ts +33 -6
- package/src/plugins/builtin/alerts/event-rows.ts +18 -4
- package/src/plugins/builtin/alerts/events-pane.tsx +6 -2
- package/src/plugins/builtin/alerts/events.ts +9 -0
- package/src/plugins/builtin/alerts/format.ts +40 -15
- package/src/plugins/builtin/alerts/headless.ts +31 -18
- package/src/plugins/builtin/alerts/history.ts +1 -0
- package/src/plugins/builtin/alerts/index.tsx +86 -12
- package/src/plugins/builtin/alerts/live.ts +2 -1
- package/src/plugins/builtin/alerts/move-checks.ts +155 -0
- package/src/plugins/builtin/alerts/move.ts +160 -0
- package/src/plugins/builtin/alerts/pane.tsx +52 -22
- package/src/plugins/builtin/alerts/price-text.ts +62 -0
- package/src/plugins/builtin/alerts/price.ts +17 -0
- package/src/plugins/builtin/alerts/quotes.ts +84 -3
- package/src/plugins/builtin/alerts/scheduled-check.ts +7 -1
- package/src/plugins/builtin/alerts/storage.ts +20 -7
- package/src/plugins/builtin/alerts/types.ts +13 -0
- package/src/plugins/builtin/analytics/risk-client.ts +60 -39
- package/src/plugins/builtin/analytics/risk-episodes.ts +18 -0
- package/src/plugins/builtin/analytics/risk-headless.ts +20 -4
- package/src/plugins/builtin/analytics/risk-model.ts +68 -1
- package/src/plugins/builtin/analytics/risk-pane.tsx +15 -3
- package/src/plugins/builtin/backtest/engine.ts +4 -2
- package/src/plugins/builtin/backtest/window.ts +3 -1
- package/src/plugins/builtin/broker-manager/sign-in-end.ts +1 -1
- package/src/plugins/builtin/central-bank-rates/client.ts +4 -0
- package/src/plugins/builtin/central-bank-rates/headless.ts +1 -1
- package/src/plugins/builtin/central-bank-rates/model.ts +18 -8
- package/src/plugins/builtin/central-bank-rates/pane.tsx +6 -3
- package/src/plugins/builtin/chart-composer/cli-options.ts +5 -0
- package/src/plugins/builtin/chart-composer/headless-schema.ts +17 -1
- package/src/plugins/builtin/chart-composer/headless.ts +2 -0
- package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +9 -2
- package/src/plugins/builtin/crypto-board/headless.ts +82 -17
- package/src/plugins/builtin/crypto-board/index.tsx +24 -2
- package/src/plugins/builtin/crypto-board/model.ts +5 -2
- package/src/plugins/builtin/crypto-board/pane.tsx +4 -1
- package/src/plugins/builtin/debt-maturities/client.ts +111 -6
- package/src/plugins/builtin/debt-maturities/headless.ts +84 -1
- package/src/plugins/builtin/debt-maturities/model.ts +97 -14
- package/src/plugins/builtin/debt-maturities/pane.tsx +165 -15
- package/src/plugins/builtin/debt-maturities/series.ts +3 -1
- package/src/plugins/builtin/dividend-yield/client.ts +22 -6
- package/src/plugins/builtin/dividend-yield/headless.ts +113 -46
- package/src/plugins/builtin/dividend-yield/model.ts +5 -2
- package/src/plugins/builtin/dividend-yield/pane.tsx +6 -3
- package/src/plugins/builtin/dividend-yield/ranking-reads.ts +11 -4
- package/src/plugins/builtin/dividend-yield/ranking.ts +113 -18
- package/src/plugins/builtin/dividend-yield/types.ts +2 -0
- package/src/plugins/builtin/dividend-yield/view.ts +3 -0
- package/src/plugins/builtin/econ/calendar-model.ts +21 -3
- package/src/plugins/builtin/econ/detail-view.tsx +5 -3
- package/src/plugins/builtin/econ/figures.ts +13 -0
- package/src/plugins/builtin/econ/fred-catalog.ts +6 -3
- package/src/plugins/builtin/econ/index.tsx +5 -3
- package/src/plugins/builtin/econ/types.ts +5 -0
- package/src/plugins/builtin/equity-screener/footer.ts +45 -0
- package/src/plugins/builtin/equity-screener/pane.tsx +4 -18
- package/src/plugins/builtin/equity-screener/ticker-check.tsx +2 -1
- package/src/plugins/builtin/fixed-income/model.ts +1 -0
- package/src/plugins/builtin/futures/table.tsx +1 -1
- package/src/plugins/builtin/futures-curve/model.ts +3 -10
- package/src/plugins/builtin/help/function-card.tsx +2 -1
- package/src/plugins/builtin/help/function-index.ts +1 -0
- package/src/plugins/builtin/insider/client.ts +31 -14
- package/src/plugins/builtin/insider/signals-model.ts +2 -7
- package/src/plugins/builtin/iv-history/headless.ts +1 -2
- package/src/plugins/builtin/iv-history/model.ts +33 -23
- package/src/plugins/builtin/iv-history/screen-pane.tsx +0 -3
- package/src/plugins/builtin/kelly-sizer/headless.ts +64 -16
- package/src/plugins/builtin/kelly-sizer/history.ts +37 -28
- package/src/plugins/builtin/kelly-sizer/pane.tsx +43 -10
- package/src/plugins/builtin/kelly-sizer/sections.tsx +7 -2
- package/src/plugins/builtin/kelly-sizer/units.ts +29 -0
- package/src/plugins/builtin/news/index.tsx +7 -13
- package/src/plugins/builtin/news/overview-headlines.tsx +117 -0
- package/src/plugins/builtin/news/ticker-news.ts +35 -0
- package/src/plugins/builtin/news/wire/news/detail-view.tsx +8 -6
- package/src/plugins/builtin/news/wire/news/row.ts +49 -0
- package/src/plugins/builtin/news/wire/news/table.tsx +9 -20
- package/src/plugins/builtin/options/analytics.ts +7 -2
- package/src/plugins/builtin/options/live-quotes.ts +6 -1
- package/src/plugins/builtin/options/table.ts +3 -2
- package/src/plugins/builtin/options/view.tsx +11 -9
- package/src/plugins/builtin/options-scenario/client.ts +3 -0
- package/src/plugins/builtin/options-scenario/headless.ts +1 -1
- package/src/plugins/builtin/perps/client.ts +5 -4
- package/src/plugins/builtin/perps/headless.ts +134 -124
- package/src/plugins/builtin/perps/markets-section.tsx +2 -2
- package/src/plugins/builtin/perps/model.ts +8 -4
- package/src/plugins/builtin/perps/open-market.ts +4 -4
- package/src/plugins/builtin/perps/venue-markets.ts +3 -6
- package/src/plugins/builtin/portfolio-list/cell-version.ts +1 -0
- package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +34 -10
- package/src/plugins/builtin/portfolio-list/cli/period-report.ts +28 -2
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +7 -3
- package/src/plugins/builtin/portfolio-list/cli/render.ts +66 -22
- package/src/plugins/builtin/portfolio-list/grid.tsx +5 -3
- package/src/plugins/builtin/portfolio-list/pane/data.ts +34 -1
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +6 -0
- package/src/plugins/builtin/portfolio-list/pane/streaming.ts +15 -6
- package/src/plugins/builtin/portfolio-list/quick-add/resolution.ts +19 -7
- package/src/plugins/builtin/portfolio-list/table.tsx +30 -4
- package/src/plugins/builtin/realized-vol/evidence.ts +33 -6
- package/src/plugins/builtin/realized-vol/fx-proxy.ts +135 -0
- package/src/plugins/builtin/realized-vol/headless.ts +44 -8
- package/src/plugins/builtin/realized-vol/model.ts +9 -5
- package/src/plugins/builtin/realized-vol/pane.tsx +49 -15
- package/src/plugins/builtin/sec/headless.ts +48 -6
- package/src/plugins/builtin/sec/index.tsx +6 -4
- package/src/plugins/builtin/sec/model.ts +4 -1
- package/src/plugins/builtin/shared/earnings-calendar.ts +2 -0
- package/src/plugins/builtin/shared/market-cap-bands.ts +12 -0
- package/src/plugins/builtin/shared/report-freshness.ts +3 -1
- package/src/plugins/builtin/shared/use-quote-board.ts +5 -3
- package/src/plugins/builtin/shared/volatility/options.ts +63 -2
- package/src/plugins/builtin/social-mentions/headless.ts +72 -3
- package/src/plugins/builtin/social-mentions/index.tsx +8 -4
- package/src/plugins/builtin/social-mentions/lock-note.ts +6 -2
- package/src/plugins/builtin/social-mentions/outliers-client.ts +101 -0
- package/src/plugins/builtin/social-mentions/outliers-model.ts +162 -0
- package/src/plugins/builtin/social-mentions/outliers-names.ts +51 -0
- package/src/plugins/builtin/social-mentions/outliers.tsx +276 -0
- package/src/plugins/builtin/social-mentions/pane.tsx +32 -3
- package/src/plugins/builtin/supply-chain/graph-pane.tsx +2 -2
- package/src/plugins/builtin/thirteenf/api.ts +36 -2
- package/src/plugins/builtin/thirteenf/data.ts +4 -1
- package/src/plugins/builtin/thirteenf/headless.ts +14 -6
- package/src/plugins/builtin/thirteenf/model.ts +56 -1
- package/src/plugins/builtin/thirteenf/pane.tsx +8 -8
- package/src/plugins/builtin/thirteenf/report-notes.ts +11 -0
- package/src/plugins/builtin/thirteenf/table.ts +2 -1
- package/src/plugins/builtin/thirteenf/types.ts +6 -0
- package/src/plugins/builtin/ticker-detail/data-panes/historical-prices.tsx +23 -3
- package/src/plugins/builtin/ticker-detail/financials/model.ts +5 -0
- package/src/plugins/builtin/ticker-detail/headless-schema.ts +2 -1
- package/src/plugins/builtin/ticker-detail/headless.ts +21 -66
- package/src/plugins/builtin/ticker-detail/index.tsx +5 -0
- package/src/plugins/builtin/ticker-detail/overview/components.tsx +13 -1
- package/src/plugins/builtin/ticker-detail/overview/model.ts +6 -4
- package/src/plugins/builtin/ticker-detail/overview/pane.tsx +15 -0
- package/src/plugins/builtin/ticker-detail/overview/tax-equivalent.ts +69 -0
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +41 -6
- package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +47 -24
- package/src/plugins/builtin/ticker-detail/quote-monitor/export.ts +46 -0
- package/src/plugins/builtin/ticker-detail/quote-monitor/index.tsx +20 -1
- package/src/plugins/builtin/ticker-detail/quote-monitor/rows.ts +120 -0
- package/src/plugins/builtin/ticker-detail/research-tabs.ts +1 -5
- package/src/plugins/builtin/ticker-detail/settings.ts +6 -6
- package/src/plugins/builtin/treasury-auctions/cache.ts +85 -19
- package/src/plugins/builtin/treasury-auctions/index.tsx +22 -11
- package/src/plugins/builtin/treasury-auctions/model.ts +23 -0
- package/src/plugins/builtin/treasury-auctions/treasury-direct.ts +128 -0
- package/src/plugins/builtin/world-indices/client.ts +2 -0
- package/src/plugins/compat.ts +15 -0
- package/src/plugins/host-link.ts +6 -1
- package/src/plugins/installer.ts +8 -3
- package/src/portfolio/column-values.ts +14 -4
- package/src/portfolio/listed-symbol.ts +78 -0
- package/src/portfolio/real-return.ts +172 -0
- package/src/public/__snapshots__/public-api.test.ts.snap +1 -0
- package/src/renderers/browser/config-host.ts +56 -15
- package/src/renderers/browser/main.tsx +3 -1
- package/src/renderers/browser/ui-host.tsx +1 -0
- package/src/renderers/cloudflare/http-proxy.ts +1 -0
- package/src/renderers/dom/boot-frame.ts +2 -2
- package/src/renderers/dom/data-table/row.tsx +4 -1
- package/src/renderers/dom/desktop/controls.tsx +4 -4
- package/src/renderers/dom/desktop/dialog-actions.tsx +60 -41
- package/src/renderers/dom/dom-ui-host.tsx +3 -1
- package/src/renderers/dom/host/input.tsx +4 -1
- package/src/renderers/dom/host/tabs.tsx +10 -1
- package/src/renderers/dom/styles.css +33 -13
- package/src/renderers/electrobun/bun/desktop/app-name.ts +1 -1
- package/src/renderers/opentui/host.tsx +2 -1
- package/src/sources/gloomberb-cloud/fred-series.ts +12 -0
- package/src/sources/gloomberb-cloud/index.ts +31 -2
- package/src/sources/gloomberb-cloud/normalizers.ts +29 -3
- package/src/sources/provider-router/cached-routes.ts +19 -7
- package/src/state/pane-table-export-registry.ts +19 -6
- package/src/test-support/preload.ts +5 -1
- package/src/theme/colors.ts +9 -1
- package/src/theme/themes.ts +62 -15
- package/src/theme/tone-contrast.ts +40 -0
- package/src/theme/ui-tokens.ts +23 -3
- package/src/tickers/batched-lookups.ts +57 -8
- package/src/tickers/company-name-listing.ts +156 -14
- package/src/tickers/company-name.ts +30 -6
- package/src/tickers/list.ts +7 -0
- package/src/tickers/search/home-listing.ts +31 -9
- package/src/tickers/search/index.ts +13 -3
- package/src/tickers/search/listing-index.ts +558 -0
- package/src/tickers/search/major-listings.chunk.ts +10 -0
- package/src/tickers/search/major-listings.json +3346 -0
- package/src/tickers/search/ranking.ts +68 -1
- package/src/tickers/search/types.ts +4 -0
- package/src/tickers/terminal-codes.ts +26 -1
- package/src/time-series/calendar-month-returns.ts +47 -0
- package/src/time-series/currency-conversion.ts +130 -0
- package/src/time-series/hooks.ts +2 -0
- package/src/time-series/price-comparison.ts +34 -11
- package/src/time-series/resolve-context.ts +3 -0
- package/src/time-series/resolve.ts +14 -2
- package/src/time-series/spec.ts +1 -0
- package/src/time-series/studies/indicators.ts +4 -1
- package/src/time-series/types.ts +8 -0
- package/src/types/config.ts +8 -0
- package/src/types/data-provider.ts +28 -0
- package/src/types/financials.ts +20 -2
- package/src/types/headless.ts +12 -0
- package/src/ui/host.tsx +8 -0
- package/src/utils/datetime-format.ts +17 -3
- package/src/utils/display-number.ts +15 -0
- package/src/utils/double-escape-close.ts +61 -16
- package/src/utils/float32-price.ts +24 -0
- package/src/utils/forward-dividend.ts +81 -16
- package/src/utils/fx-market-hours.ts +11 -0
- package/src/utils/plugin-proxy-hosts.json +2 -1
- package/src/utils/price-history.ts +7 -6
- package/src/utils/report-timing.ts +62 -0
- package/src/utils/sec-filings.ts +32 -0
- package/src/utils/utc-time.ts +5 -0
|
@@ -19,7 +19,7 @@ import type {
|
|
|
19
19
|
TickerFinancials,
|
|
20
20
|
} from "../../types/financials";
|
|
21
21
|
import { currencyPriceMinDigits, formatMarketPrice, formatMarketPriceWithCurrency, nearParCoinPriceDigits, penceFigure, quoteFormatOptions, withCurrencyMinorDigits } from "../../market-data/market/format";
|
|
22
|
-
import { INDEX_POINTS_EXPORT_UNIT, isIndexLevel, reportedQuoteVolume } from "../../market-data/market/index-level";
|
|
22
|
+
import { INDEX_POINTS_EXPORT_UNIT, indexBarVolume, isIndexLevel, reportedQuoteVolume, YIELD_INDEX_EXPORT_UNIT } from "../../market-data/market/index-level";
|
|
23
23
|
import { changeBasisJson, changeBasisLabel, changeBasisNote, futuresQuoteFromSettle, printPredatesChangeBasis, quoteChangeBasis, quotePreviousCloseDate, quoteSettleText } from "../../market-data/market/change-basis";
|
|
24
24
|
import {
|
|
25
25
|
EXTENDED_SESSION_LABELS,
|
|
@@ -60,7 +60,7 @@ import {
|
|
|
60
60
|
ratingReason,
|
|
61
61
|
} from "../../plugins/builtin/research/analyst-model";
|
|
62
62
|
import { getPublishedUsEquityCalendarYears, getPublishedUsEquitySession } from "../../market-data/published-us-sessions";
|
|
63
|
-
import { isQuoteStaleForCurrentSession, noPrintsTodayText } from "../../market-data/quotes/freshness";
|
|
63
|
+
import { awaitingFirstDelayedPrint, isQuoteStaleForCurrentSession, noPrintsTodayText } from "../../market-data/quotes/freshness";
|
|
64
64
|
import {
|
|
65
65
|
coinOptionsAlternativesText, isCoinWithoutOptions, isOptionsUnavailableError, listedOptionsAlternative, optionsUnavailableTitle,
|
|
66
66
|
} from "../../market-data/options-alternatives";
|
|
@@ -75,7 +75,7 @@ import { latestFinancialPeriod } from "../../utils/latest-financial-period";
|
|
|
75
75
|
import type { FuturesContractTermsPayload } from "../../api-client/futures-curve";
|
|
76
76
|
import { currencyCodeLabel } from "../../utils/currency-units";
|
|
77
77
|
import {
|
|
78
|
-
futuresContractLines, futuresPricePer, futuresRollLines, isFuturesInstrument, loadFuturesPriceUnit, loadUsdPerMmbtu, usdPerMmbtuText, type UsdPerMmbtu,
|
|
78
|
+
futuresContractLines, futuresPricePer, futuresRollLines, futuresTickOption, isFuturesInstrument, loadFuturesPriceUnit, loadUsdPerMmbtu, usdPerMmbtuText, type UsdPerMmbtu,
|
|
79
79
|
} from "../../market-data/futures-contract";
|
|
80
80
|
import {
|
|
81
81
|
chainHasExpiry,
|
|
@@ -182,7 +182,7 @@ import { fail, isCliFailure, NO_DATA_CODE } from "../errors";
|
|
|
182
182
|
import { createConcurrencyLimiter, mapWithConcurrency } from "../../utils/concurrency";
|
|
183
183
|
import { MISSING_VOLUME_TEXT } from "../../utils/price-history-integrity";
|
|
184
184
|
import { CRYPTO_BOARD_HINT, quoteNotes } from "./crypto-hints";
|
|
185
|
-
import { bareFuturesCode, futuresBoardContract } from "../../market-data/futures-board";
|
|
185
|
+
import { bareFuturesCode, futuresBoardContract, futuresContractByWord } from "../../market-data/futures-board";
|
|
186
186
|
import { commodityNamedIn, commoditySearchName } from "../../market-data/commodity-names";
|
|
187
187
|
import { newsEmptyMessage } from "./news-hints";
|
|
188
188
|
import {
|
|
@@ -205,13 +205,14 @@ import {
|
|
|
205
205
|
searchNewsStories,
|
|
206
206
|
wordMeansMore,
|
|
207
207
|
} from "./news-search";
|
|
208
|
-
import { formatUtcDayTime, formatUtcTime } from "../../utils/utc-time";
|
|
208
|
+
import { displayTimeZone, formatUtcDayTime, formatUtcTime } from "../../utils/utc-time";
|
|
209
|
+
import { localReportTiming } from "../../utils/report-timing";
|
|
209
210
|
import { DAY_SO_FAR_TEXT, withSessionBar } from "../../time-series/session-bar";
|
|
210
211
|
import { isFiniteNumber } from "../../utils/guards";
|
|
211
212
|
import { exportedFundamentals } from "../../utils/price-earnings";
|
|
212
213
|
import { withBankEnterpriseValue } from "../../utils/fundamentals";
|
|
213
214
|
import { fundamentalsFreshness, quotesFreshness, rowsFreshness, valuationFreshness } from "../freshness";
|
|
214
|
-
import { fxPairListing, fxQuoteRateObservation, readFxQuoteRate } from "../fx-quote-rate";
|
|
215
|
+
import { fxPairListing, fxQuoteRateObservation, METAL_NAMES, readFxQuoteRate } from "../fx-quote-rate";
|
|
215
216
|
import { quoteBarNotes } from "../../market-data/quotes/intraday-bar";
|
|
216
217
|
import { cedearRatioText, depositaryPairText, isReceiptSide, listingCedearRatio, listingDepositaryPair } from "../../market-data/depositary-pair";
|
|
217
218
|
import { isPesoDollarPair, loadPesoDollarRates, pesoDollarRateLines, pesoDollarRatesJson } from "../peso-dollar-rates";
|
|
@@ -262,6 +263,7 @@ import {
|
|
|
262
263
|
movedSymbolLine,
|
|
263
264
|
ListingArgError,
|
|
264
265
|
isNoProviderError,
|
|
266
|
+
isTitleCaseWord,
|
|
265
267
|
requireCliListing,
|
|
266
268
|
resolveCliListing,
|
|
267
269
|
type CliListing,
|
|
@@ -272,7 +274,7 @@ import { liveCompanyQuestion } from "../company-name-hint";
|
|
|
272
274
|
import { bareListingNote, listingFateNotes, loadNoQuoteLastTraded, noLongerTradingNote, noQuoteLastTraded, noQuoteLastTradeNote, SUCCESSOR_CHANGE_WAIT_MS, tradingListing, usVenueOf, type NoQuoteLastTrade } from "../../tickers/listing-fate";
|
|
273
275
|
import { isYieldIndexSymbol } from "../../tickers/index-roots";
|
|
274
276
|
import {
|
|
275
|
-
analyzeTaxEquivalent, distributionBasis, loadTreasuryTenors, parseTaxRates, TAX_RATE_HELP_OPTIONS, taxEquivalentJson, type TaxRates,
|
|
277
|
+
analyzeTaxEquivalent, distributionBasis, loadTreasuryTenors, noBondFigures, parseTaxRates, TAX_RATE_HELP_OPTIONS, taxEquivalentJson, type TaxRates,
|
|
276
278
|
} from "../../market-data/tax-equivalent";
|
|
277
279
|
import { CBOE_YIELD_INDEX_CLOSE } from "../../plugins/builtin/shared/treasury-cutoffs";
|
|
278
280
|
import { earningsCalendarFailure, earningsChoiceNote, earningsDateLabel, isListingAbroad, noListingCalendarNote, undatedListingsNote } from "../earnings-calendar";
|
|
@@ -294,6 +296,7 @@ import { phraseSearchReport } from "./search";
|
|
|
294
296
|
import { secRegistrantMismatchMessage, SecRegistrantMismatchError, areDifferentCompanies } from "../../sources/sec-registrant";
|
|
295
297
|
import { isCryptoPairSymbol, isRoundTheClockCoin } from "../../utils/crypto-pair";
|
|
296
298
|
import { isUsListingExchange } from "../../utils/exchanges";
|
|
299
|
+
import { resolveTickerInstrumentKind } from "../../tickers/instrument-kind";
|
|
297
300
|
import {
|
|
298
301
|
describeFormerIssuer, describeTickerChange, movedAwayChange, startTickerChangeLookup, tickerChangeLine, type FormerIssuer, type TickerChange,
|
|
299
302
|
} from "../../tickers/ticker-changes";
|
|
@@ -314,6 +317,9 @@ import {
|
|
|
314
317
|
} from "../fx-forward";
|
|
315
318
|
import { unavailableOnServer } from "../../plugins/builtin/shared/cloud-resource";
|
|
316
319
|
|
|
320
|
+
/** `08:00`: an instant's UTC clock. */
|
|
321
|
+
const utcClock = (time: number) => new Date(time).toISOString().slice(11, 16);
|
|
322
|
+
|
|
317
323
|
/** `fx`'s forward form, for its usage line. */
|
|
318
324
|
const FX_FORWARD_USAGE = "fx <base>/<quote> --forward <tenor>";
|
|
319
325
|
import {
|
|
@@ -348,7 +354,7 @@ import {
|
|
|
348
354
|
withIndexedHolders,
|
|
349
355
|
} from "../../plugins/builtin/holders/index-holders";
|
|
350
356
|
import { loadShownSecFilings } from "../../plugins/builtin/sec/forms";
|
|
351
|
-
import { currentReportItemsLabel, hiddenFilingsMetadata, hiddenFilingsNote, type HiddenFilings } from "../../utils/sec-filings";
|
|
357
|
+
import { currentReportItemsLabel, form4TradeText, hiddenFilingsMetadata, hiddenFilingsNote, type HiddenFilings } from "../../utils/sec-filings";
|
|
352
358
|
import { INSIDER_REPORT_FILINGS, loadParsedInsiderFilings } from "../../plugins/builtin/insider/client";
|
|
353
359
|
import { insiderEmptyNotice, loadHomeInsiderReportsNote } from "../../plugins/builtin/insider/issuer";
|
|
354
360
|
import { buildInsiderSummary } from "../../plugins/builtin/insider/model";
|
|
@@ -432,9 +438,12 @@ function normalizeSymbols(args: string[]): string[] {
|
|
|
432
438
|
return uniqueEntries(splitSymbolArgs(args));
|
|
433
439
|
}
|
|
434
440
|
|
|
435
|
-
/**
|
|
441
|
+
/**
|
|
442
|
+
* Each entry once, a symbol upper-cased and a company's name in its typed case, a word written as a name
|
|
443
|
+
* (`Aeon`) too: it may be a company's name as much as a ticker (`titleCaseCompanyName`).
|
|
444
|
+
*/
|
|
436
445
|
function uniqueEntries(entries: readonly string[]): string[] {
|
|
437
|
-
return uniqueSecuritySymbols(entries.map((entry) => isCompanyNameInput(entry) ? entry : entry.toUpperCase()));
|
|
446
|
+
return uniqueSecuritySymbols(entries.map((entry) => isCompanyNameInput(entry) || isTitleCaseWord(entry) ? entry : entry.toUpperCase()));
|
|
438
447
|
}
|
|
439
448
|
|
|
440
449
|
/**
|
|
@@ -559,7 +568,8 @@ const CHANGE_BASIS_EXPORT_COLUMNS = [
|
|
|
559
568
|
* low and high) are already in the table's own cells.
|
|
560
569
|
*/
|
|
561
570
|
function quoteTextColumns<Column extends { key: string }>(columns: Column[]): Array<Column | typeof CHANGE_BASIS_COLUMN> {
|
|
562
|
-
const exported = new Set([...CHANGE_BASIS_EXPORT_COLUMNS, ...EXTENDED_CHANGE_EXPORT_COLUMNS, ...DAY_RANGE_EXPORT_COLUMNS]
|
|
571
|
+
const exported = new Set([...CHANGE_BASIS_EXPORT_COLUMNS, ...EXTENDED_CHANGE_EXPORT_COLUMNS, ...DAY_RANGE_EXPORT_COLUMNS, CHANGE_BP_EXPORT_COLUMN]
|
|
572
|
+
.map((column) => column.key));
|
|
563
573
|
const kept = columns.filter((column) => !exported.has(column.key));
|
|
564
574
|
const at = kept.findIndex((column) => column.key === "changePercent") + 1;
|
|
565
575
|
return [...kept.slice(0, at), CHANGE_BASIS_COLUMN, ...kept.slice(at)];
|
|
@@ -676,6 +686,14 @@ function quoteColumns() {
|
|
|
676
686
|
];
|
|
677
687
|
}
|
|
678
688
|
|
|
689
|
+
/**
|
|
690
|
+
* A yield index's move in basis points, the move the table shows (`+2.2bp`), which an export of a table holding a
|
|
691
|
+
* yield adds after its other columns; Chg% keeps the percent change it always held, blank for no yield.
|
|
692
|
+
*/
|
|
693
|
+
const CHANGE_BP_EXPORT_COLUMN = {
|
|
694
|
+
key: "changeBasisPoints", header: "Chg bp", value: (row: QuoteRow) => row.yieldIndex ? row.changeBasisPoints : null,
|
|
695
|
+
};
|
|
696
|
+
|
|
679
697
|
/** The day's low and high as numbers, after the columns an export already had. */
|
|
680
698
|
const DAY_RANGE_EXPORT_COLUMNS = [
|
|
681
699
|
{ key: "dayLow", header: "Day Low", value: (row: QuoteRow) => exportFigure(row.rawDayLow) },
|
|
@@ -765,6 +783,8 @@ function quoteRows(results: QuoteCliRecord[], now = Date.now()) {
|
|
|
765
783
|
const nearParDigits = nearParCoinPriceDigits(quote);
|
|
766
784
|
const options = {
|
|
767
785
|
...quoteFormatOptions(quote),
|
|
786
|
+
// A contract prints to its tick: the yen's 0.0063270, the euro's 1.11570.
|
|
787
|
+
...futuresTickOption(result.futuresContract),
|
|
768
788
|
minimumFractionDigits: indexPoints ? 2 : currencyPriceMinDigits(quote?.currency),
|
|
769
789
|
// A coin near a dollar prints to four decimals, as `ticker`, `G` and CRYP print it.
|
|
770
790
|
...nearParDigits != null ? { fixedFractionDigits: nearParDigits } : {},
|
|
@@ -869,6 +889,8 @@ function filingRows(filings: SecFilingItem[]) {
|
|
|
869
889
|
items: secFilingItemCodes(filing.items) ?? "",
|
|
870
890
|
// A current report's items by number and name: the results 8-K reads apart from another filed that day.
|
|
871
891
|
itemsLabel: currentReportItemsLabel(filing.items) ?? "",
|
|
892
|
+
// A Form 4's trade: whose shares, which way, how many and at what price.
|
|
893
|
+
trade: form4TradeText(filing) ?? "",
|
|
872
894
|
}));
|
|
873
895
|
}
|
|
874
896
|
|
|
@@ -1006,6 +1028,10 @@ function earningsRows(events: ResolvedEarningsEvent[]) {
|
|
|
1006
1028
|
// Out, announced by the company, or projected from its past reports.
|
|
1007
1029
|
status: earningsDateLabel(event.dateStatus),
|
|
1008
1030
|
timing: event.timing,
|
|
1031
|
+
// The company's own time when it announced one ("at 21:00 SGT Sat 7 Nov"), else with a
|
|
1032
|
+
// timezone set the session on the reader's clock: "after close, about 05:05 SGT Tue 10 Nov".
|
|
1033
|
+
localTiming: localReportTiming(isoDate(event.earningsDate).slice(0, 10),
|
|
1034
|
+
event.timing === "AMC" ? "amc" : event.timing === "BMO" ? "bmo" : null, displayTimeZone(), event.releaseAt) ?? "",
|
|
1009
1035
|
epsEstimate: event.epsEstimate,
|
|
1010
1036
|
epsActual: event.epsActual,
|
|
1011
1037
|
revenueEstimate: event.revenueEstimate,
|
|
@@ -1185,21 +1211,39 @@ async function runQuote(rawArgs: string[], ctx: Parameters<CliCommandDef["execut
|
|
|
1185
1211
|
const label = `${row.target.symbol}${row.listing.name ? ` (${row.listing.name})` : ""}`;
|
|
1186
1212
|
const stopped = noLongerTradingNote(label, row.quote, now);
|
|
1187
1213
|
const ended = stopped && liveCompanies[index] ? `${stopped}. ${liveCompanies[index]}` : stopped;
|
|
1188
|
-
|
|
1189
|
-
|
|
1214
|
+
// Open by its venue's calendar, before the delayed feed's first print: Last is the previous close until then.
|
|
1215
|
+
const awaiting = ended ? null : awaitingFirstDelayedPrint(row.quote, now);
|
|
1216
|
+
const quiet = ended || awaiting ? null : noPrintsTodayText(row.quote, now);
|
|
1217
|
+
const waiting = awaiting && row.quote
|
|
1218
|
+
? `${label}: open since ${utcClock(awaiting.open)} UTC; Last is the previous close until the first delayed print, about ${utcClock(awaiting.expected)} UTC`
|
|
1219
|
+
: null;
|
|
1220
|
+
return [ended ?? (quiet ? `${label}: ${quiet}` : waiting ?? []), quoteBarNotes(label, row.quote, now)].flat();
|
|
1190
1221
|
}),
|
|
1191
|
-
// A receipt and its home line
|
|
1222
|
+
// A receipt says the ratio, as `ticker` does, and its home line too when the receipt is in the table; a CEDEAR names itself
|
|
1223
|
+
// in its own. A plain RHM.DE or BA.L quote involves no ADR, so it says nothing of one.
|
|
1192
1224
|
...data.flatMap((row) => {
|
|
1193
1225
|
const cedear = listingCedearRatio({ quote: row.quote });
|
|
1194
1226
|
if (cedear) return [`${cedearRatioText(cedear)}.`];
|
|
1195
1227
|
const pair = listingDepositaryPair({ quote: row.quote });
|
|
1196
|
-
|
|
1228
|
+
if (!pair) return [];
|
|
1229
|
+
const receiptSide = isReceiptSide({ quote: row.quote });
|
|
1230
|
+
const receiptQuoted = receiptSide || data.some((other) => other !== row && isReceiptSide({ quote: other.quote })
|
|
1231
|
+
&& listingDepositaryPair({ quote: other.quote })?.receipt === pair.receipt);
|
|
1232
|
+
return receiptQuoted ? [`${row.target.symbol}: ${depositaryPairText(pair, receiptSide)}.`] : [];
|
|
1197
1233
|
}),
|
|
1198
1234
|
...endedNotes.flatMap((note) => note ?? []),
|
|
1235
|
+
// A commodity's word read as a security's ticker (WTI is W&T Offshore, GOLD is Gold.com) names the future it may have meant.
|
|
1236
|
+
...data.flatMap((row, index) => {
|
|
1237
|
+
const listing = asked[index]!;
|
|
1238
|
+
const contract = listing.exchange || !row.quote || isFuturesInstrument(row.target.symbol, row.quote.instrumentType)
|
|
1239
|
+
? null : futuresContractByWord(row.target.symbol);
|
|
1240
|
+
return contract ? [`${row.target.symbol} is ${row.listing.name || "a security"}; for ${contract.name}, quote the future ${contract.symbol}.`] : [];
|
|
1241
|
+
}),
|
|
1199
1242
|
// A cell shows only "unavailable", and an exported row only its status, so stderr names each failure; the JSON rows carry each reason.
|
|
1200
1243
|
...ctx.cliOptions.format !== "json" ? quoteNotes(data.filter((_row, index) => !endedNotes[index])) : [],
|
|
1201
1244
|
];
|
|
1202
|
-
const
|
|
1245
|
+
const holdsYield = data.some((row) => isYieldIndexSymbol(row.target.symbol));
|
|
1246
|
+
const columns = [...commandName === "compare" ? compareColumns() : quoteColumns(), ...holdsYield ? [CHANGE_BP_EXPORT_COLUMN] : []];
|
|
1203
1247
|
const basisNotes = changeBasisNotes(data, now);
|
|
1204
1248
|
const midNotes = extendedMidNotes(data);
|
|
1205
1249
|
if (ctx.cliOptions.format !== "json") await primeBoardCoins(notes);
|
|
@@ -1223,7 +1267,9 @@ async function runQuote(rawArgs: string[], ctx: Parameters<CliCommandDef["execut
|
|
|
1223
1267
|
symbolOrSeries: row.symbol,
|
|
1224
1268
|
// A pair's rate is its quote currency per base: JPY per USD, as `history` and `fx` export it.
|
|
1225
1269
|
currencyOrUnit: (row.currency && pairExportUnit(row.symbol, row.currency))
|
|
1226
|
-
|| row.currency || (row.yieldIndex ?
|
|
1270
|
+
|| row.currency || (row.yieldIndex ? YIELD_INDEX_EXPORT_UNIT : isIndexLevel(row.instrumentType) ? INDEX_POINTS_EXPORT_UNIT : null),
|
|
1271
|
+
// Each row as of its own price (^TNX's 19:59 beside ^VIX's 21:15), as Updated says; a row with none is blank.
|
|
1272
|
+
asOf: row.updatedAt || null,
|
|
1227
1273
|
}),
|
|
1228
1274
|
// A row with no price or move says why in its status column, as the warnings do.
|
|
1229
1275
|
exportStatus: quoteExportStatus,
|
|
@@ -1324,7 +1370,8 @@ function quoteFuturesContractText(data: QuoteCliRecord[]): string {
|
|
|
1324
1370
|
// The move Chg% gives, in the quote's money and with what it is measured from: "vs Fri settle".
|
|
1325
1371
|
const session = getRegularSessionDisplay(row.quote);
|
|
1326
1372
|
const change: Array<[string, string]> = session?.change != null && Number.isFinite(session.change)
|
|
1327
|
-
? [["Change", quoteChangeText(row.quote, session, withCurrencyMinorDigits(quoteFormatOptions(row.quote, "FUTURE"), row.quote.currency),
|
|
1373
|
+
? [["Change", quoteChangeText(row.quote, session, { ...withCurrencyMinorDigits(quoteFormatOptions(row.quote, "FUTURE"), row.quote.currency),
|
|
1374
|
+
...futuresTickOption(terms) }, terms)]]
|
|
1328
1375
|
: [];
|
|
1329
1376
|
// European gas beside Henry Hub: "≈ $30.832/MMBtu at EUR/USD 1.1650", a conversion that says so.
|
|
1330
1377
|
const inUsd = row.usdPerMmbtu;
|
|
@@ -1543,7 +1590,14 @@ async function loadListingHistory(
|
|
|
1543
1590
|
const pair = quote?.instrumentType === "CURRENCY" || isCurrencyPairListing(symbol, exchange);
|
|
1544
1591
|
// A London line's bars were priced in pence: cleaned there, and printed to the pence decimals `quote` shows.
|
|
1545
1592
|
const priceDivisor = quotedPriceDivisor(quote);
|
|
1546
|
-
|
|
1593
|
+
// An index's uncounted 0 (^HSI's hourly bars) is blank, as `quote` and HP leave it.
|
|
1594
|
+
const instrumentType = quote?.instrumentType ?? listed?.instrumentType;
|
|
1595
|
+
const counted = pair ? points.map(({ volume: _volume, ...point }) => point)
|
|
1596
|
+
: isIndexLevel(instrumentType) ? points.map(({ volume: barVolume, ...point }) => {
|
|
1597
|
+
const reported = indexBarVolume(barVolume, instrumentType);
|
|
1598
|
+
return reported == null ? point : { ...point, volume: reported };
|
|
1599
|
+
}) : points;
|
|
1600
|
+
const barRows = historyRows(counted, resolution, unit.currency, unit.unit, volume, priceDivisor);
|
|
1547
1601
|
// A monthly bar whose prices contradict each other keeps its close; its open, high and low come from the daily bars.
|
|
1548
1602
|
const rows = await withMonthlyBarsRebuilt(barRows, market, symbol, exchange, context, priceDivisor,
|
|
1549
1603
|
quote?.listingExchangeName || exchange || "");
|
|
@@ -2240,9 +2294,8 @@ async function runFinancials(rawArgs: string[], ctx: Parameters<CliCommandDef["e
|
|
|
2240
2294
|
const distributions = view === "statements" ? null : loadDividendDistributions(
|
|
2241
2295
|
market.dataProvider, listing.request, financials, { declared: ctx.cliOptions.format !== "json" });
|
|
2242
2296
|
// A fund's facts: its bond figures beside its distribution yield, and whether fn ETF has any to point to.
|
|
2243
|
-
const
|
|
2244
|
-
|
|
2245
|
-
financials, listing.saved);
|
|
2297
|
+
const fundVenue = financials.quote?.tradingExchangeName || listing.request.exchange || financials.quote?.listingExchangeName || financials.quote?.exchangeName;
|
|
2298
|
+
const fundFacts = view === "statements" ? null : loadReportFundFacts(listing.request.symbol, fundVenue, financials, listing.saved);
|
|
2246
2299
|
const treasury = rates ? loadTreasuryTenors() : null;
|
|
2247
2300
|
const identity = listingIdentity(listing, financials.quote);
|
|
2248
2301
|
const choice = await listingChoiceNotes(listing, market, financials.quote, venues);
|
|
@@ -2274,6 +2327,9 @@ async function runFinancials(rawArgs: string[], ctx: Parameters<CliCommandDef["e
|
|
|
2274
2327
|
// On the SEC yield when the sponsor publishes one, else the distribution yield the line above shows.
|
|
2275
2328
|
const taxEquivalent = rates ? analyzeTaxEquivalent({
|
|
2276
2329
|
symbol: identity.symbol || listing.key, bond, rates, treasury: await treasury,
|
|
2330
|
+
// A stock, or a fund listed abroad, says why it has no bond figures rather than that none are loaded,
|
|
2331
|
+
// once its quote says what it is.
|
|
2332
|
+
noBondFigures: financials.quote ? noBondFigures(resolveTickerInstrumentKind(listing.saved, financials), fundVenue) : null,
|
|
2277
2333
|
distribution: distributionBasis(priced.fundamentals?.dividendYield, priced.fundamentals?.dividendYieldBasis === "trailing" ? "trailing" : "forward"),
|
|
2278
2334
|
}) : null;
|
|
2279
2335
|
const report = { ...data, distributions: await distributions, statementFilings, bank: bank.bank, bankNote: bank.note, bondFund: bond, fundFacts: facts, taxEquivalent,
|
|
@@ -2577,6 +2633,7 @@ const FILING_COLUMNS = [
|
|
|
2577
2633
|
{ key: "items", header: "Items" },
|
|
2578
2634
|
{ key: "itemsLabel", header: "Item names" },
|
|
2579
2635
|
{ key: "pressReleaseUrl", header: "Press release URL" },
|
|
2636
|
+
{ key: "trade", header: "Trade" },
|
|
2580
2637
|
];
|
|
2581
2638
|
|
|
2582
2639
|
// The text table names the items before the URL, which a narrow terminal drops first. A current report's
|
|
@@ -2585,7 +2642,8 @@ const FILING_TEXT_COLUMNS = [
|
|
|
2585
2642
|
{ key: "filingDate", header: "Date" },
|
|
2586
2643
|
{ key: "form", header: "Form" },
|
|
2587
2644
|
{ key: "companyName", header: "Company", maxWidth: 24 },
|
|
2588
|
-
|
|
2645
|
+
// A current report's items; a Form 4's trade, which its filer's name alone does not say.
|
|
2646
|
+
{ key: "itemsLabel", header: "Items", format: (value: unknown, row: Record<string, unknown>) => String(value || row.trade || "") },
|
|
2589
2647
|
{ key: "url", header: "URL", optional: true,
|
|
2590
2648
|
format: (value: unknown, row: Record<string, unknown>) => String(row.pressReleaseUrl || (value ?? "")) },
|
|
2591
2649
|
];
|
|
@@ -3170,6 +3228,9 @@ async function runOptions(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
3170
3228
|
const { value: expiration, flag: expirationFlag } = expirationOption;
|
|
3171
3229
|
if (expirationOption.both) ctx.fail("--expiry is --expiration; give one of them.", `Usage: gloom ${OPTIONS_USAGE}`);
|
|
3172
3230
|
const exchangeOption = takeOption(args, "--exchange");
|
|
3231
|
+
// Contracts a corporate action adjusted (ETHA1) price another deliverable: listed only when asked for.
|
|
3232
|
+
const adjusted = takeFlag(args, "--adjusted");
|
|
3233
|
+
if (adjusted && leapsOptions.leaps) ctx.fail("--adjusted lists one chain's adjusted contracts; it does not apply with --leaps.", `Usage: gloom ${OPTIONS_USAGE}`);
|
|
3173
3234
|
if (leapsOptions.leaps) {
|
|
3174
3235
|
// With --leaps, --expiration is a window of one expiry.
|
|
3175
3236
|
const criteria = parseLeapsCriteria({ ...leapsOptions.raw, ...expirationOption.given ? { "--expiration": expiration ?? "" } : {} });
|
|
@@ -3206,6 +3267,12 @@ async function runOptions(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
3206
3267
|
// Expiries close on the listing's clock: a coin's options (Deribit) settle at 08:00 UTC on any day.
|
|
3207
3268
|
const expiryVenue = optionExpiryVenue(symbol, exchange);
|
|
3208
3269
|
const readChain = async (expiry: number | undefined) => {
|
|
3270
|
+
// The adjusted contracts are their own request, never the standard chain's cached one.
|
|
3271
|
+
if (adjusted) {
|
|
3272
|
+
return { result: undefined, chain: await market.dataProvider.getOptionsChain(symbol, exchange, expiry, {
|
|
3273
|
+
cacheMode: refresh ? "refresh" : "default", adjustedOptions: true,
|
|
3274
|
+
}) };
|
|
3275
|
+
}
|
|
3209
3276
|
const cached = await market.dataProvider.getCachedQuery?.("getOptionsChain", [symbol, exchange, expiry, undefined])
|
|
3210
3277
|
.load({ force: refresh });
|
|
3211
3278
|
return {
|
|
@@ -3259,8 +3326,10 @@ async function runOptions(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
3259
3326
|
}
|
|
3260
3327
|
const quote = await quotePromise;
|
|
3261
3328
|
const identity = listingIdentity(listing, quote);
|
|
3262
|
-
// IV and delta are valued at one spot and instant, named under the table and on every exported row.
|
|
3263
|
-
|
|
3329
|
+
// IV and delta are valued at one spot and instant, named under the table and on every exported row. Adjusted
|
|
3330
|
+
// contracts deliver something other than 100 shares, so the spot values none of them.
|
|
3331
|
+
const { chain, spot: modelSpot } = adjusted ? { chain: loaded, spot: null }
|
|
3332
|
+
: valueChainAtModelSpot(loaded, inputs, Date.now(), identity.exchange);
|
|
3264
3333
|
const basis: OptionsChainBasis = { spot: modelSpot, dividendYield: inputs.dividendYield ?? null,
|
|
3265
3334
|
openInterest: await loadOptionsChainOpenInterest(symbol, chain), ivFilled: chainHasFilledIv(chain) };
|
|
3266
3335
|
const basisFields = optionsBasisFields(basis);
|
|
@@ -3274,7 +3343,7 @@ async function runOptions(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
3274
3343
|
// A venue that marks its contracts (Deribit) states IV and greeks without a quote.
|
|
3275
3344
|
const marked = isMarkedChain(chain);
|
|
3276
3345
|
const coin = chainCoinCurrency(chain);
|
|
3277
|
-
const modelWarning = !marked && inputs.spot == null && (chain.calls.length > 0 || chain.puts.length > 0)
|
|
3346
|
+
const modelWarning = !marked && !adjusted && inputs.spot == null && (chain.calls.length > 0 || chain.puts.length > 0)
|
|
3278
3347
|
? `IV and delta need a current ${listing.key} quote; those columns are blank`
|
|
3279
3348
|
: null;
|
|
3280
3349
|
const listed = chain.expirationDates.length > 0 || chain.calls.length > 0 || chain.puts.length > 0;
|
|
@@ -3321,7 +3390,7 @@ async function runOptions(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
3321
3390
|
rows: (data: OptionsChain) => optionRows(data).map((row) => ({ ...row, ...basisFields })),
|
|
3322
3391
|
// Choosing an expiry needs the list; once one is chosen the table is that expiry.
|
|
3323
3392
|
summary: (data: OptionsChain) => expirationDate == null ? formatExpiryList(data.expirationDates) : "",
|
|
3324
|
-
empty: `No option contracts for ${listingTitle(identity)}.`,
|
|
3393
|
+
empty: adjusted ? `No adjusted option contracts for ${listingTitle(identity)} on this expiry.` : `No option contracts for ${listingTitle(identity)}.`,
|
|
3325
3394
|
...(contractCount > 0 ? { footnote: optionsBasisFootnote(basis, chain) } : {}),
|
|
3326
3395
|
exportIdentity: { symbolOrSeries: listing.key, currencyOrUnit: currency, interval: OPTIONS_EXPORT_INTERVAL },
|
|
3327
3396
|
// Exports state each decimal's unit in its header and end every row with the spot and dates it is as of.
|
|
@@ -3338,6 +3407,8 @@ async function runOptions(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
3338
3407
|
{ key: "delta", header: "Delta (decimal)" },
|
|
3339
3408
|
{ key: "volume", header: "Vol" },
|
|
3340
3409
|
{ key: "openInterest", header: "OI" },
|
|
3410
|
+
{ key: "quoteStale", header: "Quote stale" },
|
|
3411
|
+
...(adjusted ? [{ key: "deliverable", header: "Deliverable" }] : []),
|
|
3341
3412
|
{ key: "spot", header: "Spot" },
|
|
3342
3413
|
{ key: "spotBasis", header: "Spot basis" },
|
|
3343
3414
|
{ key: "spotAsOf", header: "Spot as of" },
|
|
@@ -3382,6 +3453,7 @@ async function runOptions(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
3382
3453
|
{ key: "delta", header: "Delta", align: "right", format: formatOptionDeltaCell },
|
|
3383
3454
|
{ key: "volume", header: "Vol", align: "right", format: formatCountCell, optional: true, dropPriority: 1 },
|
|
3384
3455
|
{ key: "openInterest", header: "OI", align: "right", format: formatCountCell, optional: true, dropPriority: 1 },
|
|
3456
|
+
...(adjusted ? [{ key: "deliverable", header: "Deliverable", format: (value: unknown) => typeof value === "string" ? value : "not stated" }] : []),
|
|
3385
3457
|
],
|
|
3386
3458
|
});
|
|
3387
3459
|
});
|
|
@@ -3551,6 +3623,7 @@ async function runFx(rawArgs: string[], ctx: Parameters<CliCommandDef["execute"]
|
|
|
3551
3623
|
const row = {
|
|
3552
3624
|
currency, baseCurrency, rate, asOf, stale, pair, inverse: 1 / rate,
|
|
3553
3625
|
...(quoted ? { quotes: quoted.quotes.map(({ symbol }) => symbol), ...(quoted.viaUsd ? { via: "USD" } : {}) } : {}),
|
|
3626
|
+
...(quoted?.derivedFrom ? { derived: true, derivedFrom: quoted.derivedFrom } : {}),
|
|
3554
3627
|
...(amount == null ? {} : { amount, converted }),
|
|
3555
3628
|
};
|
|
3556
3629
|
// The closing line is the quote's own, as `quote` prints it: its time, and stale once older than the feed's delay.
|
|
@@ -3577,7 +3650,11 @@ async function runFx(rawArgs: string[], ctx: Parameters<CliCommandDef["execute"]
|
|
|
3577
3650
|
const rateFields = (short: typeof base.rate) => ({
|
|
3578
3651
|
currency: short.currency, name: short.name, tenor: short.tenor, value: short.value, asOf: short.asOf,
|
|
3579
3652
|
dayCountBasis: short.dayCountBasis, publisher: short.publisher, sourceUrl: short.sourceUrl, stale: short.stale,
|
|
3653
|
+
...(short.attribution ? { attribution: short.attribution } : {}),
|
|
3580
3654
|
});
|
|
3655
|
+
// A publisher's licence asks for its attribution wherever its rate is shown (MAS's SORA).
|
|
3656
|
+
const attributions = [...new Set([base.rate, quote.rate].flatMap((short) => short.attribution
|
|
3657
|
+
? [`${short.name}: ${short.attribution.text.replace(/\.$/, "")} (${short.attribution.licenceUrl}).`] : []))];
|
|
3581
3658
|
const staleRates = [base.rate, quote.rate].filter((short) => short.stale)
|
|
3582
3659
|
.map((short) => `${short.name} (${short.currency}) is the last copy read, dated ${short.asOf ?? "undated"}; its source could not be read since.`);
|
|
3583
3660
|
const forwardRow = {
|
|
@@ -3595,6 +3672,7 @@ async function runFx(rawArgs: string[], ctx: Parameters<CliCommandDef["execute"]
|
|
|
3595
3672
|
`${currency} rate: ${describeShortRate(base.rate)}`,
|
|
3596
3673
|
`${baseCurrency} rate: ${describeShortRate(quote.rate)}`,
|
|
3597
3674
|
`Covered interest parity: ${formatFxRate(rate)} × ${growth(quote.rate)} / ${growth(base.rate)}; each rate earns simple interest over the ${tenor.days} days, standing in for a ${tenor.label} term rate.`,
|
|
3675
|
+
...attributions,
|
|
3598
3676
|
].join("\n"),
|
|
3599
3677
|
exportIdentity: { symbolOrSeries: pair, currencyOrUnit: `${baseCurrency} per ${currency}`, interval: `forward ${tenor.label}` },
|
|
3600
3678
|
columns: [
|
|
@@ -3625,9 +3703,12 @@ async function runFx(rawArgs: string[], ctx: Parameters<CliCommandDef["execute"]
|
|
|
3625
3703
|
: null;
|
|
3626
3704
|
if (peso && peso.missing.length > 0) warnings.push(`No price for ${peso.missing.join(", ")}, so the rates from ${peso.missing.length === 1 ? "it are" : "them are"} left out.`);
|
|
3627
3705
|
// A cross says so, naming the dollar pairs it is read from: the pair has no quote of its own.
|
|
3706
|
+
// A metal with no spot quote is priced from its front-month future, and says so.
|
|
3707
|
+
const metal = quoted?.derivedFrom ? (METAL_NAMES[currency] ? currency : baseCurrency) : null;
|
|
3628
3708
|
const rateText = [
|
|
3629
3709
|
describeFxRate(request, rate, quoted && !quoted.viaUsd ? quoted.quotes[0] : undefined),
|
|
3630
3710
|
...quoted?.viaUsd ? [describeFxLegs(quoted.quotes)] : [],
|
|
3711
|
+
...metal ? [`derived: ${METAL_NAMES[metal]!.toLowerCase()} from ${quoted!.derivedFrom}, the front-month future (spot ${METAL_NAMES[metal]!.toLowerCase()} is not quoted)`] : [],
|
|
3631
3712
|
...peso ? [`${peso.spotKind} rate`] : [],
|
|
3632
3713
|
].join(" · ");
|
|
3633
3714
|
ctx.printResult({ data: [peso ? { ...row, ...pesoDollarRatesJson(peso) } : row], freshness, warnings: warnings.length > 0 ? warnings : undefined }, {
|
|
@@ -3638,7 +3719,7 @@ async function runFx(rawArgs: string[], ctx: Parameters<CliCommandDef["execute"]
|
|
|
3638
3719
|
...peso ? pesoDollarRateLines(peso) : [],
|
|
3639
3720
|
].join("\n"),
|
|
3640
3721
|
// The rate is the base currency's price of one unit of the other, at the latest quote of each leg: USD per ZAR.
|
|
3641
|
-
exportIdentity: { symbolOrSeries: pair, currencyOrUnit: `${baseCurrency} per ${currency}`, interval: "spot" },
|
|
3722
|
+
exportIdentity: { symbolOrSeries: pair, currencyOrUnit: `${baseCurrency} per ${currency}`, interval: quoted?.derivedFrom ? `derived from ${quoted.derivedFrom}` : "spot" },
|
|
3642
3723
|
columns: [
|
|
3643
3724
|
{ key: "currency", header: "Currency" },
|
|
3644
3725
|
{ key: "baseCurrency", header: "Base" },
|
|
@@ -3722,7 +3803,7 @@ async function runEarnings(rawArgs: string[], ctx: Parameters<CliCommandDef["exe
|
|
|
3722
3803
|
{ key: "status", header: "Status" },
|
|
3723
3804
|
{ key: "symbol", header: "Symbol" },
|
|
3724
3805
|
{ key: "name", header: "Name" },
|
|
3725
|
-
{ key: "timing", header: "Timing" },
|
|
3806
|
+
{ key: "timing", header: "Timing", format: (value: unknown, row: Record<string, unknown>) => String(row.localTiming || (value ?? "")) },
|
|
3726
3807
|
{ key: "epsEstimate", header: "EPS Est", align: "right", format: formatEpsCell },
|
|
3727
3808
|
{ key: "epsActual", header: "EPS", align: "right", format: formatEpsCell },
|
|
3728
3809
|
],
|
|
@@ -3821,6 +3902,7 @@ export const marketDataCliCommands: BuiltinCliCommandDef[] = [
|
|
|
3821
3902
|
description: "Expiration as a date (2028-01-21) or Unix seconds; defaults to the nearest one, and lists the others. With --leaps: rank that expiry alone",
|
|
3822
3903
|
},
|
|
3823
3904
|
EXCHANGE_OPTION,
|
|
3905
|
+
{ flags: "--adjusted", description: "List the contracts a corporate action adjusted (a numbered root such as ETHA1), each with what it delivers, in place of the standard ones" },
|
|
3824
3906
|
{ flags: "--leaps", description: "Rank long-dated contracts across the symbols given, as a stock replacement; more than a year out unless a window says otherwise" },
|
|
3825
3907
|
{ flags: "--side <calls|puts>", description: `With --leaps: the side to rank (default ${DEFAULT_LEAPS_CRITERIA.side}s)` },
|
|
3826
3908
|
{
|
|
@@ -6,6 +6,7 @@ import { cliStyles, cliTerminalWidth, wrapText } from "../../utils/cli-output";
|
|
|
6
6
|
import { isFiniteNumber } from "../../utils/guards";
|
|
7
7
|
import { calculateOptionGreeks, ivSolvedNote, solveChainVolatilities } from "../../plugins/builtin/options/analytics";
|
|
8
8
|
import { optionQuoteSide } from "../../plugins/builtin/options/market-reference";
|
|
9
|
+
import { withQuotesUnderIntrinsicMarked } from "../../plugins/builtin/shared/volatility";
|
|
9
10
|
import {
|
|
10
11
|
formatModelSpotPrice, modelSpotLabel, optionModelSpot, type OptionModelSpot,
|
|
11
12
|
} from "../../plugins/builtin/options/model-spot";
|
|
@@ -222,8 +223,10 @@ export function valueChainAtModelSpot(
|
|
|
222
223
|
chain: OptionsChain, inputs: OptionModelInputs, now: number, exchange?: string,
|
|
223
224
|
): { chain: OptionsChain; spot: OptionModelSpot | null } {
|
|
224
225
|
const spot = optionModelSpot(inputs.quote, chain, now, exchange);
|
|
226
|
+
// A quote under intrinsic at that spot is shown marked stale, as the server marks one.
|
|
227
|
+
const marked = withQuotesUnderIntrinsicMarked(chain, spot?.price ?? inputs.spot);
|
|
225
228
|
return {
|
|
226
|
-
chain: chainWithModelFigures(
|
|
229
|
+
chain: chainWithModelFigures(marked, spot ? { spot: spot.price, dividendYield: inputs.dividendYield, now: spot.valuationTime } : inputs),
|
|
227
230
|
spot,
|
|
228
231
|
};
|
|
229
232
|
}
|
|
@@ -261,13 +264,20 @@ export function optionsBasisFootnote(basis: OptionsChainBasis, chain?: OptionsCh
|
|
|
261
264
|
parts.push(Number.isFinite(asOf) ? `OI live, ${formatUtcTime(new Date(asOf).toISOString())}` : openInterestAsOfLabel(basis.openInterest));
|
|
262
265
|
return parts.join(" · ");
|
|
263
266
|
}
|
|
264
|
-
|
|
267
|
+
// An adjusted contract delivers something other than 100 shares: the fund's price values none of it.
|
|
268
|
+
if (chain && [...chain.calls, ...chain.puts].some((contract) => contract.adjusted)) {
|
|
269
|
+
parts.push("adjusted: each delivers what its Deliverable says, so no IV or delta is read at the fund's price");
|
|
270
|
+
} else if (basis.spot) {
|
|
265
271
|
parts.push(`Greeks at spot ${formatModelSpotPrice(basis.spot.price)} (${modelSpotLabel(basis.spot)}), `
|
|
266
272
|
// An unknown yield is valued as none, and says so rather than read as a stated 0%.
|
|
267
273
|
+ `dividend yield ${basis.dividendYield == null ? "unknown (valued at 0%)" : `${Number((basis.dividendYield * 100).toFixed(2))}%`}, `
|
|
268
274
|
+ `rate ${Number((OPTION_MODEL_RATE * 100).toFixed(2))}%`);
|
|
269
275
|
parts.push(ivSolvedNote(basis.ivFilled === true));
|
|
270
276
|
}
|
|
277
|
+
// A quote that cannot be priced is shown, and its IV cell says why it values nothing.
|
|
278
|
+
if (chain && [...chain.calls, ...chain.puts].some((contract) => contract.quoteStale)) {
|
|
279
|
+
parts.push("stale: quoted before the session or under intrinsic, no IV or delta");
|
|
280
|
+
}
|
|
271
281
|
const oi = basis.openInterest;
|
|
272
282
|
parts.push(oi?.date ? openInterestAsOfLabel(oi)
|
|
273
283
|
: oi?.listedDate && oi.compared > 0
|
|
@@ -302,10 +312,13 @@ export function optionRows(chain: OptionsChain) {
|
|
|
302
312
|
ask: contract.ask,
|
|
303
313
|
volume: contract.volume,
|
|
304
314
|
openInterest: contract.openInterest,
|
|
305
|
-
|
|
315
|
+
// A stale quote (from before the session, or under intrinsic) is shown but values nothing.
|
|
316
|
+
iv: contract.quoteStale ? null : modeled.iv ?? null,
|
|
306
317
|
// Solved from the strike's quote, or filled from its neighbours when it has none to solve from; a venue's own mark is neither.
|
|
307
|
-
ivSource: modeled.iv == null ? null : contract.mark ? "mark" : modeled.ivFilled ? "filled" : "solved",
|
|
308
|
-
delta: modeled.delta ?? null,
|
|
318
|
+
ivSource: contract.quoteStale ? "stale quote" : modeled.iv == null ? null : contract.mark ? "mark" : modeled.ivFilled ? "filled" : "solved",
|
|
319
|
+
delta: contract.quoteStale ? null : modeled.delta ?? null,
|
|
320
|
+
quoteStale: contract.quoteStale === true,
|
|
321
|
+
...(contract.adjusted ? { root: contract.adjusted.root, deliverable: contract.adjusted.deliverable } : {}),
|
|
309
322
|
expiration: expiryIsoDate(contract.expiration),
|
|
310
323
|
// A venue's marks and coin prices (Deribit), beside the dollar ones.
|
|
311
324
|
...(contract.mark ? {
|
|
@@ -340,8 +353,12 @@ export function formatOptionQuoteCell(row: Record<string, unknown>, side: "bid"
|
|
|
340
353
|
return quote == null ? "—" : String(quote);
|
|
341
354
|
}
|
|
342
355
|
|
|
343
|
-
/**
|
|
356
|
+
/**
|
|
357
|
+
* Implied volatility as a percent; a dash when it could not be solved, never 0.0%, and a leading "~" when it was filled
|
|
358
|
+
* from neighbouring strikes. A stale quote says so in its place: its bid and ask are shown, but value nothing.
|
|
359
|
+
*/
|
|
344
360
|
export function formatOptionIvCell(value: unknown, row?: Record<string, unknown>): string {
|
|
361
|
+
if (row?.quoteStale === true) return "stale";
|
|
345
362
|
if (!isFiniteNumber(value) || !(value > 0)) return "—";
|
|
346
363
|
const text = `${(value * 100).toFixed(1)}%`;
|
|
347
364
|
return row?.ivSource === "filled" ? `~${text}` : text;
|
|
@@ -53,7 +53,7 @@ import {
|
|
|
53
53
|
type ImpactFilter,
|
|
54
54
|
} from "../../plugins/builtin/econ/calendar-model";
|
|
55
55
|
import { hasNoReleaseTime, hasNoStatedTime, type EconEvent } from "../../plugins/builtin/econ/types";
|
|
56
|
-
import { econRowFigures } from "../../plugins/builtin/econ/figures";
|
|
56
|
+
import { econRowFigures, figureWithCurrency } from "../../plugins/builtin/econ/figures";
|
|
57
57
|
import { isoDate, rejectExtraArgs, requireArg, requireOneArg, takeFlag, takeOption } from "./command-utils";
|
|
58
58
|
import { buildCorrelationSeries } from "../../plugins/builtin/correlation/matrix/model";
|
|
59
59
|
import { alignDailyCloses, correlateDailyCloses } from "../../plugins/builtin/correlation/compute";
|
|
@@ -364,12 +364,16 @@ function econTextHeadColumns(viewerZone: string | null, publisherTimed: boolean)
|
|
|
364
364
|
}
|
|
365
365
|
|
|
366
366
|
/**
|
|
367
|
-
* Actual, Forecast and Prior: as the text draws them (`30.3K`, `-4.1M bbl`) in the table,
|
|
368
|
-
* numbers in the exports (30300, -4100000), where Unit
|
|
367
|
+
* Actual, Forecast and Prior: as the text draws them (`30.3K`, `-4.1M bbl`) in the table, an amount with the
|
|
368
|
+
* currency the server states beside it (`-556.5B JPY`), as numbers in the exports (30300, -4100000), where Unit
|
|
369
|
+
* and Scale say what they count (`JPY` for that amount) and how they were drawn.
|
|
369
370
|
*/
|
|
370
371
|
function econFigureColumns(text: boolean): CliResultColumn[] {
|
|
372
|
+
const shown = (key: string) => (row: Record<string, unknown>) =>
|
|
373
|
+
figureWithCurrency(row[key] as string | null, typeof row.currency === "string" ? row.currency : null);
|
|
371
374
|
return text
|
|
372
|
-
? [{ key: "actualText", header: "Actual" }, { key: "forecastText", header: "Forecast"
|
|
375
|
+
? [{ key: "actualText", header: "Actual", value: shown("actualText") }, { key: "forecastText", header: "Forecast", value: shown("forecastText") },
|
|
376
|
+
{ key: "priorText", header: "Prior", value: shown("priorText") }]
|
|
373
377
|
: [{ key: "actual", header: "Actual" }, { key: "forecast", header: "Forecast" }, { key: "prior", header: "Prior" }];
|
|
374
378
|
}
|
|
375
379
|
|
|
@@ -542,7 +546,9 @@ async function runEcon(args: string[], ctx: Parameters<CliCommandDef["execute"]>
|
|
|
542
546
|
actual: figures.actual,
|
|
543
547
|
forecast: figures.forecast,
|
|
544
548
|
prior: figures.prior,
|
|
545
|
-
|
|
549
|
+
// A plain amount counts the currency the server states it in (JPY for Japan's current account).
|
|
550
|
+
unit: figures.unit ?? (figures.scale != null ? event.currency ?? null : null),
|
|
551
|
+
currency: event.currency ?? null,
|
|
546
552
|
scale: figures.scale,
|
|
547
553
|
actualText: event.actual ?? null,
|
|
548
554
|
forecastText: event.forecast ?? null,
|
|
@@ -747,6 +753,8 @@ async function printFredSeries(ctx: Parameters<CliCommandDef["execute"]>[1], { s
|
|
|
747
753
|
...fredHistoryNotes({ startDate, startGiven: start != null, seriesStart: data.info?.observationStart }),
|
|
748
754
|
laggingSeriesNote(seriesId),
|
|
749
755
|
computedFredSeriesNote(seriesId),
|
|
756
|
+
// A publisher's licence asks for its attribution wherever its series is shown (MAS's SORA).
|
|
757
|
+
seriesNotOnFred(seriesId)?.attribution ?? null,
|
|
750
758
|
].filter((note): note is string => note != null);
|
|
751
759
|
// Nothing on or after the start: name where the series ends, so an empty answer is not a dead end.
|
|
752
760
|
const latest = rows.length > 0 ? null : await loadFredSeries(seriesId, { limit: 1, sortOrder: "desc" })
|
|
@@ -126,6 +126,52 @@ function hostCovered(host: string, declared: readonly string[]): boolean {
|
|
|
126
126
|
return declared.some((entry) => host === entry || host.endsWith(`.${entry}`));
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
+
/**
|
|
130
|
+
* The `hosts` rows of `plugin doctor`. A plugin declares its hosts twice: in
|
|
131
|
+
* its export, which is what the web reads (the worker proxies exactly the
|
|
132
|
+
* exported `hosts` of the plugins in its build, see
|
|
133
|
+
* scripts/generate-web-proxy-hosts.ts), and in gloom.json, which is what the
|
|
134
|
+
* plugin directory shows. Terminal and desktop reach any host, so a host
|
|
135
|
+
* missing from the export works there and fails only on the web.
|
|
136
|
+
*
|
|
137
|
+
* Hosts are found by a regex over the source, so a page the plugin only opens
|
|
138
|
+
* as a link is found too; gloom.json `linkHosts` names those.
|
|
139
|
+
*/
|
|
140
|
+
export function pluginHostChecks(
|
|
141
|
+
sources: readonly string[],
|
|
142
|
+
exported: readonly string[],
|
|
143
|
+
manifest: { hosts: readonly string[] | null; linkHosts: readonly string[] },
|
|
144
|
+
): Array<{ status: PluginCheckStatus; message: string }> {
|
|
145
|
+
const declared = exported.map((host) => host.toLowerCase());
|
|
146
|
+
const listed = manifest.hosts ?? [];
|
|
147
|
+
const seen = new Set<string>();
|
|
148
|
+
for (const text of sources) {
|
|
149
|
+
for (const match of text.matchAll(HOST_LITERAL_PATTERN)) {
|
|
150
|
+
const host = match[1]!.toLowerCase();
|
|
151
|
+
if (!IGNORED_HOST_PATTERN.test(host)) seen.add(host);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
const known = [...declared, ...listed, ...manifest.linkHosts];
|
|
155
|
+
const undeclared = [...seen].filter((host) => !hostCovered(host, known)).sort();
|
|
156
|
+
const notExported = listed.filter((host) => !hostCovered(host, declared));
|
|
157
|
+
const notListed = manifest.hosts ? declared.filter((host) => !hostCovered(host, listed)) : [];
|
|
158
|
+
|
|
159
|
+
const checks: Array<{ status: PluginCheckStatus; message: string }> = [];
|
|
160
|
+
if (undeclared.length > 0) {
|
|
161
|
+
checks.push({ status: "warn", message: `In source but not declared: ${undeclared.join(", ")}. A host it fetches goes in hosts, in the plugin and in gloom.json; a page it only opens goes in linkHosts in gloom.json.` });
|
|
162
|
+
}
|
|
163
|
+
if (notExported.length > 0) {
|
|
164
|
+
checks.push({ status: "warn", message: `In gloom.json but not in the plugin's hosts: ${notExported.join(", ")}. The web proxies only the hosts the plugin exports.` });
|
|
165
|
+
}
|
|
166
|
+
if (notListed.length > 0) {
|
|
167
|
+
checks.push({ status: "warn", message: `In the plugin's hosts but not in gloom.json: ${notListed.join(", ")}. The plugin directory shows gloom.json's.` });
|
|
168
|
+
}
|
|
169
|
+
if (checks.length === 0) {
|
|
170
|
+
checks.push({ status: "ok", message: declared.length ? declared.join(", ") : "no third-party hosts found" });
|
|
171
|
+
}
|
|
172
|
+
return checks;
|
|
173
|
+
}
|
|
174
|
+
|
|
129
175
|
/** Host imports the compat tables list, as `name from gloomberb/x (...)` lines. */
|
|
130
176
|
function listedHostImports<T>(
|
|
131
177
|
sources: readonly string[],
|
|
@@ -193,7 +239,8 @@ async function doctorPlugin(nameOrPath: string): Promise<PluginDoctorReport> {
|
|
|
193
239
|
else add("host-link", "ok", `linked ${link.linked.join(", ")}`);
|
|
194
240
|
|
|
195
241
|
const incompatible = checkPluginCompatibility(candidate);
|
|
196
|
-
const
|
|
242
|
+
const manifest = readPluginManifest(candidate);
|
|
243
|
+
const declaredMin = manifest.minGloomberb;
|
|
197
244
|
// The loader skips this check for a linked checkout, so it only warns there.
|
|
198
245
|
if (incompatible) add("gloom", linked ? "warn" : "fail", incompatible.error);
|
|
199
246
|
else if (declaredMin) add("gloom", "ok", `${formatVersion(declaredMin)} or newer`);
|
|
@@ -237,23 +284,7 @@ async function doctorPlugin(nameOrPath: string): Promise<PluginDoctorReport> {
|
|
|
237
284
|
else add("config-schema", "ok", `${plugin.configSchema.length} setting${plugin.configSchema.length === 1 ? "" : "s"}`);
|
|
238
285
|
}
|
|
239
286
|
|
|
240
|
-
const
|
|
241
|
-
const seenHosts = new Set<string>();
|
|
242
|
-
for (const text of sources) {
|
|
243
|
-
for (const match of text.matchAll(HOST_LITERAL_PATTERN)) {
|
|
244
|
-
const host = match[1]!.toLowerCase();
|
|
245
|
-
if (IGNORED_HOST_PATTERN.test(host)) continue;
|
|
246
|
-
seenHosts.add(host);
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
const undeclared = [...seenHosts].filter((host) => !hostCovered(host, declaredHosts)).sort();
|
|
250
|
-
if (undeclared.length > 0) {
|
|
251
|
-
// A regex over source: a link the plugin only opens in the browser shows
|
|
252
|
-
// up too, so this is a prompt to check, not a verdict.
|
|
253
|
-
add("hosts", "warn", `In source but not in hosts: ${undeclared.join(", ")}. Anything fetched from there works on desktop and fails on the web.`);
|
|
254
|
-
} else {
|
|
255
|
-
add("hosts", "ok", declaredHosts.length ? declaredHosts.join(", ") : "no third-party hosts found");
|
|
256
|
-
}
|
|
287
|
+
for (const check of pluginHostChecks(sources, plugin.hosts ?? [], manifest)) add("hosts", check.status, check.message);
|
|
257
288
|
|
|
258
289
|
const rendersInBrowser = pluginSupportsTarget(plugin, "desktop") || pluginSupportsTarget(plugin, "web");
|
|
259
290
|
if (rendersInBrowser) {
|