@gloom-sh/terminal 0.20.10 → 0.20.12
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 +16 -0
- package/src/api-client/awards.ts +16 -0
- package/src/api-client/central-bank-rates.ts +5 -0
- package/src/api-client/data.ts +55 -2
- package/src/api-client/index.ts +18 -1
- package/src/api-client/request.ts +86 -3
- package/src/api-client/socket-connection.ts +366 -0
- package/src/api-client/socket-features.ts +75 -0
- package/src/api-client/socket-frames.ts +161 -0
- package/src/api-client/socket-listeners.ts +207 -0
- package/src/api-client/socket-quotes.ts +332 -0
- package/src/api-client/socket.ts +168 -983
- package/src/api-client/supply-chain-graph.ts +4 -2
- package/src/api-client/supply-chain.ts +8 -0
- package/src/api-client/types/econ.ts +10 -7
- package/src/api-client/types/filings-and-calls.ts +8 -0
- package/src/app/global-shortcuts.ts +2 -1
- package/src/app/keybindings/actions.ts +19 -0
- package/src/app/pane-runtime/index.tsx +18 -3
- package/src/app/pane-runtime/layout-placement.ts +63 -0
- package/src/app/pane-runtime/ticker-open-runtime.ts +10 -2
- package/src/brokers/signed-in/adapter.ts +19 -5
- package/src/brokers/signed-in/client.ts +13 -1
- package/src/brokers/signed-in/sign-in-dialog.tsx +33 -9
- package/src/capabilities/chart-series.ts +4 -1
- package/src/cli/board-coins.ts +10 -1
- package/src/cli/commands/crypto-hints.ts +3 -2
- package/src/cli/commands/fred-series.ts +0 -54
- package/src/cli/commands/market.ts +209 -31
- package/src/cli/commands/overview.ts +47 -14
- package/src/cli/commands/search.ts +37 -8
- package/src/cli/commands/ticker.ts +15 -4
- package/src/cli/desktop-pane-shot.ts +27 -2
- package/src/cli/fx-quote-rate.ts +1 -1
- package/src/cli/glossary.ts +14 -5
- package/src/cli/history-catalog-series.ts +85 -0
- package/src/cli/index.ts +1 -1
- package/src/cli/list-progress.ts +45 -0
- package/src/cli/listing-arg.ts +71 -7
- package/src/cli/name-entries.ts +8 -4
- package/src/cli/not-a-ticker.ts +2 -2
- package/src/cli/pane-functions/freshness.ts +50 -3
- package/src/cli/pane-functions/index.ts +7 -4
- package/src/cli/pane-functions/market-session.ts +66 -14
- package/src/cli/pane-functions/options.ts +5 -0
- package/src/cli/pane-functions/resolver.ts +9 -2
- package/src/cli/pane-functions/screenshot-assessment.ts +28 -3
- package/src/cli/pane-functions/screenshot-types.ts +6 -0
- package/src/cli/quote-answer.ts +49 -10
- package/src/cli/quote-list-reads.ts +87 -0
- package/src/cli/report-tables.ts +70 -13
- package/src/cli/result.ts +24 -2
- package/src/cli/symbol-list.ts +31 -4
- package/src/cli/terminal-code-hints.ts +83 -0
- package/src/cli/ticker-resolution.ts +2 -1
- package/src/cli/treasury-yields.ts +5 -0
- package/src/components/chart/native/kitty/manager.ts +2 -0
- package/src/components/chart/native/surface/manager.ts +211 -11
- package/src/components/command-bar/action-runtime.ts +2 -0
- package/src/components/command-bar/panel/index.tsx +2 -13
- package/src/components/command-bar/panel/layout.ts +1 -7
- package/src/components/command-bar/panel/runtime.ts +0 -1
- package/src/components/command-bar/panel/types.ts +0 -2
- package/src/components/command-bar/routing/launch-request.ts +2 -1
- package/src/components/command-bar/routing/navigation-state.ts +4 -2
- package/src/components/command-bar/workflow/types.ts +6 -0
- package/src/components/data-table/column-menu.tsx +89 -0
- package/src/components/data-table/sort-menu.tsx +9 -2
- package/src/components/data-table/view.tsx +33 -6
- package/src/components/form-modal/content.tsx +10 -0
- package/src/components/index.ts +1 -1
- package/src/components/layout/detached-pane-shell.tsx +3 -0
- package/src/components/layout/double-escape-close.ts +34 -3
- package/src/components/layout/floating-pane.tsx +10 -4
- package/src/components/layout/pane/cycle-order.ts +66 -2
- package/src/components/layout/pane/footer/index.tsx +25 -11
- package/src/components/layout/pane/footer/model.ts +62 -20
- package/src/components/layout/pane/header.tsx +140 -31
- package/src/components/layout/pane/sidebar.tsx +138 -20
- package/src/components/layout/pane/status-footer.ts +3 -1
- package/src/components/layout/shell/active-drag.ts +18 -13
- package/src/components/layout/shell/drag/magnets.ts +34 -18
- package/src/components/layout/shell/drag/runtime.ts +5 -0
- package/src/components/layout/shell/index.tsx +25 -0
- package/src/components/layout/shell/menu.ts +9 -0
- package/src/components/layout/shell/pane/actions.ts +36 -0
- package/src/components/layout/shell/pane/management-shortcuts.ts +27 -3
- package/src/components/layout/shell/pane-occlusion.ts +40 -0
- package/src/components/layout/shell/shortcuts.ts +17 -1
- package/src/components/layout/shell/terminal-pointer-runtime.ts +39 -6
- package/src/components/layout/shell/window-mode/index.ts +5 -16
- package/src/components/layout/shell/window-mode/overlays.tsx +3 -1
- package/src/components/market-board/index.tsx +14 -5
- package/src/components/metric-treemap/index.tsx +3 -1
- package/src/components/ticker/list-table-view.tsx +5 -0
- package/src/components/ui/button.tsx +48 -4
- package/src/components/ui/data-table/column-order.ts +180 -0
- package/src/components/ui/data-table/index.tsx +12 -1
- package/src/components/ui/data-table/opentui/index.tsx +291 -32
- package/src/components/ui/data-table/opentui/model.ts +43 -4
- package/src/components/ui/data-table/types.ts +56 -0
- package/src/components/ui/data-table/use-column-order.ts +135 -0
- package/src/components/ui/index.ts +1 -1
- package/src/components/ui/inline-quick-add.tsx +19 -3
- package/src/components/ui/list-view.tsx +11 -5
- package/src/components/ui/query-bar.tsx +16 -1
- package/src/components/ui/selection-fill.ts +39 -0
- package/src/components/ui/table-layout.ts +120 -0
- package/src/core/state/app/layout-reducer.ts +2 -1
- package/src/core/state/app/pane-choices.ts +68 -0
- package/src/core/state/app/state.ts +14 -6
- package/src/core/state/app/types.ts +8 -0
- package/src/docs/snapshot.json +3 -2
- package/src/i18n/es.ts +2 -0
- package/src/i18n/ja.ts +2 -0
- package/src/i18n/ko.ts +2 -0
- package/src/i18n/zh-cn.ts +2 -0
- package/src/i18n/zh-tw.ts +2 -0
- package/src/layout/pane-manager/dock-tree.ts +19 -0
- package/src/layout/pane-manager/index.ts +3 -0
- package/src/market-data/coordinator/index.ts +4 -3
- package/src/market-data/coordinator/quotes.ts +12 -4
- package/src/market-data/market/freshness.ts +33 -0
- package/src/market-data/market/status.ts +5 -1
- package/src/market-data/quotes/contributions.ts +10 -0
- package/src/market-data/quotes/freshness.ts +31 -0
- package/src/market-data/quotes/live-valuation.ts +32 -5
- package/src/market-data/quotes/regular-session-valuation.ts +1 -1
- package/src/market-data/quotes/resolution.ts +4 -0
- package/src/market-data/quotes/time.ts +0 -14
- package/src/plugins/builtin/account-management/index.tsx +1 -0
- package/src/plugins/builtin/awards/detail.tsx +12 -4
- package/src/plugins/builtin/awards/headless.ts +29 -8
- package/src/plugins/builtin/awards/model.ts +36 -2
- package/src/plugins/builtin/awards/pane.tsx +7 -4
- package/src/plugins/builtin/broker-manager/detail.tsx +5 -3
- package/src/plugins/builtin/broker-manager/index.tsx +7 -6
- package/src/plugins/builtin/broker-manager/model.ts +15 -6
- package/src/plugins/builtin/broker-manager/pane-actions.tsx +11 -4
- package/src/plugins/builtin/broker-manager/sign-in-end.ts +50 -19
- package/src/plugins/builtin/broker-manager/table.ts +10 -4
- package/src/plugins/builtin/broker-trading/index.tsx +1 -1
- package/src/plugins/builtin/central-bank-rates/headless.ts +6 -6
- package/src/plugins/builtin/central-bank-rates/index.tsx +1 -1
- package/src/plugins/builtin/central-bank-rates/model.ts +21 -3
- package/src/plugins/builtin/central-bank-rates/pane.tsx +15 -5
- package/src/plugins/builtin/chart-composer/headless.ts +5 -1
- package/src/plugins/builtin/chart-composer/pane.tsx +1 -0
- package/src/plugins/builtin/chat/content/handle-prompt.tsx +4 -0
- package/src/plugins/builtin/chat/controller/realtime.ts +17 -1
- package/src/plugins/builtin/chat/message/terminal.tsx +4 -1
- package/src/plugins/builtin/chat/sidebar.tsx +35 -19
- package/src/plugins/builtin/cloud/askg/pane.tsx +4 -0
- package/src/plugins/builtin/cloud/askg/tool-timeline.tsx +2 -0
- package/src/plugins/builtin/cloud/plugin.tsx +1 -0
- package/src/plugins/builtin/cloud/team/module.tsx +1 -0
- package/src/plugins/builtin/cloud/thesis/detail.tsx +9 -4
- package/src/plugins/builtin/commodity-balances/pane.tsx +13 -5
- package/src/plugins/builtin/company-kpis/model.ts +3 -3
- package/src/plugins/builtin/connections/index.ts +1 -0
- package/src/plugins/builtin/credit-boards/cdx-pane.tsx +9 -5
- package/src/plugins/builtin/credit-boards/client.ts +5 -0
- package/src/plugins/builtin/credit-boards/headless.ts +1 -6
- package/src/plugins/builtin/credit-boards/model.ts +0 -6
- package/src/plugins/builtin/credit-boards/series.ts +19 -8
- package/src/plugins/builtin/credit-boards/sovr-pane.tsx +9 -5
- package/src/plugins/builtin/crypto-etf-flows/headless.ts +23 -13
- package/src/plugins/builtin/crypto-etf-flows/pane.tsx +8 -3
- package/src/plugins/builtin/debt-maturities/headless.ts +16 -7
- package/src/plugins/builtin/debt-maturities/model.ts +9 -15
- package/src/plugins/builtin/debt-maturities/pane.tsx +9 -10
- package/src/plugins/builtin/earnings/board-model.ts +33 -4
- package/src/plugins/builtin/earnings/board.tsx +15 -3
- package/src/plugins/builtin/earnings/calendar.tsx +10 -6
- package/src/plugins/builtin/earnings/client.ts +0 -9
- package/src/plugins/builtin/earnings/headless.ts +10 -7
- package/src/plugins/builtin/earnings/history.tsx +21 -14
- package/src/plugins/builtin/earnings-calls/data.ts +24 -4
- package/src/plugins/builtin/earnings-calls/format.ts +23 -5
- package/src/plugins/builtin/earnings-calls/headless.ts +23 -3
- package/src/plugins/builtin/earnings-calls/index.tsx +1 -0
- package/src/plugins/builtin/earnings-calls/model.ts +11 -1
- package/src/plugins/builtin/earnings-calls/pane.tsx +2 -5
- package/src/plugins/builtin/econ/calendar-model.ts +27 -0
- package/src/plugins/builtin/econ/fred-catalog.ts +3 -0
- package/src/plugins/builtin/econ/index.tsx +9 -2
- package/src/plugins/builtin/econ-statistics/headless.ts +3 -1
- package/src/plugins/builtin/econ-statistics/index.tsx +1 -1
- package/src/plugins/builtin/equity-screener/live.ts +74 -18
- package/src/plugins/builtin/equity-screener/model.ts +19 -4
- package/src/plugins/builtin/equity-screener/pane.tsx +19 -14
- package/src/plugins/builtin/equity-screener/refresh-anchor.ts +45 -0
- package/src/plugins/builtin/equity-screener/results.ts +22 -2
- package/src/plugins/builtin/equity-screener/screen-check.ts +9 -3
- package/src/plugins/builtin/fear-greed/headless.ts +16 -13
- package/src/plugins/builtin/fear-greed/pane.tsx +12 -4
- package/src/plugins/builtin/filing-events/index.tsx +1 -0
- package/src/plugins/builtin/futures/index.tsx +15 -1
- package/src/plugins/builtin/futures/table.tsx +1 -1
- package/src/plugins/builtin/fx-matrix/index.tsx +32 -19
- package/src/plugins/builtin/holders/pane.tsx +30 -20
- package/src/plugins/builtin/insider/table.tsx +10 -7
- package/src/plugins/builtin/insider/tickers.tsx +1 -1
- package/src/plugins/builtin/iv-history/events.ts +5 -0
- package/src/plugins/builtin/iv-history/headless.ts +15 -9
- package/src/plugins/builtin/jobs/index.tsx +1 -0
- package/src/plugins/builtin/kelly-sizer/sections.tsx +2 -0
- package/src/plugins/builtin/macro-day/headless.ts +15 -6
- package/src/plugins/builtin/macro-day/model.ts +1 -1
- package/src/plugins/builtin/macro-day/releases.ts +25 -16
- package/src/plugins/builtin/market-movers/index.tsx +20 -8
- package/src/plugins/builtin/market-movers/model.ts +5 -0
- package/src/plugins/builtin/market-movers/session-body.tsx +2 -1
- package/src/plugins/builtin/money-markets/headless.ts +12 -2
- package/src/plugins/builtin/money-markets/pane.tsx +10 -1
- package/src/plugins/builtin/options/view.tsx +3 -0
- package/src/plugins/builtin/options-positioning/pane.tsx +1 -1
- package/src/plugins/builtin/options-scenario/pane.tsx +2 -1
- package/src/plugins/builtin/perps/cascade-tabs.tsx +2 -1
- package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +4 -31
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +19 -1
- package/src/plugins/builtin/portfolio-list/quick-add/index.tsx +22 -8
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +6 -8
- package/src/plugins/builtin/portfolio-list/table.tsx +15 -1
- package/src/plugins/builtin/rate-path/pane.tsx +2 -0
- package/src/plugins/builtin/realized-vol/headless.ts +28 -2
- package/src/plugins/builtin/revenue-breakdown/pane.tsx +2 -0
- package/src/plugins/builtin/reverse-dcf/pane.tsx +2 -1
- package/src/plugins/builtin/risk-factors/index.tsx +1 -0
- package/src/plugins/builtin/seasonality/pane.tsx +2 -1
- package/src/plugins/builtin/shared/source-footer.ts +70 -0
- package/src/plugins/builtin/short-interest/publications-pane.tsx +5 -1
- package/src/plugins/builtin/short-volume/pane.tsx +5 -1
- package/src/plugins/builtin/social-mentions/outliers.tsx +10 -1
- package/src/plugins/builtin/social-mentions/pane.tsx +7 -0
- package/src/plugins/builtin/supply-chain/client.ts +3 -1
- package/src/plugins/builtin/supply-chain/flow.tsx +25 -8
- package/src/plugins/builtin/supply-chain/graph-client.ts +1 -1
- package/src/plugins/builtin/supply-chain/graph-evidence.ts +1 -1
- package/src/plugins/builtin/supply-chain/graph-model.ts +12 -1
- package/src/plugins/builtin/supply-chain/graph-pane.tsx +9 -8
- package/src/plugins/builtin/supply-chain/graph.tsx +12 -6
- package/src/plugins/builtin/supply-chain/headless.ts +13 -7
- package/src/plugins/builtin/supply-chain/model.ts +68 -11
- package/src/plugins/builtin/supply-chain/pane.tsx +9 -6
- package/src/plugins/builtin/supply-chain/row-evidence.tsx +5 -5
- package/src/plugins/builtin/thirteenf/pane.tsx +2 -0
- package/src/plugins/builtin/ticker-detail/financials/model.ts +28 -6
- package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +26 -9
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +58 -35
- package/src/plugins/builtin/ticker-detail/overview/components.tsx +14 -1
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +2 -0
- package/src/plugins/builtin/ticker-detail/pane.tsx +48 -24
- package/src/plugins/builtin/ticker-detail/quote-footer.ts +5 -0
- package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +6 -3
- package/src/plugins/builtin/treasury-auctions/after.ts +50 -23
- package/src/plugins/builtin/treasury-auctions/cache.ts +23 -5
- package/src/plugins/builtin/treasury-auctions/headless.ts +226 -37
- package/src/plugins/builtin/treasury-auctions/hk-headless.ts +11 -5
- package/src/plugins/builtin/treasury-auctions/hk-view.tsx +27 -25
- package/src/plugins/builtin/treasury-auctions/hk.ts +60 -8
- package/src/plugins/builtin/treasury-auctions/index.tsx +3 -0
- package/src/plugins/builtin/treasury-auctions/keys.ts +27 -0
- package/src/plugins/builtin/treasury-auctions/like.ts +137 -0
- package/src/plugins/builtin/treasury-auctions/model.ts +100 -22
- package/src/plugins/builtin/treasury-auctions/pane.tsx +39 -11
- package/src/plugins/builtin/vol-surface/heat-grid.tsx +6 -3
- package/src/plugins/builtin/vol-surface/pane.tsx +7 -3
- package/src/plugins/builtin/world-indices/index.tsx +5 -1
- package/src/plugins/builtin/yield-curve/index.tsx +2 -1
- package/src/plugins/runtime/index.tsx +1 -0
- package/src/plugins/runtime/state.ts +20 -0
- package/src/portfolio/column-values.ts +8 -2
- package/src/public/__snapshots__/public-api.test.ts.snap +5 -0
- package/src/public/react.ts +7 -0
- package/src/react/auto-refresh.ts +29 -0
- package/src/renderers/browser/deeplink-bridge.ts +24 -3
- package/src/renderers/dom/data-table/column-drag.ts +147 -0
- package/src/renderers/dom/data-table/index.tsx +22 -0
- package/src/renderers/dom/data-table/row.tsx +27 -5
- package/src/renderers/dom/desktop/query-bar.tsx +229 -60
- package/src/renderers/dom/host/overflow-fade-px.ts +2 -0
- package/src/renderers/dom/host/overflow-fade.ts +1 -2
- package/src/renderers/dom/styles.css +47 -5
- package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +2 -1
- package/src/renderers/opentui/chart-surface.tsx +1 -0
- package/src/renderers/opentui/frame-hits.ts +33 -0
- package/src/renderers/opentui/host.tsx +2 -0
- package/src/renderers/opentui/native-surface.ts +14 -21
- package/src/renderers/opentui/test-utils.tsx +3 -0
- package/src/series/types.ts +2 -0
- package/src/sources/gloomberb-cloud/fred-attribution.ts +86 -0
- package/src/sources/gloomberb-cloud/index.ts +25 -1
- package/src/sources/gloomberb-cloud/normalizers.ts +22 -3
- package/src/sources/provider-errors.ts +64 -1
- package/src/sources/provider-router/batches.ts +19 -0
- package/src/sources/provider-router/index.ts +7 -1
- package/src/state/app/context/index.tsx +46 -1
- package/src/state/pane-unsent-work.ts +47 -0
- package/src/test-support/app-store.ts +24 -1
- package/src/test-support/shell-pane-keys.tsx +5 -0
- package/src/test-support/telemetry-guard.ts +83 -0
- package/src/test-support/test-env.ts +12 -0
- package/src/theme/colors.ts +17 -1
- package/src/theme/ui-tokens.ts +50 -1
- package/src/tickers/listing-venues.ts +11 -1
- package/src/tickers/search/japanese-names.json +1 -0
- package/src/tickers/search/japanese-names.ts +152 -0
- package/src/tickers/terminal-codes.ts +55 -6
- package/src/time-series/base-series.ts +3 -0
- package/src/time-series/live-quotes.ts +3 -9
- package/src/types/data-provider.ts +6 -0
- package/src/types/financials.ts +11 -0
- package/src/types/plugin-contributions.ts +7 -0
- package/src/types/plugin-panes.ts +7 -0
- package/src/ui/host.tsx +24 -0
- package/src/ui/pointer-drag.ts +11 -2
- package/src/utils/double-escape-close.ts +42 -0
- package/src/utils/fundamentals.ts +14 -3
- package/src/utils/fx-status.ts +30 -7
- package/src/utils/network-failure.ts +23 -0
- package/src/utils/share-multiples.cases.json +780 -2
- package/src/utils/share-multiples.ts +154 -24
|
@@ -33,6 +33,107 @@ const SET_WARRANT = /-W\d*$/;
|
|
|
33
33
|
*/
|
|
34
34
|
const THAI_RECEIPT = /^[A-Z][A-Z0-9]{1,7}(?:01|03|06|11|13|19|23|24|80)$/;
|
|
35
35
|
|
|
36
|
+
/**
|
|
37
|
+
* A fund's own name: an exchange-traded fund, note or product (a UCITS one
|
|
38
|
+
* too), a Brazilian index fund ("Fundo de Índice", "Classe de Índice"), an
|
|
39
|
+
* index or mutual fund, a unit trust, an investment trust plc. A sponsor's
|
|
40
|
+
* name ("Global X ETFs") is not one, nor is a company named after the unit
|
|
41
|
+
* trusts it runs ("Unit Trust Corporation"), nor "Fund", "Trust" or "REIT"
|
|
42
|
+
* alone (Blackstone Secured Lending Fund, Northern Trust, Federal Realty
|
|
43
|
+
* Investment Trust).
|
|
44
|
+
*/
|
|
45
|
+
const FUND_NAMES = [
|
|
46
|
+
/\b(?:ETF|ETN|ETP)\b/,
|
|
47
|
+
/\bUCITS\b/,
|
|
48
|
+
/\bexchange[- ]traded\s+(?:fund|note|product|commodity)\b/i,
|
|
49
|
+
/\b(?:fundos?|classes?)\s+de\s+[íi]ndice\b/i,
|
|
50
|
+
/\b(?:index|mutual)\s+funds?\b/i,
|
|
51
|
+
/\bunit\s+trusts?\b(?!\s+(?:corporation|company|bank)\b)/i,
|
|
52
|
+
/(?<!real[- ]estate\s|property\s)\binvestment\s+trust\s+(?:plc|ltd|limited)\b/i,
|
|
53
|
+
];
|
|
54
|
+
/**
|
|
55
|
+
* A profile's first sentence saying the line is a fund: "The Inv-GW CHNXT 50
|
|
56
|
+
* ETF is an exchange-traded fund", "Cohen & Steers Infrastructure Fund, Inc.
|
|
57
|
+
* is a closed ended balanced mutual fund", "PIMCO Dynamic Income Fund is a
|
|
58
|
+
* closed ended fixed income mutual fund", "Literacy Capital plc is a British
|
|
59
|
+
* closed-ended investment company", "Sprott Physical Uranium Trust is a
|
|
60
|
+
* closed-end commodity trust", "... is an investment trust", an Australian
|
|
61
|
+
* listed investment company. Closed-end funds and investment trusts are
|
|
62
|
+
* valued on their assets, not their earnings. Not a company that sponsors or
|
|
63
|
+
* runs funds ("is an exchange-traded fund sponsor"), nor a real estate
|
|
64
|
+
* investment trust; a business development company is read apart.
|
|
65
|
+
*/
|
|
66
|
+
const FUND_DESCRIPTION =
|
|
67
|
+
/\bis\s+(?:an?\s+|the\s+)?(?:(?:type|kind|form)\s+of\s+)?(?:(?!(?:of|sponsor|provider|manager|issuer|operator|administrator|distributor|advis[eo]r)\b)[\w&,'’-]+\s+){0,3}?(?:exchange[- ]traded\s+(?:funds?|notes?|products?|commodit(?:y|ies))|closed[- ]end(?:ed)?\s+(?:[\w-]+\s+){0,3}?(?:funds?|trusts?|(?:investment|management)\s+(?:compan(?:y|ies)|firms?|vehicles?))|mutual\s+funds?|unit\s+(?:investment\s+)?trusts?|index\s+funds?|listed\s+investment\s+compan(?:y|ies)|(?<!real[- ]estate\s|realty\s|property\s|mortgage\s)investment\s+trusts?)\b(?!\s+(?:sponsor|provider|manager|management|issuer|company|corporation|bank|business|platform|firm|operator|administrator|distributor)s?\b)/i;
|
|
68
|
+
/** A business development company lends to private companies and is valued on its earnings: it keeps its P/E, closed-end or not. */
|
|
69
|
+
const BUSINESS_DEVELOPMENT = /\bbusiness\s+development\s+compan(?:y|ies)\b/i;
|
|
70
|
+
/** Abbreviations whose period does not end a profile's first sentence: Inc., Ltd., Corp., Co., plc., U.S. */
|
|
71
|
+
const ABBREVIATIONS = /\b(?:Inc|Ltd|Corp|Co|Plc|plc|PLC|LLC|Pty|Pvt|Bhd)\.|\b(?:[A-Z]\.){2,}/g;
|
|
72
|
+
/** A profile's first sentence, read past abbreviations. */
|
|
73
|
+
const firstSentence = (text: string): string =>
|
|
74
|
+
text.trim().replace(ABBREVIATIONS, (match) => match.replaceAll(".", "")).split(/\.(?:\s|$)/)[0] ?? "";
|
|
75
|
+
/**
|
|
76
|
+
* The types a source gives a fund, as one exact list (spaces, dashes and
|
|
77
|
+
* underscores dropped, upper case): an exchange-traded fund, note or product,
|
|
78
|
+
* a mutual, money market or closed-end fund, a unit or investment trust.
|
|
79
|
+
* Gloom Cloud's screener reads the same list.
|
|
80
|
+
*/
|
|
81
|
+
const FUND_TYPES = new Set([
|
|
82
|
+
"ETF", "ETN", "ETP", "EXCHANGETRADEDFUND", "EXCHANGETRADEDNOTE", "EXCHANGETRADEDPRODUCT", "FUND", "MUTUALFUND",
|
|
83
|
+
"MONEYMARKET", "MONEYMARKETFUND", "CEF", "CLOSEDEND", "CLOSEDENDFUND", "UNITTRUST", "UNITINVESTMENTTRUST", "UIT",
|
|
84
|
+
"INVESTMENTTRUST",
|
|
85
|
+
]);
|
|
86
|
+
/** Words that name no particular company or fund, left out when two names are compared (ownProfileText). */
|
|
87
|
+
const GENERIC_NAME_WORDS = new Set([
|
|
88
|
+
"the", "and", "inc", "incorporated", "ltd", "limited", "plc", "corp", "corporation", "company", "group", "holdings",
|
|
89
|
+
"holding", "fund", "funds", "etf", "etfs", "etc", "etn", "etp", "trust", "ord", "shares", "share", "class", "common",
|
|
90
|
+
"stock", "units", "unit", "capital", "global", "international", "investment", "investments", "management", "asset",
|
|
91
|
+
"assets", "securities", "index", "ucits", "usd", "eur", "gbp", "acc", "dist", "new", "llc", "pty", "pvt", "bhd",
|
|
92
|
+
"mutual",
|
|
93
|
+
]);
|
|
94
|
+
const nameWords = (name: string): string[] => [...new Set(name.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").toLowerCase()
|
|
95
|
+
.split(/[^a-z0-9]+/).filter((word) => word.length >= 3 && !GENERIC_NAME_WORDS.has(word)))];
|
|
96
|
+
/** Two words name the same thing: equal, or one of four letters or more inside the other (Dspnifty, Nifty). */
|
|
97
|
+
const sameWord = (left: string, right: string): boolean =>
|
|
98
|
+
left === right || (Math.min(left.length, right.length) >= 4 && (left.includes(right) || right.includes(left)));
|
|
99
|
+
/** What a profile's first sentence is about: the words before its verb. */
|
|
100
|
+
const profileSubject = (description: string): string =>
|
|
101
|
+
firstSentence(description).split(/\s+(?:is|was|are|operates|engages|provides)\s/)[0] ?? "";
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Whether a profile's name or first sentence is this listing's own: it shares a word with the quote's name, or names
|
|
105
|
+
* the listing's symbol (IBOV11 Fund). A receipt's profile is its underlying's, which it stands for (COPX on BYMA,
|
|
106
|
+
* Banco Comafi's CEDEAR of the Global X Copper Miners ETF). A profile can be another listing's under the same symbol
|
|
107
|
+
* (USAU, U.S. Gold Corp., carried the name of a Lyxor ETF): such a name says nothing of this listing. Without a quote
|
|
108
|
+
* name, or a word to compare, it stands.
|
|
109
|
+
*/
|
|
110
|
+
function ownProfileText(financials: ShareInputs, text: string): boolean {
|
|
111
|
+
const quote = nameWords(financials.quote?.name ?? "");
|
|
112
|
+
const profile = nameWords(text);
|
|
113
|
+
if (!quote.length || !profile.length || isReceipt(financials)) return true;
|
|
114
|
+
if (financials.quote?.cedearRatio ?? financials.fundamentals?.cedearRatio) return true;
|
|
115
|
+
const code = (financials.quote?.symbol ?? "").split(":")[0]!.trim().toUpperCase();
|
|
116
|
+
if (code.length >= 3 && text.toUpperCase().split(/[^A-Z0-9.]+/).includes(code)) return true;
|
|
117
|
+
return profile.some((word) => quote.some((other) => sameWord(word, other)));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Whether a listing is a fund, whose units are no company's shares: its type (FUND_TYPES), its quote's name, or its
|
|
122
|
+
* profile's name or first sentence where each is the listing's own (ownProfileText). 159682 on SZSE, the ChiNext 50
|
|
123
|
+
* ETF a source types EQUITY, read 0.87x on an EPS of 1.27. Closed-end funds and investment trusts are funds wherever
|
|
124
|
+
* they list (Polar Capital Technology, Scottish Mortgage, Pershing Square, Literacy Capital); a business development
|
|
125
|
+
* company is not. Gloom Cloud's screener reads funds alike.
|
|
126
|
+
*/
|
|
127
|
+
function isFund(financials: ShareInputs): boolean {
|
|
128
|
+
if (FUND_TYPES.has((financials.quote?.instrumentType ?? "").replace(/[\s_-]/g, "").toUpperCase())) return true;
|
|
129
|
+
const profileName = financials.profile?.name?.trim() ?? "";
|
|
130
|
+
const names = [financials.quote?.name ?? "", ownProfileText(financials, profileName) ? profileName : ""];
|
|
131
|
+
if (names.some((name) => FUND_NAMES.some((rule) => rule.test(name)))) return true;
|
|
132
|
+
const description = financials.profile?.description ?? "";
|
|
133
|
+
return ownProfileText(financials, profileSubject(description)) && !BUSINESS_DEVELOPMENT.test(description)
|
|
134
|
+
&& FUND_DESCRIPTION.test(firstSentence(description));
|
|
135
|
+
}
|
|
136
|
+
|
|
36
137
|
type Instrument = "warrant" | "right" | "unit";
|
|
37
138
|
|
|
38
139
|
const instrumentOf = (code: string): Instrument => {
|
|
@@ -54,7 +155,8 @@ type EpsInputs = ShareInputs & Partial<Pick<TickerFinancials, "financialCurrency
|
|
|
54
155
|
* ratio is on record on the receipt already (TSM's 5 shares, a CEDEAR's
|
|
55
156
|
* published ratio). A unit is told by its name only on a US venue or for a
|
|
56
157
|
* blank-check company; a REIT's, a fund's or a partnership's units are its
|
|
57
|
-
* share, and PSA.PR.U is a preferred.
|
|
158
|
+
* share, and PSA.PR.U is a preferred. Nor is a fund's price over the EPS a
|
|
159
|
+
* source gives it a P/E (isFund).
|
|
58
160
|
*/
|
|
59
161
|
export function notTheShare(financials: ShareInputs): string | undefined {
|
|
60
162
|
const quote = financials.quote;
|
|
@@ -72,6 +174,7 @@ export function notTheShare(financials: ShareInputs): string | undefined {
|
|
|
72
174
|
: venue === "SET" && SET_WARRANT.test(code) ? "W" : undefined;
|
|
73
175
|
const instrument = byName ?? (bySymbol ? instrumentOf(bySymbol) : undefined);
|
|
74
176
|
if (instrument) return `a ${instrument} is not the share the EPS is per`;
|
|
177
|
+
if (isFund(financials)) return "a fund is not a company's share";
|
|
75
178
|
const country = financials.profile?.country?.trim().toUpperCase();
|
|
76
179
|
const fundamentals = financials.fundamentals;
|
|
77
180
|
const receipt = quote.isDepositaryReceipt || fundamentals?.isDepositaryReceipt || fundamentals?.shareBasis === "depositary_receipt"
|
|
@@ -91,7 +194,9 @@ const finite = (value: number | null | undefined): value is number => typeof val
|
|
|
91
194
|
/** A per-share figure in a reason: whole above 100, cents above 0.01, else two significant digits (BZT's 0.000089). */
|
|
92
195
|
const perShare = (value: number) => Math.abs(value) >= 100 ? value.toFixed(0)
|
|
93
196
|
: Math.abs(value) >= 0.01 ? value.toFixed(2) : value.toPrecision(2);
|
|
94
|
-
|
|
197
|
+
/** A currency's major unit; ZAC is South African cents here, as Gloom Cloud quotes it. */
|
|
198
|
+
const majorCurrency = (currency: string | null | undefined) =>
|
|
199
|
+
resolveCurrencyUnit(currency?.trim() === "ZAC" ? "ZAc" : currency).currency || undefined;
|
|
95
200
|
|
|
96
201
|
/** The latest statement's currency. */
|
|
97
202
|
function statementsCurrency(financials: EpsInputs): string | undefined {
|
|
@@ -112,31 +217,31 @@ const days = (from: string, to: string) => (Date.parse(to) - Date.parse(from)) /
|
|
|
112
217
|
const quarterApart = (from: string, to: string) => days(from, to) >= 80 && days(from, to) <= 100;
|
|
113
218
|
|
|
114
219
|
/**
|
|
115
|
-
* The statements' trailing net income in `currency`: the
|
|
116
|
-
* when no quarter runs past it, four consecutive quarters,
|
|
117
|
-
* half since it where Gloom Cloud serves one, or the latest
|
|
118
|
-
* quarters since it less the same quarters a year earlier.
|
|
119
|
-
* the same window to tell an EPS in the reporting currency.
|
|
220
|
+
* The statements' trailing net income or diluted EPS in `currency`: the
|
|
221
|
+
* latest fiscal year when no quarter runs past it, four consecutive quarters,
|
|
222
|
+
* the year plus the half since it where Gloom Cloud serves one, or the latest
|
|
223
|
+
* year plus the quarters since it less the same quarters a year earlier.
|
|
224
|
+
* Gloom Cloud reads the same window to tell an EPS in the reporting currency.
|
|
120
225
|
*/
|
|
121
|
-
function
|
|
226
|
+
function statementsTrailing(financials: EpsInputs, currency: string, field: "netIncome" | "eps"): number | undefined {
|
|
122
227
|
const usable = (rows: readonly FinancialStatement[]) => rows
|
|
123
|
-
.filter((row) => finite(row
|
|
228
|
+
.filter((row) => finite(row[field]) && Number.isFinite(Date.parse(row.date)) && row.currency === currency)
|
|
124
229
|
.sort((left, right) => left.date.localeCompare(right.date));
|
|
125
230
|
const quarters = usable(quarterRows(financials.quarterlyStatements ?? []));
|
|
126
231
|
const annual = usable(financials.annualStatements ?? []).at(-1);
|
|
127
232
|
const latest = quarters.at(-1);
|
|
128
233
|
const trailing = financials.trailingStatement;
|
|
129
234
|
const served = trailing?.trailing?.method === "annual-plus-interim" && Number.isFinite(Date.parse(trailing.date))
|
|
130
|
-
&& trailing.currency === currency && finite(trailing
|
|
235
|
+
&& trailing.currency === currency && finite(trailing[field])
|
|
131
236
|
&& !(annual && days(annual.date, trailing.date) <= SAME_DATE_DAYS)
|
|
132
237
|
&& !(latest && days(trailing.date, latest.date) > SAME_DATE_DAYS)
|
|
133
|
-
? { value: trailing
|
|
134
|
-
if (!served && annual && (!latest || days(annual.date, latest.date) <= SAME_DATE_DAYS)) return annual
|
|
238
|
+
? { value: trailing[field], end: trailing.date } : undefined;
|
|
239
|
+
if (!served && annual && (!latest || days(annual.date, latest.date) <= SAME_DATE_DAYS)) return annual[field]!;
|
|
135
240
|
if (!latest) return served?.value;
|
|
136
241
|
const lastFour = quarters.slice(-4);
|
|
137
242
|
if ((!served || Math.abs(days(latest.date, served.end)) <= SAME_DATE_DAYS) && lastFour.length === 4
|
|
138
243
|
&& lastFour.every((row, index) => index === 0 || quarterApart(lastFour[index - 1]!.date, row.date))) {
|
|
139
|
-
return lastFour.reduce((total, row) => total + row
|
|
244
|
+
return lastFour.reduce((total, row) => total + row[field]!, 0);
|
|
140
245
|
}
|
|
141
246
|
if (served) return served.value;
|
|
142
247
|
if (!annual) return undefined;
|
|
@@ -148,20 +253,39 @@ function statementsTrailingNetIncome(financials: EpsInputs, currency: string): n
|
|
|
148
253
|
}
|
|
149
254
|
const prior = interims.map((row) => quarters.find((candidate) => Math.abs(days(candidate.date, row.date) - 365) <= SAME_DATE_DAYS));
|
|
150
255
|
if (prior.some((row) => !row)) return undefined;
|
|
151
|
-
return annual
|
|
152
|
-
- prior.reduce((total, row) => total + row
|
|
256
|
+
return annual[field]! + interims.reduce((total, row) => total + row[field]!, 0)
|
|
257
|
+
- prior.reduce((total, row) => total + row![field]!, 0);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/** An EPS the statements' own diluted EPS in `currency` matches, within 1% or half a cent (the source rounds to cents). */
|
|
261
|
+
function statementsOwnEps(financials: EpsInputs, currency: string, eps: number): boolean {
|
|
262
|
+
if (eps === 0) return false;
|
|
263
|
+
const annual = (financials.annualStatements ?? [])
|
|
264
|
+
.filter((row) => row.currency === currency && finite(row.eps) && Number.isFinite(Date.parse(row.date)))
|
|
265
|
+
.sort((left, right) => left.date.localeCompare(right.date))
|
|
266
|
+
.at(-1)?.eps;
|
|
267
|
+
return [annual, statementsTrailing(financials, currency, "eps")].some((own) =>
|
|
268
|
+
finite(own) && own !== 0 && Math.abs(eps - own) <= Math.max(0.01 * Math.abs(own), 0.005));
|
|
153
269
|
}
|
|
154
270
|
|
|
155
271
|
/**
|
|
156
272
|
* Why a trailing EPS in the statements' reporting currency beside a price in
|
|
157
|
-
* another gives no P/E:
|
|
158
|
-
* P/E's `trailingPEConversion`). U.UN on the TSX divided its CA$26.47 by a
|
|
273
|
+
* another gives no P/E: the served block names no rate it was converted at
|
|
274
|
+
* (the served P/E's `trailingPEConversion`). U.UN on the TSX divided its CA$26.47 by a
|
|
159
275
|
* USD 1.64 and read 16.14; NEW on Stuttgart €1.63 by GBP 0.0241, 67.63. The
|
|
160
276
|
* EPS is shown to be in the reporting currency where it is labelled so, sits
|
|
161
|
-
* beside a trailing block in it,
|
|
162
|
-
* own in it
|
|
163
|
-
*
|
|
164
|
-
*
|
|
277
|
+
* beside a trailing block in it, the block's net income is the statements'
|
|
278
|
+
* own in it, or the EPS is their own diluted EPS for the latest fiscal year
|
|
279
|
+
* or their trailing twelve months (TBT on MUNICH's 308.64 JPY, Tokuyama's
|
|
280
|
+
* year to March 2026, beside €21.60 read 0.07x). The reason says what is
|
|
281
|
+
* known: Gloom Cloud labels a block's currency only with the rates at hand,
|
|
282
|
+
* so a labelled one was left unconverted because its source's P/E does not
|
|
283
|
+
* match the EPS; an unlabelled one has no conversion on record, which a
|
|
284
|
+
* missing rate and figures that do not tie to the statements both leave, and
|
|
285
|
+
* the payload does not say which. Gloom Cloud's screener, which knows its
|
|
286
|
+
* rates, says "no rate on record" only when it has none.
|
|
287
|
+
* Undefined for an EPS the filed quarters give (in the price's currency), a
|
|
288
|
+
* receipt's on its home line, and one whose currency cannot be told.
|
|
165
289
|
*/
|
|
166
290
|
function noRateForEps(financials: EpsInputs): string | undefined {
|
|
167
291
|
const fundamentals = financials.fundamentals;
|
|
@@ -175,10 +299,16 @@ function noRateForEps(financials: EpsInputs): string | undefined {
|
|
|
175
299
|
const conversion = fundamentals.trailingPEConversion;
|
|
176
300
|
if (conversion && majorCurrency(conversion.from) === reporting && finite(conversion.rate) && conversion.rate > 0) return undefined;
|
|
177
301
|
const income = fundamentals.netIncome;
|
|
178
|
-
const statements = finite(income) ?
|
|
302
|
+
const statements = finite(income) ? statementsTrailing(financials, reporting, "netIncome") : undefined;
|
|
179
303
|
const inReporting = stated === reporting || (!!fundamentals.financialCurrency && !fundamentals.epsCurrency)
|
|
180
|
-
|| (finite(income) && finite(statements) && Math.abs(income - statements) <= 0.01 * Math.max(Math.abs(income), Math.abs(statements)))
|
|
181
|
-
|
|
304
|
+
|| (finite(income) && finite(statements) && Math.abs(income - statements) <= 0.01 * Math.max(Math.abs(income), Math.abs(statements)))
|
|
305
|
+
|| statementsOwnEps(financials, reporting, eps);
|
|
306
|
+
if (!inReporting) return undefined;
|
|
307
|
+
// Gloom Cloud labels a block's currency only with the rates at hand: such a block was left unconverted because
|
|
308
|
+
// its source's P/E is not the price over that EPS, not for want of a rate.
|
|
309
|
+
return fundamentals.financialCurrency
|
|
310
|
+
? `EPS (TTM) in ${reporting} beside a price in ${listing}, and the source's P/E does not match that EPS`
|
|
311
|
+
: `EPS (TTM) in ${reporting} beside a price in ${listing}, with no conversion on record`;
|
|
182
312
|
}
|
|
183
313
|
|
|
184
314
|
/**
|