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
|
@@ -21,12 +21,14 @@ import {
|
|
|
21
21
|
usePaneFooter,
|
|
22
22
|
usePaneNoticeFooter,
|
|
23
23
|
usePaneTabs,
|
|
24
|
+
useRowNotes,
|
|
24
25
|
useTableLoadMore,
|
|
25
26
|
type DataTableColumn,
|
|
26
27
|
type DataTableVisibleRange,
|
|
27
28
|
type SelectControl,
|
|
28
29
|
} from "../../../components";
|
|
29
30
|
import {
|
|
31
|
+
useAppSelector,
|
|
30
32
|
useAsyncResource,
|
|
31
33
|
useAutoRefresh,
|
|
32
34
|
usePaneSettingValue,
|
|
@@ -39,15 +41,19 @@ import { useThemeColors } from "../../../theme/theme-context";
|
|
|
39
41
|
import { priceColor, shownPriceColor } from "../../../theme/colors";
|
|
40
42
|
import { apiClient } from "../../../api-client";
|
|
41
43
|
import {
|
|
44
|
+
LETTER_GRADE_FIELDS,
|
|
42
45
|
NUMERIC_FIELDS,
|
|
43
46
|
type NumericField,
|
|
47
|
+
type ScreenCriterion,
|
|
44
48
|
type ScreenDefinition,
|
|
45
49
|
type ScreenField,
|
|
46
50
|
} from "../../../api-client/equity-screener";
|
|
47
51
|
import type { PaneProps } from "../../../types/plugin";
|
|
48
52
|
import { formatPercentileRank, formatPercentRaw } from "../../../utils/format";
|
|
53
|
+
import { wrapTextLines } from "../../../utils/text-wrap";
|
|
49
54
|
import { EXTENDED_SESSION_LABELS, extendedSessionStateLabel, type ExtendedSession } from "../../../market-data/market/status";
|
|
50
55
|
import { useOpenDescription } from "../shared/open-description";
|
|
56
|
+
import { useMembersMenu } from "../shared/members-menu";
|
|
51
57
|
import { useResearchCloudSession } from "../shared/research-cloud-session";
|
|
52
58
|
import { INITIAL_STREAM_RANGE, streamWindowRows } from "../shared/use-quote-board";
|
|
53
59
|
import { useSampledValue } from "../../../state/hooks/live-ticker-financials";
|
|
@@ -55,7 +61,7 @@ import { usePlanAccess } from "../../../api-client/plan-access";
|
|
|
55
61
|
import { useQuoteDelayFooter } from "../shared/cloud-upgrade";
|
|
56
62
|
import { SignInWall } from "../cloud/auth-actions";
|
|
57
63
|
import { CriterionEditor } from "./criterion-editor";
|
|
58
|
-
import { SCREEN_IDEAS, screenIdea } from "./ideas";
|
|
64
|
+
import { ideaMetricSetting, SCREEN_IDEAS, screenIdea } from "./ideas";
|
|
59
65
|
import { ScreenTickerCheck } from "./ticker-check";
|
|
60
66
|
import {
|
|
61
67
|
fetchSavedScreens,
|
|
@@ -70,20 +76,28 @@ import {
|
|
|
70
76
|
dividendYieldBasis,
|
|
71
77
|
formatScreenMetric,
|
|
72
78
|
formatScreenValue,
|
|
79
|
+
GRADE_DISPLAY_FIELDS,
|
|
80
|
+
MAX_SYMBOL_VALUES,
|
|
81
|
+
gradeRankText,
|
|
73
82
|
metricDate,
|
|
74
83
|
parseScreenDefinition,
|
|
75
84
|
pickerFields,
|
|
76
85
|
resultFields,
|
|
77
86
|
screenMetricSetting,
|
|
78
|
-
SIGN_COLORED,
|
|
79
87
|
screenColumnLabel,
|
|
80
88
|
screenCurrencyEmpty,
|
|
81
89
|
screenDefinitionKey,
|
|
90
|
+
screenDetailValue,
|
|
82
91
|
screenLabel,
|
|
83
92
|
screenRowId,
|
|
93
|
+
screenSignValue,
|
|
94
|
+
screenSymbols,
|
|
84
95
|
screenYtdBase,
|
|
96
|
+
splitGradeReason,
|
|
85
97
|
} from "./model";
|
|
98
|
+
import { findNamedCollection, readWatchlistArgument } from "../../../portfolio/collection-name";
|
|
86
99
|
import { useScreenResults } from "./results";
|
|
100
|
+
import { screenWatchlistList } from "./watchlist";
|
|
87
101
|
import { unmatchedCategoryText, unmatchedCategoryValues } from "./categories";
|
|
88
102
|
import { overlayLiveScreenRows, screenExtendedMove, screenExtendedSessions, sortLiveScreenRows, type LiveScreenRow } from "./live";
|
|
89
103
|
import { useLiveQuoteEntries } from "../../../state/hooks/quote-streaming";
|
|
@@ -169,6 +183,21 @@ export function resultColumns(
|
|
|
169
183
|
return fits(named) ? named : build(compact.slice(0, shown), exchange, sector, "compact");
|
|
170
184
|
}
|
|
171
185
|
const loadFields = () => fetchScreenFields();
|
|
186
|
+
const criterionRowId = (row: { id: string }) => row.id;
|
|
187
|
+
const criterionSignature = (row: { criterion: ScreenCriterion }) => JSON.stringify(row.criterion);
|
|
188
|
+
const DETAIL_LABEL_WIDTH = 24;
|
|
189
|
+
/** A long note under a value, wrapped to the detail's width rather than cut: one row per line, the label on the first. */
|
|
190
|
+
function WrappedDetailRows({ label, text, width }: { label: string; text: string; width: number }) {
|
|
191
|
+
// The detail's padding, the label column and the gap after it.
|
|
192
|
+
const lines = wrapTextLines(text, Math.max(16, width - 2 - DETAIL_LABEL_WIDTH - 1));
|
|
193
|
+
return (
|
|
194
|
+
<>
|
|
195
|
+
{lines.map((line, index) => (
|
|
196
|
+
<KeyValueRow key={index} label={index === 0 ? label : ""} labelWidth={DETAIL_LABEL_WIDTH} value={line} emphasis={false} />
|
|
197
|
+
))}
|
|
198
|
+
</>
|
|
199
|
+
);
|
|
200
|
+
}
|
|
172
201
|
function ScreenDetail({
|
|
173
202
|
row,
|
|
174
203
|
width,
|
|
@@ -189,19 +218,25 @@ function ScreenDetail({
|
|
|
189
218
|
{NUMERIC_FIELDS.map((field) => {
|
|
190
219
|
const metric = row.metrics[field];
|
|
191
220
|
const stamp = metricDate(metric);
|
|
221
|
+
// A grade's company note (graded on another line of the company) is said once, above the grades.
|
|
222
|
+
const reason = GRADE_DISPLAY_FIELDS.has(field) ? splitGradeReason(metric.reason).own : metric.reason;
|
|
223
|
+
const company = field === LETTER_GRADE_FIELDS[0] ? splitGradeReason(metric.reason).company : null;
|
|
192
224
|
const extended = field === "changePercent" ? row.extended : undefined;
|
|
193
225
|
const basis = field === "dividendYieldPercent" ? dividendYieldBasis(metric) : null;
|
|
226
|
+
// A grade's rank in its sector and the inputs it read, and its notes: peers, N/M or stale inputs, its company.
|
|
227
|
+
const graded = GRADE_DISPLAY_FIELDS.has(field) && metric.value !== null ? gradeRankText(metric) : null;
|
|
194
228
|
return (
|
|
195
229
|
<Fragment key={field}>
|
|
230
|
+
{company ? <WrappedDetailRows label="Grades" text={company} width={width} /> : null}
|
|
196
231
|
<KeyValueRow
|
|
197
232
|
label={screenLabel(field)}
|
|
198
233
|
labelWidth={24}
|
|
199
|
-
value={
|
|
234
|
+
value={screenDetailValue(field, metric)}
|
|
200
235
|
detail={
|
|
201
236
|
metric.value === null
|
|
202
|
-
? (
|
|
237
|
+
? (reason ?? "unavailable")
|
|
203
238
|
: [
|
|
204
|
-
metric.percentile.value == null ? null : formatPercentileRank(metric.percentile.value),
|
|
239
|
+
graded || metric.percentile.value == null ? null : formatPercentileRank(metric.percentile.value),
|
|
205
240
|
stamp.collected ? `collected ${stamp.text}` : stamp.text,
|
|
206
241
|
metric.state === "available" ? null : metric.state,
|
|
207
242
|
].filter(Boolean).join(" \u00b7 ")
|
|
@@ -217,6 +252,8 @@ function ScreenDetail({
|
|
|
217
252
|
/>
|
|
218
253
|
) : null}
|
|
219
254
|
{basis ? <KeyValueRow label="Yield basis" labelWidth={24} value={basis} /> : null}
|
|
255
|
+
{graded ? <WrappedDetailRows label="Ranked" text={graded} width={width} /> : null}
|
|
256
|
+
{graded && reason ? <WrappedDetailRows label="Note" text={reason} width={width} /> : null}
|
|
220
257
|
</Fragment>
|
|
221
258
|
);
|
|
222
259
|
})}
|
|
@@ -247,6 +284,7 @@ export function EquityScreenerPane(props: PaneProps) {
|
|
|
247
284
|
{...props}
|
|
248
285
|
initial={initial}
|
|
249
286
|
initialMetric={preset?.metric ?? "marketCap"}
|
|
287
|
+
initialMetricSetting={preset ? ideaMetricSetting(preset) : undefined}
|
|
250
288
|
/>
|
|
251
289
|
);
|
|
252
290
|
}
|
|
@@ -256,7 +294,8 @@ function EquityScreenView({
|
|
|
256
294
|
focused,
|
|
257
295
|
initial,
|
|
258
296
|
initialMetric,
|
|
259
|
-
|
|
297
|
+
initialMetricSetting,
|
|
298
|
+
}: PaneProps & { initial: ScreenDefinition; initialMetric: NumericField; initialMetricSetting?: string }) {
|
|
260
299
|
const colors = useThemeColors(),
|
|
261
300
|
dialog = useDialog(),
|
|
262
301
|
host = useRendererHost();
|
|
@@ -268,7 +307,7 @@ function EquityScreenView({
|
|
|
268
307
|
const [definition, setDefinition] = usePluginPaneState("definition", initial);
|
|
269
308
|
const [metricSetting, setMetric] = usePaneSettingValue<string>(
|
|
270
309
|
"metric",
|
|
271
|
-
initialMetric,
|
|
310
|
+
initialMetricSetting ?? initialMetric,
|
|
272
311
|
);
|
|
273
312
|
// `--metric trailingPE,dividendYieldPercent` leads with the first and adds the others as columns.
|
|
274
313
|
const [metric, ...otherMetrics] = screenMetricSetting(metricSetting, initialMetric);
|
|
@@ -348,6 +387,36 @@ function EquityScreenView({
|
|
|
348
387
|
const selected =
|
|
349
388
|
opened ?? rows.find((row) => screenRowId(row) === selectedId) ?? rows[0];
|
|
350
389
|
const currentSaved = saved.data?.find((row) => row.id === currentSavedId);
|
|
390
|
+
// The pane menu's Save to Watchlist… takes the matches loaded, in the order shown (the first page is 100). A live
|
|
391
|
+
// quote changes the rows but not who they are, so the menu is rebuilt only when the order does.
|
|
392
|
+
const shownOrder = rows.map(screenRowId).join(" ");
|
|
393
|
+
const watchlistList = useMemo(
|
|
394
|
+
() => mode === "results" && !openId && data && screenDefinitionKey(data.definition) === screenDefinitionKey(definition)
|
|
395
|
+
? screenWatchlistList({ definition, rows, matched: data.universe.matched, savedName: currentSaved?.name })
|
|
396
|
+
: null,
|
|
397
|
+
[currentSaved?.name, data, definition, mode, openId, shownOrder], // eslint-disable-line react-hooks/exhaustive-deps
|
|
398
|
+
);
|
|
399
|
+
useMembersMenu("equity-screener:watchlist", watchlistList);
|
|
400
|
+
// A watchlist's name typed for the symbol field reads as its symbols, as `fn EQS` reads it.
|
|
401
|
+
const watchlists = useAppSelector((state) => state.config.watchlists);
|
|
402
|
+
const tickers = useAppSelector((state) => state.tickers);
|
|
403
|
+
const readWatchlist = useCallback((typed: string) => {
|
|
404
|
+
const watchlist = findNamedCollection(watchlists, typed);
|
|
405
|
+
if (!watchlist) return null;
|
|
406
|
+
const members = screenSymbols([...tickers.values()]
|
|
407
|
+
.filter((ticker) => ticker.metadata.watchlists.includes(watchlist.id))
|
|
408
|
+
.map((ticker) => ticker.metadata.ticker));
|
|
409
|
+
return members.length ? readWatchlistArgument(typed, watchlist, members, MAX_SYMBOL_VALUES) : null;
|
|
410
|
+
}, [tickers, watchlists]);
|
|
411
|
+
// How a saved criterion read a watchlist's name stays on its row until the criterion changes.
|
|
412
|
+
const criterionRows = useMemo(
|
|
413
|
+
() => definition.criteria.map((criterion, index) => ({ id: String(index), criterion })),
|
|
414
|
+
[definition.criteria],
|
|
415
|
+
);
|
|
416
|
+
const criterionNotes = useRowNotes<(typeof criterionRows)[number], string>(criterionRows, {
|
|
417
|
+
key: criterionRowId,
|
|
418
|
+
signature: criterionSignature,
|
|
419
|
+
});
|
|
351
420
|
const selectedSaved =
|
|
352
421
|
saved.data?.find((row) => row.id === savedSelectedId) ?? saved.data?.[0];
|
|
353
422
|
useEffect(() => {
|
|
@@ -816,12 +885,14 @@ function EquityScreenView({
|
|
|
816
885
|
value={editingCriterion ?? null}
|
|
817
886
|
focused={focused}
|
|
818
887
|
width={width}
|
|
888
|
+
readWatchlist={readWatchlist}
|
|
819
889
|
onCancel={() => setEditing(null)}
|
|
820
|
-
onSave={(criterion) => {
|
|
890
|
+
onSave={(criterion, note) => {
|
|
821
891
|
const criteria = [...definition.criteria];
|
|
822
892
|
if (editing < 0) criteria.push(criterion);
|
|
823
893
|
else criteria[editing] = criterion;
|
|
824
894
|
apply({ ...definition, criteria });
|
|
895
|
+
criterionNotes.setNote(String(editing < 0 ? criteria.length - 1 : editing), note);
|
|
825
896
|
setEditing(null);
|
|
826
897
|
}}
|
|
827
898
|
/>
|
|
@@ -867,10 +938,7 @@ function EquityScreenView({
|
|
|
867
938
|
align: "left",
|
|
868
939
|
},
|
|
869
940
|
]}
|
|
870
|
-
items={
|
|
871
|
-
id: String(index),
|
|
872
|
-
criterion,
|
|
873
|
-
}))}
|
|
941
|
+
items={criterionRows}
|
|
874
942
|
focused={focused && editing === null && !saveForm}
|
|
875
943
|
rootWidth={width}
|
|
876
944
|
rootHeight={bodyHeight - 1}
|
|
@@ -882,7 +950,10 @@ function EquityScreenView({
|
|
|
882
950
|
onChange: setSelectedCriterion,
|
|
883
951
|
}}
|
|
884
952
|
onActivate={(row) => setEditing(Number(row.id))}
|
|
885
|
-
renderCell={(row) =>
|
|
953
|
+
renderCell={(row) => {
|
|
954
|
+
const note = criterionNotes.noteFor(row);
|
|
955
|
+
return { text: criterionText(row.criterion), ...(note ? { note } : {}) };
|
|
956
|
+
}}
|
|
886
957
|
sortColumnId={null}
|
|
887
958
|
sortDirection="asc"
|
|
888
959
|
emptyStateTitle="No criteria. All covered equities match."
|
|
@@ -910,7 +981,7 @@ function EquityScreenView({
|
|
|
910
981
|
onChange: setIdeaSelectedId,
|
|
911
982
|
}}
|
|
912
983
|
onActivate={(row) => {
|
|
913
|
-
setMetric(row
|
|
984
|
+
setMetric(ideaMetricSetting(row));
|
|
914
985
|
apply(row.definition);
|
|
915
986
|
setCurrentSavedId(null);
|
|
916
987
|
setMode("results");
|
|
@@ -1053,10 +1124,9 @@ function EquityScreenView({
|
|
|
1053
1124
|
: null;
|
|
1054
1125
|
if (field) {
|
|
1055
1126
|
const observation = row.metrics[field];
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
: undefined;
|
|
1127
|
+
// A move by its sign (one that prints 0.0 stays neutral), a grade by its side of the middle.
|
|
1128
|
+
const sign = screenSignValue(field, observation.value);
|
|
1129
|
+
const change = sign == null ? undefined : priceColor(sign, colors);
|
|
1060
1130
|
return {
|
|
1061
1131
|
text: formatScreenMetric(field, observation),
|
|
1062
1132
|
color: observation.state === "stale" ? colors.warning : change,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ScreenCheckPayload, ScreenCriterion, ScreenDefinition } from "../../../api-client/equity-screener";
|
|
1
|
+
import type { NumericField, ScreenCheckPayload, ScreenCriterion, ScreenDefinition } from "../../../api-client/equity-screener";
|
|
2
2
|
import { canonicalExchange, parsePublicTickerKey } from "../../../utils/exchanges";
|
|
3
|
-
import { criterionText, parseScreenDefinition, screenDefinitionKey, screenLabel } from "./model";
|
|
3
|
+
import { criterionText, formatScreenValue, GRADE_DISPLAY_FIELDS, parseScreenDefinition, screenDefinitionKey, screenLabel } from "./model";
|
|
4
4
|
|
|
5
5
|
/** One listing, with the same exchange aliases the rest of the app accepts. */
|
|
6
6
|
export function screenCheckTicker(text: string): { symbol: string; exchange?: string } {
|
|
@@ -64,7 +64,8 @@ export function validateScreenCheck(
|
|
|
64
64
|
|
|
65
65
|
const number = (value: number) => value.toLocaleString("en-US", { maximumSignificantDigits: 21 });
|
|
66
66
|
function checkCriterionText(criterion: ScreenCriterion): string {
|
|
67
|
-
|
|
67
|
+
// A grade compares letters (`Value grade >= B+`), and the composite reads as the screen writes it.
|
|
68
|
+
if (!("value" in criterion) || criterion.op === "in" || GRADE_DISPLAY_FIELDS.has(criterion.field)) return criterionText(criterion);
|
|
68
69
|
const operators = { gte: ">=", lte: "<=", gt: ">", lt: "<", eq: "=", between: "between" };
|
|
69
70
|
const threshold = Array.isArray(criterion.value) ? criterion.value.map(number).join(", ") : number(criterion.value);
|
|
70
71
|
return `${screenLabel(criterion.field)} ${operators[criterion.op]} ${threshold}`;
|
|
@@ -102,7 +103,9 @@ export function checkRows(data: ScreenCheckPayload) {
|
|
|
102
103
|
id: String(index),
|
|
103
104
|
criterion: checkCriterionText(entry.criterion),
|
|
104
105
|
value: entry.state === "not-covered" ? "Not covered" : entry.value === null ? "Missing" : typeof entry.value === "number"
|
|
105
|
-
?
|
|
106
|
+
? GRADE_DISPLAY_FIELDS.has(entry.criterion.field) ? formatScreenValue(entry.criterion.field as NumericField, entry.value)
|
|
107
|
+
: checkValueText(entry.value, entry.unit, entry.criterion)
|
|
108
|
+
: entry.value,
|
|
106
109
|
result: entry.passes === null ? "Not evaluated" : entry.passes ? "Pass" : "Fail",
|
|
107
110
|
asOf: entry.asOf?.slice(0, 10) ?? (entry.observedAt ? `${entry.observedAt.slice(0, 10)} (collected)` : "--"),
|
|
108
111
|
state: entry.state,
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ScreenDefinition, ScreenRow } from "../../../api-client/equity-screener";
|
|
2
|
+
import type { MemberList } from "../shared/members-menu";
|
|
3
|
+
import { SCREEN_IDEAS } from "./ideas";
|
|
4
|
+
import { screenDefinitionKey } from "./model";
|
|
5
|
+
|
|
6
|
+
/** What a screen is called: the idea it is, else the saved screen it was opened from, else EQS. */
|
|
7
|
+
function screenTitle(definition: ScreenDefinition, savedName?: string | null): string {
|
|
8
|
+
const key = screenDefinitionKey(definition);
|
|
9
|
+
return SCREEN_IDEAS.find((idea) => screenDefinitionKey(idea.definition) === key)?.name ?? (savedName?.trim() || "EQS");
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* A screen's matches as the shared watchlist menu takes them: the rows loaded, in
|
|
14
|
+
* the order shown, each listing with its exchange and quote currency, and how
|
|
15
|
+
* many match in all. A watchlist keeps at most the first 100 of them.
|
|
16
|
+
*/
|
|
17
|
+
export function screenWatchlistList(options: {
|
|
18
|
+
definition: ScreenDefinition;
|
|
19
|
+
rows: readonly Pick<ScreenRow, "symbol" | "name" | "exchange" | "currency">[];
|
|
20
|
+
matched: number;
|
|
21
|
+
savedName?: string | null;
|
|
22
|
+
}): MemberList | null {
|
|
23
|
+
if (!options.rows.length) return null;
|
|
24
|
+
const title = screenTitle(options.definition, options.savedName);
|
|
25
|
+
return {
|
|
26
|
+
title,
|
|
27
|
+
watchlistName: title === "EQS" ? "EQS screen" : title,
|
|
28
|
+
noun: "matches",
|
|
29
|
+
total: options.matched,
|
|
30
|
+
openIn: false,
|
|
31
|
+
members: options.rows.map((row) => ({ symbol: row.symbol, name: row.name, exchange: row.exchange, currency: row.currency })),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -2,13 +2,14 @@ import type { CloudExecutiveRowPayload } from "../../../api-client";
|
|
|
2
2
|
import { formatShortDate } from "../../../utils/datetime-format";
|
|
3
3
|
import { formatPercentRaw } from "../../../utils/format";
|
|
4
4
|
|
|
5
|
-
/** "$36.3M", "$282K", "$50,000". */
|
|
6
|
-
export function formatPay(value: number | null | undefined): string {
|
|
5
|
+
/** "$36.3M", "$282K", "$50,000"; a table column keeps the decimals (`fixedDecimals`), so $12.0M lines up under $36.3M. */
|
|
6
|
+
export function formatPay(value: number | null | undefined, { fixedDecimals = false }: { fixedDecimals?: boolean } = {}): string {
|
|
7
7
|
if (value === null || value === undefined || !Number.isFinite(value))
|
|
8
8
|
return "—";
|
|
9
9
|
const abs = Math.abs(value);
|
|
10
|
-
|
|
11
|
-
if (abs >=
|
|
10
|
+
const trim = (text: string, zeros: RegExp) => fixedDecimals ? text : text.replace(zeros, "");
|
|
11
|
+
if (abs >= 1e9) return `$${trim((value / 1e9).toFixed(2), /\.?0+$/)}B`;
|
|
12
|
+
if (abs >= 1e6) return `$${trim((value / 1e6).toFixed(1), /\.0$/)}M`;
|
|
12
13
|
if (abs >= 1e5) return `$${Math.round(value / 1e3)}K`;
|
|
13
14
|
return `$${Math.round(value).toLocaleString("en-US")}`;
|
|
14
15
|
}
|
|
@@ -116,7 +116,7 @@ function renderOfficerCell(row: CloudExecutiveRowPayload, column: OfficerColumn)
|
|
|
116
116
|
case "name": return { text: row.name, color: colors.textBright };
|
|
117
117
|
case "title": return { text: row.title.replace(/\s+/g, " ").trim(), color: colors.textDim };
|
|
118
118
|
case "equity": return { text: equityShare(row), color: colors.textDim };
|
|
119
|
-
case "total": return { text: formatPay(row.total), color: colors.text, attributes: TextAttributes.BOLD };
|
|
119
|
+
case "total": return { text: formatPay(row.total, { fixedDecimals: true }), color: colors.text, attributes: TextAttributes.BOLD };
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
|
|
@@ -111,6 +111,25 @@ export async function loadCurveSpot(symbol: string, provider: Pick<DataProvider,
|
|
|
111
111
|
return curveSpot(symbol, await provider.getQuote(symbol, "").catch(logFailure("futures-curve.client", "Load curve spot quote failed", null)), now);
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
/**
|
|
115
|
+
* A month of the spot index's daily closes, read through the same history path
|
|
116
|
+
* the charts use, which the front premium takes its settlement session's close
|
|
117
|
+
* from. A failed read has none: the curve stands, its premium saying why.
|
|
118
|
+
*/
|
|
119
|
+
export async function loadCurveSpotCloses(symbol: string,
|
|
120
|
+
provider: Pick<AssetDataProvider, "getPriceHistoryForResolutionWithMetadata" | "getPriceHistoryForResolution">, force = false): Promise<{ date: Date; close: number }[]> {
|
|
121
|
+
const context = force ? { cacheMode: "refresh" as const } : undefined;
|
|
122
|
+
try {
|
|
123
|
+
if (provider.getPriceHistoryForResolutionWithMetadata) {
|
|
124
|
+
const history = await provider.getPriceHistoryForResolutionWithMetadata(symbol, "", "1M", "1d", context);
|
|
125
|
+
return history.resolution && history.resolution !== "1d" ? [] : history.points;
|
|
126
|
+
}
|
|
127
|
+
return provider.getPriceHistoryForResolution ? await provider.getPriceHistoryForResolution(symbol, "", "1M", "1d", context) : [];
|
|
128
|
+
} catch (error) {
|
|
129
|
+
return logFailure("futures-curve.client", "Load curve spot closes failed", [] as { date: Date; close: number }[])(error);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
114
133
|
/** The last day of one-minute bars: the reach of a curve's trades a basis is read for, the far months' older ones aside. */
|
|
115
134
|
const SPOT_BAR_RANGE: TimeRange = "1D";
|
|
116
135
|
|
|
@@ -4,8 +4,8 @@ import type { HeadlessPaneColumn, HeadlessPaneDefinition, HeadlessPaneEntry, Hea
|
|
|
4
4
|
import { formatPercentRaw } from "../../../utils/format";
|
|
5
5
|
import { DATE_OPTION_EXAMPLES } from "../../../utils/calendar-date";
|
|
6
6
|
import { newestReportTime, oldestReportTime } from "../../../utils/utc-time";
|
|
7
|
-
import { fetchFuturesCurve, loadCurveSpot, loadCurveSpotBars, loadFuturesCurveAsOf } from "./client";
|
|
8
|
-
import { basisSpotSymbol, BASIS_CONVENTION, blankBasisNote, catalogueCurveUnit, curveAsOfDate, curveBasisPercent, curveBasisRows, curveChangeText, curveContractCode, curvePrice, curveRoundedPrice, curveSpotSource, curveSpreadLabel, curveTimestamp, curveNoTradeSince, curveUnitLabel, noTradeChangeNote, normalizeCurveRoot, shortDatedBasisNote, thinSpreadNotice, unpairedContractCount, unsupportedCurveRootMessage, type ContractBasis } from "./model";
|
|
7
|
+
import { fetchFuturesCurve, loadCurveSpot, loadCurveSpotBars, loadCurveSpotCloses, loadFuturesCurveAsOf } from "./client";
|
|
8
|
+
import { basisSpotSymbol, BASIS_CONVENTION, blankBasisNote, catalogueCurveUnit, curveAsOfDate, curveBasisPercent, curveBasisRows, curveChangeText, curveContractCode, curvePrice, curveReadsThirtySeconds, curveRoundedPrice, curveSpotSource, curveSpotPremium, curveSpreadLabel, curveTimestamp, curveNoTradeSince, curveUnitLabel, noTradeChangeNote, normalizeCurveRoot, shortDatedBasisNote, spotIndexSymbol, thinSpreadNotice, unpairedContractCount, unsupportedCurveRootMessage, type ContractBasis, type CurveSpotPremium } from "./model";
|
|
9
9
|
import { COMMODITIES_VIEW_STATE } from "../commodities-energy/view-state";
|
|
10
10
|
import { knownGapMessage } from "../../../cli/known-gaps";
|
|
11
11
|
|
|
@@ -91,6 +91,23 @@ const FRONT_SPREAD_FIELDS = ["label", "frontSymbol", "nextSymbol", "value", "ann
|
|
|
91
91
|
const GHOST_FIELDS = ["symbol", "expiration", "price", "asOf"];
|
|
92
92
|
/** The annualized roll yield reads as the percent it is (+32.36%); an export keeps the number. */
|
|
93
93
|
const ROLL_YIELD_FORMAT = { annualizedRollYield: (value: unknown) => typeof value === "number" ? formatPercentRaw(value) : "--" };
|
|
94
|
+
/** A Treasury root's prices read in 32nds in every section, as its contracts do; an export keeps the number. */
|
|
95
|
+
const thirtySecondsFormat = (root: string, key: string): Record<string, HeadlessPaneColumn["textFormat"]> => curveReadsThirtySeconds(root)
|
|
96
|
+
? { [key]: (value: unknown) => typeof value === "number" ? curvePrice(value, root) : "--" } : {};
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Spot against the front contract, both marks of the curve's settlement
|
|
100
|
+
* session: the index close and the front settlement's premium to it.
|
|
101
|
+
*/
|
|
102
|
+
function spotPremiumEntries(premium: CurveSpotPremium, root: string): HeadlessPaneEntry[] {
|
|
103
|
+
return [
|
|
104
|
+
{ key: "spot", label: premium.label, value: premium.close,
|
|
105
|
+
formatted: premium.close == null ? "--" : `${premium.close.toFixed(2)}${premium.date ? `, ${premium.date} close` : ""}` },
|
|
106
|
+
{ key: "frontPremium", label: "Front premium", value: premium.premium,
|
|
107
|
+
formatted: premium.premium == null ? "--"
|
|
108
|
+
: `${curveChangeText(premium.premium, root)}${premium.frontSymbol ? `, ${curveContractCode(premium.frontSymbol)} settle less spot` : ""}` },
|
|
109
|
+
];
|
|
110
|
+
}
|
|
94
111
|
|
|
95
112
|
/** What one contract is: the terms a hedge is sized on, once rather than on every row, worded as `ticker` words them. */
|
|
96
113
|
function specEntries(data: FuturesCurvePayload): HeadlessPaneEntry[] {
|
|
@@ -100,18 +117,33 @@ function specEntries(data: FuturesCurvePayload): HeadlessPaneEntry[] {
|
|
|
100
117
|
const unit = catalogueCurveUnit(data.root);
|
|
101
118
|
return unit ? [{ key: "unit", label: "Unit", value: unit }] : [];
|
|
102
119
|
}
|
|
103
|
-
return
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
120
|
+
return [
|
|
121
|
+
...futuresSpecLines(spec).map((line) => {
|
|
122
|
+
const value = spec[line.key as keyof typeof spec];
|
|
123
|
+
return { key: line.key, label: line.label, value, ...line.value === String(value) ? {} : { formatted: line.value } };
|
|
124
|
+
}),
|
|
125
|
+
...curveReadsThirtySeconds(data.root) ? [TREASURY_DV01_ENTRY] : [],
|
|
126
|
+
];
|
|
107
127
|
}
|
|
108
128
|
|
|
129
|
+
/**
|
|
130
|
+
* A Treasury contract's DV01 is its cheapest-to-deliver note's divided by
|
|
131
|
+
* that note's conversion factor. CME publishes the factors, but not where they
|
|
132
|
+
* can be read, so the terms say how to size it rather than print a figure.
|
|
133
|
+
*/
|
|
134
|
+
const TREASURY_DV01_ENTRY: HeadlessPaneEntry = {
|
|
135
|
+
key: "dv01", label: "DV01", value: null,
|
|
136
|
+
formatted: "not published here; price the cheapest-to-deliver in fn YAS and divide its DV01 by its CME conversion factor",
|
|
137
|
+
};
|
|
138
|
+
|
|
109
139
|
export const futuresCurveHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
110
140
|
discovery: { aliases: ["CTM"], dataRequirements: ["Gloom Cloud futures curve endpoint"],
|
|
111
141
|
limitations: ["Listed-contract catalogues can be incomplete.", "Ghosts and percentiles use the same listed contracts.", "Cboe VIX is daily settlement.",
|
|
112
142
|
"Ann Basis is simple actual/365, each last trade against spot in the same minute, and noisy under 7 days to expiry."],
|
|
113
|
-
intents: ["futures basis trade", "cash and carry", "basis against spot"]
|
|
114
|
-
|
|
143
|
+
intents: ["futures basis trade", "cash and carry", "basis against spot"],
|
|
144
|
+
opens: [{ words: ["VX", "vix futures", "vix futures curve"], argument: "VIX" }] },
|
|
145
|
+
shape: "bundle", argument: { kind: "free-text", optional: true, placeholder: "root", description: "FUT root such as CL, ES, ZN or VX, or a CME crypto root (BTC, ETH, SOL, XRP). Defaults to ES.",
|
|
146
|
+
examples: ["VIX", "CL", "BTC"] },
|
|
115
147
|
// Only the pane reads the tab; the report always carries both.
|
|
116
148
|
options: [{ key: "tab", description: "Curve or the full contract table.", type: "enum",
|
|
117
149
|
values: [{ value: "curve" }, { value: "contracts", aliases: ["contract", "table"] }], defaultValue: "curve",
|
|
@@ -129,13 +161,17 @@ export const futuresCurveHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
129
161
|
const date = curveAsOfDate(args.options.date, new Date(), "--date");
|
|
130
162
|
// The archive keeps no spot history, so a past curve has no basis.
|
|
131
163
|
const spotSymbol = date ? null : basisSpotSymbol(root);
|
|
164
|
+
// VX reads against spot VIX's daily closes instead.
|
|
165
|
+
const indexSymbol = date ? null : spotIndexSymbol(root);
|
|
132
166
|
const now = Date.now();
|
|
133
167
|
// The quote names the spot and its feed; the one-minute bars price each trade's own minute.
|
|
134
|
-
const [data, spot, bars] = await Promise.all([
|
|
168
|
+
const [data, spot, bars, closes] = await Promise.all([
|
|
135
169
|
date ? loadFuturesCurveAsOf(root, date, ctx.apiClient) : fetchFuturesCurve(root, ctx.apiClient),
|
|
136
170
|
spotSymbol ? loadCurveSpot(spotSymbol, ctx.marketData, now) : null,
|
|
137
171
|
spotSymbol ? loadCurveSpotBars(spotSymbol, ctx.marketData, ctx.refresh === true) : null,
|
|
172
|
+
indexSymbol ? loadCurveSpotCloses(indexSymbol, ctx.marketData, ctx.refresh === true) : null,
|
|
138
173
|
]);
|
|
174
|
+
const spotPremium = closes ? curveSpotPremium(data, closes) : null;
|
|
139
175
|
const bases = spot && bars ? curveBasisRows(data.contracts, bars) : null;
|
|
140
176
|
const unit = curveUnitLabel(data);
|
|
141
177
|
const terms = specEntries(data);
|
|
@@ -148,7 +184,8 @@ export const futuresCurveHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
148
184
|
// A blank Change says why, as a blank basis does; a past curve has no session change to blank.
|
|
149
185
|
const changeNote = date ? null : noTradeChangeNote(data.contracts, data);
|
|
150
186
|
const thinSpread = thinSpreadNotice(data);
|
|
151
|
-
const notes = [...thinSpread ? [`${thinSpread}.`] : [], ...changeNote ? [changeNote] : [], ...basisNotes
|
|
187
|
+
const notes = [...thinSpread ? [`${thinSpread}.`] : [], ...changeNote ? [changeNote] : [], ...basisNotes,
|
|
188
|
+
...spotPremium?.reason ? [`Front premium blank: ${spotPremium.reason}.`] : []];
|
|
152
189
|
const columnOptions = { basis: !!bases, last: data.source !== "cboe", notice: data.contracts.some((row) => row.firstNotice) };
|
|
153
190
|
// Dated by the contracts' own quotes; the same-contract history rows are a year of context, not observations.
|
|
154
191
|
const quoted = data.contracts.map((row) => row.asOf);
|
|
@@ -162,16 +199,18 @@ export const futuresCurveHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
162
199
|
{ title: "Contracts", columns: contractColumns(root, data.settlementDate ?? null, columnOptions),
|
|
163
200
|
...bases ? { textColumns: contractColumns(root, data.settlementDate ?? null, { ...columnOptions, text: true }) } : {},
|
|
164
201
|
rows: data.contracts.map((row) => contractRow(row, data, root, !!date, bases?.get(row.symbol))) },
|
|
165
|
-
{ title: "Front spread", columns: fieldColumns(FRONT_SPREAD_FIELDS, data.slope, ROLL_YIELD_FORMAT), rows: [{ label: curveSpreadLabel(data.slope), ...data.slope, value: curveRoundedPrice(data.slope.value, root),
|
|
202
|
+
{ title: "Front spread", columns: fieldColumns(FRONT_SPREAD_FIELDS, data.slope, { ...ROLL_YIELD_FORMAT, ...thirtySecondsFormat(root, "value") }), rows: [{ label: curveSpreadLabel(data.slope), ...data.slope, value: curveRoundedPrice(data.slope.value, root),
|
|
166
203
|
annualizedRollYield: data.slope.annualizedRollYield == null ? null : Number(data.slope.annualizedRollYield.toFixed(2)),
|
|
167
204
|
percentile: rank(data.slope.percentile), rollPercentile: rank(data.slope.rollPercentile) }] },
|
|
205
|
+
...spotPremium ? [{ title: "Front vs spot", entries: spotPremiumEntries(spotPremium, root) }] : [],
|
|
168
206
|
...terms.length ? [{ title: "Contract terms", entries: terms }] : [],
|
|
169
|
-
...data.ghosts.map((ghost) => ({ title: `${ghost.label} same-contract history`, columns: fieldColumns(GHOST_FIELDS, ghost.points[0] ?? {}),
|
|
207
|
+
...data.ghosts.map((ghost) => ({ title: `${ghost.label} same-contract history`, columns: fieldColumns(GHOST_FIELDS, ghost.points[0] ?? {}, thirtySecondsFormat(root, "price")),
|
|
170
208
|
rows: ghost.points.map((point) => ({ ...point })) })),
|
|
171
209
|
],
|
|
172
210
|
errors: data.gaps,
|
|
173
211
|
...(notes.length ? { notes } : {}),
|
|
174
|
-
metadata: { ...data, quoteUnit: unit, ...(spot && bases ? { spot, basisBlankedUnpaired: unpairedContractCount(bases.values()) } : {}),
|
|
212
|
+
metadata: { ...data, quoteUnit: unit, ...(spot && bases ? { spot, basisBlankedUnpaired: unpairedContractCount(bases.values()) } : {}),
|
|
213
|
+
...(spotPremium ? { spotPremium } : {}), ...(args.argument ? {} : { defaultArgument: DEFAULT_ROOT }),
|
|
175
214
|
...(notices.length ? { notices } : {}),
|
|
176
215
|
complete: data.status === "available", percentileBasis: "Same-contract observations within one year; actual sample start/end retained" },
|
|
177
216
|
};
|
|
@@ -17,7 +17,7 @@ export const futuresCurveModule: PluginModule = {
|
|
|
17
17
|
}],
|
|
18
18
|
paneTemplates: [{ id: "futures-curve-pane", paneId: "futures-curve", label: "Futures Curve",
|
|
19
19
|
description: `Listed futures contracts, historical curves, roll yield and open interest including VIX and CME crypto futures, which add basis against spot: Ann Basis = ${BASIS_FORMULA}, simple actual/365.`,
|
|
20
|
-
keywords: ["ctm", "futures", "curve", "term structure", "contango", "backwardation", "roll", "basis", "basis trade", "carry", "annualised basis", "vix", "crude oil", "natural gas"],
|
|
20
|
+
keywords: ["ctm", "futures", "curve", "term structure", "contango", "backwardation", "roll", "basis", "basis trade", "carry", "annualised basis", "vix", "crude oil", "natural gas", "treasury futures", "dv01", "hedge ratio", "steepener", "flattener"],
|
|
21
21
|
shortcut: { prefix: "CTM", aliases: ["CT"], argKind: "text", argPlaceholder: "root", argOptional: true,
|
|
22
22
|
argOptions: () => CURVE_ROOTS },
|
|
23
23
|
headless: futuresCurveHeadless,
|