@gloom-sh/terminal 0.20.10 → 0.20.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -1
- package/patches/@opentui%2Fcore@0.3.2.patch +16 -0
- package/src/api-client/awards.ts +16 -0
- package/src/api-client/central-bank-rates.ts +5 -0
- package/src/api-client/data.ts +55 -2
- package/src/api-client/index.ts +18 -1
- package/src/api-client/request.ts +86 -3
- package/src/api-client/socket-connection.ts +366 -0
- package/src/api-client/socket-features.ts +75 -0
- package/src/api-client/socket-frames.ts +161 -0
- package/src/api-client/socket-listeners.ts +207 -0
- package/src/api-client/socket-quotes.ts +332 -0
- package/src/api-client/socket.ts +168 -983
- package/src/api-client/supply-chain-graph.ts +4 -2
- package/src/api-client/supply-chain.ts +8 -0
- package/src/api-client/types/econ.ts +10 -7
- package/src/api-client/types/filings-and-calls.ts +8 -0
- package/src/app/global-shortcuts.ts +2 -1
- package/src/app/keybindings/actions.ts +19 -0
- package/src/app/pane-runtime/index.tsx +18 -3
- package/src/app/pane-runtime/layout-placement.ts +63 -0
- package/src/app/pane-runtime/ticker-open-runtime.ts +10 -2
- package/src/brokers/signed-in/adapter.ts +19 -5
- package/src/brokers/signed-in/client.ts +13 -1
- package/src/brokers/signed-in/sign-in-dialog.tsx +33 -9
- package/src/capabilities/chart-series.ts +4 -1
- package/src/cli/board-coins.ts +10 -1
- package/src/cli/commands/crypto-hints.ts +3 -2
- package/src/cli/commands/fred-series.ts +0 -54
- package/src/cli/commands/market.ts +209 -31
- package/src/cli/commands/overview.ts +47 -14
- package/src/cli/commands/search.ts +37 -8
- package/src/cli/commands/ticker.ts +15 -4
- package/src/cli/desktop-pane-shot.ts +27 -2
- package/src/cli/fx-quote-rate.ts +1 -1
- package/src/cli/glossary.ts +14 -5
- package/src/cli/history-catalog-series.ts +85 -0
- package/src/cli/index.ts +1 -1
- package/src/cli/list-progress.ts +45 -0
- package/src/cli/listing-arg.ts +71 -7
- package/src/cli/name-entries.ts +8 -4
- package/src/cli/not-a-ticker.ts +2 -2
- package/src/cli/pane-functions/freshness.ts +50 -3
- package/src/cli/pane-functions/index.ts +7 -4
- package/src/cli/pane-functions/market-session.ts +66 -14
- package/src/cli/pane-functions/options.ts +5 -0
- package/src/cli/pane-functions/resolver.ts +9 -2
- package/src/cli/pane-functions/screenshot-assessment.ts +28 -3
- package/src/cli/pane-functions/screenshot-types.ts +6 -0
- package/src/cli/quote-answer.ts +49 -10
- package/src/cli/quote-list-reads.ts +87 -0
- package/src/cli/report-tables.ts +70 -13
- package/src/cli/result.ts +24 -2
- package/src/cli/symbol-list.ts +31 -4
- package/src/cli/terminal-code-hints.ts +83 -0
- package/src/cli/ticker-resolution.ts +2 -1
- package/src/cli/treasury-yields.ts +5 -0
- package/src/components/chart/native/kitty/manager.ts +2 -0
- package/src/components/chart/native/surface/manager.ts +211 -11
- package/src/components/command-bar/action-runtime.ts +2 -0
- package/src/components/command-bar/panel/index.tsx +2 -13
- package/src/components/command-bar/panel/layout.ts +1 -7
- package/src/components/command-bar/panel/runtime.ts +0 -1
- package/src/components/command-bar/panel/types.ts +0 -2
- package/src/components/command-bar/routing/launch-request.ts +2 -1
- package/src/components/command-bar/routing/navigation-state.ts +4 -2
- package/src/components/command-bar/workflow/types.ts +6 -0
- package/src/components/data-table/column-menu.tsx +89 -0
- package/src/components/data-table/sort-menu.tsx +9 -2
- package/src/components/data-table/view.tsx +33 -6
- package/src/components/form-modal/content.tsx +10 -0
- package/src/components/index.ts +1 -1
- package/src/components/layout/detached-pane-shell.tsx +3 -0
- package/src/components/layout/double-escape-close.ts +34 -3
- package/src/components/layout/floating-pane.tsx +10 -4
- package/src/components/layout/pane/cycle-order.ts +66 -2
- package/src/components/layout/pane/footer/index.tsx +25 -11
- package/src/components/layout/pane/footer/model.ts +62 -20
- package/src/components/layout/pane/header.tsx +140 -31
- package/src/components/layout/pane/sidebar.tsx +138 -20
- package/src/components/layout/pane/status-footer.ts +3 -1
- package/src/components/layout/shell/active-drag.ts +18 -13
- package/src/components/layout/shell/drag/magnets.ts +34 -18
- package/src/components/layout/shell/drag/runtime.ts +5 -0
- package/src/components/layout/shell/index.tsx +25 -0
- package/src/components/layout/shell/menu.ts +9 -0
- package/src/components/layout/shell/pane/actions.ts +36 -0
- package/src/components/layout/shell/pane/management-shortcuts.ts +27 -3
- package/src/components/layout/shell/pane-occlusion.ts +40 -0
- package/src/components/layout/shell/shortcuts.ts +17 -1
- package/src/components/layout/shell/terminal-pointer-runtime.ts +39 -6
- package/src/components/layout/shell/window-mode/index.ts +5 -16
- package/src/components/layout/shell/window-mode/overlays.tsx +3 -1
- package/src/components/market-board/index.tsx +14 -5
- package/src/components/metric-treemap/index.tsx +3 -1
- package/src/components/ticker/list-table-view.tsx +5 -0
- package/src/components/ui/button.tsx +48 -4
- package/src/components/ui/data-table/column-order.ts +180 -0
- package/src/components/ui/data-table/index.tsx +12 -1
- package/src/components/ui/data-table/opentui/index.tsx +291 -32
- package/src/components/ui/data-table/opentui/model.ts +43 -4
- package/src/components/ui/data-table/types.ts +56 -0
- package/src/components/ui/data-table/use-column-order.ts +135 -0
- package/src/components/ui/index.ts +1 -1
- package/src/components/ui/inline-quick-add.tsx +19 -3
- package/src/components/ui/list-view.tsx +11 -5
- package/src/components/ui/query-bar.tsx +16 -1
- package/src/components/ui/selection-fill.ts +39 -0
- package/src/components/ui/table-layout.ts +120 -0
- package/src/core/state/app/layout-reducer.ts +2 -1
- package/src/core/state/app/pane-choices.ts +68 -0
- package/src/core/state/app/state.ts +14 -6
- package/src/core/state/app/types.ts +8 -0
- package/src/docs/snapshot.json +3 -2
- package/src/i18n/es.ts +2 -0
- package/src/i18n/ja.ts +2 -0
- package/src/i18n/ko.ts +2 -0
- package/src/i18n/zh-cn.ts +2 -0
- package/src/i18n/zh-tw.ts +2 -0
- package/src/layout/pane-manager/dock-tree.ts +19 -0
- package/src/layout/pane-manager/index.ts +3 -0
- package/src/market-data/coordinator/index.ts +4 -3
- package/src/market-data/coordinator/quotes.ts +12 -4
- package/src/market-data/market/freshness.ts +33 -0
- package/src/market-data/market/status.ts +5 -1
- package/src/market-data/quotes/contributions.ts +10 -0
- package/src/market-data/quotes/freshness.ts +31 -0
- package/src/market-data/quotes/live-valuation.ts +32 -5
- package/src/market-data/quotes/regular-session-valuation.ts +1 -1
- package/src/market-data/quotes/resolution.ts +4 -0
- package/src/market-data/quotes/time.ts +0 -14
- package/src/plugins/builtin/account-management/index.tsx +1 -0
- package/src/plugins/builtin/awards/detail.tsx +12 -4
- package/src/plugins/builtin/awards/headless.ts +29 -8
- package/src/plugins/builtin/awards/model.ts +36 -2
- package/src/plugins/builtin/awards/pane.tsx +7 -4
- package/src/plugins/builtin/broker-manager/detail.tsx +5 -3
- package/src/plugins/builtin/broker-manager/index.tsx +7 -6
- package/src/plugins/builtin/broker-manager/model.ts +15 -6
- package/src/plugins/builtin/broker-manager/pane-actions.tsx +11 -4
- package/src/plugins/builtin/broker-manager/sign-in-end.ts +50 -19
- package/src/plugins/builtin/broker-manager/table.ts +10 -4
- package/src/plugins/builtin/broker-trading/index.tsx +1 -1
- package/src/plugins/builtin/central-bank-rates/headless.ts +6 -6
- package/src/plugins/builtin/central-bank-rates/index.tsx +1 -1
- package/src/plugins/builtin/central-bank-rates/model.ts +21 -3
- package/src/plugins/builtin/central-bank-rates/pane.tsx +15 -5
- package/src/plugins/builtin/chart-composer/headless.ts +5 -1
- package/src/plugins/builtin/chart-composer/pane.tsx +1 -0
- package/src/plugins/builtin/chat/content/handle-prompt.tsx +4 -0
- package/src/plugins/builtin/chat/controller/realtime.ts +17 -1
- package/src/plugins/builtin/chat/message/terminal.tsx +4 -1
- package/src/plugins/builtin/chat/sidebar.tsx +35 -19
- package/src/plugins/builtin/cloud/askg/pane.tsx +4 -0
- package/src/plugins/builtin/cloud/askg/tool-timeline.tsx +2 -0
- package/src/plugins/builtin/cloud/plugin.tsx +1 -0
- package/src/plugins/builtin/cloud/team/module.tsx +1 -0
- package/src/plugins/builtin/cloud/thesis/detail.tsx +9 -4
- package/src/plugins/builtin/commodity-balances/pane.tsx +13 -5
- package/src/plugins/builtin/company-kpis/model.ts +3 -3
- package/src/plugins/builtin/connections/index.ts +1 -0
- package/src/plugins/builtin/credit-boards/cdx-pane.tsx +9 -5
- package/src/plugins/builtin/credit-boards/client.ts +5 -0
- package/src/plugins/builtin/credit-boards/headless.ts +1 -6
- package/src/plugins/builtin/credit-boards/model.ts +0 -6
- package/src/plugins/builtin/credit-boards/series.ts +19 -8
- package/src/plugins/builtin/credit-boards/sovr-pane.tsx +9 -5
- package/src/plugins/builtin/crypto-etf-flows/headless.ts +23 -13
- package/src/plugins/builtin/crypto-etf-flows/pane.tsx +8 -3
- package/src/plugins/builtin/debt-maturities/headless.ts +16 -7
- package/src/plugins/builtin/debt-maturities/model.ts +9 -15
- package/src/plugins/builtin/debt-maturities/pane.tsx +9 -10
- package/src/plugins/builtin/earnings/board-model.ts +33 -4
- package/src/plugins/builtin/earnings/board.tsx +15 -3
- package/src/plugins/builtin/earnings/calendar.tsx +10 -6
- package/src/plugins/builtin/earnings/client.ts +0 -9
- package/src/plugins/builtin/earnings/headless.ts +10 -7
- package/src/plugins/builtin/earnings/history.tsx +21 -14
- package/src/plugins/builtin/earnings-calls/data.ts +24 -4
- package/src/plugins/builtin/earnings-calls/format.ts +23 -5
- package/src/plugins/builtin/earnings-calls/headless.ts +23 -3
- package/src/plugins/builtin/earnings-calls/index.tsx +1 -0
- package/src/plugins/builtin/earnings-calls/model.ts +11 -1
- package/src/plugins/builtin/earnings-calls/pane.tsx +2 -5
- package/src/plugins/builtin/econ/calendar-model.ts +27 -0
- package/src/plugins/builtin/econ/fred-catalog.ts +3 -0
- package/src/plugins/builtin/econ/index.tsx +9 -2
- package/src/plugins/builtin/econ-statistics/headless.ts +3 -1
- package/src/plugins/builtin/econ-statistics/index.tsx +1 -1
- package/src/plugins/builtin/equity-screener/live.ts +74 -18
- package/src/plugins/builtin/equity-screener/model.ts +19 -4
- package/src/plugins/builtin/equity-screener/pane.tsx +19 -14
- package/src/plugins/builtin/equity-screener/refresh-anchor.ts +45 -0
- package/src/plugins/builtin/equity-screener/results.ts +22 -2
- package/src/plugins/builtin/equity-screener/screen-check.ts +9 -3
- package/src/plugins/builtin/fear-greed/headless.ts +16 -13
- package/src/plugins/builtin/fear-greed/pane.tsx +12 -4
- package/src/plugins/builtin/filing-events/index.tsx +1 -0
- package/src/plugins/builtin/futures/index.tsx +15 -1
- package/src/plugins/builtin/futures/table.tsx +1 -1
- package/src/plugins/builtin/fx-matrix/index.tsx +32 -19
- package/src/plugins/builtin/holders/pane.tsx +30 -20
- package/src/plugins/builtin/insider/table.tsx +10 -7
- package/src/plugins/builtin/insider/tickers.tsx +1 -1
- package/src/plugins/builtin/iv-history/events.ts +5 -0
- package/src/plugins/builtin/iv-history/headless.ts +15 -9
- package/src/plugins/builtin/jobs/index.tsx +1 -0
- package/src/plugins/builtin/kelly-sizer/sections.tsx +2 -0
- package/src/plugins/builtin/macro-day/headless.ts +15 -6
- package/src/plugins/builtin/macro-day/model.ts +1 -1
- package/src/plugins/builtin/macro-day/releases.ts +25 -16
- package/src/plugins/builtin/market-movers/index.tsx +20 -8
- package/src/plugins/builtin/market-movers/model.ts +5 -0
- package/src/plugins/builtin/market-movers/session-body.tsx +2 -1
- package/src/plugins/builtin/money-markets/headless.ts +12 -2
- package/src/plugins/builtin/money-markets/pane.tsx +10 -1
- package/src/plugins/builtin/options/view.tsx +3 -0
- package/src/plugins/builtin/options-positioning/pane.tsx +1 -1
- package/src/plugins/builtin/options-scenario/pane.tsx +2 -1
- package/src/plugins/builtin/perps/cascade-tabs.tsx +2 -1
- package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +4 -31
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +19 -1
- package/src/plugins/builtin/portfolio-list/quick-add/index.tsx +22 -8
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +6 -8
- package/src/plugins/builtin/portfolio-list/table.tsx +15 -1
- package/src/plugins/builtin/rate-path/pane.tsx +2 -0
- package/src/plugins/builtin/realized-vol/headless.ts +28 -2
- package/src/plugins/builtin/revenue-breakdown/pane.tsx +2 -0
- package/src/plugins/builtin/reverse-dcf/pane.tsx +2 -1
- package/src/plugins/builtin/risk-factors/index.tsx +1 -0
- package/src/plugins/builtin/seasonality/pane.tsx +2 -1
- package/src/plugins/builtin/shared/source-footer.ts +70 -0
- package/src/plugins/builtin/short-interest/publications-pane.tsx +5 -1
- package/src/plugins/builtin/short-volume/pane.tsx +5 -1
- package/src/plugins/builtin/social-mentions/outliers.tsx +10 -1
- package/src/plugins/builtin/social-mentions/pane.tsx +7 -0
- package/src/plugins/builtin/supply-chain/client.ts +3 -1
- package/src/plugins/builtin/supply-chain/flow.tsx +25 -8
- package/src/plugins/builtin/supply-chain/graph-client.ts +1 -1
- package/src/plugins/builtin/supply-chain/graph-evidence.ts +1 -1
- package/src/plugins/builtin/supply-chain/graph-model.ts +12 -1
- package/src/plugins/builtin/supply-chain/graph-pane.tsx +9 -8
- package/src/plugins/builtin/supply-chain/graph.tsx +12 -6
- package/src/plugins/builtin/supply-chain/headless.ts +13 -7
- package/src/plugins/builtin/supply-chain/model.ts +68 -11
- package/src/plugins/builtin/supply-chain/pane.tsx +9 -6
- package/src/plugins/builtin/supply-chain/row-evidence.tsx +5 -5
- package/src/plugins/builtin/thirteenf/pane.tsx +2 -0
- package/src/plugins/builtin/ticker-detail/financials/model.ts +28 -6
- package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +26 -9
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +58 -35
- package/src/plugins/builtin/ticker-detail/overview/components.tsx +14 -1
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +2 -0
- package/src/plugins/builtin/ticker-detail/pane.tsx +48 -24
- package/src/plugins/builtin/ticker-detail/quote-footer.ts +5 -0
- package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +6 -3
- package/src/plugins/builtin/treasury-auctions/after.ts +50 -23
- package/src/plugins/builtin/treasury-auctions/cache.ts +23 -5
- package/src/plugins/builtin/treasury-auctions/headless.ts +226 -37
- package/src/plugins/builtin/treasury-auctions/hk-headless.ts +11 -5
- package/src/plugins/builtin/treasury-auctions/hk-view.tsx +27 -25
- package/src/plugins/builtin/treasury-auctions/hk.ts +60 -8
- package/src/plugins/builtin/treasury-auctions/index.tsx +3 -0
- package/src/plugins/builtin/treasury-auctions/keys.ts +27 -0
- package/src/plugins/builtin/treasury-auctions/like.ts +137 -0
- package/src/plugins/builtin/treasury-auctions/model.ts +100 -22
- package/src/plugins/builtin/treasury-auctions/pane.tsx +39 -11
- package/src/plugins/builtin/vol-surface/heat-grid.tsx +6 -3
- package/src/plugins/builtin/vol-surface/pane.tsx +7 -3
- package/src/plugins/builtin/world-indices/index.tsx +5 -1
- package/src/plugins/builtin/yield-curve/index.tsx +2 -1
- package/src/plugins/runtime/index.tsx +1 -0
- package/src/plugins/runtime/state.ts +20 -0
- package/src/portfolio/column-values.ts +8 -2
- package/src/public/__snapshots__/public-api.test.ts.snap +5 -0
- package/src/public/react.ts +7 -0
- package/src/react/auto-refresh.ts +29 -0
- package/src/renderers/browser/deeplink-bridge.ts +24 -3
- package/src/renderers/dom/data-table/column-drag.ts +147 -0
- package/src/renderers/dom/data-table/index.tsx +22 -0
- package/src/renderers/dom/data-table/row.tsx +27 -5
- package/src/renderers/dom/desktop/query-bar.tsx +229 -60
- package/src/renderers/dom/host/overflow-fade-px.ts +2 -0
- package/src/renderers/dom/host/overflow-fade.ts +1 -2
- package/src/renderers/dom/styles.css +47 -5
- package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +2 -1
- package/src/renderers/opentui/chart-surface.tsx +1 -0
- package/src/renderers/opentui/frame-hits.ts +33 -0
- package/src/renderers/opentui/host.tsx +2 -0
- package/src/renderers/opentui/native-surface.ts +14 -21
- package/src/renderers/opentui/test-utils.tsx +3 -0
- package/src/series/types.ts +2 -0
- package/src/sources/gloomberb-cloud/fred-attribution.ts +86 -0
- package/src/sources/gloomberb-cloud/index.ts +25 -1
- package/src/sources/gloomberb-cloud/normalizers.ts +22 -3
- package/src/sources/provider-errors.ts +64 -1
- package/src/sources/provider-router/batches.ts +19 -0
- package/src/sources/provider-router/index.ts +7 -1
- package/src/state/app/context/index.tsx +46 -1
- package/src/state/pane-unsent-work.ts +47 -0
- package/src/test-support/app-store.ts +24 -1
- package/src/test-support/shell-pane-keys.tsx +5 -0
- package/src/test-support/telemetry-guard.ts +83 -0
- package/src/test-support/test-env.ts +12 -0
- package/src/theme/colors.ts +17 -1
- package/src/theme/ui-tokens.ts +50 -1
- package/src/tickers/listing-venues.ts +11 -1
- package/src/tickers/search/japanese-names.json +1 -0
- package/src/tickers/search/japanese-names.ts +152 -0
- package/src/tickers/terminal-codes.ts +55 -6
- package/src/time-series/base-series.ts +3 -0
- package/src/time-series/live-quotes.ts +3 -9
- package/src/types/data-provider.ts +6 -0
- package/src/types/financials.ts +11 -0
- package/src/types/plugin-contributions.ts +7 -0
- package/src/types/plugin-panes.ts +7 -0
- package/src/ui/host.tsx +24 -0
- package/src/ui/pointer-drag.ts +11 -2
- package/src/utils/double-escape-close.ts +42 -0
- package/src/utils/fundamentals.ts +14 -3
- package/src/utils/fx-status.ts +30 -7
- package/src/utils/network-failure.ts +23 -0
- package/src/utils/share-multiples.cases.json +780 -2
- package/src/utils/share-multiples.ts +154 -24
|
@@ -15,17 +15,19 @@ import {
|
|
|
15
15
|
} from "../../../../components";
|
|
16
16
|
import { colors, priceColor } from "../../../../theme/colors";
|
|
17
17
|
import { fiscalYearEndMonth } from "../../../../utils/fiscal-period";
|
|
18
|
-
import { padTo } from "../../../../utils/format";
|
|
18
|
+
import { displayWidth, padTo } from "../../../../utils/format";
|
|
19
19
|
import { filledPeriodPublications, filledPeriodsNote, stalePeriodNote } from "../../../../utils/financial-statements";
|
|
20
20
|
import {
|
|
21
21
|
FINANCIAL_COL_W,
|
|
22
22
|
financialLabelWidth,
|
|
23
|
+
financialPeriodWidth,
|
|
23
24
|
FINANCIAL_SUB_TABS,
|
|
24
25
|
buildFinancialRows,
|
|
25
26
|
canCompareFinancialRow,
|
|
26
27
|
collectDefaultCollapsedGroupIds,
|
|
27
28
|
collectGroupIds,
|
|
28
29
|
computeGrowth,
|
|
30
|
+
financialCellValue,
|
|
29
31
|
financialColumnLabel,
|
|
30
32
|
formatFinancialCell,
|
|
31
33
|
financialStatementCurrency,
|
|
@@ -41,7 +43,6 @@ import {
|
|
|
41
43
|
selectFinancialStatements,
|
|
42
44
|
shareFinancialUnit,
|
|
43
45
|
splitPeriodsNotInYet,
|
|
44
|
-
statementMetricValue,
|
|
45
46
|
type FinancialPeriod,
|
|
46
47
|
type FinancialTableRow,
|
|
47
48
|
} from "./model";
|
|
@@ -72,6 +73,32 @@ type FinancialTableColumn = DataTableColumn & (
|
|
|
72
73
|
| { id: string; kind: "statement"; statement: FinancialTableStatement }
|
|
73
74
|
);
|
|
74
75
|
|
|
76
|
+
const NO_COLLAPSED_GROUPS: ReadonlySet<string> = new Set();
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* A group's name in the metric column. It draws its indent (an empty one still takes a cell), its disclosure
|
|
80
|
+
* and its name a cell apart, and says that width (`contentWidth`) so the table fits the column to it whole.
|
|
81
|
+
* The desktop draws the disclosure as a path, not a glyph.
|
|
82
|
+
*/
|
|
83
|
+
export function financialGroupNameCell(
|
|
84
|
+
row: Extract<FinancialTableRow, { kind: "group" }>,
|
|
85
|
+
color: string,
|
|
86
|
+
attributes: number,
|
|
87
|
+
): Pick<DataTableCell, "text" | "contentWidth" | "content"> {
|
|
88
|
+
const indent = " ".repeat(row.depth * 2);
|
|
89
|
+
const marker = row.toggleable ? (row.expanded ? "\u25be" : "\u25b8") : " ";
|
|
90
|
+
return {
|
|
91
|
+
text: `${indent}${marker} ${row.unitLabel}`,
|
|
92
|
+
contentWidth: Math.max(1, displayWidth(indent)) + 1 + displayWidth(marker) + 1 + displayWidth(row.unitLabel),
|
|
93
|
+
content: (
|
|
94
|
+
<Box flexDirection="row" alignItems="center" gap={1}>
|
|
95
|
+
<Text fg={color}>{indent}</Text>
|
|
96
|
+
{row.toggleable ? <DisclosureMarker expanded={!!row.expanded} color={color} /> : <Text> </Text>}
|
|
97
|
+
<Text fg={color} attributes={attributes}>{row.unitLabel}</Text>
|
|
98
|
+
</Box>
|
|
99
|
+
),
|
|
100
|
+
};
|
|
101
|
+
}
|
|
75
102
|
const financialRowKey = (row: FinancialTableRow) => row.id;
|
|
76
103
|
const financialRowBackground = (row: FinancialTableRow) => (
|
|
77
104
|
row.kind === "group" && row.depth === 0 ? colors.panel : undefined
|
|
@@ -318,6 +345,24 @@ export function ResolvedFinancialsTab({
|
|
|
318
345
|
const moneyUnit = [comparisonCurrency, unit].filter(Boolean).join(" ");
|
|
319
346
|
const unitMarked = !!unit && rows.some((row) => row.unitLabel !== row.label);
|
|
320
347
|
const metricHeader = moneyUnit ? `${moneyUnit}${unitMarked ? " unless marked" : ""}` : "Metric";
|
|
348
|
+
// The annual balance sheet leads with a newer quarter-end position.
|
|
349
|
+
const periodHeaders = useMemo(() => displayStatements.map((statement) => financialColumnHeader(
|
|
350
|
+
statement,
|
|
351
|
+
isAnnual && (statement.date === "TTM" || annualDates.has(statement.date)) ? "annual" : "quarterly",
|
|
352
|
+
yearEndMonth,
|
|
353
|
+
comparisonCurrency,
|
|
354
|
+
)), [annualDates, comparisonCurrency, displayStatements, isAnnual, yearEndMonth]);
|
|
355
|
+
// In the terminal a period is as wide as its widest value and growth, so each pair sits as far from the next
|
|
356
|
+
// as from its own growth and more periods fit. The ratio tabs keep the statement columns' width. Every line of
|
|
357
|
+
// the statement counts, a collapsed group's too, so opening or closing one leaves the periods where they are.
|
|
358
|
+
const periodWidth = useMemo(() => {
|
|
359
|
+
if (nativePaneChrome || ratioTab) return FINANCIAL_COL_W;
|
|
360
|
+
const everyRow = shareFinancialUnit(buildFinancialRows(subTab.rows, displayStatements, NO_COLLAPSED_GROUPS)).rows;
|
|
361
|
+
const values = [...everyRow, ...rows].flatMap((row) => displayStatements.map((statement) => (
|
|
362
|
+
formatFinancialValue(financialCellValue(row, statement), row, statement)
|
|
363
|
+
)));
|
|
364
|
+
return financialPeriodWidth(values, periodHeaders);
|
|
365
|
+
}, [displayStatements, nativePaneChrome, periodHeaders, ratioTab, rows, subTab.rows]);
|
|
321
366
|
const columns = useMemo<FinancialTableColumn[]>(() => [
|
|
322
367
|
{
|
|
323
368
|
id: "metric",
|
|
@@ -330,18 +375,12 @@ export function ResolvedFinancialsTab({
|
|
|
330
375
|
id: `statement:${statement.date}:${index}`,
|
|
331
376
|
kind: "statement",
|
|
332
377
|
statement,
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
statement,
|
|
336
|
-
isAnnual && (statement.date === "TTM" || annualDates.has(statement.date)) ? "annual" : "quarterly",
|
|
337
|
-
yearEndMonth,
|
|
338
|
-
comparisonCurrency,
|
|
339
|
-
), FINANCIAL_COL_W, "center"),
|
|
340
|
-
width: FINANCIAL_COL_W,
|
|
378
|
+
label: padTo(periodHeaders[index]!, periodWidth, "center"),
|
|
379
|
+
width: periodWidth,
|
|
341
380
|
align: "right",
|
|
342
381
|
headerColor: statement.date === "TTM" ? colors.textBright : colors.textDim,
|
|
343
382
|
})),
|
|
344
|
-
], [
|
|
383
|
+
], [displayStatements, metricHeader, periodHeaders, periodWidth, width]);
|
|
345
384
|
const periodEnd = latestFinancialPeriodEnd(displayStatements);
|
|
346
385
|
const renderCell = useCallback((
|
|
347
386
|
row: FinancialTableRow,
|
|
@@ -349,22 +388,12 @@ export function ResolvedFinancialsTab({
|
|
|
349
388
|
): DataTableCell => {
|
|
350
389
|
if (column.kind === "metric") {
|
|
351
390
|
if (row.kind === "group") {
|
|
352
|
-
const indent = " ".repeat(row.depth * 2);
|
|
353
|
-
const marker = row.toggleable ? (row.expanded ? "\u25be" : "\u25b8") : " ";
|
|
354
391
|
const labelColor = row.depth === 0 ? colors.textBright : colors.textDim;
|
|
355
392
|
const labelAttributes = row.depth === 0 ? TextAttributes.BOLD : TextAttributes.NONE;
|
|
356
393
|
return {
|
|
357
|
-
|
|
394
|
+
...financialGroupNameCell(row, labelColor, labelAttributes),
|
|
358
395
|
color: labelColor,
|
|
359
396
|
attributes: labelAttributes,
|
|
360
|
-
// The desktop draws the disclosure as a path, not a glyph.
|
|
361
|
-
content: (
|
|
362
|
-
<Box flexDirection="row" alignItems="center" gap={1}>
|
|
363
|
-
<Text fg={labelColor}>{indent}</Text>
|
|
364
|
-
{row.toggleable ? <DisclosureMarker expanded={!!row.expanded} color={labelColor} /> : <Text> </Text>}
|
|
365
|
-
<Text fg={labelColor} attributes={labelAttributes}>{row.unitLabel}</Text>
|
|
366
|
-
</Box>
|
|
367
|
-
),
|
|
368
397
|
onMouseDown: row.toggleable
|
|
369
398
|
? (event) => {
|
|
370
399
|
event.preventDefault?.();
|
|
@@ -381,31 +410,24 @@ export function ResolvedFinancialsTab({
|
|
|
381
410
|
};
|
|
382
411
|
}
|
|
383
412
|
|
|
384
|
-
|
|
385
|
-
if (row.kind === "group" && !key) return {
|
|
413
|
+
if (row.kind === "group" && !row.summaryKey) return {
|
|
386
414
|
text: "",
|
|
387
415
|
};
|
|
388
416
|
|
|
389
417
|
const previous = previousStatementMap.get(column.statement.date);
|
|
390
|
-
const value = row.
|
|
391
|
-
|
|
392
|
-
: statementMetricValue(row, column.statement);
|
|
393
|
-
const previousValue = previous
|
|
394
|
-
? row.kind === "group"
|
|
395
|
-
? previous[key!] as number | undefined
|
|
396
|
-
: statementMetricValue(row, previous)
|
|
397
|
-
: undefined;
|
|
418
|
+
const value = financialCellValue(row, column.statement);
|
|
419
|
+
const previousValue = previous ? financialCellValue(row, previous) : undefined;
|
|
398
420
|
const growth = (row.kind === "metric" && !row.showGrowth)
|
|
399
421
|
|| !canCompareFinancialRow(row, column.statement, previous, comparisonCurrency)
|
|
400
422
|
? undefined : computeGrowth(value, previousValue);
|
|
401
423
|
const formattedValue = formatFinancialValue(value, row, column.statement);
|
|
402
|
-
const cell = formatFinancialCell(formattedValue, growth);
|
|
424
|
+
const cell = formatFinancialCell(formattedValue, growth, column.width);
|
|
403
425
|
const growthColorValue = semanticGrowthValue(growth, row.growthDirection);
|
|
404
426
|
|
|
405
427
|
return {
|
|
406
428
|
text: `${cell.valueText}${cell.growthText}`,
|
|
407
429
|
content: (
|
|
408
|
-
<Box flexDirection="row" width={
|
|
430
|
+
<Box flexDirection="row" width={column.width}>
|
|
409
431
|
<Text
|
|
410
432
|
attributes={row.kind === "group" ? TextAttributes.BOLD : TextAttributes.NONE}
|
|
411
433
|
fg={colors.text}
|
|
@@ -547,7 +569,6 @@ export function ResolvedFinancialsTab({
|
|
|
547
569
|
// Desktop: the query bar and table run edge to edge like every other
|
|
548
570
|
// pane; the table keeps its own inline padding.
|
|
549
571
|
paddingX={nativePaneChrome ? 0 : 1}
|
|
550
|
-
paddingBottom={nativePaneChrome ? 0 : 1}
|
|
551
572
|
overflow="hidden"
|
|
552
573
|
>
|
|
553
574
|
{isValuation && oldestPeriodEnd ? <PeriodEndHistoryLoader oldestPeriodEnd={oldestPeriodEnd} onChange={setHistory} /> : null}
|
|
@@ -578,6 +599,8 @@ export function ResolvedFinancialsTab({
|
|
|
578
599
|
headerScrollId={headerScrollId}
|
|
579
600
|
bodyScrollId={bodyScrollId}
|
|
580
601
|
columns={columns}
|
|
602
|
+
// Fiscal periods, oldest to newest: an axis, not columns to arrange.
|
|
603
|
+
columnReorder={false}
|
|
581
604
|
items={rows}
|
|
582
605
|
selection={{
|
|
583
606
|
kind: "id",
|
|
@@ -110,6 +110,7 @@ export function CompactRangeBar({
|
|
|
110
110
|
currency,
|
|
111
111
|
priceOptions,
|
|
112
112
|
endpoints = "price",
|
|
113
|
+
note,
|
|
113
114
|
}: {
|
|
114
115
|
current: number;
|
|
115
116
|
low: number;
|
|
@@ -130,6 +131,11 @@ export function CompactRangeBar({
|
|
|
130
131
|
priceOptions: MarketFormatOptions;
|
|
131
132
|
/** Shared by ranges drawn together, as `endpointWidth` is (rangeEndpointStyle). */
|
|
132
133
|
endpoints?: RangeEndpointStyle;
|
|
134
|
+
/**
|
|
135
|
+
* Muted context after the high, where the range is not the source's own
|
|
136
|
+
* (`daily bars`): shown only while the track keeps RANGE_MIN_TRACK_WIDTH.
|
|
137
|
+
*/
|
|
138
|
+
note?: string;
|
|
133
139
|
}) {
|
|
134
140
|
const { nativePaneChrome } = useUiCapabilities();
|
|
135
141
|
const range = high - low;
|
|
@@ -140,7 +146,9 @@ export function CompactRangeBar({
|
|
|
140
146
|
const shownLabelWidth = useShortLabel ? displayWidth(shortLabel) : labelWidth;
|
|
141
147
|
const endpointOptions = { ...priceOptions, maxWidth: endpointWidth };
|
|
142
148
|
const [lowText, highText] = formatRangeEndpoints(low, high, currency, endpointOptions, endpoints);
|
|
143
|
-
const
|
|
149
|
+
const noteCells = note ? displayWidth(note) + 1 : 0;
|
|
150
|
+
const shownNote = note && width - rangeRowChrome(shownLabelWidth, endpointWidth) - noteCells >= RANGE_MIN_TRACK_WIDTH ? note : null;
|
|
151
|
+
const barWidth = Math.max(1, width - rangeRowChrome(shownLabelWidth, endpointWidth) - (shownNote ? noteCells : 0));
|
|
144
152
|
|
|
145
153
|
// The desktop and the web size the row and its track by CSS, so the high end keeps to the pane's edge on every frame of a
|
|
146
154
|
// resize; the label, the endpoints and which of them show are still worked out from `width`, at each catch-up.
|
|
@@ -176,6 +184,11 @@ export function CompactRangeBar({
|
|
|
176
184
|
<Box width={endpointWidth} flexShrink={0} overflow="hidden">
|
|
177
185
|
<Text fg={colors.text}>{highText}</Text>
|
|
178
186
|
</Box>
|
|
187
|
+
{shownNote && (
|
|
188
|
+
<Box width={noteCells} flexShrink={0} overflow="hidden" data-gloom-role="range-note">
|
|
189
|
+
<Text fg={colors.textDim}>{` ${shownNote}`}</Text>
|
|
190
|
+
</Box>
|
|
191
|
+
)}
|
|
179
192
|
</Box>
|
|
180
193
|
);
|
|
181
194
|
}
|
|
@@ -587,6 +587,8 @@ function ResolvedOverviewTab({ width, height, focused = false, ticker, financial
|
|
|
587
587
|
high={yearRange.high}
|
|
588
588
|
label={yearRangeLabel}
|
|
589
589
|
shortLabel={t("52W")}
|
|
590
|
+
// A range the service read from the stored daily bars, the source's being no year's, says so.
|
|
591
|
+
note={quote.yearRangeBasis === "daily-bars" ? t("daily bars") : undefined}
|
|
590
592
|
labelWidth={rangeLabelWidth}
|
|
591
593
|
endpointWidth={rangeEndpointCells}
|
|
592
594
|
width={rangeWidth}
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
usePaneStateValue,
|
|
16
16
|
usePaneTicker,
|
|
17
17
|
usePaneAppConfig,
|
|
18
|
+
usePaneChoice,
|
|
18
19
|
type AppState,
|
|
19
20
|
} from "../../../state/app/context";
|
|
20
21
|
import { useQuoteUpdates } from "../../../state/hooks/quote-streaming";
|
|
@@ -34,7 +35,8 @@ import { findTickerResearchGroup, groupTickerResearchTabs, tickerResearchGroupVi
|
|
|
34
35
|
import { isRecord } from "../../../utils/guards";
|
|
35
36
|
import { useLiveStreamingSetting } from "../../../state/hooks/live-streaming";
|
|
36
37
|
import { useCloudAccessFooter } from "../shared/cloud-upgrade";
|
|
37
|
-
import { CLOUD_QUOTE_DELAY_MINUTES } from "../../../api-client/plan-access";
|
|
38
|
+
import { CLOUD_QUOTE_DELAY_MINUTES, usePlanAccess } from "../../../api-client/plan-access";
|
|
39
|
+
import { shownPaneChoice } from "../../../core/state/app/pane-choices";
|
|
38
40
|
import { parsePublicTickerKey, publicTickerKey } from "../../../utils/exchanges";
|
|
39
41
|
import { captureAttentionAction } from "../../../telemetry/attention-counts";
|
|
40
42
|
import { tickerHasListingSuffix } from "../../../sources/listing-symbols";
|
|
@@ -42,6 +44,7 @@ import { tickerQuoteFooterInfo } from "./quote-footer";
|
|
|
42
44
|
import { ResearchTabKeysProvider, useResearchTabKeysHost } from "./research-tab-keys";
|
|
43
45
|
import { ResearchTabNavigationProvider } from "./research-tab-navigation";
|
|
44
46
|
import { usePluginAppActions } from "../../../public/react";
|
|
47
|
+
import { useUtcDay } from "../../../react/auto-refresh";
|
|
45
48
|
import { resolveTickerInstrumentKind } from "../../../tickers/instrument-kind";
|
|
46
49
|
import { ResearchTradeWorkspace } from "../broker-trading/dock";
|
|
47
50
|
|
|
@@ -192,25 +195,9 @@ export function TickerResearchPane({ focused, width, height }: PaneProps) {
|
|
|
192
195
|
TICKER_RESEARCH_TAB_COMMIT_DELAY_MS,
|
|
193
196
|
{ commitPendingOnUnmount: true },
|
|
194
197
|
);
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
if (ticker.metadata.broker_contracts?.length) {
|
|
199
|
-
for (const key of ["ticker", "exchange", "tab"]) url.searchParams.delete(key);
|
|
200
|
-
window.history.replaceState(window.history.state, "", url.href);
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
url.searchParams.set("ticker", ticker.metadata.ticker);
|
|
204
|
-
// A bare ticker can name different issuers on different venues. Keep the
|
|
205
|
-
// selected listing on reload, and replace any previous pane's venue.
|
|
206
|
-
if (ticker.metadata.exchange && !parsePublicTickerKey(ticker.metadata.ticker).exchange && !tickerHasListingSuffix(ticker.metadata.ticker)) {
|
|
207
|
-
url.searchParams.set("exchange", ticker.metadata.exchange);
|
|
208
|
-
} else {
|
|
209
|
-
url.searchParams.delete("exchange");
|
|
210
|
-
}
|
|
211
|
-
url.searchParams.set("tab", activeTabId);
|
|
212
|
-
window.history.replaceState(window.history.state, "", url.href);
|
|
213
|
-
}, [focused, ticker?.metadata.ticker, ticker?.metadata.exchange, activeTabId, ticker?.metadata.broker_contracts]);
|
|
198
|
+
// A tab picked in this session, by any route, as opposed to restored with the workspace.
|
|
199
|
+
const [tabChosen, chooseTab] = usePaneChoice("activeTabId");
|
|
200
|
+
const access = usePlanAccess();
|
|
214
201
|
const [pluginCaptured, setPluginCaptured] = useState(false);
|
|
215
202
|
useEffect(() => {
|
|
216
203
|
if (focused && Number.isFinite(financials?.quote?.price) && (financials?.quote?.price ?? 0) > 0) {
|
|
@@ -240,9 +227,41 @@ export function TickerResearchPane({ focused, width, height }: PaneProps) {
|
|
|
240
227
|
config,
|
|
241
228
|
hasOptionsChain,
|
|
242
229
|
});
|
|
230
|
+
const savedTabId = allTabs.some((tab) => tab.id === activeTabId) ? activeTabId : (allTabs[0]?.id ?? "overview");
|
|
231
|
+
const proOnlyTabIds = useMemo(
|
|
232
|
+
() => new Set(tickerResearchTabs.filter((tab) => tab.proOnly).map((tab) => tab.id)),
|
|
233
|
+
[tickerResearchTabs],
|
|
234
|
+
);
|
|
235
|
+
// A Pro-only tab restored for an account without Pro opens on the first
|
|
236
|
+
// free tab (Overview); its wall shows once the tab is picked.
|
|
243
237
|
const resolvedTabId = paneSettings.hideTabs
|
|
244
238
|
? resolveLockedTabId(paneSettings, allTabs)
|
|
245
|
-
: (
|
|
239
|
+
: shownPaneChoice(savedTabId, {
|
|
240
|
+
chosen: tabChosen || activeTabId !== committedActiveTabId,
|
|
241
|
+
hasProAccess: access.hasProAccess,
|
|
242
|
+
proOnly: (tabId) => proOnlyTabIds.has(tabId),
|
|
243
|
+
fallback: allTabs.find((tab) => !proOnlyTabIds.has(tab.id))?.id ?? savedTabId,
|
|
244
|
+
});
|
|
245
|
+
// The address names the tab on screen, so a copied link opens what was seen.
|
|
246
|
+
useEffect(() => {
|
|
247
|
+
if (!focused || !ticker || getCurrentPluginTarget() !== "web") return;
|
|
248
|
+
const url = new URL(window.location.href);
|
|
249
|
+
if (ticker.metadata.broker_contracts?.length) {
|
|
250
|
+
for (const key of ["ticker", "exchange", "tab"]) url.searchParams.delete(key);
|
|
251
|
+
window.history.replaceState(window.history.state, "", url.href);
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
url.searchParams.set("ticker", ticker.metadata.ticker);
|
|
255
|
+
// A bare ticker can name different issuers on different venues. Keep the
|
|
256
|
+
// selected listing on reload, and replace any previous pane's venue.
|
|
257
|
+
if (ticker.metadata.exchange && !parsePublicTickerKey(ticker.metadata.ticker).exchange && !tickerHasListingSuffix(ticker.metadata.ticker)) {
|
|
258
|
+
url.searchParams.set("exchange", ticker.metadata.exchange);
|
|
259
|
+
} else {
|
|
260
|
+
url.searchParams.delete("exchange");
|
|
261
|
+
}
|
|
262
|
+
url.searchParams.set("tab", resolvedTabId);
|
|
263
|
+
window.history.replaceState(window.history.state, "", url.href);
|
|
264
|
+
}, [focused, ticker?.metadata.ticker, ticker?.metadata.exchange, resolvedTabId, ticker?.metadata.broker_contracts]);
|
|
246
265
|
// Only quote/chart views use the parent quote status. Other research tabs
|
|
247
266
|
// own their data status (the options chain may have a different delay/feed).
|
|
248
267
|
const quoteFooterActive = resolvedTabId === "overview" || resolvedTabId === "chart";
|
|
@@ -255,6 +274,8 @@ export function TickerResearchPane({ focused, width, height }: PaneProps) {
|
|
|
255
274
|
segmentId: "ticker-research-access",
|
|
256
275
|
shortcutScope: "ticker-research:upgrade",
|
|
257
276
|
});
|
|
277
|
+
// The quote's time of today drops its day; the next day the footer names it.
|
|
278
|
+
const utcDay = useUtcDay();
|
|
258
279
|
usePaneFooter(
|
|
259
280
|
"ticker-research-access",
|
|
260
281
|
() => quoteFooterActive ? {
|
|
@@ -263,7 +284,7 @@ export function TickerResearchPane({ focused, width, height }: PaneProps) {
|
|
|
263
284
|
hints: cloudAccess.hint ? [cloudAccess.hint] : undefined,
|
|
264
285
|
order: -1,
|
|
265
286
|
} : null,
|
|
266
|
-
[cloudAccess.hint, cloudAccess.segment, financials?.quote, quoteFooterActive, resolvedTabId, width],
|
|
287
|
+
[cloudAccess.hint, cloudAccess.segment, financials?.quote, quoteFooterActive, resolvedTabId, utcDay, width],
|
|
267
288
|
);
|
|
268
289
|
|
|
269
290
|
const visibleTabIdKey = allTabs.map((tab) => tab.id).join("\0");
|
|
@@ -276,8 +297,9 @@ export function TickerResearchPane({ focused, width, height }: PaneProps) {
|
|
|
276
297
|
if (!requestedTabId || !requestedTabAt || requestedTabAt === consumedTabAt) return;
|
|
277
298
|
if (!allTabs.some((tab) => tab.id === requestedTabId)) return;
|
|
278
299
|
setConsumedTabAt(requestedTabAt);
|
|
300
|
+
chooseTab();
|
|
279
301
|
setActiveTabId(requestedTabId);
|
|
280
|
-
}, [consumedTabAt, requestedTabAt, requestedTabId, setActiveTabId, setConsumedTabAt, visibleTabIdKey]);
|
|
302
|
+
}, [chooseTab, consumedTabAt, requestedTabAt, requestedTabId, setActiveTabId, setConsumedTabAt, visibleTabIdKey]);
|
|
281
303
|
// A quote tick re-renders this pane; the strips only have to re-render
|
|
282
304
|
// when a tab appears, disappears, or is renamed.
|
|
283
305
|
const tabItemsKey = allTabs.map((tab) => `${tab.id}:${tab.name}:${tab.order}`).join("\0");
|
|
@@ -309,8 +331,10 @@ export function TickerResearchPane({ focused, width, height }: PaneProps) {
|
|
|
309
331
|
const action = tabId === "chart" ? "chart" : tabId === "options" ? "option_chain" : null;
|
|
310
332
|
if (action) captureAttentionAction()(publicTickerKey(ticker.metadata.ticker, ticker.metadata.exchange), action);
|
|
311
333
|
}
|
|
334
|
+
// Picking the tab the pane has saved changes no value, so say it was picked.
|
|
335
|
+
if (!tabChosen) chooseTab();
|
|
312
336
|
setActiveTabId(tabId);
|
|
313
|
-
}, [resolvedTabId, setActiveTabId, ticker]);
|
|
337
|
+
}, [chooseTab, resolvedTabId, setActiveTabId, tabChosen, ticker]);
|
|
314
338
|
// A group opens on the view last chosen in it, as Fixed Income's sections do.
|
|
315
339
|
const selectResearchGroup = useCallback((groupId: string) => {
|
|
316
340
|
const group = groups.find((entry) => entry.id === groupId);
|
|
@@ -6,6 +6,7 @@ import { formatQuoteNavAsOf } from "../../../market-data/quotes/time";
|
|
|
6
6
|
import { delistingLabel } from "../../../market-data/quotes/delisting";
|
|
7
7
|
import type { Quote } from "../../../types/financials";
|
|
8
8
|
import { displayWidth } from "../../../utils/format";
|
|
9
|
+
import { quoteSourceFooterSegment } from "../shared/source-footer";
|
|
9
10
|
|
|
10
11
|
export function tickerQuoteFooterInfo(
|
|
11
12
|
quote: Quote | undefined,
|
|
@@ -42,6 +43,10 @@ export function tickerQuoteFooterInfo(
|
|
|
42
43
|
info.push(status);
|
|
43
44
|
} else if (navAsOf) {
|
|
44
45
|
info.push({ id: "ticker-research-nav", parts: [{ text: navAsOf, tone: "muted" }] });
|
|
46
|
+
} else if (quote) {
|
|
47
|
+
// Where the quote is from and when, as `quote` ends; the access clock beside it says how late the feed is.
|
|
48
|
+
const source = quoteSourceFooterSegment([quote], { id: "ticker-research-source" });
|
|
49
|
+
if (source) info.push(source);
|
|
45
50
|
}
|
|
46
51
|
if (access) info.push(access);
|
|
47
52
|
return info;
|
|
@@ -23,6 +23,7 @@ import { isQuoteStaleForCurrentSession } from "../../../../market-data/quotes/fr
|
|
|
23
23
|
import { delistingLabel, delistingStateLabel } from "../../../../market-data/quotes/delisting";
|
|
24
24
|
import { formatQuoteNavAsOf, formatQuoteSessionAsOf } from "../../../../market-data/quotes/time";
|
|
25
25
|
import { ClippedText } from "../../../../components/ui/display";
|
|
26
|
+
import { useSelectionFill } from "../../../../components/ui/selection-fill";
|
|
26
27
|
import { useQuoteFlashDirection } from "../../../../components/quote-flash";
|
|
27
28
|
import { followLiveSparklinePrice } from "../../../../components/price-sparkline/model";
|
|
28
29
|
import {
|
|
@@ -163,6 +164,7 @@ export function QuoteMonitorCard({
|
|
|
163
164
|
onOpen: (symbol: string) => void;
|
|
164
165
|
}) {
|
|
165
166
|
const { nativePaneChrome, cellWidthPx = 8 } = useUiCapabilities();
|
|
167
|
+
const selectionFill = useSelectionFill();
|
|
166
168
|
const quote = resolveEntryData(quoteEntry) ?? cachedFinancials?.quote;
|
|
167
169
|
const queriedPriceHistory = resolveEntryData(chartEntry);
|
|
168
170
|
const barHistory = queriedPriceHistory && queriedPriceHistory.length >= 2
|
|
@@ -251,9 +253,10 @@ export function QuoteMonitorCard({
|
|
|
251
253
|
onSelect,
|
|
252
254
|
onActivate: onOpen,
|
|
253
255
|
});
|
|
254
|
-
// The terminal marks the cursor on the symbol
|
|
255
|
-
|
|
256
|
-
const
|
|
256
|
+
// The terminal marks the cursor on the symbol, quieter while the board does
|
|
257
|
+
// not have the keys; the desktop rings the card.
|
|
258
|
+
const symbolFg = selected && !nativePaneChrome && selectionFill.lit ? colors.selectedText : colors.textBright;
|
|
259
|
+
const symbolBg = selected && !nativePaneChrome ? selectionFill.bg : undefined;
|
|
257
260
|
|
|
258
261
|
return (
|
|
259
262
|
<Box
|
|
@@ -3,7 +3,9 @@ import type { CloudCurveHistory, CloudCurveId } from "../../../api-client/yield-
|
|
|
3
3
|
import { createTtlCache } from "../../../data/ttl-cache";
|
|
4
4
|
import { toBasisPoints } from "../../../utils/basis-points";
|
|
5
5
|
import { AUCTION_HISTORY_ALL, type AuctionHistoryWindow } from "./client";
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
AUCTION_HISTORY_WINDOWS, auctionBenchmark, dealerPct, indirectPct, isPendingAuction, nextAuctionHistoryWindow, publishesMedian, stopOutVsAvgBp,
|
|
8
|
+
} from "./model";
|
|
7
9
|
import type { TreasuryAuction } from "./types";
|
|
8
10
|
|
|
9
11
|
/**
|
|
@@ -11,11 +13,13 @@ import type { TreasuryAuction } from "./types";
|
|
|
11
13
|
* ranked against its tenor's own recent history, and what the matching
|
|
12
14
|
* constant-maturity yield did after it.
|
|
13
15
|
*
|
|
14
|
-
* - B/C, indirect and dealer share are each a percentile
|
|
15
|
-
* previous 24 auctions with that figure: the share of
|
|
16
|
-
* the ones equal. A tenor is the security type and the
|
|
17
|
-
* as (the 10-year note and its 9-Year 10-Month
|
|
18
|
-
* TIPS is another). Fewer than 12 earlier
|
|
16
|
+
* - Stop-out vs median, B/C, indirect and dealer share are each a percentile
|
|
17
|
+
* against the tenor's previous 24 auctions with that figure: the share of
|
|
18
|
+
* them below it, half the ones equal. A tenor is the security type and the
|
|
19
|
+
* benchmark it was sold as (the 10-year note and its 9-Year 10-Month
|
|
20
|
+
* reopenings are one; a 10-year TIPS is another). Fewer than 12 earlier
|
|
21
|
+
* auctions rank nothing. The stop-out ranks only against auctions on the
|
|
22
|
+
* same footing: the median from November 1998, the average before.
|
|
19
23
|
* - The yield change is the Treasury par (CMT) yield of the auction's tenor,
|
|
20
24
|
* or the TIPS real yield for a TIPS, from the auction day's close to the
|
|
21
25
|
* close 1, 5 and 20 sessions later, in basis points. An FRN floats and has
|
|
@@ -29,9 +33,12 @@ const PERCENTILE_LOOKBACK = 24;
|
|
|
29
33
|
const PERCENTILE_MIN = 12;
|
|
30
34
|
|
|
31
35
|
export interface AuctionAfter {
|
|
36
|
+
stopOutPercentile: number | null;
|
|
32
37
|
btcPercentile: number | null;
|
|
33
38
|
indirectPercentile: number | null;
|
|
34
39
|
dealerPercentile: number | null;
|
|
40
|
+
/** The moves left blank because their later close falls after the day a backtest is as of (`--like`'s asked date). */
|
|
41
|
+
afterAskedDate?: Array<"after1d" | "after5d" | "after20d">;
|
|
35
42
|
/** The CMT yield's change, bp, 1, 5 and 20 sessions after the auction day's close. */
|
|
36
43
|
after1d: number | null;
|
|
37
44
|
after5d: number | null;
|
|
@@ -98,11 +105,11 @@ export function widerAfterWindow(
|
|
|
98
105
|
}
|
|
99
106
|
|
|
100
107
|
const NO_AFTER: AuctionAfter = {
|
|
101
|
-
btcPercentile: null, indirectPercentile: null, dealerPercentile: null, after1d: null, after5d: null, after20d: null, cmt: null,
|
|
108
|
+
stopOutPercentile: null, btcPercentile: null, indirectPercentile: null, dealerPercentile: null, after1d: null, after5d: null, after20d: null, cmt: null,
|
|
102
109
|
};
|
|
103
110
|
|
|
104
111
|
/** The tenor an auction ranks within: its type and the benchmark it was sold as. */
|
|
105
|
-
function auctionTenorKey(auction: TreasuryAuction): string | null {
|
|
112
|
+
export function auctionTenorKey(auction: TreasuryAuction): string | null {
|
|
106
113
|
const benchmark = auctionBenchmark(auction.securityTerm);
|
|
107
114
|
return benchmark ? `${auction.secType}|${benchmark.count}${benchmark.unit}` : null;
|
|
108
115
|
}
|
|
@@ -116,36 +123,41 @@ function percentileOf(value: number, history: readonly number[]): number | null
|
|
|
116
123
|
}
|
|
117
124
|
|
|
118
125
|
type Metric = (auction: TreasuryAuction) => number | null;
|
|
119
|
-
|
|
126
|
+
type PercentileKey = "stopOutPercentile" | "btcPercentile" | "indirectPercentile" | "dealerPercentile";
|
|
127
|
+
export type AuctionPercentiles = Pick<AuctionAfter, PercentileKey>;
|
|
128
|
+
/** Each figure ranked, and whether an earlier auction's figure is on the same footing as this one's. */
|
|
129
|
+
const METRICS: ReadonlyArray<[PercentileKey, Metric, ((auction: TreasuryAuction, past: TreasuryAuction) => boolean)?]> = [
|
|
130
|
+
["stopOutPercentile", stopOutVsAvgBp, (auction, past) => publishesMedian(auction) === publishesMedian(past)],
|
|
120
131
|
["btcPercentile", (auction) => auction.bidToCoverRatio],
|
|
121
132
|
["indirectPercentile", indirectPct],
|
|
122
133
|
["dealerPercentile", dealerPct],
|
|
123
134
|
];
|
|
124
135
|
|
|
125
136
|
/** Each completed auction's percentiles, by id, against the auctions of its tenor before it in `auctions`. */
|
|
126
|
-
export function auctionPercentiles(auctions: readonly TreasuryAuction[]): Map<string,
|
|
137
|
+
export function auctionPercentiles(auctions: readonly TreasuryAuction[]): Map<string, AuctionPercentiles> {
|
|
127
138
|
const byTenor = new Map<string, TreasuryAuction[]>();
|
|
128
139
|
for (const auction of auctions) {
|
|
129
140
|
const key = auctionTenorKey(auction);
|
|
130
141
|
if (!key || isPendingAuction(auction)) continue;
|
|
131
142
|
byTenor.set(key, [...byTenor.get(key) ?? [], auction]);
|
|
132
143
|
}
|
|
133
|
-
const ranked = new Map<string,
|
|
144
|
+
const ranked = new Map<string, AuctionPercentiles>();
|
|
134
145
|
for (const group of byTenor.values()) {
|
|
135
146
|
group.sort((left, right) => left.auctionDate.localeCompare(right.auctionDate) || left.id.localeCompare(right.id));
|
|
136
147
|
group.forEach((auction, index) => {
|
|
137
|
-
const entry = { btcPercentile: null, indirectPercentile: null, dealerPercentile: null }
|
|
138
|
-
for (const [key, metric] of METRICS) {
|
|
148
|
+
const entry: AuctionPercentiles = { stopOutPercentile: null, btcPercentile: null, indirectPercentile: null, dealerPercentile: null };
|
|
149
|
+
for (const [key, metric, comparable] of METRICS) {
|
|
139
150
|
const value = metric(auction);
|
|
140
151
|
if (value == null) continue;
|
|
141
152
|
const history: number[] = [];
|
|
142
153
|
for (let earlier = index - 1; earlier >= 0 && history.length < PERCENTILE_LOOKBACK; earlier--) {
|
|
154
|
+
if (comparable && !comparable(auction, group[earlier]!)) continue;
|
|
143
155
|
const past = metric(group[earlier]!);
|
|
144
156
|
if (past != null) history.push(past);
|
|
145
157
|
}
|
|
146
158
|
entry[key] = percentileOf(value, history);
|
|
147
159
|
}
|
|
148
|
-
ranked.set(auction.id, entry
|
|
160
|
+
ranked.set(auction.id, entry);
|
|
149
161
|
});
|
|
150
162
|
}
|
|
151
163
|
return ranked;
|
|
@@ -178,6 +190,11 @@ export type CurveCloses = ReadonlyArray<{ date: string; value: number }>;
|
|
|
178
190
|
|
|
179
191
|
/** The change from the auction day's close to the close `sessions` later, in bp; null when either is missing. */
|
|
180
192
|
export function yieldChangeAfter(closes: CurveCloses, date: string, sessions: number): number | null {
|
|
193
|
+
return yieldMoveAfter(closes, date, sessions)?.change ?? null;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/** The change from the auction day's close to the close `sessions` later, in bp, and that later close's day. */
|
|
197
|
+
function yieldMoveAfter(closes: CurveCloses, date: string, sessions: number): { change: number; end: string } | null {
|
|
181
198
|
let low = 0, high = closes.length;
|
|
182
199
|
while (low < high) {
|
|
183
200
|
const middle = (low + high) >> 1;
|
|
@@ -187,26 +204,36 @@ export function yieldChangeAfter(closes: CurveCloses, date: string, sessions: nu
|
|
|
187
204
|
const base = closes[low];
|
|
188
205
|
const later = closes[low + sessions];
|
|
189
206
|
if (!base || base.date !== date || !later) return null;
|
|
190
|
-
return toBasisPoints(later.value - base.value, 1);
|
|
207
|
+
return { change: toBasisPoints(later.value - base.value, 1), end: later.date };
|
|
191
208
|
}
|
|
192
209
|
|
|
193
|
-
|
|
210
|
+
export type AfterMove = "after1d" | "after5d" | "after20d";
|
|
211
|
+
const MOVE_SESSIONS: ReadonlyArray<[AfterMove, number]> = [["after1d", 1], ["after5d", 5], ["after20d", 20]];
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* The after view's figures for each auction shown, by id. With `knownBy` (a
|
|
215
|
+
* backtest as of that day) an earlier auction's move whose later close falls
|
|
216
|
+
* after it is blank, and named in `afterAskedDate`: it was not known on that
|
|
217
|
+
* day. The auction held on the day keeps its own.
|
|
218
|
+
*/
|
|
194
219
|
export function projectAuctionAfter(
|
|
195
220
|
shown: readonly TreasuryAuction[],
|
|
196
221
|
history: readonly TreasuryAuction[],
|
|
197
222
|
curves: ReadonlyMap<string, CurveCloses>,
|
|
223
|
+
knownBy?: string,
|
|
198
224
|
): Map<string, AuctionAfter> {
|
|
199
225
|
const percentiles = auctionPercentiles(history);
|
|
200
226
|
return new Map(shown.map((auction) => {
|
|
201
227
|
const cmt = cmtFor(auction);
|
|
202
228
|
const closes = cmt ? curves.get(curveKey(cmt)) : undefined;
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}
|
|
229
|
+
const figures: AuctionAfter = { ...NO_AFTER, ...percentiles.get(auction.id), cmt: cmt ? cmtLabel(cmt) : null };
|
|
230
|
+
const late: AfterMove[] = [];
|
|
231
|
+
for (const [key, sessions] of MOVE_SESSIONS) {
|
|
232
|
+
const move = closes && !isPendingAuction(auction) ? yieldMoveAfter(closes, auction.auctionDate, sessions) : null;
|
|
233
|
+
if (move && knownBy && auction.auctionDate < knownBy && move.end > knownBy) late.push(key);
|
|
234
|
+
else figures[key] = move?.change ?? null;
|
|
235
|
+
}
|
|
236
|
+
return [auction.id, late.length ? { ...figures, afterAskedDate: late } : figures];
|
|
210
237
|
}));
|
|
211
238
|
}
|
|
212
239
|
|
|
@@ -152,6 +152,23 @@ async function loadRecentBoard(
|
|
|
152
152
|
|
|
153
153
|
/** A New York day (YYYY-MM-DD): an auction closes on it and its results come out that afternoon. */
|
|
154
154
|
const newYorkDay = new Intl.DateTimeFormat("en-CA", { timeZone: "America/New_York", year: "numeric", month: "2-digit", day: "2-digit" });
|
|
155
|
+
const newYorkHour = new Intl.DateTimeFormat("en-US", { timeZone: "America/New_York", hour: "numeric", hourCycle: "h23" });
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* How long a command reuses the recent board an earlier run saved while an
|
|
159
|
+
* auction it lists has come due: five minutes, so a run after a run does not
|
|
160
|
+
* walk both sources again (about a second each), and one minute in the hour
|
|
161
|
+
* after 13:00 New York on an auction day, when a note or bond's results come
|
|
162
|
+
* out and a minute-old board may lack them.
|
|
163
|
+
*/
|
|
164
|
+
const DUE_REUSE_MS = 5 * 60_000;
|
|
165
|
+
const RESULTS_HOUR_REUSE_MS = 60_000;
|
|
166
|
+
|
|
167
|
+
function dueReuseMs(auctions: readonly TreasuryAuction[], now: number): number {
|
|
168
|
+
const today = newYorkDay.format(now);
|
|
169
|
+
const resultsHour = Number(newYorkHour.format(now)) === 13;
|
|
170
|
+
return resultsHour && auctions.some((auction) => auction.auctionDate === today) ? RESULTS_HOUR_REUSE_MS : DUE_REUSE_MS;
|
|
171
|
+
}
|
|
155
172
|
|
|
156
173
|
/** An announced auction whose day has come in the last week: its results may be out by now. */
|
|
157
174
|
function comeDue(auction: TreasuryAuction, today: string, weekAgo: string): boolean {
|
|
@@ -165,9 +182,9 @@ function comeDue(auction: TreasuryAuction, today: string, weekAgo: string): bool
|
|
|
165
182
|
* an auction announced within that hour, which the app waits as long for. A
|
|
166
183
|
* command otherwise asks both sources again (saved-copy-persistence.ts), a
|
|
167
184
|
* second or more each run; an auction due today is asked for until its
|
|
168
|
-
* results are in
|
|
169
|
-
*
|
|
170
|
-
* (a command) looks here.
|
|
185
|
+
* results are in, though no more often than `dueReuseMs` says. The app's own
|
|
186
|
+
* cache already answers from a fresh copy, and keeps the failure of a refresh,
|
|
187
|
+
* so only a run that has read nothing yet (a command) looks here.
|
|
171
188
|
*/
|
|
172
189
|
function savedRecentBoard(fiscalKey: string, directKey: string | null, from: string, now = Date.now()): TreasuryAuctionsResult | null {
|
|
173
190
|
if (cache.get(fiscalKey)) return null;
|
|
@@ -175,10 +192,11 @@ function savedRecentBoard(fiscalKey: string, directKey: string | null, from: str
|
|
|
175
192
|
const direct = directKey ? directCache.get(directKey, { allowExpired: true }) : null;
|
|
176
193
|
if (!fiscal || fiscal.stale || (directKey && (!direct || direct.stale))) return null;
|
|
177
194
|
const auctions = mergeAuctionSources(fiscal.data, direct?.data ?? [], from);
|
|
195
|
+
const fetchedAt = Math.min(fiscal.fetchedAt, direct?.fetchedAt ?? Infinity);
|
|
178
196
|
const today = newYorkDay.format(now);
|
|
179
197
|
const weekAgo = newYorkDay.format(now - 7 * 86_400_000);
|
|
180
|
-
if (auctions.some((auction) => comeDue(auction, today, weekAgo))) return null;
|
|
181
|
-
return { auctions, fetchedAt
|
|
198
|
+
if (auctions.some((auction) => comeDue(auction, today, weekAgo)) && now - fetchedAt >= dueReuseMs(auctions, now)) return null;
|
|
199
|
+
return { auctions, fetchedAt, stale: false };
|
|
182
200
|
}
|
|
183
201
|
|
|
184
202
|
export async function loadTreasuryAuctions(
|