@gloom-sh/terminal 0.20.12 → 0.20.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -1
- package/patches/@opentui%2Fcore@0.3.2.patch +22 -4
- package/src/account/auth-dialog.tsx +22 -4
- package/src/account/auth-form.tsx +6 -1
- package/src/account/billing.ts +3 -2
- package/src/account/checkout-handoff.tsx +7 -14
- package/src/account/device-signin-dialog.tsx +35 -24
- package/src/account/upgrade-dialog.tsx +8 -8
- package/src/api-client/crypto-markets.ts +10 -0
- package/src/api-client/errors.ts +3 -1
- package/src/api-client/index.ts +10 -2
- package/src/api-client/install-experiments.ts +146 -0
- package/src/api-client/money-markets.ts +7 -0
- package/src/api-client/request.ts +12 -2
- package/src/api-client/telemetry.ts +47 -0
- package/src/api-client/types/market.ts +4 -0
- package/src/api-client/types/news.ts +16 -0
- package/src/architecture/floating-promise-allowlist.json +17 -34
- package/src/brokers/signed-in/adapter.ts +2 -2
- package/src/brokers/signed-in/catalog.ts +13 -4
- package/src/brokers/signed-in/sign-in-dialog.tsx +38 -38
- package/src/cli/commands/market.ts +146 -55
- package/src/cli/commands/overview.ts +21 -7
- package/src/cli/commands/search.ts +103 -9
- package/src/cli/commands/ticker.ts +22 -13
- package/src/cli/earnings-calendar.ts +33 -53
- package/src/cli/errors.ts +3 -1
- package/src/cli/freshness.ts +7 -2
- package/src/cli/glossary.ts +10 -5
- package/src/cli/helpers.ts +8 -16
- package/src/cli/history-export.ts +4 -0
- package/src/cli/history-rows.ts +18 -1
- package/src/cli/known-gaps.ts +11 -2
- package/src/cli/listing-arg.ts +183 -28
- package/src/cli/not-a-ticker.ts +4 -0
- package/src/cli/pane-functions/catalog.ts +81 -12
- package/src/cli/pane-functions/dom.ts +8 -1
- package/src/cli/pane-functions/freshness.ts +2 -2
- package/src/cli/pane-functions/headless.ts +13 -10
- package/src/cli/pane-functions/index.ts +1 -1
- package/src/cli/pane-functions/options.ts +7 -0
- package/src/cli/pane-functions/report.ts +4 -1
- package/src/cli/pane-functions/resolver.ts +61 -15
- package/src/cli/perpetual-contract.ts +4 -4
- package/src/cli/quote-answer.ts +6 -2
- package/src/cli/result.ts +24 -5
- package/src/cli/symbol-args.ts +5 -3
- package/src/cli/symbol-list.ts +23 -10
- package/src/cli/symbol-rows.ts +135 -3
- package/src/cli/treasury-yields.ts +15 -1
- package/src/components/chart/composite/axis-overlays.tsx +5 -2
- package/src/components/chart/composite/composite-chart.tsx +1 -0
- package/src/components/chart/composite/format.ts +103 -16
- package/src/components/chart/composite/legend.tsx +60 -25
- package/src/components/chart/composite/panel-surface/axis-markers.ts +133 -0
- package/src/components/chart/composite/panel-surface/level-labels.tsx +78 -0
- package/src/components/chart/composite/panel-surface/overlays.ts +108 -0
- package/src/components/chart/composite/panel-surface/pan-coast.ts +54 -0
- package/src/components/chart/composite/panel-surface/panel-cursor.tsx +138 -0
- package/src/components/chart/composite/panel-surface/panel-levels.ts +47 -0
- package/src/components/chart/composite/panel-surface/plot-gestures.ts +403 -0
- package/src/components/chart/composite/panel-surface/plot-pointer.ts +65 -0
- package/src/components/chart/composite/panel-surface/plot-wheel.ts +102 -0
- package/src/components/chart/composite/panel-surface/pointer.ts +12 -0
- package/src/components/chart/composite/panel-surface/props.ts +79 -0
- package/src/components/chart/composite/panel-surface/tool-readout.ts +151 -0
- package/src/components/chart/composite/panel-surface/value-axis-gestures.ts +152 -0
- package/src/components/chart/composite/panel-surface.tsx +81 -1177
- package/src/components/chart/composite/time-axis.ts +51 -29
- package/src/components/chart/composite/toolbar.tsx +42 -6
- package/src/components/chart/curve/curve-surface.tsx +5 -5
- package/src/components/command-bar/commands/collection-list.ts +1 -0
- package/src/components/command-bar/list/badge.ts +8 -5
- package/src/components/command-bar/list/model.ts +0 -5
- package/src/components/command-bar/list/view.tsx +39 -2
- package/src/components/command-bar/routes/root/plugin-install.ts +4 -2
- package/src/components/command-bar/routes/root/provider-search.ts +23 -3
- package/src/components/command-bar/routes/root/results.ts +23 -11
- package/src/components/command-bar/routes/root/runtime.ts +3 -2
- package/src/components/command-bar/routes/root/selection.ts +3 -2
- package/src/components/command-bar/routes/root/shortcuts.ts +15 -0
- package/src/components/command-bar/routes/root/start-here.ts +1 -2
- package/src/components/command-bar/routes/ticker-search/actions.ts +2 -3
- package/src/components/command-bar/routes/ticker-search/results.ts +23 -4
- package/src/components/data-table/view.tsx +29 -6
- package/src/components/form-modal/host.tsx +1 -1
- package/src/components/layout/header.tsx +3 -2
- package/src/components/layout/market-summary.ts +3 -3
- package/src/components/layout/pane/error-boundary.tsx +2 -1
- package/src/components/layout/pane/title.ts +10 -4
- package/src/components/markdown-text.tsx +36 -0
- package/src/components/market-board/index.tsx +4 -3
- package/src/components/onboarding/first-run-workspace.ts +46 -11
- package/src/components/onboarding/onboarding-keyboard.ts +57 -5
- package/src/components/onboarding/onboarding-wizard.tsx +91 -24
- package/src/components/onboarding/portfolio-step/index.tsx +1 -0
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +36 -9
- package/src/components/onboarding/portfolio-step/types.ts +2 -0
- package/src/components/onboarding/tickers-step-model.ts +140 -0
- package/src/components/onboarding/tickers-step.tsx +116 -0
- package/src/components/onboarding/use-onboarding-broker-form.ts +1 -1
- package/src/components/onboarding/use-onboarding-progress.ts +100 -11
- package/src/components/onboarding/use-onboarding-upgrade.ts +3 -2
- package/src/components/onboarding/wizard-model.ts +3 -1
- package/src/components/onboarding/wizard-tickers.ts +139 -0
- package/src/components/pane-settings-dialog/tui.tsx +6 -3
- package/src/components/pane-settings-dialog.tsx +2 -1
- package/src/components/pane-template-wizard.tsx +2 -0
- package/src/components/price-performance.tsx +2 -2
- package/src/components/speedometer-gauge/model.ts +2 -1
- package/src/components/speedometer-gauge/terminal.tsx +13 -8
- package/src/components/ui/choice-dialog.tsx +102 -33
- package/src/components/ui/confirm-dialog.tsx +3 -2
- package/src/components/ui/frame.tsx +7 -3
- package/src/components/ui/icon.tsx +4 -2
- package/src/components/ui/list-view.tsx +8 -0
- package/src/components/ui/multi-select/dialog.tsx +1 -7
- package/src/components/ui/not-meaningful.ts +16 -0
- package/src/components/ui/number-prompt-dialog.tsx +2 -1
- package/src/components/ui/query-bar.tsx +16 -4
- package/src/components/ui/stat-grid.tsx +27 -6
- package/src/components/use-pane-notice-footer.tsx +3 -1
- package/src/data/config/store/normalize.ts +2 -0
- package/src/docs/snapshot.json +3 -3
- package/src/i18n/es.ts +6 -2
- package/src/i18n/ja.ts +6 -2
- package/src/i18n/ko.ts +6 -2
- package/src/i18n/zh-cn.ts +6 -2
- package/src/i18n/zh-tw.ts +6 -2
- package/src/layout-marketplace/model.ts +2 -1
- package/src/market-data/futures-contract.ts +2 -1
- package/src/market-data/hooks.tsx +1 -1
- package/src/market-data/market/change-basis.ts +27 -5
- package/src/market-data/market/format.ts +48 -14
- package/src/market-data/quotes/contributions.ts +13 -0
- package/src/market-data/quotes/export-identity.ts +36 -1
- package/src/market-data/quotes/listing-enterprise-value.ts +3 -3
- package/src/market-data/quotes/resolution.ts +16 -0
- package/src/market-data/quotes/time.ts +17 -10
- package/src/market-data/tax-equivalent.ts +3 -2
- package/src/news/aggregator.ts +19 -8
- package/src/news/hooks.ts +1 -1
- package/src/news/news-model.ts +49 -0
- package/src/news/types.ts +9 -0
- package/src/plugins/builtin/account-management/calendar-tab.tsx +8 -3
- package/src/plugins/builtin/account-management/pane.tsx +9 -8
- package/src/plugins/builtin/account-management/password-dialog.tsx +2 -2
- package/src/plugins/builtin/alerts/calendar-events.ts +4 -5
- package/src/plugins/builtin/alerts/format.ts +6 -5
- package/src/plugins/builtin/alerts/headless.ts +3 -2
- package/src/plugins/builtin/alerts/history.ts +2 -1
- package/src/plugins/builtin/alerts/pane.tsx +2 -1
- package/src/plugins/builtin/alerts/price-text.ts +2 -1
- package/src/plugins/builtin/alerts/scheduled.ts +6 -5
- package/src/plugins/builtin/analytics/account-returns.ts +6 -7
- package/src/plugins/builtin/analytics/display.ts +2 -1
- package/src/plugins/builtin/analytics/pane-model.ts +5 -9
- package/src/plugins/builtin/analytics/risk-client.ts +12 -2
- package/src/plugins/builtin/analytics/risk-headless.ts +66 -6
- package/src/plugins/builtin/analytics/risk-math.ts +23 -6
- package/src/plugins/builtin/analytics/risk-model.ts +26 -15
- package/src/plugins/builtin/analytics/risk-pane.tsx +8 -7
- package/src/plugins/builtin/analytics/view.tsx +5 -5
- package/src/plugins/builtin/attention/model.ts +6 -5
- package/src/plugins/builtin/attention/pane.tsx +5 -4
- package/src/plugins/builtin/awards/detail.tsx +5 -4
- package/src/plugins/builtin/awards/headless.ts +8 -7
- package/src/plugins/builtin/awards/model.ts +4 -3
- package/src/plugins/builtin/awards/pane.tsx +4 -4
- package/src/plugins/builtin/backtest/format.ts +3 -2
- package/src/plugins/builtin/backtest/report.ts +3 -2
- package/src/plugins/builtin/bond-calculator/headless.ts +2 -1
- package/src/plugins/builtin/bond-calculator/pane.tsx +2 -1
- package/src/plugins/builtin/broker-manager/add-flow.tsx +1 -1
- package/src/plugins/builtin/broker-trading/orders-data.ts +3 -3
- package/src/plugins/builtin/broker-trading/orders.tsx +3 -2
- package/src/plugins/builtin/broker-trading/ticket.tsx +2 -2
- package/src/plugins/builtin/buildout/cells.tsx +2 -1
- package/src/plugins/builtin/buildout/company/pane.tsx +4 -3
- package/src/plugins/builtin/buildout/data-runtime.ts +21 -23
- package/src/plugins/builtin/buildout/detail/values.ts +2 -1
- package/src/plugins/builtin/buildout/format.ts +4 -3
- package/src/plugins/builtin/buildout/pane/index.tsx +3 -3
- package/src/plugins/builtin/catalysts/detail.tsx +2 -1
- package/src/plugins/builtin/catalysts/model.ts +6 -5
- package/src/plugins/builtin/catalysts/pane.tsx +2 -1
- package/src/plugins/builtin/cds/headless.ts +3 -2
- package/src/plugins/builtin/cds/model.ts +8 -8
- package/src/plugins/builtin/cds/pane.tsx +3 -2
- package/src/plugins/builtin/central-bank-rates/headless.ts +2 -1
- package/src/plugins/builtin/central-bank-rates/model.ts +3 -2
- package/src/plugins/builtin/central-bank-rates/pane.tsx +5 -5
- package/src/plugins/builtin/changelog/index.tsx +2 -2
- package/src/plugins/builtin/chart-composer/catalog-inventory.ts +5 -2
- package/src/plugins/builtin/chart-composer/editor.tsx +1 -0
- package/src/plugins/builtin/chart-composer/index.tsx +4 -2
- package/src/plugins/builtin/chart-composer/pane.tsx +8 -4
- package/src/plugins/builtin/chart-composer/quick-add.tsx +4 -1
- package/src/plugins/builtin/chart-composer/series-catalog.ts +17 -1
- package/src/plugins/builtin/chart-composer/use-series-catalog.ts +3 -1
- package/src/plugins/builtin/chart-composer/user-series.ts +3 -1
- package/src/plugins/builtin/chat/attachments/desktop.tsx +2 -1
- package/src/plugins/builtin/chat/controller/utils.ts +2 -1
- package/src/plugins/builtin/clinical-trials/model.ts +4 -3
- package/src/plugins/builtin/clinical-trials/sponsor-tickers.ts +4 -2
- package/src/plugins/builtin/cloud/askg/lock-note.ts +16 -4
- package/src/plugins/builtin/cloud/askg/model.ts +2 -1
- package/src/plugins/builtin/cloud/askg/pane.tsx +35 -1
- package/src/plugins/builtin/cloud/company-picker.tsx +1 -3
- package/src/plugins/builtin/cloud/plugin.tsx +2 -0
- package/src/plugins/builtin/cloud/team/pane.tsx +12 -12
- package/src/plugins/builtin/cloud/thesis/detail.tsx +13 -8
- package/src/plugins/builtin/cloud/thesis/module.tsx +2 -0
- package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +6 -2
- package/src/plugins/builtin/cloud-tweets/model.ts +2 -2
- package/src/plugins/builtin/comment-letters/pane.tsx +2 -1
- package/src/plugins/builtin/commodity-balances/headless.ts +3 -2
- package/src/plugins/builtin/company-attention/app-rank.tsx +5 -4
- package/src/plugins/builtin/company-attention/building-model.ts +7 -7
- package/src/plugins/builtin/company-attention/headless.ts +6 -5
- package/src/plugins/builtin/company-attention/model.ts +4 -4
- package/src/plugins/builtin/company-attention/moves-model.ts +9 -9
- package/src/plugins/builtin/company-attention/signals-model.ts +9 -9
- package/src/plugins/builtin/company-kpis/headless.ts +2 -1
- package/src/plugins/builtin/company-kpis/model.ts +15 -10
- package/src/plugins/builtin/company-kpis/pane.tsx +2 -2
- package/src/plugins/builtin/congress-trades/detail.tsx +6 -5
- package/src/plugins/builtin/congress-trades/headless.ts +2 -1
- package/src/plugins/builtin/congress-trades/model.ts +6 -6
- package/src/plugins/builtin/congress-trades/table.tsx +7 -6
- package/src/plugins/builtin/connections/pane.tsx +5 -5
- package/src/plugins/builtin/correlation/headless.ts +2 -2
- package/src/plugins/builtin/correlation/index.tsx +4 -1
- package/src/plugins/builtin/correlation/matrix/selection.ts +2 -1
- package/src/plugins/builtin/correlation/relationship/view-model.ts +3 -3
- package/src/plugins/builtin/cot/headless.ts +3 -2
- package/src/plugins/builtin/cot/model.ts +2 -1
- package/src/plugins/builtin/cot/pane.tsx +4 -3
- package/src/plugins/builtin/cpi/headless.ts +10 -4
- package/src/plugins/builtin/cpi/model.ts +25 -7
- package/src/plugins/builtin/cpi/pane.tsx +3 -1
- package/src/plugins/builtin/credit-boards/cdx-pane.tsx +5 -4
- package/src/plugins/builtin/credit-boards/headless.ts +2 -1
- package/src/plugins/builtin/credit-boards/model.ts +5 -5
- package/src/plugins/builtin/credit-conditions/headless.ts +2 -1
- package/src/plugins/builtin/credit-conditions/index.tsx +2 -2
- package/src/plugins/builtin/credit-documents/model.ts +2 -2
- package/src/plugins/builtin/crypto-board/client.ts +6 -1
- package/src/plugins/builtin/crypto-board/defi-view.tsx +7 -7
- package/src/plugins/builtin/crypto-board/defi.ts +2 -2
- package/src/plugins/builtin/crypto-board/headless.ts +10 -2
- package/src/plugins/builtin/crypto-board/model.ts +93 -14
- package/src/plugins/builtin/crypto-board/pane.tsx +28 -13
- package/src/plugins/builtin/crypto-board/supply.ts +2 -2
- package/src/plugins/builtin/crypto-etf-flows/model.ts +4 -4
- package/src/plugins/builtin/custom-view/index.tsx +3 -1
- package/src/plugins/builtin/custom-view/pane.tsx +5 -1
- package/src/plugins/builtin/custom-view/view-spec.ts +11 -0
- package/src/plugins/builtin/debt-maturities/model.ts +3 -3
- package/src/plugins/builtin/debt-maturities/pane.tsx +2 -2
- package/src/plugins/builtin/dividend-yield/client.ts +31 -5
- package/src/plugins/builtin/dividend-yield/headless.ts +20 -13
- package/src/plugins/builtin/dividend-yield/pane.tsx +12 -10
- package/src/plugins/builtin/dividend-yield/ranking-view.tsx +4 -1
- package/src/plugins/builtin/dividend-yield/ranking.ts +21 -12
- package/src/plugins/builtin/dividend-yield/types.ts +4 -0
- package/src/plugins/builtin/dividend-yield/view.ts +8 -4
- package/src/plugins/builtin/docs/use-docs.ts +4 -2
- package/src/plugins/builtin/doe/headless.ts +2 -1
- package/src/plugins/builtin/doe/model.ts +12 -11
- package/src/plugins/builtin/earnings/board-model.ts +14 -8
- package/src/plugins/builtin/earnings/board-table.ts +13 -8
- package/src/plugins/builtin/earnings/calendar-model.ts +5 -5
- package/src/plugins/builtin/earnings/calendar.tsx +2 -1
- package/src/plugins/builtin/earnings/format.ts +16 -14
- package/src/plugins/builtin/earnings/headless.ts +57 -19
- package/src/plugins/builtin/earnings/history-model.ts +11 -7
- package/src/plugins/builtin/earnings/history-table.ts +22 -9
- package/src/plugins/builtin/earnings/history.tsx +4 -3
- package/src/plugins/builtin/earnings-calls/calendar.tsx +2 -1
- package/src/plugins/builtin/earnings-calls/format.ts +6 -5
- package/src/plugins/builtin/earnings-calls/upcoming.ts +5 -5
- package/src/plugins/builtin/earnings-ripple/headless.ts +2 -1
- package/src/plugins/builtin/earnings-ripple/index.tsx +2 -0
- package/src/plugins/builtin/earnings-ripple/model.ts +3 -2
- package/src/plugins/builtin/earnings-ripple/pane.tsx +6 -6
- package/src/plugins/builtin/econ/calendar-model.ts +19 -3
- package/src/plugins/builtin/econ/detail-view.tsx +2 -2
- package/src/plugins/builtin/econ/fred-catalog.ts +33 -4
- package/src/plugins/builtin/econ/index.tsx +7 -6
- package/src/plugins/builtin/econ-statistics/detail.tsx +2 -1
- package/src/plugins/builtin/econ-statistics/headless.ts +25 -4
- package/src/plugins/builtin/econ-statistics/pane.tsx +2 -2
- package/src/plugins/builtin/equity-screener/headless.ts +5 -5
- package/src/plugins/builtin/equity-screener/model.ts +6 -4
- package/src/plugins/builtin/equity-screener/pane.tsx +7 -7
- package/src/plugins/builtin/equity-screener/screen-check.ts +2 -1
- package/src/plugins/builtin/equity-screener/ticker-check.tsx +2 -1
- package/src/plugins/builtin/estimate-revisions/model.ts +3 -2
- package/src/plugins/builtin/estimate-revisions/pane.tsx +8 -8
- package/src/plugins/builtin/executives/format.ts +4 -4
- package/src/plugins/builtin/exposure/headless.ts +8 -8
- package/src/plugins/builtin/exposure/model.ts +4 -3
- package/src/plugins/builtin/exposure/pane.tsx +6 -5
- package/src/plugins/builtin/fear-greed/format.ts +7 -7
- package/src/plugins/builtin/fear-greed/headless.ts +2 -1
- package/src/plugins/builtin/filing-events/feed.ts +2 -1
- package/src/plugins/builtin/futures/table.tsx +8 -8
- package/src/plugins/builtin/futures-curve/headless.ts +18 -18
- package/src/plugins/builtin/futures-curve/model.ts +5 -5
- package/src/plugins/builtin/futures-curve/pane.tsx +8 -8
- package/src/plugins/builtin/fx-matrix/index.tsx +2 -2
- package/src/plugins/builtin/fx-matrix/pairs.ts +2 -1
- package/src/plugins/builtin/gpu/board.tsx +6 -5
- package/src/plugins/builtin/gpu/changes.tsx +2 -1
- package/src/plugins/builtin/gpu/equities.tsx +2 -2
- package/src/plugins/builtin/gpu/headless.ts +4 -3
- package/src/plugins/builtin/gpu/model.ts +8 -7
- package/src/plugins/builtin/help/functions-table.tsx +41 -9
- package/src/plugins/builtin/help/index.tsx +6 -3
- package/src/plugins/builtin/help/keybindings-editor.tsx +35 -7
- package/src/plugins/builtin/help/shortcut-table.tsx +19 -7
- package/src/plugins/builtin/help/table-cells.tsx +51 -0
- package/src/plugins/builtin/holders/pane.tsx +4 -1
- package/src/plugins/builtin/insider/base-values.ts +2 -2
- package/src/plugins/builtin/insider/display.ts +2 -1
- package/src/plugins/builtin/insider/headless.ts +16 -16
- package/src/plugins/builtin/insider/insider-data.ts +2 -1
- package/src/plugins/builtin/insider/signals-model.ts +3 -3
- package/src/plugins/builtin/insider/table-model.ts +27 -13
- package/src/plugins/builtin/insider/table.tsx +1 -1
- package/src/plugins/builtin/ipo-calendar/model.ts +4 -4
- package/src/plugins/builtin/iv-history/format.ts +8 -7
- package/src/plugins/builtin/iv-history/headless.ts +9 -8
- package/src/plugins/builtin/iv-history/pane.tsx +3 -2
- package/src/plugins/builtin/iv-history/screen-pane.tsx +5 -4
- package/src/plugins/builtin/jobs/headless.ts +11 -11
- package/src/plugins/builtin/jobs/model.ts +2 -2
- package/src/plugins/builtin/jobs/pane.tsx +5 -5
- package/src/plugins/builtin/jodi/model.ts +2 -2
- package/src/plugins/builtin/jodi/pane.tsx +2 -1
- package/src/plugins/builtin/kelly-sizer/headless.ts +4 -4
- package/src/plugins/builtin/kelly-sizer/model.ts +2 -1
- package/src/plugins/builtin/kelly-sizer/sections.tsx +2 -2
- package/src/plugins/builtin/macro-day/headless.ts +27 -15
- package/src/plugins/builtin/macro-day/model.ts +42 -4
- package/src/plugins/builtin/macro-day/pane.tsx +30 -12
- package/src/plugins/builtin/macro-day/releases.ts +24 -1
- package/src/plugins/builtin/market-halts/model.ts +11 -10
- package/src/plugins/builtin/market-halts/pane.tsx +2 -1
- package/src/plugins/builtin/market-heatmap/index.tsx +4 -4
- package/src/plugins/builtin/market-movers/session-table.ts +3 -3
- package/src/plugins/builtin/market-movers/session.ts +2 -1
- package/src/plugins/builtin/market-movers/table.ts +5 -5
- package/src/plugins/builtin/market-valuation/detail.tsx +2 -2
- package/src/plugins/builtin/market-valuation/headless.ts +7 -7
- package/src/plugins/builtin/market-valuation/pane.tsx +7 -7
- package/src/plugins/builtin/members/breadth-pane.tsx +5 -4
- package/src/plugins/builtin/members/headless.ts +2 -1
- package/src/plugins/builtin/members/model.ts +3 -2
- package/src/plugins/builtin/members/pane.tsx +10 -9
- package/src/plugins/builtin/mna/distress/model.ts +2 -1
- package/src/plugins/builtin/mna/model.ts +5 -5
- package/src/plugins/builtin/money-markets/client.ts +4 -1
- package/src/plugins/builtin/money-markets/headless.ts +17 -5
- package/src/plugins/builtin/money-markets/index.tsx +1 -1
- package/src/plugins/builtin/money-markets/model.ts +3 -2
- package/src/plugins/builtin/money-markets/pane.tsx +11 -5
- package/src/plugins/builtin/news/headless.ts +5 -2
- package/src/plugins/builtin/news/wire/breaking/notifications.ts +21 -19
- package/src/plugins/builtin/news/wire/news/row.ts +3 -1
- package/src/plugins/builtin/news/wire/news/table.tsx +3 -2
- package/src/plugins/builtin/news/wire/persisted-articles.ts +28 -3
- package/src/plugins/builtin/notes/headless.ts +2 -1
- package/src/plugins/builtin/notes/model.ts +2 -1
- package/src/plugins/builtin/openfda/pane.tsx +4 -3
- package/src/plugins/builtin/options/carry.ts +3 -2
- package/src/plugins/builtin/options/market-reference.ts +2 -1
- package/src/plugins/builtin/options/table.ts +48 -9
- package/src/plugins/builtin/options/view.tsx +47 -17
- package/src/plugins/builtin/options-calculator/headless.ts +3 -2
- package/src/plugins/builtin/options-calculator/pane.tsx +7 -7
- package/src/plugins/builtin/options-positioning/headless.ts +8 -7
- package/src/plugins/builtin/options-positioning/model.ts +10 -10
- package/src/plugins/builtin/options-positioning/pane.tsx +5 -5
- package/src/plugins/builtin/options-scenario/collar.ts +5 -4
- package/src/plugins/builtin/options-scenario/csp-screen-headless.ts +11 -10
- package/src/plugins/builtin/options-scenario/csp-screen-pane.tsx +15 -14
- package/src/plugins/builtin/options-scenario/csp-screen.ts +2 -1
- package/src/plugins/builtin/options-scenario/csp.ts +6 -5
- package/src/plugins/builtin/options-scenario/headless.ts +6 -5
- package/src/plugins/builtin/options-scenario/hedge.ts +3 -3
- package/src/plugins/builtin/options-scenario/pane.tsx +7 -6
- package/src/plugins/builtin/options-scenario/strategy-screen.ts +1 -1
- package/src/plugins/builtin/pe-band/headless.ts +9 -8
- package/src/plugins/builtin/pe-band/pane.tsx +7 -7
- package/src/plugins/builtin/perps/cascade.ts +3 -2
- package/src/plugins/builtin/perps/headless.ts +10 -9
- package/src/plugins/builtin/perps/model.ts +14 -14
- package/src/plugins/builtin/perps/pane.tsx +3 -2
- package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +4 -2
- package/src/plugins/builtin/portfolio-list/cli/period-report.ts +61 -11
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +11 -3
- package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +2 -0
- package/src/plugins/builtin/portfolio-list/header.tsx +2 -2
- package/src/plugins/builtin/portfolio-list/headless.ts +33 -6
- package/src/plugins/builtin/portfolio-list/index.tsx +3 -2
- package/src/plugins/builtin/portfolio-list/pane/futures-terms.ts +4 -2
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +5 -3
- package/src/plugins/builtin/portfolio-list/pane/period-pnl.ts +26 -7
- package/src/plugins/builtin/portfolio-list/pane/purchase-date-fx.ts +4 -2
- package/src/plugins/builtin/portfolio-list/period-pnl.ts +16 -1
- package/src/plugins/builtin/portfolio-list/quick-add/index.tsx +2 -2
- package/src/plugins/builtin/portfolio-list/settings.ts +4 -1
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +8 -5
- package/src/plugins/builtin/portfolio-list/summary/totals.ts +6 -4
- package/src/plugins/builtin/portfolio-list/table.tsx +25 -15
- package/src/plugins/builtin/power/detail.tsx +6 -5
- package/src/plugins/builtin/power/gas-model.ts +8 -7
- package/src/plugins/builtin/power/gas.tsx +2 -1
- package/src/plugins/builtin/power/headless.ts +7 -6
- package/src/plugins/builtin/power/model.ts +3 -2
- package/src/plugins/builtin/power/prices-headless.ts +10 -9
- package/src/plugins/builtin/power/prices-model.ts +3 -2
- package/src/plugins/builtin/power/prices.tsx +2 -1
- package/src/plugins/builtin/primary-dealers/model.ts +3 -3
- package/src/plugins/builtin/primary-dealers/pane.tsx +2 -2
- package/src/plugins/builtin/rate-path/headless.ts +8 -7
- package/src/plugins/builtin/rate-path/model.ts +6 -5
- package/src/plugins/builtin/rate-path/pane.tsx +6 -5
- package/src/plugins/builtin/realized-vol/fx-proxy.ts +2 -1
- package/src/plugins/builtin/realized-vol/headless.ts +11 -10
- package/src/plugins/builtin/realized-vol/pane.tsx +5 -4
- package/src/plugins/builtin/relative-rotation/headless.ts +2 -1
- package/src/plugins/builtin/relative-rotation/pane.tsx +6 -6
- package/src/plugins/builtin/research/analyst-headless.ts +5 -5
- package/src/plugins/builtin/research/analyst-model.ts +7 -7
- package/src/plugins/builtin/research/analyst-pane.tsx +7 -7
- package/src/plugins/builtin/research/client.ts +14 -0
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +40 -30
- package/src/plugins/builtin/research/event-model.ts +55 -22
- package/src/plugins/builtin/research/event-sources.ts +26 -8
- package/src/plugins/builtin/research/relative-valuation-columns.ts +20 -12
- package/src/plugins/builtin/research/relative-valuation-currency.ts +16 -0
- package/src/plugins/builtin/research/relative-valuation-headless.ts +33 -21
- package/src/plugins/builtin/research/relative-valuation-model.ts +31 -17
- package/src/plugins/builtin/research/relative-valuation-pane.tsx +29 -14
- package/src/plugins/builtin/research-search/model.ts +2 -1
- package/src/plugins/builtin/research-search/saved-view.tsx +4 -3
- package/src/plugins/builtin/revenue-breakdown/model.ts +4 -4
- package/src/plugins/builtin/reverse-dcf/headless.ts +7 -7
- package/src/plugins/builtin/reverse-dcf/model.ts +4 -4
- package/src/plugins/builtin/reverse-dcf/pane.tsx +2 -2
- package/src/plugins/builtin/scanner/flow-model.ts +7 -4
- package/src/plugins/builtin/scanner/flow-pane.tsx +1 -1
- package/src/plugins/builtin/scanner/headless.ts +3 -2
- package/src/plugins/builtin/scanner/hilo-model.ts +2 -1
- package/src/plugins/builtin/scanner/live-headless.ts +2 -2
- package/src/plugins/builtin/scanner/live-model.ts +3 -2
- package/src/plugins/builtin/scanner/live-pane.tsx +5 -5
- package/src/plugins/builtin/seasonality/headless.ts +2 -1
- package/src/plugins/builtin/seasonality/pane.tsx +4 -3
- package/src/plugins/builtin/sec/filing-display.tsx +12 -15
- package/src/plugins/builtin/sec/fund-facts.ts +2 -2
- package/src/plugins/builtin/sec/headless.ts +2 -1
- package/src/plugins/builtin/sec/index.tsx +6 -2
- package/src/plugins/builtin/sectors/headless.ts +4 -4
- package/src/plugins/builtin/sectors/index.tsx +7 -7
- package/src/plugins/builtin/shared/cloud-upgrade.ts +4 -2
- package/src/plugins/builtin/shared/cpi-year-gap.ts +67 -0
- package/src/plugins/builtin/shared/earnings-calendar.ts +90 -6
- package/src/plugins/builtin/shared/earnings-report.ts +13 -6
- package/src/plugins/builtin/shared/research-cells.tsx +2 -2
- package/src/plugins/builtin/shared/source-footer.ts +2 -1
- package/src/plugins/builtin/shared/trend.ts +2 -2
- package/src/plugins/builtin/shared/use-quote-board.ts +9 -8
- package/src/plugins/builtin/short-interest/headless.ts +6 -6
- package/src/plugins/builtin/short-interest/model.ts +9 -9
- package/src/plugins/builtin/short-interest/publications-model.ts +5 -5
- package/src/plugins/builtin/short-interest/publications-pane.tsx +3 -2
- package/src/plugins/builtin/short-interest/watch-headless.ts +5 -5
- package/src/plugins/builtin/short-interest/watch-pane.tsx +6 -6
- package/src/plugins/builtin/short-volume/model.ts +5 -5
- package/src/plugins/builtin/short-volume/pane.tsx +4 -4
- package/src/plugins/builtin/social-mentions/headless.ts +2 -1
- package/src/plugins/builtin/social-mentions/model.ts +4 -4
- package/src/plugins/builtin/supply-chain/graph-model.ts +2 -1
- package/src/plugins/builtin/supply-chain/graph-pane.tsx +2 -2
- package/src/plugins/builtin/supply-chain/headless.ts +3 -2
- package/src/plugins/builtin/supply-chain/model.ts +4 -4
- package/src/plugins/builtin/supply-chain/pane.tsx +2 -2
- package/src/plugins/builtin/supply-chain/row-evidence.tsx +2 -1
- package/src/plugins/builtin/themes/headless.ts +2 -1
- package/src/plugins/builtin/themes/model.ts +3 -2
- package/src/plugins/builtin/themes/pane.tsx +3 -2
- package/src/plugins/builtin/thirteenf/format.ts +9 -9
- package/src/plugins/builtin/thirteenf/headless.ts +3 -2
- package/src/plugins/builtin/thirteenf/model.ts +2 -1
- package/src/plugins/builtin/thirteenf/overlap-pane.tsx +2 -1
- package/src/plugins/builtin/thirteenf/pane.tsx +5 -4
- package/src/plugins/builtin/thirteenf/report-notes.ts +2 -1
- package/src/plugins/builtin/thirteenf/signals-pane.tsx +3 -2
- package/src/plugins/builtin/thirteenf/table.ts +6 -5
- package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +45 -2
- package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +4 -3
- package/src/plugins/builtin/ticker-detail/data-panes/historical-prices.tsx +4 -4
- package/src/plugins/builtin/ticker-detail/data-panes/returns-pane.tsx +3 -3
- package/src/plugins/builtin/ticker-detail/financials/model.ts +83 -35
- package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +3 -1
- package/src/plugins/builtin/ticker-detail/financials/ratios.ts +2 -2
- package/src/plugins/builtin/ticker-detail/financials/schema.ts +14 -18
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +8 -13
- package/src/plugins/builtin/ticker-detail/headless.ts +33 -6
- package/src/plugins/builtin/ticker-detail/overview/chart-scale.ts +52 -0
- package/src/plugins/builtin/ticker-detail/overview/components.tsx +8 -9
- package/src/plugins/builtin/ticker-detail/overview/model.ts +28 -14
- package/src/plugins/builtin/ticker-detail/overview/pane.tsx +6 -0
- package/src/plugins/builtin/ticker-detail/overview/tax-equivalent.ts +2 -1
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +43 -9
- package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +7 -5
- package/src/plugins/builtin/ticker-detail/quote-monitor/rows.ts +4 -4
- package/src/plugins/builtin/ticker-detail/settings.ts +17 -0
- package/src/plugins/builtin/time-sales/headless.ts +3 -2
- package/src/plugins/builtin/time-sales/model.ts +7 -5
- package/src/plugins/builtin/time-sales/pane.tsx +7 -6
- package/src/plugins/builtin/trace-bonds/model.ts +3 -2
- package/src/plugins/builtin/trace-bonds/pane.tsx +3 -2
- package/src/plugins/builtin/treasury-auctions/client.ts +2 -1
- package/src/plugins/builtin/treasury-auctions/headless.ts +6 -6
- package/src/plugins/builtin/treasury-auctions/hk-headless.ts +3 -2
- package/src/plugins/builtin/treasury-auctions/hk-view.tsx +10 -9
- package/src/plugins/builtin/treasury-auctions/hk.ts +5 -5
- package/src/plugins/builtin/treasury-auctions/model.ts +4 -4
- package/src/plugins/builtin/treasury-auctions/pane.tsx +18 -18
- package/src/plugins/builtin/treasury-auctions/treasury-direct.ts +2 -1
- package/src/plugins/builtin/treasury-daily/model.ts +2 -2
- package/src/plugins/builtin/vol-surface/events.ts +5 -4
- package/src/plugins/builtin/vol-surface/headless.ts +19 -18
- package/src/plugins/builtin/vol-surface/heat-grid.tsx +2 -1
- package/src/plugins/builtin/vol-surface/pane.tsx +8 -7
- package/src/plugins/builtin/vol-surface/stored.ts +2 -1
- package/src/plugins/builtin/vol-surface/tables.ts +4 -3
- package/src/plugins/builtin/volatility/headless.ts +5 -4
- package/src/plugins/builtin/volatility/pane.tsx +6 -6
- package/src/plugins/builtin/world-indices/headless.ts +7 -7
- package/src/plugins/builtin/world-indices/index.tsx +3 -1
- package/src/plugins/builtin/world-venue-map/headless.ts +2 -1
- package/src/plugins/builtin/world-venue-map/layered-pane.tsx +2 -1
- package/src/plugins/builtin/world-venue-map/layers.ts +3 -2
- package/src/plugins/builtin/world-venue-map/use-geo.ts +4 -2
- package/src/plugins/builtin/yield-curve/curves.ts +3 -3
- package/src/plugins/builtin/yield-curve/headless.ts +7 -6
- package/src/plugins/builtin/yield-curve/index.tsx +5 -4
- package/src/plugins/builtin/yield-curve/swaps.tsx +2 -1
- package/src/portfolio/allocation.ts +5 -5
- package/src/portfolio/collection-name.ts +2 -1
- package/src/portfolio/column-values.ts +61 -45
- package/src/portfolio/futures-positions.ts +2 -1
- package/src/portfolio/listed-symbol.ts +4 -2
- package/src/portfolio/period-pnl.ts +51 -1
- package/src/renderers/dom/dialog-host.tsx +5 -5
- package/src/renderers/electrobun/bun/desktop/backend-requests.ts +7 -1
- package/src/renderers/electrobun/view/remote/capability-invoker.ts +1 -1
- package/src/renderers/opentui/dialog-host.tsx +3 -4
- package/src/renderers/opentui/ui-host.tsx +32 -2
- package/src/renderers/share/layout-view.tsx +2 -1
- package/src/sources/gloomberb-cloud/news.ts +9 -0
- package/src/sources/gloomberb-cloud/normalizers.ts +7 -0
- package/src/sources/provider-router/history.ts +5 -2
- package/src/sources/provider-router/search.ts +15 -10
- package/src/state/hooks/inline-tickers.ts +3 -2
- package/src/state/hooks/quote-streaming.ts +9 -10
- package/src/team/collections-sync.ts +8 -3
- package/src/telemetry/usage-counts.ts +26 -0
- package/src/test-support/plugin-persistence.ts +12 -0
- package/src/tickers/company-name-listing.ts +6 -5
- package/src/tickers/company-name.ts +36 -2
- package/src/tickers/instrument-coverage.ts +27 -0
- package/src/tickers/listing-venues.ts +26 -1
- package/src/tickers/renamed-listings.ts +2 -1
- package/src/tickers/search/home-listing.ts +38 -1
- package/src/tickers/search/index.ts +22 -2
- package/src/tickers/search/ranking.ts +21 -2
- package/src/tickers/starter-symbols.ts +7 -0
- package/src/time-series/base-series.ts +4 -0
- package/src/time-series/fundamentals/statement-fields.ts +11 -14
- package/src/time-series/history-acquisition.ts +1 -1
- package/src/time-series/log-scale.ts +9 -0
- package/src/time-series/reporting.ts +3 -3
- package/src/time-series/resolve.ts +6 -4
- package/src/time-series/transforms.ts +10 -5
- package/src/time-series/types.ts +5 -2
- package/src/types/config.ts +9 -0
- package/src/types/data-provider.ts +3 -2
- package/src/types/financials.ts +28 -0
- package/src/types/headless.ts +2 -0
- package/src/types/instrument.ts +6 -0
- package/src/types/plugin-panes.ts +1 -1
- package/src/types/plugin-reports.ts +8 -0
- package/src/ui/dialog-stack.ts +17 -0
- package/src/ui/dialog.tsx +6 -2
- package/src/utils/crypto-pair.ts +9 -0
- package/src/utils/datetime-format.ts +74 -33
- package/src/utils/exchanges.ts +13 -0
- package/src/utils/financial-statements.ts +98 -17
- package/src/utils/format.ts +4 -9
- package/src/utils/fundamentals.ts +38 -16
- package/src/utils/futures-generic.ts +14 -0
- package/src/utils/growth.ts +67 -0
- package/src/utils/keyboard.ts +6 -0
- package/src/utils/options.ts +1 -1
- package/src/utils/report-timing.ts +2 -2
- package/src/utils/served-rates.ts +45 -0
- package/src/utils/text-wrap.ts +84 -3
- package/src/utils/trailing-dividend.ts +13 -3
- package/src/utils/zoned-date-time.ts +47 -22
|
@@ -46,7 +46,7 @@ import { isRecord } from "../../utils/guards";
|
|
|
46
46
|
import { displayTickerKey } from "../../utils/exchanges";
|
|
47
47
|
import { splitSymbolWords } from "../symbol-args";
|
|
48
48
|
import { formatUtcTime, localTimeSuffix } from "../../utils/utc-time";
|
|
49
|
-
import { formatCompact } from "../../utils/format";
|
|
49
|
+
import { MISSING_VALUE, formatCompact } from "../../utils/format";
|
|
50
50
|
import { deriveHeadlessFreshness, formatFreshnessLine, staleRowsText, withSavedCopy, type ReportFreshness } from "./freshness";
|
|
51
51
|
import { DATA_SERVICE_UNREACHABLE_MESSAGE } from "../../utils/network-failure";
|
|
52
52
|
import { accessGateStatus, errorsAccessGate, isProLock, reportGateText } from "./access-gate";
|
|
@@ -419,7 +419,7 @@ export function serializeHeadlessPaneResult(
|
|
|
419
419
|
}
|
|
420
420
|
|
|
421
421
|
function displayValue(value: unknown): string {
|
|
422
|
-
if (value == null) return
|
|
422
|
+
if (value == null) return MISSING_VALUE;
|
|
423
423
|
if (value instanceof Date) return displayTime(value.getTime());
|
|
424
424
|
if (typeof value === "number") return displayNumber(value);
|
|
425
425
|
if (typeof value === "object") return JSON.stringify(value);
|
|
@@ -449,7 +449,7 @@ function displayNumber(value: number): string {
|
|
|
449
449
|
}
|
|
450
450
|
|
|
451
451
|
function displayTime(time: number): string {
|
|
452
|
-
if (!Number.isFinite(time)) return
|
|
452
|
+
if (!Number.isFinite(time)) return MISSING_VALUE;
|
|
453
453
|
return formatUtcTime(new Date(time));
|
|
454
454
|
}
|
|
455
455
|
|
|
@@ -488,7 +488,7 @@ function observesDays(series: HeadlessSeries): boolean {
|
|
|
488
488
|
|
|
489
489
|
function seriesPointDate(series: HeadlessSeries, date: SeriesPointDate): string {
|
|
490
490
|
const time = seriesPointTime(date);
|
|
491
|
-
if (!Number.isFinite(time)) return typeof date === "string" ? date :
|
|
491
|
+
if (!Number.isFinite(time)) return typeof date === "string" ? date : MISSING_VALUE;
|
|
492
492
|
const calendar = calendarSeries(series);
|
|
493
493
|
return calendar ? observationDate(time, calendar) : formatUtcTime({ time, dateOnly: isDateOnly(date) || observesDays(series) });
|
|
494
494
|
}
|
|
@@ -531,7 +531,7 @@ function seriesPointExportDate(series: HeadlessSeries, date: SeriesPointDate, da
|
|
|
531
531
|
* without float noise.
|
|
532
532
|
*/
|
|
533
533
|
function seriesValue(series: HeadlessSeries, value: number | null): string {
|
|
534
|
-
if (value == null) return
|
|
534
|
+
if (value == null) return MISSING_VALUE;
|
|
535
535
|
if (!Number.isFinite(value)) return displayNumber(value);
|
|
536
536
|
if (series.textDecimals != null) return value.toFixed(series.textDecimals);
|
|
537
537
|
if (series.textCompact) return formatCompact(value);
|
|
@@ -619,12 +619,12 @@ const TRAILING_COLUMNS: HeadlessPaneColumn[] = [
|
|
|
619
619
|
|
|
620
620
|
function trailingCells(trailing: HeadlessSeries["trailing"]): Record<string, string> {
|
|
621
621
|
if (!trailing) return {};
|
|
622
|
-
const mean = (value: number | null) => (value == null ?
|
|
622
|
+
const mean = (value: number | null) => (value == null ? MISSING_VALUE : value.toFixed(1));
|
|
623
623
|
const change = trailing.changeVsYearAgoPct;
|
|
624
624
|
return {
|
|
625
625
|
avg7: mean(trailing.avg7),
|
|
626
626
|
avg28: mean(trailing.avg28),
|
|
627
|
-
vsYearAgo: change == null || !Number.isFinite(change) ?
|
|
627
|
+
vsYearAgo: change == null || !Number.isFinite(change) ? MISSING_VALUE : `${change > 0 ? "+" : ""}${change.toFixed(1)}%`,
|
|
628
628
|
};
|
|
629
629
|
}
|
|
630
630
|
|
|
@@ -637,7 +637,7 @@ function renderSeries(result: HeadlessSeriesResult): string[] {
|
|
|
637
637
|
return {
|
|
638
638
|
series: series.label,
|
|
639
639
|
name: series.name?.trim() || null,
|
|
640
|
-
latest: series.notMeaningful ? series.notMeaningful.asOf : latest ? seriesLatestDate(series, latest.date) :
|
|
640
|
+
latest: series.notMeaningful ? series.notMeaningful.asOf : latest ? seriesLatestDate(series, latest.date) : MISSING_VALUE,
|
|
641
641
|
value: series.notMeaningful ? "N/M" : seriesValue(series, latest?.value ?? latest?.close ?? null),
|
|
642
642
|
unit: series.unit?.trim() ? currencyRateUnitText(series.unit.trim()) : null,
|
|
643
643
|
...trailingCells(series.trailing),
|
|
@@ -867,8 +867,11 @@ export function headlessReportTables(
|
|
|
867
867
|
const columns = displayedColumns(columnsFor(rowsResult.rows, rowsResult.columns, definition.columns));
|
|
868
868
|
const rowIdentities = rowIdentitiesOf(rowsResult.rows, rowsResult);
|
|
869
869
|
const own = exportRowsTable(title, columns, rowsResult.rows, { status: true, ...(rowsResult.rowUnitKey ? { rowUnitKey: rowsResult.rowUnitKey } : {}) });
|
|
870
|
-
const
|
|
871
|
-
|
|
870
|
+
const ownIdentity = {
|
|
871
|
+
...(rowsResult.unit?.trim() ? { currencyOrUnit: rowsResult.unit.trim() } : {}),
|
|
872
|
+
...(rowsResult.interval?.trim() ? { interval: rowsResult.interval.trim() } : {}),
|
|
873
|
+
};
|
|
874
|
+
tables = [{ ...own, ...(rowIdentities ? { rowIdentities } : {}), ...(Object.keys(ownIdentity).length > 0 ? { identity: ownIdentity } : {}) }, ...(rowsResult.exportTables ?? []).map((extra) => {
|
|
872
875
|
const identity = {
|
|
873
876
|
...(extra.unit?.trim() ? { currencyOrUnit: extra.unit.trim() } : {}),
|
|
874
877
|
...(extra.interval?.trim() ? { interval: extra.interval.trim() } : {}),
|
|
@@ -406,7 +406,7 @@ export async function runPaneFunction(args: string[], ctx: CliCommandContext) {
|
|
|
406
406
|
const moved = { command: "fn", retry: (key: string) => `gloom fn ${resolved.token} ${key}` };
|
|
407
407
|
// A report that fails or comes back empty for an exchange the symbol is not listed on says so.
|
|
408
408
|
// A report written to a file is drawn for it as it is built: no colour and no terminal width, as a redirect gets it.
|
|
409
|
-
const buildReport = () => buildFunctionReport(resolved, context, parsed.arg);
|
|
409
|
+
const buildReport = () => buildFunctionReport(resolved, context, parsed.arg, registry);
|
|
410
410
|
// A report still loading after a few seconds (a chain the server reads cold) says so, so it never looks stuck.
|
|
411
411
|
const progress = progressNotice(ctx, [resolved.token, parsed.arg].filter(Boolean).join(" "), FN_PROGRESS_AFTER_MS);
|
|
412
412
|
const report = await refuseMovedListing(fate, moved, () => withPersistedCloudSession(
|
|
@@ -67,6 +67,11 @@ export interface ParsedPaneFunctionArgs {
|
|
|
67
67
|
* pair with no options of its own): an export still has a row for each, its reason in the status column.
|
|
68
68
|
*/
|
|
69
69
|
refusedListings?: Array<{ symbol: string; reason: string }>;
|
|
70
|
+
/**
|
|
71
|
+
* The argument's words as the shell passed them, when one holds a space: it was quoted (`fn G "VOD LN"`), so
|
|
72
|
+
* its words are one entry, not several typed apart (`fn G AAPL MSFT`). `arg` joins them either way.
|
|
73
|
+
*/
|
|
74
|
+
quotedWords?: string[];
|
|
70
75
|
}
|
|
71
76
|
|
|
72
77
|
export interface ParsedPaneCatalogArgs {
|
|
@@ -227,6 +232,7 @@ export function parsePaneFunctionArgs(
|
|
|
227
232
|
|
|
228
233
|
const target = positionals[0]?.trim() ?? "";
|
|
229
234
|
const arg = positionals.slice(1).join(" ").trim();
|
|
235
|
+
const quoted = positionals.slice(1).some((word) => /\s/.test(word.trim()));
|
|
230
236
|
// The outer CLI parser consumes --limit and --tail before fn/shot sees its arguments.
|
|
231
237
|
// Restore them for the pane's own schema and loader, including bounds checks,
|
|
232
238
|
// so a function without a tail option says so instead of ignoring it.
|
|
@@ -239,6 +245,7 @@ export function parsePaneFunctionArgs(
|
|
|
239
245
|
...(explain ? { explain } : {}),
|
|
240
246
|
...(strict ? { strict } : {}),
|
|
241
247
|
...(shotOnly.length > 0 ? { shotOnly } : {}),
|
|
248
|
+
...(quoted ? { quotedWords: positionals.slice(1) } : {}),
|
|
242
249
|
};
|
|
243
250
|
}
|
|
244
251
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { MarketContext } from "../types";
|
|
2
2
|
import type { NormalizedPaneFunctionOptions } from "./capabilities";
|
|
3
3
|
import type { ResolvedPaneFunction } from "./resolver";
|
|
4
|
+
import type { PaneFunctionCatalog } from "./catalog";
|
|
4
5
|
import { buildHeadlessFunctionReport } from "./headless";
|
|
5
6
|
import { appendDomReportFooter, buildDomFunctionReport, domReportNote, domReportView } from "./dom";
|
|
6
7
|
import type { ReportFreshness } from "./freshness";
|
|
@@ -68,6 +69,8 @@ export async function buildFunctionReport(
|
|
|
68
69
|
resolved: ResolvedPaneFunction,
|
|
69
70
|
context: MarketContext,
|
|
70
71
|
rawArg: string,
|
|
72
|
+
/** The functions the report was resolved among, for a note that offers others (ASKG behind its wall). */
|
|
73
|
+
catalog?: PaneFunctionCatalog,
|
|
71
74
|
): Promise<PaneFunctionReport> {
|
|
72
75
|
const startedAt = performance.now();
|
|
73
76
|
const source = resolvePaneFunctionReportSource(resolved);
|
|
@@ -93,7 +96,7 @@ export async function buildFunctionReport(
|
|
|
93
96
|
|
|
94
97
|
const report = source === "headless"
|
|
95
98
|
? await buildHeadlessFunctionReport(resolved, context, rawArg)
|
|
96
|
-
: await buildDomFunctionReport(resolved, context, rawArg);
|
|
99
|
+
: await buildDomFunctionReport(resolved, context, rawArg, catalog);
|
|
97
100
|
const elapsedMs = Math.max(0, Math.round(performance.now() - startedAt));
|
|
98
101
|
report.data = { ...report.data, source, elapsedMs };
|
|
99
102
|
// A report about one symbol names it on every exported row; a chart's series name their own.
|
|
@@ -9,13 +9,14 @@ import type {
|
|
|
9
9
|
} from "../../types/plugin";
|
|
10
10
|
import { applyChartComposerCapabilityOptions } from "../../plugins/builtin/chart-composer/cli-options";
|
|
11
11
|
import { parseChartSpec } from "../../plugins/builtin/chart-composer/chart-spec";
|
|
12
|
+
import { CHART_COMPOSER_TEMPLATE_ID } from "../../plugins/builtin/chart-composer/catalog-inventory";
|
|
12
13
|
import { normalizeTickerInput } from "../../tickers/search";
|
|
13
14
|
import { slugifyName } from "../../utils/slugify";
|
|
14
15
|
import { fredSeriesArgument } from "../../series/fred-argument";
|
|
15
16
|
import {
|
|
16
17
|
type CliListing, listCoinNotes, ListingArgError, listingInstrument, listingReadNotes, MAX_CHOICE_LOOKUPS, resolveCliListing, usListingsOnlyMessage,
|
|
17
18
|
} from "../listing-arg";
|
|
18
|
-
import { uncoveredInstrumentKind, uncoveredInstrumentMessage } from "../../tickers/instrument-coverage";
|
|
19
|
+
import { uncoveredInstrumentKind, uncoveredInstrumentMessage, uncoveredInstrumentsMessage } from "../../tickers/instrument-coverage";
|
|
19
20
|
import { uncoveredInstrumentCommand } from "../uncovered-instrument";
|
|
20
21
|
import { listingAbroadVenue } from "../../utils/sec";
|
|
21
22
|
import { splitSymbolArgs, stripStrayEdges } from "../symbol-args";
|
|
@@ -27,7 +28,7 @@ import { readTerminalCodeArg } from "../../tickers/company-name-listing";
|
|
|
27
28
|
import { unknownBloombergMarket, unreadBloombergCode } from "../../tickers/terminal-codes";
|
|
28
29
|
import { notATickerWords } from "../company-name-hint";
|
|
29
30
|
import type { MarketContext } from "../types";
|
|
30
|
-
import {
|
|
31
|
+
import { shellWord } from "../../utils/shell-word";
|
|
31
32
|
import { readWatchlistArgument, watchlistMemberSymbol } from "../../portfolio/collection-name";
|
|
32
33
|
import {
|
|
33
34
|
buildPaneFunctionLookup,
|
|
@@ -225,6 +226,8 @@ export async function applyListingArgument(
|
|
|
225
226
|
): Promise<ParsedPaneFunctionArgs> {
|
|
226
227
|
const found = args.target ? findPaneFunction(registry, args.target) : null;
|
|
227
228
|
if (!found?.pane || !args.arg) return args;
|
|
229
|
+
// G's series are text (`fn G AAPL MSFT` is two), but a quoted terminal code in them is one listing.
|
|
230
|
+
if (found.template?.id === CHART_COMPOSER_TEMPLATE_ID) return withChartTerminalCodes(args, context);
|
|
228
231
|
const headless = getHeadlessPaneDefinition(found.template, found.pane);
|
|
229
232
|
const kind = headless?.argument.kind ?? found.template?.shortcut?.argKind;
|
|
230
233
|
const takesOneTicker = kind === "ticker";
|
|
@@ -233,7 +236,7 @@ export async function applyListingArgument(
|
|
|
233
236
|
if (!(takesOneTicker || takesList) || getPaneFunctionCapability(found.template, found.pane).options.some((option) => option.key === "exchange")) {
|
|
234
237
|
return args;
|
|
235
238
|
}
|
|
236
|
-
// A watchlist's name stands for its symbols, as saved (`fn SIW HY3`).
|
|
239
|
+
// A watchlist's or a portfolio's name stands for its symbols, as saved (`fn SIW HY3`, `fn RIPL "Pension Book"`).
|
|
237
240
|
const watchlist = takesList ? await watchlistArgument(args.arg, context, headless?.argument.maximum) : null;
|
|
238
241
|
if (watchlist) args = { ...args, arg: watchlist.symbols.join(", ") };
|
|
239
242
|
// A function that reads FRED series (MDAY) gets FRED:T10Y2Y as typed; any other is told it is no listing.
|
|
@@ -299,7 +302,10 @@ export async function applyListingArgument(
|
|
|
299
302
|
if (listings.length === 0) {
|
|
300
303
|
throw new ListingArgError(answers.map((answer) => answer.message).join("\n"), answers.map((answer) => answer.details).join("\n"));
|
|
301
304
|
}
|
|
302
|
-
|
|
305
|
+
// Several are said in one line (a portfolio's futures and funds), each one's own command left out.
|
|
306
|
+
notes.push(...outside.length > 1
|
|
307
|
+
? [uncoveredInstrumentsMessage(token, covered, outside.map(({ instrument }) => instrument))]
|
|
308
|
+
: answers.map((answer) => `${answer.message} ${answer.details}`));
|
|
303
309
|
refused.push(...outside.map(({ listing }, index) => ({ symbol: listing.key, reason: answers[index]!.message })));
|
|
304
310
|
}
|
|
305
311
|
}
|
|
@@ -348,10 +354,39 @@ export async function applyListingArgument(
|
|
|
348
354
|
}
|
|
349
355
|
|
|
350
356
|
/**
|
|
351
|
-
*
|
|
352
|
-
*
|
|
353
|
-
*
|
|
354
|
-
*
|
|
357
|
+
* A chart's series typed in quotes that is a terminal's code for one listing
|
|
358
|
+
* (`fn G "VOD LN"`, `"MC FP Equity"`) is that listing, as `quote`, `history`,
|
|
359
|
+
* HP and GP read it, and says so: its words are not two series (VOD on NASDAQ
|
|
360
|
+
* and LN, a ticker that stopped trading in 2020). So is each such entry of a
|
|
361
|
+
* quoted list (`"VOD LN, MC FP"`). Words typed apart (`fn G AAPL MSFT`) are a
|
|
362
|
+
* series each, and a qualified symbol (VOD:LSE) is read as written.
|
|
363
|
+
*/
|
|
364
|
+
async function withChartTerminalCodes(args: ParsedPaneFunctionArgs, context: MarketContext): Promise<ParsedPaneFunctionArgs> {
|
|
365
|
+
if (!args.quotedWords) return args;
|
|
366
|
+
const notes: string[] = [];
|
|
367
|
+
const readEntry = async (entry: string) => {
|
|
368
|
+
const typed = entry.trim();
|
|
369
|
+
const code = /\s/.test(typed) ? await readTerminalCodeArg(context.dataProvider, typed) : null;
|
|
370
|
+
if (!code) return entry;
|
|
371
|
+
notes.push(`Read "${typed}" as ${code.key}.`);
|
|
372
|
+
return entry.replace(typed, code.key);
|
|
373
|
+
};
|
|
374
|
+
const words = await Promise.all(args.quotedWords.map(async (word) => /\s/.test(word.trim())
|
|
375
|
+
? (await Promise.all(word.split(/([;,\n])/).map((part, index) => index % 2 === 1 ? part : readEntry(part)))).join("")
|
|
376
|
+
: word));
|
|
377
|
+
if (notes.length === 0) return args;
|
|
378
|
+
return { ...args, arg: words.join(" ").trim(), listingNotes: [...args.listingNotes ?? [], ...notes] };
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* The symbols of the watchlist or portfolio a list argument names by its name
|
|
383
|
+
* (case aside), as saved, a portfolio's holdings being what it holds now, at
|
|
384
|
+
* most the function's `maximum` of them, with the note that says the name was
|
|
385
|
+
* read as that list (`readWatchlistArgument`). A list's id is no name: `main`
|
|
386
|
+
* is the default portfolio's id and a ticker too. Null when the argument names
|
|
387
|
+
* neither, or names an empty list a ticker could be named as (an empty
|
|
388
|
+
* watchlist named AI reads AI); an empty list's name of several words fails,
|
|
389
|
+
* saying so.
|
|
355
390
|
*/
|
|
356
391
|
async function watchlistArgument(
|
|
357
392
|
arg: string,
|
|
@@ -359,13 +394,24 @@ async function watchlistArgument(
|
|
|
359
394
|
maximum: number | undefined,
|
|
360
395
|
): Promise<{ symbols: string[]; notes: string[] } | null> {
|
|
361
396
|
if (/[,;\t\n]/.test(arg)) return null;
|
|
362
|
-
const
|
|
363
|
-
|
|
364
|
-
const
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
if (
|
|
368
|
-
const
|
|
397
|
+
const wanted = arg.trim().toLowerCase();
|
|
398
|
+
const named = <T extends { name: string }>(lists: readonly T[]) => lists.find((list) => list.name.trim().toLowerCase() === wanted) ?? null;
|
|
399
|
+
const watchlist = named(context.config.watchlists);
|
|
400
|
+
const portfolio = watchlist ? null : named(context.config.portfolios);
|
|
401
|
+
const list = watchlist ?? portfolio;
|
|
402
|
+
if (!list) return null;
|
|
403
|
+
const members = (await context.store.loadAllTickers()).filter((ticker) => watchlist
|
|
404
|
+
? ticker.metadata.watchlists.includes(watchlist.id)
|
|
405
|
+
: ticker.metadata.portfolios.includes(portfolio!.id)
|
|
406
|
+
|| ticker.metadata.positions.some((position) => position.portfolio === portfolio!.id && position.shares !== 0));
|
|
407
|
+
const symbols = [...new Set(members.map((ticker) => watchlistMemberSymbol(ticker.metadata)))];
|
|
408
|
+
const kind = watchlist ? "watchlist" : "portfolio";
|
|
409
|
+
if (symbols.length === 0) {
|
|
410
|
+
if (!/\s/.test(arg.trim())) return null;
|
|
411
|
+
throw new ListingArgError(`${kind === "watchlist" ? "Watchlist" : "Portfolio"} "${list.name}" is empty, so there is nothing to read.`,
|
|
412
|
+
`Add symbols with gloom ${kind} add ${shellWord(list.name)} AAPL, or type tickers.`);
|
|
413
|
+
}
|
|
414
|
+
const read = readWatchlistArgument(arg, list, symbols, maximum, kind);
|
|
369
415
|
return { symbols: read.symbols, notes: [read.note] };
|
|
370
416
|
}
|
|
371
417
|
|
|
@@ -3,7 +3,7 @@ import type { PerpBoardRow } from "../api-client/perps";
|
|
|
3
3
|
import type { Quote } from "../types/financials";
|
|
4
4
|
import { loadPerpetualMarket } from "../sources/gloomberb-cloud/perpetuals";
|
|
5
5
|
import { PERPETUAL_TYPE, perpetualListing } from "../tickers/perpetual-listing";
|
|
6
|
-
import { formatCompact } from "../utils/format";
|
|
6
|
+
import { MISSING_VALUE, formatCompact } from "../utils/format";
|
|
7
7
|
|
|
8
8
|
/** What `quote` adds for a perpetual: the market PERP opens, its funding and open interest. Rates are fractions. */
|
|
9
9
|
export interface PerpetualContractPayload {
|
|
@@ -55,8 +55,8 @@ export function perpetualContractStats(contract: PerpetualContractPayload): [str
|
|
|
55
55
|
.filter(Boolean).join(", ");
|
|
56
56
|
return [
|
|
57
57
|
["Market", `${contract.marketId} (PERP)`],
|
|
58
|
-
["Funding 8h", contract.fundingRate8h == null ?
|
|
59
|
-
["Open interest", contract.openInterestUsd == null ?
|
|
60
|
-
["Premium", contract.premium == null ?
|
|
58
|
+
["Funding 8h", contract.fundingRate8h == null ? MISSING_VALUE : `${percent(contract.fundingRate8h, 4)}${basis ? ` (${basis})` : ""}`],
|
|
59
|
+
["Open interest", contract.openInterestUsd == null ? MISSING_VALUE : `${formatCompact(contract.openInterestUsd, { fixedDecimals: true })} USD`],
|
|
60
|
+
["Premium", contract.premium == null ? MISSING_VALUE : `${percent(contract.premium, 2)} vs oracle`],
|
|
61
61
|
];
|
|
62
62
|
}
|
package/src/cli/quote-answer.ts
CHANGED
|
@@ -67,7 +67,11 @@ export interface QuoteAnswer {
|
|
|
67
67
|
/** The listing the row is: the one asked for, or the venue a bare symbol was quoted on. */
|
|
68
68
|
listing: CliListing;
|
|
69
69
|
/** Why there is no quote, when there is more to say than the source's own error. */
|
|
70
|
-
failure?: {
|
|
70
|
+
failure?: {
|
|
71
|
+
message: string; details?: string; oneLine: string;
|
|
72
|
+
/** Several companies list the symbol and it went to none: a choice between live listings, not a dead symbol. */
|
|
73
|
+
choose?: boolean;
|
|
74
|
+
};
|
|
71
75
|
notes: string[];
|
|
72
76
|
/**
|
|
73
77
|
* Lines about another listing than the row's, printed under the table
|
|
@@ -194,7 +198,7 @@ export async function answerQuote(
|
|
|
194
198
|
other ? `${other.heading}: ${other.listings.join(", ")}.` : "",
|
|
195
199
|
...tryLines,
|
|
196
200
|
].filter(Boolean).join(" ");
|
|
197
|
-
return { result, listing, failure: { message, details, oneLine }, notes: [] };
|
|
201
|
+
return { result, listing, failure: { message, details, oneLine, ...other?.choose ? { choose: true } : {} }, notes: [] };
|
|
198
202
|
}
|
|
199
203
|
|
|
200
204
|
/**
|
package/src/cli/result.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MISSING_VALUE } from "../utils/format";
|
|
1
2
|
import type { CliGlobalOptions } from "./options";
|
|
2
3
|
import {
|
|
3
4
|
cliPlainEnabled,
|
|
@@ -155,6 +156,12 @@ export interface CliResultRenderOptions<T = unknown, Row = Record<string, unknow
|
|
|
155
156
|
* without a reason here, named as `<header>: not available`.
|
|
156
157
|
*/
|
|
157
158
|
exportStatus?: (row: Row) => string | null | undefined;
|
|
159
|
+
/**
|
|
160
|
+
* Row fields a report gained after its columns were set: CSV writes them
|
|
161
|
+
* last, after `retrieved_at`, and NDJSON ends each row with them, so no
|
|
162
|
+
* column an earlier export had moves.
|
|
163
|
+
*/
|
|
164
|
+
exportAppendedKeys?: readonly string[];
|
|
158
165
|
}
|
|
159
166
|
|
|
160
167
|
interface CliResultJsonEnvelope<T> extends Omit<CliResult<T>, "freshness" | "exportFreshness" | "failure"> {
|
|
@@ -264,7 +271,7 @@ function formatTextValue(
|
|
|
264
271
|
depth = 0,
|
|
265
272
|
width: number | null = null,
|
|
266
273
|
): string {
|
|
267
|
-
const missing = context === "record" ? cliPlainEnabled() ?
|
|
274
|
+
const missing = context === "record" ? cliPlainEnabled() ? MISSING_VALUE : cliStyles.muted(MISSING_VALUE) : "";
|
|
268
275
|
if (value == null || value === "") return missing;
|
|
269
276
|
// Times print in UTC with the zone named, never in the host's zone; JSON and CSV keep the raw value.
|
|
270
277
|
if (value instanceof Date) return formatUtcTime(value);
|
|
@@ -377,11 +384,16 @@ function renderCsv<Row extends Record<string, unknown>>(
|
|
|
377
384
|
dating?: (row: Row) => string[],
|
|
378
385
|
/** When the data was retrieved, which an undated export's rows end with (`retrieved_at`). */
|
|
379
386
|
retrieved?: string,
|
|
387
|
+
/** Keys written after every other column (`exportAppendedKeys`), in this order. */
|
|
388
|
+
appendedKeys: readonly string[] = [],
|
|
380
389
|
): string {
|
|
381
|
-
const
|
|
390
|
+
const allColumns = columns && columns.length > 0
|
|
382
391
|
? columns
|
|
383
392
|
: inferColumns(rows as Record<string, unknown>[]) as CliResultColumn<Row>[];
|
|
393
|
+
const resolvedColumns = allColumns.filter((column) => !appendedKeys.includes(column.key));
|
|
394
|
+
const appended = appendedKeys.flatMap((key) => allColumns.filter((column) => column.key === key));
|
|
384
395
|
const headers = resolvedColumns.map((column) => column.header);
|
|
396
|
+
const cell = (value: unknown) => isNonFiniteNumber(value) ? "" : typeof value === "number" ? exportNumber(value) : value;
|
|
385
397
|
// A dated export's own `released` column keeps its values; the others close the row.
|
|
386
398
|
const datingAdded = dating
|
|
387
399
|
? EXPORT_DATING_COLUMNS.flatMap((column, index) => headers.includes(column) ? [] : [index]) : [];
|
|
@@ -393,17 +405,19 @@ function renderCsv<Row extends Record<string, unknown>>(
|
|
|
393
405
|
...identity ? EXPORT_IDENTITY_COLUMNS : [],
|
|
394
406
|
...datingAdded.map((index) => EXPORT_DATING_COLUMNS[index]!),
|
|
395
407
|
...retrieval ? [EXPORT_RETRIEVAL_COLUMN] : [],
|
|
408
|
+
...appended.map((column) => column.header),
|
|
396
409
|
],
|
|
397
410
|
...rows.map((row) => {
|
|
398
411
|
const values = resolvedColumns.map((column) => (column.value ? column.value(row) : row[column.key]));
|
|
399
412
|
const blanked = resolvedColumns.flatMap((column, index) => isNonFiniteNumber(values[index]) ? [column.header] : []);
|
|
400
413
|
const datingCells = dating?.(row) ?? [];
|
|
401
414
|
return [
|
|
402
|
-
...values.map(
|
|
415
|
+
...values.map(cell),
|
|
403
416
|
...status ? [exportStatusText(status(row), blanked)] : [],
|
|
404
417
|
...identity?.(row) ?? [],
|
|
405
418
|
...datingAdded.map((index) => datingCells[index] ?? ""),
|
|
406
419
|
...retrieval ? [retrieved] : [],
|
|
420
|
+
...appended.map((column) => cell(column.value ? column.value(row) : row[column.key])),
|
|
407
421
|
];
|
|
408
422
|
}),
|
|
409
423
|
]);
|
|
@@ -586,13 +600,17 @@ function serializeCliRows<T, Row extends Record<string, unknown>>(
|
|
|
586
600
|
// An undated row says when it was retrieved last, as CSV's `retrieved_at` does.
|
|
587
601
|
const retrieval = !renderOptions.exportDated && !(EXPORT_RETRIEVAL_COLUMN in fields)
|
|
588
602
|
? { [EXPORT_RETRIEVAL_COLUMN]: exportRetrievalCell(cited) } : {};
|
|
589
|
-
|
|
603
|
+
// Fields a report gained later end the row, as they end a CSV row.
|
|
604
|
+
const appended = Object.fromEntries((renderOptions.exportAppendedKeys ?? []).flatMap((key) => key in fields ? [[key, fields[key]]] : []));
|
|
605
|
+
const own = Object.fromEntries(Object.entries(fields).filter(([key]) => !(key in appended)));
|
|
606
|
+
return JSON.stringify({ ...own, ...exportIdentityFields(cited, identity), ...dating, ...retrieval, ...appended }, exportJsonValue);
|
|
590
607
|
}).join("\n");
|
|
591
608
|
}
|
|
592
609
|
if (options.format === "csv") {
|
|
593
610
|
// The rows a window cut say so after them, as text and JSON do: a script has no other way to know.
|
|
594
611
|
const cutNote = window.note ? [`note: ${window.note}`] : [];
|
|
595
|
-
|
|
612
|
+
const appended = renderOptions.exportAppendedKeys ?? [];
|
|
613
|
+
if (!cited) return withCsvFooter(renderCsv(rows as Row[], renderOptions.columns, undefined, status, undefined, undefined, appended), cutNote);
|
|
596
614
|
const csv = renderCsv(
|
|
597
615
|
rows as Row[],
|
|
598
616
|
renderOptions.columns,
|
|
@@ -600,6 +618,7 @@ function serializeCliRows<T, Row extends Record<string, unknown>>(
|
|
|
600
618
|
status,
|
|
601
619
|
renderOptions.exportDated ? (row) => exportDatingCells(cited, rowIdentity(row, renderOptions.exportIdentity)) : undefined,
|
|
602
620
|
exportRetrievalCell(cited),
|
|
621
|
+
appended,
|
|
603
622
|
);
|
|
604
623
|
return withCsvFooter(csv, [...exportSourceLines(cited), ...cutNote, ...(renderOptions.exportNotes ?? []).map((note) => `note: ${note}`)]);
|
|
605
624
|
}
|
package/src/cli/symbol-args.ts
CHANGED
|
@@ -136,10 +136,12 @@ export function symbolInputKey(symbol: string): string {
|
|
|
136
136
|
|
|
137
137
|
/**
|
|
138
138
|
* How a command's symbol list spots one security typed twice: `symbolInputKey`,
|
|
139
|
-
* with a share class written with a dot
|
|
139
|
+
* with a share class written with a dot, a dash or, as a broker writes it, a
|
|
140
|
+
* slash as one (BRK.B, BRK-B and BRK/B). One letter before a slash is no
|
|
141
|
+
* symbol's (N/A, P/E).
|
|
140
142
|
*/
|
|
141
|
-
function securityInputKey(symbol: string): string {
|
|
142
|
-
return symbolInputKey(symbol).replace(/-/g, ".");
|
|
143
|
+
export function securityInputKey(symbol: string): string {
|
|
144
|
+
return symbolInputKey(symbol).replace(/-/g, ".").replace(/^([A-Z]{2,5})\/([A-Z])$/, "$1.$2");
|
|
143
145
|
}
|
|
144
146
|
|
|
145
147
|
/** The securities of a symbol list, each once, in the first spelling typed: `AAPL aapl BRK.B BRK-B` is AAPL and BRK.B. */
|
package/src/cli/symbol-list.ts
CHANGED
|
@@ -221,6 +221,8 @@ interface SymbolText {
|
|
|
221
221
|
entries?: true;
|
|
222
222
|
/** A first row read as a header in words no header list knows (`Hisse,Adet,Maliyet`), skipped and named. */
|
|
223
223
|
header?: string[];
|
|
224
|
+
/** Each symbol is a line of the text, whole: a list of one entry a line, as a sheet's column pastes. */
|
|
225
|
+
lines?: true;
|
|
224
226
|
}
|
|
225
227
|
|
|
226
228
|
/** Words a sheet writes where a value is missing, beside the marks isJunkCell knows (`N/A`, `-`, `—`). */
|
|
@@ -296,7 +298,7 @@ export function parseSymbolText(text: string): SymbolText {
|
|
|
296
298
|
const cleaned = records.map((cells) => cells.map((cell) => stripStrayEdges(cell).text));
|
|
297
299
|
const figures = cleaned.some((cells) => cells.some((cell, index) => index > 0 && isFigure(cell)));
|
|
298
300
|
// Lines split by spaces alone are entries, unless figures sit beside the symbols.
|
|
299
|
-
if (!delimited && !figures) return { symbols: records.map((cells) => cells.join(" ")), ignored: [], entries: true };
|
|
301
|
+
if (!delimited && !figures) return { symbols: records.map((cells) => cells.join(" ")), ignored: [], entries: true, lines: true };
|
|
300
302
|
// A grid of symbols: a terminal's code is one cell (`CZR US Equity`), and so is a numeric code among tickers (`2007`).
|
|
301
303
|
const codes = symbolColumns(cleaned);
|
|
302
304
|
const grid = numericCodeGrid(cleaned) || cleaned.every((cells) => cells.every((cell, index) => (
|
|
@@ -479,13 +481,15 @@ export async function readSymbolList(source: SymbolListSource): Promise<{ symbol
|
|
|
479
481
|
const code = (error as NodeJS.ErrnoException).code;
|
|
480
482
|
throw new SymbolListError(code === "ENOENT" ? `No file at ${source.file}.` : `Could not read ${source.file}: ${error instanceof Error ? error.message : String(error)}`);
|
|
481
483
|
}
|
|
482
|
-
|
|
483
|
-
|
|
484
|
+
const parsed = parseSymbolText(foldTypedText(text));
|
|
485
|
+
typedForms.push(...typedLines(text, !!parsed.lines));
|
|
486
|
+
await addCells(parsed);
|
|
484
487
|
}
|
|
485
488
|
if (wantsStdin || (typed.length === 0 && source.file == null && (source.stdinPiped ?? stdinIsPiped()))) {
|
|
486
489
|
const text = await readStdin();
|
|
487
|
-
|
|
488
|
-
|
|
490
|
+
const parsed = parseSymbolText(foldTypedText(text));
|
|
491
|
+
typedForms.push(...typedLines(text, !!parsed.lines));
|
|
492
|
+
await addCells(parsed);
|
|
489
493
|
}
|
|
490
494
|
// A number where a symbol goes (a line of prices, a typed 1.899) is left out with those typed beside a symbol.
|
|
491
495
|
const numbers = [...figures, ...collected.filter(isNumberCell)];
|
|
@@ -498,17 +502,26 @@ export interface TypedForm {
|
|
|
498
502
|
typed: string;
|
|
499
503
|
/** The entry the line reads as, its repeats' key (`symbolInputKey`): `USDJPY` and `usdjpy` are both `USDJPY`'s. */
|
|
500
504
|
key: string;
|
|
505
|
+
/**
|
|
506
|
+
* A line of a list of one entry a line, which has a row whatever it reads as, so the rows line up with the
|
|
507
|
+
* sheet's: a blank one (`typed` empty), or one no entry was read from (`N/A`, a number).
|
|
508
|
+
*/
|
|
509
|
+
ownRow?: true;
|
|
501
510
|
}
|
|
502
511
|
|
|
503
512
|
/**
|
|
504
513
|
* Each line of a list's text that is one entry, as typed and in order, an exact repeat too, with the key of the entry
|
|
505
514
|
* it reads as: so a command can give every line its row and say which line of a sheet each row is, where several
|
|
506
|
-
* were read as one entry.
|
|
515
|
+
* were read as one entry. In a list of one entry a line (`everyLine`), every line up to the last that holds
|
|
516
|
+
* anything is one, a blank line too; a comment (`# held since 2019`) is none.
|
|
507
517
|
*/
|
|
508
|
-
function typedLines(text: string): TypedForm[] {
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
518
|
+
function typedLines(text: string, everyLine: boolean): TypedForm[] {
|
|
519
|
+
const lines = text.replace(/^\uFEFF/, "").split(/\r?\n/).map((line) => line.trim());
|
|
520
|
+
const last = lines.findLastIndex(Boolean);
|
|
521
|
+
return lines.slice(0, last + 1).flatMap((typed) => {
|
|
522
|
+
// The list reads a line's words with one space between them (`MC FP Equity` is MC FP Equity), so its key does too.
|
|
523
|
+
const key = symbolInputKey(stripStrayEdges(foldTypedText(typed)).text.replace(/\s+/g, " "));
|
|
524
|
+
if (everyLine && !isComment(typed)) return [{ typed, key, ownRow: true as const }];
|
|
512
525
|
if (!typed || !key) return [];
|
|
513
526
|
return [{ typed, key }];
|
|
514
527
|
});
|