@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
|
@@ -101,9 +101,10 @@ import {
|
|
|
101
101
|
} from "./model";
|
|
102
102
|
import { findNamedCollection, readWatchlistArgument } from "../../../portfolio/collection-name";
|
|
103
103
|
import { useScreenResults } from "./results";
|
|
104
|
+
import { useRefreshAnchor } from "./refresh-anchor";
|
|
104
105
|
import { screenWatchlistList } from "./watchlist";
|
|
105
106
|
import { unmatchedCategoryText, unmatchedCategoryValues } from "./categories";
|
|
106
|
-
import { overlayLiveScreenRows, screenExtendedMove, screenExtendedSessions,
|
|
107
|
+
import { liveScreenPlaces, overlayLiveScreenRows, placeLiveScreenRows, screenExtendedMove, screenExtendedSessions, type LiveScreenRow } from "./live";
|
|
107
108
|
import { useLiveQuoteEntries } from "../../../state/hooks/quote-streaming";
|
|
108
109
|
import { buildScreenerQuoteTargets } from "../../../market-data/quotes/screener-live-quotes";
|
|
109
110
|
import { useLiveStreamingSetting } from "../../../state/hooks/live-streaming";
|
|
@@ -380,20 +381,16 @@ function EquityScreenView({
|
|
|
380
381
|
LIVE_ORDER_SAMPLE_MS,
|
|
381
382
|
`${data?.snapshot?.id ?? ""}:${JSON.stringify(definition.sort)}:${snapshotRows.length}`,
|
|
382
383
|
);
|
|
383
|
-
const
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
.sort((a, b) => a.place - b.place || a.index - b.index)
|
|
388
|
-
.map(({ row }) => row);
|
|
389
|
-
}, [definition.sort, liveRows, orderRows]);
|
|
390
|
-
const opened = rows.find((row) => screenRowId(row) === openId);
|
|
384
|
+
const places = useMemo(() => liveScreenPlaces(orderRows, definition.sort), [definition.sort, orderRows]);
|
|
385
|
+
const rows = useMemo(() => placeLiveScreenRows(liveRows, places), [liveRows, places]);
|
|
386
|
+
const { anchor: refreshAnchor, release: releaseRefreshAnchor } = useRefreshAnchor(data?.snapshot?.id ?? null, rows, visibleRange.start);
|
|
387
|
+
const opened = openId ? rows.find((row) => screenRowId(row) === openId) : undefined;
|
|
391
388
|
const selected =
|
|
392
389
|
opened ?? rows.find((row) => screenRowId(row) === selectedId) ?? rows[0];
|
|
393
390
|
const currentSaved = saved.data?.find((row) => row.id === currentSavedId);
|
|
394
391
|
// The pane menu's Save to Watchlist… takes the matches loaded, in the order shown (the first page is 100). A live
|
|
395
392
|
// quote changes the rows but not who they are, so the menu is rebuilt only when the order does.
|
|
396
|
-
const shownOrder =
|
|
393
|
+
const shownOrder = useMemo(() => [...places.keys()].join(" "), [places]);
|
|
397
394
|
const watchlistList = useMemo(
|
|
398
395
|
() => mode === "results" && !openId && data && screenDefinitionKey(data.definition) === screenDefinitionKey(definition)
|
|
399
396
|
? screenWatchlistList({ definition, rows, matched: data.universe.matched, savedName: currentSaved?.name })
|
|
@@ -443,22 +440,27 @@ function EquityScreenView({
|
|
|
443
440
|
]);
|
|
444
441
|
const tableScroll = useRef<ScrollBoxRenderable>(null);
|
|
445
442
|
const queryControl = useRef<SelectControl>(null);
|
|
446
|
-
const
|
|
443
|
+
const loadMoreNearEnd = useTableLoadMore(
|
|
447
444
|
tableScroll,
|
|
448
445
|
!opened && !results.loading && !results.loadingMore && !!data?.nextCursor,
|
|
449
446
|
results.loadMore,
|
|
450
447
|
);
|
|
448
|
+
const loadMore = useCallback((source?: "programmatic" | "user") => {
|
|
449
|
+
if (source === "user") releaseRefreshAnchor();
|
|
450
|
+
loadMoreNearEnd();
|
|
451
|
+
}, [loadMoreNearEnd, releaseRefreshAnchor]);
|
|
451
452
|
const metricFields = pickerFields(
|
|
452
453
|
fields.data?.fields.filter((field) => field.kind === "number") ?? [],
|
|
453
454
|
[metric],
|
|
454
455
|
);
|
|
455
456
|
// AS OF earns its column only when some row's focus metric is stale; the
|
|
456
457
|
// snapshot decides, so a live quote freshening a row does not reflow the table.
|
|
457
|
-
const staleFocus = snapshotRows.some((row) => row.metrics[metric]?.state === "stale");
|
|
458
|
+
const staleFocus = useMemo(() => snapshotRows.some((row) => row.metrics[metric]?.state === "stale"), [metric, snapshotRows]);
|
|
458
459
|
// A pre-market, after-hours or overnight column only while a row has such a print.
|
|
459
|
-
const extendedSessions = screenExtendedSessions(rows);
|
|
460
|
+
const extendedSessions = useMemo(() => screenExtendedSessions(rows), [rows]);
|
|
460
461
|
// YTD names the close it is measured from, `31 Dec`.
|
|
461
|
-
const
|
|
462
|
+
const assembledAt = data?.snapshot?.assembledAt;
|
|
463
|
+
const ytdBase = useMemo(() => screenYtdBase(snapshotRows, assembledAt), [assembledAt, snapshotRows]);
|
|
462
464
|
// A screen its currency emptied says so, not that no company matches.
|
|
463
465
|
const currencyEmpty = data && data.rows.length === 0 ? screenCurrencyEmpty(data.definition, data.universe) : null;
|
|
464
466
|
// A criterion's name that matches nothing (`Utility`) says so with the names it was likely meant as.
|
|
@@ -1082,6 +1084,9 @@ function EquityScreenView({
|
|
|
1082
1084
|
rootHeight={bodyHeight - 1}
|
|
1083
1085
|
scrollRef={tableScroll}
|
|
1084
1086
|
onBodyScrollActivity={loadMore}
|
|
1087
|
+
scrollToIndex={refreshAnchor?.index}
|
|
1088
|
+
scrollToIndexAlign={refreshAnchor ? "start" : "nearest"}
|
|
1089
|
+
scrollToIndexVersion={refreshAnchor?.version ?? 0}
|
|
1085
1090
|
resetScrollKey={JSON.stringify(definition)}
|
|
1086
1091
|
visibleRangeKey={JSON.stringify(definition)}
|
|
1087
1092
|
onVisibleRangeChange={setVisibleRange}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
2
|
+
import type { ScreenRow } from "../../../api-client/equity-screener";
|
|
3
|
+
import { screenRowId } from "./model";
|
|
4
|
+
|
|
5
|
+
/** How long a refresh keeps asking the table to hold the row that was at its top. */
|
|
6
|
+
const REFRESH_ANCHOR_HOLD_MS = 2_000;
|
|
7
|
+
|
|
8
|
+
export interface RefreshAnchor {
|
|
9
|
+
index: number;
|
|
10
|
+
version: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* A refresh puts a new snapshot's rows under the scroll position. This asks
|
|
15
|
+
* the table to keep the row that sat at its top there: the anchor is the
|
|
16
|
+
* row's place in the new rows, as a `scrollToIndex` request with a new
|
|
17
|
+
* `version` per refresh. A list at its top stays there, and a row the new
|
|
18
|
+
* snapshot dropped leaves the scroll as it is. The request lapses once the
|
|
19
|
+
* user scrolls (`release`), and a moment after, when the table has long since
|
|
20
|
+
* applied it.
|
|
21
|
+
*/
|
|
22
|
+
export function useRefreshAnchor(
|
|
23
|
+
snapshotId: string | null,
|
|
24
|
+
rows: readonly ScreenRow[],
|
|
25
|
+
firstVisible: number,
|
|
26
|
+
): { anchor: RefreshAnchor | null; release: () => void } {
|
|
27
|
+
const topRow = rows[firstVisible];
|
|
28
|
+
const topRowId = topRow ? screenRowId(topRow) : null;
|
|
29
|
+
const kept = useRef({ snapshotId, topRowId, firstVisible });
|
|
30
|
+
const [anchor, setAnchor] = useState<RefreshAnchor | null>(null);
|
|
31
|
+
useLayoutEffect(() => {
|
|
32
|
+
const before = kept.current;
|
|
33
|
+
kept.current = { snapshotId, topRowId, firstVisible };
|
|
34
|
+
if (!before.topRowId || !before.snapshotId || !snapshotId || before.snapshotId === snapshotId || before.firstVisible === 0) return;
|
|
35
|
+
const index = rows.findIndex((row) => screenRowId(row) === before.topRowId);
|
|
36
|
+
if (index >= 0 && index !== before.firstVisible) setAnchor((current) => ({ index, version: (current?.version ?? 0) + 1 }));
|
|
37
|
+
});
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (!anchor) return;
|
|
40
|
+
const timer = setTimeout(() => setAnchor(null), REFRESH_ANCHOR_HOLD_MS);
|
|
41
|
+
return () => clearTimeout(timer);
|
|
42
|
+
}, [anchor]);
|
|
43
|
+
const release = useCallback(() => setAnchor(null), []);
|
|
44
|
+
return { anchor, release };
|
|
45
|
+
}
|
|
@@ -8,7 +8,16 @@ import { logFailure } from "../../../utils/log-failure";
|
|
|
8
8
|
import { fetchScreen } from "./client";
|
|
9
9
|
import { appendScreenPage } from "./model";
|
|
10
10
|
|
|
11
|
-
/**
|
|
11
|
+
/** A refresh re-reads what a long list holds, up to this many rows, so it does not walk an endless one. */
|
|
12
|
+
const REFRESH_ROW_LIMIT = 1_000;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Query changes and pagination cannot exchange data across immutable snapshots.
|
|
16
|
+
* A refresh of a screen already loaded replaces its rows in place: the first
|
|
17
|
+
* page of the new snapshot, then as many more as the list held, swapped in
|
|
18
|
+
* together so the table keeps its length and its scroll position. A refresh
|
|
19
|
+
* that finds the same snapshot keeps the pages as they are.
|
|
20
|
+
*/
|
|
12
21
|
export function useScreenResults(
|
|
13
22
|
definition: ScreenDefinition,
|
|
14
23
|
sessionKey: string,
|
|
@@ -42,6 +51,7 @@ export function useScreenResults(
|
|
|
42
51
|
moreController.current = null;
|
|
43
52
|
const request = new AbortController();
|
|
44
53
|
controller.current = request;
|
|
54
|
+
const held = stateRef.current.identity === identity ? stateRef.current.data : null;
|
|
45
55
|
setState((current) => ({
|
|
46
56
|
identity,
|
|
47
57
|
data: current.identity === identity ? current.data : null,
|
|
@@ -51,8 +61,18 @@ export function useScreenResults(
|
|
|
51
61
|
updatedAt: current.identity === identity ? current.updatedAt : null,
|
|
52
62
|
}));
|
|
53
63
|
try {
|
|
54
|
-
|
|
64
|
+
let data = await fetcher(definition, null, request.signal);
|
|
55
65
|
if (request.signal.aborted || activeIdentity.current !== identity) return;
|
|
66
|
+
if (held?.snapshot && data.snapshot?.id === held.snapshot.id) {
|
|
67
|
+
data = held;
|
|
68
|
+
} else if (held) {
|
|
69
|
+
const wanted = Math.min(held.rows.length, REFRESH_ROW_LIMIT);
|
|
70
|
+
while (data.nextCursor && data.rows.length < wanted) {
|
|
71
|
+
const page = await fetcher(definition, data.nextCursor, request.signal);
|
|
72
|
+
if (request.signal.aborted || activeIdentity.current !== identity) return;
|
|
73
|
+
data = appendScreenPage(data, page);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
56
76
|
setState({
|
|
57
77
|
identity,
|
|
58
78
|
data,
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import type { NumericField, ScreenCheckPayload, ScreenCriterion, ScreenDefinition } from "../../../api-client/equity-screener";
|
|
2
|
-
import {
|
|
2
|
+
import { parseListingArg } from "../../../cli/listing-arg";
|
|
3
|
+
import { canonicalExchange } from "../../../utils/exchanges";
|
|
3
4
|
import { criterionText, formatScreenValue, GRADE_DISPLAY_FIELDS, parseScreenDefinition, screenDefinitionKey, screenLabel } from "./model";
|
|
4
5
|
|
|
5
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* One listing, read as `quote` reads it before it asks: 700:HKEX, 700.HK and
|
|
8
|
+
* 00700.HK are 0700:HKEX, GARAN.IS is GARAN:BIST, "VOD LN" VOD:LSE. A bare
|
|
9
|
+
* symbol stays bare, for the screen to pick its listing.
|
|
10
|
+
*/
|
|
6
11
|
export function screenCheckTicker(text: string): { symbol: string; exchange?: string } {
|
|
7
|
-
const
|
|
12
|
+
const listing = parseListingArg(text.trim(), null, { listingSuffix: true });
|
|
13
|
+
const ticker = listing.exchange ? { symbol: listing.symbol, exchange: listing.exchange } : { symbol: listing.symbol };
|
|
8
14
|
if (!/^[A-Z0-9][A-Z0-9./-]{0,31}$/.test(ticker.symbol)
|
|
9
15
|
|| (ticker.exchange !== undefined && !/^[A-Z0-9_-]{1,24}$/.test(ticker.exchange)))
|
|
10
16
|
throw new Error("Enter one ticker, such as NVDA or NVDA:NASDAQ.");
|
|
@@ -54,6 +54,21 @@ function projectFearGreedHeadless(data: FearGreedData): HeadlessBundleResult {
|
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
/** `fn FNG` over a loaded reading, which the pane's footer also reads its source line from. */
|
|
58
|
+
export function fearGreedReport(result: FearGreedLoadResult): HeadlessBundleResult {
|
|
59
|
+
// A copy kept for a refresh that could not get through (offline, a timeout) ends the report with when it was
|
|
60
|
+
// saved, as other reports do; any other failure stays an error beside the old reading.
|
|
61
|
+
const savedCopy = result.source === "stale-fallback" && isTransientFailure(result.error);
|
|
62
|
+
const metadata = { fetchedAt: result.fetchedAt, stale: result.stale };
|
|
63
|
+
return {
|
|
64
|
+
...projectFearGreedHeadless(result.data),
|
|
65
|
+
...(result.refreshError && !savedCopy ? { errors: [result.refreshError] } : {}),
|
|
66
|
+
// A cached index the refresh could not replace is stale; otherwise CNN's published reading.
|
|
67
|
+
freshness: { source: "CNN", status: result.stale ? "stale" : "not-a-feed", basis: "published index" },
|
|
68
|
+
metadata: savedCopy ? servedFromSavedCopy(metadata, result.fetchedAt) : metadata,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
57
72
|
export interface FearGreedHeadlessDependencies {
|
|
58
73
|
load(args: HeadlessPaneLoadArgs, signal: AbortSignal): Promise<FearGreedLoadResult>;
|
|
59
74
|
}
|
|
@@ -73,19 +88,7 @@ export function createFearGreedHeadless(
|
|
|
73
88
|
options: [],
|
|
74
89
|
describe: "Fear & Greed",
|
|
75
90
|
async load(args, ctx) {
|
|
76
|
-
|
|
77
|
-
const projected = projectFearGreedHeadless(result.data);
|
|
78
|
-
// A copy kept for a refresh that could not get through (offline, a timeout) ends the report with when it was
|
|
79
|
-
// saved, as other reports do; any other failure stays an error beside the old reading.
|
|
80
|
-
const savedCopy = result.source === "stale-fallback" && isTransientFailure(result.error);
|
|
81
|
-
const metadata = { fetchedAt: result.fetchedAt, stale: result.stale };
|
|
82
|
-
return {
|
|
83
|
-
...projected,
|
|
84
|
-
...(result.refreshError && !savedCopy ? { errors: [result.refreshError] } : {}),
|
|
85
|
-
// A cached index the refresh could not replace is stale; otherwise CNN's published reading.
|
|
86
|
-
freshness: { source: "CNN", status: result.stale ? "stale" : "not-a-feed", basis: "published index" },
|
|
87
|
-
metadata: savedCopy ? servedFromSavedCopy(metadata, result.fetchedAt) : metadata,
|
|
88
|
-
};
|
|
91
|
+
return fearGreedReport(await dependencies.load(args, ctx.signal));
|
|
89
92
|
},
|
|
90
93
|
};
|
|
91
94
|
}
|
|
@@ -14,7 +14,9 @@ import { usePaneRefreshKey } from "../../../components/data-table/table-pane";
|
|
|
14
14
|
import { useAsyncResource } from "../../../react/async-resource";
|
|
15
15
|
import type { PaneProps } from "../../../types/plugin";
|
|
16
16
|
import { Box, ScrollBox, useUiHost } from "../../../ui";
|
|
17
|
-
import { useAutoRefresh, useUpdatedAgo } from "../../../react/auto-refresh";
|
|
17
|
+
import { useAutoRefresh, useUpdatedAgo, useUtcDay } from "../../../react/auto-refresh";
|
|
18
|
+
import { reportFooterSegment } from "../shared/source-footer";
|
|
19
|
+
import { fearGreedHeadless, fearGreedReport } from "./headless";
|
|
18
20
|
import { getCachedFearGreedData, loadFearGreed, type FearGreedLoadResult } from "./cache";
|
|
19
21
|
import { IndexHistoryChart, IndicatorChart } from "./charts";
|
|
20
22
|
import type { FearGreedData } from "./data";
|
|
@@ -57,6 +59,8 @@ export function FearGreedPane({ paneId, focused, width, height }: PaneProps) {
|
|
|
57
59
|
|
|
58
60
|
usePaneRefreshKey(refresh, { focused });
|
|
59
61
|
|
|
62
|
+
const utcDay = useUtcDay();
|
|
63
|
+
const loaded = resource.data;
|
|
60
64
|
const footerInfo = useMemo(() => [
|
|
61
65
|
...(data ? [{
|
|
62
66
|
id: "score",
|
|
@@ -64,10 +68,14 @@ export function FearGreedPane({ paneId, focused, width, height }: PaneProps) {
|
|
|
64
68
|
{ text: `${formatScore(data.overall.score)} ${ratingLabel(data.overall.rating)}`, color: ratingColor(data.overall.rating), bold: true },
|
|
65
69
|
],
|
|
66
70
|
}] : []),
|
|
67
|
-
|
|
68
|
-
|
|
71
|
+
// Its source and when CNN published the reading, as `fn FNG` ends, a stale one with its warning beside it;
|
|
72
|
+
// a saved copy says when it was saved instead.
|
|
73
|
+
...(savedAt != null ? [savedCopyFooterSegment("saved-copy", savedAt)] : [
|
|
74
|
+
...(loaded?.data ? [reportFooterSegment(fearGreedHeadless, fearGreedReport({ ...loaded, stale: false }))] : []),
|
|
75
|
+
...(stale ? [{ id: "stale", parts: [{ text: "stale", tone: "warning" as const }] }] : []),
|
|
76
|
+
]),
|
|
69
77
|
...(updatedAgo ? [ageFooterSegment(updatedAgo, { id: "age", verb: "updated", tone: "value" })] : []),
|
|
70
|
-
], [data, savedAt, stale, updatedAgo]);
|
|
78
|
+
], [data, loaded, savedAt, stale, updatedAgo, utcDay]);
|
|
71
79
|
usePaneStatusFooter({ registrationId: paneId, loading, error, info: footerInfo });
|
|
72
80
|
|
|
73
81
|
const previousScores = useMemo(() => (data ? previousScoreItems(data) : []), [data]);
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
import { handleRefreshKey } from "../../../components/data-table/table-pane";
|
|
16
16
|
import { useRemoteUiNode } from "../../../remote/semantic-tree";
|
|
17
17
|
import { usePaneVisible } from "../../../state/app/activity";
|
|
18
|
-
import { usePaneInstance, usePaneSettingValue } from "../../../state/app/context";
|
|
18
|
+
import { useOptionalPaneSettingUpdater, usePaneInstance, usePaneSettingValue } from "../../../state/app/context";
|
|
19
19
|
import { TICKER_RESEARCH_PANE_ID } from "../../../types/config";
|
|
20
20
|
import type { PaneProps } from "../../../types/plugin";
|
|
21
21
|
import { isPlainKey } from "../../../utils/keyboard";
|
|
@@ -60,6 +60,7 @@ import {
|
|
|
60
60
|
} from "./model";
|
|
61
61
|
import {
|
|
62
62
|
createFuturesColumns,
|
|
63
|
+
DEFAULT_FUTURES_COLUMN_IDS,
|
|
63
64
|
FUTURES_COLUMN_DEFS,
|
|
64
65
|
FUTURES_REPORT_COLUMNS,
|
|
65
66
|
renderFuturesCell,
|
|
@@ -88,6 +89,7 @@ export function FuturesPane({ focused, width, height }: PaneProps) {
|
|
|
88
89
|
const { pinTicker } = usePluginTickerActions();
|
|
89
90
|
const dataProvider = useAssetData();
|
|
90
91
|
const paneInstance = usePaneInstance();
|
|
92
|
+
const updateColumnIds = useOptionalPaneSettingUpdater(paneInstance?.instanceId ?? null, "columnIds");
|
|
91
93
|
const liveStreaming = useLiveStreamingSetting();
|
|
92
94
|
const [selectedId, setSelectedId] = useState<string | null>(null);
|
|
93
95
|
const [sortPreference, setSortPreference] = useState<FuturesSortPreference>(DEFAULT_FUTURES_SORT);
|
|
@@ -154,6 +156,17 @@ export function FuturesPane({ focused, width, height }: PaneProps) {
|
|
|
154
156
|
})), [columns, returns]);
|
|
155
157
|
const titledColumns = useMemo(() => returnBases.size === 0 ? columns
|
|
156
158
|
: columns.map((column) => returnBases.has(column.id) ? { ...column, title: returnBases.get(column.id) } : column), [columns, returnBases]);
|
|
159
|
+
// A header dragged to a new place rewrites the Columns setting; back in the default order, the setting goes, so
|
|
160
|
+
// columns later added to the defaults still show. The session mark and the symbol name the row and stay first.
|
|
161
|
+
const anchoredColumns = columns.findIndex((column) => column.id !== "status" && column.id !== "code");
|
|
162
|
+
const columnReorder = useMemo(() => ({
|
|
163
|
+
anchored: anchoredColumns > 0 ? anchoredColumns : undefined,
|
|
164
|
+
control: {
|
|
165
|
+
order: visibleColumnIds,
|
|
166
|
+
defaultOrder: DEFAULT_FUTURES_COLUMN_IDS,
|
|
167
|
+
onChange: (ids: string[] | undefined) => updateColumnIds(() => ids),
|
|
168
|
+
},
|
|
169
|
+
}), [anchoredColumns, updateColumnIds, visibleColumnIds]);
|
|
157
170
|
useRemoteUiNode(returnBases.size > 0 ? {
|
|
158
171
|
role: "report-notice",
|
|
159
172
|
label: "Return base dates",
|
|
@@ -369,6 +382,7 @@ export function FuturesPane({ focused, width, height }: PaneProps) {
|
|
|
369
382
|
rootWidth={width}
|
|
370
383
|
rootHeight={height}
|
|
371
384
|
columns={titledColumns}
|
|
385
|
+
columnReorder={columnReorder}
|
|
372
386
|
items={dataProvider ? rows : []}
|
|
373
387
|
sortable
|
|
374
388
|
sortColumnId={sortPreference.columnId}
|
|
@@ -37,7 +37,7 @@ export const FUTURES_COLUMN_DEFS: readonly FuturesColumnDef[] = [
|
|
|
37
37
|
{ id: "time", label: "Time", description: "UTC time of the last quote." },
|
|
38
38
|
];
|
|
39
39
|
|
|
40
|
-
const DEFAULT_FUTURES_COLUMN_IDS = FUTURES_COLUMN_DEFS.map((column) => column.id);
|
|
40
|
+
export const DEFAULT_FUTURES_COLUMN_IDS = FUTURES_COLUMN_DEFS.map((column) => column.id);
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* Extra columns only earn their width once the board is wide enough to keep a
|
|
@@ -20,7 +20,7 @@ import { useFxRatesMap } from "../../../market-data/hooks";
|
|
|
20
20
|
import { resolveEntryData } from "../../../market-data/selectors";
|
|
21
21
|
import { useRemoteUiNode } from "../../../remote/semantic-tree";
|
|
22
22
|
import { usePaneSettingValue, useUpdatePaneSettings } from "../../../state/app/context";
|
|
23
|
-
import { colors, shownPriceColor } from "../../../theme/colors";
|
|
23
|
+
import { colors, inactiveSelectedBg, shownPriceColor } from "../../../theme/colors";
|
|
24
24
|
import { formatPercentRaw, MISSING_VALUE } from "../../../utils/format";
|
|
25
25
|
import type {
|
|
26
26
|
CommandBarResultDef, CommandBarSearchProvider, GloomPluginContext, PaneProps, PaneTemplateContext, PaneTemplateCreateOptions,
|
|
@@ -33,7 +33,8 @@ import { summarizeFxRates, fxStatusLabel } from "../../../utils/fx-status";
|
|
|
33
33
|
import type { PluginModule } from "../plugin-module";
|
|
34
34
|
import { fxRateObservations } from "../shared/fx-rate-freshness";
|
|
35
35
|
import { useLiveQuoteEntries } from "../../../state/hooks/quote-streaming";
|
|
36
|
-
import { useAutoRefresh, useUpdatedAgo } from "../../../react/auto-refresh";
|
|
36
|
+
import { useAutoRefresh, useUpdatedAgo, useUtcDay } from "../../../react/auto-refresh";
|
|
37
|
+
import { reportFooterSegment } from "../shared/source-footer";
|
|
37
38
|
import { useLiveStreamingSetting } from "../../../state/hooks/live-streaming";
|
|
38
39
|
import { fxBoardMoveDay, fxLegMoveReference, fxLegQuoteKey, fxLegReferenceRate, fxLegSavedAt, fxLegTargets, fxLegs, fxLegsBehind, liveFxLegEntry } from "./live-legs";
|
|
39
40
|
import { CURRENCY_FLAG_REGIONS, FX_CURRENCIES, formatRate, resolveCurrencies, type FxCurrency } from "./pairs";
|
|
@@ -195,20 +196,19 @@ function FxMatrixPane({ focused, width, height }: PaneProps) {
|
|
|
195
196
|
}));
|
|
196
197
|
// A report or capture of the board is dated by the rates it draws: when each
|
|
197
198
|
// was observed, whether it is delayed or stale, and where the FX market
|
|
198
|
-
// stands. The
|
|
199
|
+
// stands. The footer ends with the same line, as `fn FXC` does.
|
|
200
|
+
const rateObservations = () => {
|
|
201
|
+
const legQuotes = new Map(legs.map((leg) => [leg.currency, resolveEntryData(legEntries.get(fxLegQuoteKey(leg)))] as const));
|
|
202
|
+
return fxRateObservations(currencies, rates, (currency) => ({
|
|
203
|
+
entry: rateEntries.get(currency),
|
|
204
|
+
// Only a rate that is the pair quote's own says what that quote says.
|
|
205
|
+
legQuote: liveEntries.has(currency) ? legQuotes.get(currency) : null,
|
|
206
|
+
}));
|
|
207
|
+
};
|
|
199
208
|
useRemoteUiNode({
|
|
200
209
|
role: "report-freshness",
|
|
201
210
|
label: "Rate freshness",
|
|
202
|
-
getMetadata: () => {
|
|
203
|
-
const legQuotes = new Map(legs.map((leg) => [leg.currency, resolveEntryData(legEntries.get(fxLegQuoteKey(leg)))] as const));
|
|
204
|
-
return {
|
|
205
|
-
observations: fxRateObservations(currencies, rates, (currency) => ({
|
|
206
|
-
entry: rateEntries.get(currency),
|
|
207
|
-
// Only a rate that is the pair quote's own says what that quote says.
|
|
208
|
-
legQuote: liveEntries.has(currency) ? legQuotes.get(currency) : null,
|
|
209
|
-
})),
|
|
210
|
-
};
|
|
211
|
-
},
|
|
211
|
+
getMetadata: () => ({ observations: rateObservations() }),
|
|
212
212
|
});
|
|
213
213
|
const status = summarizeFxRates(currencies, rates, (currency) => rateEntries.get(currency));
|
|
214
214
|
const statusText = fxStatusLabel(status);
|
|
@@ -300,7 +300,7 @@ function FxMatrixPane({ focused, width, height }: PaneProps) {
|
|
|
300
300
|
row: FxCurrency,
|
|
301
301
|
column: DataTableColumn,
|
|
302
302
|
_index: number,
|
|
303
|
-
rowState: { selected: boolean },
|
|
303
|
+
rowState: { selected: boolean; inactive?: boolean },
|
|
304
304
|
): DataTableCell => {
|
|
305
305
|
if (column.id === "base") {
|
|
306
306
|
return {
|
|
@@ -344,9 +344,12 @@ function FxMatrixPane({ focused, width, height }: PaneProps) {
|
|
|
344
344
|
? crossMovePercent(base, rowReference, quote, columnReference)
|
|
345
345
|
: null,
|
|
346
346
|
);
|
|
347
|
-
// The cursor row keeps its selection colours
|
|
347
|
+
// The cursor row keeps its selection colours, quieter while the board does
|
|
348
|
+
// not have the keys; the tint leans on them.
|
|
348
349
|
const backgroundColor = rowState.selected
|
|
349
|
-
?
|
|
350
|
+
? rowState.inactive
|
|
351
|
+
? directionTint(level, { background: inactiveSelectedBg(colors), text: colors.text })
|
|
352
|
+
: directionTint(level, { background: colors.selected, text: colors.selectedText })
|
|
350
353
|
: directionTint(level, { background: colors.bg, text: colors.text });
|
|
351
354
|
return { text: formatRate(base / quote, quoteCurrency, reference), color: colors.text, backgroundColor };
|
|
352
355
|
}, [amount?.currency, convertedAmount, directionReferences, flagged, moveVsUsd, rates, referenceRates, status.loading]);
|
|
@@ -354,6 +357,7 @@ function FxMatrixPane({ focused, width, height }: PaneProps) {
|
|
|
354
357
|
const handleKeyDown = useCallback((event: DataTableKeyEvent) => handleRefreshKey(event, refresh), [refresh]);
|
|
355
358
|
|
|
356
359
|
const updatedAgo = useUpdatedAgo(status.latestFetchedAt || null);
|
|
360
|
+
const utcDay = useUtcDay();
|
|
357
361
|
|
|
358
362
|
usePaneFooter(FX_MATRIX_PANE_ID, () => {
|
|
359
363
|
const info: PaneFooterSegment[] = [];
|
|
@@ -361,13 +365,20 @@ function FxMatrixPane({ focused, width, height }: PaneProps) {
|
|
|
361
365
|
const unreadAmount = amountError ?? (typedAmount && "error" in typedAmount ? typedAmount.error : null);
|
|
362
366
|
if (unreadAmount) info.push({ id: "amount", parts: [{ text: unreadAmount, tone: "warning" }] });
|
|
363
367
|
if (status.loading > 0) info.push({ id: "loading", parts: [{ text: "loading", tone: "muted" }] });
|
|
364
|
-
|
|
368
|
+
// Where the rates are from and when, as `fn FXC` ends, dates them: the rates' status then says only what is wrong,
|
|
369
|
+
// naming the pair, never the oldest rate's time again.
|
|
370
|
+
const observations = savedAt == null ? rateObservations() : [];
|
|
371
|
+
const warns = !!(status.stale || status.unknownTime || status.unavailable);
|
|
372
|
+
if (statusText && (warns || observations.length === 0)) info.push({ id: "rates", parts: [{ text: statusText, tone: warns ? "warning" : "muted" }] });
|
|
365
373
|
// Every cross is read through each currency's dollar pair, the amount column too; `fx` reads a pair's own quote.
|
|
366
374
|
info.push({ id: "cross", parts: [{ text: "via USD", tone: "muted" }] });
|
|
367
375
|
if (savedAt != null) info.push(savedCopyFooterSegment("updated", savedAt));
|
|
368
|
-
else
|
|
376
|
+
else {
|
|
377
|
+
if (observations.length) info.push(reportFooterSegment(fxMatrixHeadless, { rows: [], freshness: { observations } }));
|
|
378
|
+
if (updatedAgo) info.push(ageFooterSegment(updatedAgo, { verb: "fetched" }));
|
|
379
|
+
}
|
|
369
380
|
return { info };
|
|
370
|
-
}, [amountError, savedAt, status.loading, statusText, typedAmount, updatedAgo]);
|
|
381
|
+
}, [amountError, rates, savedAt, status.loading, status.stale, status.unavailable, status.unknownTime, statusText, typedAmount, updatedAgo, utcDay]);
|
|
371
382
|
|
|
372
383
|
const queryBar = (
|
|
373
384
|
<QueryBar
|
|
@@ -405,6 +416,8 @@ function FxMatrixPane({ focused, width, height }: PaneProps) {
|
|
|
405
416
|
resetScrollKey={amount ? storedFxBoardAmount(amount) : ""}
|
|
406
417
|
// A pane too narrow for every currency scrolls to the rest, as other wide tables do; the row's code stays.
|
|
407
418
|
columns={allColumns}
|
|
419
|
+
// Each column is a row's currency in the same order: the matrix reads across and down alike.
|
|
420
|
+
columnReorder={false}
|
|
408
421
|
freezeFirstColumn
|
|
409
422
|
getExportMetadata={() => createFxExportMetadata(currencies, rates,
|
|
410
423
|
(currency) => rateEntries.get(currency))}
|
|
@@ -19,7 +19,7 @@ import { useAsyncResource } from "../../../react/async-resource";
|
|
|
19
19
|
import { useShortcut } from "../../../react/input";
|
|
20
20
|
import { colors, priceColor } from "../../../theme/colors";
|
|
21
21
|
import type { HolderData } from "../../../types/financials";
|
|
22
|
-
import { clipToDisplayWidth, formatCompact } from "../../../utils/format";
|
|
22
|
+
import { clipToDisplayWidth, displayWidth, formatCompact } from "../../../utils/format";
|
|
23
23
|
import { isPlainKey } from "../../../utils/keyboard";
|
|
24
24
|
import { nextHeaderSort } from "../../../utils/sort-values";
|
|
25
25
|
import { useAssetData, usePluginAppActions, usePluginPaneState } from "../../runtime";
|
|
@@ -66,6 +66,34 @@ function cikMatches(rows: readonly HolderRow[]): Map<string, Holder13FMatch> {
|
|
|
66
66
|
/** The width of a three-letter badge ("13F", "ADR"): the label and its padding. */
|
|
67
67
|
const BADGE_WIDTH = 5;
|
|
68
68
|
|
|
69
|
+
/**
|
|
70
|
+
* A holder's name and its markers. ADR: a position held as receipts on a home line's list. 13F: a fund
|
|
71
|
+
* whose filing opens on Enter or o. The name gives way first, so the markers survive a narrow column;
|
|
72
|
+
* the cell says how wide it draws whole (`contentWidth`), so the table fits the column to it.
|
|
73
|
+
*/
|
|
74
|
+
export function holderNameCell(
|
|
75
|
+
name: string,
|
|
76
|
+
{ receipts, fund }: { receipts: string; fund: boolean },
|
|
77
|
+
color: string,
|
|
78
|
+
width: number,
|
|
79
|
+
): DataTableCell {
|
|
80
|
+
if (!receipts && !fund) return { text: name, color, attributes: TextAttributes.BOLD };
|
|
81
|
+
const badges = (receipts ? 1 : 0) + (fund ? 1 : 0);
|
|
82
|
+
return {
|
|
83
|
+
text: [name, receipts, fund ? "13F" : ""].filter(Boolean).join(" "),
|
|
84
|
+
contentWidth: displayWidth(name) + badges * (BADGE_WIDTH + 1),
|
|
85
|
+
content: (
|
|
86
|
+
<Box flexDirection="row" gap={1} width={width} overflow="hidden">
|
|
87
|
+
<Text fg={color} attributes={TextAttributes.BOLD}>
|
|
88
|
+
{clipToDisplayWidth(name, Math.max(1, width - badges * (BADGE_WIDTH + 1)))}
|
|
89
|
+
</Text>
|
|
90
|
+
{receipts ? <Badge label={receipts} /> : null}
|
|
91
|
+
{fund ? <Badge label="13F" tone="accent" /> : null}
|
|
92
|
+
</Box>
|
|
93
|
+
),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
69
97
|
export function HoldersView({ focused, width, height }: { focused: boolean; width: number; height: number }) {
|
|
70
98
|
const { nativePaneChrome } = useUiCapabilities();
|
|
71
99
|
const { symbol, ticker, financials } = usePaneTicker();
|
|
@@ -286,25 +314,7 @@ export function HoldersView({ focused, width, height }: { focused: boolean; widt
|
|
|
286
314
|
switch (column.id) {
|
|
287
315
|
case "holder": {
|
|
288
316
|
const color = rowState.selected ? colors.selectedText : colors.textBright;
|
|
289
|
-
|
|
290
|
-
// whose filing opens on Enter or o.
|
|
291
|
-
const receipts = holderShareBasisMarker(row);
|
|
292
|
-
const fund = fundMatches.has(row.id);
|
|
293
|
-
if (!receipts && !fund) return { text: row.name, color, attributes: TextAttributes.BOLD };
|
|
294
|
-
const badges = (receipts ? 1 : 0) + (fund ? 1 : 0);
|
|
295
|
-
// The name gives way first, so the markers survive a narrow column.
|
|
296
|
-
return {
|
|
297
|
-
text: [row.name, receipts, fund ? "13F" : ""].filter(Boolean).join(" "),
|
|
298
|
-
content: (
|
|
299
|
-
<Box flexDirection="row" gap={1} width={column.width} overflow="hidden">
|
|
300
|
-
<Text fg={color} attributes={TextAttributes.BOLD}>
|
|
301
|
-
{clipToDisplayWidth(row.name, Math.max(1, column.width - badges * (BADGE_WIDTH + 1)))}
|
|
302
|
-
</Text>
|
|
303
|
-
{receipts ? <Badge label={receipts} /> : null}
|
|
304
|
-
{fund ? <Badge label="13F" tone="accent" /> : null}
|
|
305
|
-
</Box>
|
|
306
|
-
),
|
|
307
|
-
};
|
|
317
|
+
return holderNameCell(row.name, { receipts: holderShareBasisMarker(row), fund: fundMatches.has(row.id) }, color, column.width);
|
|
308
318
|
}
|
|
309
319
|
case "value":
|
|
310
320
|
return { text: formatMoneyCompact(row.value, currency, { code: currencyCode }), color: colors.text };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Box, Text } from "../../../ui";
|
|
2
2
|
import type { DataTableCell } from "../../../components";
|
|
3
|
-
import { colors } from "../../../theme/colors";
|
|
3
|
+
import { colors, inactiveSelectedText } from "../../../theme/colors";
|
|
4
4
|
import { blendForContrast } from "../../../theme/color-utils";
|
|
5
5
|
import { clipToDisplayWidth, displayWidth } from "../../../utils/format";
|
|
6
6
|
import type { InsiderTypeTone } from "./display";
|
|
@@ -24,10 +24,12 @@ export function insiderToneColor(tone: InsiderTypeTone): string {
|
|
|
24
24
|
return tone === "buy" ? colors.positive : tone === "sell" ? colors.negative : colors.textDim;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
function typeColor(tone: InsiderTypeTone, selected: boolean): string {
|
|
28
|
-
|
|
27
|
+
function typeColor(tone: InsiderTypeTone, selected: boolean, inactive: boolean): string {
|
|
28
|
+
// On the quieter fill of a pane without the keys, the row keeps its own colours, lifted to read there.
|
|
29
|
+
if (tone === "neutral") return !selected ? colors.textDim : inactive ? inactiveSelectedText(colors.textDim) : colors.selectedText;
|
|
29
30
|
const color = insiderToneColor(tone);
|
|
30
|
-
|
|
31
|
+
if (!selected) return color;
|
|
32
|
+
return inactive ? inactiveSelectedText(color) : blendForContrast(color, colors.selected, colors.selectedText, SELECTED_TONE_MIN_CONTRAST);
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
function isoDay(date: Date | null): string | null {
|
|
@@ -38,7 +40,7 @@ export function renderInsiderCell(
|
|
|
38
40
|
row: InsiderTableRow,
|
|
39
41
|
column: InsiderColumn,
|
|
40
42
|
_index: number,
|
|
41
|
-
rowState: { selected: boolean },
|
|
43
|
+
rowState: { selected: boolean; inactive?: boolean },
|
|
42
44
|
): DataTableCell {
|
|
43
45
|
// Awards, exercises and tax lines are context; buys and sales carry the figures.
|
|
44
46
|
const figureColor = row.tone === "neutral" ? colors.textDim : colors.text;
|
|
@@ -50,12 +52,13 @@ export function renderInsiderCell(
|
|
|
50
52
|
case "role":
|
|
51
53
|
return { text: row.role, color: colors.textMuted };
|
|
52
54
|
case "type": {
|
|
53
|
-
const
|
|
55
|
+
const inactive = rowState.inactive === true;
|
|
56
|
+
const color = typeColor(row.tone, rowState.selected, inactive);
|
|
54
57
|
const text = insiderTypeText(row, column.plan === true);
|
|
55
58
|
const markers = insiderTypeMarkers(row, column.plan === true);
|
|
56
59
|
if (markers.length === 0) return { text, color, keepColorWhenSelected: true };
|
|
57
60
|
// The markers read after the type in a quieter colour.
|
|
58
|
-
const markerColor = rowState.selected ? colors.
|
|
61
|
+
const markerColor = !rowState.selected ? colors.textMuted : inactive ? inactiveSelectedText(colors.textMuted) : colors.selectedText;
|
|
59
62
|
const label = clipToDisplayWidth(row.type, column.width);
|
|
60
63
|
const room = Math.max(0, column.width - displayWidth(label) - (label ? 1 : 0));
|
|
61
64
|
return {
|
|
@@ -249,7 +249,7 @@ function TickersTradesView({ symbols, width, height, focused, viewBar }: Tickers
|
|
|
249
249
|
</Box>
|
|
250
250
|
);
|
|
251
251
|
}
|
|
252
|
-
const renderCell = (row: TickerTradeRow, column: TradeColumn, index: number, state: { selected: boolean }): DataTableCell =>
|
|
252
|
+
const renderCell = (row: TickerTradeRow, column: TradeColumn, index: number, state: { selected: boolean; inactive?: boolean }): DataTableCell =>
|
|
253
253
|
column.id === "ticker"
|
|
254
254
|
? listingCell(row.ticker, colors, state.selected)
|
|
255
255
|
: renderInsiderCell(row, column as InsiderColumn, index, state);
|
|
@@ -20,6 +20,10 @@ interface ReleaseOffsetRow {
|
|
|
20
20
|
/** 25-delta put IV minus call IV, and the risk reversal, call minus put. */
|
|
21
21
|
skew25d: number | null;
|
|
22
22
|
rr25d: number | null;
|
|
23
|
+
/** What a policy decision did (held, raised 75bp) and the rate after it and before, where Gloom Cloud has them. */
|
|
24
|
+
decision: string | null;
|
|
25
|
+
actual: string | null;
|
|
26
|
+
prior: string | null;
|
|
23
27
|
}
|
|
24
28
|
|
|
25
29
|
export interface ReleaseOffsets {
|
|
@@ -132,6 +136,7 @@ export function releaseOffsetRows(
|
|
|
132
136
|
iv30: iv30.get(date) ?? null, iv90: iv90.get(date) ?? null, iv365: iv365.get(date) ?? null,
|
|
133
137
|
hv: hv.get(date) ?? null, spread: spread.get(date) ?? null,
|
|
134
138
|
skew25d: skewValue, rr25d: skewValue == null ? null : -skewValue,
|
|
139
|
+
decision: release.figures?.decision ?? null, actual: release.figures?.actual ?? null, prior: release.figures?.prior ?? null,
|
|
135
140
|
});
|
|
136
141
|
}
|
|
137
142
|
return result;
|