gloomberb 0.19.5 → 0.20.0
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/LICENSE +0 -4
- package/package.json +6 -5
- package/patches/@opentui%2Fcore@0.3.2.patch +86 -25
- package/patches/electrobun-devkit@2.0.5.patch +148 -0
- package/src/api-client/bond-trades.ts +59 -0
- package/src/api-client/data.ts +21 -0
- package/src/api-client/equity-screener.ts +23 -0
- package/src/api-client/index.ts +2 -0
- package/src/api-client/types/account.ts +86 -0
- package/src/api-client/types/assist.ts +32 -0
- package/src/api-client/types/auth.ts +63 -0
- package/src/api-client/types/billing.ts +54 -0
- package/src/api-client/types/chat.ts +180 -0
- package/src/api-client/types/congress.ts +107 -0
- package/src/api-client/types/credit.ts +110 -0
- package/src/api-client/types/econ.ts +158 -0
- package/src/api-client/types/equity-diagnostic.ts +73 -0
- package/src/api-client/types/filings-and-calls.ts +350 -0
- package/src/api-client/types/index.ts +25 -0
- package/src/api-client/types/jobs.ts +147 -0
- package/src/api-client/types/market.ts +122 -0
- package/src/api-client/types/news.ts +91 -0
- package/src/api-client/types/notes-and-theses.ts +172 -0
- package/src/api-client/types/quotes.ts +28 -0
- package/src/api-client/types/scanners.ts +125 -0
- package/src/api-client/types/screener.ts +65 -0
- package/src/api-client/types/search.ts +107 -0
- package/src/api-client/types/sync.ts +14 -0
- package/src/api-client/types/team-collections.ts +43 -0
- package/src/api-client/types/team-views.ts +32 -0
- package/src/api-client/types/teams.ts +135 -0
- package/src/api-client/types/ticker-data.ts +57 -0
- package/src/api-client/types/tweets.ts +59 -0
- package/src/api-client/types/world-venues.ts +23 -0
- package/src/app/pane-runtime/index.tsx +2 -0
- package/src/app/pane-runtime/plugin-bindings.ts +10 -1
- package/src/app/runtime/desktop-deeplink.ts +41 -6
- package/src/app/star-prompt/status-line.tsx +1 -1
- package/src/app.tsx +64 -23
- package/src/architecture/ui-tokens-allowlist.json +0 -8
- package/src/cli/commands/market.ts +149 -10
- package/src/cli/commands/search.ts +21 -3
- package/src/cli/commands/ticker.ts +90 -36
- package/src/cli/desktop-pane-shot-browser.ts +69 -3
- package/src/cli/glossary.ts +3 -3
- package/src/cli/known-gaps.ts +8 -0
- package/src/cli/listing-arg.ts +12 -0
- package/src/cli/pane-functions/capabilities.ts +2 -0
- package/src/cli/pane-functions/catalog.ts +25 -5
- package/src/cli/pane-functions/function-help.ts +8 -5
- package/src/cli/pane-functions/headless.ts +4 -3
- package/src/cli/pane-functions/resolver.ts +75 -2
- package/src/cli/quote-answer.ts +9 -0
- package/src/cli/symbol-list.ts +54 -2
- package/src/cli/symbol-rows.ts +14 -2
- package/src/cli/ticker-resolution.ts +89 -20
- package/src/components/chart/composite/axis-overlays.tsx +60 -27
- package/src/components/chart/composite/composite-chart.tsx +118 -63
- package/src/components/chart/composite/cursor-source.ts +111 -0
- package/src/components/chart/composite/format.ts +168 -6
- package/src/components/chart/composite/legend.tsx +8 -4
- package/src/components/chart/composite/panel-labels.ts +20 -1
- package/src/components/chart/composite/panel-surface.tsx +201 -92
- package/src/components/chart/composite/price-axis-labels.tsx +92 -46
- package/src/components/chart/composite/price-series.ts +31 -8
- package/src/components/chart/composite/scene.ts +154 -59
- package/src/components/chart/composite/series-axis-tags.tsx +4 -2
- package/src/components/chart/composite/time-axis.ts +13 -5
- package/src/components/chart/composite/time-scale.ts +211 -56
- package/src/components/chart/composite/types.ts +11 -1
- package/src/components/chart/composite/use-composite-chart-keyboard.ts +43 -14
- package/src/components/chart/curve/curve-surface.tsx +5 -2
- package/src/components/chart/curve/model.ts +4 -1
- package/src/components/chart/native/use-bitmap-metrics.ts +81 -0
- package/src/components/chart/static/series.ts +3 -0
- package/src/components/command-bar/commands/collection-list.ts +81 -0
- package/src/components/command-bar/commands/direct/index.ts +6 -0
- package/src/components/command-bar/commands/registry.ts +8 -0
- package/src/components/command-bar/layout-items/current-layout.ts +22 -1
- package/src/components/command-bar/layout-items/focused-pane.ts +22 -1
- package/src/components/command-bar/pane-templates/items.ts +19 -3
- package/src/components/command-bar/pane-templates/workflow.ts +5 -0
- package/src/components/command-bar/routes/root/results.ts +23 -3
- package/src/components/command-bar/routes/root/selection.ts +4 -2
- package/src/components/command-bar/routes/root/shortcut-feedback.ts +1 -1
- package/src/components/command-bar/routes/root/shortcut-items.ts +3 -4
- package/src/components/command-bar/routes/root/shortcuts.ts +58 -14
- package/src/components/command-bar/routes/root/ticker-first.ts +32 -0
- package/src/components/command-bar/surface/environment.ts +2 -0
- package/src/components/command-bar/view-model.ts +7 -0
- package/src/components/command-bar/workflow/ops.ts +2 -1
- package/src/components/command-bar/workflow/tickers.ts +20 -0
- package/src/components/data-table/export.ts +4 -1
- package/src/components/layout/detached-pane-shell.tsx +10 -37
- package/src/components/layout/double-escape-close.ts +90 -0
- package/src/components/layout/header.tsx +3 -2
- package/src/components/layout/market-summary.ts +6 -3
- package/src/components/layout/pane/footer/index.tsx +2 -6
- package/src/components/layout/pane/footer/model.ts +6 -12
- package/src/components/layout/shell/active-drag.ts +53 -11
- package/src/components/layout/shell/drag/magnets.ts +128 -19
- package/src/components/layout/shell/menu.ts +15 -1
- package/src/components/layout/shell/pane/actions.ts +10 -2
- package/src/components/layout/shell/pane/management-shortcuts.ts +13 -51
- package/src/components/layout/shell/ticker-link-menu.ts +12 -3
- package/src/components/layout/status-bar.tsx +24 -78
- package/src/components/layout/status-widget-space.ts +5 -5
- package/src/components/onboarding/onboarding-keyboard.ts +5 -1
- package/src/components/onboarding/onboarding-wizard.tsx +15 -4
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +9 -6
- package/src/components/onboarding/use-onboarding-progress.ts +20 -1
- package/src/components/price-sparkline/view.tsx +14 -6
- package/src/components/ticker/badge/index.tsx +8 -4
- package/src/components/ticker/badge/list.tsx +23 -7
- package/src/components/ui/column-grid.tsx +8 -2
- package/src/components/ui/data-table/index.tsx +5 -1
- package/src/components/ui/data-table/opentui/model.ts +4 -1
- package/src/components/ui/data-table/render-cell.ts +19 -0
- package/src/components/ui/delayed-mark.tsx +59 -7
- package/src/components/ui/icon.tsx +1 -8
- package/src/components/ui/menu.tsx +6 -1
- package/src/components/ui/tabs.tsx +5 -2
- package/src/core/state/app/layout.ts +18 -3
- package/src/core/state/app/state.ts +2 -0
- package/src/core/state/app/types.ts +5 -0
- package/src/data/config/layout.ts +3 -0
- package/src/data/config/store/normalize.ts +39 -4
- package/src/i18n/es.ts +13 -3
- package/src/i18n/ja.ts +13 -3
- package/src/i18n/ko.ts +13 -3
- package/src/i18n/zh-cn.ts +13 -3
- package/src/i18n/zh-tw.ts +13 -3
- package/src/layout/pane-manager/floating-placement.ts +7 -4
- package/src/layout/pane-manager/floating.ts +5 -2
- package/src/market-data/bond-funds.ts +19 -0
- package/src/market-data/futures-contract.ts +14 -3
- package/src/market-data/market/freshness.ts +18 -0
- package/src/market-data/market/status.ts +15 -2
- package/src/plugins/builtin/bond-calculator/headless.ts +2 -1
- package/src/plugins/builtin/bond-calculator/index.tsx +1 -1
- package/src/plugins/builtin/bond-calculator/model.ts +14 -5
- package/src/plugins/builtin/bond-calculator/pane.tsx +1 -1
- package/src/plugins/builtin/buildout/cells.tsx +25 -45
- package/src/plugins/builtin/buildout/detail/company.tsx +3 -3
- package/src/plugins/builtin/buildout/detail/index.tsx +1 -1
- package/src/plugins/builtin/buildout/detail/intel.tsx +4 -7
- package/src/plugins/builtin/buildout/detail/site.tsx +4 -4
- package/src/plugins/builtin/buildout/detail/ui.tsx +39 -38
- package/src/plugins/builtin/buildout/format.ts +23 -1
- package/src/plugins/builtin/buildout/model/types.ts +1 -0
- package/src/plugins/builtin/buildout/pane/index.tsx +2 -8
- package/src/plugins/builtin/buildout/table-model.ts +12 -4
- package/src/plugins/builtin/cds/headless.ts +1 -0
- package/src/plugins/builtin/cds/index.tsx +1 -1
- package/src/plugins/builtin/chat/content/composer.tsx +21 -27
- package/src/plugins/builtin/chat/content/index.tsx +31 -3
- package/src/plugins/builtin/chat/content/shortcuts.ts +4 -2
- package/src/plugins/builtin/chat/content/snapshot.ts +0 -3
- package/src/plugins/builtin/cloud/auth-actions.tsx +51 -23
- package/src/plugins/builtin/cloud/plugin.tsx +2 -0
- package/src/plugins/builtin/cloud/trial-offer-status-widget.tsx +3 -3
- package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +44 -12
- package/src/plugins/builtin/congress-trades/model.ts +2 -1
- package/src/plugins/builtin/congress-trades/pane.tsx +3 -0
- package/src/plugins/builtin/correlation/headless.ts +3 -2
- package/src/plugins/builtin/crypto-board/pane.tsx +5 -4
- package/src/plugins/builtin/custom-view/index.tsx +1 -1
- package/src/plugins/builtin/custom-view/loader.ts +85 -8
- package/src/plugins/builtin/custom-view/view-spec.ts +28 -0
- package/src/plugins/builtin/debt-maturities/headless.ts +11 -2
- package/src/plugins/builtin/debt-maturities/model.ts +66 -0
- package/src/plugins/builtin/debt-maturities/pane.tsx +23 -4
- package/src/plugins/builtin/earnings-ripple/pane.tsx +1 -1
- package/src/plugins/builtin/econ/calendar-model.ts +28 -6
- package/src/plugins/builtin/equity-screener/client.ts +1 -1
- package/src/plugins/builtin/equity-screener/criterion-editor.tsx +16 -19
- package/src/plugins/builtin/equity-screener/headless.ts +37 -3
- package/src/plugins/builtin/equity-screener/ideas.ts +67 -3
- package/src/plugins/builtin/equity-screener/model.ts +238 -27
- package/src/plugins/builtin/equity-screener/pane.tsx +88 -18
- package/src/plugins/builtin/equity-screener/screen-check.ts +7 -4
- package/src/plugins/builtin/equity-screener/watchlist.ts +33 -0
- package/src/plugins/builtin/executives/format.ts +5 -4
- package/src/plugins/builtin/executives/pane.tsx +1 -1
- package/src/plugins/builtin/futures-curve/client.ts +19 -0
- package/src/plugins/builtin/futures-curve/headless.ts +52 -13
- package/src/plugins/builtin/futures-curve/index.tsx +1 -1
- package/src/plugins/builtin/futures-curve/model.ts +77 -6
- package/src/plugins/builtin/futures-curve/pane.tsx +19 -3
- package/src/plugins/builtin/help/index.tsx +55 -1
- package/src/plugins/builtin/insider/model.ts +30 -2
- package/src/plugins/builtin/jobs/model.ts +2 -2
- package/src/plugins/builtin/macro-day/client.ts +41 -0
- package/src/plugins/builtin/macro-day/headless.ts +19 -9
- package/src/plugins/builtin/macro-day/model.ts +3 -1
- package/src/plugins/builtin/market-movers/index.tsx +4 -3
- package/src/plugins/builtin/mna/distress/headless.ts +1 -0
- package/src/plugins/builtin/mna/model.ts +2 -2
- package/src/plugins/builtin/notes/files.ts +2 -0
- package/src/plugins/builtin/notes/owner.tsx +20 -1
- package/src/plugins/builtin/notes/quick-notes-pane.tsx +22 -4
- package/src/plugins/builtin/notes/store.ts +6 -1
- package/src/plugins/builtin/perps/pane.tsx +3 -1
- package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +17 -0
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +2 -1
- package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +2 -1
- package/src/plugins/builtin/portfolio-list/header.tsx +1 -1
- package/src/plugins/builtin/rate-path/headless.ts +24 -10
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +29 -25
- package/src/plugins/builtin/research/event-model.ts +10 -3
- package/src/plugins/builtin/research/events-headless.ts +20 -2
- package/src/plugins/builtin/sec/fund-facts.ts +17 -1
- package/src/plugins/builtin/sec/index.tsx +1 -1
- package/src/plugins/builtin/series-inventory.ts +1 -0
- package/src/plugins/builtin/shared/earnings-report.ts +7 -2
- package/src/plugins/builtin/shared/members-menu.tsx +103 -38
- package/src/plugins/builtin/shared/use-quote-board.ts +85 -46
- package/src/plugins/builtin/short-interest/headless.ts +1 -1
- package/src/plugins/builtin/short-interest/model.ts +15 -6
- package/src/plugins/builtin/short-interest/publications-model.ts +22 -1
- package/src/plugins/builtin/short-interest/publications-pane.tsx +13 -4
- package/src/plugins/builtin/short-interest/types.ts +2 -0
- package/src/plugins/builtin/short-interest/watch-model.ts +1 -1
- package/src/plugins/builtin/thirteenf/overlap-pane.tsx +3 -0
- package/src/plugins/builtin/thirteenf/pane.tsx +3 -0
- package/src/plugins/builtin/ticker-detail/overview/model.ts +5 -3
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +4 -4
- package/src/plugins/builtin/time-sales/pane.tsx +3 -2
- package/src/plugins/builtin/trace-bonds/client.ts +7 -4
- package/src/plugins/builtin/trace-bonds/detail.tsx +198 -0
- package/src/plugins/builtin/trace-bonds/headless.ts +62 -4
- package/src/plugins/builtin/trace-bonds/history.ts +155 -0
- package/src/plugins/builtin/trace-bonds/index.tsx +1 -1
- package/src/plugins/builtin/trace-bonds/pane.tsx +64 -5
- package/src/plugins/builtin/volatility/client.ts +6 -1
- package/src/plugins/builtin/volatility/headless.ts +0 -1
- package/src/plugins/builtin/yield-curve/curves.ts +15 -0
- package/src/plugins/builtin/yield-curve/headless.ts +6 -1
- package/src/plugins/builtin/yield-curve/index.tsx +5 -8
- package/src/plugins/host-modules.ts +22 -3
- package/src/plugins/host-smoke.ts +6 -3
- package/src/plugins/installer.ts +16 -3
- package/src/plugins/plugin-names.ts +11 -2
- package/src/portfolio/collection-name.ts +19 -0
- package/src/remote/controller.ts +9 -2
- package/src/remote/schema.ts +2 -1
- package/src/renderers/browser/http-proxy-transport.ts +78 -8
- package/src/renderers/cloudflare/http-proxy.ts +73 -3
- package/src/renderers/cloudflare/proxy-session.ts +47 -24
- package/src/renderers/cloudflare/worker.ts +44 -4
- package/src/renderers/desktop/geometry.ts +279 -0
- package/src/renderers/desktop/screen-setup.ts +246 -0
- package/src/renderers/desktop/sequential-window-host.ts +179 -0
- package/src/renderers/desktop/test-utils.ts +71 -0
- package/src/renderers/desktop/window-controller.ts +433 -0
- package/src/renderers/desktop/window-host.ts +70 -0
- package/src/renderers/desktop/window-layouts.ts +630 -0
- package/src/renderers/dom/data-frames.ts +15 -4
- package/src/renderers/dom/desktop/icons.tsx +0 -2
- package/src/renderers/dom/styles.css +0 -3
- package/src/renderers/electrobun/bun/application-menu/click.ts +1 -0
- package/src/renderers/electrobun/bun/application-menu/index.ts +4 -1
- package/src/renderers/electrobun/bun/desktop/backend-requests.ts +19 -8
- package/src/renderers/electrobun/bun/desktop/backend.ts +320 -19
- package/src/renderers/electrobun/bun/desktop/detached-windows.ts +83 -61
- package/src/renderers/electrobun/bun/desktop/host-requests.ts +4 -14
- package/src/renderers/electrobun/bun/desktop/initialization.ts +30 -11
- package/src/renderers/electrobun/bun/desktop/install-records.ts +59 -0
- package/src/renderers/electrobun/bun/desktop/installer-folder.ts +208 -592
- package/src/renderers/electrobun/bun/desktop/macos-objc.ts +14 -0
- package/src/renderers/electrobun/bun/desktop/screen-setup-file.ts +55 -0
- package/src/renderers/electrobun/bun/desktop/state-broadcaster.ts +44 -8
- package/src/renderers/electrobun/bun/desktop/update.ts +1 -1
- package/src/renderers/electrobun/bun/desktop/workspace/index.ts +298 -97
- package/src/renderers/electrobun/bun/desktop/workspace/requests.ts +44 -6
- package/src/renderers/electrobun/bun/index.ts +22 -109
- package/src/renderers/electrobun/bun/window/create.ts +23 -3
- package/src/renderers/electrobun/bun/window/electrobun-window-host.ts +306 -0
- package/src/renderers/electrobun/bun/window/events.ts +4 -4
- package/src/renderers/electrobun/bun/window/focus.ts +0 -25
- package/src/renderers/electrobun/bun/window/frame.ts +2 -1
- package/src/renderers/electrobun/bun/window/native-min-size.ts +322 -0
- package/src/renderers/electrobun/bun/window/remembered-frame.ts +4 -82
- package/src/renderers/electrobun/shared/protocol.ts +44 -2
- package/src/renderers/electrobun/view/backend-rpc.ts +16 -1
- package/src/renderers/electrobun/view/desktop/window/bridge.ts +63 -3
- package/src/renderers/electrobun/view/main.tsx +13 -7
- package/src/series/fred-argument.ts +17 -0
- package/src/sources/gloomberb-cloud/index.ts +5 -7
- package/src/sources/provider-router/batches.ts +18 -3
- package/src/sources/provider-router/financial-routes.ts +7 -1
- package/src/sources/provider-router/financials.ts +18 -4
- package/src/state/app/context/index.tsx +16 -2
- package/src/state/desktop-windows.ts +63 -0
- package/src/sync/other-window-tabs.ts +62 -0
- package/src/tickers/company-name-listing.ts +23 -3
- package/src/tickers/listing-fate.ts +147 -1
- package/src/tickers/terminal-codes.ts +5 -0
- package/src/time-series/types.ts +6 -0
- package/src/types/config.ts +10 -1
- package/src/types/data-provider.ts +14 -0
- package/src/types/desktop-window.ts +71 -2
- package/src/types/financials.ts +19 -3
- package/src/types/headless.ts +21 -0
- package/src/types/plugin.ts +6 -0
- package/src/ui/index.tsx +14 -13
- package/src/ui/same-props.ts +58 -0
- package/src/utils/cli-output.ts +33 -4
- package/src/utils/double-escape-close.ts +38 -16
- package/src/utils/format.ts +30 -5
- package/src/utils/futures-generic.ts +12 -0
- package/src/utils/http-proxy-upstream.ts +6 -2
- package/src/utils/plugin-proxy-hosts.json +0 -4
- package/src/utils/plugin-proxy-hosts.ts +22 -0
- package/src/utils/price-earnings.ts +18 -0
- package/src/utils/sec-filings.ts +7 -1
- package/patches/electrobun@1.18.1.patch +0 -633
- package/src/api-client/types.ts +0 -2441
package/src/app.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Box, ContextMenuProvider, useNativeRenderer, useRendererHost, useUiHost } from "./ui";
|
|
2
2
|
import { ToastViewport, useToastHost } from "./ui/toast";
|
|
3
|
-
import { useState, useEffect, useCallback, useRef, useMemo, type ReactNode } from "react";
|
|
3
|
+
import { useState, useEffect, useCallback, useRef, useMemo, useSyncExternalStore, type Dispatch, type ReactNode } from "react";
|
|
4
4
|
import {
|
|
5
5
|
AppProvider,
|
|
6
6
|
getFocusedTickerSymbol,
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
useAppStateRef,
|
|
10
10
|
type AppState,
|
|
11
11
|
} from "./state/app/context";
|
|
12
|
+
import type { AppAction } from "./core/state/app/state";
|
|
12
13
|
import { bindAppActivity, useAppActive, useAppVisible } from "./state/app/activity";
|
|
13
14
|
import { Header } from "./components/layout/header";
|
|
14
15
|
import { StatusBar } from "./components/layout/status-bar";
|
|
@@ -35,7 +36,7 @@ import type { AppNotificationRequest, CliLaunchRequest, GloomPlugin } from "./ty
|
|
|
35
36
|
import type { DataProvider } from "./types/data-provider";
|
|
36
37
|
import type { DesktopDockPreviewState, DesktopSharedStateSnapshot, DesktopThemePreviewState, DesktopWindowBridge } from "./types/desktop-window";
|
|
37
38
|
import type { DesktopApplicationMenuBridge } from "./types/desktop-menu";
|
|
38
|
-
import type
|
|
39
|
+
import { isPaneInLayout, type LayoutBounds } from "./layout/pane-manager";
|
|
39
40
|
import type { AppSessionSnapshot } from "./core/state/session-persistence";
|
|
40
41
|
import type { MarketDataCoordinator } from "./market-data/coordinator";
|
|
41
42
|
import { createAppNotifier } from "./notifications/app-notifier";
|
|
@@ -54,6 +55,9 @@ import { useAppUpdateRuntime } from "./app/runtime/update";
|
|
|
54
55
|
import { resolveUpdateChannel } from "./updater/channel";
|
|
55
56
|
import { createCoreSyncContributors } from "./sync/core-contributors";
|
|
56
57
|
import { useCloudSyncRuntime } from "./sync/react";
|
|
58
|
+
import { changesOtherWindowTabs, withOtherWindowTabs, withoutOtherWindowTabs } from "./sync/other-window-tabs";
|
|
59
|
+
import { getDesktopWindows } from "./state/desktop-windows";
|
|
60
|
+
import type { OtherWindowTab } from "./types/desktop-window";
|
|
57
61
|
import { RemoteControlHost, type RemoteControlAdapter } from "./remote/app-host";
|
|
58
62
|
import { RemoteUiRegistryProvider } from "./remote/semantic-tree";
|
|
59
63
|
import {
|
|
@@ -61,7 +65,7 @@ import {
|
|
|
61
65
|
resolveCliLaunchConfig,
|
|
62
66
|
resolveInitialAppConfig,
|
|
63
67
|
} from "./app/app-bootstrap-state";
|
|
64
|
-
import { scheduleConfigSave } from "./state/config-save-scheduler";
|
|
68
|
+
import { saveConfigImmediately, scheduleConfigSave } from "./state/config-save-scheduler";
|
|
65
69
|
import { LOW_PRIORITY_CONFIG_SAVE_DEBOUNCE_MS } from "./state/persist-scheduler";
|
|
66
70
|
import { savedLayoutsDifferOnlyInMirror } from "./core/state/app/layout";
|
|
67
71
|
import { measurePerf } from "./utils/perf-marks";
|
|
@@ -117,6 +121,10 @@ function ThemedAppRoot({ children }: { children: ReactNode }) {
|
|
|
117
121
|
);
|
|
118
122
|
}
|
|
119
123
|
|
|
124
|
+
const noOtherWindowTabs = (): readonly OtherWindowTab[] => NO_OTHER_WINDOW_TABS;
|
|
125
|
+
const NO_OTHER_WINDOW_TABS: readonly OtherWindowTab[] = [];
|
|
126
|
+
const noSubscription = () => () => {};
|
|
127
|
+
|
|
120
128
|
function AppInner({
|
|
121
129
|
externalPlugins,
|
|
122
130
|
pluginRegistry,
|
|
@@ -184,6 +192,27 @@ function AppInner({
|
|
|
184
192
|
updateCheckInProgress,
|
|
185
193
|
updateProgress,
|
|
186
194
|
]);
|
|
195
|
+
// Cloud sync in the desktop app's main window pushes and pulls every
|
|
196
|
+
// window's tabs, not only its own (sync/other-window-tabs.ts). The same
|
|
197
|
+
// state, getter and dispatch with one window and everywhere else.
|
|
198
|
+
const desktopWindows = getDesktopWindows();
|
|
199
|
+
const otherWindowTabs = useSyncExternalStore(
|
|
200
|
+
desktopWindows?.subscribe ?? noSubscription,
|
|
201
|
+
desktopWindows?.otherWindowTabs ?? noOtherWindowTabs,
|
|
202
|
+
);
|
|
203
|
+
const otherWindowTabsRef = useRef(otherWindowTabs);
|
|
204
|
+
otherWindowTabsRef.current = otherWindowTabs;
|
|
205
|
+
const syncState = useMemo(() => withOtherWindowTabs(state, otherWindowTabs), [state, otherWindowTabs]);
|
|
206
|
+
const getSyncState = useCallback(() => withOtherWindowTabs(stateRef.current, otherWindowTabsRef.current), [stateRef]);
|
|
207
|
+
const syncDispatch = useCallback<Dispatch<AppAction>>((action) => {
|
|
208
|
+
if (action.type !== "SET_CONFIG") {
|
|
209
|
+
dispatch(action);
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
const others = otherWindowTabsRef.current;
|
|
213
|
+
if (changesOtherWindowTabs(action.config, others)) void saveConfigImmediately(action.config);
|
|
214
|
+
dispatch({ ...action, config: withoutOtherWindowTabs(action.config, others, stateRef.current.config) });
|
|
215
|
+
}, [dispatch, stateRef]);
|
|
187
216
|
const appActive = useAppActive();
|
|
188
217
|
const appVisible = useAppVisible();
|
|
189
218
|
const appActiveRef = useRef(appActive);
|
|
@@ -191,6 +220,10 @@ function AppInner({
|
|
|
191
220
|
const dialog = useDialog();
|
|
192
221
|
const toast = useToastHost();
|
|
193
222
|
const isDetachedWindow = desktopWindowBridge?.kind === "detached";
|
|
223
|
+
// The main desktop window does the app-wide work (account sync, update
|
|
224
|
+
// checks, launch notices, background alerts); a popped-out pane's window
|
|
225
|
+
// and every other full window leave it to it.
|
|
226
|
+
const appWideWorkElsewhere = isDetachedWindow || desktopWindowBridge?.primary === false;
|
|
194
227
|
// Not while setup is already showing.
|
|
195
228
|
const runSetupAgain = useRunSetupAgain(onboardingActive ? undefined : onRunSetupAgain);
|
|
196
229
|
const detachedPaneId = isDetachedWindow ? desktopWindowBridge.paneId ?? null : null;
|
|
@@ -245,11 +278,21 @@ function AppInner({
|
|
|
245
278
|
}, [pluginRegistry]);
|
|
246
279
|
|
|
247
280
|
useEffect(() => {
|
|
248
|
-
|
|
281
|
+
// Popped-out panes dock into the main window only.
|
|
282
|
+
if (desktopWindowBridge?.kind !== "main" || appWideWorkElsewhere || !desktopWindowBridge.subscribeDockPreview) return;
|
|
249
283
|
return desktopWindowBridge.subscribeDockPreview((preview) => {
|
|
250
284
|
setDesktopDockPreview(preview);
|
|
251
285
|
});
|
|
252
|
-
}, [desktopWindowBridge]);
|
|
286
|
+
}, [appWideWorkElsewhere, desktopWindowBridge]);
|
|
287
|
+
|
|
288
|
+
// Another window asked this one to show one of its panes: a link followed, a pane found.
|
|
289
|
+
useEffect(() => {
|
|
290
|
+
const windows = desktopWindowBridge?.kind === "main" ? desktopWindowBridge.windows : undefined;
|
|
291
|
+
if (!windows) return;
|
|
292
|
+
return windows.subscribeFocusRequests((paneId) => {
|
|
293
|
+
if (isPaneInLayout(stateRef.current.config.layout, paneId)) pluginRegistry.focusPane(paneId);
|
|
294
|
+
});
|
|
295
|
+
}, [desktopWindowBridge, pluginRegistry, stateRef]);
|
|
253
296
|
|
|
254
297
|
useEffect(() => {
|
|
255
298
|
const disposers = createCoreSyncContributors().map((contributor) => (
|
|
@@ -286,7 +329,7 @@ function AppInner({
|
|
|
286
329
|
const { restartToApplyUpdate, runUpdateCheck, runUpdateCommand, startUpdate } = useAppUpdateRuntime({
|
|
287
330
|
enabled: updatesEnabled,
|
|
288
331
|
dispatch,
|
|
289
|
-
isDetachedWindow,
|
|
332
|
+
isDetachedWindow: appWideWorkElsewhere,
|
|
290
333
|
pluginRegistry,
|
|
291
334
|
stateRef,
|
|
292
335
|
updateAvailable: state.updateAvailable,
|
|
@@ -326,7 +369,7 @@ function AppInner({
|
|
|
326
369
|
externalPlugins,
|
|
327
370
|
focusedTickerSymbol,
|
|
328
371
|
getState: getRemoteState,
|
|
329
|
-
isDetachedWindow,
|
|
372
|
+
isDetachedWindow: appWideWorkElsewhere,
|
|
330
373
|
marketData,
|
|
331
374
|
pluginRegistry,
|
|
332
375
|
pluginsReady,
|
|
@@ -351,16 +394,16 @@ function AppInner({
|
|
|
351
394
|
});
|
|
352
395
|
|
|
353
396
|
useCloudSyncRuntime({
|
|
354
|
-
state,
|
|
355
|
-
getState:
|
|
356
|
-
dispatch,
|
|
397
|
+
state: syncState,
|
|
398
|
+
getState: getSyncState,
|
|
399
|
+
dispatch: syncDispatch,
|
|
357
400
|
tickerRepository,
|
|
358
401
|
pluginRegistry,
|
|
359
402
|
appActive,
|
|
360
403
|
// Keep a first-run workspace stable while the local guide is active. Once
|
|
361
404
|
// onboarding finishes, the normal pull-before-push sync starts immediately.
|
|
362
405
|
initialized: state.initialized
|
|
363
|
-
&&
|
|
406
|
+
&& !appWideWorkElsewhere
|
|
364
407
|
&& !onboardingActive
|
|
365
408
|
&& !signInGateActive,
|
|
366
409
|
});
|
|
@@ -388,11 +431,11 @@ function AppInner({
|
|
|
388
431
|
|
|
389
432
|
// Wire up app-level notifications.
|
|
390
433
|
pluginRegistry.bindHost({ notify: appNotifier.notify });
|
|
391
|
-
// Missed alerts live in this device's state store.
|
|
392
|
-
// its own in memory rather than overwrite the main window's.
|
|
434
|
+
// Missed alerts live in this device's state store. Any other desktop window
|
|
435
|
+
// keeps its own in memory rather than overwrite the main window's.
|
|
393
436
|
useEffect(() => (
|
|
394
|
-
|
|
395
|
-
), [
|
|
437
|
+
appWideWorkElsewhere ? undefined : attachNotificationLog(pluginRegistry.persistence.pluginState)
|
|
438
|
+
), [appWideWorkElsewhere, pluginRegistry]);
|
|
396
439
|
|
|
397
440
|
// Persist layout changes (switching, saving, deleting, renaming layouts).
|
|
398
441
|
// The saved layouts also mirror live pane state and focus, so they change on
|
|
@@ -491,13 +534,7 @@ function AppInner({
|
|
|
491
534
|
desktopDockPreview={desktopDockPreview}
|
|
492
535
|
commandBarNativeOccluder={commandBarNativeOccluder}
|
|
493
536
|
/>
|
|
494
|
-
<StatusBar
|
|
495
|
-
onOpenChangelog={(version) => {
|
|
496
|
-
void pluginRegistry.createPaneFromTemplateAsync("changelog-pane", {
|
|
497
|
-
values: { version },
|
|
498
|
-
}).catch(() => {});
|
|
499
|
-
}}
|
|
500
|
-
/>
|
|
537
|
+
<StatusBar />
|
|
501
538
|
</TransientLayoutProvider>
|
|
502
539
|
{!onboardingActive ? <CompanyPickerHost pluginRegistry={pluginRegistry} /> : null}
|
|
503
540
|
{initialized && !onboardingActive && !signInGateActive ? <AttentionCountsNotice notify={notifyRequest} /> : null}
|
|
@@ -607,8 +644,10 @@ export function App({
|
|
|
607
644
|
}, [requireSignIn]);
|
|
608
645
|
const signInGateActive = requireSignIn && !signedIn;
|
|
609
646
|
const shareHandoff = isPaneShareHandoff();
|
|
647
|
+
// Setup runs in the main window only.
|
|
610
648
|
const [showOnboarding, setShowOnboarding] = useState(() => (
|
|
611
649
|
desktopWindowBridge?.kind !== "detached"
|
|
650
|
+
&& desktopWindowBridge?.primary !== false
|
|
612
651
|
&& !shareHandoff
|
|
613
652
|
&& (!effectiveInitialConfig.onboardingComplete || !!effectiveInitialConfig.onboardingProgress)
|
|
614
653
|
));
|
|
@@ -650,7 +689,9 @@ export function App({
|
|
|
650
689
|
<RemoteUiRegistryProvider>
|
|
651
690
|
<AppProvider
|
|
652
691
|
config={config}
|
|
653
|
-
sessionStore={desktopWindowBridge?.kind === "detached"
|
|
692
|
+
sessionStore={desktopWindowBridge?.kind === "detached" || desktopWindowBridge?.primary === false
|
|
693
|
+
? undefined
|
|
694
|
+
: services.persistence.sessions}
|
|
654
695
|
sessionSnapshot={sessionSnapshot}
|
|
655
696
|
desktopBridge={desktopWindowBridge}
|
|
656
697
|
desktopSnapshot={desktopSnapshot}
|
|
@@ -21,14 +21,6 @@
|
|
|
21
21
|
"why": "Registry plugin (gloomberb-crypto-fear-greed): the gauge's figure, as above."
|
|
22
22
|
}
|
|
23
23
|
],
|
|
24
|
-
"CHAT": [
|
|
25
|
-
{
|
|
26
|
-
"measure": "inset",
|
|
27
|
-
"value": 7.2,
|
|
28
|
-
"component": "PaneSidebarRow",
|
|
29
|
-
"why": "Chat has its own owner: its channel rows start 7px in (reported, not changed)."
|
|
30
|
-
}
|
|
31
|
-
],
|
|
32
24
|
"FXMD_REST_HEALTH": [
|
|
33
25
|
{
|
|
34
26
|
"measure": "inset",
|
|
@@ -258,7 +258,7 @@ import {
|
|
|
258
258
|
type ListingIdentity,
|
|
259
259
|
} from "../listing-arg";
|
|
260
260
|
import { currencyNameMiss, currencyNameStop } from "../currency-name-hint";
|
|
261
|
-
import { bareListingNote, listingFateNotes, noLongerTradingNote, SUCCESSOR_CHANGE_WAIT_MS, tradingListing } from "../../tickers/listing-fate";
|
|
261
|
+
import { bareListingNote, listingFateNotes, loadNoQuoteLastTraded, noLongerTradingNote, noQuoteLastTraded, noQuoteLastTradeNote, SUCCESSOR_CHANGE_WAIT_MS, tradingListing, usVenueOf } from "../../tickers/listing-fate";
|
|
262
262
|
import { isYieldIndexSymbol } from "../../tickers/index-roots";
|
|
263
263
|
import {
|
|
264
264
|
analyzeTaxEquivalent, distributionBasis, loadTreasuryTenors, parseTaxRates, TAX_RATE_HELP_OPTIONS, taxEquivalentJson, type TaxRates,
|
|
@@ -389,10 +389,22 @@ type FinancialsCliData = TickerFinancials & {
|
|
|
389
389
|
providerId: string | null;
|
|
390
390
|
};
|
|
391
391
|
|
|
392
|
+
/**
|
|
393
|
+
* A range as typed, in any case and as other tools spell it: `1mo`, `1m` and
|
|
394
|
+
* `1 month` are 1M, `1wk` 1W, `5yr` 5Y, `max` ALL.
|
|
395
|
+
*/
|
|
396
|
+
export function readHistoryRange(value: string): HistoryRange | null {
|
|
397
|
+
const typed = value.trim().toUpperCase().replace(/\s+/g, "");
|
|
398
|
+
if (typed === "MAX") return "ALL";
|
|
399
|
+
const spelled = /^(\d+)(D|DAYS?|W|WKS?|WEEKS?|M|MOS?|MONTHS?|Y|YRS?|YEARS?)$/.exec(typed);
|
|
400
|
+
const range = (spelled ? `${spelled[1]}${spelled[2]![0]}` : typed) as HistoryRange;
|
|
401
|
+
return VALID_RANGES.has(range) ? range : null;
|
|
402
|
+
}
|
|
403
|
+
|
|
392
404
|
function parseRange(value: string | undefined, ctx: Parameters<CliCommandDef["execute"]>[1]): HistoryRange {
|
|
393
|
-
const range = (value ?? "1Y")
|
|
394
|
-
if (!
|
|
395
|
-
return range
|
|
405
|
+
const range = readHistoryRange(value ?? "1Y");
|
|
406
|
+
if (!range) ctx.fail(`Unknown range "${value}".`, `Use one of ${HISTORY_RANGES.join(", ")}.`);
|
|
407
|
+
return range!;
|
|
396
408
|
}
|
|
397
409
|
|
|
398
410
|
function parseNewsFeed(value: string | undefined): NewsQuery["feed"] | undefined {
|
|
@@ -1083,6 +1095,13 @@ async function runQuote(rawArgs: string[], ctx: Parameters<CliCommandDef["execut
|
|
|
1083
1095
|
}));
|
|
1084
1096
|
const tickerChanges = symbolChanges.map(({ change }) => change);
|
|
1085
1097
|
const formerIssuers = symbolChanges.map(({ formerIssuer }) => formerIssuer);
|
|
1098
|
+
// A symbol with no quote whose bars stopped over a month ago says when it last traded, in place of why no quote
|
|
1099
|
+
// came: no longer listed on the service's record (FLAT, a retired ETN), else no trades since. Each costs a history
|
|
1100
|
+
// read, so a long list says only why.
|
|
1101
|
+
const lastTraded = await Promise.all(answers.map(({ result, listing }) => !result.quote && !isNetworkFailure(result.error)
|
|
1102
|
+
&& answers.length <= MAX_CHOICE_LOOKUPS ? loadNoQuoteLastTraded(listing.request, market.dataProvider, now) : null));
|
|
1103
|
+
const endedNotes = answers.map(({ listing }, index) => lastTraded[index] ? `${noQuoteLastTradeNote(listing.symbol, lastTraded[index]!)}.` : null);
|
|
1104
|
+
if (symbols.length === 1 && endedNotes[0]) ctx.fail(endedNotes[0], quoteChangeLine(tickerChanges[0], formerIssuers[0]) || undefined);
|
|
1086
1105
|
const failed = answers[0]?.failure;
|
|
1087
1106
|
if (symbols.length === 1 && failed) {
|
|
1088
1107
|
ctx.fail(failed.message, [quoteChangeLine(tickerChanges[0], formerIssuers[0]), failed.details].filter(Boolean).join("\n") || undefined);
|
|
@@ -1123,6 +1142,8 @@ async function runQuote(rawArgs: string[], ctx: Parameters<CliCommandDef["execut
|
|
|
1123
1142
|
...yieldIndexFields(result),
|
|
1124
1143
|
...tickerChanges[index] ? { tickerChange: tickerChanges[index] } : {},
|
|
1125
1144
|
...formerIssuers[index] ? { formerIssuer: formerIssuers[index] } : {},
|
|
1145
|
+
// The day it last traded, and whether the service's record says it no longer trades (else only old bars say it).
|
|
1146
|
+
...lastTraded[index] ? { lastTraded: lastTraded[index]!.date, noLongerListed: lastTraded[index]!.recorded } : {},
|
|
1126
1147
|
}));
|
|
1127
1148
|
const notes = [
|
|
1128
1149
|
...list?.notes ?? [],
|
|
@@ -1150,8 +1171,9 @@ async function runQuote(rawArgs: string[], ctx: Parameters<CliCommandDef["execut
|
|
|
1150
1171
|
const pair = listingDepositaryPair({ quote: row.quote });
|
|
1151
1172
|
return pair ? [`${row.target.symbol}: ${depositaryPairText(pair, isReceiptSide({ quote: row.quote }))}.`] : [];
|
|
1152
1173
|
}),
|
|
1174
|
+
...endedNotes.flatMap((note) => note ?? []),
|
|
1153
1175
|
// A cell shows only "unavailable", and an exported row only its status, so stderr names each failure; the JSON rows carry each reason.
|
|
1154
|
-
...ctx.cliOptions.format !== "json" ? quoteNotes(data) : [],
|
|
1176
|
+
...ctx.cliOptions.format !== "json" ? quoteNotes(data.filter((_row, index) => !endedNotes[index])) : [],
|
|
1155
1177
|
];
|
|
1156
1178
|
const columns = commandName === "compare" ? compareColumns() : quoteColumns();
|
|
1157
1179
|
const basisNotes = changeBasisNotes(data, now);
|
|
@@ -1428,7 +1450,7 @@ async function loadListingHistory(
|
|
|
1428
1450
|
const quoted = quoteAnswer.then((answer) => answer.quote);
|
|
1429
1451
|
const fate = lookups ? listingFateLoader(listing, market, quoted, { successor: true }) : null;
|
|
1430
1452
|
const request = { command: historyCommand(ask), noun: "history", ...(fate ? { fate } : {}) };
|
|
1431
|
-
const [
|
|
1453
|
+
const [answered, quote] = await Promise.all([
|
|
1432
1454
|
loadForListing(listing, market, ctx, load, (loaded) => loaded.points.length === 0, request)
|
|
1433
1455
|
.catch((error) => failHistory(error, listing.key, ctx)),
|
|
1434
1456
|
quoted,
|
|
@@ -1436,6 +1458,9 @@ async function loadListingHistory(
|
|
|
1436
1458
|
// A bare symbol several companies list is never served from the one the data service picked, in a range or a window:
|
|
1437
1459
|
// it asks for an exchange as `quote` does, and in a list that is the symbol's row alone.
|
|
1438
1460
|
await failUnchosenListing(listing, market, ctx, request, (await quoteAnswer).error);
|
|
1461
|
+
const loaded = quote || window ? answered : await stoppedUsListingHistory(listing, market, loadRange, context, answered);
|
|
1462
|
+
// With no quote and no bar in over a month, when the listing last traded is said first.
|
|
1463
|
+
const lastTraded = quote || window ? null : noQuoteLastTraded(loaded);
|
|
1439
1464
|
const { resolution } = loaded;
|
|
1440
1465
|
// While the session trades the day's bar is the quote's, whatever range the history was cut for (withSessionBar).
|
|
1441
1466
|
// A window that ended before today has no session in progress.
|
|
@@ -1500,6 +1525,7 @@ async function loadListingHistory(
|
|
|
1500
1525
|
const coverage = window ? historyCoverageNotice(loaded.coverageStart, Date.parse(`${window.from}T00:00:00Z`), loaded.coverageNote)
|
|
1501
1526
|
: range === "YTD" ? null : historyCoverageWarning(range, loaded);
|
|
1502
1527
|
const notes = [
|
|
1528
|
+
...lastTraded ? [`${noQuoteLastTradeNote(listing.symbol, lastTraded)}.`] : [],
|
|
1503
1529
|
// A window the source has no bar in (a typo, a weekend, a listing that had not started) is said, not an empty table alone.
|
|
1504
1530
|
...data.length === 0 ? [emptyHistoryNote(listing.key, ask)] : [],
|
|
1505
1531
|
// FB's bars are the fund listed there now; META's from 2021 are from when it was FB.
|
|
@@ -1521,6 +1547,29 @@ async function loadListingHistory(
|
|
|
1521
1547
|
};
|
|
1522
1548
|
}
|
|
1523
1549
|
|
|
1550
|
+
/**
|
|
1551
|
+
* A bare symbol with no quote whose US listing stopped trading is that
|
|
1552
|
+
* listing's history: a source can answer the bare symbol with a listing
|
|
1553
|
+
* abroad that took it (STPP's bars from 2026 are a UCITS fund's, the iPath
|
|
1554
|
+
* steepener's ended in 2020). The bars as answered otherwise.
|
|
1555
|
+
*/
|
|
1556
|
+
async function stoppedUsListingHistory(
|
|
1557
|
+
listing: CliListing,
|
|
1558
|
+
market: MarketContext,
|
|
1559
|
+
range: TimeRange,
|
|
1560
|
+
context: { cacheMode: "refresh" | "default" },
|
|
1561
|
+
answered: PriceHistoryResult,
|
|
1562
|
+
): Promise<PriceHistoryResult> {
|
|
1563
|
+
if (listing.request.exchange || answered.delisting || !market.dataProvider.getPriceHistoryWithMetadata) return answered;
|
|
1564
|
+
const venue = await usVenueOf(listing.request.symbol, market.dataProvider);
|
|
1565
|
+
// Asked afresh: a copy saved for the bare symbol (the listing abroad's bars) can otherwise answer for the venue.
|
|
1566
|
+
const own = await market.dataProvider.getPriceHistoryWithMetadata(listing.request.symbol, venue, range, { ...context, cacheMode: "refresh" })
|
|
1567
|
+
.catch(logFailure("cli.commands-market", "Read a stopped US listing's history failed", null));
|
|
1568
|
+
const ended = own ? noQuoteLastTraded(own) : null;
|
|
1569
|
+
const newest = answered.points.at(-1)?.date;
|
|
1570
|
+
return own && ended && own.points.length > 0 && (!newest || new Date(newest).toISOString().slice(0, 10) > ended.date) ? own : answered;
|
|
1571
|
+
}
|
|
1572
|
+
|
|
1524
1573
|
/**
|
|
1525
1574
|
* A continuous future's history is the front month's, not the contract its
|
|
1526
1575
|
* quote names now: NG=F's rows from before the roll are November's under a
|
|
@@ -1690,27 +1739,115 @@ async function runHistory(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
1690
1739
|
/** A symbol of a list: its bars, or why it has none. */
|
|
1691
1740
|
type ListedHistory = { symbol: string; history: ListingHistory } | { symbol: string; error: string };
|
|
1692
1741
|
|
|
1742
|
+
/** Minutes in an intraday bar size; null for daily and longer bars. */
|
|
1743
|
+
const INTRADAY_BAR_MINUTES: Partial<Record<NonNullable<HistoryRow["interval"]>, number>> = {
|
|
1744
|
+
"1m": 1, "5m": 5, "15m": 15, "30m": 30, "45m": 45, "1h": 60,
|
|
1745
|
+
};
|
|
1746
|
+
|
|
1747
|
+
/** The index of the latest of ascending `times` at or before `time`, or -1. */
|
|
1748
|
+
function latestAtOrBefore(times: readonly number[], time: number): number {
|
|
1749
|
+
let low = 0;
|
|
1750
|
+
let high = times.length - 1;
|
|
1751
|
+
let found = -1;
|
|
1752
|
+
while (low <= high) {
|
|
1753
|
+
const middle = (low + high) >> 1;
|
|
1754
|
+
if (times[middle]! <= time) {
|
|
1755
|
+
found = middle;
|
|
1756
|
+
low = middle + 1;
|
|
1757
|
+
} else high = middle - 1;
|
|
1758
|
+
}
|
|
1759
|
+
return found;
|
|
1760
|
+
}
|
|
1761
|
+
|
|
1762
|
+
/**
|
|
1763
|
+
* Where each symbol's intraday bars go in `--wide`. Bars are listed as they
|
|
1764
|
+
* come unless one symbol's bar starts inside another's (an hour stamped on
|
|
1765
|
+
* the half hour beside one stamped on the hour, 30m bars beside 1h ones):
|
|
1766
|
+
* then every bar is set under the bar it starts in of the coarsest symbol,
|
|
1767
|
+
* the one with most bars where several share that size, which keeps its own
|
|
1768
|
+
* stamps. A bar no such bar covers keeps its own. Null when nothing moves:
|
|
1769
|
+
* daily bars, and intraday ones stamped alike, as US stocks' hours all start
|
|
1770
|
+
* at :30.
|
|
1771
|
+
*/
|
|
1772
|
+
function wideBarSlots(histories: readonly ListingHistory[]): {
|
|
1773
|
+
anchor: number;
|
|
1774
|
+
slot: (series: number, row: number) => string;
|
|
1775
|
+
} | null {
|
|
1776
|
+
const minutes = histories.map((history) => history.interval ? INTRADAY_BAR_MINUTES[history.interval] : undefined);
|
|
1777
|
+
if (histories.length < 2 || minutes.some((value) => value == null)) return null;
|
|
1778
|
+
const times = histories.map((history) => history.data.map((row) => Date.parse(row.date)));
|
|
1779
|
+
if (times.some((series) => series.some((time) => !Number.isFinite(time)))) return null;
|
|
1780
|
+
const inside = (series: number, time: number) => {
|
|
1781
|
+
const at = latestAtOrBefore(times[series]!, time);
|
|
1782
|
+
return at >= 0 && times[series]![at]! < time && time < times[series]![at]! + minutes[series]! * 60_000;
|
|
1783
|
+
};
|
|
1784
|
+
// A live last bar can be stamped at the latest trade inside its slot, so only the others say where a symbol's bars start.
|
|
1785
|
+
const crossed = times.some((series, index) => series.slice(0, -1).some((time) =>
|
|
1786
|
+
times.some((_, other) => other !== index && inside(other, time))));
|
|
1787
|
+
if (!crossed) return null;
|
|
1788
|
+
const coarsest = Math.max(...minutes as number[]);
|
|
1789
|
+
const anchor = histories.reduce((best, history, index) => minutes[index] === coarsest
|
|
1790
|
+
&& (best < 0 || history.data.length > histories[best]!.data.length) ? index : best, -1);
|
|
1791
|
+
const size = coarsest * 60_000;
|
|
1792
|
+
return {
|
|
1793
|
+
anchor,
|
|
1794
|
+
slot: (series, row) => {
|
|
1795
|
+
const own = histories[series]!.data[row]!.date;
|
|
1796
|
+
if (series === anchor) return own;
|
|
1797
|
+
const time = times[series]![row]!;
|
|
1798
|
+
const at = latestAtOrBefore(times[anchor]!, time);
|
|
1799
|
+
return at >= 0 && time < times[anchor]![at]! + size ? histories[anchor]!.data[at]!.date : own;
|
|
1800
|
+
},
|
|
1801
|
+
};
|
|
1802
|
+
}
|
|
1803
|
+
|
|
1804
|
+
/** The symbols as a list: `A`, `A and B`, `A, B and C`. */
|
|
1805
|
+
function listedKeys(keys: readonly string[]): string {
|
|
1806
|
+
return keys.length < 2 ? keys.join("") : `${keys.slice(0, -1).join(", ")} and ${keys.at(-1)}`;
|
|
1807
|
+
}
|
|
1808
|
+
|
|
1693
1809
|
/**
|
|
1694
1810
|
* `history USDJPY=X USDCHF=X EURCHF=X --wide`: one row a date and one close
|
|
1695
1811
|
* column a symbol, its unit in the header (`USDJPY=X close (JPY per USD)`),
|
|
1696
1812
|
* as a spreadsheet sets several series side by side. A symbol with no bar on
|
|
1697
|
-
* a date (another market's holiday) leaves its cell blank.
|
|
1698
|
-
*
|
|
1813
|
+
* a date (another market's holiday) leaves its cell blank. Intraday bars
|
|
1814
|
+
* that do not line up are set under the bar they start in (`wideBarSlots`):
|
|
1815
|
+
* where a symbol has several in one row, the row's close is the last one's,
|
|
1816
|
+
* the slot's close. `notes` names the symbols whose bars moved and those
|
|
1817
|
+
* whose bars were merged. `interval` is the bars' size when every symbol came
|
|
1818
|
+
* in one, else null.
|
|
1699
1819
|
*/
|
|
1700
1820
|
function wideHistoryTable(served: readonly ListingHistory[]): {
|
|
1701
1821
|
rows: Array<Record<string, string | number | null>>;
|
|
1702
1822
|
columns: CliResultColumn[];
|
|
1703
1823
|
interval: string | null;
|
|
1824
|
+
notes: string[];
|
|
1704
1825
|
} {
|
|
1705
1826
|
const histories = served.filter((history, index) => served.findIndex((other) => other.listing.key === history.listing.key) === index);
|
|
1706
1827
|
const key = (history: ListingHistory) => `close:${history.listing.key}`;
|
|
1707
|
-
const
|
|
1708
|
-
const
|
|
1828
|
+
const slots = wideBarSlots(histories);
|
|
1829
|
+
const slotOf = histories.map((history, series) => history.data.map((row, index) => slots?.slot(series, index) ?? row.date));
|
|
1830
|
+
const closes = histories.map((history, series) => new Map(history.data.map((row, index) => [slotOf[series]![index]!, row.close] as const)));
|
|
1831
|
+
const dates = [...new Set(closes.flatMap((bySlot) => [...bySlot.keys()]))].sort();
|
|
1709
1832
|
const rows = dates.map((date) => Object.fromEntries([
|
|
1710
1833
|
["date", date],
|
|
1711
1834
|
...histories.map((history, index) => [key(history), closes[index]!.get(date) ?? null] as const),
|
|
1712
1835
|
]));
|
|
1713
1836
|
const intervals = new Set(histories.map((history) => history.interval));
|
|
1837
|
+
const notes: string[] = [];
|
|
1838
|
+
if (slots) {
|
|
1839
|
+
const anchor = histories[slots.anchor]!;
|
|
1840
|
+
const under = `under the ${anchor.listing.key} ${anchor.interval} bar they start in`;
|
|
1841
|
+
const moved: string[] = [];
|
|
1842
|
+
histories.forEach((history, series) => {
|
|
1843
|
+
const rowsOf = new Set(slotOf[series]);
|
|
1844
|
+
if (rowsOf.size < history.data.length) {
|
|
1845
|
+
notes.push(`${history.listing.key}'s ${history.interval} bars are merged ${under}, ${history.data.length} bars into ${rowsOf.size} rows: a row's close is its last bar's.`);
|
|
1846
|
+
// The last bar can be stamped at the latest trade inside its slot; the others say where a symbol's bars start.
|
|
1847
|
+
} else if (history.data.slice(0, -1).some((row, index) => slotOf[series]![index] !== row.date)) moved.push(history.listing.key);
|
|
1848
|
+
});
|
|
1849
|
+
if (moved.length) notes.unshift(`${listedKeys(moved)} bars are listed ${under}.`);
|
|
1850
|
+
}
|
|
1714
1851
|
return {
|
|
1715
1852
|
rows,
|
|
1716
1853
|
columns: [
|
|
@@ -1725,6 +1862,7 @@ function wideHistoryTable(served: readonly ListingHistory[]): {
|
|
|
1725
1862
|
}),
|
|
1726
1863
|
],
|
|
1727
1864
|
interval: intervals.size === 1 ? [...intervals][0] ?? null : null,
|
|
1865
|
+
notes,
|
|
1728
1866
|
};
|
|
1729
1867
|
}
|
|
1730
1868
|
|
|
@@ -1801,6 +1939,7 @@ async function runHistoryList(
|
|
|
1801
1939
|
} : { symbol: entry.symbol, error: entry.error });
|
|
1802
1940
|
if (wide) {
|
|
1803
1941
|
const table = wideHistoryTable(served);
|
|
1942
|
+
notes.push(...table.notes);
|
|
1804
1943
|
ctx.printResult({
|
|
1805
1944
|
data: table.rows,
|
|
1806
1945
|
metadata: {
|
|
@@ -21,8 +21,8 @@ import {
|
|
|
21
21
|
type TickerSearchCandidate,
|
|
22
22
|
} from "../../tickers/search";
|
|
23
23
|
import { initMarketData, withMarketData } from "../context";
|
|
24
|
-
import { listingChangeLine, loadListingFate } from "../../tickers/listing-fate";
|
|
25
|
-
import { formatMarketPriceWithCurrency, quoteFormatOptions } from "../../market-data/market/format";
|
|
24
|
+
import { listingChangeLine, loadListingFate, loadNoQuoteEnding, noLongerListedNote, noQuoteLastTradeNote, type NoQuoteEnding } from "../../tickers/listing-fate";
|
|
25
|
+
import { formatMarketPriceWithCurrency, quoteFormatOptions, withCurrencyMinorDigits } from "../../market-data/market/format";
|
|
26
26
|
import { formerIssuerLine, startTickerChangeLookup, type TickerChangeLookup } from "../../tickers/ticker-changes";
|
|
27
27
|
import { fail, failRetryable, failWithError, isCliFailure, unreachableError } from "../errors";
|
|
28
28
|
import { isProviderBusy, SEARCH_BUSY_CODE, SEARCH_BUSY_MESSAGE } from "../../sources/provider-errors";
|
|
@@ -180,9 +180,25 @@ async function searchFate(
|
|
|
180
180
|
quote: Quote | null,
|
|
181
181
|
dataProvider: DataProvider,
|
|
182
182
|
changes: TickerChangeLookup,
|
|
183
|
+
/** The symbol's last bars when it has no quote (loadNoQuoteEnding), read beside the search. */
|
|
184
|
+
noQuoteEnding: Promise<NoQuoteEnding | null> = Promise.resolve(null),
|
|
183
185
|
): Promise<SearchFate> {
|
|
184
186
|
const fate = await loadListingFate({ symbol }, dataProvider, { quote, changes });
|
|
185
187
|
const unlisted = !candidates.some((candidate) => candidate.symbol.toUpperCase() === symbol);
|
|
188
|
+
// No quote at all (a retired ETN): a listed row the service marks ended says when, and one search no longer lists is
|
|
189
|
+
// listed with its last day and close, from its US line's last bars, when the service's record says it ended. Bars
|
|
190
|
+
// alone that stopped over a month ago say only that it has not traded since.
|
|
191
|
+
if (!quote) {
|
|
192
|
+
const ended = candidates.find((candidate) => candidate.symbol.toUpperCase() === symbol && candidate.result?.delisting)?.result?.delisting;
|
|
193
|
+
if (ended) return { stopped: null, notes: [`${noLongerListedNote(symbol, ended.lastTradeDate)}.`] };
|
|
194
|
+
const ending = unlisted ? await noQuoteEnding : null;
|
|
195
|
+
if (ending && !ending.recorded) return { stopped: null, notes: [`${noQuoteLastTradeNote(symbol, ending)}.`] };
|
|
196
|
+
if (ending) {
|
|
197
|
+
const note = noLongerListedNote(symbol, ending.date);
|
|
198
|
+
return { stopped: { symbol, name: fate.change?.issuer || null, lastTraded: ending.date,
|
|
199
|
+
lastPrice: ending.lastClose == null ? "—" : formatMarketPriceWithCurrency(ending.lastClose, "USD", withCurrencyMinorDigits({}, "USD")), note }, notes: [] };
|
|
200
|
+
}
|
|
201
|
+
}
|
|
186
202
|
const stopped = unlisted && quote && fate.endedOn && fate.note
|
|
187
203
|
? {
|
|
188
204
|
symbol,
|
|
@@ -667,13 +683,15 @@ export async function search(query: string, dependencies: SearchCommandDependenc
|
|
|
667
683
|
const savedExchange = tickers.find((ticker) => ticker.metadata.ticker.toUpperCase() === symbol)?.metadata.exchange ?? "";
|
|
668
684
|
const quote = bare ? loadSearchedQuote(symbol, savedExchange, dataProvider) : null;
|
|
669
685
|
const changes = bare ? startTickerChangeLookup(dataProvider, symbol) : null;
|
|
686
|
+
// With no quote, its US line's last bars, to list a retired symbol (STPP) with its last day.
|
|
687
|
+
const ending = quote?.then((quoted) => quoted ? null : loadNoQuoteEnding({ symbol }, dataProvider));
|
|
670
688
|
const candidates = await searchCandidatesForCli({
|
|
671
689
|
query: index?.symbol ?? trimmedQuery,
|
|
672
690
|
tickers,
|
|
673
691
|
dataProvider,
|
|
674
692
|
...quote ? { quote } : {},
|
|
675
693
|
}).catch((error: unknown) => failTickerLookup(error, trimmedQuery, !dependencies.printResult));
|
|
676
|
-
const fate = quote && changes ? await searchFate(symbol, candidates, await quote, dataProvider, changes) : NO_SEARCH_FATE;
|
|
694
|
+
const fate = quote && changes ? await searchFate(symbol, candidates, await quote, dataProvider, changes, ending) : NO_SEARCH_FATE;
|
|
677
695
|
|
|
678
696
|
const series = findCatalogSeries(dependencies.plugins ?? [], trimmedQuery, "names");
|
|
679
697
|
const bank = searchedCentralBank(trimmedQuery);
|