gloomberb 0.20.4 → 0.20.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/README.md +3 -1
- package/README.zh-CN.md +1 -1
- package/bin/gloom +9 -0
- package/bin/without-bun.cjs +98 -0
- package/package.json +4 -1
- package/src/api-client/data.ts +148 -37
- package/src/api-client/hk-tenders.ts +59 -0
- package/src/api-client/index.ts +1 -0
- package/src/api-client/types/econ.ts +30 -0
- package/src/api-client/yield-curves.ts +1 -1
- package/src/app/global-shortcuts.ts +4 -1
- package/src/app/keybindings/actions.ts +6 -0
- package/src/app/keybindings/config.ts +2 -1
- package/src/app/keybindings/index.ts +1 -0
- package/src/app/keybindings/labels.ts +6 -1
- package/src/app/keybindings/resolve.ts +23 -4
- package/src/app/keybindings/terminal-keys.ts +35 -0
- package/src/app/pane-runtime/index.tsx +2 -2
- package/src/app/pane-runtime/ticker-open-runtime.ts +68 -40
- package/src/app.tsx +18 -13
- package/src/architecture/floating-promise-allowlist.json +313 -0
- package/src/architecture/ui-literals-allowlist.json +1 -1
- package/src/capabilities/chart-series.ts +27 -1
- package/src/cli/commands/keybindings.ts +5 -5
- package/src/cli/commands/market.ts +238 -57
- package/src/cli/commands/news-search.ts +81 -14
- package/src/cli/commands/overview.ts +27 -6
- package/src/cli/commands/remote.ts +16 -17
- package/src/cli/commands/system.ts +1 -1
- package/src/cli/commands/ticker.ts +3 -1
- package/src/cli/early-command.ts +2 -0
- package/src/cli/errors.ts +10 -1
- package/src/cli/fx-forward.ts +89 -7
- package/src/cli/fx-pair.ts +1 -1
- package/src/cli/fx-quote-rate.ts +23 -0
- package/src/cli/glossary.ts +19 -5
- package/src/cli/help.ts +1 -0
- package/src/cli/history-rows.ts +5 -3
- package/src/cli/index-roots.ts +5 -4
- package/src/cli/index.ts +40 -3
- package/src/cli/known-gaps.ts +38 -9
- package/src/cli/listing-arg.ts +17 -5
- package/src/cli/name-entries.ts +5 -1
- package/src/cli/not-a-ticker.ts +4 -0
- package/src/cli/options.ts +52 -3
- package/src/cli/output-file.ts +5 -3
- package/src/cli/pane-functions/catalog.ts +15 -0
- package/src/cli/pane-functions/function-help.ts +4 -4
- package/src/cli/pane-functions/headless.ts +9 -4
- package/src/cli/pane-functions/index.ts +6 -4
- package/src/cli/pane-functions/resolver.ts +2 -2
- package/src/cli/result.ts +21 -2
- package/src/cli/spreadsheet-hint.ts +7 -3
- package/src/cli/treasury-yields.ts +5 -3
- package/src/components/chart/composite/legend.tsx +40 -2
- package/src/components/command-bar/pane-settings.ts +2 -2
- package/src/components/command-bar/routes/root/results.ts +6 -2
- package/src/components/command-bar/workflow/tickers.ts +2 -2
- package/src/components/data-table/view.tsx +9 -2
- package/src/components/input-search-bar.tsx +9 -2
- package/src/components/layout/pane/header.tsx +2 -0
- package/src/components/layout/shell/pane/capture.ts +4 -1
- package/src/components/layout/status-bar.tsx +6 -1
- package/src/components/onboarding/first-run-workspace.ts +44 -2
- package/src/components/onboarding/onboarding-frame.tsx +11 -2
- package/src/components/onboarding/onboarding-keyboard.ts +16 -0
- package/src/components/onboarding/onboarding-wizard.tsx +8 -8
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +62 -1
- package/src/components/onboarding/use-onboarding-progress.ts +12 -4
- package/src/components/pane-settings-dialog/desktop.tsx +2 -2
- package/src/components/pane-settings-dialog/tui.tsx +2 -2
- package/src/components/pane-settings-dialog/value.ts +6 -0
- package/src/components/pane-settings-dialog.tsx +3 -3
- package/src/components/reader/detail-reader.tsx +4 -0
- package/src/components/ui/data-table/opentui/index.tsx +11 -4
- package/src/components/ui/data-table/opentui/model.ts +8 -6
- package/src/components/ui/data-table/types.ts +6 -1
- package/src/components/ui/index.ts +1 -1
- package/src/components/ui/page-stack-view.tsx +3 -0
- package/src/components/ui/pane-link-chip.tsx +269 -54
- package/src/components/ui/query-bar.tsx +2 -1
- package/src/components/ui/table-layout.ts +38 -1
- package/src/components/ui/tabs.tsx +97 -19
- package/src/core/state/app/layout-reducer.ts +7 -0
- package/src/core/state/app/layout.ts +44 -7
- package/src/core/state/app/state.ts +1 -1
- package/src/core/state/app/types.ts +22 -2
- package/src/docs/snapshot.json +30 -13
- package/src/market-data/depositary-pair.ts +5 -3
- package/src/market-data/market/change-basis.ts +9 -5
- package/src/market-data/market/dated-previous-close.ts +147 -17
- package/src/market-data/market/status.ts +17 -1
- package/src/market-data/quotes/contributions.ts +2 -0
- package/src/market-data/quotes/listing-enterprise-value.ts +50 -0
- package/src/plugins/builtin/alerts/metric-data.ts +15 -2
- package/src/plugins/builtin/analytics/risk-client.ts +10 -4
- package/src/plugins/builtin/analytics/risk-episodes.ts +5 -4
- package/src/plugins/builtin/analytics/risk-headless.ts +4 -2
- package/src/plugins/builtin/analytics/risk-sectors.ts +91 -0
- package/src/plugins/builtin/awards/index.tsx +1 -1
- package/src/plugins/builtin/backtest/headless.ts +1 -1
- package/src/plugins/builtin/buildout/index.tsx +1 -0
- package/src/plugins/builtin/catalysts/index.tsx +2 -2
- package/src/plugins/builtin/cds/headless.ts +4 -0
- package/src/plugins/builtin/cds/model.ts +0 -6
- package/src/plugins/builtin/chart-composer/formula.ts +16 -3
- package/src/plugins/builtin/chart-composer/headless-schema.ts +2 -0
- package/src/plugins/builtin/chart-composer/headless.ts +4 -2
- package/src/plugins/builtin/chart-composer/index.tsx +1 -0
- package/src/plugins/builtin/chart-composer/presets.ts +1 -0
- package/src/plugins/builtin/chat/content/composer.tsx +5 -4
- package/src/plugins/builtin/chat/content/index.tsx +12 -2
- package/src/plugins/builtin/chat/content/layout-metrics.ts +3 -3
- package/src/plugins/builtin/chat/content/open-targets.ts +3 -3
- package/src/plugins/builtin/chat/layout.ts +5 -2
- package/src/plugins/builtin/chat/message/pane-chip.tsx +61 -40
- package/src/plugins/builtin/chat/message/terminal.tsx +13 -15
- package/src/plugins/builtin/chat/pane-links/previews.ts +51 -5
- package/src/plugins/builtin/chat/pane-links/share-card.ts +36 -0
- package/src/plugins/builtin/cloud/askg/pane.tsx +55 -13
- package/src/plugins/builtin/cloud/askg/tool-display.ts +1 -0
- package/src/plugins/builtin/cloud/terminal-relay/redact.ts +5 -3
- package/src/plugins/builtin/commodity-balances/index.tsx +1 -0
- package/src/plugins/builtin/company-attention/index.tsx +1 -1
- package/src/plugins/builtin/company-kpis/headless.ts +3 -1
- package/src/plugins/builtin/company-kpis/index.tsx +2 -2
- package/src/plugins/builtin/cot/index.tsx +1 -1
- package/src/plugins/builtin/cpi/index.tsx +1 -1
- package/src/plugins/builtin/credit-boards/cdx-pane.tsx +20 -7
- package/src/plugins/builtin/credit-boards/client.ts +8 -0
- package/src/plugins/builtin/credit-boards/headless.ts +4 -1
- package/src/plugins/builtin/credit-boards/model.ts +58 -4
- package/src/plugins/builtin/credit-boards/series.ts +63 -6
- package/src/plugins/builtin/credit-boards/sovr-pane.tsx +3 -2
- package/src/plugins/builtin/credit-conditions/headless.ts +24 -6
- package/src/plugins/builtin/credit-conditions/index.tsx +1 -1
- package/src/plugins/builtin/credit-conditions/model.ts +12 -6
- package/src/plugins/builtin/credit-conditions/series.ts +2 -1
- package/src/plugins/builtin/crypto-board/index.tsx +1 -0
- package/src/plugins/builtin/dividend-yield/index.tsx +1 -0
- package/src/plugins/builtin/doe/index.tsx +1 -1
- package/src/plugins/builtin/earnings-calls/headless.ts +5 -1
- package/src/plugins/builtin/earnings-calls/index.tsx +1 -0
- package/src/plugins/builtin/econ/calendar-model.ts +115 -8
- package/src/plugins/builtin/econ/calendar-source.ts +7 -1
- package/src/plugins/builtin/econ/fred-catalog.ts +3 -1
- package/src/plugins/builtin/econ/index.tsx +42 -8
- package/src/plugins/builtin/econ/types.ts +3 -0
- package/src/plugins/builtin/econ-statistics/index.tsx +1 -0
- package/src/plugins/builtin/econ-statistics/pane.tsx +6 -0
- package/src/plugins/builtin/estimate-revisions/index.tsx +1 -0
- package/src/plugins/builtin/executives/index.tsx +1 -0
- package/src/plugins/builtin/filing-events/index.tsx +1 -0
- package/src/plugins/builtin/fixed-income/index.tsx +3 -0
- package/src/plugins/builtin/futures-curve/headless.ts +3 -3
- package/src/plugins/builtin/futures-curve/index.tsx +1 -1
- package/src/plugins/builtin/futures-curve/model.ts +18 -0
- package/src/plugins/builtin/fx-matrix/index.tsx +44 -14
- package/src/plugins/builtin/gpu/index.tsx +1 -1
- package/src/plugins/builtin/help/functions-table.tsx +1 -1
- package/src/plugins/builtin/help/index.tsx +11 -1
- package/src/plugins/builtin/help/keybindings-editor.tsx +7 -3
- package/src/plugins/builtin/holders/index.tsx +1 -0
- package/src/plugins/builtin/holders/report-header.ts +2 -2
- package/src/plugins/builtin/insider/index.tsx +1 -0
- package/src/plugins/builtin/iv-history/index.tsx +1 -1
- package/src/plugins/builtin/jobs/index.tsx +1 -0
- package/src/plugins/builtin/macro-day/headless.ts +27 -8
- package/src/plugins/builtin/macro-day/index.tsx +1 -1
- package/src/plugins/builtin/macro-day/model.ts +19 -3
- package/src/plugins/builtin/macro-day/pane.tsx +14 -9
- package/src/plugins/builtin/macro-day/releases.ts +25 -7
- package/src/plugins/builtin/market-valuation/index.tsx +1 -0
- package/src/plugins/builtin/market-valuation/pane.tsx +8 -0
- package/src/plugins/builtin/members/index.tsx +1 -1
- package/src/plugins/builtin/mna/index.tsx +1 -0
- package/src/plugins/builtin/news/index.tsx +1 -0
- package/src/plugins/builtin/news/wire/index.tsx +5 -1
- package/src/plugins/builtin/news/wire/news/detail-view.tsx +4 -0
- package/src/plugins/builtin/news/wire/news/list-search.ts +5 -2
- package/src/plugins/builtin/options/index.tsx +1 -0
- package/src/plugins/builtin/options-positioning/index.tsx +1 -0
- package/src/plugins/builtin/pe-band/index.tsx +1 -1
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +25 -0
- package/src/plugins/builtin/portfolio-list/cli/render.ts +20 -3
- package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +5 -1
- package/src/plugins/builtin/portfolio-list/headless.ts +15 -6
- package/src/plugins/builtin/power/index.tsx +1 -1
- package/src/plugins/builtin/realized-vol/index.tsx +1 -1
- package/src/plugins/builtin/research/headless-schema.ts +4 -3
- package/src/plugins/builtin/research/headless.ts +10 -4
- package/src/plugins/builtin/research/index.tsx +4 -0
- package/src/plugins/builtin/research/relative-valuation-columns.ts +145 -47
- package/src/plugins/builtin/research/relative-valuation-currency.ts +31 -0
- package/src/plugins/builtin/research/relative-valuation-headless.ts +25 -8
- package/src/plugins/builtin/research/relative-valuation-model.ts +40 -9
- package/src/plugins/builtin/research/relative-valuation-pane.tsx +3 -2
- package/src/plugins/builtin/research/relative-valuation-peers.ts +2 -2
- package/src/plugins/builtin/research-search/index.tsx +1 -0
- package/src/plugins/builtin/research-search/pane.tsx +8 -0
- package/src/plugins/builtin/revenue-breakdown/index.tsx +1 -0
- package/src/plugins/builtin/reverse-dcf/index.tsx +1 -1
- package/src/plugins/builtin/risk-factors/index.tsx +1 -0
- package/src/plugins/builtin/scanner/headless.ts +52 -13
- package/src/plugins/builtin/seasonality/index.tsx +1 -1
- package/src/plugins/builtin/sec/index.tsx +1 -0
- package/src/plugins/builtin/series-inventory.ts +1 -1
- package/src/plugins/builtin/shared/scanner-capture.ts +11 -3
- package/src/plugins/builtin/shared/series-list-detail.tsx +5 -0
- package/src/plugins/builtin/short-interest/index.tsx +1 -0
- package/src/plugins/builtin/social-mentions/index.tsx +1 -1
- package/src/plugins/builtin/supply-chain/index.tsx +1 -0
- package/src/plugins/builtin/thirteenf/api.ts +47 -4
- package/src/plugins/builtin/thirteenf/data.ts +43 -10
- package/src/plugins/builtin/thirteenf/headless.ts +55 -11
- package/src/plugins/builtin/thirteenf/model.ts +25 -9
- package/src/plugins/builtin/thirteenf/report-notes.ts +27 -6
- package/src/plugins/builtin/thirteenf/types.ts +2 -0
- package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +1 -1
- package/src/plugins/builtin/ticker-detail/data-panes/historical-prices.tsx +8 -7
- package/src/plugins/builtin/ticker-detail/data-panes/history-bars.ts +8 -5
- package/src/plugins/builtin/ticker-detail/financials/model.ts +18 -2
- package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +3 -3
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +6 -6
- package/src/plugins/builtin/ticker-detail/headless.ts +24 -17
- package/src/plugins/builtin/ticker-detail/index.tsx +4 -0
- package/src/plugins/builtin/ticker-detail/overview/model.ts +6 -4
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +6 -4
- package/src/plugins/builtin/time-sales/client.ts +9 -11
- package/src/plugins/builtin/time-sales/index.tsx +1 -1
- package/src/plugins/builtin/treasury-auctions/after.ts +267 -0
- package/src/plugins/builtin/treasury-auctions/cache.ts +54 -5
- package/src/plugins/builtin/treasury-auctions/client.ts +33 -2
- package/src/plugins/builtin/treasury-auctions/headless.ts +150 -22
- package/src/plugins/builtin/treasury-auctions/hk-headless.ts +126 -0
- package/src/plugins/builtin/treasury-auctions/hk-view.tsx +347 -0
- package/src/plugins/builtin/treasury-auctions/hk.ts +363 -0
- package/src/plugins/builtin/treasury-auctions/index.tsx +27 -4
- package/src/plugins/builtin/treasury-auctions/model.ts +264 -28
- package/src/plugins/builtin/treasury-auctions/pane.tsx +176 -41
- package/src/plugins/builtin/treasury-auctions/treasury-direct.ts +5 -2
- package/src/plugins/builtin/treasury-auctions/types.ts +7 -1
- package/src/plugins/builtin/vol-surface/index.tsx +1 -1
- package/src/plugins/builtin/world-venue-map/index.ts +1 -0
- package/src/plugins/builtin/yield-curve/curves.ts +10 -4
- package/src/plugins/builtin/yield-curve/headless.ts +6 -2
- package/src/plugins/builtin/yield-curve/index.tsx +3 -3
- package/src/plugins/builtin/yield-curve/series.ts +10 -0
- package/src/plugins/builtin/yield-curve/world.ts +3 -1
- package/src/portfolio/collection-name.ts +22 -0
- package/src/portfolio/column-values.ts +2 -1
- package/src/public/__snapshots__/public-api.test.ts.snap +4 -0
- package/src/public/remote.ts +7 -1
- package/src/remote/client.ts +191 -11
- package/src/remote/controller-utils.ts +13 -1
- package/src/remote/controller.ts +88 -26
- package/src/remote/endpoint.ts +24 -0
- package/src/remote/form.ts +59 -4
- package/src/remote/resources.ts +44 -18
- package/src/remote/schema.ts +21 -9
- package/src/remote/secrets.ts +12 -0
- package/src/remote/semantic-tree.tsx +14 -2
- package/src/remote/server.ts +2 -1
- package/src/remote/surface.tsx +192 -0
- package/src/remote/types.ts +5 -0
- package/src/renderers/dom/data-table/frozen-column.ts +3 -1
- package/src/renderers/dom/data-table/index.tsx +27 -9
- package/src/renderers/dom/data-table/row.tsx +2 -0
- package/src/renderers/electrobun/bun/desktop/backend.ts +27 -24
- package/src/renderers/electrobun/bun/desktop/detached-windows.ts +3 -3
- package/src/renderers/electrobun/bun/desktop/snapshot-commit.ts +77 -0
- package/src/renderers/electrobun/shared/protocol.ts +4 -0
- package/src/renderers/electrobun/view/backend-rpc.ts +3 -0
- package/src/renderers/electrobun/view/desktop/window/bridge.ts +3 -0
- package/src/renderers/opentui/host.tsx +6 -0
- package/src/series/standalone.ts +2 -2
- package/src/shares/api.ts +21 -4
- package/src/shares/item.ts +73 -0
- package/src/shares/pane-item.ts +205 -0
- package/src/shares/pane.ts +4 -0
- package/src/shares/payload.ts +9 -5
- package/src/sources/gloomberb-cloud/news.ts +2 -0
- package/src/sources/gloomberb-cloud/normalizers.ts +9 -5
- package/src/sources/provider-router/cache.ts +3 -1
- package/src/sync/controller.ts +17 -2
- package/src/sync/other-window-tabs.ts +32 -1
- package/src/sync/react.ts +4 -4
- package/src/tickers/renamed-listings.ts +105 -0
- package/src/tickers/search/index.ts +103 -16
- package/src/time-series/bar-spacing.ts +33 -0
- package/src/time-series/base-series.ts +21 -3
- package/src/time-series/chart-bounds.ts +31 -0
- package/src/time-series/field-catalog.ts +17 -0
- package/src/time-series/fundamentals.ts +143 -11
- package/src/time-series/ice-credit.ts +32 -6
- package/src/time-series/resolve.ts +11 -7
- package/src/time-series/session-bar.ts +78 -9
- package/src/time-series/studies/formula.ts +53 -10
- package/src/time-series/studies/pair.ts +18 -7
- package/src/time-series/studies/units.ts +49 -2
- package/src/time-series/types.ts +12 -0
- package/src/types/desktop-window.ts +2 -0
- package/src/types/financials.ts +7 -0
- package/src/types/headless.ts +8 -0
- package/src/types/plugin-pane-settings.ts +2 -0
- package/src/types/plugin-panes.ts +22 -0
- package/src/utils/central-banks.ts +86 -1
- package/src/utils/cli-output.ts +6 -3
- package/src/utils/datetime-format.ts +12 -3
- package/src/utils/depositary-receipt.ts +28 -3
- package/src/utils/ebitda.ts +128 -0
- package/src/utils/format.ts +1 -1
- package/src/utils/fundamentals.ts +14 -0
- package/src/utils/max-drawdown.ts +97 -16
- package/src/utils/shell-word.ts +13 -0
- package/src/utils/untrusted-text.ts +29 -0
|
@@ -434,8 +434,9 @@ interface HoldingLine {
|
|
|
434
434
|
/**
|
|
435
435
|
* Each line's split factor by row id, new shares per old: 1 when its corporate
|
|
436
436
|
* actions show no split between the filings, null when they could not be read.
|
|
437
|
+
* `late` holds the lines left unread because the lookups' time ran out.
|
|
437
438
|
*/
|
|
438
|
-
export type SplitFactors = ReadonlyMap<string, number | null
|
|
439
|
+
export type SplitFactors = ReadonlyMap<string, number | null> & { readonly late?: ReadonlySet<string> };
|
|
439
440
|
|
|
440
441
|
/**
|
|
441
442
|
* The Est P&L of a line held through the quarter, and the value of the shares
|
|
@@ -490,8 +491,13 @@ export interface FilingQuarterReturn {
|
|
|
490
491
|
percent: number | null;
|
|
491
492
|
/** Lines split between the filings, priced on split-adjusted shares, with the new shares per old (10 for 10:1, 0.1 for 1:10). */
|
|
492
493
|
splits: Array<FilingLine & { ratio: number }>;
|
|
493
|
-
/**
|
|
494
|
-
|
|
494
|
+
/**
|
|
495
|
+
* Lines that moved as across a split whose corporate actions could not be read, left out, largest at the
|
|
496
|
+
* quarter's start first; `late` when the lookups' time ran out before them.
|
|
497
|
+
*/
|
|
498
|
+
skipped: Array<FilingLine & { previousValue: number; late?: boolean }>;
|
|
499
|
+
/** What `skipped` weighed in the book at the quarter's start, as a fraction; null when none is left out or the book has no value. */
|
|
500
|
+
skippedShare: number | null;
|
|
495
501
|
}
|
|
496
502
|
|
|
497
503
|
/** The least change in a line's share count that reads as a split: 3:2. */
|
|
@@ -531,7 +537,11 @@ export function formatSplitRatio(ratio: number): string {
|
|
|
531
537
|
* no factor is known.
|
|
532
538
|
*/
|
|
533
539
|
export function filingSplitCandidates(data: FundDetailData): Array<FilingLine & { id: string }> {
|
|
534
|
-
return buildFundHoldingRows(data)
|
|
540
|
+
return buildFundHoldingRows(data)
|
|
541
|
+
.filter((row) => row.splitUnread)
|
|
542
|
+
// Largest at the start of the quarter first: the lines that weigh most on an estimate are read first.
|
|
543
|
+
.sort((a, b) => (b.previousValue ?? 0) - (a.previousValue ?? 0))
|
|
544
|
+
.map((row) => ({ id: row.id, ticker: row.ticker, issuer: row.issuer }));
|
|
535
545
|
}
|
|
536
546
|
|
|
537
547
|
/**
|
|
@@ -551,20 +561,26 @@ export function filingSplitCandidates(data: FundDetailData): Array<FilingLine &
|
|
|
551
561
|
*/
|
|
552
562
|
export function estimateFilingQuarterReturn(data: FundDetailData, splits: SplitFactors = new Map()): FilingQuarterReturn {
|
|
553
563
|
const adjusted: FilingQuarterReturn["splits"] = [];
|
|
554
|
-
const skipped:
|
|
555
|
-
if (!hasComparable13FQuarter(data)) return { percent: null, splits: adjusted, skipped };
|
|
564
|
+
const skipped: FilingQuarterReturn["skipped"] = [];
|
|
565
|
+
if (!hasComparable13FQuarter(data)) return { percent: null, splits: adjusted, skipped, skippedShare: null };
|
|
556
566
|
let pnl = 0;
|
|
557
567
|
let base = 0;
|
|
568
|
+
let book = 0;
|
|
558
569
|
for (const row of buildFundHoldingRows(data)) {
|
|
570
|
+
book += row.previousValue != null && row.previousValue > 0 ? row.previousValue : 0;
|
|
559
571
|
const estimate = estimateHolding(row, splits);
|
|
560
572
|
const line = { ticker: row.ticker, issuer: row.issuer };
|
|
561
|
-
if (estimate.kind === "unread")
|
|
573
|
+
if (estimate.kind === "unread") {
|
|
574
|
+
skipped.push({ ...line, previousValue: row.previousValue ?? 0, ...(splits.late?.has(row.id) ? { late: true } : {}) });
|
|
575
|
+
}
|
|
562
576
|
if (estimate.kind !== "priced") continue;
|
|
563
577
|
if (estimate.ratio !== 1) adjusted.push({ ...line, ratio: estimate.ratio });
|
|
564
578
|
pnl += estimate.pnl;
|
|
565
579
|
base += estimate.base;
|
|
566
580
|
}
|
|
567
|
-
|
|
581
|
+
skipped.sort((left, right) => right.previousValue - left.previousValue);
|
|
582
|
+
const left = skipped.reduce((sum, line) => sum + line.previousValue, 0);
|
|
583
|
+
return { percent: base > 0 ? (pnl / base) * 100 : null, splits: adjusted, skipped, skippedShare: skipped.length && book > 0 ? left / book : null };
|
|
568
584
|
}
|
|
569
585
|
|
|
570
586
|
export function hasComparable13FQuarter(data: FundDetailData): boolean {
|
|
@@ -672,7 +688,7 @@ export function buildFundHoldingRows(data: FundDetailData | null, splits?: Split
|
|
|
672
688
|
valueChange,
|
|
673
689
|
estimatedPnl: estimate.kind === "priced" ? estimate.pnl : null,
|
|
674
690
|
...(ratio !== 1 ? { splitRatio: ratio } : {}),
|
|
675
|
-
...(estimate.kind === "unread" ? { splitUnread: true } : {}),
|
|
691
|
+
...(estimate.kind === "unread" ? { splitUnread: true, ...(splits?.late?.has(id) ? { splitLate: true } : {}) } : {}),
|
|
676
692
|
sharesChange,
|
|
677
693
|
sharesChangePercent,
|
|
678
694
|
action: comparable ? resolveAction(currentHolding, previousHolding, ratio) : "unknown",
|
|
@@ -140,19 +140,40 @@ export function splitAdjustedText(lines: readonly (SplitLine & { ratio: number }
|
|
|
140
140
|
return `${prefix}: ${listedLines(lines, (line) => `${lineName(line)} ${formatSplitRatio(line.ratio)}`)} (split between the filings, as the corporate actions show)`;
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
/**
|
|
144
|
-
|
|
145
|
-
|
|
143
|
+
/** Why lines that moved as across a split have no figure: their corporate actions could not be read, or the time to read them ran out. */
|
|
144
|
+
function unreadReason(lines: readonly (SplitLine & { late?: boolean })[]): string {
|
|
145
|
+
const late = lines.filter((line) => line.late).length;
|
|
146
|
+
const failed = lines.length - late;
|
|
147
|
+
if (late === 0) return "the corporate actions could not be read to tell";
|
|
148
|
+
if (failed === 0) return "the report ran out of time before reading their corporate actions";
|
|
149
|
+
return `the report ran out of time before reading the corporate actions of ${count(late)}; those of ${count(failed)} could not be read`;
|
|
146
150
|
}
|
|
147
151
|
|
|
152
|
+
/** "4.2%" of a book, or "under 0.1%". */
|
|
153
|
+
function bookShareText(share: number): string {
|
|
154
|
+
return share < 0.001 ? "under 0.1%" : `${(share * 100).toFixed(1)}%`;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* "No Est P&L: XYZ (shares and value per share moved as across a split, and the corporate actions could not be
|
|
159
|
+
* read to tell)": lines left without a figure, in the order given (largest first), `leftOut` opening it, and with
|
|
160
|
+
* `bookShare` what they weighed in the book at the quarter's start.
|
|
161
|
+
*/
|
|
162
|
+
export function splitUnreadText(lines: readonly (SplitLine & { late?: boolean })[], leftOut: string, bookShare?: number | null): string {
|
|
163
|
+
const share = bookShare != null && bookShare > 0 ? `, ${bookShareText(bookShare)} of the book at the quarter's start` : "";
|
|
164
|
+
return `${leftOut}${share}: ${listedLines(lines, lineName)} (shares and value per share moved as across a split, and ${unreadReason(lines)})`;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
type UnreadRow = SplitLine & { splitUnread?: boolean; splitLate?: boolean };
|
|
168
|
+
|
|
148
169
|
/** The note for the lines of a Holdings table left without an Est P&L because their split could not be confirmed: a data limitation, the pane's notice as well as the report's. */
|
|
149
|
-
export function holdingUnreadNotes(rows: readonly
|
|
150
|
-
const unread = rows.filter((row) => row.splitUnread);
|
|
170
|
+
export function holdingUnreadNotes(rows: readonly UnreadRow[]): string[] {
|
|
171
|
+
const unread = rows.filter((row) => row.splitUnread).map((row) => ({ ...row, late: row.splitLate }));
|
|
151
172
|
return unread.length ? [splitUnreadText(unread, "No Est P&L")] : [];
|
|
152
173
|
}
|
|
153
174
|
|
|
154
175
|
/** What a Holdings report says of its lines that moved as across a split: the ones priced split-adjusted (method, so a report's note only), and the ones left without a figure. */
|
|
155
|
-
export function holdingSplitNotes(rows: readonly (
|
|
176
|
+
export function holdingSplitNotes(rows: readonly (UnreadRow & { splitRatio?: number })[]): string[] {
|
|
156
177
|
const adjusted = rows.flatMap((row) => row.splitRatio ? [{ ...row, ratio: row.splitRatio }] : []);
|
|
157
178
|
return [...(adjusted.length ? [splitAdjustedText(adjusted, "Est P&L split-adjusted")] : []), ...holdingUnreadNotes(rows)];
|
|
158
179
|
}
|
|
@@ -195,6 +195,8 @@ export interface FundHoldingRow {
|
|
|
195
195
|
splitRatio?: number;
|
|
196
196
|
/** The line moved as across a split and its corporate actions could not be read to tell: Est P&L is left empty, not priced as a crash or a surge, and its share change stays as filed. */
|
|
197
197
|
splitUnread?: boolean;
|
|
198
|
+
/** With `splitUnread`: the lookups' time ran out before its corporate actions were read. */
|
|
199
|
+
splitLate?: boolean;
|
|
198
200
|
sharesChange: number | null;
|
|
199
201
|
sharesChangePercent: number | null;
|
|
200
202
|
action: HoldingAction;
|
|
@@ -90,7 +90,7 @@ export function adrPairFigures(comparison: DepositaryPairComparison): AdrPairFig
|
|
|
90
90
|
value: comparison.premiumPercent == null ? "—" : premiumText(comparison.premiumPercent),
|
|
91
91
|
...(comparison.premiumPercent == null ? {} : { detail: "at spot" }),
|
|
92
92
|
},
|
|
93
|
-
{ id: "ratio", label: "Ratio", value: adrRatioText(comparison.ratio) ?? `1:${ratioCount(comparison.ratio)}` },
|
|
93
|
+
{ id: "ratio", label: "Ratio", value: adrRatioText(comparison.ratio, comparison.home.symbol) ?? `1:${ratioCount(comparison.ratio)}` },
|
|
94
94
|
];
|
|
95
95
|
}
|
|
96
96
|
|
|
@@ -38,7 +38,8 @@ import {
|
|
|
38
38
|
import { usePaneTicker } from "../../../../state/app/context";
|
|
39
39
|
import { handleRefreshKey, useClampSelectedIndex } from "../../../../components/data-table/table-pane";
|
|
40
40
|
import { useBoundTicker, useTickerRequest } from "../../shared/ticker-request";
|
|
41
|
-
import { DAY_SO_FAR_TEXT, withSessionBar } from "../../../../time-series/session-bar";
|
|
41
|
+
import { DAY_SO_FAR_TEXT, requestedSessionBarSize, withSessionBar } from "../../../../time-series/session-bar";
|
|
42
|
+
import { RANGE_HISTORY_RESOLUTION, type ManualChartResolution } from "../../../../time-series/resolution";
|
|
42
43
|
import {
|
|
43
44
|
formingHistoryBar,
|
|
44
45
|
formingHistoryBarText,
|
|
@@ -130,7 +131,7 @@ interface HistoricalPriceTable {
|
|
|
130
131
|
gapNotices: string[];
|
|
131
132
|
}
|
|
132
133
|
|
|
133
|
-
function buildHistoricalPriceRows(points: PricePoint[], venue: string | undefined, now: number): HistoricalPriceTable {
|
|
134
|
+
function buildHistoricalPriceRows(points: PricePoint[], venue: string | undefined, now: number, requested: ManualChartResolution): HistoricalPriceTable {
|
|
134
135
|
const sorted = points
|
|
135
136
|
.flatMap((point, sourceIndex) => {
|
|
136
137
|
const date = pricePointDate(point);
|
|
@@ -139,7 +140,7 @@ function buildHistoricalPriceRows(points: PricePoint[], venue: string | undefine
|
|
|
139
140
|
}] : [];
|
|
140
141
|
})
|
|
141
142
|
.sort((left, right) => left.date.getTime() - right.date.getTime());
|
|
142
|
-
const size = historyBarSize(sorted.map((entry) => entry.date.getTime()));
|
|
143
|
+
const size = historyBarSize(sorted.map((entry) => entry.date.getTime()), requested);
|
|
143
144
|
const newestDate = sorted.at(-1)?.date.toISOString().slice(0, 10);
|
|
144
145
|
const forming = formingHistoryBar(size, newestDate, venue, now);
|
|
145
146
|
const dayToDate = size === "1d" && sorted.at(-1)?.partial === true;
|
|
@@ -271,16 +272,16 @@ export function HistoricalPricesPane({ focused, width, height }: PaneProps) {
|
|
|
271
272
|
// An index's uncounted 0 volume (^HSI's day built from its quote) is no volume, as `history` and HP's CSV leave it.
|
|
272
273
|
const instrumentType = quote?.instrumentType ?? financials?.quoteMetadata?.instrumentType;
|
|
273
274
|
const points = useMemo(
|
|
274
|
-
() => withSessionBar(data ?? [], quote, { now: Date.now(), venue }).map((point) => {
|
|
275
|
+
() => withSessionBar(data ?? [], quote, { now: Date.now(), venue, ...requestedSessionBarSize(data ?? [], RANGE_HISTORY_RESOLUTION[range]) }).map((point) => {
|
|
275
276
|
if (point.volume == null) return point;
|
|
276
277
|
const volume = indexBarVolume(point.volume, instrumentType);
|
|
277
278
|
return volume === point.volume ? point : { ...point, volume: undefined };
|
|
278
279
|
}),
|
|
279
|
-
[data, instrumentType, quote, venue],
|
|
280
|
+
[data, instrumentType, quote, range, venue],
|
|
280
281
|
);
|
|
281
282
|
const { rows, size, forming, dayToDate, newestDate, gapNotices } = useMemo(
|
|
282
|
-
() => buildHistoricalPriceRows(points, venue, Date.now()),
|
|
283
|
-
[points, venue],
|
|
283
|
+
() => buildHistoricalPriceRows(points, venue, Date.now(), RANGE_HISTORY_RESOLUTION[range]),
|
|
284
|
+
[points, range, venue],
|
|
284
285
|
);
|
|
285
286
|
const integrityNotice = priceHistoryIntegrityNotice(rows.filter((row) => row.point.integrity).length);
|
|
286
287
|
const wickNotice = useMemo(() => priceHistoryWickNotice(points.filter((point) => pricePointWickFlags(point).length > 0).length), [points]);
|
|
@@ -2,7 +2,7 @@ import { BAR_INTERVAL_LABELS } from "../../../../cli/history-rows";
|
|
|
2
2
|
import { periodToDateText } from "../../../../cli/pane-functions/freshness";
|
|
3
3
|
import { barLastSession, barPeriodToDate, type BarPeriod, type BarPeriodToDate } from "../../../../market-data/market/bar-period";
|
|
4
4
|
import { isIntradayDailyBar } from "../../../../market-data/market/period-return";
|
|
5
|
-
import { barSizeFromGap, medianBarGap } from "../../../../time-series/bar-spacing";
|
|
5
|
+
import { barSizeFromGap, medianBarGap, requestedBarSize } from "../../../../time-series/bar-spacing";
|
|
6
6
|
import type { TimeRange } from "../../../../time-series/range";
|
|
7
7
|
import { CHART_RESOLUTION_STEP_MS, type ManualChartResolution } from "../../../../time-series/resolution";
|
|
8
8
|
|
|
@@ -23,13 +23,16 @@ const INTRADAY_BELOW_MS = 0.8 * CHART_RESOLUTION_STEP_MS["1d"];
|
|
|
23
23
|
/**
|
|
24
24
|
* The bar size of a history, read from the usual spacing of its bars
|
|
25
25
|
* (medianBarGap), as `history` reads it, so the gap a holiday leaves does not
|
|
26
|
-
* make daily bars weekly. Daily when there is no gap to read.
|
|
26
|
+
* make daily bars weekly. Daily when there is no gap to read. Daily or longer
|
|
27
|
+
* bars asked for in a size (`requested`, the range's) are that size unless
|
|
28
|
+
* the bars show otherwise (requestedBarSize).
|
|
27
29
|
*/
|
|
28
|
-
export function historyBarSize(times: readonly number[]): HistoryBarSize {
|
|
30
|
+
export function historyBarSize(times: readonly number[], requested?: ManualChartResolution | null): HistoryBarSize {
|
|
29
31
|
const gap = medianBarGap(times);
|
|
30
|
-
if (gap == null) return "1d";
|
|
32
|
+
if (gap == null) return requested ?? "1d";
|
|
31
33
|
if (gap < INTRADAY_BELOW_MS) return INTRADAY_SIZES.find((size) => CHART_RESOLUTION_STEP_MS[size] === gap) ?? "intraday";
|
|
32
|
-
|
|
34
|
+
// Daily or longer bars of a range are the size it asks for: a thin listing's daily bars a week apart are not weekly.
|
|
35
|
+
return requested && isDailyOrLongerBar(requested) ? requestedBarSize(times, requested) : barSizeFromGap(gap);
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
/** Whether a bar of this size covers a day or more, so its date is a day and not a time. */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { FinancialStatement, TickerFinancials } from "../../../../types/financials";
|
|
2
|
+
import { ebitdaLacksDepreciation } from "../../../../utils/ebitda";
|
|
2
3
|
import { fiscalPeriodLabel, ttmPeriodLabel } from "../../../../utils/fiscal-period";
|
|
3
4
|
import { formatPerShareNumber } from "../../../../utils/reported-money";
|
|
4
5
|
import { hasNonIncomeStatementGap } from "../../../../utils/statement-gaps";
|
|
@@ -99,6 +100,18 @@ export function statementMetricValue(
|
|
|
99
100
|
|
|
100
101
|
export const FINANCIAL_COL_W = 18;
|
|
101
102
|
export const FINANCIAL_LABEL_W = 28;
|
|
103
|
+
const FINANCIAL_LABEL_MIN_W = 12;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* The metric column's width in a table `width` cells wide: 28 where a period
|
|
107
|
+
* fits beside it, narrower (down to 12, labels cut with an ellipsis) where it
|
|
108
|
+
* would otherwise take every value off screen, as a 36-column Financials pane
|
|
109
|
+
* once showed nothing but metric names and "more →". The other 6 cells are the
|
|
110
|
+
* pane's padding, the table's, the column gap and the scrollbar.
|
|
111
|
+
*/
|
|
112
|
+
export function financialLabelWidth(width: number): number {
|
|
113
|
+
return Math.max(FINANCIAL_LABEL_MIN_W, Math.min(FINANCIAL_LABEL_W, width - FINANCIAL_COL_W - 6));
|
|
114
|
+
}
|
|
102
115
|
const FINANCIAL_GROWTH_W = 7;
|
|
103
116
|
const FINANCIAL_VALUE_W = FINANCIAL_COL_W - FINANCIAL_GROWTH_W;
|
|
104
117
|
|
|
@@ -181,8 +194,11 @@ function formatFinancialGrowth(growth: number): string {
|
|
|
181
194
|
|
|
182
195
|
export function formatFinancialValue(
|
|
183
196
|
value: number | undefined,
|
|
184
|
-
row: Pick<FinancialTableRow, "format" | "divisor"
|
|
197
|
+
row: Pick<FinancialTableRow, "format" | "divisor"> & { key?: string },
|
|
198
|
+
statement?: FinancialStatement,
|
|
185
199
|
): string {
|
|
200
|
+
// EBITDA is operating income plus D&A: a period that reports no D&A has none, and its cell says why.
|
|
201
|
+
if ((value == null || !Number.isFinite(value)) && row.key === "ebitda" && ebitdaLacksDepreciation(statement)) return "no D&A";
|
|
186
202
|
if (value == null || !Number.isFinite(value)) return "—";
|
|
187
203
|
if (row.format === "eps") return formatPerShareNumber(value);
|
|
188
204
|
if (row.format === "percent") return `${formatNumber(value * 100, 1)}%`;
|
|
@@ -629,7 +645,7 @@ export function buildFinancialTableModel(
|
|
|
629
645
|
|| !canCompareFinancialRow(row, statement, previous, comparisonCurrency)
|
|
630
646
|
? undefined : computeGrowth(value, previousValue);
|
|
631
647
|
return {
|
|
632
|
-
...formatFinancialCell(formatFinancialValue(value, row), growth),
|
|
648
|
+
...formatFinancialCell(formatFinancialValue(value, row, statement), growth),
|
|
633
649
|
value,
|
|
634
650
|
growth,
|
|
635
651
|
semanticGrowth: semanticGrowthValue(growth, row.growthDirection),
|
|
@@ -12,7 +12,7 @@ import type { PricePoint } from "../../../../types/financials";
|
|
|
12
12
|
import { padTo } from "../../../../utils/format";
|
|
13
13
|
import { useBoundTicker, useTickerRequest } from "../../shared/ticker-request";
|
|
14
14
|
import type { FinancialTableStatement } from "./aggregation";
|
|
15
|
-
import { FINANCIAL_COL_W,
|
|
15
|
+
import { FINANCIAL_COL_W, financialLabelWidth } from "./model";
|
|
16
16
|
import { loadPeriodEndHistory } from "./period-end-history";
|
|
17
17
|
import {
|
|
18
18
|
formatRatioInput,
|
|
@@ -170,6 +170,6 @@ export function RatioTable({
|
|
|
170
170
|
);
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
export function ratioMetricColumn(): RatioTableColumn {
|
|
174
|
-
return { id: "metric", kind: "metric", label: "Ratio", width:
|
|
173
|
+
export function ratioMetricColumn(width: number): RatioTableColumn {
|
|
174
|
+
return { id: "metric", kind: "metric", label: "Ratio", width: financialLabelWidth(width), align: "left" };
|
|
175
175
|
}
|
|
@@ -19,7 +19,7 @@ import { padTo } from "../../../../utils/format";
|
|
|
19
19
|
import { filledPeriodsNote, stalePeriodNote } from "../../../../utils/financial-statements";
|
|
20
20
|
import {
|
|
21
21
|
FINANCIAL_COL_W,
|
|
22
|
-
|
|
22
|
+
financialLabelWidth,
|
|
23
23
|
FINANCIAL_SUB_TABS,
|
|
24
24
|
buildFinancialRows,
|
|
25
25
|
canCompareFinancialRow,
|
|
@@ -305,7 +305,7 @@ export function ResolvedFinancialsTab({
|
|
|
305
305
|
id: "metric",
|
|
306
306
|
kind: "metric",
|
|
307
307
|
label: "Metric",
|
|
308
|
-
width:
|
|
308
|
+
width: financialLabelWidth(width),
|
|
309
309
|
align: "left",
|
|
310
310
|
},
|
|
311
311
|
...displayStatements.map((statement, index): FinancialTableColumn => ({
|
|
@@ -323,7 +323,7 @@ export function ResolvedFinancialsTab({
|
|
|
323
323
|
align: "right",
|
|
324
324
|
headerColor: statement.date === "TTM" ? colors.textBright : colors.textDim,
|
|
325
325
|
})),
|
|
326
|
-
], [annualDates, comparisonCurrency, displayStatements, isAnnual, yearEndMonth]);
|
|
326
|
+
], [annualDates, comparisonCurrency, displayStatements, isAnnual, width, yearEndMonth]);
|
|
327
327
|
const { rows, unit } = useMemo(
|
|
328
328
|
() => shareFinancialUnit(buildFinancialRows(subTab.rows, displayStatements, collapsedGroups)),
|
|
329
329
|
[collapsedGroups, displayStatements, subTab.rows],
|
|
@@ -385,7 +385,7 @@ export function ResolvedFinancialsTab({
|
|
|
385
385
|
const growth = (row.kind === "metric" && !row.showGrowth)
|
|
386
386
|
|| !canCompareFinancialRow(row, column.statement, previous, comparisonCurrency)
|
|
387
387
|
? undefined : computeGrowth(value, previousValue);
|
|
388
|
-
const formattedValue = formatFinancialValue(value, row);
|
|
388
|
+
const formattedValue = formatFinancialValue(value, row, column.statement);
|
|
389
389
|
const cell = formatFinancialCell(formattedValue, growth);
|
|
390
390
|
const growthColorValue = semanticGrowthValue(growth, row.growthDirection);
|
|
391
391
|
|
|
@@ -440,9 +440,9 @@ export function ResolvedFinancialsTab({
|
|
|
440
440
|
isValuation, quarterlyStatements, ratioTab, resolvedPeriod, financials?.profile,
|
|
441
441
|
]);
|
|
442
442
|
const ratioColumns = useMemo<RatioTableColumn[]>(() => [
|
|
443
|
-
ratioMetricColumn(),
|
|
443
|
+
ratioMetricColumn(width),
|
|
444
444
|
...columns.flatMap((column, index) => column.kind === "statement" ? [{ ...column, index: index - 1 }] : []),
|
|
445
|
-
], [columns]);
|
|
445
|
+
], [columns, width]);
|
|
446
446
|
|
|
447
447
|
// The Balance Sheet and Liquidity show cash, which an offering filed since the latest balance sheet is not in yet.
|
|
448
448
|
const { symbol: boundSymbol, exchange: boundExchange } = useBoundTicker();
|
|
@@ -45,11 +45,13 @@ import {
|
|
|
45
45
|
quotedPriceDivisor,
|
|
46
46
|
} from "../../../cli/history-rows";
|
|
47
47
|
import { formatUtcTime } from "../../../utils/utc-time";
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
48
|
+
import { closeMoves } from "../../../utils/max-drawdown";
|
|
49
|
+
import { isYieldIndexSymbol } from "../../../tickers/index-roots";
|
|
50
|
+
import { parsePublicTickerKey } from "../../../utils/exchanges";
|
|
51
|
+
import { isPastPriceWindow, loadPriceWindowHistory, priceWindowInterval, priceWindowText, readPriceWindow, type PriceWindow } from "../../../utils/price-window";
|
|
50
52
|
import { historyCoverageNotice } from "../../../sources/history-coverage";
|
|
51
53
|
import { getChartResolutionLabel, isIntradayResolution, RANGE_HISTORY_RESOLUTION, type ManualChartResolution } from "../../../time-series/resolution";
|
|
52
|
-
import { DAY_SO_FAR_TEXT, withSessionBar } from "../../../time-series/session-bar";
|
|
54
|
+
import { DAY_SO_FAR_TEXT, requestedSessionBarSize, withSessionBar } from "../../../time-series/session-bar";
|
|
53
55
|
import { buildReturnRows, closedMarketNote, isTodayReturnRow, returnBaseCloseDay, type ReturnRange } from "./data-panes/returns-model";
|
|
54
56
|
import { periodBaseText } from "../../../market-data/market/period-return";
|
|
55
57
|
import { loadReturnSeries } from "./data-panes/returns-history";
|
|
@@ -111,7 +113,8 @@ export const financialStatementsHeadless: HeadlessPaneDefinition<"rows"> = {
|
|
|
111
113
|
const receiptPeriods = table?.statements.filter(({ shareBasis }) => shareBasis === "depositary_receipt").map(({ date }) => date) ?? [];
|
|
112
114
|
const allReceipts = receiptPeriods.length > 0 && receiptPeriods.length === table?.statements.length;
|
|
113
115
|
const shareBases = new Set(table?.statements.map(({ shareBasis }) => shareBasis ?? null));
|
|
114
|
-
const ratio = adrRatioText(financials.fundamentals?.adrRatio ?? financials.quote?.adrRatio
|
|
116
|
+
const ratio = adrRatioText(financials.fundamentals?.adrRatio ?? financials.quote?.adrRatio,
|
|
117
|
+
(financials.fundamentals?.depositaryPair ?? financials.quote?.depositaryPair)?.ordinary[0]);
|
|
115
118
|
const shareBasisNotice = receiptPeriods.length === 0 || !table?.rows.some(isPerShareFinancialRow) ? null
|
|
116
119
|
: allReceipts
|
|
117
120
|
? `Share counts are in ADRs and EPS is per ADR${ratio ? `; ${ratio}` : ""}.`
|
|
@@ -414,7 +417,9 @@ export const historicalPricesHeadless: HeadlessPaneDefinition<"rows"> = {
|
|
|
414
417
|
// The venue whose sessions say whether a day, week or month is still running: the key's, or for a bare symbol its quote's.
|
|
415
418
|
const venue = exchange || quote?.listingExchangeName || quote?.exchangeName || undefined;
|
|
416
419
|
const now = Date.now();
|
|
417
|
-
|
|
420
|
+
// The bars the range or window asks for: a thin listing's daily bars a week or two apart are still daily.
|
|
421
|
+
const requested = window ? priceWindowInterval(window) : RANGE_HISTORY_RESOLUTION[range];
|
|
422
|
+
const points = withSessionBar(loaded, quote, { now, venue, ...requestedSessionBarSize(loaded, requested) });
|
|
418
423
|
// Providers serve float32 prices (4013.39990234 for 4013.4): the rows hold the decimal each is, as `history` does,
|
|
419
424
|
// a London line's cleaned in the pence it was priced in.
|
|
420
425
|
const priceDivisor = quotedPriceDivisor(quote);
|
|
@@ -433,7 +438,7 @@ export const historicalPricesHeadless: HeadlessPaneDefinition<"rows"> = {
|
|
|
433
438
|
};
|
|
434
439
|
}).sort((left, right) => left.date.localeCompare(right.date));
|
|
435
440
|
const notice = priceHistoryIntegrityNotice(rows.filter((row) => row.integrity).length);
|
|
436
|
-
const size = historyBarSize(rows.map((row) => Date.parse(row.date)));
|
|
441
|
+
const size = historyBarSize(rows.map((row) => Date.parse(row.date)), requested);
|
|
437
442
|
// A weekly or monthly bar whose period runs on is dated by how far it runs, as `history` dates it.
|
|
438
443
|
const forming = formingHistoryBar(size, rows.at(-1)?.date, venue, now);
|
|
439
444
|
// A complete one is dated by the day its last session closed, the day its close is from.
|
|
@@ -461,13 +466,12 @@ export const historicalPricesHeadless: HeadlessPaneDefinition<"rows"> = {
|
|
|
461
466
|
...(forming ? { periodToDate: forming } : closedDay ? { asOf: closedDay } : quotedAt ? { asOf: quotedAt } : {}),
|
|
462
467
|
...(dayToDate ? { basis: "daily bars", note: `the newest bar is ${DAY_SO_FAR_TEXT}`, ...(quote ? { asOf: new Date(quote.lastUpdated).toISOString() } : {}) } : {}),
|
|
463
468
|
};
|
|
464
|
-
// The largest fall from a close to a later one in the bars shown, said under the title.
|
|
465
|
-
const drawdown =
|
|
466
|
-
|
|
467
|
-
date: (value) => isDailyOrLongerBar(size) ? value.slice(0, 10) : formatUtcTime(value) }) : null;
|
|
469
|
+
// The largest fall from a close to a later one in the bars shown, said under the title; a yield's in bp, with its largest rise.
|
|
470
|
+
const { drawdown, runUp, lines: moveLines } = closeMoves(shown, drawdownScaleOf(symbol), { basis: `${historyBarSizeWord(size)} closes`,
|
|
471
|
+
price: (value) => formatBarPrice(value, decimals), date: (value) => isDailyOrLongerBar(size) ? value.slice(0, 10) : formatUtcTime(value) });
|
|
468
472
|
// A wick left out of the range is said, though the bar's close still counts.
|
|
469
473
|
const wickNotice = priceHistoryWickNotice(points.filter((point) => pricePointWickFlags(point).length > 0).length);
|
|
470
|
-
const reportNotices = [
|
|
474
|
+
const reportNotices = [...moveLines, notice, wickNotice].filter((line): line is string => line != null);
|
|
471
475
|
return {
|
|
472
476
|
rows: shown,
|
|
473
477
|
columns: historyColumns(size, marked, false, false, decimals),
|
|
@@ -478,7 +482,7 @@ export const historicalPricesHeadless: HeadlessPaneDefinition<"rows"> = {
|
|
|
478
482
|
...(notice ? { complete: false } : {}),
|
|
479
483
|
unavailableSymbols: rows.some((row) => row.close !== null) ? [] : [symbol],
|
|
480
484
|
metadata: { symbol, range: window ? null : range, ...(window ? { requestedWindow: window } : {}), ...(size === "intraday" ? {} : { interval: size }),
|
|
481
|
-
...(allStart ? { sourceStart: allStart } : {}), maxDrawdown: drawdown,
|
|
485
|
+
...(allStart ? { sourceStart: allStart } : {}), maxDrawdown: drawdown, ...(runUp ? { maxRunUp: runUp } : {}),
|
|
482
486
|
...(reportNotices.length ? { notices: reportNotices } : {}) },
|
|
483
487
|
};
|
|
484
488
|
},
|
|
@@ -535,10 +539,9 @@ export const returnsHeadless: HeadlessPaneDefinition<"rows"> = {
|
|
|
535
539
|
const dayToDate = isTodayReturnRow(returns.at(-1), series.resolution, venue, now);
|
|
536
540
|
const rows = forming || dayToDate ? [...unmarked.slice(0, -1), { ...unmarked.at(-1)!, partial: true }] : unmarked;
|
|
537
541
|
const price = (value: unknown) => typeof value === "number" && Number.isFinite(value) ? value.toFixed(decimals) : "-";
|
|
538
|
-
// The largest fall from a close to a later one in the window, said under the title.
|
|
539
|
-
const drawdown =
|
|
540
|
-
|
|
541
|
-
date: (value) => intraday ? formatUtcTime(value) : value.slice(0, 10) }) : null;
|
|
542
|
+
// The largest fall from a close to a later one in the window, said under the title; a yield's in bp, with its largest rise.
|
|
543
|
+
const { drawdown, runUp, lines: moveLines } = closeMoves(unmarked.map((row) => ({ date: row.time, close: row.close })), drawdownScaleOf(symbol),
|
|
544
|
+
{ basis: `${BAR_INTERVAL_LABELS[series.resolution]} closes`, price, date: (value) => intraday ? formatUtcTime(value) : value.slice(0, 10) });
|
|
542
545
|
const figures: HeadlessPaneColumn[] = [
|
|
543
546
|
{ key: "close", header: "Price", align: "right", format: price },
|
|
544
547
|
{ key: "intervalChange", header: "Int $", align: "right", format: price },
|
|
@@ -565,7 +568,7 @@ export const returnsHeadless: HeadlessPaneDefinition<"rows"> = {
|
|
|
565
568
|
const textColumns: HeadlessPaneColumn[] = [timeColumn(true), ...textFigures];
|
|
566
569
|
// An interval the range is too long for is served in the nearest longer bar; say so rather than switch silently.
|
|
567
570
|
const notices = [
|
|
568
|
-
|
|
571
|
+
...moveLines,
|
|
569
572
|
baseDay ? `Totals ${periodBaseText(baseDay, now)}.` : null,
|
|
570
573
|
series.resolution !== requested
|
|
571
574
|
? `${getChartResolutionLabel(requested)} bars do not ${window ? `cover ${priceWindowText(window)}` : `reach back ${range}`}; these are ${getChartResolutionLabel(series.resolution)} bars.`
|
|
@@ -605,8 +608,12 @@ export const returnsHeadless: HeadlessPaneDefinition<"rows"> = {
|
|
|
605
608
|
...(series.lastSession ? { marketClosed: true, lastSession: series.lastSession } : {}),
|
|
606
609
|
basis: "Price returns of bar closes; dividends are not included",
|
|
607
610
|
maxDrawdown: drawdown,
|
|
611
|
+
...(runUp ? { maxRunUp: runUp } : {}),
|
|
608
612
|
...(notices.length ? { notices } : {}),
|
|
609
613
|
},
|
|
610
614
|
};
|
|
611
615
|
},
|
|
612
616
|
};
|
|
617
|
+
|
|
618
|
+
/** A Cboe yield index (^TNX) moves by its level, in bp; anything else by its return. */
|
|
619
|
+
const drawdownScaleOf = (symbol: string) => isYieldIndexSymbol(parsePublicTickerKey(symbol).symbol) ? "yield" as const : "return" as const;
|
|
@@ -45,6 +45,7 @@ export const tickerDetailModule: PluginModule = {
|
|
|
45
45
|
icon: "D",
|
|
46
46
|
get component(): typeof import("./pane").TickerResearchPane { const { TickerResearchPane } = require("./pane"); return TickerResearchPane; },
|
|
47
47
|
defaultPosition: "right",
|
|
48
|
+
shareItem: { ticker: true },
|
|
48
49
|
tickerFollower: true,
|
|
49
50
|
// DES and ADR open this pane; ADR's window is named by its params (the tab it asked for), so settings never say whose a window is.
|
|
50
51
|
identitySettings: [],
|
|
@@ -71,6 +72,7 @@ export const tickerDetailModule: PluginModule = {
|
|
|
71
72
|
get component(): typeof import("./financials/pane").FinancialAnalysisPane { const { FinancialAnalysisPane } = require("./financials/pane"); return FinancialAnalysisPane; },
|
|
72
73
|
headless: financialStatementsHeadless,
|
|
73
74
|
defaultPosition: "right",
|
|
75
|
+
shareItem: { ticker: true },
|
|
74
76
|
tickerFollower: true,
|
|
75
77
|
defaultMode: "floating",
|
|
76
78
|
defaultFloatingSize: { width: 98, height: 30 },
|
|
@@ -100,6 +102,7 @@ export const tickerDetailModule: PluginModule = {
|
|
|
100
102
|
get component(): typeof import("./data-panes/historical-prices").HistoricalPricesPane { const { HistoricalPricesPane } = require("./data-panes/historical-prices"); return HistoricalPricesPane; },
|
|
101
103
|
headless: historicalPricesHeadless,
|
|
102
104
|
defaultPosition: "right",
|
|
105
|
+
shareItem: { ticker: true },
|
|
103
106
|
tickerFollower: true,
|
|
104
107
|
defaultMode: "floating",
|
|
105
108
|
defaultFloatingSize: { width: 92, height: 26 },
|
|
@@ -113,6 +116,7 @@ export const tickerDetailModule: PluginModule = {
|
|
|
113
116
|
get component(): typeof import("./data-panes/returns-pane").ReturnsPane { const { ReturnsPane } = require("./data-panes/returns-pane"); return ReturnsPane; },
|
|
114
117
|
headless: returnsHeadless,
|
|
115
118
|
defaultPosition: "right",
|
|
119
|
+
shareItem: { ticker: true },
|
|
116
120
|
tickerFollower: true,
|
|
117
121
|
defaultMode: "floating",
|
|
118
122
|
defaultFloatingSize: { width: 100, height: 28 },
|
|
@@ -31,7 +31,7 @@ import { getPortfolioPositionMetrics, getPortfolioQuoteDisplay, resolvePortfolio
|
|
|
31
31
|
import { listingDividendYield, liveForwardPE, liveMarketCapitalization, liveTrailingPE } from "../../../../market-data/quotes/live-valuation";
|
|
32
32
|
import { atRegularSessionPrice } from "../../../../market-data/quotes/regular-session-valuation";
|
|
33
33
|
import { formatReportedMoney, REPORTING_CURRENCY_NOT_SOURCED } from "../../../../utils/reported-money";
|
|
34
|
-
import { enterpriseValueCheck, enterpriseValueNotMeaningful, fundamentalsCurrency, isBankEnterpriseValue, fundamentalsEpsCurrency, reportedEnterpriseValue } from "../../../../utils/fundamentals";
|
|
34
|
+
import { enterpriseValueCheck, enterpriseValueGapIsLarge, enterpriseValueNotMeaningful, fundamentalsCurrency, isBankEnterpriseValue, fundamentalsEpsCurrency, reportedEnterpriseValue } from "../../../../utils/fundamentals";
|
|
35
35
|
import { formatShortDate } from "../../../../utils/datetime-format";
|
|
36
36
|
import { safeExternalUrl } from "../../../../utils/external-url";
|
|
37
37
|
import type { FundBondFacts } from "../../../../api-client/fund-facts";
|
|
@@ -232,7 +232,7 @@ export function buildOverviewStats({
|
|
|
232
232
|
const { pair, receiptSide } = depositaryPair;
|
|
233
233
|
const count = ratioCount(pair.ratio);
|
|
234
234
|
stats.push(receiptSide
|
|
235
|
-
? { label: "ADR Ratio", value: `1:${count}`, detail: [adrRatioText(pair.ratio)!, `${count} sh per ADR`], link: ADR_PAIR }
|
|
235
|
+
? { label: "ADR Ratio", value: `1:${count}`, detail: [adrRatioText(pair.ratio, pair.ordinary[0])!, `${count} sh per ADR`], link: ADR_PAIR }
|
|
236
236
|
: { label: "ADR", value: pair.receipt, detail: [`1 ADR = ${count} of these shares`, `1:${count}`], link: ADR_PAIR });
|
|
237
237
|
}
|
|
238
238
|
if (cedearRatio) {
|
|
@@ -334,9 +334,11 @@ export function buildOverviewStats({
|
|
|
334
334
|
} else if (fundamentals?.unavailableFields?.includes("enterpriseValue")) {
|
|
335
335
|
stats.push({ label: "EV", value: "—" });
|
|
336
336
|
} else if (enterpriseValue != null) {
|
|
337
|
-
// More than
|
|
337
|
+
// More than 10% from market cap + debt - cash: the provider's, with the computed figure where it fits.
|
|
338
|
+
// Closer than that it is the valuation panes' detail (enterpriseValueGapIsLarge).
|
|
338
339
|
const check = enterpriseValueCheck(priced);
|
|
339
|
-
const computed = check?.status === "differs" && check.computed != null
|
|
340
|
+
const computed = check?.status === "differs" && check.computed != null && enterpriseValueGapIsLarge(priced)
|
|
341
|
+
? formatCompact(check.computed) : undefined;
|
|
340
342
|
stats.push({
|
|
341
343
|
label: "EV",
|
|
342
344
|
value: formatCompactCurrency(enterpriseValue, quoteCurrency),
|
|
@@ -38,7 +38,7 @@ import type { TickerRecord } from "../../../types/ticker";
|
|
|
38
38
|
import { Box, ScrollBox, Text, useUiCapabilities } from "../../../ui";
|
|
39
39
|
import { publicTickerKey, resolveExchangeTimeZone } from "../../../utils/exchanges";
|
|
40
40
|
import { convertCurrency, displayWidth, formatPercentRaw, truncateToDisplayWidth } from "../../../utils/format";
|
|
41
|
-
import { appTtmRate, enterpriseValueReconciliationNote, ttmAtAppRate, ttmConversionNote, withBankEnterpriseValue } from "../../../utils/fundamentals";
|
|
41
|
+
import { appTtmRate, enterpriseValueGapIsLarge, enterpriseValueReconciliationNote, ttmAtAppRate, ttmConversionNote, withBankEnterpriseValue } from "../../../utils/fundamentals";
|
|
42
42
|
import { atRegularSessionPrice } from "../../../market-data/quotes/regular-session-valuation";
|
|
43
43
|
import { zonedDateKey } from "../../../utils/zoned-date-time";
|
|
44
44
|
import { sharesOutstandingInReceipts } from "../../../utils/depositary-receipt";
|
|
@@ -250,9 +250,11 @@ function ResolvedOverviewTab({ width, height, focused = false, ticker, financial
|
|
|
250
250
|
panelId: "price",
|
|
251
251
|
timeBasis: chartTimeZone ? { kind: "market", timeZone: chartTimeZone } : undefined,
|
|
252
252
|
});
|
|
253
|
-
// A provider EV off market cap + debt - cash, or why a withdrawn one is unavailable, at the
|
|
254
|
-
// regular session price the EV beside it is shown at.
|
|
255
|
-
const
|
|
253
|
+
// A provider EV well off market cap + debt - cash, or why a withdrawn one is unavailable, at the
|
|
254
|
+
// regular session price the EV beside it is shown at. A gap of a few percent is the valuation panes' detail.
|
|
255
|
+
const pricedForEnterpriseValue = atRegularSessionPrice({ quote, fundamentals: withBankEnterpriseValue(fundamentals, profile) }).fundamentals;
|
|
256
|
+
const enterpriseValueNote = enterpriseValueGapIsLarge(pricedForEnterpriseValue)
|
|
257
|
+
? enterpriseValueReconciliationNote(pricedForEnterpriseValue) : undefined;
|
|
256
258
|
// Months of cash, for a company that burns it, and an offering since its balance sheet that the cash is not in yet.
|
|
257
259
|
const runway = useMemo(() => financials ? cashRunway(financials) : null, [financials]);
|
|
258
260
|
const runwayOfferingNote = useOfferingNote(ticker.metadata.ticker, ticker.metadata.exchange, runway?.periodEnd ?? null, runway?.trailing?.kind === "months");
|
|
@@ -61,25 +61,23 @@ export function validateTape(data: TapeSnapshot, symbol: string, exchange: strin
|
|
|
61
61
|
/** The latest tape, or with a `range` that window of the session. */
|
|
62
62
|
export async function fetchTape(symbol: string, exchange: string, signal?: AbortSignal,
|
|
63
63
|
client: Pick<typeof apiClient, "getCloudTape"> = apiClient, range?: TapeRange): Promise<TapeSnapshot> {
|
|
64
|
-
|
|
64
|
+
// The tape names US venues by their codes: a listing found as NYSEARCA is asked as ARCA, as it is answered.
|
|
65
|
+
const venue = canonicalExchange(exchange);
|
|
66
|
+
try { return validateTape(await (range ? client.getCloudTape(symbol, venue, signal, range) : client.getCloudTape(symbol, venue, signal)), symbol, exchange); }
|
|
65
67
|
catch (error) {
|
|
66
68
|
if (error instanceof ApiRequestError && [404, 503].includes(error.status ?? 0)) throw new Error("Time and sales is not available yet.");
|
|
67
69
|
// A rejected request answers with an unavailable snapshot; show its reason, not the JSON body.
|
|
68
70
|
if (error instanceof ApiRequestError) {
|
|
69
|
-
const reason =
|
|
71
|
+
const reason = tapeGap(error.details);
|
|
70
72
|
if (reason) throw new Error(reason);
|
|
71
73
|
}
|
|
72
74
|
throw error;
|
|
73
75
|
}
|
|
74
76
|
}
|
|
75
77
|
|
|
76
|
-
/** The first stated gap of an unavailable tape snapshot
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
return Array.isArray(value?.gaps) && typeof value.gaps[0] === "string" ? value.gaps[0] : null;
|
|
81
|
-
} catch {
|
|
82
|
-
// Intentional ignore: an error body that is not JSON names no gap, so the request's own error stands.
|
|
83
|
-
return null;
|
|
84
|
-
}
|
|
78
|
+
/** The first stated gap of an unavailable tape snapshot, as the request's parsed error body holds it. */
|
|
79
|
+
function tapeGap(details: Readonly<Record<string, unknown>> | undefined): string | null {
|
|
80
|
+
const gaps = details?.gaps;
|
|
81
|
+
return Array.isArray(gaps) && typeof gaps[0] === "string" ? gaps[0] : null;
|
|
85
82
|
}
|
|
83
|
+
|
|
@@ -3,7 +3,7 @@ import { createTickerSurfacePaneTemplate } from "../shared/ticker-surface";
|
|
|
3
3
|
import { quoteRecapHeadless, timeSalesHeadless } from "./headless";
|
|
4
4
|
export const timeSalesModule: PluginModule = {
|
|
5
5
|
panes: [{ id: "time-sales", name: "Time and Sales", icon: "T", get component(): typeof import("./pane").TimeSalesPane { const { TimeSalesPane } = require("./pane"); return TimeSalesPane; },
|
|
6
|
-
defaultPosition: "right", tickerFollower: true, defaultMode: "floating", defaultFloatingSize: { width: 104, height: 28 },
|
|
6
|
+
defaultPosition: "right", shareItem: { ticker: true }, tickerFollower: true, defaultMode: "floating", defaultFloatingSize: { width: 104, height: 28 },
|
|
7
7
|
tableExport: true, headless: timeSalesHeadless, settings: { title: "Time and Sales", fields: [{ key: "tab", label: "View", type: "select", options: [{ value: "trades", label: "Trades" }, { value: "quotes", label: "NBBO" }] }] } }],
|
|
8
8
|
paneTemplates: [
|
|
9
9
|
{ ...createTickerSurfacePaneTemplate({ id: "time-sales-tas", paneId: "time-sales", label: "Time and Sales",
|