gloomberb 0.19.4 → 0.19.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -1
- package/patches/@opentui%2Fcore@0.3.2.patch +86 -25
- package/src/api-client/equity-screener.ts +23 -0
- package/src/app/pane-runtime/index.tsx +2 -0
- package/src/app/pane-runtime/plugin-bindings.ts +10 -1
- package/src/app.tsx +63 -16
- package/src/cli/commands/command-utils.ts +4 -0
- package/src/cli/commands/market.ts +264 -33
- package/src/cli/commands/search.ts +22 -4
- package/src/cli/commands/ticker.ts +84 -39
- package/src/cli/currency-name-hint.ts +60 -0
- package/src/cli/glossary.ts +3 -3
- package/src/cli/history-rows.ts +18 -1
- package/src/cli/known-gaps.ts +25 -2
- package/src/cli/listing-arg.ts +12 -0
- package/src/cli/not-a-ticker.ts +5 -3
- package/src/cli/pane-functions/capabilities.ts +2 -0
- package/src/cli/pane-functions/catalog.ts +31 -5
- package/src/cli/pane-functions/function-help.ts +8 -5
- package/src/cli/pane-functions/headless.ts +11 -6
- package/src/cli/pane-functions/market-session.ts +6 -7
- package/src/cli/pane-functions/resolver.ts +75 -2
- package/src/cli/quote-answer.ts +9 -0
- package/src/cli/series-search.ts +4 -5
- package/src/cli/symbol-list.ts +54 -2
- package/src/cli/symbol-rows.ts +14 -2
- package/src/cli/ticker-resolution.ts +89 -20
- package/src/components/chart/composite/axis-overlays.tsx +60 -27
- package/src/components/chart/composite/composite-chart.tsx +118 -63
- package/src/components/chart/composite/cursor-source.ts +111 -0
- package/src/components/chart/composite/format.ts +168 -6
- package/src/components/chart/composite/legend.tsx +8 -4
- package/src/components/chart/composite/panel-bitmap.ts +28 -2
- package/src/components/chart/composite/panel-labels.ts +20 -1
- package/src/components/chart/composite/panel-surface.tsx +201 -92
- package/src/components/chart/composite/price-axis-labels.tsx +92 -46
- package/src/components/chart/composite/price-series.ts +31 -8
- package/src/components/chart/composite/scene.ts +154 -59
- package/src/components/chart/composite/series-axis-tags.tsx +4 -2
- package/src/components/chart/composite/time-axis.ts +30 -7
- package/src/components/chart/composite/time-scale.ts +211 -56
- package/src/components/chart/composite/types.ts +11 -1
- package/src/components/chart/composite/use-composite-chart-keyboard.ts +32 -12
- package/src/components/chart/curve/curve-surface.tsx +5 -2
- package/src/components/chart/curve/model.ts +4 -1
- package/src/components/chart/native/use-bitmap-metrics.ts +81 -0
- package/src/components/chart/static/series.ts +3 -0
- package/src/components/command-bar/commands/collection-list.ts +81 -0
- package/src/components/command-bar/commands/direct/index.ts +6 -0
- package/src/components/command-bar/commands/registry.ts +8 -0
- package/src/components/command-bar/layout-items/current-layout.ts +22 -1
- package/src/components/command-bar/layout-items/focused-pane.ts +22 -1
- package/src/components/command-bar/pane-templates/items.ts +19 -3
- package/src/components/command-bar/pane-templates/workflow.ts +5 -0
- package/src/components/command-bar/routes/root/results.ts +23 -3
- package/src/components/command-bar/routes/root/selection.ts +4 -2
- package/src/components/command-bar/routes/root/shortcut-feedback.ts +1 -1
- package/src/components/command-bar/routes/root/shortcut-items.ts +3 -4
- package/src/components/command-bar/routes/root/shortcuts.ts +58 -14
- package/src/components/command-bar/routes/root/ticker-first.ts +32 -0
- package/src/components/command-bar/surface/environment.ts +2 -0
- package/src/components/command-bar/view-model.ts +7 -0
- package/src/components/command-bar/workflow/ops.ts +2 -1
- package/src/components/command-bar/workflow/tickers.ts +20 -0
- package/src/components/layout/shell/active-drag.ts +38 -7
- package/src/components/layout/shell/drag/magnets.ts +106 -0
- package/src/components/layout/shell/menu.ts +15 -1
- package/src/components/layout/shell/pane/actions.ts +4 -0
- package/src/components/layout/shell/ticker-link-menu.ts +12 -3
- package/src/components/layout/status-bar.tsx +20 -0
- package/src/components/layout/window-controls.tsx +96 -35
- package/src/components/layout/window-fullscreen.ts +20 -0
- package/src/components/onboarding/onboarding-keyboard.ts +5 -1
- package/src/components/onboarding/onboarding-wizard.tsx +15 -4
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +8 -5
- package/src/components/onboarding/use-onboarding-progress.ts +20 -1
- package/src/components/price-sparkline/view.tsx +14 -6
- package/src/components/quote-flash.ts +36 -32
- package/src/components/ticker/badge/index.tsx +8 -4
- package/src/components/ticker/badge/list.tsx +23 -7
- package/src/components/ui/column-grid.tsx +8 -2
- package/src/components/ui/data-table/opentui/model.ts +4 -1
- package/src/components/ui/tabs.tsx +5 -2
- package/src/core/state/app/layout.ts +18 -3
- package/src/core/state/app/state.ts +2 -0
- package/src/core/state/app/types.ts +5 -0
- package/src/data/config/layout.ts +3 -0
- package/src/data/config/store/normalize.ts +39 -4
- package/src/i18n/es.ts +10 -0
- package/src/i18n/ja.ts +10 -0
- package/src/i18n/ko.ts +10 -0
- package/src/i18n/zh-cn.ts +10 -0
- package/src/i18n/zh-tw.ts +10 -0
- package/src/layout/pane-manager/floating-placement.ts +7 -4
- package/src/layout/pane-manager/floating.ts +5 -2
- package/src/market-data/bond-funds.ts +19 -0
- package/src/market-data/coordinator/events.ts +17 -1
- package/src/market-data/frame-scheduler.ts +47 -10
- package/src/market-data/frame-wake.ts +74 -0
- package/src/market-data/futures-board.ts +7 -6
- package/src/market-data/futures-contract.ts +14 -3
- package/src/market-data/hooks.tsx +12 -3
- package/src/market-data/market/freshness.ts +18 -0
- package/src/market-data/market/status.ts +15 -2
- package/src/market-data/performance.ts +78 -9
- package/src/market-data/request-types.ts +6 -3
- package/src/plugins/builtin/alerts/cli.ts +2 -1
- package/src/plugins/builtin/analytics/risk-evidence.ts +1 -0
- package/src/plugins/builtin/attention/evidence.ts +1 -1
- package/src/plugins/builtin/awards/client.ts +1 -1
- package/src/plugins/builtin/awards/evidence.ts +1 -1
- package/src/plugins/builtin/awards/pane.tsx +2 -1
- package/src/plugins/builtin/bond-calculator/headless.ts +2 -1
- package/src/plugins/builtin/bond-calculator/index.tsx +1 -1
- package/src/plugins/builtin/bond-calculator/math.ts +1 -1
- package/src/plugins/builtin/bond-calculator/model.ts +14 -5
- package/src/plugins/builtin/bond-calculator/pane.tsx +1 -1
- package/src/plugins/builtin/broker-manager/footer.ts +3 -2
- package/src/plugins/builtin/broker-manager/index.tsx +2 -1
- package/src/plugins/builtin/broker-manager/keyboard.ts +2 -1
- package/src/plugins/builtin/buildout/cells.tsx +25 -45
- package/src/plugins/builtin/buildout/detail/company.tsx +3 -3
- package/src/plugins/builtin/buildout/detail/index.tsx +1 -1
- package/src/plugins/builtin/buildout/detail/intel.tsx +4 -7
- package/src/plugins/builtin/buildout/detail/site.tsx +4 -4
- package/src/plugins/builtin/buildout/detail/ui.tsx +39 -38
- package/src/plugins/builtin/buildout/format.ts +23 -1
- package/src/plugins/builtin/buildout/model/types.ts +1 -0
- package/src/plugins/builtin/buildout/pane/index.tsx +2 -8
- package/src/plugins/builtin/buildout/table-model.ts +12 -4
- package/src/plugins/builtin/catalysts/evidence.ts +1 -1
- package/src/plugins/builtin/catalysts/pane.tsx +2 -1
- package/src/plugins/builtin/cds/headless.ts +1 -0
- package/src/plugins/builtin/cds/index.tsx +1 -1
- package/src/plugins/builtin/chart-composer/headless.ts +40 -1
- package/src/plugins/builtin/cloud/plugin.tsx +2 -0
- package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +28 -3
- package/src/plugins/builtin/cloud-tweets/table.tsx +3 -2
- package/src/plugins/builtin/comment-letters/client.ts +2 -1
- package/src/plugins/builtin/company-kpis/client.ts +1 -1
- package/src/plugins/builtin/company-kpis/pane.tsx +2 -1
- package/src/plugins/builtin/company-kpis/screenshot-evidence.ts +3 -2
- package/src/plugins/builtin/correlation/headless.ts +3 -2
- package/src/plugins/builtin/cot/headless.ts +9 -3
- package/src/plugins/builtin/cot/model.ts +44 -3
- package/src/plugins/builtin/credit-documents/client.ts +1 -1
- package/src/plugins/builtin/credit-documents/evidence.ts +1 -1
- package/src/plugins/builtin/credit-documents/pane.tsx +2 -1
- package/src/plugins/builtin/crypto-board/pane.tsx +5 -4
- package/src/plugins/builtin/debt-maturities/headless.ts +11 -2
- package/src/plugins/builtin/debt-maturities/model.ts +66 -0
- package/src/plugins/builtin/debt-maturities/pane.tsx +23 -4
- package/src/plugins/builtin/earnings-calls/pane.tsx +1 -1
- package/src/plugins/builtin/earnings-ripple/index.tsx +6 -1
- package/src/plugins/builtin/earnings-ripple/pane.tsx +1 -1
- package/src/plugins/builtin/econ/calendar-model.ts +30 -6
- package/src/plugins/builtin/econ/fred-catalog.ts +5 -5
- package/src/plugins/builtin/econ/print-watch.ts +3 -1
- package/src/plugins/builtin/equity-screener/client.ts +1 -1
- package/src/plugins/builtin/equity-screener/criterion-editor.tsx +4 -16
- package/src/plugins/builtin/equity-screener/headless.ts +4 -2
- package/src/plugins/builtin/equity-screener/ideas.ts +67 -3
- package/src/plugins/builtin/equity-screener/model.ts +180 -12
- package/src/plugins/builtin/equity-screener/pane.tsx +52 -12
- package/src/plugins/builtin/equity-screener/screen-check.ts +7 -4
- package/src/plugins/builtin/equity-screener/watchlist.ts +33 -0
- package/src/plugins/builtin/futures/series.ts +16 -1
- package/src/plugins/builtin/futures-curve/client.ts +19 -0
- package/src/plugins/builtin/futures-curve/headless.ts +52 -13
- package/src/plugins/builtin/futures-curve/index.tsx +1 -1
- package/src/plugins/builtin/futures-curve/model.ts +77 -6
- package/src/plugins/builtin/futures-curve/pane.tsx +19 -3
- package/src/plugins/builtin/fx-matrix/headless.ts +4 -2
- package/src/plugins/builtin/fx-matrix/index.tsx +37 -3
- package/src/plugins/builtin/fx-matrix/pairs.ts +15 -0
- package/src/plugins/builtin/gpu/headless.ts +2 -1
- package/src/plugins/builtin/help/function-card.tsx +2 -1
- package/src/plugins/builtin/help/index.tsx +2 -1
- package/src/plugins/builtin/insider/display.ts +45 -6
- package/src/plugins/builtin/ipo-calendar/model.ts +2 -0
- package/src/plugins/builtin/iv-history/client.ts +2 -1
- package/src/plugins/builtin/iv-history/headless.ts +2 -1
- package/src/plugins/builtin/jobs/pages.ts +4 -4
- package/src/plugins/builtin/kelly-sizer/headless.ts +2 -1
- package/src/plugins/builtin/macro-day/client.ts +41 -0
- package/src/plugins/builtin/macro-day/headless.ts +19 -9
- package/src/plugins/builtin/macro-day/model.ts +3 -1
- package/src/plugins/builtin/market-heatmap/index.tsx +2 -1
- package/src/plugins/builtin/market-movers/index.tsx +4 -3
- package/src/plugins/builtin/members/client.ts +1 -1
- package/src/plugins/builtin/mna/distress/client.ts +1 -0
- package/src/plugins/builtin/mna/distress/headless.ts +1 -0
- package/src/plugins/builtin/mna/pane.tsx +4 -1
- package/src/plugins/builtin/options/market-reference.ts +1 -1
- package/src/plugins/builtin/options/open-interest-as-of.ts +3 -1
- package/src/plugins/builtin/options/view.tsx +2 -1
- package/src/plugins/builtin/options-calculator/evidence.ts +1 -1
- package/src/plugins/builtin/options-scenario/csp-screen-pane.tsx +1 -1
- package/src/plugins/builtin/options-scenario/csp-screen.ts +8 -4
- package/src/plugins/builtin/options-scenario/csp.ts +28 -9
- package/src/plugins/builtin/options-scenario/evidence.ts +5 -4
- package/src/plugins/builtin/options-scenario/pane.tsx +2 -1
- package/src/plugins/builtin/perps/client.ts +1 -1
- package/src/plugins/builtin/perps/pane.tsx +3 -1
- package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +17 -0
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +2 -1
- package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +4 -2
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +7 -3
- package/src/plugins/builtin/portfolio-list/use-throttled-memo.ts +10 -19
- package/src/plugins/builtin/rate-path/headless.ts +24 -10
- package/src/plugins/builtin/research/analyst-model.ts +1 -0
- package/src/plugins/builtin/research/equity-diagnostic-pane.tsx +2 -1
- package/src/plugins/builtin/research/event-model.ts +10 -3
- package/src/plugins/builtin/research/events-headless.ts +20 -2
- package/src/plugins/builtin/research/index.tsx +1 -0
- package/src/plugins/builtin/research/relative-valuation-currency.ts +1 -1
- package/src/plugins/builtin/research/relative-valuation-peers.ts +2 -1
- package/src/plugins/builtin/research-search/command-bar-search.ts +3 -1
- package/src/plugins/builtin/research-search/snippet.ts +1 -0
- package/src/plugins/builtin/revenue-breakdown/client.ts +3 -2
- package/src/plugins/builtin/seasonality/headless.ts +2 -1
- package/src/plugins/builtin/sec/command-bar-search.ts +3 -2
- package/src/plugins/builtin/sec/fund-facts.ts +17 -1
- package/src/plugins/builtin/sec/index.tsx +8 -5
- package/src/plugins/builtin/sec/row-summaries.ts +28 -12
- package/src/plugins/builtin/shared/members-menu.tsx +103 -38
- package/src/plugins/builtin/short-interest/publications-model.ts +22 -1
- package/src/plugins/builtin/short-interest/publications-pane.tsx +13 -4
- package/src/plugins/builtin/short-interest/watch-client.ts +2 -1
- package/src/plugins/builtin/short-interest/watch-model.ts +1 -1
- package/src/plugins/builtin/social-mentions/client.ts +2 -1
- package/src/plugins/builtin/supply-chain/client.ts +1 -1
- package/src/plugins/builtin/supply-chain/evidence.ts +1 -1
- package/src/plugins/builtin/supply-chain/graph-pane.tsx +2 -1
- package/src/plugins/builtin/supply-chain/pane.tsx +2 -1
- package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +1 -1
- package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +24 -4
- package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +1 -1
- package/src/plugins/builtin/time-sales/client.ts +1 -0
- package/src/plugins/builtin/time-sales/pane.tsx +3 -2
- package/src/plugins/builtin/trace-bonds/client.ts +7 -4
- package/src/plugins/builtin/trace-bonds/index.tsx +1 -1
- package/src/plugins/builtin/vol-surface/client.ts +2 -1
- package/src/plugins/builtin/volatility/client.ts +6 -1
- package/src/plugins/builtin/volatility/headless.ts +0 -1
- package/src/plugins/builtin/yield-curve/curves.ts +15 -0
- package/src/plugins/builtin/yield-curve/headless.ts +9 -2
- package/src/plugins/builtin/yield-curve/index.tsx +5 -8
- package/src/plugins/host-modules.ts +22 -3
- package/src/plugins/host-smoke.ts +6 -3
- package/src/portfolio/collection-name.ts +19 -0
- package/src/portfolio/column-values.ts +76 -10
- package/src/renderers/browser/http-proxy-transport.ts +78 -8
- package/src/renderers/cloudflare/http-proxy.ts +13 -2
- package/src/renderers/cloudflare/proxy-session.ts +47 -24
- package/src/renderers/cloudflare/worker.ts +15 -2
- package/src/renderers/desktop/geometry.ts +279 -0
- package/src/renderers/desktop/screen-setup.ts +246 -0
- package/src/renderers/desktop/sequential-window-host.ts +179 -0
- package/src/renderers/desktop/test-utils.ts +71 -0
- package/src/renderers/desktop/window-controller.ts +433 -0
- package/src/renderers/desktop/window-host.ts +70 -0
- package/src/renderers/desktop/window-layouts.ts +630 -0
- package/src/renderers/dom/data-frames.ts +15 -4
- package/src/renderers/dom/host/box.tsx +204 -176
- package/src/renderers/dom/host/style.ts +49 -20
- package/src/renderers/dom/host/text.tsx +3 -2
- package/src/renderers/electrobun/bun/application-menu/click.ts +1 -0
- package/src/renderers/electrobun/bun/application-menu/index.ts +4 -1
- package/src/renderers/electrobun/bun/desktop/backend-requests.ts +19 -8
- package/src/renderers/electrobun/bun/desktop/backend.ts +322 -19
- package/src/renderers/electrobun/bun/desktop/detached-windows.ts +83 -61
- package/src/renderers/electrobun/bun/desktop/host-requests.ts +29 -15
- package/src/renderers/electrobun/bun/desktop/initialization.ts +30 -11
- package/src/renderers/electrobun/bun/desktop/relaunch.ts +9 -1
- package/src/renderers/electrobun/bun/desktop/screen-setup-file.ts +55 -0
- package/src/renderers/electrobun/bun/desktop/state-broadcaster.ts +44 -8
- package/src/renderers/electrobun/bun/desktop/windows-script.ts +9 -6
- package/src/renderers/electrobun/bun/desktop/workspace/index.ts +298 -97
- package/src/renderers/electrobun/bun/desktop/workspace/requests.ts +44 -6
- package/src/renderers/electrobun/bun/index.ts +4 -97
- package/src/renderers/electrobun/bun/window/electrobun-window-host.ts +306 -0
- package/src/renderers/electrobun/bun/window/focus.ts +0 -25
- package/src/renderers/electrobun/bun/window/remembered-frame.ts +4 -82
- package/src/renderers/electrobun/bun/window/windows-native.ts +26 -1
- package/src/renderers/electrobun/shared/protocol.ts +50 -2
- package/src/renderers/electrobun/view/backend-rpc.ts +15 -0
- package/src/renderers/electrobun/view/desktop/window/bridge.ts +63 -3
- package/src/renderers/electrobun/view/main.tsx +13 -7
- package/src/renderers/electrobun/view/ui-host.tsx +7 -0
- package/src/renderers/electrobun/view/window-fullscreen.ts +10 -3
- package/src/series/fred-argument.ts +17 -0
- package/src/sources/provider-router/financial-routes.ts +7 -1
- package/src/sources/provider-router/index.ts +7 -1
- package/src/state/app/context/index.tsx +16 -2
- package/src/state/desktop-windows.ts +63 -0
- package/src/sync/other-window-tabs.ts +62 -0
- package/src/tickers/company-name-listing.ts +23 -3
- package/src/tickers/listing-fate.ts +147 -1
- package/src/tickers/terminal-codes.ts +5 -0
- package/src/time-series/price-units.ts +11 -0
- package/src/time-series/types.ts +6 -0
- package/src/types/config.ts +10 -1
- package/src/types/desktop-window.ts +71 -2
- package/src/types/financials.ts +4 -0
- package/src/types/headless.ts +19 -0
- package/src/types/plugin.ts +6 -0
- package/src/ui/host.tsx +2 -0
- package/src/ui/index.tsx +14 -13
- package/src/ui/same-props.ts +58 -0
- package/src/utils/cli-output.ts +33 -4
- package/src/utils/currency-names.ts +20 -0
- package/src/utils/currency-pair.ts +6 -0
- package/src/utils/exchange-rate-snapshot.ts +20 -2
- package/src/utils/format.ts +7 -2
- package/src/utils/futures-generic.ts +12 -0
- package/src/utils/fx-market-hours.ts +43 -0
- package/src/utils/http-proxy-upstream.ts +6 -2
- package/src/utils/plugin-proxy-hosts.json +0 -4
- package/src/utils/plugin-proxy-hosts.ts +22 -0
- package/src/utils/sec-filings.ts +7 -1
|
@@ -103,6 +103,7 @@ import { perpetualDisplaySymbol, perpetualListing, perpetualVenueName } from "..
|
|
|
103
103
|
import { useColumnClock } from "../use-column-clock";
|
|
104
104
|
import { liveMarketCapitalization } from "../../../../market-data/quotes/live-valuation";
|
|
105
105
|
import { hasUnknownOptionMultiplier } from "../../../../portfolio/position-metrics";
|
|
106
|
+
import { sharePositionMetrics } from "../../../../portfolio/column-values";
|
|
106
107
|
import { withFuturesContractSizes } from "../../../../portfolio/futures-positions";
|
|
107
108
|
import { withPurchaseDateCostFx } from "../../../../portfolio/cost-fx";
|
|
108
109
|
import { usePortfolioFuturesTerms } from "./futures-terms";
|
|
@@ -124,6 +125,8 @@ const ALLOCATION_COLUMN_IDS = new Set(["weight", "drift", "trade", "trade_value"
|
|
|
124
125
|
const FOOTER_TOTALS_THROTTLE_MS = 250;
|
|
125
126
|
const WEIGHT_TOTAL_THROTTLE_MS = 1_000;
|
|
126
127
|
const DAY_MS = 86_400_000;
|
|
128
|
+
/** One fallback for every render: a fresh `{}` would read as a changed value each time. */
|
|
129
|
+
const NO_COLLECTION_SORTS: Record<string, CollectionSortPreference> = {};
|
|
127
130
|
|
|
128
131
|
export function PortfolioListPane({ focused, width, height }: PaneProps) {
|
|
129
132
|
const activateTicker = useTickerSourceActivate();
|
|
@@ -139,7 +142,7 @@ export function PortfolioListPane({ focused, width, height }: PaneProps) {
|
|
|
139
142
|
|
|
140
143
|
const [currentCollectionId, setCurrentCollectionId] = usePaneStateValue<string>("collectionId", paneCollection.collectionId ?? "");
|
|
141
144
|
const [committedCursorSymbol, setCommittedCursorSymbol] = usePaneStateValue<string | null>("cursorSymbol", null);
|
|
142
|
-
const [collectionSorts, setCollectionSorts] = usePaneStateValue<Record<string, CollectionSortPreference>>("collectionSorts",
|
|
145
|
+
const [collectionSorts, setCollectionSorts] = usePaneStateValue<Record<string, CollectionSortPreference>>("collectionSorts", NO_COLLECTION_SORTS);
|
|
143
146
|
const [cashDrawerExpanded, setCashDrawerExpanded] = usePaneStateValue<boolean>("cashDrawerExpanded", false);
|
|
144
147
|
const [, setViewMode] = usePaneSettingValue<PortfolioViewMode>("viewMode", "table");
|
|
145
148
|
|
|
@@ -322,11 +325,12 @@ export function PortfolioListPane({ focused, width, height }: PaneProps) {
|
|
|
322
325
|
totalsCurrency,
|
|
323
326
|
valuationBasis,
|
|
324
327
|
]);
|
|
325
|
-
|
|
328
|
+
// Cells and sort keys share each row's position figures: the clock does not move them.
|
|
329
|
+
const columnContext: ColumnContext = useMemo(() => sharePositionMetrics({ ...baseColumnContext, now }, baseColumnContext), [baseColumnContext, now]);
|
|
326
330
|
// The order only follows the per-second clock when sorting by quote age;
|
|
327
331
|
// day-based columns read the day, which the day's start stands for.
|
|
328
332
|
const sortNow = activeSort.columnId === "latency" ? now : Math.floor(now / DAY_MS) * DAY_MS;
|
|
329
|
-
const sortContext: ColumnContext = useMemo(() => ({ ...baseColumnContext, now: sortNow }), [baseColumnContext, sortNow]);
|
|
333
|
+
const sortContext: ColumnContext = useMemo(() => sharePositionMetrics({ ...baseColumnContext, now: sortNow }, baseColumnContext), [baseColumnContext, sortNow]);
|
|
330
334
|
|
|
331
335
|
const candidateSortedTickers = useMemo(
|
|
332
336
|
() => sortTickers(tickers, financialsMap, activeSort, sortContext, columns),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { useEffect,
|
|
1
|
+
import { useEffect, useRef } from "react";
|
|
2
|
+
import { useDataFrameWake } from "../../../market-data/frame-wake";
|
|
2
3
|
|
|
3
4
|
function sameDeps(left: readonly unknown[], right: readonly unknown[]): boolean {
|
|
4
5
|
return left.length === right.length && left.every((value, index) => Object.is(value, right[index]));
|
|
@@ -8,7 +9,7 @@ interface ThrottledMemoState<T> {
|
|
|
8
9
|
value: T;
|
|
9
10
|
throttledDeps: readonly unknown[];
|
|
10
11
|
immediateDeps: readonly unknown[];
|
|
11
|
-
/**
|
|
12
|
+
/** When it last recomputed, on the market data clock (monotonic, so a wall-clock step cannot stall it). */
|
|
12
13
|
at: number;
|
|
13
14
|
}
|
|
14
15
|
|
|
@@ -16,7 +17,8 @@ interface ThrottledMemoState<T> {
|
|
|
16
17
|
* useMemo whose recomputation for `throttledDeps` (quote-driven inputs) runs at
|
|
17
18
|
* most once per interval, during a render that is happening anyway. A change
|
|
18
19
|
* to `immediateDeps` (collection, currency, rates) recomputes at once. When the
|
|
19
|
-
* input stops changing inside the interval, one trailing render catches up
|
|
20
|
+
* input stops changing inside the interval, one trailing render catches up, in
|
|
21
|
+
* a market data frame, so it shares a commit with the quotes that frame brings.
|
|
20
22
|
*/
|
|
21
23
|
export function useThrottledMemo<T>(
|
|
22
24
|
compute: () => T,
|
|
@@ -25,13 +27,10 @@ export function useThrottledMemo<T>(
|
|
|
25
27
|
intervalMs: number,
|
|
26
28
|
): T {
|
|
27
29
|
const stateRef = useRef<ThrottledMemoState<T> | null>(null);
|
|
28
|
-
const
|
|
29
|
-
const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
30
|
-
const [, forceRender] = useReducer((count: number) => count + 1, 0);
|
|
31
|
-
latestThrottledDepsRef.current = throttledDeps;
|
|
30
|
+
const clock = useDataFrameWake();
|
|
32
31
|
|
|
33
32
|
const state = stateRef.current;
|
|
34
|
-
const now =
|
|
33
|
+
const now = clock.now();
|
|
35
34
|
let pending = false;
|
|
36
35
|
if (!state || !sameDeps(state.immediateDeps, immediateDeps) || now - state.at >= intervalMs) {
|
|
37
36
|
if (!state || !sameDeps(state.immediateDeps, immediateDeps) || !sameDeps(state.throttledDeps, throttledDeps)) {
|
|
@@ -42,18 +41,10 @@ export function useThrottledMemo<T>(
|
|
|
42
41
|
}
|
|
43
42
|
|
|
44
43
|
useEffect(() => {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
timerRef.current = null;
|
|
49
|
-
const current = stateRef.current;
|
|
50
|
-
if (current && !sameDeps(current.throttledDeps, latestThrottledDepsRef.current)) forceRender();
|
|
51
|
-
}, wait);
|
|
44
|
+
// A render that caught up in the meantime (an input changed) drops the trailing one.
|
|
45
|
+
if (pending) clock.wakeAt(stateRef.current!.at + intervalMs);
|
|
46
|
+
else clock.cancel();
|
|
52
47
|
});
|
|
53
48
|
|
|
54
|
-
useEffect(() => () => {
|
|
55
|
-
if (timerRef.current) clearTimeout(timerRef.current);
|
|
56
|
-
}, []);
|
|
57
|
-
|
|
58
49
|
return stateRef.current!.value;
|
|
59
50
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RateMeeting } from "../../../api-client/rates";
|
|
1
|
+
import type { RateMeeting, RatePathPayload } from "../../../api-client/rates";
|
|
2
2
|
import type { HeadlessPaneColumn, HeadlessPaneDefinition } from "../../../types/plugin";
|
|
3
3
|
import { fetchRatePath } from "./client";
|
|
4
4
|
import { meetingMoves, moveOddsText, movesPriced, movesText, rateText } from "./model";
|
|
@@ -25,8 +25,9 @@ const probabilities = (value: unknown) => {
|
|
|
25
25
|
: outcomes.map((outcome) => `${outcome.targetMidpoint.toFixed(3)}% ${(outcome.probability * 100).toFixed(0)}%`).join(" / ");
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
+
const STALE_COLUMN: HeadlessPaneColumn = { key: "stale", header: "Data stale", stackPriority: 2, format: yesNo };
|
|
28
29
|
// A narrow terminal leaves out the sample count, status, percentile and quote time (the closing line has it),
|
|
29
|
-
// then moves the
|
|
30
|
+
// then moves the month under each row.
|
|
30
31
|
const contractColumns: HeadlessPaneColumn[] = [
|
|
31
32
|
{ key: "symbol", header: "Symbol", shrink: false }, { key: "month", header: "Month", shrink: false, stackPriority: 1 },
|
|
32
33
|
{ key: "price", header: "Price", align: "right", format: (value) => finiteOrNull(value)?.toFixed(3) ?? "--" },
|
|
@@ -34,8 +35,17 @@ const contractColumns: HeadlessPaneColumn[] = [
|
|
|
34
35
|
{ key: "percentile", header: "Pctl 1Y", align: "right", stackPriority: 4, stackRows: 0, format: pctl },
|
|
35
36
|
{ key: "samples", header: "Samples", align: "right", stackPriority: 6, stackRows: 0 },
|
|
36
37
|
{ key: "asOf", header: "As of UTC", shrink: false, stackPriority: 3, stackRows: 0, format: timestamp },
|
|
37
|
-
{ key: "status", header: "Status", stackPriority: 5, stackRows: 0 },
|
|
38
|
+
{ key: "status", header: "Status", stackPriority: 5, stackRows: 0 }, STALE_COLUMN,
|
|
38
39
|
];
|
|
40
|
+
/** The text says once which rows are stale, under the tables (`staleNote`), not "no" on every row; JSON keeps the column. */
|
|
41
|
+
const textColumns = (columns: HeadlessPaneColumn[]) => columns.filter((column) => column.key !== "stale");
|
|
42
|
+
|
|
43
|
+
/** "Stale: Effective fed funds rate, ZQX26.CBT.", naming each row whose figure is stale; null when none is. */
|
|
44
|
+
function staleNote(data: Pick<RatePathPayload, "current" | "fedFunds" | "sofr">): string | null {
|
|
45
|
+
const stale = [...Object.entries(data.current).filter(([, metric]) => metric.stale).map(([name]) => policyLabel(name)),
|
|
46
|
+
...[...data.fedFunds, ...data.sofr].filter((contract) => contract.stale && contract.status !== "unavailable").map((contract) => contract.symbol)];
|
|
47
|
+
return stale.length ? `Stale: ${stale.join(", ")}.` : null;
|
|
48
|
+
}
|
|
39
49
|
|
|
40
50
|
/**
|
|
41
51
|
* How far the fed funds and SOFR futures quotes are held back. The rate-path
|
|
@@ -60,14 +70,17 @@ export const ratePathHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
60
70
|
// (FRED) keep their own date and stale flag in their table, and the meetings are read from the contracts.
|
|
61
71
|
const contracts = [...data.fedFunds, ...data.sofr].filter((contract) => contract.status !== "unavailable")
|
|
62
72
|
.map(({ asOf, stale }) => ({ asOf, stale }));
|
|
73
|
+
const policyColumns: HeadlessPaneColumn[] = [
|
|
74
|
+
{ key: "name", header: "Name", minWidth: 18, format: policyLabel }, { key: "value", header: "Value", align: "right", format: rate },
|
|
75
|
+
{ key: "asOf", header: "As of", shrink: false }, { key: "percentile", header: "Pctl 1Y", align: "right", stackPriority: 1, format: pctl },
|
|
76
|
+
{ key: "samples", header: "Samples", align: "right", stackPriority: 2, stackRows: 0 }, { key: "stale", header: "Data stale", format: yesNo },
|
|
77
|
+
];
|
|
78
|
+
const stale = staleNote(data);
|
|
63
79
|
return {
|
|
64
80
|
freshness: { observedKey: "asOf", observations: contracts },
|
|
65
81
|
sections: [
|
|
66
|
-
{ title: "Current policy", columns:
|
|
67
|
-
|
|
68
|
-
{ key: "asOf", header: "As of", shrink: false }, { key: "percentile", header: "Pctl 1Y", align: "right", stackPriority: 1, format: pctl },
|
|
69
|
-
{ key: "samples", header: "Samples", align: "right", stackPriority: 2, stackRows: 0 }, { key: "stale", header: "Data stale", format: yesNo },
|
|
70
|
-
], rows: Object.entries(data.current).map(([name, metric]) => ({ name, ...metric })) },
|
|
82
|
+
{ title: "Current policy", columns: policyColumns, textColumns: textColumns(policyColumns),
|
|
83
|
+
rows: Object.entries(data.current).map(([name, metric]) => ({ name, ...metric })) },
|
|
71
84
|
// A narrow terminal keeps the moves and change, prints the probabilities of the next two meetings
|
|
72
85
|
// under their rows, and leaves out the rest; a reason a meeting has no rate stays under its row.
|
|
73
86
|
{ title: "FOMC meetings", columns: [
|
|
@@ -83,9 +96,10 @@ export const ratePathHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
83
96
|
{ key: "probabilities", header: "Probabilities", shrink: false, stackPriority: 4, stackRows: 2, format: probabilities },
|
|
84
97
|
{ key: "method", header: "Method", stackPriority: 9, stackRows: 0 }, { key: "reason", header: "Reason", stackPriority: 10 },
|
|
85
98
|
], rows: data.meetings.map((meeting) => ({ ...meeting, moves: movesPriced(meeting), moveOdds: moves.get(meeting.date) ?? null })) },
|
|
86
|
-
{ title: "Fed funds contracts", columns: contractColumns, rows: data.fedFunds.map((contract) => ({ ...contract })) },
|
|
87
|
-
{ title: "SOFR contracts", columns: contractColumns, rows: data.sofr.map((contract) => ({ ...contract })) },
|
|
99
|
+
{ title: "Fed funds contracts", columns: contractColumns, textColumns: textColumns(contractColumns), rows: data.fedFunds.map((contract) => ({ ...contract })) },
|
|
100
|
+
{ title: "SOFR contracts", columns: contractColumns, textColumns: textColumns(contractColumns), rows: data.sofr.map((contract) => ({ ...contract })) },
|
|
88
101
|
],
|
|
102
|
+
...(stale ? { notes: [stale] } : {}),
|
|
89
103
|
errors: data.gaps,
|
|
90
104
|
metadata: { ...data, probabilityBasis: data.probabilityAssumption, units: "percent", complete: data.status === "available" },
|
|
91
105
|
};
|
|
@@ -293,6 +293,7 @@ export function ratingReasonSource(reason: NonNullable<AnalystRatingRecord["reas
|
|
|
293
293
|
try {
|
|
294
294
|
return new URL(reason.url).hostname.replace(/^www\./, "");
|
|
295
295
|
} catch {
|
|
296
|
+
// Intentional ignore: a malformed link has no site to name, so it reads as source.
|
|
296
297
|
return "source";
|
|
297
298
|
}
|
|
298
299
|
}
|
|
@@ -22,6 +22,7 @@ import { ProWall, SignInWall } from "../cloud/auth-actions";
|
|
|
22
22
|
import { useCloudPlanAction, useCloudUpgradeAction } from "../shared/cloud-upgrade";
|
|
23
23
|
import { usePlanAccess } from "../../../api-client/plan-access";
|
|
24
24
|
import { useBoundTicker } from "../shared/ticker-request";
|
|
25
|
+
import { logFailure } from "../../../utils/log-failure";
|
|
25
26
|
|
|
26
27
|
const FOOTER_ID = "equity-diagnostic";
|
|
27
28
|
/** Width of the "Observed"/"Reading" label column before the layout stacks. */
|
|
@@ -519,7 +520,7 @@ export function EquityDiagnosticView({ focused, width, height }: {
|
|
|
519
520
|
}).then((sourceId) => {
|
|
520
521
|
const source = sources.find((entry) => entry.id === sourceId);
|
|
521
522
|
if (source) void rendererHost.openExternal(source.url);
|
|
522
|
-
}).catch((
|
|
523
|
+
}).catch(logFailure("research.equity-diagnostic-pane", "Open diagnostic source choices failed"));
|
|
523
524
|
}, [dialog, rendererHost, sources]);
|
|
524
525
|
|
|
525
526
|
// The preview's pitch sits in the body, not an empty state, so its buttons
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
formatPercentRaw,
|
|
15
15
|
} from "../../../utils/format";
|
|
16
16
|
import { computeTTM } from "../ticker-detail/financials/aggregation";
|
|
17
|
+
import { classifyInstrumentType } from "../../../tickers/instrument-kind";
|
|
17
18
|
import { declaredDividends } from "../../../utils/declared-dividends";
|
|
18
19
|
import { fundamentalsEpsCurrency, SERVED_TRAILING_EPS } from "../../../utils/fundamentals";
|
|
19
20
|
import {
|
|
@@ -180,10 +181,16 @@ function estimateValue(pair: EstimatePair): string {
|
|
|
180
181
|
*/
|
|
181
182
|
export type EventFinancials = Pick<TickerFinancials, "quarterlyStatements" | "financialCurrency"> & {
|
|
182
183
|
fundamentals?: Pick<NonNullable<TickerFinancials["fundamentals"]>, "eps" | "epsCurrency" | "financialCurrency" | "marketCapCurrency" | "trailingEpsSource"> | null;
|
|
183
|
-
/** The listing's currency, which says whether an unlabelled EPS can be in the statements' (fundamentalsCurrency). */
|
|
184
|
-
quote?: Pick<NonNullable<TickerFinancials["quote"]>, "currency"> | null;
|
|
184
|
+
/** The listing's currency, which says whether an unlabelled EPS can be in the statements' (fundamentalsCurrency), and its type. */
|
|
185
|
+
quote?: Pick<NonNullable<TickerFinancials["quote"]>, "currency" | "instrumentType"> | null;
|
|
186
|
+
quoteMetadata?: Pick<NonNullable<TickerFinancials["quoteMetadata"]>, "instrumentType"> | null;
|
|
185
187
|
};
|
|
186
188
|
|
|
189
|
+
/** A fund (an ETF, a closed-end fund) reports no earnings: a feed's EPS rows for one are another company's or noise. */
|
|
190
|
+
function isFundListing(financials: EventFinancials | null): boolean {
|
|
191
|
+
return [financials?.quote?.instrumentType, financials?.quoteMetadata?.instrumentType].some((type) => classifyInstrumentType(type) === "fund");
|
|
192
|
+
}
|
|
193
|
+
|
|
187
194
|
/**
|
|
188
195
|
* The four reported rows behind the latest four statement quarters, summed, only when every one is on the adjusted
|
|
189
196
|
* basis and in one currency. Quarters of different or unknown bases never add up to anything.
|
|
@@ -325,7 +332,7 @@ export function buildEventRows(
|
|
|
325
332
|
): EventRow[] {
|
|
326
333
|
const rows: EventRow[] = [];
|
|
327
334
|
const quarterlyStatements = sortedQuarterlyStatements(financials);
|
|
328
|
-
const earnings = data?.earnings ?? [];
|
|
335
|
+
const earnings = isFundListing(financials) ? [] : data?.earnings ?? [];
|
|
329
336
|
const ttm = ttmRow(quarterlyStatements, earnings, financials);
|
|
330
337
|
if (ttm) rows.push(ttm);
|
|
331
338
|
|
|
@@ -12,6 +12,10 @@ import { buildEventRows, eventSourceNotice, CORPORATE_ACTION_COVERAGE } from "./
|
|
|
12
12
|
import { EVENT_COLUMNS, loadEventSources } from "./event-sources";
|
|
13
13
|
import { REPORTED_DATA } from "../shared/report-freshness";
|
|
14
14
|
import { EPS_BASIS_NOTE } from "../shared/earnings-report";
|
|
15
|
+
import { loadNoQuoteLastTraded, noQuoteLastTradeNote, otherListingProfile } from "../../../tickers/listing-fate";
|
|
16
|
+
import { isUsSymbolVenue } from "../../../tickers/ticker-changes";
|
|
17
|
+
import { parsePublicTickerKey } from "../../../utils/exchanges";
|
|
18
|
+
import type { EventStatus } from "./event-model";
|
|
15
19
|
|
|
16
20
|
interface EventHeadlessData {
|
|
17
21
|
actions: CorporateActionsData | null;
|
|
@@ -23,6 +27,9 @@ interface EventHeadlessData {
|
|
|
23
27
|
financialsError?: string | null;
|
|
24
28
|
}
|
|
25
29
|
|
|
30
|
+
/** The rows drawn from the research served under a symbol (its reports and estimates), not from its own corporate actions. */
|
|
31
|
+
const RESEARCH_EVENTS: ReadonlySet<EventStatus> = new Set(["Earnings", "Q Est", "FY Est", "TTM"]);
|
|
32
|
+
|
|
26
33
|
export interface EventsHeadlessDependencies {
|
|
27
34
|
load(
|
|
28
35
|
args: HeadlessPaneLoadArgs,
|
|
@@ -65,9 +72,20 @@ export function createEventsHeadless(
|
|
|
65
72
|
const errors = [notice?.failed ? notice.text : null,
|
|
66
73
|
data.financialsError ? `Financial statements unavailable: ${data.financialsError}` : null,
|
|
67
74
|
].filter((error): error is string => !!error);
|
|
75
|
+
// A symbol with no quote whose listing stopped trading says when it last traded. The issuer's own events after
|
|
76
|
+
// that stay (a cash-out, a liquidating distribution); only where the research served under the symbol is shown
|
|
77
|
+
// to be another listing's (STPP: a fund abroad's profile) are the reports and estimates after it dropped.
|
|
78
|
+
const lastTrade = data.financials?.quote ? null : await loadNoQuoteLastTraded({ symbol }, ctx.marketData);
|
|
79
|
+
const other = lastTrade ? otherListingProfile(data.financials?.profile, { usLine: isUsSymbolVenue(parsePublicTickerKey(symbol).exchange) }) : null;
|
|
80
|
+
const rows = buildEventRows(data.actions, data.estimates, data.financials, data.currency);
|
|
81
|
+
const own = lastTrade && other
|
|
82
|
+
? rows.filter((row) => !RESEARCH_EVENTS.has(row.status) || row.date.slice(0, 10) <= lastTrade.date) : rows;
|
|
83
|
+
const hidden = rows.length - own.length;
|
|
84
|
+
const ended = lastTrade ? `${noQuoteLastTradeNote(symbol, lastTrade)}.${hidden > 0
|
|
85
|
+
? ` ${hidden} later ${hidden === 1 ? "report is" : "reports are"} another listing's (${other}), not shown.` : ""}` : null;
|
|
68
86
|
return {
|
|
69
|
-
rows:
|
|
70
|
-
|
|
87
|
+
rows: own.map((row) => ({ ...row })),
|
|
88
|
+
...(ended ? { notes: [ended] } : {}),
|
|
71
89
|
errors: errors.length > 0 ? errors : undefined,
|
|
72
90
|
metadata: { symbol, currency: data.currency, coverage: data.actions?.coverage,
|
|
73
91
|
coverageNote: CORPORATE_ACTION_COVERAGE, epsBasis: EPS_BASIS_NOTE,
|
|
@@ -170,6 +170,7 @@ export const researchModule: PluginModule = {
|
|
|
170
170
|
? options.symbols
|
|
171
171
|
: parseTickerListInput(options?.arg ?? context.activeTicker ?? "", MAX_RELATIVE_VALUATION_TICKERS);
|
|
172
172
|
} catch {
|
|
173
|
+
// Intentional ignore: a ticker list the parser rejects creates no pane.
|
|
173
174
|
return null;
|
|
174
175
|
}
|
|
175
176
|
return {
|
|
@@ -162,7 +162,7 @@ export function normalizeCapCurrency(value: string): string {
|
|
|
162
162
|
try {
|
|
163
163
|
known = Intl.supportedValuesOf("currency");
|
|
164
164
|
} catch {
|
|
165
|
-
//
|
|
165
|
+
// Intentional ignore: an older runtime lists no currencies, so the shape check stands alone.
|
|
166
166
|
}
|
|
167
167
|
if (!CURRENCY_CODE.test(code) || (known.length > 0 && !known.includes(code))) {
|
|
168
168
|
throw new Error(`Invalid --currency value "${value}". Use a three-letter currency code such as USD or EUR.`);
|
|
@@ -10,6 +10,7 @@ import { notATickerSymbol } from "../../../sources/provider-errors";
|
|
|
10
10
|
import { fetchScreen } from "../equity-screener/client";
|
|
11
11
|
import { loadHeadlessFinancials } from "../shared/headless-market-data";
|
|
12
12
|
import { loadFxLegs } from "./relative-valuation-currency";
|
|
13
|
+
import { logFailure } from "../../../utils/log-failure";
|
|
13
14
|
|
|
14
15
|
/** The pane setting holding the peers chosen for its subject (`PeerSelection`), which the report reads back too. */
|
|
15
16
|
export const PEER_SELECTION_SETTING = "peerSelection";
|
|
@@ -438,7 +439,7 @@ export async function pickPeers(symbol: string, financials: TickerFinancials | n
|
|
|
438
439
|
let failure: string | null = null;
|
|
439
440
|
try {
|
|
440
441
|
const [capUsd, industryRows, coreRows] = await Promise.all([
|
|
441
|
-
subjectCapUsd(financials, ctx).catch((
|
|
442
|
+
subjectCapUsd(financials, ctx).catch(logFailure("research.relative-valuation-peers", "Read subject market cap for peers failed", null)),
|
|
442
443
|
screenRows([{ field: "industry", op: "in", value: [group.industry] }], ctx),
|
|
443
444
|
group.related ? screenRows([{ field: "symbol", op: "in", value: [...group.related.core] }], ctx) : Promise.resolve([]),
|
|
444
445
|
]);
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
RESEARCH_SEARCH_TEMPLATE_ID,
|
|
17
17
|
} from "./model";
|
|
18
18
|
import { parseMarkedSnippet } from "./snippet";
|
|
19
|
+
import { logFailure } from "../../../utils/log-failure";
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* Each hit costs two rows (title, then source and snippet), and the sheet now
|
|
@@ -123,7 +124,8 @@ function createCorpusSearchProvider(
|
|
|
123
124
|
signal,
|
|
124
125
|
);
|
|
125
126
|
hits = response.hits ?? [];
|
|
126
|
-
} catch {
|
|
127
|
+
} catch (error) {
|
|
128
|
+
if (!signal.aborted) logFailure("research-search.command-bar-search", "Search documents for command bar failed")(error);
|
|
127
129
|
return [];
|
|
128
130
|
}
|
|
129
131
|
|
|
@@ -7,6 +7,7 @@ import type {
|
|
|
7
7
|
import type { IssuerListingParams } from "../../../api-client/paths";
|
|
8
8
|
import { createPluginCache } from "../../../data/plugin-cache";
|
|
9
9
|
import { secListingKey } from "../../../utils/sec";
|
|
10
|
+
import { logFailure } from "../../../utils/log-failure";
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Revenue by product, segment or region comes from Gloom Cloud, which reads
|
|
@@ -94,8 +95,8 @@ export function cachedRevenueBreakdown(
|
|
|
94
95
|
if (!cached) return null;
|
|
95
96
|
try {
|
|
96
97
|
return { payload: validateRevenueBreakdown(cached.data), stale: false, refreshError: null };
|
|
97
|
-
} catch {
|
|
98
|
-
return null;
|
|
98
|
+
} catch (error) {
|
|
99
|
+
return logFailure("revenue-breakdown.client", "Validate cached revenue breakdown failed", null)(error);
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
102
|
|
|
@@ -3,6 +3,7 @@ import { resolveHeadlessInstrument } from "../shared/headless-market-data";
|
|
|
3
3
|
import { loadSeasonalityHistory } from "./client";
|
|
4
4
|
import { closedHistoryBarDay, formingHistoryBar } from "../ticker-detail/data-panes/history-bars";
|
|
5
5
|
import { MONTH_LABELS, projectSeasonality, projectWeekdays, TURN_OF_MONTH_LABELS } from "./model";
|
|
6
|
+
import { logFailure } from "../../../utils/log-failure";
|
|
6
7
|
|
|
7
8
|
const percent = (digits: number) => (value: unknown) => typeof value === "number" ? `${(value * 100).toFixed(digits)}%` : "--";
|
|
8
9
|
const statColumns = (digits: number, countHeader: string) => [{ key: "mean", header: "Avg", format: percent(digits) },
|
|
@@ -50,7 +51,7 @@ export const seasonalityHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
50
51
|
// Monthly bars are dated by their month's first day, which is no close while the month runs.
|
|
51
52
|
const bar = model.asOf?.toISOString().slice(0, 10);
|
|
52
53
|
// The venue whose sessions say whether the month still runs: the key's, or for a bare symbol its quote's.
|
|
53
|
-
const quote = bar && !instrument.exchange ? await ctx.marketData.getQuote(instrument.symbol, "").catch((
|
|
54
|
+
const quote = bar && !instrument.exchange ? await ctx.marketData.getQuote(instrument.symbol, "").catch(logFailure("seasonality.headless", "Load seasonality quote failed", null)) : null;
|
|
54
55
|
const venue = instrument.exchange || quote?.listingExchangeName || quote?.exchangeName || undefined;
|
|
55
56
|
const forming = formingHistoryBar("1mo", bar, venue, Date.now());
|
|
56
57
|
const closed = forming ? null : closedHistoryBarDay("1mo", bar, venue, Date.now());
|
|
@@ -9,6 +9,7 @@ import type {
|
|
|
9
9
|
import { formatShortDate } from "../../../utils/datetime-format";
|
|
10
10
|
import { secFilingItemCodes } from "../../../utils/sec";
|
|
11
11
|
import { getFilingColumnText } from "./model";
|
|
12
|
+
import { logFailure } from "../../../utils/log-failure";
|
|
12
13
|
|
|
13
14
|
const SEC_TEMPLATE_ID = "sec-pane";
|
|
14
15
|
const FILING_ROW_LIMIT = 4;
|
|
@@ -216,8 +217,8 @@ export function createSecFilingSearchProvider(
|
|
|
216
217
|
count: RECENT_FILING_COUNT,
|
|
217
218
|
});
|
|
218
219
|
filings = entry.data ?? entry.lastGoodData ?? [];
|
|
219
|
-
} catch {
|
|
220
|
-
return [];
|
|
220
|
+
} catch (error) {
|
|
221
|
+
return logFailure("sec.command-bar-search", "Load SEC filings for command bar search failed", [])(error);
|
|
221
222
|
}
|
|
222
223
|
if (signal.aborted) return [];
|
|
223
224
|
const now = deps.now();
|
|
@@ -7,7 +7,7 @@ import { createPluginCache } from "../../../data/plugin-cache";
|
|
|
7
7
|
import type { HeadlessPaneEntry } from "../../../types/plugin";
|
|
8
8
|
import { errorMessage } from "../../../utils/errors";
|
|
9
9
|
import { formatCompact } from "../../../utils/format";
|
|
10
|
-
import { bondClassText, bondFigures } from "../../../market-data/bond-funds";
|
|
10
|
+
import { bondClassText, bondFigures, DV01_FROM_DURATION, durationDv01PerShare, formatDv01PerShare } from "../../../market-data/bond-funds";
|
|
11
11
|
import { readFundFacts, validateFundFacts } from "../../../market-data/fund-facts";
|
|
12
12
|
import { cachedCloudResource, loadCloudResource, unavailableOnServer } from "../shared/cloud-resource";
|
|
13
13
|
|
|
@@ -242,6 +242,8 @@ export function fundFactItems(facts: FundFactsPayload): StatItem[] {
|
|
|
242
242
|
for (const figure of facts.bond ? bondFigures(facts.bond) : []) {
|
|
243
243
|
items.push(cell(figure.key, figure.label, figure.text, { detail: figure.date, marked: facts.stale }));
|
|
244
244
|
}
|
|
245
|
+
const dv01 = fundDv01(facts);
|
|
246
|
+
if (dv01) items.push(cell("dv01", "DV01", formatDv01PerShare(dv01.value), { detail: DV01_FROM_DURATION, marked: facts.stale }));
|
|
245
247
|
// A metal trust's metal in trust, in tonnes as the market quotes it and ounces as the trust counts it, then its day's change.
|
|
246
248
|
const metal = facts.metalHoldings;
|
|
247
249
|
if (metal) {
|
|
@@ -267,6 +269,18 @@ export function fundFactItems(facts: FundFactsPayload): StatItem[] {
|
|
|
267
269
|
return items;
|
|
268
270
|
}
|
|
269
271
|
|
|
272
|
+
/**
|
|
273
|
+
* A bond fund's DV01 per share, derived from its duration at the closing
|
|
274
|
+
* price (NAV without one), with the price it was read at.
|
|
275
|
+
*/
|
|
276
|
+
function fundDv01(facts: FundFactsPayload): { value: number; price: string } | null {
|
|
277
|
+
const price = facts.closingPrice ?? facts.nav;
|
|
278
|
+
const value = durationDv01PerShare(price?.value, facts.bond);
|
|
279
|
+
if (value == null || !price) return null;
|
|
280
|
+
const date = price.asOf ? ` ${price.asOf}` : "";
|
|
281
|
+
return { value, price: facts.closingPrice ? `closing price${date}` : `NAV${date}` };
|
|
282
|
+
}
|
|
283
|
+
|
|
270
284
|
/** A DES figure: `warn` when it is older than it looks, which DES draws in the warning colour. */
|
|
271
285
|
interface FundFactOverviewField {
|
|
272
286
|
label: string;
|
|
@@ -373,6 +387,8 @@ export function fundFactEntries(facts: FundFactsPayload): HeadlessPaneEntry[] {
|
|
|
373
387
|
add(keys[figure.key], figure.key === "secYield" ? "30-day SEC yield" : figure.label, figure.value,
|
|
374
388
|
provenance(figure.text, figure.date, figure.source), figure.key === "duration" ? "years" : "%");
|
|
375
389
|
}
|
|
390
|
+
const dv01 = fundDv01(facts);
|
|
391
|
+
if (dv01) add("dv01PerShare", "DV01", dv01.value, provenance(formatDv01PerShare(dv01.value), DV01_FROM_DURATION, dv01.price), "USD per bp");
|
|
376
392
|
}
|
|
377
393
|
if (facts.sponsor) add("sponsor", "Sponsor", facts.sponsor.value, facts.sponsor.value);
|
|
378
394
|
if (facts.inception) add("inception", "Inception", facts.inception.value, facts.inception.value);
|
|
@@ -23,6 +23,7 @@ import { mayBeUsEquityOrFundTicker, mayBeUsEquityTicker, secFilingItemCodes, US_
|
|
|
23
23
|
import { fundAbroadProfile, venueAbroad, type FundAbroadProfile } from "./fund-abroad";
|
|
24
24
|
import { listingAnnouncementsPage } from "../../../utils/exchange-announcements";
|
|
25
25
|
import { pricingSupplementTest } from "../../../utils/sec-filings";
|
|
26
|
+
import { formatInsiderName } from "../insider/display";
|
|
26
27
|
import { parseForm4Xml } from "../insider/insider-data";
|
|
27
28
|
import { createTickerSurfacePaneTemplate } from "../shared/ticker-surface";
|
|
28
29
|
import {
|
|
@@ -63,7 +64,7 @@ import {
|
|
|
63
64
|
secIssuerLabel,
|
|
64
65
|
secReportedAcceptance,
|
|
65
66
|
} from "./model";
|
|
66
|
-
import { rowSummary, rowSummaryTarget } from "./row-summaries";
|
|
67
|
+
import { ownerNames, rowSummary, rowSummaryTarget } from "./row-summaries";
|
|
67
68
|
import { usePaneTickerIdentity } from "../../../state/hooks/pane-ticker";
|
|
68
69
|
import { createSecFilingSearchProvider, resetSecFilingFocusRequests, useSecFilingFocusRequest } from "./command-bar-search";
|
|
69
70
|
|
|
@@ -150,7 +151,7 @@ function buildForm4Detail(content: string | null, filing: SecFilingItem): string
|
|
|
150
151
|
if (!tx) return buildDetailBody(filing);
|
|
151
152
|
|
|
152
153
|
const lines: string[] = [];
|
|
153
|
-
lines.push(`Insider: ${tx.reportedName}`);
|
|
154
|
+
lines.push(`Insider: ${formatInsiderName(tx.reportedName)}`);
|
|
154
155
|
if (tx.title) lines.push(`Title: ${tx.title}`);
|
|
155
156
|
for (const [index, transaction] of transactions.entries()) {
|
|
156
157
|
if (transactions.length > 1) lines.push("", `Transaction ${index + 1}`);
|
|
@@ -172,6 +173,8 @@ function toFeedItems(
|
|
|
172
173
|
documentsError: string | null,
|
|
173
174
|
contentErrors: Map<string, string>,
|
|
174
175
|
): FeedDataTableItem[] {
|
|
176
|
+
// A Form 144 names its seller freely; the insider forms read beside it say which way round.
|
|
177
|
+
const knownOwners = filings.flatMap((filing) => ownerNames(filing.form, contentCache.get(filing.accessionNumber)));
|
|
175
178
|
return filings.map((filing) => {
|
|
176
179
|
const displayTitle = getFilingDisplayTitle(filing);
|
|
177
180
|
const acceptedAt = secReportedAcceptance(filing);
|
|
@@ -186,7 +189,7 @@ function toFeedItems(
|
|
|
186
189
|
// An insider form read once says who traded and how, a fund's 24F-2NT its
|
|
187
190
|
// year's flows; the row says it too.
|
|
188
191
|
const summaryTarget = rowSummaryTarget(filing);
|
|
189
|
-
const readSummary = summaryTarget ? rowSummary(filing.form, contentCache.get(summaryTarget.accessionNumber)) : null;
|
|
192
|
+
const readSummary = summaryTarget ? rowSummary(filing.form, contentCache.get(summaryTarget.accessionNumber), knownOwners) : null;
|
|
190
193
|
const form4Detail = isOwnership && hasFetchedContent
|
|
191
194
|
? buildForm4Detail(fetchedContent ?? null, filing)
|
|
192
195
|
: null;
|
|
@@ -413,7 +416,7 @@ function SecView({ width, height, focused, paneType }: { width: number; height:
|
|
|
413
416
|
const filing = visibleFilings.find((candidate) => candidate.accessionNumber === item.id);
|
|
414
417
|
if (!coordinator || !filing) return;
|
|
415
418
|
if (coordinator.getSecDocumentsEntry(filing.accessionNumber).phase !== "idle") return;
|
|
416
|
-
void coordinator.loadSecFilingDocuments(filing).catch(() => {});
|
|
419
|
+
void coordinator.loadSecFilingDocuments(filing).catch(() => { /* Intentional ignore: the coordinator keeps a failed warm-up's error, which the filing shows when opened. */ });
|
|
417
420
|
}, [visibleFilings]);
|
|
418
421
|
|
|
419
422
|
const refresh = useCallback(() => {
|
|
@@ -634,7 +637,7 @@ export const secModule: PluginModule = {
|
|
|
634
637
|
label: "Fund Facts",
|
|
635
638
|
description: "A US-listed fund's fee, NAV, premium or discount, net assets, sponsor, inception and index, a leveraged or inverse fund's daily objective, then the fund's own SEC filings: prospectus updates, shareholder reports, N-CEN and N-PORT.",
|
|
636
639
|
keywords: ["etf", "fund", "expense ratio", "fee", "nav", "premium", "discount", "aum", "net assets", "n-1a", "485bpos", "497", "n-csr", "n-cen", "n-port", "prospectus",
|
|
637
|
-
"leveraged", "inverse", "daily objective", "daily-reset", "decay"],
|
|
640
|
+
"leveraged", "inverse", "daily objective", "daily-reset", "decay", "bond fund", "duration", "dv01", "hedge ratio", "steepener"],
|
|
638
641
|
shortcut: "ETF",
|
|
639
642
|
viewKey: "etf",
|
|
640
643
|
canCreate: (_context, options) => !options?.ticker || mayBeUsEquityOrFundTicker(options.ticker),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { SecFilingItem } from "../../../types/data-provider";
|
|
2
2
|
import { decodeHtmlEntities } from "../../../utils/html-entities";
|
|
3
3
|
import { formatCompact } from "../../../utils/format";
|
|
4
|
+
import { formatFreeformPersonName, formatInsiderName } from "../insider/display";
|
|
4
5
|
import { parseForm4Xml, transactionTypeLabel } from "../insider/insider-data";
|
|
5
6
|
import { buildInsiderTransactionTitle } from "./filing-display";
|
|
6
7
|
|
|
@@ -36,9 +37,20 @@ export function rowSummaryTarget(filing: SecFilingItem): SecFilingItem | null {
|
|
|
36
37
|
return { ...filing, accessionNumber: `${filing.accessionNumber}:${document}`, primaryDocument: document, primaryDocumentUrl: url, filingUrl: url };
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
function
|
|
40
|
-
const
|
|
41
|
-
return decodeHtmlEntities((match
|
|
40
|
+
function tagTexts(xml: string, tag: string): string[] {
|
|
41
|
+
const pattern = new RegExp(`<(?:[\\w.-]+:)?${tag}(?:\\s[^>]*)?>([\\s\\S]*?)<\\/(?:[\\w.-]+:)?${tag}\\s*>`, "gi");
|
|
42
|
+
return [...xml.matchAll(pattern)].map((match) => decodeHtmlEntities((match[1] ?? "").replace(/<[^>]*>/g, "").trim()));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const tagText = (xml: string, tag: string): string => tagTexts(xml, tag)[0] ?? "";
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The reporting owners a Form 3, 4 or 5 names, spelled as filed ("COOK TIMOTHY D"):
|
|
49
|
+
* what a Form 144's free-text seller is recognised by, so one person reads alike on every row.
|
|
50
|
+
*/
|
|
51
|
+
export function ownerNames(form: string, content: string | null | undefined): string[] {
|
|
52
|
+
if (!content || !/^[345](?:\/A)?$/i.test(form.trim())) return [];
|
|
53
|
+
return tagTexts(content, "rptOwnerName").filter(Boolean);
|
|
42
54
|
}
|
|
43
55
|
|
|
44
56
|
const money = (value: number) => `$${formatCompact(value)}`;
|
|
@@ -47,9 +59,10 @@ const money = (value: number) => `$${formatCompact(value)}`;
|
|
|
47
59
|
* A Form 144 is a notice that someone means to sell: who, how many shares
|
|
48
60
|
* and what they were worth when it was filed.
|
|
49
61
|
*/
|
|
50
|
-
function form144Summary(xml: string): RowSummary | null {
|
|
51
|
-
const
|
|
52
|
-
if (!
|
|
62
|
+
function form144Summary(xml: string, knownOwners: readonly string[]): RowSummary | null {
|
|
63
|
+
const filedName = tagText(xml, "nameOfPersonForWhoseAccountTheSecuritiesAreToBeSold");
|
|
64
|
+
if (!filedName) return null;
|
|
65
|
+
const name = formatFreeformPersonName(filedName, knownOwners);
|
|
53
66
|
const shares = Number(tagText(xml, "noOfUnitsSold"));
|
|
54
67
|
const value = Number(tagText(xml, "aggregateMarketValue"));
|
|
55
68
|
const amount = [
|
|
@@ -62,7 +75,7 @@ function form144Summary(xml: string): RowSummary | null {
|
|
|
62
75
|
/** The reporting owner of a Form 3, which lists holdings and no transactions. */
|
|
63
76
|
function initialOwnershipSummary(xml: string): RowSummary | null {
|
|
64
77
|
const name = tagText(xml, "rptOwnerName");
|
|
65
|
-
return name ? { title: `${name}: initial holdings`, direction: null } : null;
|
|
78
|
+
return name ? { title: `${formatInsiderName(name)}: initial holdings`, direction: null } : null;
|
|
66
79
|
}
|
|
67
80
|
|
|
68
81
|
const signedMoney = (value: number) => `${value < 0 ? "-" : "+"}${money(Math.abs(value))}`;
|
|
@@ -86,20 +99,23 @@ function fundFlowSummary(xml: string): RowSummary | null {
|
|
|
86
99
|
/**
|
|
87
100
|
* The row text of a filing whose content has been read, or null when it was
|
|
88
101
|
* not read or says nothing a row can use. An insider form with one
|
|
89
|
-
* transaction says it in full; one with several lists their kinds.
|
|
102
|
+
* transaction says it in full; one with several lists their kinds. Names read
|
|
103
|
+
* as the Insider table writes them; `knownOwners` (`ownerNames` of the
|
|
104
|
+
* insider forms read beside this one) tells a Form 144's seller which way round
|
|
105
|
+
* their name is filed.
|
|
90
106
|
*/
|
|
91
|
-
export function rowSummary(form: string, content: string | null | undefined): RowSummary | null {
|
|
107
|
+
export function rowSummary(form: string, content: string | null | undefined, knownOwners: readonly string[] = []): RowSummary | null {
|
|
92
108
|
if (!content) return null;
|
|
93
109
|
if (FUND_FLOW_FORM.test(form.trim())) return fundFlowSummary(content);
|
|
94
110
|
if (!isOwnershipForm(form)) return null;
|
|
95
111
|
const base = form.trim().replace(/\/A$/i, "");
|
|
96
|
-
if (base === "144") return form144Summary(content);
|
|
112
|
+
if (base === "144") return form144Summary(content, knownOwners);
|
|
97
113
|
const transactions = parseForm4Xml(content);
|
|
98
114
|
const first = transactions[0];
|
|
99
115
|
if (!first) return base === "3" ? initialOwnershipSummary(content) : null;
|
|
100
116
|
const codes = new Set(transactions.map((transaction) => transaction.transactionType));
|
|
101
117
|
const direction = codes.has("P") && !codes.has("S") ? "buy" : codes.has("S") && !codes.has("P") ? "sell" : null;
|
|
102
|
-
if (transactions.length === 1) return { title: `${first.reportedName}: ${buildInsiderTransactionTitle(first)}`, direction };
|
|
118
|
+
if (transactions.length === 1) return { title: `${formatInsiderName(first.reportedName)}: ${buildInsiderTransactionTitle(first)}`, direction };
|
|
103
119
|
const kinds = [...new Set(transactions.map((transaction) => transactionTypeLabel(transaction.transactionType)))];
|
|
104
|
-
return { title: `${first.reportedName}: ${transactions.length} transactions, ${kinds.join(", ")}`, direction };
|
|
120
|
+
return { title: `${formatInsiderName(first.reportedName)}: ${transactions.length} transactions, ${kinds.join(", ")}`, direction };
|
|
105
121
|
}
|