@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
|
@@ -4,8 +4,10 @@ import { spanDigits } from "../../../components/chart-table";
|
|
|
4
4
|
import { compositeAxisTicks } from "../../../components/chart/composite/format";
|
|
5
5
|
import type { CompositeAxisDomain } from "../../../components/chart/composite/types";
|
|
6
6
|
import { FUTURES_CONTRACTS, futuresBoardContractForTicker, futuresContractByCode, tickDecimals } from "../../../market-data/futures-board";
|
|
7
|
+
import { futuresContractCode } from "../../../market-data/futures-contract";
|
|
7
8
|
import { contractMonthLabel } from "../../../utils/contract-month";
|
|
8
9
|
import { formatPercentileRank } from "../../../utils/format";
|
|
10
|
+
import { formatThirtySeconds } from "../../../market-data/market/format";
|
|
9
11
|
import { cryptoPairCoin, isFuturesSymbol } from "../shared/crypto-pair";
|
|
10
12
|
import { parseReportTime } from "../../../utils/utc-time";
|
|
11
13
|
import { zonedWallClockToUtcMs } from "../../../utils/zoned-date-time";
|
|
@@ -88,13 +90,17 @@ export function curveRootForTicker(ticker: unknown): string | null {
|
|
|
88
90
|
|
|
89
91
|
/**
|
|
90
92
|
* Treasury futures trade in fractions of a 32nd (ZT to 1/256, ZF 1/128, ZN
|
|
91
|
-
* 1/64, ZB and UB 1/32), so the catalogue leaves their tick unset.
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
* 103.51562500, never 103.50 next to 103.515625.
|
|
93
|
+
* 1/64, ZB and UB 1/32), so the catalogue leaves their tick unset. Their
|
|
94
|
+
* prices read in 32nds (106-20\u00bd); a report's numbers keep the decimals the
|
|
95
|
+
* tick needs to stay exact (ZT 8, ZN 6), never float noise.
|
|
95
96
|
*/
|
|
96
97
|
const RATE_TICKS: Readonly<Record<string, number>> = { ZT: 1 / 256, ZF: 1 / 128, ZN: 1 / 64, ZB: 1 / 32, UB: 1 / 32 };
|
|
97
98
|
|
|
99
|
+
/** Whether a root's prices read in 32nds of par (the Treasury futures), not decimals. */
|
|
100
|
+
export function curveReadsThirtySeconds(root: string): boolean {
|
|
101
|
+
return RATE_TICKS[root] != null;
|
|
102
|
+
}
|
|
103
|
+
|
|
98
104
|
function curvePriceDecimals(root: string): number {
|
|
99
105
|
const rateTick = RATE_TICKS[root];
|
|
100
106
|
if (rateTick != null) return tickDecimals(rateTick);
|
|
@@ -105,6 +111,8 @@ function curvePriceDecimals(root: string): number {
|
|
|
105
111
|
|
|
106
112
|
export function curvePrice(value: number | null, root: string): string {
|
|
107
113
|
if (value == null) return "--";
|
|
114
|
+
// A Treasury future reads in 32nds, as `quote` and FUT write it: 106-20\u00bd, never 106.640625.
|
|
115
|
+
if (RATE_TICKS[root] != null) return formatThirtySeconds(Math.abs(value) < 1e-9 ? 0 : value);
|
|
108
116
|
const text = value.toFixed(curvePriceDecimals(root));
|
|
109
117
|
// A spread that rounds to zero is unsigned: 0.00, never -0.00.
|
|
110
118
|
return /[1-9]/.test(text) ? text : text.replace("-", "");
|
|
@@ -136,7 +144,7 @@ export function curveUnitLabel(data: Pick<FuturesCurvePayload, "root" | "spec" |
|
|
|
136
144
|
|
|
137
145
|
/** A contract as traders write it: GCZ26.CMX is GCZ26; a VX symbol stays as Cboe lists it. */
|
|
138
146
|
export function curveContractCode(symbol: string): string {
|
|
139
|
-
return
|
|
147
|
+
return futuresContractCode({ contract: null, contractSymbol: symbol });
|
|
140
148
|
}
|
|
141
149
|
|
|
142
150
|
/**
|
|
@@ -184,13 +192,26 @@ export function thinSpreadNotice(data: Pick<FuturesCurvePayload, "slope" | "cont
|
|
|
184
192
|
return reason ? `${curveSpreadLabel(data.slope)} is thin (${reason}): no contango or backwardation call` : null;
|
|
185
193
|
}
|
|
186
194
|
|
|
195
|
+
/**
|
|
196
|
+
* The grid a Treasury root's chart axis ticks on, in points: its own fraction
|
|
197
|
+
* of a 32nd, no finer than a quarter (ZT and ZF quarter 32nds, ZN half, ZB and
|
|
198
|
+
* UB whole 32nds), so a tick reads 104-25½, never 104-25.60. Undefined for a
|
|
199
|
+
* root quoted in decimals, whose axis steps 1, 2, 5.
|
|
200
|
+
*/
|
|
201
|
+
export function curveAxisGrid(root: string): number | undefined {
|
|
202
|
+
const tick = RATE_TICKS[root];
|
|
203
|
+
return tick == null ? undefined : Math.max(tick, 1 / 128);
|
|
204
|
+
}
|
|
205
|
+
|
|
187
206
|
/**
|
|
188
207
|
* Axis gridlines sit on round values, so they need no tick precision: one
|
|
189
208
|
* decimal count across the gutter, as many as the plotted range asks for and
|
|
190
209
|
* enough to keep every tick within a percent of that range. A span of hundreds
|
|
191
|
-
* of index points reads 7800, a VIX strip 18.5
|
|
210
|
+
* of index points reads 7800, a VIX strip 18.5. A Treasury axis reads in 32nds,
|
|
211
|
+
* its ticks on the root's grid (`curveAxisGrid`).
|
|
192
212
|
*/
|
|
193
213
|
export function curveAxisPrice(value: number, domain: CompositeAxisDomain, root: string): string {
|
|
214
|
+
if (RATE_TICKS[root] != null) return formatThirtySeconds(value);
|
|
194
215
|
const cap = curvePriceDecimals(root);
|
|
195
216
|
const tolerance = Math.abs(domain.max - domain.min) / 100;
|
|
196
217
|
const needed = (tick: number) => {
|
|
@@ -407,6 +428,56 @@ export function spotBarsFromHistory(points: readonly { date: Date | string | num
|
|
|
407
428
|
return [...byMinute].sort((a, b) => a[0] - b[0]).map(([minute, price]) => ({ minute, price }));
|
|
408
429
|
}
|
|
409
430
|
|
|
431
|
+
/**
|
|
432
|
+
* The cash index a settlement-only root's front contract is read against: VX
|
|
433
|
+
* against spot VIX. A root missing here shows no spot.
|
|
434
|
+
*/
|
|
435
|
+
const SPOT_INDEX_SYMBOLS: ReadonlyMap<string, { symbol: string; label: string }> = new Map([
|
|
436
|
+
["VX", { symbol: "^VIX", label: "Spot VIX" }],
|
|
437
|
+
]);
|
|
438
|
+
|
|
439
|
+
export function spotIndexSymbol(root: string): string | null {
|
|
440
|
+
return SPOT_INDEX_SYMBOLS.get(root)?.symbol ?? null;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Spot against the front contract: the index's close on the curve's
|
|
445
|
+
* settlement session and the front settlement's premium to it, so both are
|
|
446
|
+
* marks of one session and a live index is never read against an older
|
|
447
|
+
* settlement. `reason` says why a figure is blank.
|
|
448
|
+
*/
|
|
449
|
+
export interface CurveSpotPremium {
|
|
450
|
+
symbol: string;
|
|
451
|
+
label: string;
|
|
452
|
+
close: number | null;
|
|
453
|
+
/** The session of `close`, the curve's settlement date. */
|
|
454
|
+
date: string | null;
|
|
455
|
+
frontSymbol: string | null;
|
|
456
|
+
/** The front settlement less `close`, at the root's precision. */
|
|
457
|
+
premium: number | null;
|
|
458
|
+
reason: string | null;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
/** The front contract's settlement less the index's close on the curve's settlement session. */
|
|
462
|
+
export function curveSpotPremium(data: Pick<FuturesCurvePayload, "root" | "contracts" | "slope" | "settlementDate">,
|
|
463
|
+
closes: readonly { date: Date | string | number; close: number }[]): CurveSpotPremium | null {
|
|
464
|
+
const index = SPOT_INDEX_SYMBOLS.get(data.root);
|
|
465
|
+
if (!index) return null;
|
|
466
|
+
const front = data.contracts.find((row) => row.symbol === data.slope.frontSymbol)
|
|
467
|
+
?? [...data.contracts].filter((row) => row.settlement != null).sort((a, b) => a.expiration.localeCompare(b.expiration))[0];
|
|
468
|
+
const date = data.settlementDate ?? null;
|
|
469
|
+
const bar = date ? closes.find((point) => {
|
|
470
|
+
const time = new Date(point.date).getTime();
|
|
471
|
+
return Number.isFinite(time) && new Date(time).toISOString().slice(0, 10) === date && positive(point.close);
|
|
472
|
+
}) : undefined;
|
|
473
|
+
const close = bar ? bar.close : null;
|
|
474
|
+
const settle = front ? front.settlement ?? front.price : null;
|
|
475
|
+
const premium = close != null && positive(settle) ? curveRoundedPrice(settle - close, data.root) : null;
|
|
476
|
+
const reason = !date ? "the curve has no settlement date" : close == null ? `no ${index.symbol} close on ${date}`
|
|
477
|
+
: premium == null ? "no front settlement" : null;
|
|
478
|
+
return { symbol: index.symbol, label: index.label, close, date, frontSymbol: front?.symbol ?? null, premium, reason };
|
|
479
|
+
}
|
|
480
|
+
|
|
410
481
|
/** The bar in `minute`, else the one nearest it; null when there are none. */
|
|
411
482
|
function nearestSpotBar(bars: readonly SpotBar[], minute: number): SpotBar | null {
|
|
412
483
|
let low = 0;
|
|
@@ -16,8 +16,8 @@ import { useAutoRefresh } from "../../../react/auto-refresh";
|
|
|
16
16
|
import { futuresSessionRefreshInterval } from "../shared/futures-session";
|
|
17
17
|
import { useResearchCloudSession } from "../shared/research-cloud-session";
|
|
18
18
|
import { useQuoteBoard } from "../shared/use-quote-board";
|
|
19
|
-
import { getCachedFuturesCurve, loadCurveSpotBars, loadFuturesCurve, loadFuturesCurveAsOf } from "./client";
|
|
20
|
-
import { BASIS_CONVENTION, basisSpotSymbol, blankBasisNote, curveAsOfDate, curveAxisPrice, curveBasisPercent, curveBasisRows, curveChangeText, curveContractChanges, curveContractCode, curvePrice, curveRank, curveSpot, curveSpotLabel, curveSpotSource, curveSpreadBasis, curveSpreadLabel, curveTimestamp, curveTitle, curveUnitLabel, DEFAULT_CURVE_HORIZON, futuresCurveSeries, newestQuote, noTradeChangeNote, normalizeCurveRoot, paneCurveRoot, shortDatedBasis, shortDatedBasisNote, sortCurveContracts, thinSpreadNotice, unsupportedCurveRootMessage, type CurveContractChanges, type CurveSpot } from "./model";
|
|
19
|
+
import { getCachedFuturesCurve, loadCurveSpotBars, loadCurveSpotCloses, loadFuturesCurve, loadFuturesCurveAsOf } from "./client";
|
|
20
|
+
import { BASIS_CONVENTION, basisSpotSymbol, blankBasisNote, curveAsOfDate, curveAxisGrid, curveAxisPrice, curveBasisPercent, curveBasisRows, curveChangeText, curveContractChanges, curveContractCode, curvePrice, curveRank, curveSpot, curveSpotLabel, curveSpotPremium, curveSpotSource, curveSpreadBasis, curveSpreadLabel, curveTimestamp, curveTitle, curveUnitLabel, DEFAULT_CURVE_HORIZON, futuresCurveSeries, newestQuote, noTradeChangeNote, normalizeCurveRoot, paneCurveRoot, shortDatedBasis, shortDatedBasisNote, sortCurveContracts, spotIndexSymbol, thinSpreadNotice, unsupportedCurveRootMessage, type CurveContractChanges, type CurveSpot } from "./model";
|
|
21
21
|
|
|
22
22
|
const TABS = [{ value: "curve", label: "Curve" }, { value: "contracts", label: "Contracts" }];
|
|
23
23
|
// One column order for every root. SETTLE is the exchange settlement for the
|
|
@@ -140,6 +140,12 @@ function FuturesCurveView({ width, height, focused, root, ownsTitle }: PaneProps
|
|
|
140
140
|
? (force: boolean) => loadCurveSpotBars(spotSymbol, assetData, force) : null,
|
|
141
141
|
[assetData, basisActive, spotSymbol, resource.updatedAt]);
|
|
142
142
|
const spotBars = useAsyncResource(barsLoader, { keepPreviousData: true });
|
|
143
|
+
// VX reads its front settlement against spot VIX's close on the same session, re-read whenever the curve is.
|
|
144
|
+
const indexSymbol = requestedDate ? null : spotIndexSymbol(root);
|
|
145
|
+
const closesLoader = useMemo(() => indexSymbol && assetData
|
|
146
|
+
? (force: boolean) => loadCurveSpotCloses(indexSymbol, assetData, force) : null,
|
|
147
|
+
[assetData, indexSymbol, resource.updatedAt]);
|
|
148
|
+
const spotCloses = useAsyncResource(closesLoader, { keepPreviousData: true });
|
|
143
149
|
// Until the first answer there is nothing to say: no reason, only blank cells.
|
|
144
150
|
const spot = useMemo(() => !basisActive || !spotSymbol || !spotState || spotState.loading && !spotState.quote ? null
|
|
145
151
|
: curveSpot(spotSymbol, spotState.quote, clock), [basisActive, clock, spotState, spotSymbol]);
|
|
@@ -171,6 +177,9 @@ function FuturesCurveView({ width, height, focused, root, ownsTitle }: PaneProps
|
|
|
171
177
|
const thin = data?.slope.state === "thin";
|
|
172
178
|
const spreadRank = data && !thin ? curveRank(data.slope.percentile, data.slope.samples) : null;
|
|
173
179
|
const thinSpread = data ? thinSpreadNotice(data) : null;
|
|
180
|
+
// Until the closes first answer there is nothing to say.
|
|
181
|
+
const spotPremium = useMemo(() => data && indexSymbol && spotCloses.data ? curveSpotPremium(data, spotCloses.data) : null,
|
|
182
|
+
[data, indexSymbol, spotCloses.data]);
|
|
174
183
|
const statItems: StatItem[] = data ? [
|
|
175
184
|
{ id: "roll", label: "Ann. roll yield", value: signedPercent(data.slope.annualizedRollYield),
|
|
176
185
|
...thin ? { tone: "warning" as const } : { detail: curveRank(data.slope.rollPercentile, data.slope.samples) } },
|
|
@@ -178,6 +187,13 @@ function FuturesCurveView({ width, height, focused, root, ownsTitle }: PaneProps
|
|
|
178
187
|
{ id: "spread", label: curveSpreadLabel(data.slope), value: data.slope.value == null ? "--" : curvePrice(data.slope.value, root),
|
|
179
188
|
...thin ? { tone: "warning" as const } : {},
|
|
180
189
|
detail: [data.slope.state, spreadBasis, spreadRank, slopeDate].filter(Boolean).join(" · ") },
|
|
190
|
+
...spotPremium ? [
|
|
191
|
+
{ id: "spot", label: spotPremium.label, value: spotPremium.close == null ? "--" : spotPremium.close.toFixed(2),
|
|
192
|
+
detail: spotPremium.date ? `${spotPremium.date.slice(5)} close` : undefined },
|
|
193
|
+
{ id: "premium", label: "Front premium", value: curveChangeText(spotPremium.premium, root),
|
|
194
|
+
...spotPremium.premium == null ? { tone: "warning" as const, detail: spotPremium.reason ?? undefined }
|
|
195
|
+
: { detail: spotPremium.frontSymbol ? `${curveContractCode(spotPremium.frontSymbol)} settle` : undefined } },
|
|
196
|
+
] : [],
|
|
181
197
|
...data.spec ? [{ id: "contract", label: "Contract", value: data.spec.size, detail: `tick ${futuresTickText(data.spec)}` }] : [],
|
|
182
198
|
] : [];
|
|
183
199
|
const { strip: tabStrip, rows: tabRows } = usePaneTabs({ tabs: TABS, activeValue: tab, onSelect: setTab, focused, dense: true, queryBarWidth: width });
|
|
@@ -260,7 +276,7 @@ function FuturesCurveView({ width, height, focused, root, ownsTitle }: PaneProps
|
|
|
260
276
|
const chart = strip ? {
|
|
261
277
|
render: (size: { width: number; height: number }) => <CurveSurface series={curves} width={size.width} height={size.height} display="chart"
|
|
262
278
|
caption={caption} xScale="linear" formatValue={formatValue} formatChange={formatChange}
|
|
263
|
-
formatAxisValue={(value, domain) => curveAxisPrice(value, domain, root)}
|
|
279
|
+
formatAxisValue={(value, domain) => curveAxisPrice(value, domain, root)} valueGrid={curveAxisGrid(root)}
|
|
264
280
|
selectedPointId={selectedId} onSelectedPointChange={setSelected} />,
|
|
265
281
|
minRows: curveSurfaceMinRows({ series: curves, width, caption }),
|
|
266
282
|
strip,
|
|
@@ -20,6 +20,9 @@ import { ShortcutTable, type ShortcutTableEntry } from "./shortcut-table";
|
|
|
20
20
|
import { resolveCommandShortcuts, resolveWindowTemplates } from "./shortcut-model";
|
|
21
21
|
import { badgeColumnWidth } from "./table-cells";
|
|
22
22
|
import { logFailure } from "../../../utils/log-failure";
|
|
23
|
+
import { VERSION } from "../../../version";
|
|
24
|
+
import { getCurrentPluginTarget } from "../../current-target";
|
|
25
|
+
import { openUrl } from "../../../components/ui/external-link";
|
|
23
26
|
|
|
24
27
|
const HELP_TABS = [
|
|
25
28
|
{ label: "Basics", value: "basics" },
|
|
@@ -32,6 +35,12 @@ const HELP_TABS = [
|
|
|
32
35
|
|
|
33
36
|
type HelpTabId = typeof HELP_TABS[number]["value"];
|
|
34
37
|
const GLOOMBERB_ISSUES_URL = "https://github.com/gloom-sh/gloomberb/issues";
|
|
38
|
+
/**
|
|
39
|
+
* Where the web app sends people who want the installed app. The route picks
|
|
40
|
+
* the installer for the visitor's OS, so one link serves every platform.
|
|
41
|
+
*/
|
|
42
|
+
const DESKTOP_DOWNLOAD_URL = "https://gloom.sh/download/desktop";
|
|
43
|
+
const DESKTOP_DOWNLOAD_DESCRIPTION = "Get Gloom for Mac or Windows";
|
|
35
44
|
|
|
36
45
|
function entry(id: string, badges: string[], description: string): ShortcutTableEntry {
|
|
37
46
|
return { id, badges, description };
|
|
@@ -133,6 +142,14 @@ function HelpPane({ focused, width, height }: PaneProps) {
|
|
|
133
142
|
void rendererHost.openExternal(GLOOMBERB_ISSUES_URL);
|
|
134
143
|
}, [rendererHost]);
|
|
135
144
|
|
|
145
|
+
const openChangelog = useCallback(() => {
|
|
146
|
+
createPaneFromTemplate("changelog-pane", { values: { version: VERSION } });
|
|
147
|
+
}, [createPaneFromTemplate]);
|
|
148
|
+
|
|
149
|
+
const openDesktopDownload = useCallback(() => {
|
|
150
|
+
void rendererHost.openExternal(DESKTOP_DOWNLOAD_URL);
|
|
151
|
+
}, [rendererHost]);
|
|
152
|
+
|
|
136
153
|
// Each tab's actions. `l` moves between tabs, so layout actions take `a`.
|
|
137
154
|
const tabHints = useMemo<PaneHint[]>(() => {
|
|
138
155
|
if (activeTabId === "basics") {
|
|
@@ -198,6 +215,29 @@ function HelpPane({ focused, width, height }: PaneProps) {
|
|
|
198
215
|
].filter((item) => hasCode(item.badges[0]!)),
|
|
199
216
|
}], [hasCode]);
|
|
200
217
|
|
|
218
|
+
// The app's version and, in the browser, the installed app: kept out of the
|
|
219
|
+
// status bar, which holds only what a new visitor needs.
|
|
220
|
+
const aboutRows = useMemo(() => [
|
|
221
|
+
...(hasCode("CHG")
|
|
222
|
+
? [{ ...entry("about-changelog", ["CHG"], tf("What's new in v{version}", { version: VERSION })), run: openChangelog }]
|
|
223
|
+
: []),
|
|
224
|
+
...(getCurrentPluginTarget() === "web"
|
|
225
|
+
? [{ ...entry("about-desktop", [], t(DESKTOP_DOWNLOAD_DESCRIPTION)), run: openDesktopDownload }]
|
|
226
|
+
: []),
|
|
227
|
+
], [hasCode, openChangelog, openDesktopDownload]);
|
|
228
|
+
const aboutSections = useMemo<Array<TableSection<ShortcutTableEntry>>>(
|
|
229
|
+
() => aboutRows.length > 0 ? [{ label: "About", items: aboutRows }] : [],
|
|
230
|
+
[aboutRows],
|
|
231
|
+
);
|
|
232
|
+
// The keyboard reaches them from the pane menu, as it does Try These.
|
|
233
|
+
usePaneMenuItems("help:about", () => activeTabId === "basics"
|
|
234
|
+
? aboutRows.map((row) => ({
|
|
235
|
+
id: row.id,
|
|
236
|
+
label: row.id === "about-desktop" ? t("Download desktop app") : `${row.description} (CHG)`,
|
|
237
|
+
onSelect: row.run,
|
|
238
|
+
}))
|
|
239
|
+
: null, [activeTabId, aboutRows]);
|
|
240
|
+
|
|
201
241
|
const referenceSections = useMemo<Array<TableSection<ShortcutTableEntry>>>(() => [
|
|
202
242
|
{
|
|
203
243
|
label: "Command Bar",
|
|
@@ -371,7 +411,7 @@ function HelpPane({ focused, width, height }: PaneProps) {
|
|
|
371
411
|
</Text>
|
|
372
412
|
|
|
373
413
|
<Box marginTop={1}>
|
|
374
|
-
<ShortcutTable sections={startSections} width={bodyWidth} keyWidth={keyColumnWidth} />
|
|
414
|
+
<ShortcutTable sections={[...startSections, ...aboutSections]} width={bodyWidth} keyWidth={keyColumnWidth} />
|
|
375
415
|
</Box>
|
|
376
416
|
</>
|
|
377
417
|
);
|
|
@@ -420,6 +460,20 @@ function HelpPane({ focused, width, height }: PaneProps) {
|
|
|
420
460
|
}
|
|
421
461
|
|
|
422
462
|
export const helpModule: PluginModule = {
|
|
463
|
+
setup(ctx) {
|
|
464
|
+
// The browser's way to the installed app; the desktop app and the terminal are installed already.
|
|
465
|
+
ctx.registerCommand({
|
|
466
|
+
id: "download-desktop-app",
|
|
467
|
+
label: "Download Desktop App",
|
|
468
|
+
description: DESKTOP_DOWNLOAD_DESCRIPTION,
|
|
469
|
+
keywords: ["desktop", "download", "install", "app", "mac", "macos", "windows"],
|
|
470
|
+
category: "config",
|
|
471
|
+
hidden: () => getCurrentPluginTarget() !== "web",
|
|
472
|
+
execute: () => {
|
|
473
|
+
openUrl(DESKTOP_DOWNLOAD_URL);
|
|
474
|
+
},
|
|
475
|
+
});
|
|
476
|
+
},
|
|
423
477
|
panes: [
|
|
424
478
|
{
|
|
425
479
|
id: "help",
|
|
@@ -118,7 +118,26 @@ export interface InsiderSummaryFigures {
|
|
|
118
118
|
incomplete: boolean;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
/**
|
|
121
|
+
/** Words a filer adds or leaves out without naming another class: "Common Stock" and "Common" are one. */
|
|
122
|
+
const SECURITY_FILLER_WORDS = new Set(["stock", "stocks", "share", "shares"]);
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* One key for every spelling filers give the same class of security: "Common
|
|
126
|
+
* Stock", "Common", "COMMON STOCK, $0.001 PAR VALUE" and "Common Stock, par
|
|
127
|
+
* value $.01 per share" are one class, and so are "Class A Common Stock" and
|
|
128
|
+
* "Common Stock, Class A". Class A and Class B, common and preferred, Series A
|
|
129
|
+
* and Series B stay apart.
|
|
130
|
+
*/
|
|
131
|
+
export function securityClassKey(title: string): string {
|
|
132
|
+
const words = title.toLowerCase()
|
|
133
|
+
// A par or nominal value tail names the same shares: ", par value $0.0001 per share", "$.01 par value".
|
|
134
|
+
.replace(/(?:[$€£]?\s*\d*\.?\d+\s*)?\b(?:par(?:\s+value)?|nominal\s+value|stated\s+value)\b.*$/, " ")
|
|
135
|
+
.split(/[^a-z0-9]+/)
|
|
136
|
+
.filter((word) => word && !SECURITY_FILLER_WORDS.has(word));
|
|
137
|
+
return words.length ? [...new Set(words)].sort().join(" ") : title.trim().toLowerCase();
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** Totals of the loaded non-derivative buys and sales in the last 90 days, by class of security and side. */
|
|
122
141
|
export function buildInsiderSummaryFigures(parsed: readonly ParsedInsiderFiling[], now = Date.now(), context: readonly ParsedInsiderFiling[] = parsed): InsiderSummaryFigures | null {
|
|
123
142
|
if (parsed.some(({ isLoading }) => isLoading)) return null;
|
|
124
143
|
const amendments = buildInsiderAmendmentScopes(context);
|
|
@@ -129,6 +148,8 @@ export function buildInsiderSummaryFigures(parsed: readonly ParsedInsiderFiling[
|
|
|
129
148
|
});
|
|
130
149
|
const cutoff = now - NINETY_DAYS_MS;
|
|
131
150
|
const totals = new Map<string, InsiderSideTotal>();
|
|
151
|
+
// Shares under each spelling of a class, so a total is named the way most of its shares were filed.
|
|
152
|
+
const spellings = new Map<string, Map<string, number>>();
|
|
132
153
|
for (const entry of parsed) {
|
|
133
154
|
const { transaction } = entry;
|
|
134
155
|
if (!transaction || transaction.isDerivative || transaction.shares == null || !transaction.securityTitle) continue;
|
|
@@ -136,13 +157,20 @@ export function buildInsiderSummaryFigures(parsed: readonly ParsedInsiderFiling[
|
|
|
136
157
|
if (date == null || !Number.isFinite(date) || date < cutoff || date > now) continue;
|
|
137
158
|
if (transaction.transactionType !== "P" && transaction.transactionType !== "S") continue;
|
|
138
159
|
const security = transaction.securityTitle;
|
|
139
|
-
const key = `${security}:${transaction.transactionType}`;
|
|
160
|
+
const key = `${securityClassKey(security)}:${transaction.transactionType}`;
|
|
140
161
|
const total = totals.get(key) ?? { security, side: transaction.transactionType, shares: 0, value: 0, knownValue: true, unreconciled: false };
|
|
141
162
|
total.unreconciled ||= affectingInsiderAmendments(entry, amendments).length > 0;
|
|
142
163
|
total.shares += transaction.shares;
|
|
143
164
|
total.knownValue &&= transaction.totalValue != null;
|
|
144
165
|
total.value += transaction.totalValue ?? 0;
|
|
145
166
|
totals.set(key, total);
|
|
167
|
+
const filed = spellings.get(key) ?? new Map<string, number>();
|
|
168
|
+
filed.set(security, (filed.get(security) ?? 0) + transaction.shares);
|
|
169
|
+
spellings.set(key, filed);
|
|
170
|
+
}
|
|
171
|
+
for (const [key, total] of totals) {
|
|
172
|
+
const filed = [...spellings.get(key)!];
|
|
173
|
+
total.security = filed.reduce((best, entry) => (entry[1] > best[1] ? entry : best), filed[0]!)[0];
|
|
146
174
|
}
|
|
147
175
|
return { totals: [...totals.values()], incomplete };
|
|
148
176
|
}
|
|
@@ -266,10 +266,10 @@ export function buildMoverRows(movers: readonly CloudJobsMoverPayload[]): MoverR
|
|
|
266
266
|
mover,
|
|
267
267
|
ticker: mover.ticker,
|
|
268
268
|
company: mover.companyName ?? "",
|
|
269
|
-
open: formatCompact(mover.openCount),
|
|
269
|
+
open: formatCompact(mover.openCount, { fixedDecimals: true }),
|
|
270
270
|
change: mover.change30d ? formatChange(mover.change30d) : "",
|
|
271
271
|
changeValue: mover.change30d?.percent ?? mover.change30d?.count ?? null,
|
|
272
|
-
posted30d: mover.posted30d != null ? formatCompact(mover.posted30d) : "",
|
|
272
|
+
posted30d: mover.posted30d != null ? formatCompact(mover.posted30d, { fixedDecimals: true }) : "",
|
|
273
273
|
posted30dValue: mover.posted30d ?? null,
|
|
274
274
|
new7d: mover.new7d > 0 ? String(mover.new7d) : "",
|
|
275
275
|
function: functionLabel(mover.topFunction),
|
|
@@ -76,6 +76,47 @@ export async function loadMacroDayHistory(
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
/** A FRED series read as closes: its daily values, and whether a value is a rate, whose moves read in bp. */
|
|
80
|
+
export interface MacroDaySeriesHistory extends MacroDayHistory {
|
|
81
|
+
/** The series is in percent (a yield or a spread such as T10Y2Y): a move is the change in its level. */
|
|
82
|
+
rate: boolean;
|
|
83
|
+
/** FRED's title for it, "10-Year Treasury Constant Maturity Minus 2-Year Treasury Constant Maturity". */
|
|
84
|
+
title: string | null;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** The five years of daily values a release-day study reads, as the price history is. */
|
|
88
|
+
const SERIES_LOOKBACK_DAYS = 5 * 366;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* A FRED series (`FRED:T10Y2Y`) as the study's closes: each dated value, with
|
|
92
|
+
* blank days (holidays FRED lists as no value) left out. A rate or spread in
|
|
93
|
+
* percent moves by its level, read in basis points; any other series by its
|
|
94
|
+
* return. Never rejects but on cancel.
|
|
95
|
+
*/
|
|
96
|
+
export async function loadMacroDaySeriesHistory(
|
|
97
|
+
request: { seriesId: string; signal?: AbortSignal },
|
|
98
|
+
client: Pick<typeof apiClient, "getCloudFredSeries"> = apiClient,
|
|
99
|
+
now = Date.now(),
|
|
100
|
+
): Promise<MacroDaySeriesHistory> {
|
|
101
|
+
if (request.signal?.aborted) throw abortError(CANCELLED);
|
|
102
|
+
const startDate = new Date(now - SERIES_LOOKBACK_DAYS * 86_400_000).toISOString().slice(0, 10);
|
|
103
|
+
try {
|
|
104
|
+
const payload = await abortable(client.getCloudFredSeries(request.seriesId, { startDate, sortOrder: "asc" },
|
|
105
|
+
request.signal ? { signal: request.signal } : {}), request.signal, CANCELLED);
|
|
106
|
+
const history = payload.observations
|
|
107
|
+
.filter((point) => typeof point.value === "number" && Number.isFinite(point.value) && /^\d{4}-\d{2}-\d{2}$/.test(point.date))
|
|
108
|
+
.map((point) => ({ date: new Date(`${point.date}T00:00:00Z`), close: point.value! }))
|
|
109
|
+
.sort((left, right) => left.date.getTime() - right.date.getTime());
|
|
110
|
+
const fetchedAt = payload.fetchedAt ? Date.parse(payload.fetchedAt) : now;
|
|
111
|
+
return { history, stale: payload.stale === true, error: history.length ? null : `No values for FRED:${request.seriesId}`,
|
|
112
|
+
fetchedAt: Number.isFinite(fetchedAt) ? fetchedAt : now,
|
|
113
|
+
rate: /^percent\b/i.test(payload.info?.units?.trim() ?? ""), title: payload.info?.title?.trim() || null };
|
|
114
|
+
} catch (error) {
|
|
115
|
+
if (request.signal?.aborted || (error instanceof Error && error.name === "AbortError")) throw abortError(CANCELLED);
|
|
116
|
+
return { history: [], stale: false, error: errorMessage(error), fetchedAt: now, rate: false, title: null };
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
79
120
|
export interface MacroDayEarnings {
|
|
80
121
|
reports: MacroDayEarningsReport[];
|
|
81
122
|
stale: boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { HeadlessPaneDefinition } from "../../../types/plugin";
|
|
2
2
|
import { resolveHeadlessInstrument } from "../shared/headless-market-data";
|
|
3
|
-
import { loadMacroDayEarnings, loadMacroDayHistory, loadMacroReleases, macroDayEarningsNotice } from "./client";
|
|
3
|
+
import { loadMacroDayEarnings, loadMacroDayHistory, loadMacroDaySeriesHistory, loadMacroReleases, macroDayEarningsNotice, type MacroDayEarnings } from "./client";
|
|
4
|
+
import { fredSeriesArgument } from "../../../series/fred-argument";
|
|
4
5
|
import { formatMacroDayMove, macroDayEventLabel, macroDayStats, matchesSurprise, projectMacroDays, type MacroDayStats } from "./model";
|
|
5
6
|
import { MACRO_EVENT_KINDS, MACRO_EVENT_LABELS, MACRO_RELEASE_SOURCES, MACRO_SURPRISE_LABELS, MACRO_SURPRISES, staleMacroReleasesNotice,
|
|
6
7
|
type MacroEventKind, type MacroSurprise } from "./releases";
|
|
@@ -11,13 +12,15 @@ const multiple = (value: unknown) => typeof value === "number" ? `${value.toFixe
|
|
|
11
12
|
const share = (value: unknown) => typeof value === "number" ? `${Math.round(value * 100)}%` : "--";
|
|
12
13
|
|
|
13
14
|
export const macroDayHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
14
|
-
shape: "bundle", argument: { kind: "ticker", description: "Ticker" },
|
|
15
|
+
shape: "bundle", argument: { kind: "ticker", description: "Ticker, or a FRED series such as FRED:T10Y2Y", examples: ["TLT", "FRED:T10Y2Y"] },
|
|
15
16
|
usListingsOnly: "Macro release day data",
|
|
17
|
+
// A spread the catalog prints (FRED:T10Y2Y) moves on release days too: its moves in bp.
|
|
18
|
+
fredSeriesArgument: true,
|
|
16
19
|
// Dated by the release list (releasesThrough) as much as by the closes, so no session schedule applies.
|
|
17
20
|
freshness: { status: "not-a-feed", basis: "release-day study on daily closes" },
|
|
18
21
|
describe: (args) => `MDAY ${args.symbols[0] ?? ""}`,
|
|
19
22
|
discovery: { screenshotReadiness: "live-dom", limitations: [
|
|
20
|
-
"US listings; close-to-close on the release day.",
|
|
23
|
+
"US listings, or a FRED series (FRED:T10Y2Y, whose moves in a rate or spread read in bp); close-to-close on the release day.",
|
|
21
24
|
"Published CPI, jobs and FOMC days, and Brazil's IPCA days from Gloom Cloud; sessions after the list's last covered day (releasesThrough) are left out.",
|
|
22
25
|
"Actual, forecast and prior for the days Gloom Cloud has them (the US headlines from its kept economic calendar, IPCA from the central bank's SGS series); --surprise keeps the days that came in hot, cool or in line with the forecast.",
|
|
23
26
|
"A release day that is also the reaction session of the company's own earnings report is marked earnings and left out of the release averages and the normal day.",
|
|
@@ -31,11 +34,18 @@ export const macroDayHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
31
34
|
{ key: "lookbackYears", type: "integer", minimum: 1, maximum: 5, defaultValue: 5, description: "Years of daily closes" },
|
|
32
35
|
],
|
|
33
36
|
async load(args, ctx) {
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
+
// FRED:T10Y2Y is a series, read from FRED: it has no earnings, and a rate or spread moves by its level.
|
|
38
|
+
const seriesId = fredSeriesArgument(args.symbols[0]!);
|
|
39
|
+
const instrument = seriesId ? null : await resolveHeadlessInstrument(ctx, args.symbols[0]!);
|
|
40
|
+
const symbol = instrument?.symbol ?? `FRED:${seriesId}`;
|
|
41
|
+
const [history, releases, earnings] = await Promise.all([
|
|
42
|
+
instrument ? loadMacroDayHistory({ instrument, signal: ctx.signal }, ctx.marketData) : loadMacroDaySeriesHistory({ seriesId: seriesId!, signal: ctx.signal }, ctx.apiClient),
|
|
43
|
+
loadMacroReleases(),
|
|
44
|
+
instrument ? loadMacroDayEarnings({ instrument, signal: ctx.signal }) : Promise.resolve<MacroDayEarnings>({ reports: [], stale: false, error: null }),
|
|
45
|
+
]);
|
|
46
|
+
const basis = "rate" in history ? history.rate ? "yield" as const : "return" as const : undefined;
|
|
37
47
|
ctx.signal.throwIfAborted();
|
|
38
|
-
const model = projectMacroDays(history.history, { symbol
|
|
48
|
+
const model = projectMacroDays(history.history, { symbol, basis, lookbackYears: Number(args.options.lookbackYears) || 5,
|
|
39
49
|
releases: releases.releases, coveredThrough: releases.coveredThrough, earnings: earnings.reports });
|
|
40
50
|
const notes = [staleMacroReleasesNotice(releases), macroDayEarningsNotice(earnings)].filter((note): note is string => !!note);
|
|
41
51
|
const row = (label: string, stats: MacroDayStats) => ({ label, ...stats });
|
|
@@ -67,10 +77,10 @@ export const macroDayHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
67
77
|
...(figures ? { headline: figures.event } : {}) })) },
|
|
68
78
|
],
|
|
69
79
|
complete: !history.stale && !earnings.stale && !history.error && !notes.length && model.events.length > 0,
|
|
70
|
-
unavailableSymbols: model.events.length ? [] : [
|
|
80
|
+
unavailableSymbols: model.events.length ? [] : [symbol],
|
|
71
81
|
errors: history.error ? [history.error] : [],
|
|
72
82
|
...(notes.length ? { notes } : {}),
|
|
73
|
-
metadata: { unit: yieldMoves ?
|
|
83
|
+
metadata: { unit: yieldMoves ? `change in the ${seriesId ? "rate" : "yield"} in percentage points, close to close on the release day`
|
|
74
84
|
: "decimal return, close to close on the release day", start: model.start, asOf: model.asOf,
|
|
75
85
|
releasesThrough: releases.coveredThrough, releaseSources: Object.values(MACRO_RELEASE_SOURCES),
|
|
76
86
|
stale: history.stale || earnings.stale, fetchedAt: history.fetchedAt, methodology: "docs/research-data.md#macro-day-reaction" },
|
|
@@ -164,6 +164,8 @@ const US_KINDS: ReadonlySet<MacroEventKind> = new Set(US_MACRO_EVENT_KINDS);
|
|
|
164
164
|
*/
|
|
165
165
|
export function projectMacroDays(history: readonly PricePoint[], options: {
|
|
166
166
|
symbol: string;
|
|
167
|
+
/** How a move is measured when the symbol does not say: a FRED rate or spread moves by its level, in bp. */
|
|
168
|
+
basis?: MacroDayMoveBasis;
|
|
167
169
|
lookbackYears: number;
|
|
168
170
|
releases: readonly MacroRelease[];
|
|
169
171
|
/** The release list's last covered day. */
|
|
@@ -172,7 +174,7 @@ export function projectMacroDays(history: readonly PricePoint[], options: {
|
|
|
172
174
|
earnings?: readonly MacroDayEarningsReport[];
|
|
173
175
|
}): MacroDayModel {
|
|
174
176
|
const { coveredThrough } = options;
|
|
175
|
-
const basis = macroDayMoveBasis(options.symbol);
|
|
177
|
+
const basis = options.basis ?? macroDayMoveBasis(options.symbol);
|
|
176
178
|
const byDate = new Map<string, number>();
|
|
177
179
|
for (const point of history) {
|
|
178
180
|
const time = new Date(point.date).getTime();
|
|
@@ -114,12 +114,13 @@ function MarketMoversPane({ focused, width, height }: PaneProps) {
|
|
|
114
114
|
.filter((quote): quote is MarketSummaryQuote => !!quote)
|
|
115
115
|
), [summaryBoard, summarySymbols]);
|
|
116
116
|
|
|
117
|
-
|
|
118
|
-
const
|
|
117
|
+
// Kept between quotes, so the tab strip skips the renders a board update gives the pane.
|
|
118
|
+
const tabItems = useMemo(() => tabs.map((tab) => ({ label: tab.label, value: tab.id })), [tabs]);
|
|
119
|
+
const selectTab = useCallback((value: string) => {
|
|
119
120
|
setSavedTab(value as TabId);
|
|
120
121
|
setPickedIn(session.key);
|
|
121
122
|
if (requestedTab) setRequestedTab(null);
|
|
122
|
-
};
|
|
123
|
+
}, [requestedTab, session.key, setPickedIn, setRequestedTab, setSavedTab]);
|
|
123
124
|
const { strip: tabStrip } = usePaneTabs({ tabs: tabItems, activeValue: activeTab, onSelect: selectTab, focused, compact: true, variant: "bare" });
|
|
124
125
|
|
|
125
126
|
return (
|
|
@@ -146,6 +146,7 @@ export const distressHeadless: HeadlessPaneDefinition<"rows"> = {
|
|
|
146
146
|
argument: { kind: "none" },
|
|
147
147
|
discovery: {
|
|
148
148
|
aliases: ["DIST"],
|
|
149
|
+
intents: ["distressed exchange", "chapter 11", "bankruptcy", "missed payment", "forbearance", "going concern", "covenant waiver", "delisting notice"],
|
|
149
150
|
dataRequirements: ["Public SEC EDGAR filings and financial statement notes, TWSE and TPEx open data, BODACC and The Gazette notices"],
|
|
150
151
|
limitations: [
|
|
151
152
|
"A company missing from a list may still be in difficulty; absence is not a finding.",
|
|
@@ -21,10 +21,10 @@ export function formatPerShare(amount: number, currency: string | null, maxDigit
|
|
|
21
21
|
return sign ? `${sign}${fixed}` : `${code} ${fixed}`;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
/** A headline amount: "$1.8B", "€420M", "GBP 1.2B". */
|
|
24
|
+
/** A headline amount: "$1.8B", "€420M", "GBP 1.2B"; "$1.80B" in a table column. */
|
|
25
25
|
export function formatDealValue(value: number | null, currency: string | null): string {
|
|
26
26
|
if (value == null || !Number.isFinite(value) || value <= 0) return MISSING;
|
|
27
|
-
const compact = formatCompact(value
|
|
27
|
+
const compact = formatCompact(value);
|
|
28
28
|
const code = currency?.trim().toUpperCase() ?? "";
|
|
29
29
|
if (!code) return compact;
|
|
30
30
|
const sign = CURRENCY_SIGNS[code];
|
|
@@ -5,6 +5,8 @@ export interface QuickNoteEntry {
|
|
|
5
5
|
id: string;
|
|
6
6
|
title: string;
|
|
7
7
|
updatedAt?: number;
|
|
8
|
+
/** Who wrote a cloud note, when the server says; never saved to disk. */
|
|
9
|
+
createdBy?: string | null;
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
/** A stored note: `key` is what `load`/`save` take, not the file path. */
|
|
@@ -6,7 +6,7 @@ import { QueryBar } from "../../../components/ui/query-bar";
|
|
|
6
6
|
import { Box } from "../../../ui";
|
|
7
7
|
import type { DialogApi, PromptContext } from "../../../ui/dialog";
|
|
8
8
|
import { colors } from "../../../theme/colors";
|
|
9
|
-
import { teamAccentHex, teamPrefix } from "../../../team/model";
|
|
9
|
+
import { canManageTeam, teamAccentHex, teamPrefix } from "../../../team/model";
|
|
10
10
|
import { teamStore } from "../../../team/store";
|
|
11
11
|
import { logFailure } from "../../../utils/log-failure";
|
|
12
12
|
import { NoteConflictError, type NoteOwner, noteOwnerKey } from "./store";
|
|
@@ -18,6 +18,25 @@ export function useNoteTeams(): TeamSummary[] {
|
|
|
18
18
|
).teams;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Whether the server lets me delete a note: any of mine, and a team note I
|
|
23
|
+
* wrote or whose team I run. A team note without an author is one I just
|
|
24
|
+
* added, or one from a server that lets any member delete.
|
|
25
|
+
*/
|
|
26
|
+
export function mayDeleteNote(
|
|
27
|
+
note: { owner: NoteOwner; createdBy?: string | null },
|
|
28
|
+
teams: readonly TeamSummary[],
|
|
29
|
+
selfUserId: string | null,
|
|
30
|
+
): boolean {
|
|
31
|
+
const { owner } = note;
|
|
32
|
+
if (owner.kind === "user" || note.createdBy === undefined) return true;
|
|
33
|
+
if (selfUserId !== null && note.createdBy === selfUserId) return true;
|
|
34
|
+
return canManageTeam(teams.find((team) => team.id === owner.teamId)?.role);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Why a teammate's note offers no delete. */
|
|
38
|
+
export const NOT_YOUR_NOTE = "Only its author or a team admin can delete this note.";
|
|
39
|
+
|
|
21
40
|
/** The owner a new note defaults to: the focused team, else me. */
|
|
22
41
|
export function defaultNoteOwner(): NoteOwner {
|
|
23
42
|
const teamId = teamStore.getDefaultTeamId();
|