@gloom-sh/terminal 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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
|
+
import { apiClient } from "../../../api-client";
|
|
2
3
|
import { Box, Text, type InputRenderable, type TextareaRenderable } from "../../../ui";
|
|
3
4
|
import { useShortcut } from "../../../react/input";
|
|
4
5
|
import { isPlainKey } from "../../../utils/keyboard";
|
|
@@ -17,7 +18,15 @@ import {
|
|
|
17
18
|
generateNoteId,
|
|
18
19
|
type QuickNoteEntry,
|
|
19
20
|
} from "./model";
|
|
20
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
chooseNoteOwner,
|
|
23
|
+
mayDeleteNote,
|
|
24
|
+
NOT_YOUR_NOTE,
|
|
25
|
+
ownerColor,
|
|
26
|
+
ownerLabel,
|
|
27
|
+
resolveNoteConflict,
|
|
28
|
+
useNoteTeams,
|
|
29
|
+
} from "./owner";
|
|
21
30
|
import { NoteConflictError, type NoteOwner, noteOwnerKey, type NotesStoreRegistry } from "./store";
|
|
22
31
|
import { useSyncedText } from "./text-state";
|
|
23
32
|
|
|
@@ -63,6 +72,10 @@ export function createQuickNotesPane(registry: NotesStoreRegistry) {
|
|
|
63
72
|
const unreadableIndexRef = useRef(new Set<string>());
|
|
64
73
|
const [indexError, setIndexError] = useState<{ message: string; owners: NoteOwner[] } | null>(null);
|
|
65
74
|
const activeTab = tabs.find((tab) => tab.id === activeTabId);
|
|
75
|
+
// Closing a tab deletes its note, which a teammate's team note refuses.
|
|
76
|
+
const mayDelete = useCallback((tab: OwnedQuickNote) => (
|
|
77
|
+
mayDeleteNote(tab, teams, apiClient.getCurrentUser()?.id ?? null)
|
|
78
|
+
), [teams]);
|
|
66
79
|
|
|
67
80
|
const saveQuickNotesIndex = useCallback((entries: OwnedQuickNote[]) => {
|
|
68
81
|
// Each owner keeps its own index; a title change only touches that store.
|
|
@@ -296,6 +309,10 @@ export function createQuickNotesPane(registry: NotesStoreRegistry) {
|
|
|
296
309
|
|
|
297
310
|
const requestRemoveTab = useCallback(async (id: string) => {
|
|
298
311
|
const tab = tabs.find((entry) => entry.id === id);
|
|
312
|
+
if (tab && !mayDelete(tab)) {
|
|
313
|
+
notify({ body: NOT_YOUR_NOTE, type: "info" });
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
299
316
|
const store = storeFor(tab?.owner ?? { kind: "user" });
|
|
300
317
|
const text = id === activeTabId
|
|
301
318
|
? readActiveNoteText()
|
|
@@ -317,7 +334,7 @@ export function createQuickNotesPane(registry: NotesStoreRegistry) {
|
|
|
317
334
|
}
|
|
318
335
|
|
|
319
336
|
removeTab(id);
|
|
320
|
-
}, [activeTabId, dialog, readActiveNoteText, removeTab, storeFor, tabs]);
|
|
337
|
+
}, [activeTabId, dialog, mayDelete, notify, readActiveNoteText, removeTab, storeFor, tabs]);
|
|
321
338
|
|
|
322
339
|
const startRename = useCallback(() => {
|
|
323
340
|
if (!activeTab) return;
|
|
@@ -404,7 +421,8 @@ export function createQuickNotesPane(registry: NotesStoreRegistry) {
|
|
|
404
421
|
|
|
405
422
|
// Deleting the only note when it is empty just swaps in another empty one,
|
|
406
423
|
// and a note that failed to load reads as empty, so it would go unconfirmed.
|
|
407
|
-
const canDelete = !!activeTabId && !readError && (tabs.length > 1 || noteText.trim().length > 0)
|
|
424
|
+
const canDelete = !!activeTabId && !readError && (tabs.length > 1 || noteText.trim().length > 0)
|
|
425
|
+
&& (!activeTab || mayDelete(activeTab));
|
|
408
426
|
|
|
409
427
|
usePaneFooter("quick-notes", () => ({
|
|
410
428
|
info: footerWarning
|
|
@@ -426,7 +444,7 @@ export function createQuickNotesPane(registry: NotesStoreRegistry) {
|
|
|
426
444
|
label: tab.owner.kind === "team" ? `${ownerLabel(tab.owner, teams)} ${tab.title}` : tab.title,
|
|
427
445
|
value: tab.id,
|
|
428
446
|
...(tab.owner.kind === "team" ? { fg: ownerColor(tab.owner, teams) } : {}),
|
|
429
|
-
onClose: tabs.length > 1 ? (id: string) => { void requestRemoveTab(id); } : undefined,
|
|
447
|
+
onClose: tabs.length > 1 && mayDelete(tab) ? (id: string) => { void requestRemoveTab(id); } : undefined,
|
|
430
448
|
onDoubleClick: startRenameTab,
|
|
431
449
|
}));
|
|
432
450
|
const selectTab = (id: string) => {
|
|
@@ -240,7 +240,12 @@ export class CloudNotesStore implements NotesStore {
|
|
|
240
240
|
return [...index.values()]
|
|
241
241
|
.filter((summary) => summary.kind === "quick")
|
|
242
242
|
.sort((a, b) => a.createdAt.localeCompare(b.createdAt))
|
|
243
|
-
.map((summary) => ({
|
|
243
|
+
.map((summary) => ({
|
|
244
|
+
id: summary.key,
|
|
245
|
+
title: summary.title ?? "Note",
|
|
246
|
+
updatedAt: Date.parse(summary.updatedAt) || undefined,
|
|
247
|
+
...(summary.createdBy !== undefined ? { createdBy: summary.createdBy } : {}),
|
|
248
|
+
}));
|
|
244
249
|
}
|
|
245
250
|
|
|
246
251
|
/**
|
|
@@ -411,7 +411,9 @@ export function PerpsPane({ width, height, focused, marketAction }: Pick<PanePro
|
|
|
411
411
|
}, [assetOnly, carried, compareAsset, marketTab, setSearch, setCompareAsset, setTab]);
|
|
412
412
|
const openMarket = useCallback((row: PerpBoardRow, next: PerpTab = openingTab(row.marketId, access.hasProAccess)) => { setSearch(row.marketId); setTab(next); }, [setSearch, setTab, access.hasProAccess]);
|
|
413
413
|
const openMarketId = useCallback((marketId: string) => { setSearch(marketId); setTab(openingTab(marketId, access.hasProAccess)); }, [setSearch, setTab, access.hasProAccess]);
|
|
414
|
-
|
|
414
|
+
// Kept between board updates, so the tab strip skips the renders they give the pane.
|
|
415
|
+
const tabItems = useMemo(() => PERP_TABS.map((value) => ({ value, label: label(value) })), []);
|
|
416
|
+
const { strip, rows: tabRows } = usePaneTabs({ tabs: tabItems, activeValue: tab, onSelect: selectTab, focused, dense: true });
|
|
415
417
|
const refreshMarket = useCallback(() => { void resource.reload(); }, [resource.reload]);
|
|
416
418
|
useAutoRefresh(resource.updatedAt, resource.load, { intervalMs: 60_000 });
|
|
417
419
|
usePaneRefreshKey(refreshMarket, { focused: focused && marketTab && !querySearch.active && (tab !== "history" || !active) });
|
|
@@ -237,6 +237,23 @@ export function retryNotice(ctx: CliCommandContext): (count: number, waitMs: num
|
|
|
237
237
|
};
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
+
/** A list this long says how far its lookup has got, so a long add never looks stuck. */
|
|
241
|
+
const PROGRESS_FROM = 50;
|
|
242
|
+
const PROGRESS_EVERY_MS = 5_000;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Lines on standard error while a long add looks its symbols up: "Looked up
|
|
246
|
+
* 120 of 300 symbols." every few seconds, and nothing for a short list.
|
|
247
|
+
*/
|
|
248
|
+
export function progressNotice(ctx: CliCommandContext, now = () => Date.now()): (looked: number, total: number) => void {
|
|
249
|
+
let last = now();
|
|
250
|
+
return (looked, total) => {
|
|
251
|
+
if (ctx.cliOptions.quiet || total < PROGRESS_FROM || looked >= total || now() - last < PROGRESS_EVERY_MS) return;
|
|
252
|
+
last = now();
|
|
253
|
+
console.error(cliStyles.muted(`Looked up ${looked} of ${total} symbols.`));
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
|
|
240
257
|
/**
|
|
241
258
|
* The symbols an add or remove was given, failing the command when there are
|
|
242
259
|
* none or the file cannot be read. An add reads a typed company's name with
|
|
@@ -74,7 +74,7 @@ import {
|
|
|
74
74
|
requirePortfolio,
|
|
75
75
|
takeCollectionName,
|
|
76
76
|
} from "./shared";
|
|
77
|
-
import { addOneSymbol, addSymbols, FILE_OPTION, printSymbolRows, removeSymbols, requireSymbolList, retryNotice, shellWord, SYMBOL_LIST_HELP } from "./bulk-symbols";
|
|
77
|
+
import { addOneSymbol, addSymbols, FILE_OPTION, printSymbolRows, progressNotice, removeSymbols, requireSymbolList, retryNotice, shellWord, SYMBOL_LIST_HELP } from "./bulk-symbols";
|
|
78
78
|
import { readNameEntries } from "../../../../cli/name-entries";
|
|
79
79
|
import { DRIP_DEFAULT_YEARS, DRIP_MAX_YEARS, parseDripYears, parseWithholding } from "../income";
|
|
80
80
|
|
|
@@ -263,6 +263,7 @@ async function addToPortfolioCommand(args: string[], file: string | undefined, e
|
|
|
263
263
|
suggest: true,
|
|
264
264
|
dryRun,
|
|
265
265
|
onRetry: retryNotice(ctx),
|
|
266
|
+
onProgress: progressNotice(ctx),
|
|
266
267
|
retry,
|
|
267
268
|
add: (ticker) => addTickerToPortfolio(ticker, portfolio.id),
|
|
268
269
|
});
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
} from "../../../../portfolio/mutations";
|
|
23
23
|
import { showCollection } from "./render";
|
|
24
24
|
import { listingFields, misplacedSymbolList, refuseDryRun, takeCollectionName } from "./shared";
|
|
25
|
-
import { addOneSymbol, addSymbols, FILE_OPTION, printSymbolRows, removeSymbols, requireSymbolList, retryNotice, shellWord, SYMBOL_LIST_HELP } from "./bulk-symbols";
|
|
25
|
+
import { addOneSymbol, addSymbols, FILE_OPTION, printSymbolRows, progressNotice, removeSymbols, requireSymbolList, retryNotice, shellWord, SYMBOL_LIST_HELP } from "./bulk-symbols";
|
|
26
26
|
import { readNameEntries } from "../../../../cli/name-entries";
|
|
27
27
|
import { CLI_COMMAND_GROUPS } from "../../../../cli/help";
|
|
28
28
|
|
|
@@ -123,6 +123,7 @@ async function addToWatchlistCommand(args: string[], file: string | undefined, e
|
|
|
123
123
|
store: market.store,
|
|
124
124
|
dataProvider: market.dataProvider,
|
|
125
125
|
onRetry: retryNotice(ctx),
|
|
126
|
+
onProgress: progressNotice(ctx),
|
|
126
127
|
retry,
|
|
127
128
|
suggest: true,
|
|
128
129
|
dryRun,
|
|
@@ -55,7 +55,7 @@ export function PortfolioCashMarginDrawer({
|
|
|
55
55
|
<Text fg={colors.textDim}>{" qty "}</Text>
|
|
56
56
|
<Text fg={colors.text}>{padTo(formatMarketQuantity(balance.quantity, { isCashBalance: true, maxWidth: 14 }), 14, "right")}</Text>
|
|
57
57
|
<Text fg={colors.textDim}>{" value "}</Text>
|
|
58
|
-
<Text fg={colors.text}>{padTo(balance.baseValue != null ? formatCompact(balance.baseValue) : "—", 10, "right")}</Text>
|
|
58
|
+
<Text fg={colors.text}>{padTo(balance.baseValue != null ? formatCompact(balance.baseValue, { fixedDecimals: true }) : "—", 10, "right")}</Text>
|
|
59
59
|
</Box>
|
|
60
60
|
))
|
|
61
61
|
)}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RateMeeting } from "../../../api-client/rates";
|
|
1
|
+
import type { RateMeeting, RatePathPayload } from "../../../api-client/rates";
|
|
2
2
|
import type { HeadlessPaneColumn, HeadlessPaneDefinition } from "../../../types/plugin";
|
|
3
3
|
import { fetchRatePath } from "./client";
|
|
4
4
|
import { meetingMoves, moveOddsText, movesPriced, movesText, rateText } from "./model";
|
|
@@ -25,8 +25,9 @@ const probabilities = (value: unknown) => {
|
|
|
25
25
|
: outcomes.map((outcome) => `${outcome.targetMidpoint.toFixed(3)}% ${(outcome.probability * 100).toFixed(0)}%`).join(" / ");
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
+
const STALE_COLUMN: HeadlessPaneColumn = { key: "stale", header: "Data stale", stackPriority: 2, format: yesNo };
|
|
28
29
|
// A narrow terminal leaves out the sample count, status, percentile and quote time (the closing line has it),
|
|
29
|
-
// then moves the
|
|
30
|
+
// then moves the month under each row.
|
|
30
31
|
const contractColumns: HeadlessPaneColumn[] = [
|
|
31
32
|
{ key: "symbol", header: "Symbol", shrink: false }, { key: "month", header: "Month", shrink: false, stackPriority: 1 },
|
|
32
33
|
{ key: "price", header: "Price", align: "right", format: (value) => finiteOrNull(value)?.toFixed(3) ?? "--" },
|
|
@@ -34,8 +35,17 @@ const contractColumns: HeadlessPaneColumn[] = [
|
|
|
34
35
|
{ key: "percentile", header: "Pctl 1Y", align: "right", stackPriority: 4, stackRows: 0, format: pctl },
|
|
35
36
|
{ key: "samples", header: "Samples", align: "right", stackPriority: 6, stackRows: 0 },
|
|
36
37
|
{ key: "asOf", header: "As of UTC", shrink: false, stackPriority: 3, stackRows: 0, format: timestamp },
|
|
37
|
-
{ key: "status", header: "Status", stackPriority: 5, stackRows: 0 },
|
|
38
|
+
{ key: "status", header: "Status", stackPriority: 5, stackRows: 0 }, STALE_COLUMN,
|
|
38
39
|
];
|
|
40
|
+
/** The text says once which rows are stale, under the tables (`staleNote`), not "no" on every row; JSON keeps the column. */
|
|
41
|
+
const textColumns = (columns: HeadlessPaneColumn[]) => columns.filter((column) => column.key !== "stale");
|
|
42
|
+
|
|
43
|
+
/** "Stale: Effective fed funds rate, ZQX26.CBT.", naming each row whose figure is stale; null when none is. */
|
|
44
|
+
function staleNote(data: Pick<RatePathPayload, "current" | "fedFunds" | "sofr">): string | null {
|
|
45
|
+
const stale = [...Object.entries(data.current).filter(([, metric]) => metric.stale).map(([name]) => policyLabel(name)),
|
|
46
|
+
...[...data.fedFunds, ...data.sofr].filter((contract) => contract.stale && contract.status !== "unavailable").map((contract) => contract.symbol)];
|
|
47
|
+
return stale.length ? `Stale: ${stale.join(", ")}.` : null;
|
|
48
|
+
}
|
|
39
49
|
|
|
40
50
|
/**
|
|
41
51
|
* How far the fed funds and SOFR futures quotes are held back. The rate-path
|
|
@@ -60,14 +70,17 @@ export const ratePathHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
60
70
|
// (FRED) keep their own date and stale flag in their table, and the meetings are read from the contracts.
|
|
61
71
|
const contracts = [...data.fedFunds, ...data.sofr].filter((contract) => contract.status !== "unavailable")
|
|
62
72
|
.map(({ asOf, stale }) => ({ asOf, stale }));
|
|
73
|
+
const policyColumns: HeadlessPaneColumn[] = [
|
|
74
|
+
{ key: "name", header: "Name", minWidth: 18, format: policyLabel }, { key: "value", header: "Value", align: "right", format: rate },
|
|
75
|
+
{ key: "asOf", header: "As of", shrink: false }, { key: "percentile", header: "Pctl 1Y", align: "right", stackPriority: 1, format: pctl },
|
|
76
|
+
{ key: "samples", header: "Samples", align: "right", stackPriority: 2, stackRows: 0 }, { key: "stale", header: "Data stale", format: yesNo },
|
|
77
|
+
];
|
|
78
|
+
const stale = staleNote(data);
|
|
63
79
|
return {
|
|
64
80
|
freshness: { observedKey: "asOf", observations: contracts },
|
|
65
81
|
sections: [
|
|
66
|
-
{ title: "Current policy", columns:
|
|
67
|
-
|
|
68
|
-
{ key: "asOf", header: "As of", shrink: false }, { key: "percentile", header: "Pctl 1Y", align: "right", stackPriority: 1, format: pctl },
|
|
69
|
-
{ key: "samples", header: "Samples", align: "right", stackPriority: 2, stackRows: 0 }, { key: "stale", header: "Data stale", format: yesNo },
|
|
70
|
-
], rows: Object.entries(data.current).map(([name, metric]) => ({ name, ...metric })) },
|
|
82
|
+
{ title: "Current policy", columns: policyColumns, textColumns: textColumns(policyColumns),
|
|
83
|
+
rows: Object.entries(data.current).map(([name, metric]) => ({ name, ...metric })) },
|
|
71
84
|
// A narrow terminal keeps the moves and change, prints the probabilities of the next two meetings
|
|
72
85
|
// under their rows, and leaves out the rest; a reason a meeting has no rate stays under its row.
|
|
73
86
|
{ title: "FOMC meetings", columns: [
|
|
@@ -83,9 +96,10 @@ export const ratePathHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
83
96
|
{ key: "probabilities", header: "Probabilities", shrink: false, stackPriority: 4, stackRows: 2, format: probabilities },
|
|
84
97
|
{ key: "method", header: "Method", stackPriority: 9, stackRows: 0 }, { key: "reason", header: "Reason", stackPriority: 10 },
|
|
85
98
|
], rows: data.meetings.map((meeting) => ({ ...meeting, moves: movesPriced(meeting), moveOdds: moves.get(meeting.date) ?? null })) },
|
|
86
|
-
{ title: "Fed funds contracts", columns: contractColumns, rows: data.fedFunds.map((contract) => ({ ...contract })) },
|
|
87
|
-
{ title: "SOFR contracts", columns: contractColumns, rows: data.sofr.map((contract) => ({ ...contract })) },
|
|
99
|
+
{ title: "Fed funds contracts", columns: contractColumns, textColumns: textColumns(contractColumns), rows: data.fedFunds.map((contract) => ({ ...contract })) },
|
|
100
|
+
{ title: "SOFR contracts", columns: contractColumns, textColumns: textColumns(contractColumns), rows: data.sofr.map((contract) => ({ ...contract })) },
|
|
88
101
|
],
|
|
102
|
+
...(stale ? { notes: [stale] } : {}),
|
|
89
103
|
errors: data.gaps,
|
|
90
104
|
metadata: { ...data, probabilityBasis: data.probabilityAssumption, units: "percent", complete: data.status === "available" },
|
|
91
105
|
};
|
|
@@ -141,15 +141,20 @@ export function matchEarningsSecFiling(row: { status: string; date: string; date
|
|
|
141
141
|
return best?.filing ?? null;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
/**
|
|
145
|
-
|
|
146
|
-
|
|
144
|
+
/**
|
|
145
|
+
* The one currency every stated EPS and revenue amount is in, named once above
|
|
146
|
+
* the table (EVT and EE alike). An amount whose source stated no currency is
|
|
147
|
+
* marked `?` beside it rather than counted, so it never reads as that currency;
|
|
148
|
+
* amounts in several currencies keep their own codes.
|
|
149
|
+
*/
|
|
150
|
+
function sharedMetricCurrency(rows: readonly EventRow[]): string | undefined {
|
|
151
|
+
const currencies = new Set<string>();
|
|
147
152
|
for (const row of rows) {
|
|
148
153
|
for (const [value, currency] of [
|
|
149
154
|
[row.qEps, row.epsCurrency], [row.annualEps, row.epsCurrency],
|
|
150
155
|
[row.qRevenue, row.revenueCurrency], [row.annualRevenue, row.revenueCurrency],
|
|
151
156
|
] as const) {
|
|
152
|
-
if (value != null && Number.isFinite(value) &&
|
|
157
|
+
if (value != null && Number.isFinite(value) && currency) currencies.add(currency);
|
|
153
158
|
}
|
|
154
159
|
}
|
|
155
160
|
const [only] = currencies;
|
|
@@ -169,15 +174,14 @@ export function buildEventColumns(width: number, unit?: string, variant: "corpor
|
|
|
169
174
|
{ id: "detail", label: "DETAIL", width: 9, align: "left", flexGrow: 1 },
|
|
170
175
|
], width, ["detail", "growth", "revenue"]);
|
|
171
176
|
}
|
|
172
|
-
const withUnit = (label: string) => unit ? `${label} ${unit}` : label;
|
|
173
177
|
const columns: EventColumn[] = [
|
|
174
178
|
{ id: "date", label: "DATE", width: 10, align: "left" },
|
|
175
179
|
{ id: "status", label: "EVENT", width: 8, align: "left" },
|
|
176
180
|
{ id: "period", label: "PERIOD", width: 12, align: "left" },
|
|
177
|
-
{ id: "qEps", label:
|
|
178
|
-
{ id: "qRevenue", label:
|
|
179
|
-
{ id: "annualEps", label:
|
|
180
|
-
{ id: "annualRevenue", label:
|
|
181
|
+
{ id: "qEps", label: "Q EPS", width: 12, align: "right" },
|
|
182
|
+
{ id: "qRevenue", label: "Q REV", width: 12, align: "right" },
|
|
183
|
+
{ id: "annualEps", label: "ANN EPS", width: 12, align: "right" },
|
|
184
|
+
{ id: "annualRevenue", label: "ANN REV", width: 12, align: "right" },
|
|
181
185
|
{ id: "value", label: "VALUE", width: 11, align: "right" },
|
|
182
186
|
{ id: "detail", label: "DETAIL", width: 9, align: "left", flexGrow: 1 },
|
|
183
187
|
];
|
|
@@ -498,7 +502,7 @@ export function CorporateActionsView({
|
|
|
498
502
|
? allRows.filter((row) => EARNINGS_STATUSES.has(row.status))
|
|
499
503
|
: allRows
|
|
500
504
|
), [allRows, variant]);
|
|
501
|
-
const unit = useMemo(() => sharedMetricCurrency(rows
|
|
505
|
+
const unit = useMemo(() => sharedMetricCurrency(rows), [rows]);
|
|
502
506
|
const hasUnstatedCurrency = rows.some((row) =>
|
|
503
507
|
((row.qEps != null || row.annualEps != null) && !row.epsCurrency)
|
|
504
508
|
|| ((row.qRevenue != null || row.annualRevenue != null) && !row.revenueCurrency));
|
|
@@ -618,6 +622,11 @@ export function CorporateActionsView({
|
|
|
618
622
|
row: EventRow,
|
|
619
623
|
column: EventColumn,
|
|
620
624
|
): DataTableCell => {
|
|
625
|
+
// Bare under the currency named above the table, with its own code otherwise, `?` when its source stated none.
|
|
626
|
+
const metric = (value: number | undefined, currency: string | undefined, kind: "eps" | "revenue"): DataTableCell => {
|
|
627
|
+
const text = formatEventMetric(value, unit ? undefined : currency, kind);
|
|
628
|
+
return { text: value != null && !currency ? `${text} ?` : text, value: unit && currency ? value : undefined, color: colors.textDim };
|
|
629
|
+
};
|
|
621
630
|
switch (column.id) {
|
|
622
631
|
case "date":
|
|
623
632
|
return { text: row.date, color: colors.textDim };
|
|
@@ -626,26 +635,21 @@ export function CorporateActionsView({
|
|
|
626
635
|
case "period":
|
|
627
636
|
return { text: row.period, color: colors.textDim };
|
|
628
637
|
case "eps":
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
const currency = eps ? row.epsCurrency : row.revenueCurrency;
|
|
633
|
-
const text = formatEventMetric(value, unit ? undefined : currency, eps ? "eps" : "revenue");
|
|
634
|
-
return { text: value != null && !currency ? `${text} ?` : text,
|
|
635
|
-
value: unit && currency ? value : undefined, color: colors.textDim };
|
|
636
|
-
}
|
|
638
|
+
return metric(row.qEps ?? row.annualEps, row.epsCurrency, "eps");
|
|
639
|
+
case "revenue":
|
|
640
|
+
return metric(row.qRevenue ?? row.annualRevenue, row.revenueCurrency, "revenue");
|
|
637
641
|
case "surprise":
|
|
638
642
|
return { text: row.status === "Earnings" ? row.value : "-", value: row.surprisePercent, color: row.status === "Earnings" ? toneColor(row.tone) : colors.textDim };
|
|
639
643
|
case "growth":
|
|
640
644
|
return { text: row.estimateGrowthMetric && row.value !== "-" ? `${row.value} ${row.estimateGrowthMetric === "eps" ? "EPS" : "rev"}` : "-", color: row.estimateGrowthMetric ? toneColor(row.tone) : colors.textDim };
|
|
641
645
|
case "qEps":
|
|
642
|
-
return
|
|
646
|
+
return metric(row.qEps, row.epsCurrency, "eps");
|
|
643
647
|
case "qRevenue":
|
|
644
|
-
return
|
|
648
|
+
return metric(row.qRevenue, row.revenueCurrency, "revenue");
|
|
645
649
|
case "annualEps":
|
|
646
|
-
return
|
|
650
|
+
return metric(row.annualEps, row.epsCurrency, "eps");
|
|
647
651
|
case "annualRevenue":
|
|
648
|
-
return
|
|
652
|
+
return metric(row.annualRevenue, row.revenueCurrency, "revenue");
|
|
649
653
|
case "value":
|
|
650
654
|
return { text: row.value, color: toneColor(row.tone) };
|
|
651
655
|
case "detail":
|
|
@@ -694,7 +698,7 @@ export function CorporateActionsView({
|
|
|
694
698
|
rootWidth={width}
|
|
695
699
|
rootHeight={height}
|
|
696
700
|
rootBefore={<ChartTableHeader width={width} height={height} tableRows={rows.length} tableColumns={columns}
|
|
697
|
-
query={
|
|
701
|
+
query={currencyMeta ? <QueryBar width={width} meta={currencyMeta} /> : undefined} />}
|
|
698
702
|
onRootKeyDown={handleKeyDown}
|
|
699
703
|
columns={columns}
|
|
700
704
|
items={rows}
|
|
@@ -702,10 +706,10 @@ export function CorporateActionsView({
|
|
|
702
706
|
sortDirection="desc"
|
|
703
707
|
getItemKey={eventRowKey}
|
|
704
708
|
renderCell={renderCell}
|
|
705
|
-
getExportMetadata={
|
|
709
|
+
getExportMetadata={() => [
|
|
706
710
|
...(unit ? [["Currency", unit]] : []),
|
|
707
711
|
...(hasUnstatedCurrency ? [["?", "Currency unstated"]] : []),
|
|
708
|
-
]
|
|
712
|
+
]}
|
|
709
713
|
selectedTextOverridesCellColor
|
|
710
714
|
getRowBackgroundColor={rowBackground}
|
|
711
715
|
emptyStateTitle={loading
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
formatPercentRaw,
|
|
15
15
|
} from "../../../utils/format";
|
|
16
16
|
import { computeTTM } from "../ticker-detail/financials/aggregation";
|
|
17
|
+
import { classifyInstrumentType } from "../../../tickers/instrument-kind";
|
|
17
18
|
import { declaredDividends } from "../../../utils/declared-dividends";
|
|
18
19
|
import { fundamentalsEpsCurrency, SERVED_TRAILING_EPS } from "../../../utils/fundamentals";
|
|
19
20
|
import {
|
|
@@ -180,10 +181,16 @@ function estimateValue(pair: EstimatePair): string {
|
|
|
180
181
|
*/
|
|
181
182
|
export type EventFinancials = Pick<TickerFinancials, "quarterlyStatements" | "financialCurrency"> & {
|
|
182
183
|
fundamentals?: Pick<NonNullable<TickerFinancials["fundamentals"]>, "eps" | "epsCurrency" | "financialCurrency" | "marketCapCurrency" | "trailingEpsSource"> | null;
|
|
183
|
-
/** The listing's currency, which says whether an unlabelled EPS can be in the statements' (fundamentalsCurrency). */
|
|
184
|
-
quote?: Pick<NonNullable<TickerFinancials["quote"]>, "currency"> | null;
|
|
184
|
+
/** The listing's currency, which says whether an unlabelled EPS can be in the statements' (fundamentalsCurrency), and its type. */
|
|
185
|
+
quote?: Pick<NonNullable<TickerFinancials["quote"]>, "currency" | "instrumentType"> | null;
|
|
186
|
+
quoteMetadata?: Pick<NonNullable<TickerFinancials["quoteMetadata"]>, "instrumentType"> | null;
|
|
185
187
|
};
|
|
186
188
|
|
|
189
|
+
/** A fund (an ETF, a closed-end fund) reports no earnings: a feed's EPS rows for one are another company's or noise. */
|
|
190
|
+
function isFundListing(financials: EventFinancials | null): boolean {
|
|
191
|
+
return [financials?.quote?.instrumentType, financials?.quoteMetadata?.instrumentType].some((type) => classifyInstrumentType(type) === "fund");
|
|
192
|
+
}
|
|
193
|
+
|
|
187
194
|
/**
|
|
188
195
|
* The four reported rows behind the latest four statement quarters, summed, only when every one is on the adjusted
|
|
189
196
|
* basis and in one currency. Quarters of different or unknown bases never add up to anything.
|
|
@@ -325,7 +332,7 @@ export function buildEventRows(
|
|
|
325
332
|
): EventRow[] {
|
|
326
333
|
const rows: EventRow[] = [];
|
|
327
334
|
const quarterlyStatements = sortedQuarterlyStatements(financials);
|
|
328
|
-
const earnings = data?.earnings ?? [];
|
|
335
|
+
const earnings = isFundListing(financials) ? [] : data?.earnings ?? [];
|
|
329
336
|
const ttm = ttmRow(quarterlyStatements, earnings, financials);
|
|
330
337
|
if (ttm) rows.push(ttm);
|
|
331
338
|
|
|
@@ -12,6 +12,10 @@ import { buildEventRows, eventSourceNotice, CORPORATE_ACTION_COVERAGE } from "./
|
|
|
12
12
|
import { EVENT_COLUMNS, loadEventSources } from "./event-sources";
|
|
13
13
|
import { REPORTED_DATA } from "../shared/report-freshness";
|
|
14
14
|
import { EPS_BASIS_NOTE } from "../shared/earnings-report";
|
|
15
|
+
import { loadNoQuoteLastTraded, noQuoteLastTradeNote, otherListingProfile } from "../../../tickers/listing-fate";
|
|
16
|
+
import { isUsSymbolVenue } from "../../../tickers/ticker-changes";
|
|
17
|
+
import { parsePublicTickerKey } from "../../../utils/exchanges";
|
|
18
|
+
import type { EventStatus } from "./event-model";
|
|
15
19
|
|
|
16
20
|
interface EventHeadlessData {
|
|
17
21
|
actions: CorporateActionsData | null;
|
|
@@ -23,6 +27,9 @@ interface EventHeadlessData {
|
|
|
23
27
|
financialsError?: string | null;
|
|
24
28
|
}
|
|
25
29
|
|
|
30
|
+
/** The rows drawn from the research served under a symbol (its reports and estimates), not from its own corporate actions. */
|
|
31
|
+
const RESEARCH_EVENTS: ReadonlySet<EventStatus> = new Set(["Earnings", "Q Est", "FY Est", "TTM"]);
|
|
32
|
+
|
|
26
33
|
export interface EventsHeadlessDependencies {
|
|
27
34
|
load(
|
|
28
35
|
args: HeadlessPaneLoadArgs,
|
|
@@ -65,9 +72,20 @@ export function createEventsHeadless(
|
|
|
65
72
|
const errors = [notice?.failed ? notice.text : null,
|
|
66
73
|
data.financialsError ? `Financial statements unavailable: ${data.financialsError}` : null,
|
|
67
74
|
].filter((error): error is string => !!error);
|
|
75
|
+
// A symbol with no quote whose listing stopped trading says when it last traded. The issuer's own events after
|
|
76
|
+
// that stay (a cash-out, a liquidating distribution); only where the research served under the symbol is shown
|
|
77
|
+
// to be another listing's (STPP: a fund abroad's profile) are the reports and estimates after it dropped.
|
|
78
|
+
const lastTrade = data.financials?.quote ? null : await loadNoQuoteLastTraded({ symbol }, ctx.marketData);
|
|
79
|
+
const other = lastTrade ? otherListingProfile(data.financials?.profile, { usLine: isUsSymbolVenue(parsePublicTickerKey(symbol).exchange) }) : null;
|
|
80
|
+
const rows = buildEventRows(data.actions, data.estimates, data.financials, data.currency);
|
|
81
|
+
const own = lastTrade && other
|
|
82
|
+
? rows.filter((row) => !RESEARCH_EVENTS.has(row.status) || row.date.slice(0, 10) <= lastTrade.date) : rows;
|
|
83
|
+
const hidden = rows.length - own.length;
|
|
84
|
+
const ended = lastTrade ? `${noQuoteLastTradeNote(symbol, lastTrade)}.${hidden > 0
|
|
85
|
+
? ` ${hidden} later ${hidden === 1 ? "report is" : "reports are"} another listing's (${other}), not shown.` : ""}` : null;
|
|
68
86
|
return {
|
|
69
|
-
rows:
|
|
70
|
-
|
|
87
|
+
rows: own.map((row) => ({ ...row })),
|
|
88
|
+
...(ended ? { notes: [ended] } : {}),
|
|
71
89
|
errors: errors.length > 0 ? errors : undefined,
|
|
72
90
|
metadata: { symbol, currency: data.currency, coverage: data.actions?.coverage,
|
|
73
91
|
coverageNote: CORPORATE_ACTION_COVERAGE, epsBasis: EPS_BASIS_NOTE,
|
|
@@ -7,7 +7,7 @@ import { createPluginCache } from "../../../data/plugin-cache";
|
|
|
7
7
|
import type { HeadlessPaneEntry } from "../../../types/plugin";
|
|
8
8
|
import { errorMessage } from "../../../utils/errors";
|
|
9
9
|
import { formatCompact } from "../../../utils/format";
|
|
10
|
-
import { bondClassText, bondFigures } from "../../../market-data/bond-funds";
|
|
10
|
+
import { bondClassText, bondFigures, DV01_FROM_DURATION, durationDv01PerShare, formatDv01PerShare } from "../../../market-data/bond-funds";
|
|
11
11
|
import { readFundFacts, validateFundFacts } from "../../../market-data/fund-facts";
|
|
12
12
|
import { cachedCloudResource, loadCloudResource, unavailableOnServer } from "../shared/cloud-resource";
|
|
13
13
|
|
|
@@ -242,6 +242,8 @@ export function fundFactItems(facts: FundFactsPayload): StatItem[] {
|
|
|
242
242
|
for (const figure of facts.bond ? bondFigures(facts.bond) : []) {
|
|
243
243
|
items.push(cell(figure.key, figure.label, figure.text, { detail: figure.date, marked: facts.stale }));
|
|
244
244
|
}
|
|
245
|
+
const dv01 = fundDv01(facts);
|
|
246
|
+
if (dv01) items.push(cell("dv01", "DV01", formatDv01PerShare(dv01.value), { detail: DV01_FROM_DURATION, marked: facts.stale }));
|
|
245
247
|
// A metal trust's metal in trust, in tonnes as the market quotes it and ounces as the trust counts it, then its day's change.
|
|
246
248
|
const metal = facts.metalHoldings;
|
|
247
249
|
if (metal) {
|
|
@@ -267,6 +269,18 @@ export function fundFactItems(facts: FundFactsPayload): StatItem[] {
|
|
|
267
269
|
return items;
|
|
268
270
|
}
|
|
269
271
|
|
|
272
|
+
/**
|
|
273
|
+
* A bond fund's DV01 per share, derived from its duration at the closing
|
|
274
|
+
* price (NAV without one), with the price it was read at.
|
|
275
|
+
*/
|
|
276
|
+
function fundDv01(facts: FundFactsPayload): { value: number; price: string } | null {
|
|
277
|
+
const price = facts.closingPrice ?? facts.nav;
|
|
278
|
+
const value = durationDv01PerShare(price?.value, facts.bond);
|
|
279
|
+
if (value == null || !price) return null;
|
|
280
|
+
const date = price.asOf ? ` ${price.asOf}` : "";
|
|
281
|
+
return { value, price: facts.closingPrice ? `closing price${date}` : `NAV${date}` };
|
|
282
|
+
}
|
|
283
|
+
|
|
270
284
|
/** A DES figure: `warn` when it is older than it looks, which DES draws in the warning colour. */
|
|
271
285
|
interface FundFactOverviewField {
|
|
272
286
|
label: string;
|
|
@@ -373,6 +387,8 @@ export function fundFactEntries(facts: FundFactsPayload): HeadlessPaneEntry[] {
|
|
|
373
387
|
add(keys[figure.key], figure.key === "secYield" ? "30-day SEC yield" : figure.label, figure.value,
|
|
374
388
|
provenance(figure.text, figure.date, figure.source), figure.key === "duration" ? "years" : "%");
|
|
375
389
|
}
|
|
390
|
+
const dv01 = fundDv01(facts);
|
|
391
|
+
if (dv01) add("dv01PerShare", "DV01", dv01.value, provenance(formatDv01PerShare(dv01.value), DV01_FROM_DURATION, dv01.price), "USD per bp");
|
|
376
392
|
}
|
|
377
393
|
if (facts.sponsor) add("sponsor", "Sponsor", facts.sponsor.value, facts.sponsor.value);
|
|
378
394
|
if (facts.inception) add("inception", "Inception", facts.inception.value, facts.inception.value);
|
|
@@ -637,7 +637,7 @@ export const secModule: PluginModule = {
|
|
|
637
637
|
label: "Fund Facts",
|
|
638
638
|
description: "A US-listed fund's fee, NAV, premium or discount, net assets, sponsor, inception and index, a leveraged or inverse fund's daily objective, then the fund's own SEC filings: prospectus updates, shareholder reports, N-CEN and N-PORT.",
|
|
639
639
|
keywords: ["etf", "fund", "expense ratio", "fee", "nav", "premium", "discount", "aum", "net assets", "n-1a", "485bpos", "497", "n-csr", "n-cen", "n-port", "prospectus",
|
|
640
|
-
"leveraged", "inverse", "daily objective", "daily-reset", "decay"],
|
|
640
|
+
"leveraged", "inverse", "daily objective", "daily-reset", "decay", "bond fund", "duration", "dv01", "hedge ratio", "steepener"],
|
|
641
641
|
shortcut: "ETF",
|
|
642
642
|
viewKey: "etf",
|
|
643
643
|
canCreate: (_context, options) => !options?.ticker || mayBeUsEquityOrFundTicker(options.ticker),
|
|
@@ -53,6 +53,7 @@ export const SERIES_INVENTORY: readonly SeriesInventoryEntry[] = [
|
|
|
53
53
|
{ module: "credit-conditions", chart: "Corporate bond spreads by rating", series: ["fred:BAML*"] },
|
|
54
54
|
{ module: "credit-boards", chart: "Index CDS (CDX, iTraxx) and sovereign 5Y CDS", series: ["cdx:*", "sovereign-cds:*"] },
|
|
55
55
|
{ module: "cds", chart: "A company's 5Y CDS spread", series: ["cds:*"] },
|
|
56
|
+
{ module: "trace-bonds", chart: "A bond's daily closing price since it was kept", notInCatalog: "not-yet", reason: "Daily and dated per CUSIP, kept only for the bonds Pro accounts looked up; none is registered for the composer yet." },
|
|
56
57
|
{ module: "credit-documents", chart: "Principal due by year", notInCatalog: "not-a-time-series", reason: "A maturity schedule, not a history." },
|
|
57
58
|
{ module: "debt-maturities", chart: "A company's principal and the share due soon, across annual filings", series: ["debt-maturities:*"] },
|
|
58
59
|
{ module: "debt-maturities", chart: "A company's maturity wall", notInCatalog: "not-a-time-series", reason: "A schedule by maturity year from one filing; its total and near-term shares across filings are in the catalog." },
|
|
@@ -54,8 +54,13 @@ export function epsBasisShort(basis: EarningsEpsBasis | null): string {
|
|
|
54
54
|
return basis === "gaap" ? "GAAP" : basis === "adjusted" ? "adj" : "?";
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
/**
|
|
58
|
-
|
|
57
|
+
/**
|
|
58
|
+
* A reported row's detail names a known basis as ERN's Basis column does. An
|
|
59
|
+
* unknown one says nothing a reader can use in a sentence ("unknown, +0.07 vs
|
|
60
|
+
* est"), so the detail leaves it out; the row's `epsBasis`, its drilldown and
|
|
61
|
+
* ERN's column still say it.
|
|
62
|
+
*/
|
|
63
|
+
const BASIS_TEXT: Record<EpsBasisName, string> = { GAAP: "GAAP", adjusted: "adj", unknown: "" };
|
|
59
64
|
|
|
60
65
|
type EarningsRecord = CorporateActionsData["earnings"][number];
|
|
61
66
|
|