@gloom-sh/terminal 0.20.21 → 0.20.23
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 +4 -3
- package/patches/electrobun-devkit@2.0.5.patch +169 -3
- package/src/account/heard-from-question.tsx +6 -4
- package/src/account/heard-from.ts +3 -4
- package/src/api-client/buybacks.ts +108 -0
- package/src/api-client/data.ts +213 -1
- package/src/api-client/dilution.ts +183 -0
- package/src/api-client/earnings.ts +2 -2
- package/src/api-client/equity-screener.ts +7 -0
- package/src/api-client/exchange-announcements.ts +16 -5
- package/src/api-client/exchange-short-balances.ts +24 -0
- package/src/api-client/heard-from.ts +5 -7
- package/src/api-client/hk-cbbc.ts +134 -0
- package/src/api-client/hk-ccass.ts +233 -0
- package/src/api-client/index.ts +55 -3
- package/src/api-client/jpx-short-positions.ts +24 -0
- package/src/api-client/market-discovery.ts +34 -6
- package/src/api-client/members.ts +5 -0
- package/src/api-client/ownership-disclosures.ts +68 -0
- package/src/api-client/paths.ts +2 -2
- package/src/api-client/request.ts +39 -10
- package/src/api-client/revenue-breakdown.ts +6 -2
- package/src/api-client/sfc-short-positions.ts +19 -0
- package/src/api-client/supply-chain.ts +22 -0
- package/src/api-client/taiwan-revenue.ts +134 -0
- package/src/api-client/types/jobs.ts +1 -0
- package/src/api-client/types/ticker-data.ts +3 -1
- package/src/api-client/types/world-venues.ts +1 -0
- package/src/app/language-observer.tsx +6 -1
- package/src/app/pane-runtime/plugin-bindings.ts +9 -4
- package/src/app/runtime/plugin-bindings.ts +20 -2
- package/src/architecture/core-builtin-allowlist.json +2 -2
- package/src/architecture/dom-cell-metrics-allowlist.json +2 -2
- package/src/architecture/dom-text-cuts-allowlist.json +2 -2
- package/src/architecture/floating-promise-allowlist.json +2 -2
- package/src/architecture/pane-tabs-allowlist.json +3 -0
- package/src/brokers/account-cache.ts +2 -1
- package/src/brokers/account-choice.ts +121 -0
- package/src/brokers/broker-portfolio-sync.ts +30 -5
- package/src/brokers/profile-form.ts +3 -0
- package/src/brokers/signed-in/adapter.ts +16 -5
- package/src/brokers/sync-broker-instance.ts +27 -3
- package/src/capabilities/asset-data-inputs.ts +8 -0
- package/src/capabilities/factories.ts +4 -0
- package/src/cli/commands/market.ts +141 -76
- package/src/cli/commands/news-search.ts +12 -0
- package/src/cli/commands/options-chain.ts +9 -3
- package/src/cli/commands/options-leaps.ts +55 -30
- package/src/cli/commands/overview.ts +20 -23
- package/src/cli/commands/search.ts +2 -1
- package/src/cli/commands/ticker.ts +17 -18
- package/src/cli/csv-export.ts +9 -5
- package/src/cli/desktop-pane-shot-browser.ts +143 -53
- package/src/cli/desktop-pane-shot.ts +50 -64
- package/src/cli/export-source.ts +9 -4
- package/src/cli/history-demergers.ts +134 -11
- package/src/cli/history-rows.ts +47 -7
- package/src/cli/listing-arg.ts +45 -18
- package/src/cli/pane-functions/catalog-snapshot.json +26 -22
- package/src/cli/pane-functions/catalog.ts +6 -2
- package/src/cli/pane-functions/data.ts +3 -1
- package/src/cli/pane-functions/dom.ts +8 -5
- package/src/cli/pane-functions/freshness.ts +6 -1
- package/src/cli/pane-functions/function-help.ts +32 -2
- package/src/cli/pane-functions/headless.ts +79 -27
- package/src/cli/pane-functions/index.ts +2 -1
- package/src/cli/pane-functions/market-session.ts +13 -3
- package/src/cli/pane-functions/resolver.ts +4 -1
- package/src/cli/pane-functions/screenshot-assessment.ts +26 -10
- package/src/cli/pane-functions/screenshot-bridge.ts +4 -1
- package/src/cli/pane-functions/screenshot-data-evidence.ts +11 -5
- package/src/cli/pane-functions/screenshot-payload.ts +21 -3
- package/src/cli/pane-functions/screenshot-render.ts +2 -0
- package/src/cli/pane-functions/ticker-question.ts +52 -47
- package/src/cli/rendered-table-rows.ts +75 -0
- package/src/cli/report-tables.ts +7 -1
- package/src/cli/result.ts +9 -2
- package/src/cli/symbol-list.ts +52 -14
- package/src/cli/ticker-resolution.ts +133 -38
- package/src/cli/visible-key-values.ts +3 -2
- package/src/components/chart/composite/composite-chart.tsx +12 -0
- package/src/components/chart/composite/format.ts +14 -1
- package/src/components/chart/composite/panel-surface/panel-cursor.tsx +37 -14
- package/src/components/chart/composite/panel-surface.tsx +1 -0
- package/src/components/chart/composite/text-renderer.ts +104 -44
- package/src/components/chart/composite/types.ts +18 -0
- package/src/components/chart/composite/use-composite-chart-keyboard.ts +38 -15
- package/src/components/chart/curve/model.ts +4 -1
- package/src/components/chart-table/header.tsx +11 -5
- package/src/components/chart-table/selection.ts +20 -1
- package/src/components/command-bar/routes/root/start-here.ts +1 -1
- package/src/components/command-bar/routes/ticker-search/results.ts +2 -1
- package/src/components/data-table/export.ts +3 -1
- package/src/components/data-table/sections.ts +12 -1
- package/src/components/data-table/view.tsx +52 -8
- package/src/components/feed-data-table/stack-view.tsx +88 -5
- package/src/components/index.ts +3 -3
- package/src/components/layout/floating-pane.tsx +5 -2
- package/src/components/layout/pane/header.tsx +33 -32
- package/src/components/layout/pane/index.tsx +6 -2
- package/src/components/layout/pane/link-note.ts +12 -0
- package/src/components/layout/pane/title.ts +1 -3
- package/src/components/market-board/index.tsx +8 -11
- package/src/components/reader/reader-text.tsx +25 -2
- package/src/components/ticker/badge/index.tsx +9 -4
- package/src/components/ticker/badge/list.tsx +3 -1
- package/src/components/ticker/list-table-view.tsx +4 -0
- package/src/components/ui/data-table/column-fit.ts +129 -0
- package/src/components/ui/data-table/display-columns.ts +28 -9
- package/src/components/ui/data-table/index.tsx +64 -16
- package/src/components/ui/data-table/muted-row.tsx +47 -0
- package/src/components/ui/data-table/opentui/index.tsx +47 -11
- package/src/components/ui/data-table/spill.ts +36 -0
- package/src/components/ui/data-table/types.ts +113 -6
- package/src/components/ui/data-table/use-column-order.ts +11 -0
- package/src/components/ui/data-table/visible-range.ts +9 -1
- package/src/components/ui/day-cell.ts +30 -0
- package/src/components/ui/icon.tsx +50 -3
- package/src/components/ui/index.ts +3 -1
- package/src/components/ui/list-view.tsx +2 -2
- package/src/components/ui/prose.tsx +3 -1
- package/src/components/ui/table-layout.ts +220 -6
- package/src/components/ui/terminal-hover-label.tsx +49 -0
- package/src/components/use-pinned-moment.ts +222 -13
- package/src/core/state/app/layout.ts +7 -2
- package/src/core/state/app/state.ts +17 -4
- package/src/core/state/app/types.ts +2 -1
- package/src/data/config/store/legacy-tabs.ts +51 -0
- package/src/data/config/store/node.ts +2 -2
- package/src/data/config/store/normalize.ts +11 -5
- package/src/data/config/store/shared-file.ts +8 -7
- package/src/data/config/store/shared-layout.ts +146 -0
- package/src/data/sqlite/access.ts +90 -12
- package/src/data/sqlite/checkpointer.ts +75 -12
- package/src/data/sqlite/database.ts +18 -1
- package/src/data/sqlite/retry.ts +1 -1
- package/src/docs/load.ts +5 -2
- package/src/docs/snapshot.json +1862 -4456
- package/src/i18n/es.ts +109 -0
- package/src/i18n/index.ts +74 -4
- package/src/i18n/ja.ts +109 -0
- package/src/i18n/ko.ts +109 -0
- package/src/i18n/react.ts +10 -2
- package/src/i18n/zh-cn.ts +109 -0
- package/src/i18n/zh-tw.ts +109 -0
- package/src/layout/pane-manager/dock-normalization.ts +61 -0
- package/src/market-data/ah-pair.ts +7 -2
- package/src/market-data/fund-actions.ts +21 -0
- package/src/market-data/market/freshness.ts +39 -35
- package/src/market-data/market/globex-day.ts +14 -0
- package/src/market-data/market/split-price-basis.ts +55 -0
- package/src/market-data/market/status.ts +2 -4
- package/src/market-data/price-adjustments.ts +115 -0
- package/src/market-data/published-us-sessions.ts +3 -2
- package/src/market-data/quotes/balance-sheet-rate.ts +6 -2
- package/src/market-data/quotes/day-range.ts +24 -9
- package/src/market-data/quotes/freshness.ts +4 -3
- package/src/market-data/quotes/live-valuation.ts +4 -2
- package/src/market-data/quotes/metadata.ts +48 -5
- package/src/market-data/quotes/regular-session-valuation.ts +18 -1
- package/src/market-data/quotes/resolution.ts +18 -29
- package/src/market-data/quotes/time.ts +138 -14
- package/src/news/query-presets.ts +6 -4
- package/src/plugins/builtin/alerts/cli-forms.ts +3 -0
- package/src/plugins/builtin/alerts/cli.ts +19 -7
- package/src/plugins/builtin/alerts/events-pane.tsx +1 -0
- package/src/plugins/builtin/alerts/format.ts +22 -10
- package/src/plugins/builtin/alerts/headless.ts +7 -4
- package/src/plugins/builtin/alerts/history-pane.tsx +93 -36
- package/src/plugins/builtin/alerts/history-rows.ts +24 -1
- package/src/plugins/builtin/alerts/index.tsx +8 -10
- package/src/plugins/builtin/alerts/metric-data.ts +24 -6
- package/src/plugins/builtin/alerts/pane.tsx +9 -0
- package/src/plugins/builtin/alerts/pro-rules.ts +1 -0
- package/src/plugins/builtin/alerts/research-builder.ts +6 -2
- package/src/plugins/builtin/alerts/research-rules.ts +12 -0
- package/src/plugins/builtin/alerts/types.ts +1 -0
- package/src/plugins/builtin/awards/detail.tsx +5 -4
- package/src/plugins/builtin/awards/headless.ts +13 -4
- package/src/plugins/builtin/awards/model.ts +36 -1
- package/src/plugins/builtin/awards/pane.tsx +29 -9
- package/src/plugins/builtin/backtest/pane.tsx +4 -2
- package/src/plugins/builtin/bond-calculator/pane.tsx +2 -1
- package/src/plugins/builtin/broker-manager/detail.tsx +67 -4
- package/src/plugins/builtin/broker-manager/index.tsx +35 -4
- package/src/plugins/builtin/broker-manager/keyboard.ts +10 -0
- package/src/plugins/builtin/broker-manager/pane-actions.tsx +35 -2
- package/src/plugins/builtin/broker-trading/orders.tsx +14 -5
- package/src/plugins/builtin/broker-trading/ticket.tsx +1 -0
- package/src/plugins/builtin/buildout/format.ts +3 -1
- package/src/plugins/builtin/buybacks/client.ts +48 -0
- package/src/plugins/builtin/buybacks/index.tsx +22 -0
- package/src/plugins/builtin/buybacks/model.ts +151 -0
- package/src/plugins/builtin/buybacks/pane.tsx +140 -0
- package/src/plugins/builtin/buybacks/series.ts +36 -0
- package/src/plugins/builtin/catalysts/detail.tsx +14 -8
- package/src/plugins/builtin/catalysts/evidence.ts +11 -3
- package/src/plugins/builtin/catalysts/headless.ts +51 -8
- package/src/plugins/builtin/catalysts/kinds.ts +413 -0
- package/src/plugins/builtin/catalysts/model.ts +61 -18
- package/src/plugins/builtin/catalysts/pane.tsx +85 -19
- package/src/plugins/builtin/cds/client.ts +9 -2
- package/src/plugins/builtin/cds/headless.ts +25 -10
- package/src/plugins/builtin/cds/model.ts +37 -12
- package/src/plugins/builtin/cds/pane.tsx +18 -10
- package/src/plugins/builtin/chart-composer/chart-spec-edit.ts +68 -7
- package/src/plugins/builtin/chart-composer/chart-title.ts +114 -0
- package/src/plugins/builtin/chart-composer/cli-options.ts +1 -1
- package/src/plugins/builtin/chart-composer/headless.ts +13 -1
- package/src/plugins/builtin/chart-composer/index.tsx +2 -68
- package/src/plugins/builtin/chart-composer/leverage-overlay.ts +2 -4
- package/src/plugins/builtin/chart-composer/pane.tsx +11 -3
- package/src/plugins/builtin/chart-composer/presets.ts +1 -1
- package/src/plugins/builtin/chat/attachments/desktop.tsx +46 -12
- package/src/plugins/builtin/chat/channels.ts +5 -2
- package/src/plugins/builtin/chat/content/composer-runtime.ts +64 -65
- package/src/plugins/builtin/chat/content/footer.tsx +17 -7
- package/src/plugins/builtin/chat/content/index.tsx +108 -36
- package/src/plugins/builtin/chat/content/new-dm-dialog.tsx +21 -8
- package/src/plugins/builtin/chat/content/selection-runtime.ts +16 -0
- package/src/plugins/builtin/chat/content/shortcuts.ts +3 -0
- package/src/plugins/builtin/chat/content/snapshot.ts +37 -13
- package/src/plugins/builtin/chat/content/transcript.tsx +12 -0
- package/src/plugins/builtin/chat/content/types.ts +2 -0
- package/src/plugins/builtin/chat/controller/channels.ts +15 -15
- package/src/plugins/builtin/chat/controller/draft-sync.ts +13 -7
- package/src/plugins/builtin/chat/controller/index.ts +140 -34
- package/src/plugins/builtin/chat/controller/lifecycle.ts +8 -12
- package/src/plugins/builtin/chat/controller/persistence.ts +32 -4
- package/src/plugins/builtin/chat/controller/send.ts +41 -17
- package/src/plugins/builtin/chat/controller/session-runtime.ts +28 -27
- package/src/plugins/builtin/chat/controller/state.ts +21 -8
- package/src/plugins/builtin/chat/controller/storage.ts +41 -4
- package/src/plugins/builtin/chat/controller/view.ts +6 -3
- package/src/plugins/builtin/chat/index.tsx +1 -1
- package/src/plugins/builtin/chat/layout.ts +8 -1
- package/src/plugins/builtin/chat/message/desktop.tsx +15 -11
- package/src/plugins/builtin/chat/message/header.tsx +112 -30
- package/src/plugins/builtin/chat/message/reactions.tsx +10 -11
- package/src/plugins/builtin/chat/message/render-state.ts +4 -2
- package/src/plugins/builtin/chat/message/terminal.tsx +13 -15
- package/src/plugins/builtin/chat/message/types.ts +5 -0
- package/src/plugins/builtin/chat/pane-requests.ts +8 -4
- package/src/plugins/builtin/clinical-trials/model.ts +2 -2
- package/src/plugins/builtin/clinical-trials/pane.tsx +3 -3
- package/src/plugins/builtin/cloud/askg/pane.tsx +60 -50
- package/src/plugins/builtin/cloud/auth-actions.tsx +2 -1
- package/src/plugins/builtin/cloud-tweets/table.tsx +25 -2
- package/src/plugins/builtin/comment-letters/pane.tsx +4 -2
- package/src/plugins/builtin/commodity-balances/headless.ts +2 -1
- package/src/plugins/builtin/company-attention/building-model.ts +3 -4
- package/src/plugins/builtin/company-attention/building.tsx +2 -0
- package/src/plugins/builtin/company-attention/headless.ts +2 -2
- package/src/plugins/builtin/company-attention/model.ts +2 -0
- package/src/plugins/builtin/company-attention/moves-model.ts +2 -1
- package/src/plugins/builtin/company-attention/moves.tsx +2 -0
- package/src/plugins/builtin/company-attention/pane.tsx +17 -3
- package/src/plugins/builtin/company-attention/signals-model.ts +3 -4
- package/src/plugins/builtin/company-attention/signals.tsx +5 -0
- package/src/plugins/builtin/company-kpis/headless.ts +26 -10
- package/src/plugins/builtin/company-kpis/model.ts +58 -10
- package/src/plugins/builtin/company-kpis/pane.tsx +36 -19
- package/src/plugins/builtin/company-kpis/taiwan-monthly-model.ts +99 -0
- package/src/plugins/builtin/company-kpis/taiwan-monthly-view.tsx +327 -0
- package/src/plugins/builtin/composite/ownership-browser.ts +28 -0
- package/src/plugins/builtin/composite/ownership.ts +5 -1
- package/src/plugins/builtin/congress-trades/detail.tsx +44 -8
- package/src/plugins/builtin/congress-trades/headless.ts +15 -11
- package/src/plugins/builtin/congress-trades/model.ts +104 -11
- package/src/plugins/builtin/congress-trades/pane.tsx +11 -6
- package/src/plugins/builtin/congress-trades/table.tsx +17 -10
- package/src/plugins/builtin/congress-trades/use-feed.ts +13 -2
- package/src/plugins/builtin/correlation/compute.ts +6 -1
- package/src/plugins/builtin/correlation/headless.ts +2 -2
- package/src/plugins/builtin/correlation/relationship/pane.tsx +11 -8
- package/src/plugins/builtin/correlation/relationship/view-model.ts +1 -19
- package/src/plugins/builtin/cot/headless.ts +1 -1
- package/src/plugins/builtin/cot/pane.tsx +7 -2
- package/src/plugins/builtin/cpi/headless.ts +2 -1
- package/src/plugins/builtin/credit-conditions/headless.ts +2 -1
- package/src/plugins/builtin/credit-documents/detail.tsx +2 -1
- package/src/plugins/builtin/credit-documents/export.ts +18 -12
- package/src/plugins/builtin/credit-documents/model.ts +106 -25
- package/src/plugins/builtin/credit-documents/pane.tsx +9 -5
- package/src/plugins/builtin/crypto-board/defi-view.tsx +2 -1
- package/src/plugins/builtin/crypto-board/defi.ts +5 -4
- package/src/plugins/builtin/crypto-board/headless.ts +7 -2
- package/src/plugins/builtin/crypto-board/model.ts +6 -4
- package/src/plugins/builtin/crypto-board/pane.tsx +2 -1
- package/src/plugins/builtin/crypto-board/supply.ts +4 -3
- package/src/plugins/builtin/crypto-etf-flows/headless.ts +15 -8
- package/src/plugins/builtin/crypto-etf-flows/pane.tsx +6 -5
- package/src/plugins/builtin/custom-view/loader.ts +95 -34
- package/src/plugins/builtin/custom-view/pane.tsx +31 -41
- package/src/plugins/builtin/custom-view/table.ts +201 -0
- package/src/plugins/builtin/debt-maturities/headless.ts +56 -38
- package/src/plugins/builtin/debt-maturities/model.ts +2 -1
- package/src/plugins/builtin/debt-maturities/pane.tsx +24 -22
- package/src/plugins/builtin/dilution/index.tsx +74 -0
- package/src/plugins/builtin/dilution/model.ts +159 -0
- package/src/plugins/builtin/dilution/pane.tsx +592 -0
- package/src/plugins/builtin/dividend-yield/client.ts +14 -17
- package/src/plugins/builtin/dividend-yield/headless.ts +24 -16
- package/src/plugins/builtin/dividend-yield/index.tsx +2 -1
- package/src/plugins/builtin/dividend-yield/model.ts +52 -10
- package/src/plugins/builtin/dividend-yield/pane.tsx +89 -17
- package/src/plugins/builtin/dividend-yield/ranking-view.tsx +6 -2
- package/src/plugins/builtin/dividend-yield/ranking.ts +7 -3
- package/src/plugins/builtin/dividend-yield/types.ts +2 -3
- package/src/plugins/builtin/dividend-yield/view.ts +58 -12
- package/src/plugins/builtin/docs/index.tsx +1 -1
- package/src/plugins/builtin/docs/pane.tsx +7 -3
- package/src/plugins/builtin/docs/use-docs.ts +2 -1
- package/src/plugins/builtin/earnings/board-model.ts +19 -6
- package/src/plugins/builtin/earnings/board-table.ts +64 -48
- package/src/plugins/builtin/earnings/board.tsx +93 -51
- package/src/plugins/builtin/earnings/headless.ts +71 -12
- package/src/plugins/builtin/earnings/history-model.ts +28 -15
- package/src/plugins/builtin/earnings/history.tsx +1 -1
- package/src/plugins/builtin/earnings-calls/calendar.tsx +23 -10
- package/src/plugins/builtin/earnings-calls/format.ts +34 -0
- package/src/plugins/builtin/earnings-calls/headless.ts +5 -4
- package/src/plugins/builtin/earnings-calls/pane.tsx +22 -17
- package/src/plugins/builtin/earnings-calls/transcript-view.tsx +14 -12
- package/src/plugins/builtin/earnings-ripple/pane.tsx +4 -3
- package/src/plugins/builtin/econ/calendar-model.ts +207 -3
- package/src/plugins/builtin/econ/columns.ts +132 -0
- package/src/plugins/builtin/econ/index.tsx +27 -79
- package/src/plugins/builtin/econ-statistics/detail.tsx +2 -2
- package/src/plugins/builtin/econ-statistics/headless.ts +10 -5
- package/src/plugins/builtin/econ-statistics/pane.tsx +6 -3
- package/src/plugins/builtin/econ-statistics/view.ts +15 -4
- package/src/plugins/builtin/equity-screener/client.ts +1 -1
- package/src/plugins/builtin/equity-screener/model.ts +12 -3
- package/src/plugins/builtin/estimate-revisions/headless.ts +23 -2
- package/src/plugins/builtin/estimate-revisions/model.ts +63 -13
- package/src/plugins/builtin/estimate-revisions/pane.tsx +228 -225
- package/src/plugins/builtin/estimate-revisions/sorting.ts +8 -16
- package/src/plugins/builtin/exposure/drivers.ts +5 -2
- package/src/plugins/builtin/exposure/headless.ts +6 -3
- package/src/plugins/builtin/exposure/model.ts +2 -1
- package/src/plugins/builtin/exposure/pane.tsx +16 -7
- package/src/plugins/builtin/fear-greed/format.ts +7 -7
- package/src/plugins/builtin/fear-greed/pane.tsx +21 -7
- package/src/plugins/builtin/futures-curve/headless.ts +14 -9
- package/src/plugins/builtin/futures-curve/model.ts +12 -4
- package/src/plugins/builtin/futures-curve/pane.tsx +18 -15
- package/src/plugins/builtin/fx-matrix/headless.ts +3 -2
- package/src/plugins/builtin/gpu/headless.ts +10 -4
- package/src/plugins/builtin/holders/beneficial-model.ts +1 -1
- package/src/plugins/builtin/holders/beneficial-view.tsx +3 -2
- package/src/plugins/builtin/holders/ccass-market-pane.tsx +363 -0
- package/src/plugins/builtin/holders/ccass-view.tsx +323 -0
- package/src/plugins/builtin/holders/disclosures-view.tsx +66 -0
- package/src/plugins/builtin/holders/disclosures.ts +47 -0
- package/src/plugins/builtin/holders/headless.ts +9 -2
- package/src/plugins/builtin/holders/index.tsx +75 -1
- package/src/plugins/builtin/holders/pane.tsx +37 -10
- package/src/plugins/builtin/holders/report-rows.ts +2 -0
- package/src/plugins/builtin/holders/table-model.ts +14 -6
- package/src/plugins/builtin/holders/types.ts +2 -2
- package/src/plugins/builtin/insider/activity-chart.ts +141 -0
- package/src/plugins/builtin/insider/headless.ts +2 -1
- package/src/plugins/builtin/insider/index.tsx +74 -12
- package/src/plugins/builtin/insider/signals-cells.tsx +15 -8
- package/src/plugins/builtin/insider/signals.tsx +6 -5
- package/src/plugins/builtin/insider/table-model.ts +17 -17
- package/src/plugins/builtin/insider/table.tsx +18 -10
- package/src/plugins/builtin/ipo-calendar/headless.ts +55 -11
- package/src/plugins/builtin/ipo-calendar/listing-ipo.ts +31 -4
- package/src/plugins/builtin/ipo-calendar/model.ts +238 -48
- package/src/plugins/builtin/ipo-calendar/pane.tsx +91 -25
- package/src/plugins/builtin/iv-history/client.ts +17 -8
- package/src/plugins/builtin/iv-history/format.ts +23 -12
- package/src/plugins/builtin/iv-history/headless.ts +9 -5
- package/src/plugins/builtin/iv-history/model.ts +15 -13
- package/src/plugins/builtin/iv-history/pane.tsx +5 -2
- package/src/plugins/builtin/iv-history/screen-pane.tsx +46 -24
- package/src/plugins/builtin/jobs/headless.ts +4 -3
- package/src/plugins/builtin/jobs/pane.tsx +6 -5
- package/src/plugins/builtin/jodi/headless.ts +15 -2
- package/src/plugins/builtin/jodi/model.ts +46 -5
- package/src/plugins/builtin/jodi/pane.tsx +17 -13
- package/src/plugins/builtin/kelly-sizer/headless.ts +11 -4
- package/src/plugins/builtin/kelly-sizer/pane.tsx +19 -9
- package/src/plugins/builtin/kelly-sizer/sections.tsx +2 -1
- package/src/plugins/builtin/kelly-sizer/units.ts +26 -0
- package/src/plugins/builtin/macro-day/pane.tsx +12 -5
- package/src/plugins/builtin/market-halts/model.ts +10 -8
- package/src/plugins/builtin/market-halts/pane.tsx +15 -3
- package/src/plugins/builtin/market-heatmap/data.ts +17 -2
- package/src/plugins/builtin/market-heatmap/headless.ts +56 -6
- package/src/plugins/builtin/market-heatmap/index.tsx +55 -1
- package/src/plugins/builtin/market-heatmap/model.ts +27 -1
- package/src/plugins/builtin/market-movers/model.ts +7 -1
- package/src/plugins/builtin/market-movers/session-table.ts +1 -0
- package/src/plugins/builtin/market-movers/session.ts +1 -1
- package/src/plugins/builtin/market-movers/table.ts +1 -1
- package/src/plugins/builtin/members/headless.ts +13 -5
- package/src/plugins/builtin/members/model.ts +35 -1
- package/src/plugins/builtin/members/pane.tsx +16 -8
- package/src/plugins/builtin/mna/distress/detail.tsx +7 -6
- package/src/plugins/builtin/mna/distress/model.ts +7 -7
- package/src/plugins/builtin/mna/distress/pane.tsx +8 -7
- package/src/plugins/builtin/mna/headless.ts +40 -7
- package/src/plugins/builtin/mna/model.ts +66 -6
- package/src/plugins/builtin/mna/pane.tsx +118 -60
- package/src/plugins/builtin/news/wire/industry-pane.tsx +1 -0
- package/src/plugins/builtin/news/wire/news/row.ts +5 -12
- package/src/plugins/builtin/news/wire/news/table.tsx +46 -44
- package/src/plugins/builtin/notes/index.tsx +2 -1
- package/src/plugins/builtin/openfda/model.ts +1 -1
- package/src/plugins/builtin/openfda/pane.tsx +37 -9
- package/src/plugins/builtin/options/analytics.ts +30 -6
- package/src/plugins/builtin/options/calc-seed.ts +38 -3
- package/src/plugins/builtin/options/footer.ts +18 -1
- package/src/plugins/builtin/options/live-quotes.ts +21 -6
- package/src/plugins/builtin/options/open-interest-as-of.ts +5 -0
- package/src/plugins/builtin/options/quote-context.tsx +21 -8
- package/src/plugins/builtin/options/table.ts +17 -2
- package/src/plugins/builtin/options/view.tsx +97 -46
- package/src/plugins/builtin/options-calculator/model.ts +65 -3
- package/src/plugins/builtin/options-calculator/pane.tsx +11 -3
- package/src/plugins/builtin/options-calculator/valuation.ts +33 -0
- package/src/plugins/builtin/options-positioning/cbbc-model.ts +160 -0
- package/src/plugins/builtin/options-positioning/cbbc-view.tsx +453 -0
- package/src/plugins/builtin/options-positioning/index.tsx +22 -1
- package/src/plugins/builtin/options-positioning/pane.tsx +16 -1
- package/src/plugins/builtin/options-scenario/charts.tsx +2 -1
- package/src/plugins/builtin/options-scenario/csp-screen-headless.ts +5 -5
- package/src/plugins/builtin/options-scenario/csp-screen-pane.tsx +11 -14
- package/src/plugins/builtin/options-scenario/csp-screen.ts +9 -1
- package/src/plugins/builtin/options-scenario/headless.ts +3 -3
- package/src/plugins/builtin/options-scenario/index.tsx +1 -1
- package/src/plugins/builtin/options-scenario/model.ts +7 -0
- package/src/plugins/builtin/options-scenario/pane.tsx +24 -14
- package/src/plugins/builtin/pe-band/headless.ts +1 -1
- package/src/plugins/builtin/pe-band/model.ts +41 -18
- package/src/plugins/builtin/pe-band/pane.tsx +8 -6
- package/src/plugins/builtin/perps/cascade-tabs.tsx +2 -1
- package/src/plugins/builtin/perps/cascade.ts +4 -3
- package/src/plugins/builtin/perps/equity-row.tsx +4 -6
- package/src/plugins/builtin/perps/headless.ts +19 -12
- package/src/plugins/builtin/perps/markets-section.tsx +19 -15
- package/src/plugins/builtin/perps/model.ts +14 -5
- package/src/plugins/builtin/portfolio-list/cached-account.ts +3 -1
- package/src/plugins/builtin/portfolio-list/cli/import-positions.ts +6 -18
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +1 -1
- package/src/plugins/builtin/portfolio-list/pane/purchase-date-fx.ts +1 -1
- package/src/plugins/builtin/portfolio-list/positions-import/index.tsx +1 -1
- package/src/plugins/builtin/portfolio-list/positions-import/lookup.ts +28 -57
- package/src/plugins/builtin/portfolio-list/settings.ts +4 -3
- package/src/plugins/builtin/portfolio-list/table.tsx +19 -2
- package/src/plugins/builtin/power/client.ts +2 -2
- package/src/plugins/builtin/power/detail.tsx +11 -8
- package/src/plugins/builtin/power/gas-model.ts +2 -1
- package/src/plugins/builtin/power/gas.tsx +3 -2
- package/src/plugins/builtin/power/headless.ts +4 -1
- package/src/plugins/builtin/power/model.ts +19 -0
- package/src/plugins/builtin/power/pane.tsx +5 -4
- package/src/plugins/builtin/power/prices-headless.ts +4 -3
- package/src/plugins/builtin/power/prices.tsx +7 -6
- package/src/plugins/builtin/primary-dealers/headless.ts +1 -1
- package/src/plugins/builtin/primary-dealers/model.ts +2 -1
- package/src/plugins/builtin/rate-path/headless.ts +5 -2
- package/src/plugins/builtin/rate-path/pane.tsx +13 -10
- package/src/plugins/builtin/realized-vol/fx-proxy.ts +7 -8
- package/src/plugins/builtin/realized-vol/headless.ts +3 -4
- package/src/plugins/builtin/realized-vol/pane.tsx +5 -4
- package/src/plugins/builtin/relative-rotation/headless.ts +2 -1
- package/src/plugins/builtin/research/analyst-model.ts +1 -1
- package/src/plugins/builtin/research/analyst-pane.tsx +2 -1
- package/src/plugins/builtin/research/earnings-estimates-pane.tsx +262 -0
- package/src/plugins/builtin/research/event-charts.ts +322 -0
- package/src/plugins/builtin/research/event-data.ts +140 -0
- package/src/plugins/builtin/research/event-detail.tsx +442 -0
- package/src/plugins/builtin/research/event-model.ts +338 -39
- package/src/plugins/builtin/research/event-sources.ts +58 -8
- package/src/plugins/builtin/research/event-views.tsx +397 -0
- package/src/plugins/builtin/research/events-headless.ts +60 -4
- package/src/plugins/builtin/research/headless-schema.ts +2 -2
- package/src/plugins/builtin/research/headless.ts +84 -7
- package/src/plugins/builtin/research/index.tsx +19 -17
- package/src/plugins/builtin/research/relative-valuation-columns.ts +39 -14
- package/src/plugins/builtin/research/relative-valuation-headless.ts +9 -5
- package/src/plugins/builtin/research/relative-valuation-model.ts +23 -8
- package/src/plugins/builtin/research/relative-valuation-pane.tsx +10 -0
- package/src/plugins/builtin/revenue-breakdown/client.ts +9 -4
- package/src/plugins/builtin/revenue-breakdown/headless.ts +1 -1
- package/src/plugins/builtin/revenue-breakdown/index.tsx +2 -1
- package/src/plugins/builtin/revenue-breakdown/model.ts +2 -0
- package/src/plugins/builtin/revenue-breakdown/pane.tsx +10 -0
- package/src/plugins/builtin/risk-factors/pane.tsx +14 -9
- package/src/plugins/builtin/scanner/flow-pane.tsx +10 -0
- package/src/plugins/builtin/scanner/headless.ts +2 -0
- package/src/plugins/builtin/scanner/lock-note.ts +5 -9
- package/src/plugins/builtin/sec/exchange-filings.ts +69 -0
- package/src/plugins/builtin/sec/fund-facts.ts +10 -8
- package/src/plugins/builtin/sec/headless.ts +60 -8
- package/src/plugins/builtin/sec/index.tsx +169 -61
- package/src/plugins/builtin/sec/model.ts +10 -4
- package/src/plugins/builtin/sec/row-summaries.ts +1 -0
- package/src/plugins/builtin/series-inventory.ts +4 -0
- package/src/plugins/builtin/shared/beat-miss-chart.ts +66 -0
- package/src/plugins/builtin/shared/day-entries.ts +41 -0
- package/src/plugins/builtin/shared/earnings-calendar.ts +80 -53
- package/src/plugins/builtin/shared/earnings-report.ts +53 -15
- package/src/plugins/builtin/shared/history-span.ts +2 -1
- package/src/plugins/builtin/shared/locked-rows.tsx +1 -1
- package/src/plugins/builtin/shared/pro-lock-note.ts +8 -12
- package/src/plugins/builtin/shared/report-freshness.ts +4 -1
- package/src/plugins/builtin/shared/ticker-request.ts +4 -2
- package/src/plugins/builtin/shared/volatility/live-session.ts +6 -7
- package/src/plugins/builtin/shared/volatility/option-snapshot.ts +30 -0
- package/src/plugins/builtin/shared/volatility/quote-session.ts +49 -0
- package/src/plugins/builtin/short-interest/exchange-balances.ts +76 -0
- package/src/plugins/builtin/short-interest/exchange-positions-pane.tsx +55 -0
- package/src/plugins/builtin/short-interest/headless.ts +15 -2
- package/src/plugins/builtin/short-interest/index.tsx +7 -3
- package/src/plugins/builtin/short-interest/jpx.ts +38 -0
- package/src/plugins/builtin/short-interest/model.ts +3 -2
- package/src/plugins/builtin/short-interest/pane.tsx +4 -3
- package/src/plugins/builtin/short-interest/publications-model.ts +73 -2
- package/src/plugins/builtin/short-interest/publications-pane.tsx +16 -4
- package/src/plugins/builtin/short-interest/sfc.ts +40 -0
- package/src/plugins/builtin/short-interest/surface.tsx +16 -2
- package/src/plugins/builtin/short-volume/headless.ts +18 -3
- package/src/plugins/builtin/short-volume/model.ts +6 -1
- package/src/plugins/builtin/short-volume/pane.tsx +8 -7
- package/src/plugins/builtin/short-volume/sgx.ts +23 -0
- package/src/plugins/builtin/social-mentions/outliers-model.ts +2 -1
- package/src/plugins/builtin/social-mentions/pane.tsx +10 -8
- package/src/plugins/builtin/supply-chain/client.ts +10 -2
- package/src/plugins/builtin/supply-chain/directories.ts +18 -0
- package/src/plugins/builtin/supply-chain/evidence.ts +12 -4
- package/src/plugins/builtin/supply-chain/headless.ts +20 -7
- package/src/plugins/builtin/supply-chain/pane.tsx +40 -11
- package/src/plugins/builtin/thirteenf/api.ts +299 -31
- package/src/plugins/builtin/thirteenf/data.ts +126 -32
- package/src/plugins/builtin/thirteenf/format.ts +4 -6
- package/src/plugins/builtin/thirteenf/headless.ts +68 -29
- package/src/plugins/builtin/thirteenf/model.ts +24 -11
- package/src/plugins/builtin/thirteenf/overlap-pane.tsx +16 -8
- package/src/plugins/builtin/thirteenf/pane.tsx +45 -22
- package/src/plugins/builtin/thirteenf/report-notes.ts +52 -2
- package/src/plugins/builtin/thirteenf/session-scope.ts +57 -0
- package/src/plugins/builtin/thirteenf/signals-pane.tsx +17 -4
- package/src/plugins/builtin/thirteenf/split-history.ts +119 -0
- package/src/plugins/builtin/thirteenf/table.ts +6 -6
- package/src/plugins/builtin/thirteenf/types.ts +17 -1
- package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +11 -0
- package/src/plugins/builtin/ticker-detail/data-panes/historical-prices.tsx +12 -8
- package/src/plugins/builtin/ticker-detail/data-panes/history-bars.ts +5 -4
- package/src/plugins/builtin/ticker-detail/data-panes/returns-model.ts +7 -0
- package/src/plugins/builtin/ticker-detail/data-panes/returns-pane.tsx +12 -5
- package/src/plugins/builtin/ticker-detail/financials/aggregation.ts +35 -5
- package/src/plugins/builtin/ticker-detail/financials/exchange-table.tsx +61 -0
- package/src/plugins/builtin/ticker-detail/financials/model.ts +210 -43
- package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +69 -8
- package/src/plugins/builtin/ticker-detail/financials/ratios.ts +64 -10
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +132 -68
- package/src/plugins/builtin/ticker-detail/headless.ts +37 -13
- package/src/plugins/builtin/ticker-detail/overview/components.tsx +75 -14
- package/src/plugins/builtin/ticker-detail/overview/model.ts +87 -35
- package/src/plugins/builtin/ticker-detail/overview/pane.tsx +14 -8
- package/src/plugins/builtin/ticker-detail/overview/types.ts +2 -0
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +50 -17
- package/src/plugins/builtin/ticker-detail/pane.tsx +5 -3
- package/src/plugins/builtin/ticker-detail/research-groups.ts +15 -2
- package/src/plugins/builtin/ticker-detail/research-tabs.ts +2 -1
- package/src/plugins/builtin/time-sales/headless.ts +3 -3
- package/src/plugins/builtin/time-sales/model.ts +16 -9
- package/src/plugins/builtin/time-sales/pane.tsx +27 -24
- package/src/plugins/builtin/trace-bonds/pane.tsx +3 -2
- package/src/plugins/builtin/treasury-auctions/cache.ts +44 -19
- package/src/plugins/builtin/treasury-auctions/client.ts +9 -4
- package/src/plugins/builtin/treasury-daily/client.ts +43 -9
- package/src/plugins/builtin/treasury-daily/pane.tsx +48 -27
- package/src/plugins/builtin/treasury-daily/resource.ts +33 -0
- package/src/plugins/builtin/vol-surface/charts.tsx +3 -1
- package/src/plugins/builtin/vol-surface/events.ts +8 -5
- package/src/plugins/builtin/vol-surface/evidence.ts +2 -2
- package/src/plugins/builtin/vol-surface/headless.ts +46 -28
- package/src/plugins/builtin/vol-surface/heat-grid.tsx +2 -1
- package/src/plugins/builtin/vol-surface/model.ts +34 -9
- package/src/plugins/builtin/vol-surface/pane.tsx +35 -67
- package/src/plugins/builtin/vol-surface/quote-coverage.ts +68 -0
- package/src/plugins/builtin/vol-surface/tables.ts +57 -6
- package/src/plugins/builtin/volatility/charts.tsx +7 -3
- package/src/plugins/builtin/volatility/headless.ts +5 -5
- package/src/plugins/builtin/volatility/pane.tsx +8 -5
- package/src/plugins/builtin/world-indices/headless.ts +5 -3
- package/src/plugins/builtin/world-venue-map/headless.ts +15 -1
- package/src/plugins/builtin/world-venue-map/layered-pane.tsx +5 -3
- package/src/plugins/builtin/world-venue-map/pane.tsx +4 -3
- package/src/plugins/builtin/world-venue-map/venue-exceptions.ts +72 -0
- package/src/plugins/builtin/world-venue-map/venue-header.tsx +20 -11
- package/src/plugins/builtin/yield-curve/headless.ts +4 -2
- package/src/plugins/builtin/yield-curve/index.tsx +4 -3
- package/src/plugins/catalog-browser.ts +3 -34
- package/src/plugins/marketplace/feed.ts +3 -2
- package/src/plugins/registry/contributions.ts +37 -10
- package/src/plugins/registry/index.ts +2 -1
- package/src/portfolio/column-values.ts +8 -9
- package/src/portfolio/positions-import/parse.ts +14 -6
- package/src/portfolio/positions-import/plan.ts +3 -2
- package/src/public/__snapshots__/public-api.test.ts.snap +5 -0
- package/src/public/i18n.ts +3 -2
- package/src/react/async-resource.ts +3 -1
- package/src/renderers/dom/css.d.ts +1 -0
- package/src/renderers/dom/data-table/index.tsx +100 -8
- package/src/renderers/dom/data-table/row.tsx +40 -4
- package/src/renderers/dom/desktop/icons.tsx +147 -3
- package/src/renderers/dom/desktop/popover.tsx +2 -2
- package/src/renderers/dom/host/media-surface.tsx +204 -45
- package/src/renderers/dom/host/tabs.tsx +1 -0
- package/src/renderers/dom/styles.css +14 -2
- package/src/renderers/electrobun/bun/desktop/backend.ts +14 -1
- package/src/renderers/electrobun/bun/desktop/rpc-timing.ts +9 -3
- package/src/renderers/electrobun/shared/protocol.ts +2 -0
- package/src/renderers/electrobun/view/backend-rpc.ts +5 -2
- package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +7 -1
- package/src/renderers/electrobun/view/remote/asset-data-client.ts +2 -0
- package/src/renderers/electrobun/view/rpc-timeout.ts +44 -3
- package/src/sources/gloomberb-cloud/batched-lookups.ts +12 -1
- package/src/sources/gloomberb-cloud/index.ts +44 -10
- package/src/sources/gloomberb-cloud/normalizers.ts +8 -2
- package/src/sources/listing-symbols.ts +7 -1
- package/src/sources/provider-router/cache.ts +5 -4
- package/src/sources/provider-router/financials.ts +44 -22
- package/src/sources/provider-router/index.ts +9 -1
- package/src/state/app/context/index.tsx +12 -4
- package/src/state/app/tab-cursor.ts +47 -6
- package/src/sync/broker-instances.ts +63 -11
- package/src/sync/config-merge.ts +1 -1
- package/src/sync/sanitize.ts +2 -0
- package/src/telemetry/stall-clocks.ts +3 -0
- package/src/telemetry/stall-reports.ts +12 -3
- package/src/telemetry/windows-process-activity.ts +41 -0
- package/src/telemetry/windows-time.ts +32 -0
- package/src/test-support/cloud-api.ts +34 -0
- package/src/test-support/scoped-earnings.ts +24 -0
- package/src/test-support/strict-table-capture.tsx +83 -0
- package/src/tickers/search/index.ts +23 -7
- package/src/tickers/terminal-codes.ts +1 -6
- package/src/time-series/alignment.ts +14 -4
- package/src/time-series/base-series.ts +5 -4
- package/src/time-series/chart-data.ts +2 -0
- package/src/time-series/chart-seed.ts +3 -1
- package/src/time-series/daily-valuation.ts +13 -6
- package/src/time-series/filed-trailing-eps.ts +16 -3
- package/src/time-series/fundamentals/current-valuation.ts +30 -5
- package/src/time-series/fundamentals/historical-valuation.ts +20 -0
- package/src/time-series/fundamentals/history-link.ts +25 -0
- package/src/time-series/fundamentals/quarterly-ttm.ts +50 -5
- package/src/time-series/fundamentals/series.ts +13 -1
- package/src/time-series/market.ts +30 -4
- package/src/time-series/price-comparison.ts +39 -60
- package/src/time-series/resolve.ts +18 -11
- package/src/time-series/spec.ts +2 -1
- package/src/time-series/studies/formula.ts +4 -2
- package/src/time-series/studies/indicators.ts +2 -0
- package/src/time-series/studies/pair.ts +4 -2
- package/src/time-series/studies/shared.ts +1 -0
- package/src/time-series/types.ts +2 -1
- package/src/time-series/use-chart-resolution.ts +32 -14
- package/src/time-series/valuation-currency.ts +2 -0
- package/src/types/config.ts +13 -61
- package/src/types/data-provider.ts +8 -0
- package/src/types/financials.ts +94 -15
- package/src/types/headless.ts +30 -0
- package/src/types/plugin-context.ts +8 -1
- package/src/ui/dialog-context.ts +8 -0
- package/src/utils/crypto-pair.ts +10 -0
- package/src/utils/datetime-format.ts +23 -1
- package/src/utils/day-format.ts +104 -0
- package/src/utils/declared-dividends.ts +12 -2
- package/src/utils/exchange-announcements.ts +38 -12
- package/src/utils/exchange-notation.generated.ts +3 -1
- package/src/utils/exchanges.ts +2 -1
- package/src/utils/financial-statements.ts +40 -46
- package/src/utils/format.ts +39 -12
- package/src/utils/forward-dividend.ts +2 -1
- package/src/utils/fundamentals.ts +1 -0
- package/src/utils/main-thread-stall.ts +9 -1
- package/src/utils/rpc-timeout-error.ts +36 -11
- package/src/utils/sec.ts +3 -1
- package/src/utils/share-multiples.ts +1 -1
- package/src/utils/stall-process-activity.ts +70 -0
- package/src/utils/statement-scope.ts +103 -0
- package/src/utils/trailing-dividend.ts +47 -0
- package/src/utils/trailing-eps.ts +1 -1
- package/src/utils/zoned-date-time.ts +1 -0
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +0 -771
|
@@ -139,6 +139,7 @@ export const EXCHANGE_NOTATION: ExchangeNotation = {
|
|
|
139
139
|
XWAR: "WSE",
|
|
140
140
|
PRA: "PSE",
|
|
141
141
|
XPRA: "PSE",
|
|
142
|
+
XPHS: "XPHS",
|
|
142
143
|
VIE: "VIE",
|
|
143
144
|
VIENNA: "VIE",
|
|
144
145
|
XWBO: "VIE",
|
|
@@ -363,6 +364,7 @@ export const EXCHANGE_NOTATION: ExchangeNotation = {
|
|
|
363
364
|
ICEX: "Nasdaq Iceland",
|
|
364
365
|
WSE: "Warsaw Stock Exchange",
|
|
365
366
|
PSE: "Prague Stock Exchange",
|
|
367
|
+
XPHS: "Philippine Stock Exchange",
|
|
366
368
|
VIE: "Vienna Stock Exchange",
|
|
367
369
|
WBDM: "Vienna MTF",
|
|
368
370
|
TWSE: "Taiwan Stock Exchange",
|
|
@@ -413,4 +415,4 @@ export const EXCHANGE_NOTATION: ExchangeNotation = {
|
|
|
413
415
|
},
|
|
414
416
|
}
|
|
415
417
|
|
|
416
|
-
export const EXCHANGE_NOTATION_VERSION = "
|
|
418
|
+
export const EXCHANGE_NOTATION_VERSION = "c496447bd0bb1aa4"
|
package/src/utils/exchanges.ts
CHANGED
|
@@ -47,6 +47,7 @@ export const EXCHANGE_TIME_ZONES: Record<string, string> = {
|
|
|
47
47
|
LSE: "Europe/London",
|
|
48
48
|
ASX: "Australia/Sydney",
|
|
49
49
|
SGX: "Asia/Singapore",
|
|
50
|
+
XPHS: "Asia/Manila",
|
|
50
51
|
HOSE: "Asia/Ho_Chi_Minh",
|
|
51
52
|
HNX: "Asia/Ho_Chi_Minh",
|
|
52
53
|
KRX: "Asia/Seoul",
|
|
@@ -213,7 +214,7 @@ const US_EQUITY_EXCHANGES: ReadonlySet<string> = new Set([
|
|
|
213
214
|
*/
|
|
214
215
|
export function isUsOtcVenue(value?: string): boolean {
|
|
215
216
|
const venue = canonicalExchange(value);
|
|
216
|
-
return US_OTC_EXCHANGES.has(venue) || /^(?:OTC MARKETS\b|
|
|
217
|
+
return US_OTC_EXCHANGES.has(venue) || /^(?:OTC MARKETS\b|OTC(?:PK|QX|QB|ID|BB|B|M|Q)$|OID$|PINX$|EXPM$|NASDAQ OTCBB$|PINK SHEETS$|OTHER OTC$)/.test(venue);
|
|
217
218
|
}
|
|
218
219
|
|
|
219
220
|
/** A US venue a stock or fund trades on, listed or over the counter. */
|
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
import type { FinancialStatement, ResultsFillField, StatementFill, StatementFillField, TickerFinancials } from "../types/financials";
|
|
2
|
-
import { settleWithin } from "./async-deadline";
|
|
3
2
|
import { fiscalYearEndMonth } from "./fiscal-period";
|
|
4
|
-
import { logFailure } from "./log-failure";
|
|
5
3
|
import { copyIncomeField, incomeFieldOwner, INCOME_STATEMENT_FIELDS, isIncomeStatementField } from "./income-statement";
|
|
6
4
|
import { mergeStatementGaps } from "./statement-gaps";
|
|
7
5
|
|
|
8
6
|
export const FINANCIAL_VINTAGE_NOTICE = "Latest available statements may include restatements. Historical as-of values are not reconstructed.";
|
|
9
7
|
|
|
8
|
+
/**
|
|
9
|
+
* The key of a statement or ratio table's first row in the pane, the day each
|
|
10
|
+
* period ends: part of the heading, not a line of figures, so a capture's
|
|
11
|
+
* checks on a table's values leave it out.
|
|
12
|
+
*/
|
|
13
|
+
export const PERIOD_END_ROW_ID = "period-end";
|
|
14
|
+
|
|
10
15
|
/** The oldest dated period of a report's columns (a TTM column has no date), or null when none has one. */
|
|
11
|
-
function oldestPeriod(dates: readonly string[]): string | null {
|
|
16
|
+
export function oldestPeriod(dates: readonly string[]): string | null {
|
|
12
17
|
return dates.filter((date) => /^\d{4}-\d{2}-\d{2}/.test(date)).map((date) => date.slice(0, 10)).sort()[0] ?? null;
|
|
13
18
|
}
|
|
14
19
|
|
|
15
20
|
/**
|
|
16
21
|
* The closing lines of a statements report that say how far back it goes, from
|
|
17
22
|
* the oldest period it served: the report holds no older ones. `older` says
|
|
18
|
-
* whether
|
|
19
|
-
*
|
|
20
|
-
* when it does not, the listing has no older ones at all (IAG on LSE: its
|
|
21
|
-
* statements start in 2022, in GF too). Null when that could not be told in
|
|
22
|
-
* time: the report then says nothing of older periods. Empty too when no
|
|
23
|
-
* period has a date, so a report with nothing in it says nothing.
|
|
23
|
+
* whether the linked GF revenue series goes further back. Null when that
|
|
24
|
+
* could not be checked, or when no period has a date.
|
|
24
25
|
*/
|
|
25
26
|
export function statementHistoryNotes(
|
|
26
27
|
period: "annual" | "quarterly",
|
|
@@ -31,44 +32,14 @@ export function statementHistoryNotes(
|
|
|
31
32
|
const oldest = oldestPeriod(dates);
|
|
32
33
|
if (!oldest || older === null) return [];
|
|
33
34
|
const [from, unit] = period === "annual" ? [oldest.slice(0, 4), "years"] : [oldest, "quarters"];
|
|
34
|
-
if (older === false) return [`${period} history from ${from};
|
|
35
|
+
if (older === false) return [`${period} history from ${from}; no earlier revenue in GF's latest ${HISTORY_LINK_PERIODS} periods`];
|
|
35
36
|
return [
|
|
36
37
|
`${period} history from ${from}; older ${unit} not served`,
|
|
37
|
-
|
|
38
|
+
`earlier revenue: gloom fn GF ${symbol} --period ${period} --periods ${HISTORY_LINK_PERIODS}`,
|
|
38
39
|
];
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
* How long a statements report waits on the extended history for its
|
|
43
|
-
* older-periods note, as a lock note waits on its routes' checks: a read still
|
|
44
|
-
* out then leaves the report on time, without the note. The read goes on and
|
|
45
|
-
* warms the cache for the next report.
|
|
46
|
-
*/
|
|
47
|
-
const OLDER_STATEMENTS_WAIT_MS = 3_000;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Whether the listing's extended statement history, which `GF` reads, has a
|
|
51
|
-
* period older than the oldest of `dates`, a report's columns: a US filer's
|
|
52
|
-
* filings reach years back; a listing abroad has nothing past what the report
|
|
53
|
-
* served. Null when the history could not be read within `waitMs`.
|
|
54
|
-
*/
|
|
55
|
-
export async function hasOlderStatements(
|
|
56
|
-
loadExtended: () => Promise<Pick<TickerFinancials, "annualStatements" | "quarterlyStatements">>,
|
|
57
|
-
period: "annual" | "quarterly",
|
|
58
|
-
dates: readonly string[],
|
|
59
|
-
waitMs = OLDER_STATEMENTS_WAIT_MS,
|
|
60
|
-
): Promise<boolean | null> {
|
|
61
|
-
const oldest = oldestPeriod(dates);
|
|
62
|
-
if (!oldest) return null;
|
|
63
|
-
const read = Promise.resolve().then(loadExtended).catch((error: unknown) => {
|
|
64
|
-
logFailure("utils.financial-statements", "Reading the extended statement history failed")(error);
|
|
65
|
-
throw error;
|
|
66
|
-
});
|
|
67
|
-
const extended = await settleWithin(read, waitMs);
|
|
68
|
-
if (!extended) return null;
|
|
69
|
-
const rows = period === "annual" ? extended.annualStatements : extended.quarterlyStatements;
|
|
70
|
-
return rows.some((row) => /^\d{4}-\d{2}-\d{2}/.test(row.date) && row.date.slice(0, 10) < oldest);
|
|
71
|
-
}
|
|
42
|
+
export const HISTORY_LINK_PERIODS = 40;
|
|
72
43
|
|
|
73
44
|
/** Venues whose companies report half-yearly and yearly, with no quarterly statements: Australia's (ASX, and Cboe Australia, which trades ASX companies) and New Zealand's. */
|
|
74
45
|
const HALF_YEARLY_VENUES = new Set(["ASX", "CXA", "NZX"]);
|
|
@@ -202,9 +173,10 @@ type FilledRow = Pick<FinancialStatement, "date" | "filledFrom"> & { aggregation
|
|
|
202
173
|
|
|
203
174
|
/** How a filled row is dated: ASX's read, its own results' first publication, or the later period's whose comparative it is. */
|
|
204
175
|
export interface FillDate {
|
|
205
|
-
label: "read" | "published" | "comparative";
|
|
176
|
+
label: "read" | "published" | "catalogue" | "comparative" | "first observed";
|
|
206
177
|
/** YYYY-MM-DD; null for a comparative whose later period's first announcement is not known. */
|
|
207
178
|
date: string | null;
|
|
179
|
+
catalogueSource?: "issuer";
|
|
208
180
|
}
|
|
209
181
|
|
|
210
182
|
/** The same day a year on. */
|
|
@@ -231,7 +203,20 @@ export function fillDate(row: FilledRow, rows: readonly FilledRow[] = []): FillD
|
|
|
231
203
|
if (fill.source === "asx") return { label: "read", date: fill.retrievedAt.slice(0, 10) };
|
|
232
204
|
if (fill.fields.length === 0) return null;
|
|
233
205
|
const periodEnd = (row.aggregation?.periodEnd ?? row.date).slice(0, 10);
|
|
234
|
-
const
|
|
206
|
+
const observed = fill.documents.filter((document) => document.firstObserved);
|
|
207
|
+
if (observed.length) {
|
|
208
|
+
return { label: "first observed", date: observed.map((document) => document.publishedAt.slice(0, 10)).sort().at(-1) ?? null };
|
|
209
|
+
}
|
|
210
|
+
const idx = fill.documents.some((document) => document.source === "idx");
|
|
211
|
+
// An IDX quarter can cite the YTD figure subtracted from its own report.
|
|
212
|
+
// Only the reports supplying the current lines can date the result.
|
|
213
|
+
const contributors = idx
|
|
214
|
+
? Object.values(fill.lines).flatMap((line) => fill.documents[line.document] ?? [])
|
|
215
|
+
: fill.documents;
|
|
216
|
+
const docs = (contributors.length ? contributors : fill.documents)
|
|
217
|
+
.map((document) => ({ date: document.publishedAt.slice(0, 10), catalogue: document.dateBasis === "catalogue" }))
|
|
218
|
+
.sort((a, b) => a.date.localeCompare(b.date) || Number(a.catalogue) - Number(b.catalogue));
|
|
219
|
+
const dates = docs.map(({ date }) => date);
|
|
235
220
|
// A quarter's announcement also gives the quarter before: the next period is the list's next row where it
|
|
236
221
|
// has one before the same period a year on. A quarter derived from two years to date ends with the later
|
|
237
222
|
// one, which its own announcement gives, however late it came out.
|
|
@@ -240,6 +225,9 @@ export function fillDate(row: FilledRow, rows: readonly FilledRow[] = []): FillD
|
|
|
240
225
|
.filter((end) => /^\d{4}-\d{2}-\d{2}$/.test(end) && end > periodEnd && !areNearbyFinancialPeriodEnds(end, periodEnd))
|
|
241
226
|
.sort()[0];
|
|
242
227
|
const later = next && next < yearOn && !(fill.source === "results" && fill.derived) ? next : yearOn;
|
|
228
|
+
const currentDoc = docs.find(({ date }) => date >= periodEnd && date <= later)
|
|
229
|
+
?? docs.find(({ date }) => date >= periodEnd);
|
|
230
|
+
if (currentDoc?.catalogue) return { label: "catalogue", date: currentDoc.date, ...(!idx ? { catalogueSource: "issuer" } : {}) };
|
|
243
231
|
const own = dates.find((date) => date >= periodEnd && date <= later);
|
|
244
232
|
if (own || row.aggregation || dates.length === 0 || !dates.every((date) => date > later)) {
|
|
245
233
|
return { label: "published", date: own ?? dates.find((date) => date >= periodEnd) ?? dates[0] ?? null };
|
|
@@ -260,7 +248,9 @@ export function fillDate(row: FilledRow, rows: readonly FilledRow[] = []): FillD
|
|
|
260
248
|
|
|
261
249
|
/** How a filled column's date reads: "announced 2026-08-20", "comparative in the 2026-08-20 announcement". */
|
|
262
250
|
export function fillDateText(date: FillDate): string {
|
|
251
|
+
if (date.label === "first observed") return `first observed ${date.date}`;
|
|
263
252
|
if (date.label === "read") return `read ${date.date}`;
|
|
253
|
+
if (date.label === "catalogue") return `${date.catalogueSource === "issuer" ? "Issuer" : "IDX"} catalogue date ${date.date}`;
|
|
264
254
|
if (date.label === "published") return `announced ${date.date}`;
|
|
265
255
|
return date.date ? `comparative in the ${date.date} announcement` : "comparative in a later announcement";
|
|
266
256
|
}
|
|
@@ -268,7 +258,11 @@ export function fillDateText(date: FillDate): string {
|
|
|
268
258
|
/** A table's filled periods with the lines it shows, newest first; a TTM row's end is that of the period it runs to. */
|
|
269
259
|
function filledPeriods(statements: readonly FilledRow[], shown?: ReadonlySet<string>) {
|
|
270
260
|
return statements.flatMap(({ date, filledFrom, aggregation }) => {
|
|
271
|
-
const source = filledFrom &&
|
|
261
|
+
const source = filledFrom?.source === "results" && filledFrom.documents.some((document) => document.source === "idx")
|
|
262
|
+
? "Indonesia Stock Exchange filings"
|
|
263
|
+
: filledFrom?.source === "results" && filledFrom.documents.some((document) => document.source === "ir" && document.dateBasis === "catalogue")
|
|
264
|
+
? "issuer financial statements"
|
|
265
|
+
: filledFrom && FILL_SOURCES[filledFrom.source];
|
|
272
266
|
const fields = [...new Set((filledFrom?.fields ?? [])
|
|
273
267
|
.filter((field) => FILL_FIELDS[field] && (!shown || shown.has(field)))
|
|
274
268
|
.map((field) => FILL_FIELDS[field]))];
|
|
@@ -320,7 +314,7 @@ export function filledPeriodsNote(
|
|
|
320
314
|
// Each announcement dates its own periods: "TTM revenue; 2025-12-31 revenue (published 2026-03-25)", and
|
|
321
315
|
// a comparative column the later period's: "2025-06-30 revenue (comparative in the 2026-08-20 announcement)".
|
|
322
316
|
if (filled.every(({ stamp }) => stamp.label !== "read")) {
|
|
323
|
-
const stampText = (
|
|
317
|
+
const stampText = (stamp: FillDate) => (stamp.label === "published" ? `published ${stamp.date}` : fillDateText(stamp));
|
|
324
318
|
const stamps = [...new Set(filled.map(({ stamp }) => stampText(stamp)))];
|
|
325
319
|
const lines = (text: string) => filled.filter(({ stamp }) => stampText(stamp) === text).map(({ period, fields }) => `${period} ${fields.join(", ")}`).join("; ");
|
|
326
320
|
note = `From ${sources.join(" and ")}: ${stamps.map((text) => `${lines(text)} (${text})`).join("; ")}.`;
|
package/src/utils/format.ts
CHANGED
|
@@ -15,15 +15,19 @@ export function currencyPriceDigits(currency: string | undefined): 2 | 3 {
|
|
|
15
15
|
return currency != null && THREE_DECIMAL_CURRENCIES.has(currency.trim().toUpperCase()) ? 3 : 2;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
function getCurrencyFormatter(
|
|
19
|
-
|
|
18
|
+
function getCurrencyFormatter(
|
|
19
|
+
currency: string,
|
|
20
|
+
maximumFractionDigits: number = currencyPriceDigits(currency),
|
|
21
|
+
// Whole units (0) drop the cents rather than throw.
|
|
22
|
+
minimumFractionDigits: number = Math.min(currencyPriceDigits(currency), maximumFractionDigits),
|
|
23
|
+
): Intl.NumberFormat {
|
|
24
|
+
const key = `${currency}:${maximumFractionDigits}:${minimumFractionDigits}`;
|
|
20
25
|
let formatter = currencyFormatters.get(key);
|
|
21
26
|
if (!formatter) {
|
|
22
27
|
const options = {
|
|
23
28
|
style: "currency" as const,
|
|
24
29
|
currency,
|
|
25
|
-
|
|
26
|
-
minimumFractionDigits: Math.min(currencyPriceDigits(currency), maximumFractionDigits),
|
|
30
|
+
minimumFractionDigits,
|
|
27
31
|
maximumFractionDigits,
|
|
28
32
|
};
|
|
29
33
|
formatter = new Intl.NumberFormat("en-US", options);
|
|
@@ -53,21 +57,21 @@ function getNumberFormatter(decimals: number): Intl.NumberFormat {
|
|
|
53
57
|
* stablecoin perpetual venues quote in) reads as the code before the amount,
|
|
54
58
|
* as a price in it does: USDT101.70.
|
|
55
59
|
*/
|
|
56
|
-
function formatMoney(value: number, currency: string, maximumFractionDigits: number): string {
|
|
60
|
+
function formatMoney(value: number, currency: string, maximumFractionDigits: number, minimumFractionDigits?: number): string {
|
|
57
61
|
// A minor unit is written after the amount: 314.95¢ in US cents, 412.50p in pence.
|
|
58
62
|
const minor = minorUnitSign(currency);
|
|
59
63
|
if (minor) {
|
|
60
64
|
const body = new Intl.NumberFormat("en-US", {
|
|
61
|
-
minimumFractionDigits: Math.min(2, maximumFractionDigits),
|
|
65
|
+
minimumFractionDigits: minimumFractionDigits ?? Math.min(2, maximumFractionDigits),
|
|
62
66
|
maximumFractionDigits,
|
|
63
67
|
}).format(Math.abs(value));
|
|
64
68
|
return `${value < 0 && /[1-9]/.test(body) ? "-" : ""}${body}${minor}`;
|
|
65
69
|
}
|
|
66
70
|
try {
|
|
67
|
-
return getCurrencyFormatter(currency, maximumFractionDigits).format(value).replace(BIDI_MARKS, "");
|
|
71
|
+
return getCurrencyFormatter(currency, maximumFractionDigits, minimumFractionDigits).format(value).replace(BIDI_MARKS, "");
|
|
68
72
|
} catch {
|
|
69
73
|
const body = new Intl.NumberFormat("en-US", {
|
|
70
|
-
minimumFractionDigits: Math.min(currencyPriceDigits(currency), maximumFractionDigits),
|
|
74
|
+
minimumFractionDigits: minimumFractionDigits ?? Math.min(currencyPriceDigits(currency), maximumFractionDigits),
|
|
71
75
|
maximumFractionDigits,
|
|
72
76
|
}).format(Math.abs(value));
|
|
73
77
|
return `${value < 0 && /[1-9]/.test(body) ? "-" : ""}${currency.trim().toUpperCase()}${body}`;
|
|
@@ -116,10 +120,33 @@ function distributionAmountDigits(currency = "USD"): number {
|
|
|
116
120
|
return minorUnitSign(currency) ? 4 : currencyPriceDigits(currency) + 4;
|
|
117
121
|
}
|
|
118
122
|
|
|
119
|
-
/**
|
|
120
|
-
|
|
123
|
+
/**
|
|
124
|
+
* A per-share distribution to distributionAmountDigits, its currency's usual
|
|
125
|
+
* decimals at least; with `digits` (distributionAmountsDigits), to exactly
|
|
126
|
+
* that many, so a column of them reads alike.
|
|
127
|
+
*/
|
|
128
|
+
export function formatDistributionAmount(value: number | undefined, currency = "USD", digits?: number): string {
|
|
121
129
|
if (value == null || !Number.isFinite(value)) return MISSING_VALUE;
|
|
122
|
-
return
|
|
130
|
+
return digits == null
|
|
131
|
+
? formatMoney(value, currency, distributionAmountDigits(currency))
|
|
132
|
+
: formatMoney(value, currency, digits, digits);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* The decimals per-share distributions shown together share: as many as the
|
|
137
|
+
* finest of them needs, distributionAmountDigits at most, and the currency's
|
|
138
|
+
* usual decimals at least. Haier's CN¥0.89151 beside its CN¥0.2692 makes five
|
|
139
|
+
* (0.89151 over 0.26920), and KO's $0.485 beside $0.51 three ($0.485, $0.510).
|
|
140
|
+
*/
|
|
141
|
+
export function distributionAmountsDigits(values: readonly number[], currency = "USD"): number {
|
|
142
|
+
const most = distributionAmountDigits(currency);
|
|
143
|
+
let digits = Math.min(minorUnitSign(currency) ? 2 : currencyPriceDigits(currency), most);
|
|
144
|
+
for (const value of values) {
|
|
145
|
+
if (!Number.isFinite(value)) continue;
|
|
146
|
+
const finest = Number(value.toFixed(most));
|
|
147
|
+
while (digits < most && Number(value.toFixed(digits)) !== finest) digits += 1;
|
|
148
|
+
}
|
|
149
|
+
return digits;
|
|
123
150
|
}
|
|
124
151
|
|
|
125
152
|
/** Signs a fixed-decimal move; one that rounds to zero is unsigned (0.00, never +0.00 or -0.00). */
|
|
@@ -267,7 +294,7 @@ export function formatSignificant(value: number | undefined, digits = 4): string
|
|
|
267
294
|
}
|
|
268
295
|
|
|
269
296
|
/** The decimals `formatSignificant` writes a value to: 0.8904 has 4, 1.123 has 3, 0 none. */
|
|
270
|
-
|
|
297
|
+
function significantDecimals(value: number, digits = 4): number {
|
|
271
298
|
if (value === 0 || !Number.isFinite(value)) return 0;
|
|
272
299
|
const rounded = Number(value.toPrecision(digits));
|
|
273
300
|
return Math.min(12, Math.max(0, digits - 1 - Math.floor(Math.log10(Math.abs(rounded)))));
|
|
@@ -58,7 +58,8 @@ function statedDeclaration(exDate: string, options: DeclaredBasisOptions): { amo
|
|
|
58
58
|
* ahead, `annualized from the declared $0.98 payable 2026-12-10, ex
|
|
59
59
|
* 2026-11-19`, the amount and pay date when they are stated; the basis alone
|
|
60
60
|
* when the date is unknown. `payDate` is the pay date a source states beside
|
|
61
|
-
* that ex-date without a declared row (DVD's summary).
|
|
61
|
+
* that ex-date without a declared row (DVD's summary). Its days are ISO, as
|
|
62
|
+
* exports keep them; DVD's pane and text draw them day first.
|
|
62
63
|
*/
|
|
63
64
|
export function forwardDividendBasis(
|
|
64
65
|
asOf: string | Date | null | undefined,
|
|
@@ -489,6 +489,7 @@ export function ttmAtAppRate<T extends Fundamentals>(fundamentals: T, rate: AppF
|
|
|
489
489
|
const factor = rate.rate / conversion.rate;
|
|
490
490
|
const shown: T = { ...fundamentals };
|
|
491
491
|
for (const key of TTM_AMOUNTS) {
|
|
492
|
+
if (key === "freeCashFlow" && fundamentals.freeCashFlowCurrency !== undefined && fundamentals.freeCashFlowCurrency !== fundamentals.financialCurrency) continue;
|
|
492
493
|
const value = fundamentals[key];
|
|
493
494
|
if (finiteNumber(value)) (shown as Fundamentals)[key] = Math.round(value * factor);
|
|
494
495
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { lastPerfSample, recordPerfSample, takeHeldPerfSample, takePersonWaitMs, withoutLastStep } from "./perf-marks";
|
|
2
|
+
import { processActivityDelta, type ProcessActivityDelta, type ProcessActivityReading } from "./stall-process-activity";
|
|
2
3
|
|
|
3
4
|
/** How often the monitor checks in. Short enough to date a stall precisely. */
|
|
4
5
|
const SAMPLE_INTERVAL_MS = 250;
|
|
@@ -29,6 +30,7 @@ export interface StallClockReading {
|
|
|
29
30
|
threadCpuMs: number | null;
|
|
30
31
|
/** CPU time the whole process has used, every thread together. */
|
|
31
32
|
processCpuMs: number | null;
|
|
33
|
+
processActivity?: ProcessActivityReading;
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
export interface StallEvent {
|
|
@@ -61,6 +63,8 @@ export interface StallEvent {
|
|
|
61
63
|
threadCpu?: number;
|
|
62
64
|
/** CPU the process's other threads used meanwhile, in cores (1: one core throughout). */
|
|
63
65
|
otherCpu?: number;
|
|
66
|
+
/** Windows process-wide counts over the sampling interval, not attribution to the stalled thread. */
|
|
67
|
+
processActivity?: ProcessActivityDelta;
|
|
64
68
|
}
|
|
65
69
|
|
|
66
70
|
let stallSink: ((event: StallEvent) => void) | null = null;
|
|
@@ -102,7 +106,9 @@ function readStallClocks(read: (() => StallClockReading) | null): StallClockRead
|
|
|
102
106
|
}
|
|
103
107
|
|
|
104
108
|
function delta(after: number | null | undefined, before: number | null | undefined): number | null {
|
|
105
|
-
|
|
109
|
+
if (after == null || before == null) return null;
|
|
110
|
+
const elapsed = after - before;
|
|
111
|
+
return elapsed >= 0 && Number.isFinite(elapsed) ? elapsed : null;
|
|
106
112
|
}
|
|
107
113
|
|
|
108
114
|
/**
|
|
@@ -208,6 +214,7 @@ export function startMainThreadStallMonitor(
|
|
|
208
214
|
const sqlite = sample?.name === "sqlite.blocked" ? sqliteDetail(sample.metadata) : undefined;
|
|
209
215
|
const threadCpuMs = delta(currentClocks?.threadCpuMs, before?.threadCpuMs);
|
|
210
216
|
const processCpuMs = delta(currentClocks?.processCpuMs, before?.processCpuMs);
|
|
217
|
+
const activity = processActivityDelta(before === null ? null : before?.processActivity, currentClocks === null ? null : currentClocks?.processActivity);
|
|
211
218
|
report(blockedMs, {
|
|
212
219
|
...(sample
|
|
213
220
|
? { lastMeasured: sample.name, lastMeasuredEndedMsAgo: Math.round(current - sample.endedAt) }
|
|
@@ -220,6 +227,7 @@ export function startMainThreadStallMonitor(
|
|
|
220
227
|
...(threadCpuMs == null || processCpuMs == null
|
|
221
228
|
? {}
|
|
222
229
|
: { otherCpu: Math.max(0, (processCpuMs - threadCpuMs) / (elapsedMs - asleepMs)) }),
|
|
230
|
+
...(activity ? { processActivity: activity } : {}),
|
|
223
231
|
});
|
|
224
232
|
}, intervalMs);
|
|
225
233
|
if (handle && typeof (handle as { unref?: () => void }).unref === "function") {
|
|
@@ -1,9 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
export interface RpcClockSample {
|
|
2
|
+
wallMs: number;
|
|
3
|
+
elapsedMs: number;
|
|
4
|
+
awakeMs: number;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const RPC_CLOCK_FRESHNESS_MS = 1_000;
|
|
8
|
+
const CLOCK_SLOP_MS = 100;
|
|
9
|
+
const MIN_SLEEP_MS = 5_000;
|
|
10
|
+
|
|
11
|
+
/** A conservative upper bound on the request's awake time, only when the clocks also show sleep. */
|
|
12
|
+
export function rpcAwakeTimeBound(
|
|
13
|
+
startedAt: number,
|
|
14
|
+
timedOutAt: number,
|
|
15
|
+
before: RpcClockSample | null,
|
|
16
|
+
after: RpcClockSample | null,
|
|
17
|
+
): number | null {
|
|
18
|
+
if (!before || !after || ![startedAt, timedOutAt, before.wallMs, after.wallMs, before.elapsedMs, after.elapsedMs, before.awakeMs, after.awakeMs].every(Number.isFinite)) return null;
|
|
19
|
+
if (timedOutAt <= startedAt || Math.abs(before.wallMs - startedAt) > RPC_CLOCK_FRESHNESS_MS
|
|
20
|
+
|| after.wallMs < timedOutAt || after.wallMs - timedOutAt > RPC_CLOCK_FRESHNESS_MS) return null;
|
|
21
|
+
if (before.awakeMs < 0 || before.elapsedMs < 0) return null;
|
|
22
|
+
const elapsed = after.elapsedMs - before.elapsedMs;
|
|
23
|
+
const awake = after.awakeMs - before.awakeMs;
|
|
24
|
+
if (elapsed <= 0 || awake < 0 || Math.abs(elapsed - (after.wallMs - before.wallMs)) > CLOCK_SLOP_MS) return null;
|
|
25
|
+
const outsideRequest = Math.max(0, startedAt - before.wallMs) + after.wallMs - timedOutAt;
|
|
26
|
+
if (elapsed - awake - outsideRequest - CLOCK_SLOP_MS < MIN_SLEEP_MS) return null;
|
|
27
|
+
return awake + Math.max(0, before.wallMs - startedAt) + CLOCK_SLOP_MS;
|
|
28
|
+
}
|
|
7
29
|
|
|
8
30
|
/** What a desktop pane says when the app's background process did not answer its request in time. */
|
|
9
31
|
export const REQUEST_TIMED_OUT_MESSAGE = "Request timed out";
|
|
@@ -23,23 +45,26 @@ export class RpcTimeoutError extends Error {
|
|
|
23
45
|
readonly elapsedMs: number;
|
|
24
46
|
readonly limitMs: number;
|
|
25
47
|
readonly report: string;
|
|
48
|
+
readonly awakeUpperBoundMs: number | null;
|
|
26
49
|
|
|
27
50
|
constructor(
|
|
28
51
|
message: string,
|
|
29
|
-
{ elapsedMs, limitMs, report, cause
|
|
52
|
+
{ elapsedMs, limitMs, report, cause, awakeUpperBoundMs = null }: {
|
|
53
|
+
elapsedMs: number; limitMs: number; report: string; cause?: unknown; awakeUpperBoundMs?: number | null;
|
|
54
|
+
},
|
|
30
55
|
) {
|
|
31
56
|
super(message, cause === undefined ? undefined : { cause });
|
|
32
57
|
this.elapsedMs = elapsedMs;
|
|
33
58
|
this.limitMs = limitMs;
|
|
34
59
|
this.report = report;
|
|
60
|
+
this.awakeUpperBoundMs = awakeUpperBoundMs;
|
|
35
61
|
}
|
|
36
62
|
}
|
|
37
63
|
|
|
38
64
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* process already lost. Nothing the user did failed, so it is not a crash.
|
|
65
|
+
* Suppress only when sleep is measured and the request did not have its full
|
|
66
|
+
* awake budget. Timer lateness alone also happens during a real awake stall.
|
|
42
67
|
*/
|
|
43
68
|
export function isSleepRpcTimeout(error: unknown): boolean {
|
|
44
|
-
return error instanceof RpcTimeoutError && error.
|
|
69
|
+
return error instanceof RpcTimeoutError && error.awakeUpperBoundMs !== null && error.awakeUpperBoundMs < error.limitMs;
|
|
45
70
|
}
|
package/src/utils/sec.ts
CHANGED
|
@@ -112,7 +112,9 @@ export function isKnownNonUsEquityTicker(ticker: TickerRecord | null | undefined
|
|
|
112
112
|
* destination or no venue at all, which look the symbol up as a US ticker.
|
|
113
113
|
*/
|
|
114
114
|
export function nonUsSecListingVenue(ticker: string, exchange?: string): string | null {
|
|
115
|
-
const
|
|
115
|
+
const listing = parsePublicTickerKey(ticker);
|
|
116
|
+
const venue = listing.exchange ?? (canonicalExchange(exchange)
|
|
117
|
+
|| (/^[A-Z0-9][A-Z0-9-]{0,11}\.PS$/i.test(listing.symbol) ? "XPHS" : ""));
|
|
116
118
|
if (!venue || ROUTING_EXCHANGES.has(venue) || isUsEquityExchange(venue)) return null;
|
|
117
119
|
return venue;
|
|
118
120
|
}
|
|
@@ -363,7 +363,7 @@ export function withShareMultiples<T extends EpsInputs>(financials: T): T {
|
|
|
363
363
|
const fundamentals = financials.fundamentals;
|
|
364
364
|
if (!fundamentals) return financials;
|
|
365
365
|
const share = notTheShare(financials);
|
|
366
|
-
const reason = share ?? noRateForEps(financials) ?? epsAgainstIncome(financials);
|
|
366
|
+
const reason = share ?? (fundamentals.scopedEarnings === undefined ? noRateForEps(financials) ?? epsAgainstIncome(financials) : undefined);
|
|
367
367
|
// A multiple an earlier pass withdrew is one the block had.
|
|
368
368
|
const had = fundamentals.notMeaningful ?? {};
|
|
369
369
|
const has: Record<keyof Withdrawn, boolean> = {
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
const IO_COUNTERS = ["readOps", "writeOps", "otherOps", "readBytes", "writeBytes", "otherBytes"] as const;
|
|
2
|
+
|
|
3
|
+
type IoCounter = typeof IO_COUNTERS[number];
|
|
4
|
+
type CounterStatus = "unavailable" | "failed" | "reset";
|
|
5
|
+
type CounterReading<T> = T | null | undefined;
|
|
6
|
+
|
|
7
|
+
export interface ProcessActivityReading {
|
|
8
|
+
pageFaults: CounterReading<bigint>;
|
|
9
|
+
io: CounterReading<ReadonlyArray<bigint>>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface ProcessActivityDelta {
|
|
13
|
+
pageFaults: number | CounterStatus;
|
|
14
|
+
io: Record<IoCounter, number> | CounterStatus;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function pageFaultDelta(before: CounterReading<bigint>, after: CounterReading<bigint>): number | CounterStatus {
|
|
18
|
+
if (before === null || after === null) return "failed";
|
|
19
|
+
if (before === undefined || after === undefined) return "unavailable";
|
|
20
|
+
return difference(before, after);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function difference(before: bigint, after: bigint): number | "reset" {
|
|
24
|
+
return after < before ? "reset" : Math.min(Number.MAX_SAFE_INTEGER, Number(after - before));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function processActivityDelta(
|
|
28
|
+
before: ProcessActivityReading | null | undefined,
|
|
29
|
+
after: ProcessActivityReading | null | undefined,
|
|
30
|
+
): ProcessActivityDelta | undefined {
|
|
31
|
+
if (!before && !after) return undefined;
|
|
32
|
+
const beforeIo = before === null ? null : before?.io;
|
|
33
|
+
const afterIo = after === null ? null : after?.io;
|
|
34
|
+
let io: ProcessActivityDelta["io"];
|
|
35
|
+
if (beforeIo === null || afterIo === null) io = "failed";
|
|
36
|
+
else if (!beforeIo || !afterIo) io = "unavailable";
|
|
37
|
+
else {
|
|
38
|
+
const counts = {} as Record<IoCounter, number>;
|
|
39
|
+
io = counts;
|
|
40
|
+
for (const [index, counter] of IO_COUNTERS.entries()) {
|
|
41
|
+
const count = difference(beforeIo[index]!, afterIo[index]!);
|
|
42
|
+
if (count === "reset") {
|
|
43
|
+
io = count;
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
counts[counter] = count;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
pageFaults: pageFaultDelta(before === null ? null : before?.pageFaults, after === null ? null : after?.pageFaults),
|
|
51
|
+
io,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function formatProcessActivity(activity: ProcessActivityDelta): string[] {
|
|
56
|
+
const { io } = activity;
|
|
57
|
+
return [
|
|
58
|
+
`pageFaults=${activity.pageFaults}`,
|
|
59
|
+
...(typeof io === "string" ? [`io=${io}`] : IO_COUNTERS.map((counter) => `${counter}=${io[counter]}`)),
|
|
60
|
+
];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Compact, fixed-order counters for the crash reporter's bounded details field. */
|
|
64
|
+
export function formatProcessActivitySummary({ pageFaults, io }: ProcessActivityDelta): string[] {
|
|
65
|
+
const bucket = (value: number | CounterStatus): string => {
|
|
66
|
+
if (typeof value !== "number") return value === "unavailable" ? "na" : value === "failed" ? "err" : "reset";
|
|
67
|
+
return value < 100 ? String(value) : `e${Math.floor(Math.log10(value))}`;
|
|
68
|
+
};
|
|
69
|
+
return [`pf=${bucket(pageFaults)}`, `io=${typeof io === "string" ? bucket(io) : IO_COUNTERS.map((counter) => bucket(io[counter])).join("/")}`];
|
|
70
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { FinancialStatement, Fundamentals, Quote, StatementScope, TickerFinancials } from "../types/financials";
|
|
2
|
+
import { completeAvailability, financialAvailabilityTime, statementFieldAvailability, statementPeriodMonths } from "./financial-statements";
|
|
3
|
+
import { reportedEarnings } from "./trailing-eps";
|
|
4
|
+
|
|
5
|
+
export function listingOwnsRow(scope: StatementScope | undefined, row: FinancialStatement): boolean {
|
|
6
|
+
if (!scope) return !row.statementScope;
|
|
7
|
+
return scope.basis === "standalone" && !!scope.entity && row.statementScope?.basis === "standalone"
|
|
8
|
+
&& row.statementScope.entity === scope.entity && row.statementScope.registrant === scope.registrant;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function listingOwnsSeries(data: Pick<TickerFinancials, "statementScope" | "quarterlyStatements" | "annualStatements">): boolean {
|
|
12
|
+
const owned = (row: FinancialStatement) => listingOwnsRow(data.statementScope, row);
|
|
13
|
+
return (!data.statementScope || data.statementScope.basis === "standalone")
|
|
14
|
+
&& data.annualStatements.every(owned) && data.quarterlyStatements.every(owned);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
type ScopedEarnings = NonNullable<Fundamentals["scopedEarnings"]>;
|
|
18
|
+
|
|
19
|
+
const DAY_MS = 86_400_000;
|
|
20
|
+
|
|
21
|
+
function spansDays(start: string, end: string, min: number, max: number): boolean {
|
|
22
|
+
const days = (Date.parse(end) - Date.parse(start)) / DAY_MS + 1;
|
|
23
|
+
return days >= min && days <= max;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function completeQuarterWindow(rows: FinancialStatement[], end: string): boolean {
|
|
27
|
+
if (rows.length !== 4 || rows[3]!.date !== end) return false;
|
|
28
|
+
const firstStart = rows[0]!.dateEvidence?.startDate;
|
|
29
|
+
return (firstStart === undefined || spansDays(firstStart, end, 350, 380)) && rows.every((row, index) => {
|
|
30
|
+
if (row.shareBasis !== rows[0]!.shareBasis || (statementPeriodMonths(row) ?? 3) !== 3) return false;
|
|
31
|
+
const start = row.dateEvidence?.startDate;
|
|
32
|
+
if (start !== undefined && !spansDays(start, row.date, 77, 105)) return false;
|
|
33
|
+
if (index === 0) return true;
|
|
34
|
+
const previousEnd = Date.parse(rows[index - 1]!.date);
|
|
35
|
+
const days = (Date.parse(row.date) - previousEnd) / DAY_MS;
|
|
36
|
+
return days >= 77 && days <= 105 && (start === undefined || Date.parse(start) === previousEnd + DAY_MS);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function sumFiledDecimals(values: number[]): number {
|
|
41
|
+
if (values.length === 1) return values[0]!;
|
|
42
|
+
const terms = values.map(value => {
|
|
43
|
+
const [digits, exponent] = value.toExponential().split("e");
|
|
44
|
+
const places = digits!.split(".")[1]?.length ?? 0;
|
|
45
|
+
return { units: BigInt(digits!.replace(".", "")), power: Number(exponent) - places };
|
|
46
|
+
});
|
|
47
|
+
const power = Math.min(...terms.map(term => term.power));
|
|
48
|
+
const units = terms.reduce((sum, term) => sum + term.units * 10n ** BigInt(term.power - power), 0n);
|
|
49
|
+
return Number(`${units}e${power}`);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function dateScopedEarnings(data: Pick<TickerFinancials, "statementScope" | "statementReview" | "annualStatements" | "quarterlyStatements">,
|
|
53
|
+
earnings: Omit<ScopedEarnings, "epsAvailableAt"> | null | undefined): ScopedEarnings | null {
|
|
54
|
+
const reviewedThrough = data.statementReview?.reviewedThrough;
|
|
55
|
+
if (data.statementScope?.basis !== "standalone" || !earnings || !Number.isFinite(earnings.eps) || !/^[A-Z]{3}$/.test(earnings.currency)
|
|
56
|
+
|| !reviewedThrough || !listingOwnsSeries(data)) return null;
|
|
57
|
+
const { eps, currency, periodEnd, priced } = earnings;
|
|
58
|
+
const quarters = data.quarterlyStatements.filter(row => row.date <= periodEnd)
|
|
59
|
+
.sort((first, second) => first.date.localeCompare(second.date)).slice(-4);
|
|
60
|
+
const candidates = data.annualStatements.filter(row => row.date === periodEnd
|
|
61
|
+
&& (row.dateEvidence?.startDate === undefined || spansDays(row.dateEvidence.startDate, periodEnd, 350, 380))).map(row => [row]);
|
|
62
|
+
if (completeQuarterWindow(quarters, periodEnd)) candidates.push(quarters);
|
|
63
|
+
const admittedTotals = new Set([eps]);
|
|
64
|
+
const totals = candidates.flatMap(rows => {
|
|
65
|
+
if (!rows.every(row => row.currency === currency && reportedEarnings(row, "eps") !== null)) return [];
|
|
66
|
+
const values = rows.map(row => row.eps!);
|
|
67
|
+
const total = sumFiledDecimals(values);
|
|
68
|
+
if (!Number.isFinite(total)) return [];
|
|
69
|
+
const roundoff = values.length * values.reduce((bound, value) => bound + Number.EPSILON * Math.abs(value), 0);
|
|
70
|
+
if (values.reduce((sum, value) => sum + value, 0) === eps && Math.abs(total - eps) <= roundoff) admittedTotals.add(total);
|
|
71
|
+
return [{ rows, total }];
|
|
72
|
+
});
|
|
73
|
+
const matchingInputs = totals.filter(({ total }) => admittedTotals.has(total)).flatMap(({ rows }) => rows);
|
|
74
|
+
const epsAvailableAt = completeAvailability(matchingInputs.map(row => {
|
|
75
|
+
const available = statementFieldAvailability(row, "eps");
|
|
76
|
+
return available && Date.parse(available) >= Date.parse(row.date) ? available : undefined;
|
|
77
|
+
}));
|
|
78
|
+
return epsAvailableAt && Date.parse(epsAvailableAt) >= Date.parse(periodEnd) && financialAvailabilityTime(epsAvailableAt) <= financialAvailabilityTime(reviewedThrough)
|
|
79
|
+
? { eps, currency, periodEnd, epsAvailableAt, priced }
|
|
80
|
+
: null;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function captureScopedEarnings(data: TickerFinancials): TickerFinancials {
|
|
84
|
+
if (!data.statementScope || !data.fundamentals) return data;
|
|
85
|
+
const { eps, epsCurrency, trailingPeriodEnd, trailingPE } = data.fundamentals;
|
|
86
|
+
const scopedEarnings = typeof eps === "number" && epsCurrency && trailingPeriodEnd ? dateScopedEarnings(data, { eps, currency: epsCurrency,
|
|
87
|
+
periodEnd: trailingPeriodEnd, priced: typeof trailingPE === "number" && Number.isFinite(trailingPE) && trailingPE > 0 }) : null;
|
|
88
|
+
return { ...data, fundamentals: priceScopedEarnings({ ...data.fundamentals, scopedEarnings },
|
|
89
|
+
data.quote?.price, data.quote, data.quote?.lastUpdated) };
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function priceScopedEarnings(stats: Fundamentals, price: number | null | undefined, quote: Pick<Quote, "currency" | "stale"> | null | undefined,
|
|
93
|
+
priceTime: number | undefined, now = Date.now()): Fundamentals {
|
|
94
|
+
const { eps: _eps, epsCurrency: _currency, trailingPE: _pe, trailingPEConversion: _conversion,
|
|
95
|
+
trailingEpsSource: _source, trailingEpsPeriodEnd: _end, ...rest } = stats;
|
|
96
|
+
const earnings = stats.scopedEarnings;
|
|
97
|
+
if (!earnings?.epsAvailableAt) return rest;
|
|
98
|
+
const filed = financialAvailabilityTime(earnings.epsAvailableAt);
|
|
99
|
+
if (!(filed <= now)) return rest;
|
|
100
|
+
const eligible = earnings.priced && !stats.notMeaningful?.trailingPE && earnings.eps > 0 && quote && !quote.stale && quote.currency === earnings.currency
|
|
101
|
+
&& priceTime !== undefined && priceTime >= filed && priceTime <= now && typeof price === "number" && Number.isFinite(price) && price > 0;
|
|
102
|
+
return { ...rest, eps: earnings.eps, epsCurrency: earnings.currency, ...(eligible ? { trailingPE: price / earnings.eps } : {}) };
|
|
103
|
+
}
|