@gloom-sh/terminal 0.20.20 → 0.20.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -1
- package/src/api-client/data.ts +1 -1
- package/src/api-client/equity-screener.ts +17 -0
- package/src/api-client/futures-curve.ts +5 -0
- package/src/api-client/market-discovery.ts +8 -0
- package/src/api-client/members.ts +2 -0
- package/src/api-client/paths.ts +3 -0
- package/src/api-client/perps.ts +20 -0
- package/src/api-client/request.ts +53 -7
- package/src/api-client/types/filings-and-calls.ts +2 -0
- package/src/app/pane-runtime/plugin-bindings.ts +6 -4
- package/src/app/pro-welcome/model.ts +15 -11
- package/src/app/pro-welcome/row.tsx +3 -3
- package/src/app/pro-welcome/use-pro-welcome.ts +2 -2
- package/src/app/runtime/startup.ts +3 -2
- package/src/app.tsx +3 -2
- package/src/capabilities/asset-data-inputs.ts +5 -0
- package/src/capabilities/factories.ts +8 -3
- package/src/capabilities/registry.ts +1 -0
- package/src/capabilities/types.ts +1 -0
- package/src/cli/commands/market.ts +68 -35
- package/src/cli/commands/options-chain.ts +2 -2
- package/src/cli/commands/overview.ts +10 -9
- package/src/cli/commands/ticker.ts +19 -4
- package/src/cli/desktop-pane-shot.ts +11 -3
- package/src/cli/export-source.ts +35 -2
- package/src/cli/glossary.ts +3 -2
- package/src/cli/helpers.ts +2 -1
- package/src/cli/history-demergers.ts +41 -10
- package/src/cli/history-rows.ts +3 -1
- package/src/cli/known-gaps.ts +21 -7
- package/src/cli/listing-arg.ts +22 -11
- package/src/cli/pane-functions/capabilities.ts +4 -9
- package/src/cli/pane-functions/catalog-snapshot.json +29 -29
- package/src/cli/pane-functions/catalog.ts +1 -18
- package/src/cli/pane-functions/data.ts +8 -4
- package/src/cli/pane-functions/financial-ratio-shot.ts +20 -5
- package/src/cli/pane-functions/freshness.ts +57 -12
- package/src/cli/pane-functions/function-help.ts +2 -2
- package/src/cli/pane-functions/headless.ts +6 -0
- package/src/cli/pane-functions/index.ts +11 -4
- package/src/cli/pane-functions/market-session.ts +25 -0
- package/src/cli/pane-functions/report-notices.ts +10 -0
- package/src/cli/pane-functions/resolver.ts +75 -3
- package/src/cli/pane-functions/screenshot-bridge.ts +1 -0
- package/src/cli/pane-functions/screenshot-data-evidence.ts +1 -0
- package/src/cli/pane-functions/screenshot-payload.ts +38 -5
- package/src/cli/pane-functions/screenshot-render.ts +20 -7
- package/src/cli/perpetual-contract.ts +14 -1
- package/src/cli/report-tables.ts +11 -2
- package/src/cli/result.ts +6 -1
- package/src/components/chart-table/layout.ts +8 -4
- package/src/components/command-bar/list/model.ts +2 -0
- package/src/components/command-bar/pane-templates/items.ts +5 -25
- package/src/components/command-bar/panel/index.tsx +7 -4
- package/src/components/command-bar/routes/root/provider-search.ts +4 -4
- package/src/components/command-bar/routes/root/results.ts +6 -2
- package/src/components/command-bar/routes/ticker-search/results.ts +19 -0
- package/src/components/command-bar/routes/ticker-search/route.ts +3 -3
- package/src/components/command-bar/routes/ticker-search/title.ts +23 -0
- package/src/components/command-bar/routing/list-state.ts +17 -5
- package/src/components/command-bar/selection-runtime.ts +3 -2
- package/src/components/command-bar/surface/index.tsx +2 -0
- package/src/components/command-bar/workflow/alert.ts +6 -4
- package/src/components/command-bar/workflow/collection-actions.ts +2 -1
- package/src/components/layout/pane/footer/index.tsx +1 -0
- package/src/components/layout/pane/footer/model.ts +20 -7
- package/src/components/layout/pane/title.ts +11 -2
- package/src/components/price-selector-dialog.tsx +8 -4
- package/src/components/ticker/badge/list.tsx +4 -3
- package/src/components/ticker/list-table-view.tsx +12 -1
- package/src/components/ui/query-bar.tsx +20 -14
- package/src/data/cached-query.ts +20 -4
- package/src/data/news-pane-snapshots.ts +2 -1
- package/src/data/plugin-cache.ts +5 -1
- package/src/data/saved-copies.ts +68 -2
- package/src/docs/snapshot.json +65 -14
- package/src/docs/topics.ts +11 -9
- package/src/i18n/es.ts +1 -0
- package/src/i18n/ja.ts +1 -0
- package/src/i18n/ko.ts +1 -0
- package/src/i18n/zh-cn.ts +1 -0
- package/src/i18n/zh-tw.ts +1 -0
- package/src/market-data/coordinator/index.ts +25 -5
- package/src/market-data/depositary-pair.ts +27 -10
- package/src/market-data/futures-roll-returns.ts +54 -7
- package/src/market-data/fx-closes.ts +14 -0
- package/src/market-data/market/futures-product-hours.ts +113 -0
- package/src/market-data/market/futures-week.ts +2 -0
- package/src/market-data/market/globex-day.ts +9 -2
- package/src/market-data/market/status.ts +32 -25
- package/src/market-data/market/venue-session.ts +18 -0
- package/src/market-data/options-alternatives.ts +49 -7
- package/src/market-data/perpetual-open-interest.ts +41 -0
- package/src/market-data/quotes/contributions.ts +4 -2
- package/src/market-data/quotes/export-identity.ts +11 -3
- package/src/market-data/quotes/freshness.ts +3 -2
- package/src/market-data/quotes/resolution.ts +9 -2
- package/src/market-data/quotes/tick-range.ts +22 -1
- package/src/market-data/quotes/time.ts +34 -4
- package/src/market-data/split-terms.ts +3 -2
- package/src/news/aggregator.ts +1 -0
- package/src/news/news-model.ts +12 -2
- package/src/news/types.ts +15 -0
- package/src/plugins/builtin/alerts/alert-engine.ts +2 -0
- package/src/plugins/builtin/alerts/cli-forms.ts +3 -2
- package/src/plugins/builtin/alerts/cli-move.ts +5 -2
- package/src/plugins/builtin/alerts/cli.ts +50 -25
- package/src/plugins/builtin/alerts/command.ts +51 -3
- package/src/plugins/builtin/alerts/event-rows.ts +1 -1
- package/src/plugins/builtin/alerts/events-pane.tsx +1 -1
- package/src/plugins/builtin/alerts/format.ts +67 -8
- package/src/plugins/builtin/alerts/headless.ts +22 -6
- package/src/plugins/builtin/alerts/index.tsx +26 -25
- package/src/plugins/builtin/alerts/move-checks.ts +1 -0
- package/src/plugins/builtin/alerts/pane.tsx +15 -6
- package/src/plugins/builtin/alerts/pro-rules.ts +9 -4
- package/src/plugins/builtin/alerts/quotes.ts +10 -5
- package/src/plugins/builtin/alerts/session.ts +28 -0
- package/src/plugins/builtin/alerts/types.ts +1 -0
- package/src/plugins/builtin/analytics/pane-model.ts +2 -1
- package/src/plugins/builtin/analytics/risk-model.ts +2 -2
- package/src/plugins/builtin/attention/headless.ts +2 -2
- package/src/plugins/builtin/attention/model.ts +7 -2
- package/src/plugins/builtin/attention/pane.tsx +2 -1
- package/src/plugins/builtin/awards/headless.ts +1 -1
- package/src/plugins/builtin/broker-trading/ticket.tsx +13 -5
- package/src/plugins/builtin/buildout/detail/company.tsx +0 -1
- package/src/plugins/builtin/buildout/detail/ui.tsx +7 -5
- package/src/plugins/builtin/buildout/model/normalizers.ts +0 -1
- package/src/plugins/builtin/buildout/model/types.ts +0 -1
- package/src/plugins/builtin/buildout/pane/index.tsx +9 -0
- package/src/plugins/builtin/buildout/pane/status.tsx +11 -0
- package/src/plugins/builtin/catalysts/headless.ts +1 -1
- package/src/plugins/builtin/chart-composer/headless.ts +14 -6
- package/src/plugins/builtin/chart-composer/pane.tsx +2 -1
- package/src/plugins/builtin/chart-composer/session-history.ts +14 -2
- package/src/plugins/builtin/chat/controller/index.ts +5 -3
- package/src/plugins/builtin/chat/controller/session-runtime.ts +18 -8
- package/src/plugins/builtin/chat/index.tsx +1 -1
- package/src/plugins/builtin/cloud/auth-actions.tsx +4 -2
- package/src/plugins/builtin/cloud/mcp-connect/dialog.tsx +4 -1
- package/src/plugins/builtin/cloud/thesis/ticker-tab.tsx +2 -1
- package/src/plugins/builtin/company-attention/headless.ts +2 -1
- package/src/plugins/builtin/company-kpis/headless.ts +1 -1
- package/src/plugins/builtin/correlation/headless.ts +3 -3
- package/src/plugins/builtin/correlation/history.ts +1 -0
- package/src/plugins/builtin/correlation/index.tsx +7 -5
- package/src/plugins/builtin/correlation/matrix/selection.ts +21 -3
- package/src/plugins/builtin/correlation/relationship/model.ts +5 -0
- package/src/plugins/builtin/correlation/relationship/pane.tsx +3 -2
- package/src/plugins/builtin/correlation/relationship/view-model.ts +3 -2
- package/src/plugins/builtin/credit-documents/headless.ts +1 -1
- package/src/plugins/builtin/dividend-yield/client.ts +81 -10
- package/src/plugins/builtin/dividend-yield/headless.ts +21 -10
- package/src/plugins/builtin/dividend-yield/model.ts +1 -1
- package/src/plugins/builtin/dividend-yield/pane.tsx +9 -5
- package/src/plugins/builtin/dividend-yield/ranking.ts +15 -5
- package/src/plugins/builtin/dividend-yield/reference-price.ts +3 -0
- package/src/plugins/builtin/dividend-yield/types.ts +12 -0
- package/src/plugins/builtin/dividend-yield/view.ts +30 -7
- package/src/plugins/builtin/doe/headless.ts +1 -1
- package/src/plugins/builtin/doe/pane.tsx +16 -7
- package/src/plugins/builtin/earnings-calls/data.ts +8 -5
- package/src/plugins/builtin/earnings-ripple/headless.ts +1 -1
- package/src/plugins/builtin/econ/calendar-model.ts +1 -1
- package/src/plugins/builtin/econ/index.tsx +26 -18
- package/src/plugins/builtin/equity-screener/client.ts +1 -1
- package/src/plugins/builtin/equity-screener/headless.ts +149 -31
- package/src/plugins/builtin/equity-screener/live.ts +23 -5
- package/src/plugins/builtin/equity-screener/model.ts +27 -12
- package/src/plugins/builtin/equity-screener/pane.tsx +5 -5
- package/src/plugins/builtin/exposure/headless.ts +1 -1
- package/src/plugins/builtin/exposure/holdings.ts +2 -2
- package/src/plugins/builtin/futures/index.tsx +29 -1
- package/src/plugins/builtin/futures/model.ts +93 -10
- package/src/plugins/builtin/futures/returns.ts +54 -1
- package/src/plugins/builtin/futures/table.tsx +14 -2
- package/src/plugins/builtin/futures/use-front-returns.ts +20 -3
- package/src/plugins/builtin/futures-curve/client.ts +1 -1
- package/src/plugins/builtin/futures-curve/headless.ts +9 -3
- package/src/plugins/builtin/futures-curve/model.ts +19 -5
- package/src/plugins/builtin/futures-curve/pane.tsx +12 -6
- package/src/plugins/builtin/gpu/headless.ts +1 -1
- package/src/plugins/builtin/gpu/model.ts +1 -1
- package/src/plugins/builtin/help/function-index.ts +16 -8
- package/src/plugins/builtin/help/functions-table.tsx +6 -4
- package/src/plugins/builtin/help/shortcut-model.ts +7 -2
- package/src/plugins/builtin/holders/headless.ts +16 -5
- package/src/plugins/builtin/holders/pane.tsx +43 -5
- package/src/plugins/builtin/insider/client.ts +118 -11
- package/src/plugins/builtin/insider/filing-stories.ts +36 -20
- package/src/plugins/builtin/insider/issuer.ts +5 -2
- package/src/plugins/builtin/iv-history/headless.ts +2 -0
- package/src/plugins/builtin/macro-day/client.ts +2 -3
- package/src/plugins/builtin/macro-day/comparison.ts +58 -0
- package/src/plugins/builtin/macro-day/headless.ts +47 -3
- package/src/plugins/builtin/macro-day/index.tsx +32 -9
- package/src/plugins/builtin/macro-day/model.ts +1 -1
- package/src/plugins/builtin/macro-day/pane.tsx +99 -12
- package/src/plugins/builtin/market-heatmap/index.tsx +2 -2
- package/src/plugins/builtin/market-movers/footer.ts +29 -3
- package/src/plugins/builtin/market-movers/headless.ts +12 -5
- package/src/plugins/builtin/market-movers/index.tsx +3 -3
- package/src/plugins/builtin/market-movers/session-body.tsx +6 -3
- package/src/plugins/builtin/market-valuation/detail.tsx +3 -3
- package/src/plugins/builtin/market-valuation/headless.ts +6 -6
- package/src/plugins/builtin/market-valuation/pane.tsx +2 -3
- package/src/plugins/builtin/market-valuation/view.ts +6 -8
- package/src/plugins/builtin/members/client.ts +9 -2
- package/src/plugins/builtin/members/headless.ts +8 -10
- package/src/plugins/builtin/members/model.ts +29 -17
- package/src/plugins/builtin/members/pane.tsx +10 -12
- package/src/plugins/builtin/money-markets/headless.ts +1 -1
- package/src/plugins/builtin/news/headless.ts +4 -0
- package/src/plugins/builtin/news/index.tsx +3 -1
- package/src/plugins/builtin/news/wire/industry-pane.tsx +2 -1
- package/src/plugins/builtin/news/wire/news/preset-pane.tsx +1 -1
- package/src/plugins/builtin/news/wire/persisted-articles.ts +8 -4
- package/src/plugins/builtin/notes/headless.ts +7 -0
- package/src/plugins/builtin/notes/index.tsx +1 -1
- package/src/plugins/builtin/notes/quick-notes-pane.tsx +18 -2
- package/src/plugins/builtin/options/view.tsx +7 -6
- package/src/plugins/builtin/options-positioning/headless.ts +4 -4
- package/src/plugins/builtin/options-positioning/pane.tsx +7 -3
- package/src/plugins/builtin/options-scenario/client.ts +20 -4
- package/src/plugins/builtin/options-scenario/headless.ts +1 -1
- package/src/plugins/builtin/pe-band/client.ts +5 -9
- package/src/plugins/builtin/pe-band/headless.ts +11 -13
- package/src/plugins/builtin/pe-band/model.ts +39 -60
- package/src/plugins/builtin/pe-band/pane.tsx +14 -15
- package/src/plugins/builtin/perps/equity-row.tsx +3 -1
- package/src/plugins/builtin/perps/freshness.ts +16 -9
- package/src/plugins/builtin/perps/headless.ts +4 -1
- package/src/plugins/builtin/perps/markets-section.tsx +16 -10
- package/src/plugins/builtin/perps/model.ts +33 -2
- package/src/plugins/builtin/perps/pane.tsx +3 -2
- package/src/plugins/builtin/perps/status-line.ts +12 -3
- package/src/plugins/builtin/perps/venue-markets.ts +38 -0
- package/src/plugins/builtin/plugin-marketplace/pane.tsx +4 -3
- package/src/plugins/builtin/portfolio-list/cell-version.ts +1 -1
- package/src/plugins/builtin/portfolio-list/cli/render.ts +46 -7
- package/src/plugins/builtin/portfolio-list/headless.ts +31 -8
- package/src/plugins/builtin/portfolio-list/settings.ts +3 -0
- package/src/plugins/builtin/portfolio-list/table.tsx +7 -1
- package/src/plugins/builtin/power/headless.ts +1 -1
- package/src/plugins/builtin/realized-vol/headless.ts +1 -1
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +27 -13
- package/src/plugins/builtin/scanner/feed.ts +7 -4
- package/src/plugins/builtin/scanner/flow-pane.tsx +8 -4
- package/src/plugins/builtin/scanner/headless.ts +57 -26
- package/src/plugins/builtin/scanner/hilo-pane.tsx +6 -3
- package/src/plugins/builtin/scanner/lock-note.ts +3 -2
- package/src/plugins/builtin/scanner/us-session.ts +9 -0
- package/src/plugins/builtin/seasonality/client.ts +46 -10
- package/src/plugins/builtin/seasonality/headless.ts +29 -11
- package/src/plugins/builtin/seasonality/model.ts +101 -24
- package/src/plugins/builtin/seasonality/pane.tsx +10 -6
- package/src/plugins/builtin/sec/filing-content.ts +13 -0
- package/src/plugins/builtin/sec/index.tsx +16 -11
- package/src/plugins/builtin/sectors/client.ts +27 -5
- package/src/plugins/builtin/sectors/headless.ts +2 -1
- package/src/plugins/builtin/sectors/index.tsx +22 -10
- package/src/plugins/builtin/shared/cloud-resource.ts +3 -3
- package/src/plugins/builtin/shared/extended-print.ts +38 -0
- package/src/plugins/builtin/shared/pro-feature-wall.tsx +1 -1
- package/src/plugins/builtin/shared/report-freshness.ts +7 -3
- package/src/plugins/builtin/shared/scanner-capture.ts +16 -3
- package/src/plugins/builtin/shared/ticker-company.ts +17 -8
- package/src/plugins/builtin/shared/use-quote-board.ts +11 -4
- package/src/plugins/builtin/social-mentions/client.ts +7 -3
- package/src/plugins/builtin/social-mentions/outliers.tsx +9 -2
- package/src/plugins/builtin/thirteenf/api.ts +24 -3
- package/src/plugins/builtin/thirteenf/data.ts +21 -8
- package/src/plugins/builtin/thirteenf/headless.ts +7 -3
- package/src/plugins/builtin/thirteenf/signals-pane.tsx +10 -3
- package/src/plugins/builtin/thirteenf/signals.ts +22 -1
- package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +4 -2
- package/src/plugins/builtin/ticker-detail/financials/model.ts +7 -0
- package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +15 -6
- package/src/plugins/builtin/ticker-detail/financials/ratios.ts +5 -4
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +14 -5
- package/src/plugins/builtin/ticker-detail/headless.ts +32 -26
- package/src/plugins/builtin/ticker-detail/index.tsx +1 -1
- package/src/plugins/builtin/ticker-detail/overview/components.tsx +8 -3
- package/src/plugins/builtin/ticker-detail/overview/model.ts +28 -5
- package/src/plugins/builtin/ticker-detail/overview/pane.tsx +14 -1
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +9 -8
- package/src/plugins/builtin/ticker-detail/pane.tsx +16 -9
- package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +41 -23
- package/src/plugins/builtin/ticker-detail/quote-monitor/rows.ts +30 -13
- package/src/plugins/builtin/ticker-detail/settings.ts +9 -2
- package/src/plugins/builtin/time-sales/headless.ts +49 -13
- package/src/plugins/builtin/time-sales/model.ts +2 -2
- package/src/plugins/builtin/time-sales/window.ts +84 -10
- package/src/plugins/builtin/vol-surface/charts.tsx +4 -2
- package/src/plugins/builtin/vol-surface/events.ts +12 -5
- package/src/plugins/builtin/vol-surface/headless.ts +1 -1
- package/src/plugins/builtin/vol-surface/pane.tsx +15 -7
- package/src/plugins/builtin/world-indices/footer.ts +1 -1
- package/src/plugins/builtin/world-venue-map/chokepoint-report.ts +3 -1
- package/src/plugins/builtin/world-venue-map/headless.ts +27 -13
- package/src/plugins/builtin/yield-curve/client.ts +3 -1
- package/src/plugins/duplicates.ts +60 -0
- package/src/plugins/loader.ts +12 -3
- package/src/plugins/marketplace/model.ts +10 -1
- package/src/portfolio/column-values.ts +52 -5
- package/src/react/async-resource.ts +8 -7
- package/src/renderers/browser/bundled-plugins.ts +2 -1
- package/src/renderers/dom/build-assets.ts +20 -0
- package/src/renderers/dom/data-table/index.tsx +36 -2
- package/src/renderers/dom/es2023-array-methods.ts +57 -0
- package/src/renderers/dom/host/surface-fit.ts +64 -13
- package/src/renderers/dom/styles.css +6 -1
- package/src/renderers/electrobun/bun/external-plugins.ts +16 -6
- package/src/renderers/electrobun/shared/protocol.ts +2 -0
- package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +31 -7
- package/src/renderers/electrobun/view/cli-pane-shot-frame.tsx +15 -8
- package/src/renderers/electrobun/view/external-plugins.ts +1 -0
- package/src/renderers/electrobun/view/remote/asset-data-client.ts +1 -0
- package/src/series/types.ts +1 -0
- package/src/sources/gloomberb-cloud/fred-attribution.ts +6 -5
- package/src/sources/gloomberb-cloud/index.ts +42 -5
- package/src/sources/gloomberb-cloud/news.ts +15 -2
- package/src/sources/gloomberb-cloud/normalizers.ts +9 -0
- package/src/sources/history-result.ts +2 -1
- package/src/sources/history-retention.ts +14 -2
- package/src/sources/listing-symbols.ts +1 -1
- package/src/sources/provider-router/cache.ts +32 -3
- package/src/sources/provider-router/cached-routes.ts +25 -0
- package/src/sources/provider-router/connection-health.ts +1 -0
- package/src/sources/provider-router/history.ts +2 -2
- package/src/sources/provider-router/index.ts +14 -0
- package/src/sources/provider-router/sec-filings-page.ts +25 -0
- package/src/sources/sec-edgar/content.ts +67 -36
- package/src/tickers/listing-fate.ts +28 -0
- package/src/tickers/search/home-listing.ts +3 -0
- package/src/tickers/search/index-root-lead.ts +40 -0
- package/src/tickers/terminal-codes.ts +7 -4
- package/src/time-series/base-series.ts +17 -8
- package/src/time-series/fundamentals/historical-valuation.ts +2 -2
- package/src/time-series/fundamentals/series.ts +15 -12
- package/src/time-series/history-acquisition.ts +2 -0
- package/src/time-series/market.ts +3 -1
- package/src/time-series/price-comparison.ts +3 -1
- package/src/time-series/resolve-context.ts +8 -0
- package/src/time-series/resolve.ts +50 -10
- package/src/time-series/types.ts +1 -0
- package/src/time-series/use-chart-resolution.ts +2 -2
- package/src/time-series/valuation-currency.ts +40 -12
- package/src/types/data-provider.ts +30 -1
- package/src/types/financials.ts +23 -0
- package/src/types/headless.ts +23 -0
- package/src/types/instrument.ts +1 -0
- package/src/utils/crypto-pair.ts +16 -0
- package/src/utils/exchange-announcements.ts +2 -1
- package/src/utils/exchange-notation.generated.ts +58 -1
- package/src/utils/exchanges.ts +43 -1
- package/src/utils/format.ts +37 -2
- package/src/utils/function-search.ts +38 -0
- package/src/utils/fuzzy-search.ts +10 -6
- package/src/utils/option-choice.ts +15 -0
- package/src/utils/price-history.ts +15 -1
- package/src/utils/reason-codes.ts +6 -3
- package/src/utils/trailing-dividend.ts +241 -28
|
@@ -5,6 +5,12 @@
|
|
|
5
5
|
export interface ExchangeNotation {
|
|
6
6
|
/** Every spelling read as a venue, by the venue's code. */
|
|
7
7
|
aliases: Readonly<Record<string, string>>
|
|
8
|
+
/**
|
|
9
|
+
* Other spellings of venues `aliases` does not name, by the venue's code,
|
|
10
|
+
* read only where a listing is typed (INTP:IDX is INTP:JAKARTA): never in a
|
|
11
|
+
* saved ticker or as a listing suffix.
|
|
12
|
+
*/
|
|
13
|
+
typedAliases: Readonly<Record<string, string>>
|
|
8
14
|
/** What a listing key writes for a venue when it is not the code (its MIC). */
|
|
9
15
|
keyCodes: Readonly<Record<string, string>>
|
|
10
16
|
/** Venue names, for output that says where a listing trades. */
|
|
@@ -213,6 +219,11 @@ export const EXCHANGE_NOTATION: ExchangeNotation = {
|
|
|
213
219
|
XCAI: "EGX",
|
|
214
220
|
EGYPT: "EGX",
|
|
215
221
|
CAIRO: "EGX",
|
|
222
|
+
HOSE: "HOSE",
|
|
223
|
+
HSX: "HOSE",
|
|
224
|
+
XSTC: "HOSE",
|
|
225
|
+
HNX: "HNX",
|
|
226
|
+
XHNX: "HNX",
|
|
216
227
|
CME: "CME",
|
|
217
228
|
CBT: "CBT",
|
|
218
229
|
CBOT: "CBT",
|
|
@@ -239,6 +250,50 @@ export const EXCHANGE_NOTATION: ExchangeNotation = {
|
|
|
239
250
|
KRX: "KRX",
|
|
240
251
|
EURONEXT: "AMS",
|
|
241
252
|
},
|
|
253
|
+
typedAliases: {
|
|
254
|
+
"TEXAS STOCK EXCHANGE": "TXSE",
|
|
255
|
+
BCXE: "CBOE",
|
|
256
|
+
XDUB: "ISE",
|
|
257
|
+
XMSM: "ISE",
|
|
258
|
+
IRISH: "ISE",
|
|
259
|
+
KLSE: "BURSAMY",
|
|
260
|
+
XKLS: "BURSAMY",
|
|
261
|
+
IDX: "JAKARTA",
|
|
262
|
+
XIDX: "JAKARTA",
|
|
263
|
+
BKK: "SET",
|
|
264
|
+
XBKK: "SET",
|
|
265
|
+
THAILAND: "SET",
|
|
266
|
+
BCS: "BVS",
|
|
267
|
+
SGO: "BVS",
|
|
268
|
+
XSGO: "BVS",
|
|
269
|
+
SANTIAGO: "BVS",
|
|
270
|
+
BUX: "BUD",
|
|
271
|
+
XBUD: "BUD",
|
|
272
|
+
BUDAPEST: "BUD",
|
|
273
|
+
ATHEX: "ATH",
|
|
274
|
+
ASEX: "ATH",
|
|
275
|
+
ATHENS: "ATH",
|
|
276
|
+
XBSE: "BVB",
|
|
277
|
+
IST: "BIST",
|
|
278
|
+
XIST: "BIST",
|
|
279
|
+
ISTANBUL: "BIST",
|
|
280
|
+
XADS: "ADX",
|
|
281
|
+
ADSM: "ADX",
|
|
282
|
+
"ABU DHABI": "ADX",
|
|
283
|
+
XKAR: "PSX",
|
|
284
|
+
KAR: "PSX",
|
|
285
|
+
KARACHI: "PSX",
|
|
286
|
+
MUN: "MUNICH",
|
|
287
|
+
XMUN: "MUNICH",
|
|
288
|
+
SWB: "XSTU",
|
|
289
|
+
STU: "XSTU",
|
|
290
|
+
STUTTGART: "XSTU",
|
|
291
|
+
DUS: "XDUS",
|
|
292
|
+
BER: "XBER",
|
|
293
|
+
HAM: "XHAM",
|
|
294
|
+
HAN: "HANOVER",
|
|
295
|
+
XHAN: "HANOVER",
|
|
296
|
+
},
|
|
242
297
|
keyCodes: {
|
|
243
298
|
NASDAQ: "XNAS",
|
|
244
299
|
NYSE: "XNYS",
|
|
@@ -329,6 +384,8 @@ export const EXCHANGE_NOTATION: ExchangeNotation = {
|
|
|
329
384
|
MSX: "Muscat Stock Exchange",
|
|
330
385
|
KUWAIT: "Boursa Kuwait",
|
|
331
386
|
EGX: "Egyptian Exchange",
|
|
387
|
+
HOSE: "Ho Chi Minh Stock Exchange",
|
|
388
|
+
HNX: "Hanoi Stock Exchange",
|
|
332
389
|
CBT: "CBOT",
|
|
333
390
|
NYM: "NYMEX",
|
|
334
391
|
CMX: "COMEX",
|
|
@@ -356,4 +413,4 @@ export const EXCHANGE_NOTATION: ExchangeNotation = {
|
|
|
356
413
|
},
|
|
357
414
|
}
|
|
358
415
|
|
|
359
|
-
export const EXCHANGE_NOTATION_VERSION = "
|
|
416
|
+
export const EXCHANGE_NOTATION_VERSION = "eb76ebd1ac8be330"
|
package/src/utils/exchanges.ts
CHANGED
|
@@ -47,6 +47,8 @@ export const EXCHANGE_TIME_ZONES: Record<string, string> = {
|
|
|
47
47
|
LSE: "Europe/London",
|
|
48
48
|
ASX: "Australia/Sydney",
|
|
49
49
|
SGX: "Asia/Singapore",
|
|
50
|
+
HOSE: "Asia/Ho_Chi_Minh",
|
|
51
|
+
HNX: "Asia/Ho_Chi_Minh",
|
|
50
52
|
KRX: "Asia/Seoul",
|
|
51
53
|
KOSDAQ: "Asia/Seoul",
|
|
52
54
|
NZX: "Pacific/Auckland",
|
|
@@ -94,6 +96,19 @@ export function isKnownExchangeCode(value?: string): boolean {
|
|
|
94
96
|
return !!normalized && KNOWN_EXCHANGE_CODES.has(normalized);
|
|
95
97
|
}
|
|
96
98
|
|
|
99
|
+
/**
|
|
100
|
+
* The venue a code the app does not know names where a listing is typed with it: IDX and XIDX are the Indonesia
|
|
101
|
+
* Stock Exchange (JAKARTA), KLSE Bursa Malaysia, BKK the Stock Exchange of Thailand (the notation table's
|
|
102
|
+
* `typedAliases`, Gloom Cloud's own reading). Never read from a saved ticker or as a listing suffix, so a key is
|
|
103
|
+
* built from the venue's code and none already saved moves. Undefined for a code the app knows, or one no venue
|
|
104
|
+
* is written as.
|
|
105
|
+
*/
|
|
106
|
+
export function typedExchangeVenue(value?: string): string | undefined {
|
|
107
|
+
const normalized = normalizeExchange(value);
|
|
108
|
+
if (!normalized || KNOWN_EXCHANGE_CODES.has(normalized)) return undefined;
|
|
109
|
+
return EXCHANGE_NOTATION.typedAliases[normalized];
|
|
110
|
+
}
|
|
111
|
+
|
|
97
112
|
/** "Warsaw Stock Exchange" for a venue with a name, the canonical code otherwise (NASDAQ, whose name is its code). */
|
|
98
113
|
export function exchangeName(value?: string): string {
|
|
99
114
|
const code = canonicalExchange(value);
|
|
@@ -140,11 +155,15 @@ export function isSharedExchangeCode(value?: string): boolean {
|
|
|
140
155
|
|
|
141
156
|
/**
|
|
142
157
|
* Every venue a typed exchange code can name, as canonical codes: TSE is
|
|
143
|
-
* TSX or JPX, PAR is EPA
|
|
158
|
+
* TSX or JPX, PAR is EPA, IDX is JAKARTA (or IDX, where a row is saved on
|
|
159
|
+
* it). Empty for no code.
|
|
144
160
|
*/
|
|
145
161
|
export function exchangeCodeVenues(value?: string): string[] {
|
|
146
162
|
const normalized = normalizeExchange(value);
|
|
147
163
|
if (!normalized) return [];
|
|
164
|
+
// A typed spelling of a venue (IDX) is that venue, or the spelling a row was saved under before it was read.
|
|
165
|
+
const typed = typedExchangeVenue(normalized);
|
|
166
|
+
if (typed) return [typed, normalized];
|
|
148
167
|
return [...(SHARED_EXCHANGE_CODES[normalized] ?? [canonicalExchange(normalized)])];
|
|
149
168
|
}
|
|
150
169
|
|
|
@@ -271,6 +290,29 @@ export function displayTickerKey(key: string): string {
|
|
|
271
290
|
return isKnownExchangeCode(parsePublicTickerKey(key).exchange) ? canonicalTickerKey(key) : key;
|
|
272
291
|
}
|
|
273
292
|
|
|
293
|
+
/** A venue by the MIC a stored key writes for it (`XHKG` is HKEX), for the venues whose key code is not their own. */
|
|
294
|
+
const VENUE_BY_KEY_CODE: ReadonlyMap<string, string> = new Map(
|
|
295
|
+
Object.entries(EXCHANGE_NOTATION.keyCodes).filter(([venue, code]) => venue !== code).map(([venue, code]) => [code, venue]),
|
|
296
|
+
);
|
|
297
|
+
|
|
298
|
+
/** A stored listing key in running text: a symbol, a colon and a key code (`0700:XHKG`, `XYZ:XNYS`). */
|
|
299
|
+
const STORED_LISTING_KEY = new RegExp(
|
|
300
|
+
`(?<![\\w:.^=-])([A-Z0-9^][A-Z0-9.^=-]*):(${[...VENUE_BY_KEY_CODE.keys()].join("|")})(?![\\w:])`,
|
|
301
|
+
"g",
|
|
302
|
+
);
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Text with every stored listing key in it written as a person types it, by
|
|
306
|
+
* its venue's own code (displayTickerKey): "No data for 0700:XHKG" reads "No
|
|
307
|
+
* data for 0700:HKEX", as titles, cards and the command bar name it. Anything
|
|
308
|
+
* else stays as written. For text a pane or the CLI shows that may carry a key
|
|
309
|
+
* as it was stored: an error, a state's title, a window's saved title.
|
|
310
|
+
*/
|
|
311
|
+
export function displayListingKeys(text: string): string {
|
|
312
|
+
if (!text.includes(":")) return text;
|
|
313
|
+
return text.replace(STORED_LISTING_KEY, (_match, symbol: string, code: string) => `${symbol}:${VENUE_BY_KEY_CODE.get(code)!}`);
|
|
314
|
+
}
|
|
315
|
+
|
|
274
316
|
/**
|
|
275
317
|
* A stored key as the listing a request names: a row saved under its venue's
|
|
276
318
|
* code (`ES3:XSES`, as a key is when another listing holds the bare symbol)
|
package/src/utils/format.ts
CHANGED
|
@@ -104,10 +104,22 @@ export function formatCurrencyCode(
|
|
|
104
104
|
return `${value < 0 && /[1-9]/.test(body) ? "-" : ""}${body} ${code}`;
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
/**
|
|
107
|
+
/**
|
|
108
|
+
* The decimals a per-share distribution is written to: a ten-thousandth of
|
|
109
|
+
* its currency's minor unit, whichever unit it is in. HSBC states its HK$ and
|
|
110
|
+
* sterling amounts to six decimals (HK$0.784088, £0.076442), the same pound
|
|
111
|
+
* amount in pence is 7.6442p, and a split-adjusted $0.000469 keeps its digits;
|
|
112
|
+
* an amount converted at a market rate (Shell's 29.858244p before its sterling
|
|
113
|
+
* fixing) or a sum of them is no finer than that, 29.8582p.
|
|
114
|
+
*/
|
|
115
|
+
function distributionAmountDigits(currency = "USD"): number {
|
|
116
|
+
return minorUnitSign(currency) ? 4 : currencyPriceDigits(currency) + 4;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** A per-share distribution to distributionAmountDigits, its currency's usual decimals at least. */
|
|
108
120
|
export function formatDistributionAmount(value: number | undefined, currency = "USD"): string {
|
|
109
121
|
if (value == null || !Number.isFinite(value)) return MISSING_VALUE;
|
|
110
|
-
return formatMoney(value, currency,
|
|
122
|
+
return formatMoney(value, currency, distributionAmountDigits(currency));
|
|
111
123
|
}
|
|
112
124
|
|
|
113
125
|
/** Signs a fixed-decimal move; one that rounds to zero is unsigned (0.00, never +0.00 or -0.00). */
|
|
@@ -220,6 +232,29 @@ export function formatNumber(value: number | undefined, decimals = 2): string {
|
|
|
220
232
|
return getNumberFormatter(decimals).format(value);
|
|
221
233
|
}
|
|
222
234
|
|
|
235
|
+
const tradeSizeFormatters = new Map<number, Intl.NumberFormat>();
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* A traded size, as every book, tape and size column writes it: a bid or ask
|
|
239
|
+
* size, a print's size, a lot count. A whole number reads as it always has
|
|
240
|
+
* (1,500); a fraction keeps up to four decimals, and one under 1 four
|
|
241
|
+
* significant digits (0.001235), so a coin's size never rounds to 0.
|
|
242
|
+
* `compact` writes a thousand or more as a compact column does (1.5k).
|
|
243
|
+
*/
|
|
244
|
+
export function formatTradeSize(value: number | null | undefined, { compact = false }: { compact?: boolean } = {}): string {
|
|
245
|
+
if (value == null || !Number.isFinite(value)) return MISSING_VALUE;
|
|
246
|
+
if (compact && Math.abs(value) >= 1000) return formatCompact(value);
|
|
247
|
+
if (Number.isInteger(value)) return getNumberFormatter(0).format(value);
|
|
248
|
+
const abs = Math.abs(value);
|
|
249
|
+
const decimals = abs >= 1 ? 4 : Math.min(12, 3 - Math.floor(Math.log10(abs)));
|
|
250
|
+
let formatter = tradeSizeFormatters.get(decimals);
|
|
251
|
+
if (!formatter) {
|
|
252
|
+
formatter = new Intl.NumberFormat("en-US", { maximumFractionDigits: decimals });
|
|
253
|
+
tradeSizeFormatters.set(decimals, formatter);
|
|
254
|
+
}
|
|
255
|
+
return formatter.format(value);
|
|
256
|
+
}
|
|
257
|
+
|
|
223
258
|
/**
|
|
224
259
|
* A value to a count of significant digits, so a small ratio keeps its leading
|
|
225
260
|
* digits (0.0005664, not 0.0006) while a large one reads as a plain number
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { PaneTemplateDef } from "../types/plugin";
|
|
2
|
+
|
|
3
|
+
const STOP_WORDS = new Set(["a", "an", "and", "at", "by", "for", "from", "in", "is", "of", "on", "or", "the", "to", "with"]);
|
|
4
|
+
|
|
5
|
+
export function functionQueryTerms(query: string): string[] {
|
|
6
|
+
const words = query.toLowerCase().trim().split(/\s+/).filter(Boolean);
|
|
7
|
+
const named = words.filter((word) => !STOP_WORDS.has(word));
|
|
8
|
+
return named.length > 0 ? named : words;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function searchStem(text: string): string {
|
|
12
|
+
return text.replace(/\bcompar(?:isons?|ing|e[ds]?)\b/g, "compare");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function startsWord(text: string, phrase: string): boolean {
|
|
16
|
+
for (let at = text.indexOf(phrase); at >= 0; at = text.indexOf(phrase, at + 1)) {
|
|
17
|
+
if (at === 0 || !/[a-z0-9]/.test(text[at - 1]!)) return true;
|
|
18
|
+
}
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function matchesFunctionPhrase(text: string, phrase: string): boolean {
|
|
23
|
+
const target = text.toLowerCase();
|
|
24
|
+
const query = phrase.toLowerCase();
|
|
25
|
+
return !query || startsWord(target, query) || startsWord(searchStem(target), searchStem(query));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function matchesFunctionSearch(query: string, fields: readonly string[]): boolean {
|
|
29
|
+
return functionQueryTerms(query).every((term) => fields.some((field) => matchesFunctionPhrase(field, term)));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function paneTemplateSearchFields(template: PaneTemplateDef, pane?: { headless?: PaneTemplateDef["headless"] }): string[] {
|
|
33
|
+
const discovery = (template.headless ?? pane?.headless)?.discovery;
|
|
34
|
+
return [...template.keywords ?? [], template.label, template.description, template.paneId, template.id,
|
|
35
|
+
template.shortcut?.prefix ?? "", ...template.shortcut?.aliases ?? [],
|
|
36
|
+
...discovery?.aliases ?? [], ...discovery?.suggestFor ?? [], ...discovery?.intents ?? [],
|
|
37
|
+
...discovery?.opens?.flatMap((opening) => opening.words) ?? []];
|
|
38
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { functionQueryTerms, matchesFunctionPhrase } from "./function-search";
|
|
2
|
+
|
|
1
3
|
interface FuzzyMatchResult {
|
|
2
4
|
match: boolean;
|
|
3
5
|
score: number;
|
|
@@ -43,7 +45,7 @@ function matchWordPrefixRun(query: string, label: string): FuzzyMatchResult {
|
|
|
43
45
|
* up in the full haystack; the looser fallback only ever sees the label, since
|
|
44
46
|
* keywords and descriptions are there to be found by whole words, not letters.
|
|
45
47
|
*/
|
|
46
|
-
function matchTerm(term: string, haystack: string, label: string): FuzzyMatchResult {
|
|
48
|
+
function matchTerm(term: string, haystack: string, label: string, functionLookup: boolean): FuzzyMatchResult {
|
|
47
49
|
if (haystack === term) return { match: true, score: 2500 - term.length };
|
|
48
50
|
|
|
49
51
|
const tokens = haystack.split(/\s+/).filter(Boolean);
|
|
@@ -57,23 +59,24 @@ function matchTerm(term: string, haystack: string, label: string): FuzzyMatchRes
|
|
|
57
59
|
}
|
|
58
60
|
|
|
59
61
|
if (haystack.includes(term)) return { match: true, score: 500 - term.length };
|
|
62
|
+
if (functionLookup && matchesFunctionPhrase(haystack, term)) return { match: true, score: 400 - term.length };
|
|
60
63
|
|
|
61
64
|
return matchWordPrefixRun(term, label);
|
|
62
65
|
}
|
|
63
66
|
|
|
64
67
|
/** Every word of the query has to match on its own; the whole phrase matching too ranks higher. */
|
|
65
|
-
function fuzzyMatch(query: string, target: string, label: string): FuzzyMatchResult {
|
|
68
|
+
function fuzzyMatch(query: string, target: string, label: string, functionLookup: boolean): FuzzyMatchResult {
|
|
66
69
|
const q = query.toLowerCase().trim();
|
|
67
70
|
const haystack = target.toLowerCase();
|
|
68
71
|
const labelText = label.toLowerCase();
|
|
69
|
-
const terms = q.split(/\s+/).filter(Boolean);
|
|
72
|
+
const terms = functionLookup ? functionQueryTerms(q) : q.split(/\s+/).filter(Boolean);
|
|
70
73
|
|
|
71
74
|
if (terms.length === 0) return { match: true, score: 0 };
|
|
72
|
-
if (terms.length === 1) return matchTerm(terms[0]!, haystack, labelText);
|
|
75
|
+
if (terms.length === 1) return matchTerm(terms[0]!, haystack, labelText, functionLookup);
|
|
73
76
|
|
|
74
77
|
let score = 0;
|
|
75
78
|
for (const term of terms) {
|
|
76
|
-
const result = matchTerm(term, haystack, labelText);
|
|
79
|
+
const result = matchTerm(term, haystack, labelText, functionLookup);
|
|
77
80
|
if (!result.match) return NO_MATCH;
|
|
78
81
|
score += result.score;
|
|
79
82
|
}
|
|
@@ -92,12 +95,13 @@ export function fuzzyFilter<T>(
|
|
|
92
95
|
query: string,
|
|
93
96
|
getText: (item: T) => string,
|
|
94
97
|
getLabel?: (item: T) => string,
|
|
98
|
+
isFunction?: (item: T) => boolean,
|
|
95
99
|
): T[] {
|
|
96
100
|
if (!query) return items;
|
|
97
101
|
return items
|
|
98
102
|
.map((item) => {
|
|
99
103
|
const text = getText(item);
|
|
100
|
-
return { item, ...fuzzyMatch(query, text, getLabel ? getLabel(item) : text) };
|
|
104
|
+
return { item, ...fuzzyMatch(query, text, getLabel ? getLabel(item) : text, isFunction?.(item) ?? false) };
|
|
101
105
|
})
|
|
102
106
|
.filter((r) => r.match)
|
|
103
107
|
.sort((a, b) => b.score - a.score)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type Choice = { value: string; label?: string; aliases?: readonly string[] };
|
|
2
|
+
|
|
3
|
+
const choiceToken = (value: string) => value.trim().toLowerCase().replace(/[\s_.-]+/g, "");
|
|
4
|
+
|
|
5
|
+
export function matchOptionChoice<ChoiceType extends Choice>(choices: readonly ChoiceType[], typed: string): ChoiceType | undefined {
|
|
6
|
+
const token = choiceToken(typed);
|
|
7
|
+
return choices.find((choice) => choiceToken(choice.value) === token)
|
|
8
|
+
?? choices.find((choice) => (choice.label && choiceToken(choice.label) === token)
|
|
9
|
+
|| choice.aliases?.some((alias) => choiceToken(alias) === token));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function optionChoiceNames(choices: readonly Choice[]): string {
|
|
13
|
+
return choices.map(({ value, label }) => label && choiceToken(label) !== choiceToken(value)
|
|
14
|
+
? `"${label}" (${value})` : value).join(", ");
|
|
15
|
+
}
|
|
@@ -263,9 +263,23 @@ export function isPriceHistoryStaleForCurrentWindow(
|
|
|
263
263
|
* follows, and one written with a venue's suffix (GUBRF.IS) to that venue, whose hours its bars keep.
|
|
264
264
|
*/
|
|
265
265
|
function listingSessionExchange(exchange: string | undefined, symbol?: string): string {
|
|
266
|
-
|
|
266
|
+
const venue = canonicalExchange(exchange);
|
|
267
|
+
return (venue && !US_SESSION_PUBLISHERS.has(venue) ? venue : "") || indexSessionVenue(symbol)
|
|
268
|
+
|| (symbol ? listingSuffixVenue(symbol)?.exchange : undefined) || "NYSE";
|
|
267
269
|
}
|
|
268
270
|
|
|
271
|
+
/**
|
|
272
|
+
* US index publishers (S&P's SNP, Dow Jones's DJI, Nasdaq's NIM, Cboe's index
|
|
273
|
+
* feed, FTSE Russell's WCB) and US futures exchanges, which the session tables
|
|
274
|
+
* have no calendar for. Their bars are read on the US calendar, as the same
|
|
275
|
+
* symbol asked for bare is: under its venue, `^VIX:CXI` or `GC=F:CMX`, Friday's
|
|
276
|
+
* bars counted as behind all weekend, and a chart of it had none to show.
|
|
277
|
+
*/
|
|
278
|
+
const US_SESSION_PUBLISHERS: ReadonlySet<string> = new Set([
|
|
279
|
+
"SNP", "DJI", "NIM", "NASDAQ GIDS", "WCB", "CXI", "CBOE INDICES", "CHICAGO OPTIONS",
|
|
280
|
+
"CME", "CBT", "NYM", "CMX", "NYB", "CFE",
|
|
281
|
+
]);
|
|
282
|
+
|
|
269
283
|
interface ListingSessions {
|
|
270
284
|
/** The open of the session trading at the time asked, if one is. */
|
|
271
285
|
liveOpen: number | null;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { displayListingKeys } from "./exchanges";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Reason codes are a data service's words for a machine: why it has nothing
|
|
3
5
|
* (NO_DATA, NOT_FOUND) or could not answer (UPSTREAM_ERROR, TIMEOUT). An
|
|
@@ -65,15 +67,16 @@ function withEmbeddedCodes(text: string): string {
|
|
|
65
67
|
* Text fit to show as a state's title or a CLI error: a bare reason code as
|
|
66
68
|
* a sentence ("The source did not answer."), a known code inside a longer
|
|
67
69
|
* text as its clause ("AAPL: the source did not answer"), anything else as
|
|
68
|
-
* it is
|
|
70
|
+
* it is, with a listing stored under its venue's MIC named as it is typed
|
|
71
|
+
* (`0700:XHKG` reads `0700:HKEX`, displayListingKeys).
|
|
69
72
|
*/
|
|
70
73
|
export function readableError(text: string): string {
|
|
71
|
-
if (!isReasonCode(text)) return withEmbeddedCodes(text);
|
|
74
|
+
if (!isReasonCode(text)) return displayListingKeys(withEmbeddedCodes(text));
|
|
72
75
|
const clause = reasonCodeClause(text);
|
|
73
76
|
return `${clause.charAt(0).toUpperCase()}${clause.slice(1)}.`;
|
|
74
77
|
}
|
|
75
78
|
|
|
76
79
|
/** The same for a footer status, which reads as a clause: "the source did not answer". */
|
|
77
80
|
export function readableStatus(text: string): string {
|
|
78
|
-
return isReasonCode(text) ? reasonCodeClause(text) : withEmbeddedCodes(text);
|
|
81
|
+
return isReasonCode(text) ? reasonCodeClause(text) : displayListingKeys(withEmbeddedCodes(text));
|
|
79
82
|
}
|