gloomberb 0.20.1 → 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 +16 -26
- package/README.zh-CN.md +21 -65
- package/package.json +2 -1
- package/src/account/auth-form.tsx +13 -8
- package/src/account/auth-model.ts +20 -1
- package/src/account/upgrade-dialog.tsx +8 -4
- package/src/api-client/askg.ts +7 -1
- package/src/api-client/auth.ts +27 -0
- package/src/api-client/catalysts.ts +2 -0
- package/src/api-client/central-bank-rates.ts +5 -0
- package/src/api-client/company-kpis.ts +2 -1
- package/src/api-client/cot.ts +14 -2
- package/src/api-client/data.ts +20 -6
- package/src/api-client/debt-maturities.ts +45 -2
- package/src/api-client/earnings.ts +50 -5
- package/src/api-client/errors.ts +21 -11
- package/src/api-client/futures-curve.ts +17 -0
- package/src/api-client/index.ts +5 -1
- package/src/api-client/one-tap-reasons.ts +42 -0
- package/src/api-client/paths.ts +9 -1
- package/src/api-client/perps.ts +2 -1
- package/src/api-client/request.ts +3 -1
- package/src/api-client/research-activity.ts +16 -3
- package/src/api-client/social-mentions.ts +47 -0
- package/src/api-client/types/econ.ts +4 -0
- package/src/api-client/types/filings-and-calls.ts +3 -0
- package/src/api-client/types/search.ts +3 -0
- package/src/app/keybindings/chord.ts +153 -9
- package/src/app/keybindings/index.ts +1 -1
- package/src/app/keybindings/labels.ts +49 -6
- package/src/app/runtime/desktop-deeplink.ts +73 -8
- package/src/app.tsx +18 -2
- package/src/architecture/core-builtin-allowlist.json +1 -2
- package/src/architecture/pane-tabs-allowlist.json +2 -1
- package/src/architecture/shortcut-labels-allowlist.json +11 -0
- package/src/architecture/ui-literals-allowlist.json +8 -8
- package/src/brokers/broker-portfolio-sync.ts +1 -1
- package/src/cli/bank-section.ts +26 -12
- package/src/cli/command-options.ts +2 -1
- package/src/cli/commands/market.ts +372 -99
- 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 +16 -9
- package/src/cli/desktop-pane-shot-browser.ts +47 -31
- package/src/cli/desktop-pane-shot.ts +15 -0
- package/src/cli/entry.ts +5 -0
- package/src/cli/export-source.ts +7 -1
- package/src/cli/freshness.ts +0 -16
- package/src/cli/fx-pair.ts +64 -12
- package/src/cli/fx-quote-rate.ts +192 -0
- package/src/cli/glossary.ts +100 -15
- package/src/cli/history-back-adjust.ts +122 -0
- package/src/cli/history-rows.ts +122 -34
- package/src/cli/index.ts +6 -35
- package/src/cli/known-gaps.ts +48 -6
- package/src/cli/listing-arg.ts +125 -21
- package/src/cli/name-entries.ts +26 -5
- package/src/cli/not-a-ticker.ts +6 -2
- package/src/cli/pane-functions/capabilities.ts +12 -1
- package/src/cli/pane-functions/catalog.ts +12 -2
- package/src/cli/pane-functions/dom.ts +4 -2
- package/src/cli/pane-functions/function-help.ts +23 -11
- package/src/cli/pane-functions/headless.ts +11 -6
- package/src/cli/pane-functions/index.ts +35 -4
- package/src/cli/pane-functions/market-session.ts +8 -3
- package/src/cli/pane-functions/resolver.ts +22 -12
- package/src/cli/pane-functions/screenshot-assessment.ts +15 -3
- package/src/cli/pane-functions/screenshot-payload.ts +166 -72
- package/src/cli/pane-functions/screenshot-render.ts +18 -2
- package/src/cli/pane-functions/screenshot-types.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 +71 -4
- package/src/cli/ticker-resolution.ts +171 -21
- package/src/cli/unknown-command.ts +88 -0
- package/src/components/chart/composite/axis-overlays.tsx +13 -3
- package/src/components/chart/composite/composite-chart.tsx +8 -1
- package/src/components/chart/composite/format.ts +16 -1
- package/src/components/chart/composite/legend.tsx +4 -3
- package/src/components/chart/composite/panel-labels.ts +2 -1
- package/src/components/chart/composite/panel-surface.tsx +33 -4
- package/src/components/chart/composite/time-scale.ts +1 -1
- package/src/components/chart/composite/toolbar.tsx +8 -4
- package/src/components/chart/composite/types.ts +17 -1
- package/src/components/chart/composite/use-composite-chart-keyboard.ts +15 -5
- package/src/components/chart/composite/use-composite-viewport.ts +31 -8
- package/src/components/chart/static/scatter-chart-surface.tsx +25 -9
- package/src/components/chart-table/axis.ts +11 -0
- package/src/components/command-bar/assist/inventory.ts +3 -2
- package/src/components/command-bar/assist/model.ts +6 -1
- package/src/components/command-bar/commands/collection-list.ts +3 -2
- 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/layout.ts +8 -1
- package/src/components/command-bar/panel/prompt-binding.ts +4 -0
- package/src/components/command-bar/panel/prompt-width.ts +34 -0
- package/src/components/command-bar/panel/state.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/root/search-providers.ts +3 -2
- package/src/components/command-bar/routes/root/search-report.ts +2 -2
- 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/ticker-listing-picker.ts +1 -0
- package/src/components/command-bar/workflow/tickers.ts +3 -2
- package/src/components/company-logo.tsx +22 -4
- package/src/components/data-table/export.ts +13 -8
- package/src/components/data-table/view.tsx +11 -2
- package/src/components/feed-data-table/stack-view.tsx +20 -6
- package/src/components/feedback-dialog.tsx +5 -2
- package/src/components/form-modal/field-row.tsx +3 -2
- package/src/components/form-modal/routes.ts +1 -0
- package/src/components/index.ts +1 -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 +87 -47
- package/src/components/layout/market-summary.ts +323 -116
- package/src/components/layout/pane/footer/index.tsx +31 -9
- package/src/components/layout/pane/footer/model.ts +63 -21
- package/src/components/layout/pane/footer/registration.tsx +60 -1
- package/src/components/layout/pane/header-tabs.tsx +17 -3
- package/src/components/layout/pane/header.tsx +8 -4
- package/src/components/layout/pane/pane-tabs.tsx +57 -3
- package/src/components/layout/shell/active-drag.ts +38 -30
- package/src/components/layout/shell/chrome.ts +15 -15
- package/src/components/layout/shell/drag/index.ts +51 -21
- package/src/components/layout/shell/menu.ts +3 -5
- package/src/components/layout/shell/pane/actions.ts +4 -1
- package/src/components/layout/shell/pane/ask.ts +5 -2
- package/src/components/layout/status-bar.tsx +63 -57
- package/src/components/layout/status-widget-space.ts +8 -0
- package/src/components/markdown-editor.tsx +2 -2
- package/src/components/markdown-text.tsx +35 -10
- package/src/components/onboarding/account-step/form-panel.tsx +0 -3
- package/src/components/onboarding/first-run-workspace.ts +25 -23
- package/src/components/onboarding/onboarding-keyboard.ts +21 -7
- package/src/components/onboarding/onboarding-wizard.tsx +73 -13
- package/src/components/onboarding/portfolio-step/broker-fields-panel.tsx +0 -1
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +3 -5
- package/src/components/onboarding/use-onboarding-broker-form.ts +2 -1
- package/src/components/onboarding/use-onboarding-progress.ts +11 -4
- package/src/components/onboarding/use-onboarding-upgrade.ts +3 -2
- package/src/components/onboarding/wizard-positions.ts +8 -1
- package/src/components/pane-notice-seen.ts +125 -0
- package/src/components/pane-settings-dialog/field-dialogs.tsx +2 -1
- package/src/components/pane-settings-dialog.tsx +7 -6
- package/src/components/price-sparkline/model.ts +26 -10
- package/src/components/sign-in-code-panel.tsx +3 -2
- package/src/components/speedometer-gauge/terminal.tsx +30 -9
- package/src/components/ticker/list-table-view.tsx +68 -7
- package/src/components/ui/button.tsx +13 -2
- package/src/components/ui/column-grid.tsx +18 -9
- package/src/components/ui/confirm-dialog.tsx +2 -1
- package/src/components/ui/data-table/index.tsx +5 -3
- package/src/components/ui/data-table/opentui/index.tsx +17 -6
- package/src/components/ui/data-table/types.ts +26 -0
- package/src/components/ui/delayed-mark.tsx +3 -2
- package/src/components/ui/external-link.tsx +4 -1
- package/src/components/ui/field-grid.tsx +1 -3
- package/src/components/ui/fields.tsx +7 -4
- package/src/components/ui/index.ts +2 -0
- package/src/components/ui/inline-quick-add.tsx +7 -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/multi-select/dialog.tsx +10 -9
- package/src/components/ui/pane-link-chip.tsx +354 -0
- package/src/components/ui/query-bar.tsx +22 -13
- package/src/components/ui/ratio-bar.tsx +24 -1
- package/src/components/ui/select-button.tsx +2 -1
- package/src/components/ui/shortcut-hint.tsx +32 -4
- package/src/components/ui/table-layout.ts +81 -0
- package/src/components/ui/tabs.tsx +52 -6
- package/src/components/ui/text-prompt-dialog.tsx +2 -1
- package/src/components/use-pane-notice-footer.tsx +12 -4
- package/src/core/app-service-ports.ts +1 -1
- package/src/core/state/app/command-bar-launch.ts +3 -0
- package/src/data/config/store/normalize.ts +6 -0
- package/src/data/plugin-state-store.ts +44 -8
- package/src/docs/snapshot.json +172 -100
- package/src/i18n/es.ts +48 -6
- package/src/i18n/ja.ts +48 -5
- package/src/i18n/ko.ts +48 -5
- package/src/i18n/zh-cn.ts +48 -5
- package/src/i18n/zh-tw.ts +48 -5
- package/src/layout/pane-manager/gridlock-inference.ts +2 -1
- package/src/layout/pane-manager/gridlock.ts +58 -2
- package/src/layout-marketplace/api.ts +1 -0
- package/src/layout-marketplace/gallery.tsx +4 -3
- package/src/layout-marketplace/linked.ts +6 -4
- package/src/layout-marketplace/model.ts +3 -2
- 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 +86 -34
- package/src/market-data/fx-closes.ts +5 -2
- package/src/market-data/hooks.tsx +23 -0
- package/src/market-data/market/change-basis.ts +74 -16
- package/src/market-data/market/dated-previous-close.ts +163 -47
- package/src/market-data/market/format.ts +33 -14
- package/src/market-data/market/freshness.ts +24 -7
- package/src/market-data/market/globex-day.ts +73 -0
- package/src/market-data/market/header-market.ts +154 -0
- package/src/market-data/market/index-level.ts +39 -1
- 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/intraday-bar.ts +1 -1
- package/src/market-data/quotes/session-split.ts +28 -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 +3 -3
- 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/account-returns.ts +1 -1
- package/src/plugins/builtin/analytics/index.tsx +10 -3
- package/src/plugins/builtin/analytics/pane-model.ts +1 -1
- package/src/plugins/builtin/analytics/risk-client.ts +64 -40
- package/src/plugins/builtin/analytics/risk-episodes.ts +440 -0
- package/src/plugins/builtin/analytics/risk-fx.ts +1 -1
- package/src/plugins/builtin/analytics/risk-headless.ts +44 -10
- package/src/plugins/builtin/analytics/risk-math.ts +1 -1
- package/src/plugins/builtin/analytics/risk-model.ts +183 -27
- package/src/plugins/builtin/analytics/risk-pane.tsx +216 -26
- package/src/plugins/builtin/analytics/sharpe-cadence.ts +1 -1
- package/src/plugins/builtin/backtest/engine.ts +4 -2
- package/src/plugins/builtin/backtest/format.ts +14 -0
- package/src/plugins/builtin/backtest/pane.tsx +3 -3
- package/src/plugins/builtin/backtest/report.ts +5 -3
- package/src/plugins/builtin/backtest/window.ts +3 -1
- package/src/plugins/builtin/broker-manager/add-request.ts +10 -1
- package/src/plugins/builtin/broker-manager/sign-in-end.ts +1 -1
- package/src/plugins/builtin/broker-trading/pane.tsx +20 -2
- package/src/plugins/builtin/buildout/company/flow.tsx +5 -5
- package/src/plugins/builtin/buildout/company/model.ts +14 -2
- package/src/plugins/builtin/catalysts/detail.tsx +2 -2
- package/src/plugins/builtin/catalysts/model.ts +7 -2
- package/src/plugins/builtin/catalysts/pane.tsx +2 -2
- 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/chat/message/pane-chip.tsx +36 -208
- package/src/plugins/builtin/cloud/askg/answer-follow-ups.tsx +61 -0
- package/src/plugins/builtin/cloud/askg/answer-sources.tsx +102 -0
- package/src/plugins/builtin/cloud/askg/controller.ts +7 -1
- package/src/plugins/builtin/cloud/askg/host.ts +57 -0
- package/src/plugins/builtin/cloud/askg/model.ts +45 -5
- package/src/plugins/builtin/cloud/askg/pane.tsx +304 -25
- package/src/plugins/builtin/cloud/askg/protocol.ts +26 -1
- package/src/plugins/builtin/cloud/askg/sources.ts +466 -0
- package/src/plugins/builtin/cloud/one-tap/controller.ts +309 -0
- package/src/plugins/builtin/cloud/one-tap/google-identity.ts +142 -0
- package/src/plugins/builtin/cloud/one-tap/one-tap-prompt.tsx +101 -0
- package/src/plugins/builtin/cloud/plugin.tsx +7 -1
- package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +9 -2
- package/src/plugins/builtin/company-kpis/client.ts +4 -3
- package/src/plugins/builtin/company-kpis/model.ts +34 -3
- package/src/plugins/builtin/correlation/index.tsx +39 -167
- package/src/plugins/builtin/correlation/matrix/grid.tsx +285 -0
- package/src/plugins/builtin/correlation/relationship/pane.tsx +6 -7
- package/src/plugins/builtin/correlation/relationship/view-model.ts +14 -5
- package/src/plugins/builtin/cot/client.ts +8 -3
- package/src/plugins/builtin/cot/headless.ts +65 -12
- package/src/plugins/builtin/cot/pane.tsx +11 -5
- 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/earnings/client.ts +40 -6
- package/src/plugins/builtin/earnings/fiscal-quarter.ts +54 -0
- package/src/plugins/builtin/earnings/headless.ts +47 -11
- package/src/plugins/builtin/earnings/history-model.ts +136 -24
- package/src/plugins/builtin/earnings/history-table.ts +42 -10
- package/src/plugins/builtin/earnings/history.tsx +23 -8
- package/src/plugins/builtin/earnings-ripple/client.ts +5 -2
- package/src/plugins/builtin/earnings-ripple/headless.ts +8 -3
- package/src/plugins/builtin/earnings-ripple/model.ts +21 -0
- package/src/plugins/builtin/earnings-ripple/pane.tsx +2 -3
- 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 +10 -7
- package/src/plugins/builtin/econ/types.ts +5 -0
- package/src/plugins/builtin/econ-statistics/stats.ts +13 -5
- package/src/plugins/builtin/equity-screener/footer.ts +45 -0
- package/src/plugins/builtin/equity-screener/headless.ts +2 -1
- 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/filing-events/feed.ts +56 -18
- package/src/plugins/builtin/filing-events/pane.tsx +8 -2
- package/src/plugins/builtin/fixed-income/model.ts +1 -0
- package/src/plugins/builtin/futures/index.tsx +32 -10
- package/src/plugins/builtin/futures/model.ts +93 -6
- package/src/plugins/builtin/futures/returns.ts +29 -7
- package/src/plugins/builtin/futures/table.tsx +59 -17
- package/src/plugins/builtin/futures/use-front-returns.ts +32 -6
- package/src/plugins/builtin/futures-curve/client.ts +12 -2
- package/src/plugins/builtin/futures-curve/headless.ts +58 -17
- package/src/plugins/builtin/futures-curve/model.ts +114 -25
- package/src/plugins/builtin/futures-curve/pane.tsx +11 -6
- package/src/plugins/builtin/fx-matrix/amount.ts +132 -0
- package/src/plugins/builtin/fx-matrix/headless.ts +53 -13
- package/src/plugins/builtin/fx-matrix/index.tsx +205 -42
- package/src/plugins/builtin/fx-matrix/pairs.ts +10 -8
- package/src/plugins/builtin/fx-matrix/settings.ts +22 -1
- package/src/plugins/builtin/help/function-card.tsx +2 -1
- package/src/plugins/builtin/help/function-index.ts +1 -0
- package/src/plugins/builtin/help/index.tsx +68 -61
- package/src/plugins/builtin/holders/format.ts +7 -2
- package/src/plugins/builtin/holders/pane.tsx +11 -3
- package/src/plugins/builtin/holders/report-header.ts +5 -4
- package/src/plugins/builtin/holders/report-rows.ts +4 -1
- package/src/plugins/builtin/holders/treemap.tsx +5 -3
- package/src/plugins/builtin/insider/client.ts +31 -14
- package/src/plugins/builtin/insider/signals-model.ts +6 -12
- package/src/plugins/builtin/ipo-calendar/headless.ts +18 -7
- package/src/plugins/builtin/ipo-calendar/listing-ipo.ts +3 -1
- package/src/plugins/builtin/ipo-calendar/model.ts +28 -8
- package/src/plugins/builtin/ipo-calendar/pane.tsx +2 -1
- 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 +68 -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 +189 -123
- package/src/plugins/builtin/perps/index.tsx +3 -1
- package/src/plugins/builtin/perps/markets-section.tsx +2 -2
- package/src/plugins/builtin/perps/model.ts +9 -5
- package/src/plugins/builtin/perps/open-market.ts +4 -4
- package/src/plugins/builtin/perps/pane.tsx +2 -0
- package/src/plugins/builtin/perps/venue-markets.ts +3 -6
- package/src/plugins/builtin/portfolio-list/cell-version.ts +2 -0
- package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +54 -11
- package/src/plugins/builtin/portfolio-list/cli/import-positions.ts +260 -0
- package/src/plugins/builtin/portfolio-list/cli/period-report.ts +180 -0
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +68 -22
- package/src/plugins/builtin/portfolio-list/cli/render.ts +82 -27
- package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +5 -3
- package/src/plugins/builtin/portfolio-list/grid.tsx +61 -15
- package/src/plugins/builtin/portfolio-list/headless.ts +128 -0
- package/src/plugins/builtin/portfolio-list/pane/data.ts +34 -1
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +48 -4
- package/src/plugins/builtin/portfolio-list/pane/period-pnl.ts +124 -0
- package/src/plugins/builtin/portfolio-list/pane/streaming.ts +15 -6
- package/src/plugins/builtin/portfolio-list/period-pnl.ts +179 -0
- package/src/plugins/builtin/portfolio-list/positions-import/dialog.tsx +445 -0
- package/src/plugins/builtin/portfolio-list/positions-import/index.tsx +255 -0
- package/src/plugins/builtin/portfolio-list/positions-import/lookup.ts +78 -0
- package/src/plugins/builtin/portfolio-list/positions-import/read-file.ts +32 -0
- package/src/plugins/builtin/portfolio-list/quick-add/index.tsx +186 -50
- package/src/plugins/builtin/portfolio-list/quick-add/resolution.ts +137 -11
- package/src/plugins/builtin/portfolio-list/settings.ts +25 -0
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +16 -1
- package/src/plugins/builtin/portfolio-list/summary/totals.ts +7 -5
- package/src/plugins/builtin/portfolio-list/table.tsx +134 -9
- package/src/plugins/builtin/power/headless.ts +47 -9
- 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/research/relative-valuation-model.ts +8 -3
- package/src/plugins/builtin/research-search/article.ts +12 -2
- package/src/plugins/builtin/research-search/data.ts +5 -2
- package/src/plugins/builtin/research-search/document-view.tsx +1 -1
- package/src/plugins/builtin/research-search/model.ts +47 -3
- package/src/plugins/builtin/research-search/pane.tsx +3 -2
- package/src/plugins/builtin/reverse-dcf/model.ts +7 -4
- package/src/plugins/builtin/risk-factors/headless.ts +3 -2
- package/src/plugins/builtin/risk-factors/pane.tsx +5 -3
- package/src/plugins/builtin/scanner/flow-model.ts +17 -13
- package/src/plugins/builtin/scanner/flow-pane.tsx +8 -9
- package/src/plugins/builtin/scanner/flow-session.ts +2 -9
- package/src/plugins/builtin/sec/filing-display.tsx +0 -5
- package/src/plugins/builtin/sec/forms.ts +19 -0
- package/src/plugins/builtin/sec/headless.ts +55 -17
- package/src/plugins/builtin/sec/index.tsx +17 -7
- package/src/plugins/builtin/sec/model.ts +4 -1
- package/src/plugins/builtin/shared/earnings-calendar.ts +8 -3
- package/src/plugins/builtin/shared/earnings-report.ts +1 -1
- package/src/plugins/builtin/shared/fx-rate-freshness.ts +0 -35
- 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 +47 -30
- 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-model.ts +7 -1
- package/src/plugins/builtin/supply-chain/graph-pane.tsx +2 -2
- package/src/plugins/builtin/supply-chain/headless.ts +20 -10
- package/src/plugins/builtin/supply-chain/model.ts +117 -20
- package/src/plugins/builtin/supply-chain/pane.tsx +22 -15
- package/src/plugins/builtin/supply-chain/row-evidence.tsx +1 -1
- 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/data-panes/returns-chart-model.ts +69 -0
- package/src/plugins/builtin/ticker-detail/data-panes/returns-chart.tsx +118 -0
- package/src/plugins/builtin/ticker-detail/data-panes/returns-model.ts +1 -1
- package/src/plugins/builtin/ticker-detail/data-panes/returns-pane.tsx +103 -40
- package/src/plugins/builtin/ticker-detail/financials/model.ts +5 -0
- package/src/plugins/builtin/ticker-detail/headless-schema.ts +12 -2
- package/src/plugins/builtin/ticker-detail/headless.ts +21 -59
- package/src/plugins/builtin/ticker-detail/index.tsx +5 -0
- package/src/plugins/builtin/ticker-detail/overview/components.tsx +15 -2
- package/src/plugins/builtin/ticker-detail/overview/model.ts +10 -6
- 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 +52 -14
- package/src/plugins/builtin/ticker-detail/pane.tsx +95 -20
- 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-groups.ts +89 -0
- package/src/plugins/builtin/ticker-detail/research-tabs.ts +1 -5
- package/src/plugins/builtin/ticker-detail/settings.ts +10 -9
- 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/volatility/charts.tsx +2 -2
- 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/host-resolver.ts +3 -2
- package/src/plugins/installer.ts +8 -3
- package/src/portfolio/column-values.ts +56 -12
- package/src/portfolio/futures-positions.ts +10 -2
- package/src/portfolio/listed-symbol.ts +78 -0
- package/src/portfolio/mutations.ts +4 -3
- package/src/portfolio/period-pnl.ts +119 -0
- package/src/portfolio/positions-import/describe.ts +89 -0
- package/src/portfolio/positions-import/parse.ts +682 -0
- package/src/portfolio/positions-import/plan.ts +295 -0
- package/src/portfolio/real-return.ts +172 -0
- package/src/{plugins/builtin/analytics/metrics.ts → portfolio/return-metrics.ts} +24 -11
- package/src/public/__snapshots__/public-api.test.ts.snap +2 -0
- package/src/react/jsx-dev-fallback.ts +62 -0
- package/src/renderers/browser/cloud-transport.ts +1 -1
- package/src/renderers/browser/config-host.ts +59 -16
- package/src/renderers/browser/deeplink-bridge.ts +8 -1
- package/src/renderers/browser/http-proxy-transport.ts +9 -2
- package/src/renderers/browser/main.tsx +5 -2
- package/src/renderers/browser/research-entry.ts +12 -0
- package/src/renderers/browser/ui-host.tsx +1 -0
- package/src/renderers/cloudflare/http-proxy.ts +9 -2
- package/src/renderers/cloudflare/proxy-session.ts +1 -0
- package/src/renderers/cloudflare/worker.ts +12 -3
- package/src/renderers/dom/boot-frame.ts +2 -2
- package/src/renderers/dom/data-table/row.tsx +4 -1
- package/src/renderers/dom/desktop/audio-player.tsx +2 -2
- package/src/renderers/dom/desktop/controls.tsx +5 -5
- package/src/renderers/dom/desktop/dialog-actions.tsx +62 -57
- package/src/renderers/dom/desktop/icons.tsx +4 -2
- package/src/renderers/dom/desktop/query-bar.tsx +23 -19
- package/src/renderers/dom/dom-host-providers.tsx +7 -2
- package/src/renderers/dom/dom-ui-host.tsx +3 -1
- package/src/renderers/dom/host/box.tsx +2 -2
- package/src/renderers/dom/host/input.tsx +17 -1
- package/src/renderers/dom/host/tabs.tsx +10 -1
- package/src/renderers/dom/key-event.ts +1 -0
- package/src/renderers/dom/styles.css +36 -13
- package/src/renderers/electrobun/bun/context-menu/click.ts +1 -0
- package/src/renderers/electrobun/bun/desktop/app-name.ts +1 -1
- package/src/renderers/electrobun/bun/desktop/backend.ts +1 -0
- package/src/renderers/electrobun/bun/desktop/capability-bridge.ts +5 -4
- package/src/renderers/electrobun/bun/desktop/host-requests.ts +5 -4
- package/src/renderers/electrobun/bun/desktop/http-fetch.ts +1 -0
- package/src/renderers/electrobun/bun/desktop/http-stream.ts +1 -1
- package/src/renderers/electrobun/bun/desktop/initialization.ts +3 -1
- package/src/renderers/electrobun/bun/desktop/install-records.ts +4 -1
- package/src/renderers/electrobun/bun/desktop/installer-folder.ts +5 -2
- package/src/renderers/electrobun/bun/desktop/macos-objc.ts +3 -1
- package/src/renderers/electrobun/bun/desktop/screen-setup-file.ts +9 -4
- package/src/renderers/electrobun/bun/desktop/update.ts +27 -13
- package/src/renderers/electrobun/bun/desktop/windows-script.ts +6 -2
- package/src/renderers/electrobun/bun/window/attention.ts +1 -0
- package/src/renderers/electrobun/bun/window/boot-frame.ts +1 -0
- package/src/renderers/electrobun/bun/window/create.ts +1 -0
- package/src/renderers/electrobun/bun/window/electrobun-window-host.ts +13 -8
- package/src/renderers/electrobun/bun/window/native-min-size.ts +1 -1
- package/src/renderers/electrobun/bun/window/remembered-frame.ts +1 -0
- package/src/renderers/electrobun/bun/window/windows-native.ts +3 -1
- package/src/renderers/electrobun/bun/window/windows-quit.ts +3 -1
- package/src/renderers/electrobun/view/app-badge-host.ts +2 -1
- package/src/renderers/electrobun/view/capability-subscription.ts +2 -1
- package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +7 -10
- package/src/renderers/electrobun/view/cli-pane-shot-mutations.ts +36 -0
- package/src/renderers/electrobun/view/http-fetch.ts +2 -1
- package/src/renderers/electrobun/view/main.tsx +9 -4
- package/src/renderers/electrobun/view/remote/capability-invoker.ts +6 -3
- package/src/renderers/electrobun/view/remote/persistence.ts +63 -27
- package/src/renderers/electrobun/view/rpc-timeout.ts +1 -0
- package/src/renderers/electrobun/view/ui-host.tsx +3 -2
- package/src/renderers/electrobun/view/window-fullscreen.ts +3 -1
- package/src/renderers/opentui/browser-open.ts +2 -1
- package/src/renderers/opentui/dialog-host.tsx +1 -1
- package/src/renderers/opentui/host.tsx +2 -1
- package/src/renderers/opentui/interaction-performance.ts +3 -1
- package/src/renderers/opentui/start.tsx +2 -1
- package/src/renderers/opentui/terminal-media.ts +11 -6
- package/src/renderers/opentui/ui-host.tsx +5 -8
- package/src/shares/open.ts +22 -1
- package/src/shares/pane.ts +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 +32 -3
- package/src/sources/provider-router/cached-routes.ts +19 -7
- package/src/state/pane-table-export-registry.ts +19 -6
- package/src/sync/analytics-payload.ts +194 -0
- package/src/sync/baseline.ts +19 -9
- package/src/sync/broker-identity.ts +171 -0
- package/src/sync/broker-instances.ts +137 -0
- package/src/sync/collections-contributor.ts +173 -0
- package/src/sync/config-contributor.ts +100 -0
- package/src/sync/config-merge.ts +229 -0
- package/src/sync/controller.ts +139 -28
- package/src/sync/core-contributors.ts +8 -1583
- package/src/sync/history-memo.ts +32 -0
- package/src/sync/layout-merge.ts +259 -0
- package/src/sync/sanitize.ts +114 -0
- package/src/sync/ticker-merge.ts +208 -0
- package/src/sync/ticker-payload.ts +81 -0
- package/src/sync/types.ts +15 -1
- package/src/telemetry/attention-setting.ts +1 -1
- package/src/telemetry/usage-counts.ts +16 -0
- package/src/test-support/preload.ts +9 -0
- package/src/theme/color-utils.ts +10 -0
- package/src/theme/colors.ts +9 -1
- package/src/theme/font-scale.ts +34 -3
- package/src/theme/series-colors.ts +44 -0
- package/src/theme/themes.ts +64 -16
- package/src/theme/tone-contrast.ts +40 -0
- package/src/theme/ui-tokens.ts +23 -3
- package/src/tickers/batched-lookups.ts +314 -8
- package/src/tickers/company-name-listing.ts +198 -14
- package/src/tickers/company-name.ts +37 -8
- 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/search/upsert.ts +16 -1
- package/src/tickers/terminal-codes.ts +26 -1
- package/src/time-series/base-series.ts +18 -4
- 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 +7 -2
- package/src/time-series/studies/resolve.ts +1 -1
- package/src/time-series/types.ts +14 -0
- package/src/types/config.ts +8 -0
- package/src/types/data-provider.ts +28 -0
- package/src/types/financials.ts +38 -2
- package/src/types/headless.ts +23 -0
- package/src/ui/host.tsx +34 -3
- package/src/ui/index.tsx +1 -0
- package/src/utils/concurrency.ts +6 -0
- package/src/utils/currency-pair.ts +56 -4
- package/src/utils/datetime-format.ts +28 -3
- package/src/utils/decimal-comma.ts +9 -6
- package/src/utils/display-number.ts +15 -0
- package/src/utils/double-escape-close.ts +61 -16
- package/src/utils/exchanges.ts +32 -0
- package/src/utils/float32-price.ts +24 -0
- package/src/utils/forward-dividend.ts +81 -16
- package/src/utils/fundamentals.ts +41 -0
- package/src/utils/fx-market-hours.ts +11 -0
- package/src/utils/markdown.ts +4 -2
- package/src/utils/pasted-lines.ts +14 -0
- package/src/utils/plugin-proxy-hosts.json +2 -1
- package/src/utils/price-history.ts +7 -6
- package/src/utils/price-window.ts +2 -1
- package/src/utils/report-timing.ts +62 -0
- package/src/utils/sec-filings.ts +49 -0
- package/src/utils/sec.ts +4 -23
- package/src/utils/shortcut-labels.ts +6 -30
- package/src/utils/utc-time.ts +5 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { logFailure } from "../../utils/log-failure";
|
|
2
|
+
import { normalizeTickerSymbol } from "../../tickers/search/ranking";
|
|
2
3
|
import type { CliCommandDef } from "../../types/plugin";
|
|
3
4
|
import { TIME_RANGES, type TimeRange } from "../../time-series/range";
|
|
4
5
|
import { CHART_RESOLUTION_STEP_MS } from "../../time-series/resolution";
|
|
5
6
|
import { yearToDateStartIndex } from "../../market-data/market/year-to-date";
|
|
6
|
-
import type { EarningsEvent, QuoteBatchResult, QuoteSubscriptionTarget, SecFilingItem } from "../../types/data-provider";
|
|
7
|
+
import type { EarningsEvent, MarketDataRequestContext, QuoteBatchResult, QuoteSubscriptionTarget, SecFilingItem } from "../../types/data-provider";
|
|
7
8
|
import { companyDataNotes, type CompanyFrom } from "../../types/company-from";
|
|
8
9
|
import type { NewsArticle, NewsFeed, NewsQuery } from "../../news/types";
|
|
9
10
|
import { newsSummaryLine } from "../../news/news-model";
|
|
@@ -13,12 +14,13 @@ import type {
|
|
|
13
14
|
CorporateActionsData,
|
|
14
15
|
HolderData,
|
|
15
16
|
OptionsChain,
|
|
17
|
+
PricePoint,
|
|
16
18
|
Quote,
|
|
17
19
|
TickerFinancials,
|
|
18
20
|
} from "../../types/financials";
|
|
19
21
|
import { currencyPriceMinDigits, formatMarketPrice, formatMarketPriceWithCurrency, nearParCoinPriceDigits, penceFigure, quoteFormatOptions, withCurrencyMinorDigits } from "../../market-data/market/format";
|
|
20
|
-
import { INDEX_POINTS_EXPORT_UNIT, isIndexLevel, reportedQuoteVolume } from "../../market-data/market/index-level";
|
|
21
|
-
import { changeBasisJson, changeBasisLabel, changeBasisNote, printPredatesChangeBasis, quoteChangeBasis, quotePreviousCloseDate, quoteSettleText } from "../../market-data/market/change-basis";
|
|
22
|
+
import { INDEX_POINTS_EXPORT_UNIT, indexBarVolume, isIndexLevel, reportedQuoteVolume, YIELD_INDEX_EXPORT_UNIT } from "../../market-data/market/index-level";
|
|
23
|
+
import { changeBasisJson, changeBasisLabel, changeBasisNote, futuresQuoteFromSettle, printPredatesChangeBasis, quoteChangeBasis, quotePreviousCloseDate, quoteSettleText } from "../../market-data/market/change-basis";
|
|
22
24
|
import {
|
|
23
25
|
EXTENDED_SESSION_LABELS,
|
|
24
26
|
getExtendedSessionDisplay,
|
|
@@ -58,7 +60,7 @@ import {
|
|
|
58
60
|
ratingReason,
|
|
59
61
|
} from "../../plugins/builtin/research/analyst-model";
|
|
60
62
|
import { getPublishedUsEquityCalendarYears, getPublishedUsEquitySession } from "../../market-data/published-us-sessions";
|
|
61
|
-
import { isQuoteStaleForCurrentSession, noPrintsTodayText } from "../../market-data/quotes/freshness";
|
|
63
|
+
import { awaitingFirstDelayedPrint, isQuoteStaleForCurrentSession, noPrintsTodayText } from "../../market-data/quotes/freshness";
|
|
62
64
|
import {
|
|
63
65
|
coinOptionsAlternativesText, isCoinWithoutOptions, isOptionsUnavailableError, listedOptionsAlternative, optionsUnavailableTitle,
|
|
64
66
|
} from "../../market-data/options-alternatives";
|
|
@@ -73,7 +75,7 @@ import { latestFinancialPeriod } from "../../utils/latest-financial-period";
|
|
|
73
75
|
import type { FuturesContractTermsPayload } from "../../api-client/futures-curve";
|
|
74
76
|
import { currencyCodeLabel } from "../../utils/currency-units";
|
|
75
77
|
import {
|
|
76
|
-
futuresContractLines, futuresPricePer, futuresRollLines, isFuturesInstrument, loadUsdPerMmbtu, usdPerMmbtuText, type UsdPerMmbtu,
|
|
78
|
+
futuresContractLines, futuresPricePer, futuresRollLines, futuresTickOption, isFuturesInstrument, loadFuturesPriceUnit, loadUsdPerMmbtu, usdPerMmbtuText, type UsdPerMmbtu,
|
|
77
79
|
} from "../../market-data/futures-contract";
|
|
78
80
|
import {
|
|
79
81
|
chainHasExpiry,
|
|
@@ -125,6 +127,8 @@ import {
|
|
|
125
127
|
type CliReportTables,
|
|
126
128
|
} from "../report-tables";
|
|
127
129
|
import { historyCoverageNotice } from "../../sources/history-coverage";
|
|
130
|
+
import { fetchHistoryResult } from "../../sources/history-result";
|
|
131
|
+
import { settleWithin } from "../../utils/async-deadline";
|
|
128
132
|
import { maxDrawdownText } from "../../utils/max-drawdown";
|
|
129
133
|
import { isPastPriceWindow, loadPriceWindowHistory, PRICE_WINDOW_FROM_HELP, PRICE_WINDOW_TO_HELP, priceWindowText, readPriceWindow, type PriceWindow } from "../../utils/price-window";
|
|
130
134
|
import {
|
|
@@ -144,6 +148,7 @@ import {
|
|
|
144
148
|
historyGapNote,
|
|
145
149
|
historyJumpNote,
|
|
146
150
|
historyUnbrokenFrom,
|
|
151
|
+
dailyRebuildSpans,
|
|
147
152
|
historyAllRangeYears,
|
|
148
153
|
historyIntervalsByRange,
|
|
149
154
|
historyMissingVolumeNote,
|
|
@@ -151,16 +156,20 @@ import {
|
|
|
151
156
|
historyNotes,
|
|
152
157
|
historyReportsVolume,
|
|
153
158
|
historyPriceDecimals,
|
|
159
|
+
historyRolls,
|
|
154
160
|
historyRows,
|
|
155
161
|
historyUnit,
|
|
156
162
|
quotedPriceDivisor,
|
|
163
|
+
withDailyRebuiltBars,
|
|
157
164
|
historyVolume,
|
|
158
165
|
historyVolumeBasis,
|
|
159
166
|
historyVolumeNote,
|
|
167
|
+
type HistoryRoll,
|
|
160
168
|
type HistoryRow,
|
|
161
169
|
type HistoryUnit,
|
|
162
170
|
type HistoryVolume,
|
|
163
171
|
} from "../history-rows";
|
|
172
|
+
import { backAdjustHistory, contractCloses, stitchedRollsNote, type BackAdjustMethod, type StitchedRoll } from "../history-back-adjust";
|
|
164
173
|
import {
|
|
165
174
|
historyExportColumns,
|
|
166
175
|
historyExportStatus,
|
|
@@ -170,10 +179,10 @@ import {
|
|
|
170
179
|
type HistoryListRow,
|
|
171
180
|
} from "../history-export";
|
|
172
181
|
import { fail, isCliFailure, NO_DATA_CODE } from "../errors";
|
|
173
|
-
import { mapWithConcurrency } from "../../utils/concurrency";
|
|
182
|
+
import { createConcurrencyLimiter, mapWithConcurrency } from "../../utils/concurrency";
|
|
174
183
|
import { MISSING_VOLUME_TEXT } from "../../utils/price-history-integrity";
|
|
175
184
|
import { CRYPTO_BOARD_HINT, quoteNotes } from "./crypto-hints";
|
|
176
|
-
import { bareFuturesCode, futuresBoardContract } from "../../market-data/futures-board";
|
|
185
|
+
import { bareFuturesCode, futuresBoardContract, futuresContractByWord } from "../../market-data/futures-board";
|
|
177
186
|
import { commodityNamedIn, commoditySearchName } from "../../market-data/commodity-names";
|
|
178
187
|
import { newsEmptyMessage } from "./news-hints";
|
|
179
188
|
import {
|
|
@@ -196,12 +205,14 @@ import {
|
|
|
196
205
|
searchNewsStories,
|
|
197
206
|
wordMeansMore,
|
|
198
207
|
} from "./news-search";
|
|
199
|
-
import { formatUtcTime } from "../../utils/utc-time";
|
|
208
|
+
import { displayTimeZone, formatUtcDayTime, formatUtcTime } from "../../utils/utc-time";
|
|
209
|
+
import { localReportTiming } from "../../utils/report-timing";
|
|
200
210
|
import { DAY_SO_FAR_TEXT, withSessionBar } from "../../time-series/session-bar";
|
|
201
211
|
import { isFiniteNumber } from "../../utils/guards";
|
|
202
212
|
import { exportedFundamentals } from "../../utils/price-earnings";
|
|
203
|
-
import {
|
|
204
|
-
import {
|
|
213
|
+
import { withBankEnterpriseValue } from "../../utils/fundamentals";
|
|
214
|
+
import { fundamentalsFreshness, quotesFreshness, rowsFreshness, valuationFreshness } from "../freshness";
|
|
215
|
+
import { fxPairListing, fxQuoteRateObservation, METAL_NAMES, readFxQuoteRate } from "../fx-quote-rate";
|
|
205
216
|
import { quoteBarNotes } from "../../market-data/quotes/intraday-bar";
|
|
206
217
|
import { cedearRatioText, depositaryPairText, isReceiptSide, listingCedearRatio, listingDepositaryPair } from "../../market-data/depositary-pair";
|
|
207
218
|
import { isPesoDollarPair, loadPesoDollarRates, pesoDollarRateLines, pesoDollarRatesJson } from "../peso-dollar-rates";
|
|
@@ -252,6 +263,7 @@ import {
|
|
|
252
263
|
movedSymbolLine,
|
|
253
264
|
ListingArgError,
|
|
254
265
|
isNoProviderError,
|
|
266
|
+
isTitleCaseWord,
|
|
255
267
|
requireCliListing,
|
|
256
268
|
resolveCliListing,
|
|
257
269
|
type CliListing,
|
|
@@ -259,10 +271,10 @@ import {
|
|
|
259
271
|
} from "../listing-arg";
|
|
260
272
|
import { currencyNameMiss, currencyNameStop } from "../currency-name-hint";
|
|
261
273
|
import { liveCompanyQuestion } from "../company-name-hint";
|
|
262
|
-
import { bareListingNote, listingFateNotes, loadNoQuoteLastTraded, noLongerTradingNote, noQuoteLastTraded, noQuoteLastTradeNote, SUCCESSOR_CHANGE_WAIT_MS, tradingListing, usVenueOf } from "../../tickers/listing-fate";
|
|
274
|
+
import { bareListingNote, listingFateNotes, loadNoQuoteLastTraded, noLongerTradingNote, noQuoteLastTraded, noQuoteLastTradeNote, SUCCESSOR_CHANGE_WAIT_MS, tradingListing, usVenueOf, type NoQuoteLastTrade } from "../../tickers/listing-fate";
|
|
263
275
|
import { isYieldIndexSymbol } from "../../tickers/index-roots";
|
|
264
276
|
import {
|
|
265
|
-
analyzeTaxEquivalent, distributionBasis, loadTreasuryTenors, parseTaxRates, TAX_RATE_HELP_OPTIONS, taxEquivalentJson, type TaxRates,
|
|
277
|
+
analyzeTaxEquivalent, distributionBasis, loadTreasuryTenors, noBondFigures, parseTaxRates, TAX_RATE_HELP_OPTIONS, taxEquivalentJson, type TaxRates,
|
|
266
278
|
} from "../../market-data/tax-equivalent";
|
|
267
279
|
import { CBOE_YIELD_INDEX_CLOSE } from "../../plugins/builtin/shared/treasury-cutoffs";
|
|
268
280
|
import { earningsCalendarFailure, earningsChoiceNote, earningsDateLabel, isListingAbroad, noListingCalendarNote, undatedListingsNote } from "../earnings-calendar";
|
|
@@ -284,6 +296,7 @@ import { phraseSearchReport } from "./search";
|
|
|
284
296
|
import { secRegistrantMismatchMessage, SecRegistrantMismatchError, areDifferentCompanies } from "../../sources/sec-registrant";
|
|
285
297
|
import { isCryptoPairSymbol, isRoundTheClockCoin } from "../../utils/crypto-pair";
|
|
286
298
|
import { isUsListingExchange } from "../../utils/exchanges";
|
|
299
|
+
import { resolveTickerInstrumentKind } from "../../tickers/instrument-kind";
|
|
287
300
|
import {
|
|
288
301
|
describeFormerIssuer, describeTickerChange, movedAwayChange, startTickerChangeLookup, tickerChangeLine, type FormerIssuer, type TickerChange,
|
|
289
302
|
} from "../../tickers/ticker-changes";
|
|
@@ -291,7 +304,7 @@ import { noSecReportsNotice, nonUsSecListingVenue, secFilingItemCodes } from "..
|
|
|
291
304
|
import type { MarketContext } from "../types";
|
|
292
305
|
import { windowRows } from "../row-window";
|
|
293
306
|
import { answerQuote, errorMessage, notUsTickerSentence } from "../quote-answer";
|
|
294
|
-
import { crossRate, describeFxConversion, describeFxRate, formatFxRate, FX_USAGE,
|
|
307
|
+
import { crossRate, describeFxConversion, describeFxLegs, describeFxRate, formatFxRate, FX_USAGE, parseFxArgs, type FxQuotedFigure } from "../fx-pair";
|
|
295
308
|
import {
|
|
296
309
|
describeShortRate,
|
|
297
310
|
formatForwardPoints,
|
|
@@ -304,6 +317,9 @@ import {
|
|
|
304
317
|
} from "../fx-forward";
|
|
305
318
|
import { unavailableOnServer } from "../../plugins/builtin/shared/cloud-resource";
|
|
306
319
|
|
|
320
|
+
/** `08:00`: an instant's UTC clock. */
|
|
321
|
+
const utcClock = (time: number) => new Date(time).toISOString().slice(11, 16);
|
|
322
|
+
|
|
307
323
|
/** `fx`'s forward form, for its usage line. */
|
|
308
324
|
const FX_FORWARD_USAGE = "fx <base>/<quote> --forward <tenor>";
|
|
309
325
|
import {
|
|
@@ -337,8 +353,8 @@ import {
|
|
|
337
353
|
loadIndexedHolders,
|
|
338
354
|
withIndexedHolders,
|
|
339
355
|
} from "../../plugins/builtin/holders/index-holders";
|
|
340
|
-
import {
|
|
341
|
-
import { currentReportItemsLabel } from "../../utils/sec-filings";
|
|
356
|
+
import { loadShownSecFilings } from "../../plugins/builtin/sec/forms";
|
|
357
|
+
import { currentReportItemsLabel, form4TradeText, hiddenFilingsMetadata, hiddenFilingsNote, type HiddenFilings } from "../../utils/sec-filings";
|
|
342
358
|
import { INSIDER_REPORT_FILINGS, loadParsedInsiderFilings } from "../../plugins/builtin/insider/client";
|
|
343
359
|
import { insiderEmptyNotice, loadHomeInsiderReportsNote } from "../../plugins/builtin/insider/issuer";
|
|
344
360
|
import { buildInsiderSummary } from "../../plugins/builtin/insider/model";
|
|
@@ -422,9 +438,12 @@ function normalizeSymbols(args: string[]): string[] {
|
|
|
422
438
|
return uniqueEntries(splitSymbolArgs(args));
|
|
423
439
|
}
|
|
424
440
|
|
|
425
|
-
/**
|
|
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
|
+
*/
|
|
426
445
|
function uniqueEntries(entries: readonly string[]): string[] {
|
|
427
|
-
return uniqueSecuritySymbols(entries.map((entry) => isCompanyNameInput(entry) ? entry : entry.toUpperCase()));
|
|
446
|
+
return uniqueSecuritySymbols(entries.map((entry) => isCompanyNameInput(entry) || isTitleCaseWord(entry) ? entry : entry.toUpperCase()));
|
|
428
447
|
}
|
|
429
448
|
|
|
430
449
|
/**
|
|
@@ -549,7 +568,8 @@ const CHANGE_BASIS_EXPORT_COLUMNS = [
|
|
|
549
568
|
* low and high) are already in the table's own cells.
|
|
550
569
|
*/
|
|
551
570
|
function quoteTextColumns<Column extends { key: string }>(columns: Column[]): Array<Column | typeof CHANGE_BASIS_COLUMN> {
|
|
552
|
-
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));
|
|
553
573
|
const kept = columns.filter((column) => !exported.has(column.key));
|
|
554
574
|
const at = kept.findIndex((column) => column.key === "changePercent") + 1;
|
|
555
575
|
return [...kept.slice(0, at), CHANGE_BASIS_COLUMN, ...kept.slice(at)];
|
|
@@ -666,6 +686,14 @@ function quoteColumns() {
|
|
|
666
686
|
];
|
|
667
687
|
}
|
|
668
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
|
+
|
|
669
697
|
/** The day's low and high as numbers, after the columns an export already had. */
|
|
670
698
|
const DAY_RANGE_EXPORT_COLUMNS = [
|
|
671
699
|
{ key: "dayLow", header: "Day Low", value: (row: QuoteRow) => exportFigure(row.rawDayLow) },
|
|
@@ -755,6 +783,8 @@ function quoteRows(results: QuoteCliRecord[], now = Date.now()) {
|
|
|
755
783
|
const nearParDigits = nearParCoinPriceDigits(quote);
|
|
756
784
|
const options = {
|
|
757
785
|
...quoteFormatOptions(quote),
|
|
786
|
+
// A contract prints to its tick: the yen's 0.0063270, the euro's 1.11570.
|
|
787
|
+
...futuresTickOption(result.futuresContract),
|
|
758
788
|
minimumFractionDigits: indexPoints ? 2 : currencyPriceMinDigits(quote?.currency),
|
|
759
789
|
// A coin near a dollar prints to four decimals, as `ticker`, `G` and CRYP print it.
|
|
760
790
|
...nearParDigits != null ? { fixedFractionDigits: nearParDigits } : {},
|
|
@@ -859,6 +889,8 @@ function filingRows(filings: SecFilingItem[]) {
|
|
|
859
889
|
items: secFilingItemCodes(filing.items) ?? "",
|
|
860
890
|
// A current report's items by number and name: the results 8-K reads apart from another filed that day.
|
|
861
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) ?? "",
|
|
862
894
|
}));
|
|
863
895
|
}
|
|
864
896
|
|
|
@@ -996,6 +1028,10 @@ function earningsRows(events: ResolvedEarningsEvent[]) {
|
|
|
996
1028
|
// Out, announced by the company, or projected from its past reports.
|
|
997
1029
|
status: earningsDateLabel(event.dateStatus),
|
|
998
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) ?? "",
|
|
999
1035
|
epsEstimate: event.epsEstimate,
|
|
1000
1036
|
epsActual: event.epsActual,
|
|
1001
1037
|
revenueEstimate: event.revenueEstimate,
|
|
@@ -1095,9 +1131,11 @@ async function runQuote(rawArgs: string[], ctx: Parameters<CliCommandDef["execut
|
|
|
1095
1131
|
const formerIssuers = symbolChanges.map(({ formerIssuer }) => formerIssuer);
|
|
1096
1132
|
// A symbol with no quote whose bars stopped over a month ago says when it last traded, in place of why no quote
|
|
1097
1133
|
// came: no longer listed on the service's record (FLAT, a retired ETN), else no trades since. Each costs a history
|
|
1098
|
-
// read, so a long list says only why.
|
|
1099
|
-
|
|
1100
|
-
|
|
1134
|
+
// read, so a long list says only why. A quote the service did not answer is asked after too: a dead listing's
|
|
1135
|
+
// quote can fail where its history still says when it stopped (FRC), and an unreachable service fails it at once.
|
|
1136
|
+
const lastTraded = await Promise.all(answers.map(async ({ result, listing }) => !result.quote && answers.length <= MAX_CHOICE_LOOKUPS
|
|
1137
|
+
? await loadNoQuoteLastTraded(listing.request, market.dataProvider, now) ?? await searchedDelisting(listing, market)
|
|
1138
|
+
: null));
|
|
1101
1139
|
const endedNotes = answers.map(({ listing }, index) => lastTraded[index] ? `${noQuoteLastTradeNote(listing.symbol, lastTraded[index]!)}.` : null);
|
|
1102
1140
|
// A bare symbol whose listing stopped asks after the company by that name that still trades (DBS: D05 on SGX).
|
|
1103
1141
|
const liveCompanies = await Promise.all(answers.map(({ result, listing }) => result.quote && !listing.exchange
|
|
@@ -1112,6 +1150,14 @@ async function runQuote(rawArgs: string[], ctx: Parameters<CliCommandDef["execut
|
|
|
1112
1150
|
const contracts = await Promise.all(answers.map(({ result }) => commandName === "quote" && result.quote
|
|
1113
1151
|
? cliFuturesContract(result.quote.symbol || result.target.symbol, result.quote.instrumentType)
|
|
1114
1152
|
: null));
|
|
1153
|
+
// A future's move the source measured from something other than the session before's settlement of the same contract is measured from it, in the row and in every line.
|
|
1154
|
+
const sourceMoves = answers.map((answer, index) => {
|
|
1155
|
+
const sent = answer.result.quote;
|
|
1156
|
+
const quote = futuresQuoteFromSettle(sent, contracts[index]);
|
|
1157
|
+
if (!sent || quote === sent) return null;
|
|
1158
|
+
answers[index] = { ...answer, result: { ...answer.result, quote } };
|
|
1159
|
+
return { change: sent.change, changePercent: sent.changePercent, previousClose: sent.previousClose };
|
|
1160
|
+
});
|
|
1115
1161
|
// A contract that is not its root's front (NGF27, NG2) prints the front's own price beside it, read in one batch.
|
|
1116
1162
|
const fronts = await loadFuturesFrontQuotes(contracts, market.dataProvider);
|
|
1117
1163
|
// A per-MWh gas price (TTF) adds its dollars per MMBtu at the day's rate, to read beside Henry Hub.
|
|
@@ -1130,11 +1176,12 @@ async function runQuote(rawArgs: string[], ctx: Parameters<CliCommandDef["execut
|
|
|
1130
1176
|
const data = answers.map(({ result, listing, failure }, index) => ({
|
|
1131
1177
|
target: result.target,
|
|
1132
1178
|
listing: listingMetadata(listingIdentity(listing, result.quote)),
|
|
1133
|
-
// The figures the table shows, beside the quote as the source
|
|
1179
|
+
// The figures the table shows, beside the quote they come from: a future's move as the table measures it, and the source's own beside it when that differs.
|
|
1134
1180
|
...quoteSessionFields(result.quote),
|
|
1135
1181
|
// What `change` is measured from, with the label and holiday note the table shows.
|
|
1136
1182
|
changeBasis: changeBasisJson(quoteChangeBasis(result.quote, { terms: contracts[index] }), now),
|
|
1137
1183
|
quote: withPreviousCloseDate(result.quote),
|
|
1184
|
+
...sourceMoves[index] ? { sourceMove: sourceMoves[index] } : {},
|
|
1138
1185
|
...contracts[index] ? { futuresContract: contracts[index] } : {},
|
|
1139
1186
|
...fronts[index] ? { futuresFront: fronts[index] } : {},
|
|
1140
1187
|
...gasInUsd[index] ? { usdPerMmbtu: gasInUsd[index] } : {},
|
|
@@ -1164,21 +1211,39 @@ async function runQuote(rawArgs: string[], ctx: Parameters<CliCommandDef["execut
|
|
|
1164
1211
|
const label = `${row.target.symbol}${row.listing.name ? ` (${row.listing.name})` : ""}`;
|
|
1165
1212
|
const stopped = noLongerTradingNote(label, row.quote, now);
|
|
1166
1213
|
const ended = stopped && liveCompanies[index] ? `${stopped}. ${liveCompanies[index]}` : stopped;
|
|
1167
|
-
|
|
1168
|
-
|
|
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();
|
|
1169
1221
|
}),
|
|
1170
|
-
// 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.
|
|
1171
1224
|
...data.flatMap((row) => {
|
|
1172
1225
|
const cedear = listingCedearRatio({ quote: row.quote });
|
|
1173
1226
|
if (cedear) return [`${cedearRatioText(cedear)}.`];
|
|
1174
1227
|
const pair = listingDepositaryPair({ quote: row.quote });
|
|
1175
|
-
|
|
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)}.`] : [];
|
|
1176
1233
|
}),
|
|
1177
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
|
+
}),
|
|
1178
1242
|
// A cell shows only "unavailable", and an exported row only its status, so stderr names each failure; the JSON rows carry each reason.
|
|
1179
1243
|
...ctx.cliOptions.format !== "json" ? quoteNotes(data.filter((_row, index) => !endedNotes[index])) : [],
|
|
1180
1244
|
];
|
|
1181
|
-
const
|
|
1245
|
+
const holdsYield = data.some((row) => isYieldIndexSymbol(row.target.symbol));
|
|
1246
|
+
const columns = [...commandName === "compare" ? compareColumns() : quoteColumns(), ...holdsYield ? [CHANGE_BP_EXPORT_COLUMN] : []];
|
|
1182
1247
|
const basisNotes = changeBasisNotes(data, now);
|
|
1183
1248
|
const midNotes = extendedMidNotes(data);
|
|
1184
1249
|
if (ctx.cliOptions.format !== "json") await primeBoardCoins(notes);
|
|
@@ -1202,7 +1267,9 @@ async function runQuote(rawArgs: string[], ctx: Parameters<CliCommandDef["execut
|
|
|
1202
1267
|
symbolOrSeries: row.symbol,
|
|
1203
1268
|
// A pair's rate is its quote currency per base: JPY per USD, as `history` and `fx` export it.
|
|
1204
1269
|
currencyOrUnit: (row.currency && pairExportUnit(row.symbol, row.currency))
|
|
1205
|
-
|| 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,
|
|
1206
1273
|
}),
|
|
1207
1274
|
// A row with no price or move says why in its status column, as the warnings do.
|
|
1208
1275
|
exportStatus: quoteExportStatus,
|
|
@@ -1303,7 +1370,8 @@ function quoteFuturesContractText(data: QuoteCliRecord[]): string {
|
|
|
1303
1370
|
// The move Chg% gives, in the quote's money and with what it is measured from: "vs Fri settle".
|
|
1304
1371
|
const session = getRegularSessionDisplay(row.quote);
|
|
1305
1372
|
const change: Array<[string, string]> = session?.change != null && Number.isFinite(session.change)
|
|
1306
|
-
? [["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)]]
|
|
1307
1375
|
: [];
|
|
1308
1376
|
// European gas beside Henry Hub: "≈ $30.832/MMBtu at EUR/USD 1.1650", a conversion that says so.
|
|
1309
1377
|
const inUsd = row.usdPerMmbtu;
|
|
@@ -1427,6 +1495,43 @@ function historyCommand({ range, window }: HistoryAsk): string {
|
|
|
1427
1495
|
return window ? `history --from ${window.from}${isPastPriceWindow(window) ? ` --to ${window.to}` : ""}` : range === "1Y" ? "history" : `history --range ${range}`;
|
|
1428
1496
|
}
|
|
1429
1497
|
|
|
1498
|
+
/** How long `history` waits for a future's contract terms to name its unit before using the catalog's. */
|
|
1499
|
+
const HISTORY_PRICE_UNIT_WAIT_MS = 1_500;
|
|
1500
|
+
|
|
1501
|
+
/** How long `history` waits for the daily bars that rebuild contradictory monthly bars before printing them with blanks. */
|
|
1502
|
+
const MONTHLY_REBUILD_WAIT_MS = 8_000;
|
|
1503
|
+
/** Reads of daily bars in flight at once to rebuild them. */
|
|
1504
|
+
const MONTHLY_REBUILD_CONCURRENCY = 3;
|
|
1505
|
+
|
|
1506
|
+
/**
|
|
1507
|
+
* Monthly bars whose prices contradict each other, rebuilt from the daily
|
|
1508
|
+
* bars of the months they span (dailyRebuildSpans, withDailyRebuiltBars),
|
|
1509
|
+
* each day the one `venue` trades it on. Any other history, and months
|
|
1510
|
+
* whose daily bars fail or do not answer in time, come back as they are.
|
|
1511
|
+
*/
|
|
1512
|
+
async function withMonthlyBarsRebuilt(
|
|
1513
|
+
rows: HistoryRow[], market: MarketContext, symbol: string, exchange: string,
|
|
1514
|
+
context: MarketDataRequestContext, priceDivisor: number, venue: string,
|
|
1515
|
+
): Promise<HistoryRow[]> {
|
|
1516
|
+
const flagged = rows.filter((row) => row.interval === "1mo" && row.close != null && row.open == null && row.flag
|
|
1517
|
+
&& row.flag.split(",").some((code) => /^(high<|low>)/.test(code)));
|
|
1518
|
+
if (flagged.length === 0) return rows;
|
|
1519
|
+
// Neighbouring months share a read, a few reads at a time; what has come by the deadline is used, and no read starts after it.
|
|
1520
|
+
const spans = dailyRebuildSpans(flagged.map((row) => row.date.slice(0, 7)));
|
|
1521
|
+
const points: PricePoint[] = [];
|
|
1522
|
+
let reading = true;
|
|
1523
|
+
await settleWithin(mapWithConcurrency(spans, MONTHLY_REBUILD_CONCURRENCY, async ({ from, to }) => {
|
|
1524
|
+
if (!reading) return;
|
|
1525
|
+
const start = new Date(`${from}-01T00:00:00Z`);
|
|
1526
|
+
const end = new Date(Date.UTC(Number(to.slice(0, 4)), Number(to.slice(5, 7)), 0, 23, 59, 59));
|
|
1527
|
+
const result = await fetchHistoryResult(market.dataProvider, symbol, exchange, { kind: "detail", start, end, interval: "1d" }, context)
|
|
1528
|
+
.catch(logFailure("cli.commands-market", "Daily bars to rebuild a monthly bar failed", null));
|
|
1529
|
+
if (reading && result?.points) points.push(...result.points);
|
|
1530
|
+
}), MONTHLY_REBUILD_WAIT_MS);
|
|
1531
|
+
reading = false;
|
|
1532
|
+
return points.length ? withDailyRebuiltBars(rows, points, priceDivisor, venue) : rows;
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1430
1535
|
/**
|
|
1431
1536
|
* One listing's bars, dated and checked as `history` prints them. Without
|
|
1432
1537
|
* `lookups` it does not look up the other venues of a bare symbol or whether
|
|
@@ -1450,6 +1555,8 @@ async function loadListingHistory(
|
|
|
1450
1555
|
? market.dataProvider.getPriceHistoryWithMetadata(symbol, exchange, loadRange, context)
|
|
1451
1556
|
: market.dataProvider.getPriceHistory(symbol, exchange, loadRange, context).then((points): PriceHistoryResult => ({ points, resolution: null }));
|
|
1452
1557
|
const quoteAnswer = loadListingQuoteAnswer(market.dataProvider, listing);
|
|
1558
|
+
// A future's prices are in its contract's unit (US cents / bushel), as FUT and G spell it; asked beside the bars.
|
|
1559
|
+
const priceUnit = isFuturesInstrument(symbol, null) ? settleWithin(loadFuturesPriceUnit(symbol), HISTORY_PRICE_UNIT_WAIT_MS) : Promise.resolve(null);
|
|
1453
1560
|
const quoted = quoteAnswer.then((answer) => answer.quote);
|
|
1454
1561
|
const fate = lookups ? listingFateLoader(listing, market, quoted, { successor: true }) : null;
|
|
1455
1562
|
const request = { command: historyCommand(ask), noun: "history", ...(fate ? { fate } : {}) };
|
|
@@ -1473,7 +1580,7 @@ async function loadListingHistory(
|
|
|
1473
1580
|
const identity = listingIdentity(listing, quote);
|
|
1474
1581
|
// Without a quote currency, the listing metadata research reads (as `ticker` does) may still state it.
|
|
1475
1582
|
const listed = quote?.currency ? quote : await market.dataProvider.getQuoteMetadata?.(symbol, exchange).catch(logFailure("cli.commands-market", "Read quote metadata for history failed", null));
|
|
1476
|
-
const unit = historyUnit(listing.key, listed ?? quote);
|
|
1583
|
+
const unit = historyUnit(listing.key, listed ?? quote, await priceUnit);
|
|
1477
1584
|
const traded = {
|
|
1478
1585
|
listing: listing.key, exchange: quote?.listingExchangeName || exchange || undefined, instrumentType: quote?.instrumentType,
|
|
1479
1586
|
};
|
|
@@ -1483,7 +1590,17 @@ async function loadListingHistory(
|
|
|
1483
1590
|
const pair = quote?.instrumentType === "CURRENCY" || isCurrencyPairListing(symbol, exchange);
|
|
1484
1591
|
// A London line's bars were priced in pence: cleaned there, and printed to the pence decimals `quote` shows.
|
|
1485
1592
|
const priceDivisor = quotedPriceDivisor(quote);
|
|
1486
|
-
|
|
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);
|
|
1601
|
+
// A monthly bar whose prices contradict each other keeps its close; its open, high and low come from the daily bars.
|
|
1602
|
+
const rows = await withMonthlyBarsRebuilt(barRows, market, symbol, exchange, context, priceDivisor,
|
|
1603
|
+
quote?.listingExchangeName || exchange || "");
|
|
1487
1604
|
// Bars stop arriving on the listing's own trading days, not New York's.
|
|
1488
1605
|
const venue = quote?.listingExchangeName || exchange || undefined;
|
|
1489
1606
|
const served = range === "YTD" && !window ? rows.slice(Math.max(0, yearToDateStartIndex(rows.map((row) => row.date), rows[0]?.interval, venue))) : rows;
|
|
@@ -1668,10 +1785,14 @@ async function runHistory(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
1668
1785
|
const rangeOption = takeOption(args, "--range");
|
|
1669
1786
|
// --from 2007 --to 2009: those years' bars, daily up to five years, in place of a range ending now.
|
|
1670
1787
|
const window = historyWindowOption(args, rangeOption, ctx);
|
|
1671
|
-
const
|
|
1788
|
+
const range = parseRange(rangeOption, ctx);
|
|
1672
1789
|
const requestedExchange = takeOption(args, "--exchange");
|
|
1673
1790
|
// One row a date and a close column a symbol, as a spreadsheet lays several series side by side.
|
|
1674
1791
|
const wide = takeFlag(args, "--wide");
|
|
1792
|
+
// A continuous future stitched across its rolls, by difference unless `ratio` follows.
|
|
1793
|
+
const backAdjust = takeBackAdjust(args, ctx);
|
|
1794
|
+
// Stitching reads daily bars: five years, which come weekly as a range, are read as the window from five years back, which comes daily.
|
|
1795
|
+
const ask: HistoryAsk = { range, window: window ?? (backAdjust && range === "5Y" ? yearsBackWindow(5) : null) };
|
|
1675
1796
|
// A list from a file or standard input (`-`), or several symbols typed (AAPL MSFT, AAPL,MSFT), is one long table.
|
|
1676
1797
|
// One argument with spaces stays one, as before: it may be a company's name.
|
|
1677
1798
|
const file = args.some((arg) => arg === "--file" || arg.startsWith("--file=")) ? takeOption(args, "--file") ?? "" : undefined;
|
|
@@ -1679,6 +1800,7 @@ async function runHistory(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
1679
1800
|
const currency = file != null || requestedExchange ? null : currencyNameStop(args, "history");
|
|
1680
1801
|
if (currency) ctx.fail(currency.message, currency.details);
|
|
1681
1802
|
if (wide || file != null || args.includes("-") || uniqueEntries(args).length > 1 || args.some((arg) => /[,;]/.test(arg))) {
|
|
1803
|
+
if (backAdjust) ctx.fail("--back-adjust stitches one continuous future, such as ES=F.", `Usage: gloom ${HISTORY_USAGE}`);
|
|
1682
1804
|
return runHistoryList(args, file, requestedExchange, ask, ctx, { wide });
|
|
1683
1805
|
}
|
|
1684
1806
|
const raw = requireOneArg(args, HISTORY_USAGE, "symbol", ctx);
|
|
@@ -1690,7 +1812,11 @@ async function runHistory(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
1690
1812
|
if (currency) ctx.fail(currency.message, currency.details);
|
|
1691
1813
|
throw error;
|
|
1692
1814
|
});
|
|
1693
|
-
const { identity, unit,
|
|
1815
|
+
const { identity, unit, interval, intraday, volume, freshness } = history;
|
|
1816
|
+
// Raw stays the default; --back-adjust stitches the contracts at the rolls the warning names, and lists them.
|
|
1817
|
+
const stitched = backAdjust ? await backAdjustListingHistory(history, backAdjust, market, ctx) : null;
|
|
1818
|
+
const data = stitched?.rows ?? history.data;
|
|
1819
|
+
const notes = stitched ? [stitched.note, ...history.notes] : history.notes;
|
|
1694
1820
|
const price = historyPrice(history.decimals);
|
|
1695
1821
|
// A bar without volume in a history that reports it prints as missing.
|
|
1696
1822
|
const missingVolume = historyReportsVolume(data) ? MISSING_VOLUME_TEXT : "";
|
|
@@ -1719,6 +1845,7 @@ async function runHistory(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
1719
1845
|
maxDrawdown: drawdown && contractDrawdown?.contract ? { ...drawdown, contract: contractDrawdown.contract } : drawdown,
|
|
1720
1846
|
asOf: freshness?.asOf ?? null,
|
|
1721
1847
|
...(volume ? { volumeUnit: volume.unit, volumePeriod: interval === "1d" ? "UTC day" : interval } : {}),
|
|
1848
|
+
...(stitched ? { backAdjust: { method: backAdjust, rolls: stitched.rolls, ...(stitched.unstitched.length > 0 ? { unstitched: stitched.unstitched } : {}) } } : {}),
|
|
1722
1849
|
},
|
|
1723
1850
|
...(notes.length > 0 ? { warnings: notes } : {}),
|
|
1724
1851
|
freshness,
|
|
@@ -1739,6 +1866,84 @@ async function runHistory(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
1739
1866
|
});
|
|
1740
1867
|
}
|
|
1741
1868
|
|
|
1869
|
+
/** The window from `years` back to today. */
|
|
1870
|
+
function yearsBackWindow(years: number): PriceWindow | null {
|
|
1871
|
+
const from = new Date();
|
|
1872
|
+
from.setUTCFullYear(from.getUTCFullYear() - years);
|
|
1873
|
+
return readPriceWindow(from.toISOString().slice(0, 10), undefined);
|
|
1874
|
+
}
|
|
1875
|
+
|
|
1876
|
+
/** `--back-adjust` and the method after it (`ratio` or `difference`, the default); null without it. */
|
|
1877
|
+
function takeBackAdjust(args: string[], ctx: Parameters<CliCommandDef["execute"]>[1]): BackAdjustMethod | null {
|
|
1878
|
+
const methods = new Set(["difference", "ratio"]);
|
|
1879
|
+
const equals = args.findIndex((arg) => arg.startsWith("--back-adjust="));
|
|
1880
|
+
if (equals >= 0) {
|
|
1881
|
+
const value = args.splice(equals, 1)[0]!.slice("--back-adjust=".length).toLowerCase();
|
|
1882
|
+
if (!methods.has(value)) ctx.fail(`--back-adjust is by difference or ratio, not "${value}".`, `Usage: gloom ${HISTORY_USAGE}`);
|
|
1883
|
+
return value as BackAdjustMethod;
|
|
1884
|
+
}
|
|
1885
|
+
const index = args.indexOf("--back-adjust");
|
|
1886
|
+
if (index < 0) return null;
|
|
1887
|
+
const next = args[index + 1]?.toLowerCase();
|
|
1888
|
+
const method = next && methods.has(next) ? next as BackAdjustMethod : "difference";
|
|
1889
|
+
args.splice(index, next && methods.has(next) ? 2 : 1);
|
|
1890
|
+
return method;
|
|
1891
|
+
}
|
|
1892
|
+
|
|
1893
|
+
/** Contract reads a back-adjusted history makes at once. */
|
|
1894
|
+
const BACK_ADJUST_READ_LIMIT = 4;
|
|
1895
|
+
/** How far before a roll a contract's bars must reach for its close: past a long holiday weekend. */
|
|
1896
|
+
const ROLL_READ_DAYS = 10;
|
|
1897
|
+
/** The ranges a contract's bars are read over, each with the days it spans at least. */
|
|
1898
|
+
const BACK_ADJUST_READ_RANGES: ReadonlyArray<readonly [TimeRange, number]> = [["1M", 28], ["3M", 89], ["6M", 181], ["1Y", 365], ["5Y", 1826]];
|
|
1899
|
+
|
|
1900
|
+
/**
|
|
1901
|
+
* A continuous future's daily bars back-adjusted at its rolls
|
|
1902
|
+
* (backAdjustHistory): each outgoing and incoming contract's bars read
|
|
1903
|
+
* around its roll, the stitched rolls and the warning that lists them. Fails
|
|
1904
|
+
* for a symbol that is not a continuous future whose bars name their
|
|
1905
|
+
* contracts, for bars coarser than daily, and when a roll cannot be priced.
|
|
1906
|
+
*/
|
|
1907
|
+
async function backAdjustListingHistory(
|
|
1908
|
+
history: ListingHistory,
|
|
1909
|
+
method: BackAdjustMethod,
|
|
1910
|
+
market: MarketContext,
|
|
1911
|
+
ctx: Parameters<CliCommandDef["execute"]>[1],
|
|
1912
|
+
): Promise<{ rows: HistoryRow[]; rolls: StitchedRoll[]; unstitched: HistoryRoll[]; note: string }> {
|
|
1913
|
+
const symbol = history.listing.symbol;
|
|
1914
|
+
const board = futuresBoardContract(symbol);
|
|
1915
|
+
if (!/=F$/i.test(symbol) || !board || !history.data.some((row) => row.contract)) {
|
|
1916
|
+
ctx.fail(`--back-adjust stitches a continuous future's contracts, such as ES=F; ${history.listing.key} is not one whose bars name them.`);
|
|
1917
|
+
}
|
|
1918
|
+
if (history.interval !== "1d") {
|
|
1919
|
+
ctx.fail("--back-adjust stitches daily bars: ask for --range 5Y or less, or a --from window of up to five years.", `Usage: gloom ${HISTORY_USAGE}`);
|
|
1920
|
+
}
|
|
1921
|
+
const rolls = historyRolls(history.data);
|
|
1922
|
+
// Each contract's daily bars over the shortest range that reaches back past its earliest roll.
|
|
1923
|
+
const oldest = new Map<string, number>();
|
|
1924
|
+
for (const roll of rolls) {
|
|
1925
|
+
for (const contract of [roll.from, roll.to]) {
|
|
1926
|
+
const at = Date.parse(`${roll.date.slice(0, 10)}T00:00:00Z`) - ROLL_READ_DAYS * 86_400_000;
|
|
1927
|
+
oldest.set(contract, Math.min(oldest.get(contract) ?? at, at));
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1930
|
+
const context = { cacheMode: ctx.cliOptions.refresh ? "refresh" as const : "default" as const };
|
|
1931
|
+
// A few contracts at a time: five years of rolls is forty-odd contracts.
|
|
1932
|
+
const read = createConcurrencyLimiter(BACK_ADJUST_READ_LIMIT);
|
|
1933
|
+
const loaded = await Promise.all([...oldest].map(([contract, from]) => read(() => {
|
|
1934
|
+
const range = BACK_ADJUST_READ_RANGES.find(([, days]) => Date.now() - days * 86_400_000 <= from)?.[0] ?? "5Y";
|
|
1935
|
+
return market.dataProvider.getPriceHistory(`${contract}.${board!.venue}`, "", range, context)
|
|
1936
|
+
.then((points) => ({ contract, closes: contractCloses(points) }))
|
|
1937
|
+
.catch(logFailure("cli.commands-market", "Read a futures contract's bars to back-adjust failed", { contract, closes: new Map<string, number>() }));
|
|
1938
|
+
})));
|
|
1939
|
+
const closes = new Map(loaded.map(({ contract, closes: read }) => [contract, read]));
|
|
1940
|
+
// A contract the source has no bars of leaves its rolls as traded, named in the warning, and the rest are stitched.
|
|
1941
|
+
const unserved = new Set(loaded.flatMap(({ contract, closes: read }) => read.size === 0 ? [contract] : []));
|
|
1942
|
+
const stitched = backAdjustHistory(history.data, method, (contract) => closes.get(contract));
|
|
1943
|
+
const named = history.data.findIndex((row) => row.contract);
|
|
1944
|
+
return { ...stitched, note: stitchedRollsNote(symbol, method, stitched.rolls, named > 0 ? history.data[named]!.date : null, stitched.unstitched, unserved) };
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1742
1947
|
/** A symbol of a list: its bars, or why it has none. */
|
|
1743
1948
|
type ListedHistory = { symbol: string; history: ListingHistory } | { symbol: string; error: string };
|
|
1744
1949
|
|
|
@@ -2089,9 +2294,8 @@ async function runFinancials(rawArgs: string[], ctx: Parameters<CliCommandDef["e
|
|
|
2089
2294
|
const distributions = view === "statements" ? null : loadDividendDistributions(
|
|
2090
2295
|
market.dataProvider, listing.request, financials, { declared: ctx.cliOptions.format !== "json" });
|
|
2091
2296
|
// A fund's facts: its bond figures beside its distribution yield, and whether fn ETF has any to point to.
|
|
2092
|
-
const
|
|
2093
|
-
|
|
2094
|
-
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);
|
|
2095
2299
|
const treasury = rates ? loadTreasuryTenors() : null;
|
|
2096
2300
|
const identity = listingIdentity(listing, financials.quote);
|
|
2097
2301
|
const choice = await listingChoiceNotes(listing, market, financials.quote, venues);
|
|
@@ -2123,6 +2327,9 @@ async function runFinancials(rawArgs: string[], ctx: Parameters<CliCommandDef["e
|
|
|
2123
2327
|
// On the SEC yield when the sponsor publishes one, else the distribution yield the line above shows.
|
|
2124
2328
|
const taxEquivalent = rates ? analyzeTaxEquivalent({
|
|
2125
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,
|
|
2126
2333
|
distribution: distributionBasis(priced.fundamentals?.dividendYield, priced.fundamentals?.dividendYieldBasis === "trailing" ? "trailing" : "forward"),
|
|
2127
2334
|
}) : null;
|
|
2128
2335
|
const report = { ...data, distributions: await distributions, statementFilings, bank: bank.bank, bankNote: bank.note, bondFund: bond, fundFacts: facts, taxEquivalent,
|
|
@@ -2137,7 +2344,9 @@ async function runFinancials(rawArgs: string[], ctx: Parameters<CliCommandDef["e
|
|
|
2137
2344
|
marketCap: capitalization?.value ?? null,
|
|
2138
2345
|
marketCapCurrency: capitalization?.currency ?? null,
|
|
2139
2346
|
} : {},
|
|
2140
|
-
|
|
2347
|
+
// A bank's EV and EV/revenue are null with why: n/m for banks.
|
|
2348
|
+
fundamentals: priced.fundamentals && exportedDividendFundamentals(
|
|
2349
|
+
exportedFundamentals(withBankEnterpriseValue(priced.fundamentals, priced.profile))!, report.distributions),
|
|
2141
2350
|
// A bond fund's sponsor figures; fundamentals.dividendYield is then its distribution yield, not its SEC yield.
|
|
2142
2351
|
...bond ? { bondFund: bond } : {},
|
|
2143
2352
|
...view === "fundamentals" ? { statementFilings, bank: bank.bank, ...bank.note ? { bankNote: bank.note } : {} } : {},
|
|
@@ -2364,8 +2573,12 @@ async function runNews(rawArgs: string[], ctx: Parameters<CliCommandDef["execute
|
|
|
2364
2573
|
// to its future: the stories that mention the word are the news.
|
|
2365
2574
|
const word = commodity ?? (unfiled ? newsFallbackText(args[0]!) : null);
|
|
2366
2575
|
const futuresCode = !!word && !!bareFuturesCode(word) && isFuturesInstrument(listing!.symbol, quote?.instrumentType);
|
|
2576
|
+
// A word typed as a word ("corn", not CORN) that a ticker answers to but no story is filed under: the stories
|
|
2577
|
+
// that mention the word, said to be that (Teucrium Corn Fund had none on 5 Nov 2026; corn's market had plenty).
|
|
2578
|
+
const typedWord = !!word && /^[A-Za-z]{3,}$/.test(word) && /[a-z]/.test(word);
|
|
2367
2579
|
const reason = commodity ? `the commodity ${future!.symbol} trades`
|
|
2368
|
-
: !resolved ? "no ticker by that name" : futuresCode ? "a futures code, not a ticker"
|
|
2580
|
+
: !resolved ? "no ticker by that name" : futuresCode ? "a futures code, not a ticker"
|
|
2581
|
+
: typedWord ? `no stories filed under ${listing!.symbol}${identity?.name ? ` (${identity.name})` : ""}` : null;
|
|
2369
2582
|
const emptyMessage = (searched: boolean) => listing && identity
|
|
2370
2583
|
? newsEmptyMessage(searched && word ? word : listing.symbol, listingTitle(identity), quote, resolved, searched)
|
|
2371
2584
|
: undefined;
|
|
@@ -2420,6 +2633,7 @@ const FILING_COLUMNS = [
|
|
|
2420
2633
|
{ key: "items", header: "Items" },
|
|
2421
2634
|
{ key: "itemsLabel", header: "Item names" },
|
|
2422
2635
|
{ key: "pressReleaseUrl", header: "Press release URL" },
|
|
2636
|
+
{ key: "trade", header: "Trade" },
|
|
2423
2637
|
];
|
|
2424
2638
|
|
|
2425
2639
|
// The text table names the items before the URL, which a narrow terminal drops first. A current report's
|
|
@@ -2428,7 +2642,8 @@ const FILING_TEXT_COLUMNS = [
|
|
|
2428
2642
|
{ key: "filingDate", header: "Date" },
|
|
2429
2643
|
{ key: "form", header: "Form" },
|
|
2430
2644
|
{ key: "companyName", header: "Company", maxWidth: 24 },
|
|
2431
|
-
|
|
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 || "") },
|
|
2432
2647
|
{ key: "url", header: "URL", optional: true,
|
|
2433
2648
|
format: (value: unknown, row: Record<string, unknown>) => String(row.pressReleaseUrl || (value ?? "")) },
|
|
2434
2649
|
];
|
|
@@ -2467,7 +2682,10 @@ async function runFilings(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
2467
2682
|
const count = parsePositiveInt(takeOption(args, "--count"), ctx.cliOptions.tail ?? ctx.cliOptions.limit ?? 15, "Count", ctx);
|
|
2468
2683
|
const exchangeOption = takeOption(args, "--exchange");
|
|
2469
2684
|
const form = takeOption(args, "--form")?.trim() || null;
|
|
2470
|
-
|
|
2685
|
+
// As in fn SEC: a bank's pricing supplements and a trust's other funds stay out unless --all, and the list
|
|
2686
|
+
// says how many it left out.
|
|
2687
|
+
const all = takeFlag(args, "--all");
|
|
2688
|
+
const raw = requireOneArg(args, "filings <symbol> [--count <n>] [--form <form>] [--all]", "symbol", ctx);
|
|
2471
2689
|
await withMarketData(ctx, async (market) => {
|
|
2472
2690
|
// NST.AX is NST:ASX, as quote, valuation and the pane functions read it: the SEC is asked by venue.
|
|
2473
2691
|
const listing = await requireCliListing(raw, exchangeOption, market, ctx, { venueSuffix: true });
|
|
@@ -2481,15 +2699,19 @@ async function runFilings(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
2481
2699
|
const pageLine = page ? `${page.name}: ${page.url}` : null;
|
|
2482
2700
|
try {
|
|
2483
2701
|
const context = identity?.name ? { listingName: identity.name } : undefined;
|
|
2702
|
+
const load = (rows: number) => market.dataProvider.getSecFilings(symbol, rows, exchange, context);
|
|
2703
|
+
let hidden: HiddenFilings | null = null;
|
|
2484
2704
|
const [filings, quote] = await Promise.all([
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2705
|
+
// What fn SEC shows: a form filter searches every filing listed for the issuer; without one, what fn SEC
|
|
2706
|
+
// leaves out by default stays out unless --all.
|
|
2707
|
+
loadForListing(listing, market, ctx, () => loadShownSecFilings(load, count, { form, all }).then((shown) => {
|
|
2708
|
+
hidden = shown.hidden;
|
|
2709
|
+
return shown.filings;
|
|
2710
|
+
}),
|
|
2490
2711
|
(found) => found.length === 0),
|
|
2491
2712
|
quotePromise,
|
|
2492
2713
|
]);
|
|
2714
|
+
const hiddenNote = hidden ? hiddenFilingsNote(hidden) : null;
|
|
2493
2715
|
const resolved = identity ?? listingIdentity(listing, quote);
|
|
2494
2716
|
const choice = await listingChoiceNotes(listing, market, quote, venues);
|
|
2495
2717
|
// A company on ASX that files nothing with the SEC lists its ASX announcements instead.
|
|
@@ -2502,6 +2724,7 @@ async function runFilings(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
2502
2724
|
metadata: {
|
|
2503
2725
|
...listingMetadata(resolved), ...(form ? { form } : {}),
|
|
2504
2726
|
...(page ? { announcementsPage: page.url } : {}),
|
|
2727
|
+
...hiddenFilingsMetadata(hidden),
|
|
2505
2728
|
},
|
|
2506
2729
|
freshness: rowsFreshness(filingRows(filings), SEC_FILING_ROWS),
|
|
2507
2730
|
...(choice.length > 0 ? { warnings: choice } : {}),
|
|
@@ -2515,7 +2738,7 @@ async function runFilings(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
2515
2738
|
empty: [form ? `No ${form} filings found for ${listingTitle(resolved)}.`
|
|
2516
2739
|
: identity ? noSecReportsNotice(resolved)
|
|
2517
2740
|
: `No SEC filings found for ${listingTitle(resolved)}.`, pageLine].filter(Boolean).join("\n"),
|
|
2518
|
-
...filingsFootnote(pageLine, filings[0]?.companyFrom),
|
|
2741
|
+
...filingsFootnote(pageLine, filings[0]?.companyFrom, hiddenNote),
|
|
2519
2742
|
});
|
|
2520
2743
|
} catch (error) {
|
|
2521
2744
|
if (!(error instanceof SecRegistrantMismatchError)) throw error;
|
|
@@ -2534,12 +2757,29 @@ async function runFilings(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
2534
2757
|
}
|
|
2535
2758
|
|
|
2536
2759
|
/**
|
|
2537
|
-
*
|
|
2538
|
-
*
|
|
2539
|
-
*
|
|
2760
|
+
* A bare symbol's own row that search marks as delisted (FRC: inactive, last
|
|
2761
|
+
* traded 2023-04-28), the service's record of it, for a symbol whose quote
|
|
2762
|
+
* and bars said nothing: "FRC last traded 2023-04-28; no longer listed".
|
|
2540
2763
|
*/
|
|
2541
|
-
function
|
|
2542
|
-
|
|
2764
|
+
async function searchedDelisting(listing: CliListing, market: MarketContext): Promise<NoQuoteLastTrade | null> {
|
|
2765
|
+
if (listing.exchange || !market.dataProvider.search || !/^[A-Z][A-Z0-9.-]{0,9}$/.test(listing.symbol)) return null;
|
|
2766
|
+
const rows = await market.dataProvider.search(listing.symbol).catch(logFailure("cli.market", "Search a delisted symbol failed", []));
|
|
2767
|
+
const row = rows.find((result) => result.delisting && normalizeTickerSymbol(result.symbol) === listing.symbol);
|
|
2768
|
+
return row?.delisting ? { date: row.delisting.lastTradeDate, recorded: true } : null;
|
|
2769
|
+
}
|
|
2770
|
+
|
|
2771
|
+
/**
|
|
2772
|
+
* The lines `filings` prints under its rows and CSV writes as notes: how
|
|
2773
|
+
* many pricing supplements it left out, an ASX listing's announcements page,
|
|
2774
|
+
* and whose filings a foreign line shows when they are its company's home
|
|
2775
|
+
* line's.
|
|
2776
|
+
*/
|
|
2777
|
+
function filingsFootnote(
|
|
2778
|
+
pageLine: string | null | undefined,
|
|
2779
|
+
companyFrom: CompanyFrom | undefined,
|
|
2780
|
+
hiddenNote: string | null = null,
|
|
2781
|
+
): { footnote?: string; exportNotes?: string[] } {
|
|
2782
|
+
const lines = [...(hiddenNote ? [hiddenNote] : []), ...(pageLine ? [pageLine] : []), ...companyDataNotes(companyFrom)];
|
|
2543
2783
|
return lines.length ? { footnote: lines.join("\n"), exportNotes: lines } : {};
|
|
2544
2784
|
}
|
|
2545
2785
|
|
|
@@ -2988,6 +3228,9 @@ async function runOptions(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
2988
3228
|
const { value: expiration, flag: expirationFlag } = expirationOption;
|
|
2989
3229
|
if (expirationOption.both) ctx.fail("--expiry is --expiration; give one of them.", `Usage: gloom ${OPTIONS_USAGE}`);
|
|
2990
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}`);
|
|
2991
3234
|
if (leapsOptions.leaps) {
|
|
2992
3235
|
// With --leaps, --expiration is a window of one expiry.
|
|
2993
3236
|
const criteria = parseLeapsCriteria({ ...leapsOptions.raw, ...expirationOption.given ? { "--expiration": expiration ?? "" } : {} });
|
|
@@ -3024,6 +3267,12 @@ async function runOptions(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
3024
3267
|
// Expiries close on the listing's clock: a coin's options (Deribit) settle at 08:00 UTC on any day.
|
|
3025
3268
|
const expiryVenue = optionExpiryVenue(symbol, exchange);
|
|
3026
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
|
+
}
|
|
3027
3276
|
const cached = await market.dataProvider.getCachedQuery?.("getOptionsChain", [symbol, exchange, expiry, undefined])
|
|
3028
3277
|
.load({ force: refresh });
|
|
3029
3278
|
return {
|
|
@@ -3077,8 +3326,10 @@ async function runOptions(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
3077
3326
|
}
|
|
3078
3327
|
const quote = await quotePromise;
|
|
3079
3328
|
const identity = listingIdentity(listing, quote);
|
|
3080
|
-
// IV and delta are valued at one spot and instant, named under the table and on every exported row.
|
|
3081
|
-
|
|
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);
|
|
3082
3333
|
const basis: OptionsChainBasis = { spot: modelSpot, dividendYield: inputs.dividendYield ?? null,
|
|
3083
3334
|
openInterest: await loadOptionsChainOpenInterest(symbol, chain), ivFilled: chainHasFilledIv(chain) };
|
|
3084
3335
|
const basisFields = optionsBasisFields(basis);
|
|
@@ -3092,7 +3343,7 @@ async function runOptions(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
3092
3343
|
// A venue that marks its contracts (Deribit) states IV and greeks without a quote.
|
|
3093
3344
|
const marked = isMarkedChain(chain);
|
|
3094
3345
|
const coin = chainCoinCurrency(chain);
|
|
3095
|
-
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)
|
|
3096
3347
|
? `IV and delta need a current ${listing.key} quote; those columns are blank`
|
|
3097
3348
|
: null;
|
|
3098
3349
|
const listed = chain.expirationDates.length > 0 || chain.calls.length > 0 || chain.puts.length > 0;
|
|
@@ -3139,7 +3390,7 @@ async function runOptions(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
3139
3390
|
rows: (data: OptionsChain) => optionRows(data).map((row) => ({ ...row, ...basisFields })),
|
|
3140
3391
|
// Choosing an expiry needs the list; once one is chosen the table is that expiry.
|
|
3141
3392
|
summary: (data: OptionsChain) => expirationDate == null ? formatExpiryList(data.expirationDates) : "",
|
|
3142
|
-
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)}.`,
|
|
3143
3394
|
...(contractCount > 0 ? { footnote: optionsBasisFootnote(basis, chain) } : {}),
|
|
3144
3395
|
exportIdentity: { symbolOrSeries: listing.key, currencyOrUnit: currency, interval: OPTIONS_EXPORT_INTERVAL },
|
|
3145
3396
|
// Exports state each decimal's unit in its header and end every row with the spot and dates it is as of.
|
|
@@ -3156,6 +3407,8 @@ async function runOptions(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
3156
3407
|
{ key: "delta", header: "Delta (decimal)" },
|
|
3157
3408
|
{ key: "volume", header: "Vol" },
|
|
3158
3409
|
{ key: "openInterest", header: "OI" },
|
|
3410
|
+
{ key: "quoteStale", header: "Quote stale" },
|
|
3411
|
+
...(adjusted ? [{ key: "deliverable", header: "Deliverable" }] : []),
|
|
3159
3412
|
{ key: "spot", header: "Spot" },
|
|
3160
3413
|
{ key: "spotBasis", header: "Spot basis" },
|
|
3161
3414
|
{ key: "spotAsOf", header: "Spot as of" },
|
|
@@ -3200,6 +3453,7 @@ async function runOptions(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
3200
3453
|
{ key: "delta", header: "Delta", align: "right", format: formatOptionDeltaCell },
|
|
3201
3454
|
{ key: "volume", header: "Vol", align: "right", format: formatCountCell, optional: true, dropPriority: 1 },
|
|
3202
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" }] : []),
|
|
3203
3457
|
],
|
|
3204
3458
|
});
|
|
3205
3459
|
});
|
|
@@ -3262,7 +3516,15 @@ async function runFxOnDate(
|
|
|
3262
3516
|
}
|
|
3263
3517
|
}
|
|
3264
3518
|
const from = legs.get(currency), into = legs.get(baseCurrency);
|
|
3519
|
+
// Converted at the closes as sent, never at a rounded rate; the line names each close it used.
|
|
3265
3520
|
const rate = currency === baseCurrency ? 1 : crossRate(from?.rate, into?.rate);
|
|
3521
|
+
const closes: FxQuotedFigure[] = codes.flatMap((code) => {
|
|
3522
|
+
const leg = dailyFxLeg(code), close = legs.get(code)?.close;
|
|
3523
|
+
return leg && close != null ? [{ pair: leg.invert ? `USD/${code}` : `${code}/USD`, figure: close }] : [];
|
|
3524
|
+
});
|
|
3525
|
+
const rateLine = closes.length > 1
|
|
3526
|
+
? `${describeFxRate(request, rate)} · ${describeFxLegs(closes)}`
|
|
3527
|
+
: describeFxRate(request, rate, closes[0]);
|
|
3266
3528
|
// A cross is as old as its older close; a weekend or holiday reads the trading day before it.
|
|
3267
3529
|
const closeDate = [...legs.values()].map((leg) => leg.date).sort()[0]!;
|
|
3268
3530
|
const converted = amount == null ? null : amount * rate;
|
|
@@ -3283,7 +3545,7 @@ async function runFxOnDate(
|
|
|
3283
3545
|
freshness: rowsFreshness([], { status: "not-a-feed", basis: "daily FX close", asOf: closeDate }),
|
|
3284
3546
|
warnings: warnings.length > 0 ? warnings : undefined,
|
|
3285
3547
|
}, {
|
|
3286
|
-
text: () => amount == null ?
|
|
3548
|
+
text: () => amount == null ? rateLine : `${describeFxConversion(request, amount, rate)}\n${rateLine}`,
|
|
3287
3549
|
exportIdentity: { symbolOrSeries: pair, currencyOrUnit: `${baseCurrency} per ${currency}`, interval: "1day" },
|
|
3288
3550
|
columns: [
|
|
3289
3551
|
{ key: "currency", header: "Currency" },
|
|
@@ -3334,49 +3596,44 @@ async function runFx(rawArgs: string[], ctx: Parameters<CliCommandDef["execute"]
|
|
|
3334
3596
|
(payload) => ({ payload }),
|
|
3335
3597
|
(error: unknown) => ({ error: unavailableOnServer(error, "Forwards are not available from Gloom Cloud yet: it serves no short rates.") }),
|
|
3336
3598
|
) : null;
|
|
3337
|
-
|
|
3338
|
-
const
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
const legs = await Promise.all(codes.map(load));
|
|
3347
|
-
const missing = codes.filter((_code, index) => !isUsableRate(legs[index]?.value));
|
|
3348
|
-
if (missing.length > 0) {
|
|
3349
|
-
// A reason the data service gave for the first missing leg says more than the generic line.
|
|
3350
|
-
const reason = missing.map((code) => reasons.get(code)).find(Boolean);
|
|
3599
|
+
// The pair's own quote, as `quote` and the FX board read it; a pair with none is crossed through the dollar.
|
|
3600
|
+
const now = Date.now();
|
|
3601
|
+
const read = await readFxQuoteRate(currency, baseCurrency, (targets, options) => market.dataProvider.getQuotesBatch(targets, options),
|
|
3602
|
+
{ forceRefresh: ctx.cliOptions.refresh, now });
|
|
3603
|
+
if (read && "missing" in read) {
|
|
3604
|
+
// A reason the data service gave for a missing quote (spot gold is not quoted) says more than the generic line;
|
|
3605
|
+
// a symbol that names nothing (USDXYZ=X) or a source with nothing to say (No quote provider available) does not.
|
|
3606
|
+
const reason = read.errors.map((error) => providerMissReason(error)
|
|
3607
|
+
?? (typeof error === "string" && !/^(?:Not a ticker|No quote provider)\b|unavailable/i.test(error) ? error : undefined)).find(Boolean);
|
|
3351
3608
|
if (reason) ctx.fail(reason);
|
|
3352
3609
|
ctx.fail(
|
|
3353
|
-
`Exchange rate unavailable for ${missing.join(" and ")}.`,
|
|
3354
|
-
|
|
3610
|
+
`Exchange rate unavailable for ${read.missing.join(" and ")}.`,
|
|
3611
|
+
`No quote came back for ${fxPairListing(currency, baseCurrency).symbol}${currency !== "USD" && baseCurrency !== "USD" ? " or the dollar pairs it crosses from" : ""}. Check the ISO code.`,
|
|
3355
3612
|
);
|
|
3356
3613
|
}
|
|
3357
|
-
const
|
|
3358
|
-
// A
|
|
3359
|
-
|
|
3360
|
-
const
|
|
3361
|
-
const
|
|
3614
|
+
const quoted = read && !("missing" in read) ? read : null;
|
|
3615
|
+
// A conversion uses the quote as sent (or the cross of the dollar pairs as sent), never a rounded rate,
|
|
3616
|
+
// and the rate line prints each figure it used.
|
|
3617
|
+
const rate = quoted ? quoted.rate : 1;
|
|
3618
|
+
const observation = quoted ? fxQuoteRateObservation(quoted, now) : null;
|
|
3619
|
+
const asOf = observation && Number.isFinite(observation.updatedAt) ? new Date(observation.updatedAt).toISOString() : null;
|
|
3620
|
+
// A rate older than its feed's delay is stale, as `quote` says of the same quote.
|
|
3621
|
+
const stale = observation?.stale === true;
|
|
3362
3622
|
const converted = amount == null ? null : amount * rate;
|
|
3363
|
-
const row = {
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
const timings = new Map([...loaded].map(([code, leg]) => [code, leg.timing]));
|
|
3378
|
-
// --refresh read every leg again: one that is still stale says the data service has no newer rate.
|
|
3379
|
-
const rateNotes = [...fxRateNotes(timings), ...ctx.cliOptions.refresh ? refreshedFxRateNotes(timings) : []];
|
|
3623
|
+
const row = {
|
|
3624
|
+
currency, baseCurrency, rate, asOf, stale, pair, inverse: 1 / rate,
|
|
3625
|
+
...(quoted ? { quotes: quoted.quotes.map(({ symbol }) => symbol), ...(quoted.viaUsd ? { via: "USD" } : {}) } : {}),
|
|
3626
|
+
...(quoted?.derivedFrom ? { derived: true, derivedFrom: quoted.derivedFrom } : {}),
|
|
3627
|
+
...(amount == null ? {} : { amount, converted }),
|
|
3628
|
+
};
|
|
3629
|
+
// The closing line is the quote's own, as `quote` prints it: its time, and stale once older than the feed's delay.
|
|
3630
|
+
const freshness = observation ? rowsFreshness([observation], undefined, undefined, now) : undefined;
|
|
3631
|
+
// A rate that is its pair's bar says which bar, and a stale one why it stands; --refresh says when it found nothing newer.
|
|
3632
|
+
const rateNotes = (quoted?.quotes ?? []).flatMap(({ symbol, quote }) => [
|
|
3633
|
+
...quoteBarNotes(symbol, quote, now),
|
|
3634
|
+
...ctx.cliOptions.refresh && !quote.staleReason && isQuoteStaleForCurrentSession(quote, now)
|
|
3635
|
+
? [`${symbol}: --refresh found no newer quote than ${formatUtcDayTime({ time: quote.lastUpdated, dateOnly: false }, now)} UTC.`] : [],
|
|
3636
|
+
]);
|
|
3380
3637
|
if (tenor && shortRates && !("error" in tenor)) {
|
|
3381
3638
|
const read = await shortRates;
|
|
3382
3639
|
if ("error" in read) throw read.error;
|
|
@@ -3393,7 +3650,11 @@ async function runFx(rawArgs: string[], ctx: Parameters<CliCommandDef["execute"]
|
|
|
3393
3650
|
const rateFields = (short: typeof base.rate) => ({
|
|
3394
3651
|
currency: short.currency, name: short.name, tenor: short.tenor, value: short.value, asOf: short.asOf,
|
|
3395
3652
|
dayCountBasis: short.dayCountBasis, publisher: short.publisher, sourceUrl: short.sourceUrl, stale: short.stale,
|
|
3653
|
+
...(short.attribution ? { attribution: short.attribution } : {}),
|
|
3396
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}).`] : []))];
|
|
3397
3658
|
const staleRates = [base.rate, quote.rate].filter((short) => short.stale)
|
|
3398
3659
|
.map((short) => `${short.name} (${short.currency}) is the last copy read, dated ${short.asOf ?? "undated"}; its source could not be read since.`);
|
|
3399
3660
|
const forwardRow = {
|
|
@@ -3411,6 +3672,7 @@ async function runFx(rawArgs: string[], ctx: Parameters<CliCommandDef["execute"]
|
|
|
3411
3672
|
`${currency} rate: ${describeShortRate(base.rate)}`,
|
|
3412
3673
|
`${baseCurrency} rate: ${describeShortRate(quote.rate)}`,
|
|
3413
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,
|
|
3414
3676
|
].join("\n"),
|
|
3415
3677
|
exportIdentity: { symbolOrSeries: pair, currencyOrUnit: `${baseCurrency} per ${currency}`, interval: `forward ${tenor.label}` },
|
|
3416
3678
|
columns: [
|
|
@@ -3440,7 +3702,15 @@ async function runFx(rawArgs: string[], ctx: Parameters<CliCommandDef["execute"]
|
|
|
3440
3702
|
? await loadPesoDollarRates((targets) => market.dataProvider.getQuotesBatch(targets, { forceRefresh: ctx.cliOptions.refresh }))
|
|
3441
3703
|
: null;
|
|
3442
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.`);
|
|
3443
|
-
|
|
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;
|
|
3708
|
+
const rateText = [
|
|
3709
|
+
describeFxRate(request, rate, quoted && !quoted.viaUsd ? quoted.quotes[0] : undefined),
|
|
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)`] : [],
|
|
3712
|
+
...peso ? [`${peso.spotKind} rate`] : [],
|
|
3713
|
+
].join(" · ");
|
|
3444
3714
|
ctx.printResult({ data: [peso ? { ...row, ...pesoDollarRatesJson(peso) } : row], freshness, warnings: warnings.length > 0 ? warnings : undefined }, {
|
|
3445
3715
|
// The conversion, then the rate it used; the source line under it dates that rate.
|
|
3446
3716
|
text: () => [
|
|
@@ -3449,7 +3719,7 @@ async function runFx(rawArgs: string[], ctx: Parameters<CliCommandDef["execute"]
|
|
|
3449
3719
|
...peso ? pesoDollarRateLines(peso) : [],
|
|
3450
3720
|
].join("\n"),
|
|
3451
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.
|
|
3452
|
-
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" },
|
|
3453
3723
|
columns: [
|
|
3454
3724
|
{ key: "currency", header: "Currency" },
|
|
3455
3725
|
{ key: "baseCurrency", header: "Base" },
|
|
@@ -3533,7 +3803,7 @@ async function runEarnings(rawArgs: string[], ctx: Parameters<CliCommandDef["exe
|
|
|
3533
3803
|
{ key: "status", header: "Status" },
|
|
3534
3804
|
{ key: "symbol", header: "Symbol" },
|
|
3535
3805
|
{ key: "name", header: "Name" },
|
|
3536
|
-
{ key: "timing", header: "Timing" },
|
|
3806
|
+
{ key: "timing", header: "Timing", format: (value: unknown, row: Record<string, unknown>) => String(row.localTiming || (value ?? "")) },
|
|
3537
3807
|
{ key: "epsEstimate", header: "EPS Est", align: "right", format: formatEpsCell },
|
|
3538
3808
|
{ key: "epsActual", header: "EPS", align: "right", format: formatEpsCell },
|
|
3539
3809
|
],
|
|
@@ -3580,6 +3850,7 @@ export const marketDataCliCommands: BuiltinCliCommandDef[] = [
|
|
|
3580
3850
|
{ flags: "--to <year|date>, --end <year|date>", description: PRICE_WINDOW_TO_HELP },
|
|
3581
3851
|
{ flags: "--file <path>", description: "Read the symbols from a text or CSV file, one per line (- reads standard input), and write every symbol's bars in one table" },
|
|
3582
3852
|
{ flags: "--wide", description: "One row per date and one close column per symbol, its unit in the header, in place of one long table" },
|
|
3853
|
+
{ flags: "--back-adjust [ratio]", description: "A continuous future (ES=F) stitched into one series at the rolls its bars name: every price before a roll moved by the gap between the two contracts that day (by difference, or scaled by their ratio with ratio), the rolls listed in a warning and in --json metadata.backAdjust. Daily bars, --range 5Y included; a roll whose contracts the source serves no bars of is left as traded and named. Raw front-month prices are the default" },
|
|
3583
3854
|
EXCHANGE_OPTION,
|
|
3584
3855
|
],
|
|
3585
3856
|
sections: [{
|
|
@@ -3631,6 +3902,7 @@ export const marketDataCliCommands: BuiltinCliCommandDef[] = [
|
|
|
3631
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",
|
|
3632
3903
|
},
|
|
3633
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" },
|
|
3634
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" },
|
|
3635
3907
|
{ flags: "--side <calls|puts>", description: `With --leaps: the side to rank (default ${DEFAULT_LEAPS_CRITERIA.side}s)` },
|
|
3636
3908
|
{
|
|
@@ -3828,10 +4100,11 @@ export const marketDataCliCommands: BuiltinCliCommandDef[] = [
|
|
|
3828
4100
|
description: "Fetch recent SEC filings; a listing abroad gets its exchange's announcements page, and ASX's list",
|
|
3829
4101
|
help: {
|
|
3830
4102
|
group: CLI_COMMAND_GROUPS.companyData,
|
|
3831
|
-
usage: ["filings <symbol> [--count <n>] [--form <form>]"],
|
|
4103
|
+
usage: ["filings <symbol> [--count <n>] [--form <form>] [--all]"],
|
|
3832
4104
|
options: [
|
|
3833
4105
|
{ flags: "--count <n>", description: "Number of filings (default 15)" },
|
|
3834
4106
|
{ flags: "--form <form>", description: "Only this form and its amendments, such as 10-K or 13D" },
|
|
4107
|
+
{ flags: "--all", description: "Also list what fn SEC leaves out by default: the pricing supplements and term sheets (424B2, FWP) a bank files for each structured note, and a fund trust's filings for its other funds" },
|
|
3835
4108
|
EXCHANGE_OPTION,
|
|
3836
4109
|
],
|
|
3837
4110
|
examples: ["filings AAPL", "filings BHP:ASX", "filings NST.AX", "filings AAPL --count 40 --json", "filings CAR --form 13G"],
|
|
@@ -3879,7 +4152,7 @@ export const marketDataCliCommands: BuiltinCliCommandDef[] = [
|
|
|
3879
4152
|
}, {
|
|
3880
4153
|
title: "Amounts",
|
|
3881
4154
|
lines: [
|
|
3882
|
-
"An amount in front converts it from the first currency to the second: fx 1234.5 EUR/USD, or fx 1234,5 EUR USD. It takes either decimal mark (1.234,5 and 1,234.5 are 1234.5
|
|
4155
|
+
"An amount in front converts it from the first currency to the second: fx 1234.5 EUR/USD, or fx 1234,5 EUR USD. It takes either decimal mark (1.234,5 and 1,234.5 are 1234.5; 1.5 and 1,5 are 1.5). A lone comma or dot before exactly three digits (fx 1,234 EUR, fx 1.234 EUR) could be thousands or a decimal, so fx asks which: type 1234 or 1.2340. An amount and one currency converts to USD. The answer gives the converted amount, then the rate it used, dated by the source line; --json adds amount and converted.",
|
|
3883
4156
|
],
|
|
3884
4157
|
}, {
|
|
3885
4158
|
title: "A past day",
|