gloomberb 0.20.4 → 0.20.6
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/README.md +3 -1
- package/README.zh-CN.md +1 -1
- package/bin/gloom +9 -0
- package/bin/without-bun.cjs +98 -0
- package/package.json +4 -1
- package/src/api-client/data.ts +148 -37
- package/src/api-client/hk-tenders.ts +59 -0
- package/src/api-client/index.ts +1 -0
- package/src/api-client/types/econ.ts +30 -0
- package/src/api-client/yield-curves.ts +1 -1
- package/src/app/global-shortcuts.ts +4 -1
- package/src/app/keybindings/actions.ts +6 -0
- package/src/app/keybindings/config.ts +2 -1
- package/src/app/keybindings/index.ts +1 -0
- package/src/app/keybindings/labels.ts +6 -1
- package/src/app/keybindings/resolve.ts +23 -4
- package/src/app/keybindings/terminal-keys.ts +35 -0
- package/src/app/pane-runtime/index.tsx +2 -2
- package/src/app/pane-runtime/ticker-open-runtime.ts +68 -40
- package/src/app.tsx +18 -13
- package/src/architecture/floating-promise-allowlist.json +313 -0
- package/src/architecture/ui-literals-allowlist.json +1 -1
- package/src/capabilities/chart-series.ts +27 -1
- package/src/cli/commands/keybindings.ts +5 -5
- package/src/cli/commands/market.ts +238 -57
- package/src/cli/commands/news-search.ts +81 -14
- package/src/cli/commands/overview.ts +27 -6
- package/src/cli/commands/remote.ts +16 -17
- package/src/cli/commands/system.ts +1 -1
- package/src/cli/commands/ticker.ts +3 -1
- package/src/cli/early-command.ts +2 -0
- package/src/cli/errors.ts +10 -1
- package/src/cli/fx-forward.ts +89 -7
- package/src/cli/fx-pair.ts +1 -1
- package/src/cli/fx-quote-rate.ts +23 -0
- package/src/cli/glossary.ts +19 -5
- package/src/cli/help.ts +1 -0
- package/src/cli/history-rows.ts +5 -3
- package/src/cli/index-roots.ts +5 -4
- package/src/cli/index.ts +40 -3
- package/src/cli/known-gaps.ts +38 -9
- package/src/cli/listing-arg.ts +17 -5
- package/src/cli/name-entries.ts +5 -1
- package/src/cli/not-a-ticker.ts +4 -0
- package/src/cli/options.ts +52 -3
- package/src/cli/output-file.ts +5 -3
- package/src/cli/pane-functions/catalog.ts +15 -0
- package/src/cli/pane-functions/function-help.ts +4 -4
- package/src/cli/pane-functions/headless.ts +9 -4
- package/src/cli/pane-functions/index.ts +6 -4
- package/src/cli/pane-functions/resolver.ts +2 -2
- package/src/cli/result.ts +21 -2
- package/src/cli/spreadsheet-hint.ts +7 -3
- package/src/cli/treasury-yields.ts +5 -3
- package/src/components/chart/composite/legend.tsx +40 -2
- package/src/components/command-bar/pane-settings.ts +2 -2
- package/src/components/command-bar/routes/root/results.ts +6 -2
- package/src/components/command-bar/workflow/tickers.ts +2 -2
- package/src/components/data-table/view.tsx +9 -2
- package/src/components/input-search-bar.tsx +9 -2
- package/src/components/layout/pane/header.tsx +2 -0
- package/src/components/layout/shell/pane/capture.ts +4 -1
- package/src/components/layout/status-bar.tsx +6 -1
- package/src/components/onboarding/first-run-workspace.ts +44 -2
- package/src/components/onboarding/onboarding-frame.tsx +11 -2
- package/src/components/onboarding/onboarding-keyboard.ts +16 -0
- package/src/components/onboarding/onboarding-wizard.tsx +8 -8
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +62 -1
- package/src/components/onboarding/use-onboarding-progress.ts +12 -4
- package/src/components/pane-settings-dialog/desktop.tsx +2 -2
- package/src/components/pane-settings-dialog/tui.tsx +2 -2
- package/src/components/pane-settings-dialog/value.ts +6 -0
- package/src/components/pane-settings-dialog.tsx +3 -3
- package/src/components/reader/detail-reader.tsx +4 -0
- package/src/components/ui/data-table/opentui/index.tsx +11 -4
- package/src/components/ui/data-table/opentui/model.ts +8 -6
- package/src/components/ui/data-table/types.ts +6 -1
- package/src/components/ui/index.ts +1 -1
- package/src/components/ui/page-stack-view.tsx +3 -0
- package/src/components/ui/pane-link-chip.tsx +269 -54
- package/src/components/ui/query-bar.tsx +2 -1
- package/src/components/ui/table-layout.ts +38 -1
- package/src/components/ui/tabs.tsx +97 -19
- package/src/core/state/app/layout-reducer.ts +7 -0
- package/src/core/state/app/layout.ts +44 -7
- package/src/core/state/app/state.ts +1 -1
- package/src/core/state/app/types.ts +22 -2
- package/src/docs/snapshot.json +30 -13
- package/src/market-data/depositary-pair.ts +5 -3
- package/src/market-data/market/change-basis.ts +9 -5
- package/src/market-data/market/dated-previous-close.ts +147 -17
- package/src/market-data/market/status.ts +17 -1
- package/src/market-data/quotes/contributions.ts +2 -0
- package/src/market-data/quotes/listing-enterprise-value.ts +50 -0
- package/src/plugins/builtin/alerts/metric-data.ts +15 -2
- package/src/plugins/builtin/analytics/risk-client.ts +10 -4
- package/src/plugins/builtin/analytics/risk-episodes.ts +5 -4
- package/src/plugins/builtin/analytics/risk-headless.ts +4 -2
- package/src/plugins/builtin/analytics/risk-sectors.ts +91 -0
- package/src/plugins/builtin/awards/index.tsx +1 -1
- package/src/plugins/builtin/backtest/headless.ts +1 -1
- package/src/plugins/builtin/buildout/index.tsx +1 -0
- package/src/plugins/builtin/catalysts/index.tsx +2 -2
- package/src/plugins/builtin/cds/headless.ts +4 -0
- package/src/plugins/builtin/cds/model.ts +0 -6
- package/src/plugins/builtin/chart-composer/formula.ts +16 -3
- package/src/plugins/builtin/chart-composer/headless-schema.ts +2 -0
- package/src/plugins/builtin/chart-composer/headless.ts +4 -2
- package/src/plugins/builtin/chart-composer/index.tsx +1 -0
- package/src/plugins/builtin/chart-composer/presets.ts +1 -0
- package/src/plugins/builtin/chat/content/composer.tsx +5 -4
- package/src/plugins/builtin/chat/content/index.tsx +12 -2
- package/src/plugins/builtin/chat/content/layout-metrics.ts +3 -3
- package/src/plugins/builtin/chat/content/open-targets.ts +3 -3
- package/src/plugins/builtin/chat/layout.ts +5 -2
- package/src/plugins/builtin/chat/message/pane-chip.tsx +61 -40
- package/src/plugins/builtin/chat/message/terminal.tsx +13 -15
- package/src/plugins/builtin/chat/pane-links/previews.ts +51 -5
- package/src/plugins/builtin/chat/pane-links/share-card.ts +36 -0
- package/src/plugins/builtin/cloud/askg/pane.tsx +55 -13
- package/src/plugins/builtin/cloud/askg/tool-display.ts +1 -0
- package/src/plugins/builtin/cloud/terminal-relay/redact.ts +5 -3
- package/src/plugins/builtin/commodity-balances/index.tsx +1 -0
- package/src/plugins/builtin/company-attention/index.tsx +1 -1
- package/src/plugins/builtin/company-kpis/headless.ts +3 -1
- package/src/plugins/builtin/company-kpis/index.tsx +2 -2
- package/src/plugins/builtin/cot/index.tsx +1 -1
- package/src/plugins/builtin/cpi/index.tsx +1 -1
- package/src/plugins/builtin/credit-boards/cdx-pane.tsx +20 -7
- package/src/plugins/builtin/credit-boards/client.ts +8 -0
- package/src/plugins/builtin/credit-boards/headless.ts +4 -1
- package/src/plugins/builtin/credit-boards/model.ts +58 -4
- package/src/plugins/builtin/credit-boards/series.ts +63 -6
- package/src/plugins/builtin/credit-boards/sovr-pane.tsx +3 -2
- package/src/plugins/builtin/credit-conditions/headless.ts +24 -6
- package/src/plugins/builtin/credit-conditions/index.tsx +1 -1
- package/src/plugins/builtin/credit-conditions/model.ts +12 -6
- package/src/plugins/builtin/credit-conditions/series.ts +2 -1
- package/src/plugins/builtin/crypto-board/index.tsx +1 -0
- package/src/plugins/builtin/dividend-yield/index.tsx +1 -0
- package/src/plugins/builtin/doe/index.tsx +1 -1
- package/src/plugins/builtin/earnings-calls/headless.ts +5 -1
- package/src/plugins/builtin/earnings-calls/index.tsx +1 -0
- package/src/plugins/builtin/econ/calendar-model.ts +115 -8
- package/src/plugins/builtin/econ/calendar-source.ts +7 -1
- package/src/plugins/builtin/econ/fred-catalog.ts +3 -1
- package/src/plugins/builtin/econ/index.tsx +42 -8
- package/src/plugins/builtin/econ/types.ts +3 -0
- package/src/plugins/builtin/econ-statistics/index.tsx +1 -0
- package/src/plugins/builtin/econ-statistics/pane.tsx +6 -0
- package/src/plugins/builtin/estimate-revisions/index.tsx +1 -0
- package/src/plugins/builtin/executives/index.tsx +1 -0
- package/src/plugins/builtin/filing-events/index.tsx +1 -0
- package/src/plugins/builtin/fixed-income/index.tsx +3 -0
- package/src/plugins/builtin/futures-curve/headless.ts +3 -3
- package/src/plugins/builtin/futures-curve/index.tsx +1 -1
- package/src/plugins/builtin/futures-curve/model.ts +18 -0
- package/src/plugins/builtin/fx-matrix/index.tsx +44 -14
- package/src/plugins/builtin/gpu/index.tsx +1 -1
- package/src/plugins/builtin/help/functions-table.tsx +1 -1
- package/src/plugins/builtin/help/index.tsx +11 -1
- package/src/plugins/builtin/help/keybindings-editor.tsx +7 -3
- package/src/plugins/builtin/holders/index.tsx +1 -0
- package/src/plugins/builtin/holders/report-header.ts +2 -2
- package/src/plugins/builtin/insider/index.tsx +1 -0
- package/src/plugins/builtin/iv-history/index.tsx +1 -1
- package/src/plugins/builtin/jobs/index.tsx +1 -0
- package/src/plugins/builtin/macro-day/headless.ts +27 -8
- package/src/plugins/builtin/macro-day/index.tsx +1 -1
- package/src/plugins/builtin/macro-day/model.ts +19 -3
- package/src/plugins/builtin/macro-day/pane.tsx +14 -9
- package/src/plugins/builtin/macro-day/releases.ts +25 -7
- package/src/plugins/builtin/market-valuation/index.tsx +1 -0
- package/src/plugins/builtin/market-valuation/pane.tsx +8 -0
- package/src/plugins/builtin/members/index.tsx +1 -1
- package/src/plugins/builtin/mna/index.tsx +1 -0
- package/src/plugins/builtin/news/index.tsx +1 -0
- package/src/plugins/builtin/news/wire/index.tsx +5 -1
- package/src/plugins/builtin/news/wire/news/detail-view.tsx +4 -0
- package/src/plugins/builtin/news/wire/news/list-search.ts +5 -2
- package/src/plugins/builtin/options/index.tsx +1 -0
- package/src/plugins/builtin/options-positioning/index.tsx +1 -0
- package/src/plugins/builtin/pe-band/index.tsx +1 -1
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +25 -0
- package/src/plugins/builtin/portfolio-list/cli/render.ts +20 -3
- package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +5 -1
- package/src/plugins/builtin/portfolio-list/headless.ts +15 -6
- package/src/plugins/builtin/power/index.tsx +1 -1
- package/src/plugins/builtin/realized-vol/index.tsx +1 -1
- package/src/plugins/builtin/research/headless-schema.ts +4 -3
- package/src/plugins/builtin/research/headless.ts +10 -4
- package/src/plugins/builtin/research/index.tsx +4 -0
- package/src/plugins/builtin/research/relative-valuation-columns.ts +145 -47
- package/src/plugins/builtin/research/relative-valuation-currency.ts +31 -0
- package/src/plugins/builtin/research/relative-valuation-headless.ts +25 -8
- package/src/plugins/builtin/research/relative-valuation-model.ts +40 -9
- package/src/plugins/builtin/research/relative-valuation-pane.tsx +3 -2
- package/src/plugins/builtin/research/relative-valuation-peers.ts +2 -2
- package/src/plugins/builtin/research-search/index.tsx +1 -0
- package/src/plugins/builtin/research-search/pane.tsx +8 -0
- package/src/plugins/builtin/revenue-breakdown/index.tsx +1 -0
- package/src/plugins/builtin/reverse-dcf/index.tsx +1 -1
- package/src/plugins/builtin/risk-factors/index.tsx +1 -0
- package/src/plugins/builtin/scanner/headless.ts +52 -13
- package/src/plugins/builtin/seasonality/index.tsx +1 -1
- package/src/plugins/builtin/sec/index.tsx +1 -0
- package/src/plugins/builtin/series-inventory.ts +1 -1
- package/src/plugins/builtin/shared/scanner-capture.ts +11 -3
- package/src/plugins/builtin/shared/series-list-detail.tsx +5 -0
- package/src/plugins/builtin/short-interest/index.tsx +1 -0
- package/src/plugins/builtin/social-mentions/index.tsx +1 -1
- package/src/plugins/builtin/supply-chain/index.tsx +1 -0
- package/src/plugins/builtin/thirteenf/api.ts +47 -4
- package/src/plugins/builtin/thirteenf/data.ts +43 -10
- package/src/plugins/builtin/thirteenf/headless.ts +55 -11
- package/src/plugins/builtin/thirteenf/model.ts +25 -9
- package/src/plugins/builtin/thirteenf/report-notes.ts +27 -6
- package/src/plugins/builtin/thirteenf/types.ts +2 -0
- package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +1 -1
- package/src/plugins/builtin/ticker-detail/data-panes/historical-prices.tsx +8 -7
- package/src/plugins/builtin/ticker-detail/data-panes/history-bars.ts +8 -5
- package/src/plugins/builtin/ticker-detail/financials/model.ts +18 -2
- package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +3 -3
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +6 -6
- package/src/plugins/builtin/ticker-detail/headless.ts +24 -17
- package/src/plugins/builtin/ticker-detail/index.tsx +4 -0
- package/src/plugins/builtin/ticker-detail/overview/model.ts +6 -4
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +6 -4
- package/src/plugins/builtin/time-sales/client.ts +9 -11
- package/src/plugins/builtin/time-sales/index.tsx +1 -1
- package/src/plugins/builtin/treasury-auctions/after.ts +267 -0
- package/src/plugins/builtin/treasury-auctions/cache.ts +54 -5
- package/src/plugins/builtin/treasury-auctions/client.ts +33 -2
- package/src/plugins/builtin/treasury-auctions/headless.ts +150 -22
- package/src/plugins/builtin/treasury-auctions/hk-headless.ts +126 -0
- package/src/plugins/builtin/treasury-auctions/hk-view.tsx +347 -0
- package/src/plugins/builtin/treasury-auctions/hk.ts +363 -0
- package/src/plugins/builtin/treasury-auctions/index.tsx +27 -4
- package/src/plugins/builtin/treasury-auctions/model.ts +264 -28
- package/src/plugins/builtin/treasury-auctions/pane.tsx +176 -41
- package/src/plugins/builtin/treasury-auctions/treasury-direct.ts +5 -2
- package/src/plugins/builtin/treasury-auctions/types.ts +7 -1
- package/src/plugins/builtin/vol-surface/index.tsx +1 -1
- package/src/plugins/builtin/world-venue-map/index.ts +1 -0
- package/src/plugins/builtin/yield-curve/curves.ts +10 -4
- package/src/plugins/builtin/yield-curve/headless.ts +6 -2
- package/src/plugins/builtin/yield-curve/index.tsx +3 -3
- package/src/plugins/builtin/yield-curve/series.ts +10 -0
- package/src/plugins/builtin/yield-curve/world.ts +3 -1
- package/src/portfolio/collection-name.ts +22 -0
- package/src/portfolio/column-values.ts +2 -1
- package/src/public/__snapshots__/public-api.test.ts.snap +4 -0
- package/src/public/remote.ts +7 -1
- package/src/remote/client.ts +191 -11
- package/src/remote/controller-utils.ts +13 -1
- package/src/remote/controller.ts +88 -26
- package/src/remote/endpoint.ts +24 -0
- package/src/remote/form.ts +59 -4
- package/src/remote/resources.ts +44 -18
- package/src/remote/schema.ts +21 -9
- package/src/remote/secrets.ts +12 -0
- package/src/remote/semantic-tree.tsx +14 -2
- package/src/remote/server.ts +2 -1
- package/src/remote/surface.tsx +192 -0
- package/src/remote/types.ts +5 -0
- package/src/renderers/dom/data-table/frozen-column.ts +3 -1
- package/src/renderers/dom/data-table/index.tsx +27 -9
- package/src/renderers/dom/data-table/row.tsx +2 -0
- package/src/renderers/electrobun/bun/desktop/backend.ts +27 -24
- package/src/renderers/electrobun/bun/desktop/detached-windows.ts +3 -3
- package/src/renderers/electrobun/bun/desktop/snapshot-commit.ts +77 -0
- package/src/renderers/electrobun/shared/protocol.ts +4 -0
- package/src/renderers/electrobun/view/backend-rpc.ts +3 -0
- package/src/renderers/electrobun/view/desktop/window/bridge.ts +3 -0
- package/src/renderers/opentui/host.tsx +6 -0
- package/src/series/standalone.ts +2 -2
- package/src/shares/api.ts +21 -4
- package/src/shares/item.ts +73 -0
- package/src/shares/pane-item.ts +205 -0
- package/src/shares/pane.ts +4 -0
- package/src/shares/payload.ts +9 -5
- package/src/sources/gloomberb-cloud/news.ts +2 -0
- package/src/sources/gloomberb-cloud/normalizers.ts +9 -5
- package/src/sources/provider-router/cache.ts +3 -1
- package/src/sync/controller.ts +17 -2
- package/src/sync/other-window-tabs.ts +32 -1
- package/src/sync/react.ts +4 -4
- package/src/tickers/renamed-listings.ts +105 -0
- package/src/tickers/search/index.ts +103 -16
- package/src/time-series/bar-spacing.ts +33 -0
- package/src/time-series/base-series.ts +21 -3
- package/src/time-series/chart-bounds.ts +31 -0
- package/src/time-series/field-catalog.ts +17 -0
- package/src/time-series/fundamentals.ts +143 -11
- package/src/time-series/ice-credit.ts +32 -6
- package/src/time-series/resolve.ts +11 -7
- package/src/time-series/session-bar.ts +78 -9
- package/src/time-series/studies/formula.ts +53 -10
- package/src/time-series/studies/pair.ts +18 -7
- package/src/time-series/studies/units.ts +49 -2
- package/src/time-series/types.ts +12 -0
- package/src/types/desktop-window.ts +2 -0
- package/src/types/financials.ts +7 -0
- package/src/types/headless.ts +8 -0
- package/src/types/plugin-pane-settings.ts +2 -0
- package/src/types/plugin-panes.ts +22 -0
- package/src/utils/central-banks.ts +86 -1
- package/src/utils/cli-output.ts +6 -3
- package/src/utils/datetime-format.ts +12 -3
- package/src/utils/depositary-receipt.ts +28 -3
- package/src/utils/ebitda.ts +128 -0
- package/src/utils/format.ts +1 -1
- package/src/utils/fundamentals.ts +14 -0
- package/src/utils/max-drawdown.ts +97 -16
- package/src/utils/shell-word.ts +13 -0
- package/src/utils/untrusted-text.ts +29 -0
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
type DataTableCell,
|
|
12
12
|
type DataTableKeyEvent,
|
|
13
13
|
type DataTableRootKeyContext,
|
|
14
|
+
type QueryBarSelectFilter,
|
|
14
15
|
} from "../../../components";
|
|
15
16
|
import { loadingErrorFooterInfo, usePaneRefreshKey } from "../../../components/data-table/table-pane";
|
|
16
17
|
import { ageFooterSegment, savedCopyFooterInfo } from "../../../components/layout/pane/footer";
|
|
@@ -29,28 +30,40 @@ import { useAsyncResource } from "../../../react/async-resource";
|
|
|
29
30
|
import { useAutoRefresh } from "../../../react/auto-refresh";
|
|
30
31
|
import { useCommandValue } from "../shared/command-tab";
|
|
31
32
|
import { FIXED_INCOME_PANE_ID } from "../fixed-income/model";
|
|
33
|
+
import {
|
|
34
|
+
afterLoadWindow, afterWindowStart, AUCTION_VIEWS, loadAuctionCurves, projectAuctionAfter, widerAfterWindow, type AuctionAfter, type AuctionView,
|
|
35
|
+
} from "./after";
|
|
32
36
|
import { loadTreasuryAuctions } from "./cache";
|
|
37
|
+
import type { AuctionHistoryWindow } from "./client";
|
|
33
38
|
import {
|
|
39
|
+
AUCTION_AFTER_SORT_COLUMN_IDS,
|
|
34
40
|
AUCTION_FILTERS,
|
|
35
41
|
AUCTION_SEARCH_FIELDS,
|
|
36
42
|
AUCTION_SORT_COLUMN_IDS,
|
|
43
|
+
AUCTION_SORT_NAMES,
|
|
37
44
|
DEFAULT_AUCTION_SORT,
|
|
38
45
|
auctionDatesShowYear,
|
|
39
46
|
auctionHistoryPhrase,
|
|
40
47
|
auctionHistoryWindow,
|
|
41
48
|
auctionSize,
|
|
49
|
+
auctionSortColumn,
|
|
42
50
|
buildAuctionColumns,
|
|
43
51
|
dealerPct,
|
|
44
52
|
directPct,
|
|
45
53
|
firstAuctionSortDirection,
|
|
46
54
|
formatAuctionRate,
|
|
47
55
|
indirectPct,
|
|
56
|
+
isAfterColumn,
|
|
57
|
+
isBill,
|
|
48
58
|
isPendingAuction,
|
|
49
59
|
nextAuctionHistoryWindow,
|
|
50
60
|
nextFilter,
|
|
51
61
|
rateLabel,
|
|
52
62
|
rateValue,
|
|
53
|
-
|
|
63
|
+
middleRateLabel,
|
|
64
|
+
publishesMedian,
|
|
65
|
+
stopOutLabel,
|
|
66
|
+
stopOutVsAvgBp,
|
|
54
67
|
visibleAuctions,
|
|
55
68
|
type AuctionColumn,
|
|
56
69
|
type AuctionColumnId,
|
|
@@ -61,6 +74,8 @@ import {
|
|
|
61
74
|
TREASURY_AUCTIONS_PANE_ID,
|
|
62
75
|
type TreasuryAuction,
|
|
63
76
|
} from "./types";
|
|
77
|
+
import { AUCTION_MARKETS, isAuctionMarket, type AuctionMarket } from "./hk";
|
|
78
|
+
import { HkTendersView } from "./hk-view";
|
|
64
79
|
|
|
65
80
|
function formatRate(value: number | null): string {
|
|
66
81
|
return value == null ? "—" : `${value.toFixed(3)}%`;
|
|
@@ -81,11 +96,18 @@ function formatPct(value: number | null, auction?: TreasuryAuction): string {
|
|
|
81
96
|
return `${value.toFixed(1)}%`;
|
|
82
97
|
}
|
|
83
98
|
|
|
84
|
-
/** The stop-out against the
|
|
99
|
+
/** The stop-out against the median reads in basis points, like an FRN margin. */
|
|
85
100
|
function formatBp(value: number | null): string {
|
|
86
101
|
return value == null ? "—" : `${value.toFixed(1)}bp`;
|
|
87
102
|
}
|
|
88
103
|
|
|
104
|
+
/** A yield's move after the auction, in whole bp under a header that says bp; blank until the session is in. */
|
|
105
|
+
function formatMove(value: number | null): string {
|
|
106
|
+
return value == null ? "" : `${value > 0 ? "+" : ""}${value.toFixed(0)}`;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const VIEW_OPTIONS = AUCTION_VIEWS.map((value) => ({ value, label: value === "after" ? "After" : "Results" }));
|
|
110
|
+
|
|
89
111
|
function formatMoney(value: number | null): string {
|
|
90
112
|
return value == null ? "—" : `$${formatCompact(value)}`;
|
|
91
113
|
}
|
|
@@ -118,6 +140,7 @@ function renderAuctionCell(
|
|
|
118
140
|
column: AuctionColumn,
|
|
119
141
|
rowState: { selected: boolean },
|
|
120
142
|
showYear: boolean,
|
|
143
|
+
after: AuctionAfter | undefined,
|
|
121
144
|
): DataTableCell {
|
|
122
145
|
const selected = rowState.selected ? colors.selectedText : undefined;
|
|
123
146
|
const dimmed = selected ?? colors.textDim;
|
|
@@ -144,7 +167,7 @@ function renderAuctionCell(
|
|
|
144
167
|
? { text: RESULTS_PENDING, color: dimmed }
|
|
145
168
|
: { text: formatAuctionRate(auction, rateValue(auction), "—"), color: selected ?? colors.textBright };
|
|
146
169
|
case "stopOut":
|
|
147
|
-
return { text: formatBp(
|
|
170
|
+
return { text: formatBp(stopOutVsAvgBp(auction)), color: selected ?? colors.text };
|
|
148
171
|
case "btc":
|
|
149
172
|
return { text: formatRatio(auction.bidToCoverRatio, auction), color: selected ?? colors.text };
|
|
150
173
|
case "indirect":
|
|
@@ -155,11 +178,26 @@ function renderAuctionCell(
|
|
|
155
178
|
return { text: formatPct(dealerPct(auction), auction), color: selected ?? colors.text };
|
|
156
179
|
case "size":
|
|
157
180
|
return { text: formatMoney(auctionSize(auction)), color: dimmed };
|
|
181
|
+
case "cusip":
|
|
182
|
+
return { text: auction.cusip ?? "", color: dimmed };
|
|
183
|
+
case "btcPctl":
|
|
184
|
+
case "indirectPctl":
|
|
185
|
+
case "dealerPctl": {
|
|
186
|
+
const key = column.id === "btcPctl" ? "btcPercentile" : column.id === "indirectPctl" ? "indirectPercentile" : "dealerPercentile";
|
|
187
|
+
const value = after?.[key] ?? null;
|
|
188
|
+
return { text: value == null ? "" : String(value), value, color: selected ?? colors.text };
|
|
189
|
+
}
|
|
190
|
+
case "after1d":
|
|
191
|
+
case "after5d":
|
|
192
|
+
case "after20d": {
|
|
193
|
+
const value = after?.[column.id] ?? null;
|
|
194
|
+
return { text: formatMove(value), value, color: selected ?? colors.text };
|
|
195
|
+
}
|
|
158
196
|
}
|
|
159
197
|
}
|
|
160
198
|
|
|
161
199
|
|
|
162
|
-
function TreasuryAuctionDetail({ auction, width }: { auction: TreasuryAuction; width: number }) {
|
|
200
|
+
function TreasuryAuctionDetail({ auction, width, after }: { auction: TreasuryAuction; width: number; after?: AuctionAfter }) {
|
|
163
201
|
const share = (value: number | null, total: number | null): string => (
|
|
164
202
|
value == null || !total ? formatMoney(value) : `${formatMoney(value)} (${((value / total) * 100).toFixed(1)}%)`
|
|
165
203
|
);
|
|
@@ -174,16 +212,22 @@ function TreasuryAuctionDetail({ auction, width }: { auction: TreasuryAuction; w
|
|
|
174
212
|
</Box>
|
|
175
213
|
<Box height={1} />
|
|
176
214
|
<KeyValueRow labelWidth={22} width={Math.max(1, width - 2)} emphasis={false} label={rateLabel(auction)} value={formatAuctionRate(auction, rateValue(auction), "—")} />
|
|
215
|
+
{isBill(auction) && auction.highDiscountRate != null && (
|
|
216
|
+
<KeyValueRow labelWidth={22} width={Math.max(1, width - 2)} emphasis={false} label="High discount rate" value={formatRate(auction.highDiscountRate)} />
|
|
217
|
+
)}
|
|
218
|
+
{isBill(auction) && auction.avgMedDiscountRate != null && (
|
|
219
|
+
<KeyValueRow labelWidth={22} width={Math.max(1, width - 2)} emphasis={false} label={middleRateLabel(auction, "discount rate")} value={formatRate(auction.avgMedDiscountRate)} />
|
|
220
|
+
)}
|
|
177
221
|
{auction.avgMedYield != null && (
|
|
178
|
-
<KeyValueRow labelWidth={22} width={Math.max(1, width - 2)} emphasis={false} label="
|
|
222
|
+
<KeyValueRow labelWidth={22} width={Math.max(1, width - 2)} emphasis={false} label={middleRateLabel(auction, "yield")} value={formatRate(auction.avgMedYield)} />
|
|
179
223
|
)}
|
|
180
|
-
{
|
|
181
|
-
<KeyValueRow labelWidth={22} width={Math.max(1, width - 2)} emphasis={false} label=
|
|
224
|
+
{stopOutVsAvgBp(auction) != null && (
|
|
225
|
+
<KeyValueRow labelWidth={22} width={Math.max(1, width - 2)} emphasis={false} label={stopOutLabel(auction)} value={formatBp(stopOutVsAvgBp(auction))} />
|
|
182
226
|
)}
|
|
183
227
|
<KeyValueRow labelWidth={22} width={Math.max(1, width - 2)} emphasis={false} label="Bid-to-cover" value={formatRatio(auction.bidToCoverRatio)} />
|
|
184
228
|
<Box height={1} />
|
|
185
229
|
<KeyValueRow labelWidth={22} width={Math.max(1, width - 2)} emphasis={false} label="High price" value={auction.highPrice?.toFixed(4) ?? "—"} />
|
|
186
|
-
<KeyValueRow labelWidth={22} width={Math.max(1, width - 2)} emphasis={false} label="
|
|
230
|
+
<KeyValueRow labelWidth={22} width={Math.max(1, width - 2)} emphasis={false} label={publishesMedian(auction) ? "Median price" : "Average price"} value={auction.avgMedPrice?.toFixed(4) ?? "—"} />
|
|
187
231
|
<KeyValueRow labelWidth={22} width={Math.max(1, width - 2)} emphasis={false} label="Low price" value={auction.lowPrice?.toFixed(4) ?? "—"} />
|
|
188
232
|
<Box height={1} />
|
|
189
233
|
<KeyValueRow labelWidth={22} width={Math.max(1, width - 2)} emphasis={false} label="Offering" value={formatMoney(auction.offeringAmount)} />
|
|
@@ -192,6 +236,16 @@ function TreasuryAuctionDetail({ auction, width }: { auction: TreasuryAuction; w
|
|
|
192
236
|
<KeyValueRow labelWidth={22} width={Math.max(1, width - 2)} emphasis={false} label="Indirect" value={share(auction.indirectAccepted, auction.competitiveAccepted)} />
|
|
193
237
|
<KeyValueRow labelWidth={22} width={Math.max(1, width - 2)} emphasis={false} label="Direct" value={share(auction.directAccepted, auction.competitiveAccepted)} />
|
|
194
238
|
<KeyValueRow labelWidth={22} width={Math.max(1, width - 2)} emphasis={false} label="Primary dealer" value={share(auction.primaryDealerAccepted, auction.competitiveAccepted)} />
|
|
239
|
+
{after && <>
|
|
240
|
+
<Box height={1} />
|
|
241
|
+
<KeyValueRow labelWidth={22} width={Math.max(1, width - 2)} emphasis={false} label="B/C percentile" value={after.btcPercentile == null ? "—" : String(after.btcPercentile)} />
|
|
242
|
+
<KeyValueRow labelWidth={22} width={Math.max(1, width - 2)} emphasis={false} label="Indirect percentile" value={after.indirectPercentile == null ? "—" : String(after.indirectPercentile)} />
|
|
243
|
+
<KeyValueRow labelWidth={22} width={Math.max(1, width - 2)} emphasis={false} label="Dealer percentile" value={after.dealerPercentile == null ? "—" : String(after.dealerPercentile)} />
|
|
244
|
+
{after.cmt && ([[1, after.after1d], [5, after.after5d], [20, after.after20d]] as const).map(([sessions, value]) => (
|
|
245
|
+
<KeyValueRow key={sessions} labelWidth={22} width={Math.max(1, width - 2)} emphasis={false}
|
|
246
|
+
label={`${after.cmt} yield +${sessions}d`} value={value == null ? "—" : `${formatMove(value)}bp`} />
|
|
247
|
+
))}
|
|
248
|
+
</>}
|
|
195
249
|
</Box>
|
|
196
250
|
</ScrollBox>
|
|
197
251
|
);
|
|
@@ -199,11 +253,69 @@ function TreasuryAuctionDetail({ auction, width }: { auction: TreasuryAuction; w
|
|
|
199
253
|
|
|
200
254
|
const NO_AUCTIONS: TreasuryAuction[] = [];
|
|
201
255
|
|
|
256
|
+
/** A sort as kept in pane state and typed after --sort: the column's name, and `:asc` or `:desc` once the pane flips it. */
|
|
257
|
+
function readSort(value: string | null): AuctionSortPreference | null {
|
|
258
|
+
if (!value) return null;
|
|
259
|
+
const [name, direction] = value.split(":");
|
|
260
|
+
const columnId = auctionSortColumn(name ?? "");
|
|
261
|
+
if (!columnId) return null;
|
|
262
|
+
return { columnId, direction: direction === "asc" || direction === "desc" ? direction : firstAuctionSortDirection(columnId) };
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
function writeSort(sort: AuctionSortPreference): string | null {
|
|
266
|
+
const name = AUCTION_SORT_NAMES.find((entry) => entry.column === sort.columnId)?.value;
|
|
267
|
+
return name ? `${name}:${sort.direction}` : null;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/** A command's value for this pane's auctions tab, from `AUCT 7Y --view after` and the like. */
|
|
271
|
+
const auctionParam = (key: string) => (params: Readonly<Record<string, string>>) => params.view === "auctions" ? params[key] ?? null : null;
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* AUCT: US Treasury auctions, or Hong Kong's government paper tenders, by the
|
|
275
|
+
* Market choice in the query bar (`AUCT --market hk`, `AUCT HK 10Y`). The
|
|
276
|
+
* group, search, sort and window carry across.
|
|
277
|
+
*/
|
|
202
278
|
export function TreasuryAuctionsPane({ focused, width, height }: PaneProps) {
|
|
203
279
|
const historyDays = auctionHistoryWindow(usePaneInstance()?.settings);
|
|
280
|
+
const [marketChoice, setMarket] = useCommandValue<string>(FIXED_INCOME_PANE_ID, "market", auctionParam("auctionMarket"), "us");
|
|
281
|
+
const market: AuctionMarket = isAuctionMarket(marketChoice) ? marketChoice : "us";
|
|
282
|
+
const [sortValue, setSortValue] = useCommandValue<string | null>(FIXED_INCOME_PANE_ID, "sortColumn", auctionParam("auctionSort"), null);
|
|
283
|
+
const [filter, setFilter] = useCommandValue<AuctionFilter>(FIXED_INCOME_PANE_ID, "activeTab",
|
|
284
|
+
(params) => AUCTION_FILTERS.find((entry) => entry.value === auctionParam("auctionFilter")(params))?.value ?? null, "all");
|
|
285
|
+
// `AUCT 10Y` opens on that search, as `fn AUCT 10Y` reads it; a later `AUCT 5Y` replaces it.
|
|
286
|
+
const [searchQuery, setSearchQuery] = useCommandValue(
|
|
287
|
+
FIXED_INCOME_PANE_ID,
|
|
288
|
+
"search",
|
|
289
|
+
(params) => params.view === "auctions" ? params.search ?? "" : null,
|
|
290
|
+
"",
|
|
291
|
+
);
|
|
292
|
+
const marketFilter = useMemo<QueryBarSelectFilter<string>>(() => ({
|
|
293
|
+
id: "market", label: "Market", value: market, options: AUCTION_MARKETS, onChange: setMarket, inline: true,
|
|
294
|
+
}), [market, setMarket]);
|
|
295
|
+
const shared = { focused, width, height, historyDays, filter, setFilter, searchQuery, setSearchQuery, sortValue, setSortValue, marketFilter };
|
|
296
|
+
return market === "hk" ? <HkTendersView {...shared} /> : <UsAuctionsView {...shared} />;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function UsAuctionsView({
|
|
300
|
+
focused, width, height, historyDays, filter, setFilter, searchQuery, setSearchQuery, sortValue, setSortValue, marketFilter,
|
|
301
|
+
}: Parameters<typeof HkTendersView>[0]) {
|
|
302
|
+
const [viewChoice, setView] = useCommandValue<string>(FIXED_INCOME_PANE_ID, "view", auctionParam("auctionView"), "results");
|
|
303
|
+
const sortPreference = useMemo(() => readSort(sortValue) ?? DEFAULT_AUCTION_SORT, [sortValue]);
|
|
304
|
+
const setSortPreference = useCallback((next: AuctionSortPreference | ((current: AuctionSortPreference) => AuctionSortPreference)) => {
|
|
305
|
+
setSortValue(writeSort(typeof next === "function" ? next(readSort(sortValue) ?? DEFAULT_AUCTION_SORT) : next));
|
|
306
|
+
}, [setSortValue, sortValue]);
|
|
307
|
+
// A sort by an after column shows the after view, as `fn AUCT --sort btc-pctl` does.
|
|
308
|
+
const view: AuctionView = viewChoice === "after" || isAfterColumn(sortPreference.columnId) ? "after" : "results";
|
|
309
|
+
// The after view reads more than it lists, until each listed tenor has its 24 before the oldest row
|
|
310
|
+
// (widerAfterWindow); the widening holds for one list, and a new search, group or window starts over.
|
|
311
|
+
const listKey = `${historyDays}|${filter}|${searchQuery}`;
|
|
312
|
+
const [widened, setWidened] = useState<{ key: string; window: AuctionHistoryWindow } | null>(null);
|
|
313
|
+
const loadWindow = view === "after"
|
|
314
|
+
? widened?.key === listKey ? widened.window : afterLoadWindow(historyDays)
|
|
315
|
+
: historyDays;
|
|
204
316
|
const loadAuctions = useCallback(
|
|
205
|
-
(force: boolean) => loadTreasuryAuctions(force, undefined,
|
|
206
|
-
[
|
|
317
|
+
(force: boolean) => loadTreasuryAuctions(force, undefined, loadWindow).then((result) => ({ ...result, window: loadWindow })),
|
|
318
|
+
[loadWindow],
|
|
207
319
|
);
|
|
208
320
|
// A new history window keeps the loaded auctions up until its own answer.
|
|
209
321
|
const resource = useAsyncResource(loadAuctions, { keepPreviousData: true });
|
|
@@ -216,25 +328,34 @@ export function TreasuryAuctionsPane({ focused, width, height }: PaneProps) {
|
|
|
216
328
|
const error = resource.error ?? (resource.loading || savedAt != null ? null : resource.data?.refreshError ?? null);
|
|
217
329
|
// Once auctions have loaded, a refresh runs without a loading state.
|
|
218
330
|
const loading = resource.loading && !resource.data;
|
|
219
|
-
const [filter, setFilter] = usePluginPaneState<AuctionFilter>("activeTab", "all");
|
|
220
331
|
const [selectedId, setSelectedId] = usePluginPaneState<string | null>("selectedId", null);
|
|
221
332
|
const [detailOpen, setDetailOpen] = usePluginPaneState<boolean>("detailOpen", false);
|
|
222
|
-
const [sortPreference, setSortPreference] = useState<AuctionSortPreference>(DEFAULT_AUCTION_SORT);
|
|
223
|
-
// `AUCT 10Y` opens on that search, as `fn AUCT 10Y` reads it; a later `AUCT 5Y` replaces it.
|
|
224
|
-
const [searchQuery, setSearchQuery] = useCommandValue(
|
|
225
|
-
FIXED_INCOME_PANE_ID,
|
|
226
|
-
"search",
|
|
227
|
-
(params) => params.view === "auctions" ? params.search ?? "" : null,
|
|
228
|
-
"",
|
|
229
|
-
);
|
|
230
333
|
const { active: searchFocused, focus: focusSearch, blur: blurSearch, searchProps } = useQueryBarSearch();
|
|
231
334
|
|
|
232
335
|
// The cache decides whether a tick becomes a request; only [r] forces it.
|
|
233
336
|
useAutoRefresh(stale ? null : fetchedAt, resource.load);
|
|
234
337
|
|
|
338
|
+
const listed = useMemo(
|
|
339
|
+
() => visibleAuctions(auctions, { filter, query: searchQuery, sort: DEFAULT_AUCTION_SORT,
|
|
340
|
+
...(view === "after" ? { from: afterWindowStart(historyDays) } : {}) }),
|
|
341
|
+
[auctions, filter, historyDays, searchQuery, view],
|
|
342
|
+
);
|
|
343
|
+
const loadedWindow = resource.data?.window ?? null;
|
|
344
|
+
useEffect(() => {
|
|
345
|
+
if (view !== "after" || loadedWindow !== loadWindow) return;
|
|
346
|
+
const wider = widerAfterWindow(listed, auctions, loadWindow);
|
|
347
|
+
if (wider) setWidened({ key: listKey, window: wider });
|
|
348
|
+
}, [auctions, listKey, listed, loadWindow, loadedWindow, view]);
|
|
349
|
+
const curvesFrom = afterWindowStart(historyDays) ?? null;
|
|
350
|
+
const loadCurves = useCallback(() => loadAuctionCurves(listed, curvesFrom), [curvesFrom, listed]);
|
|
351
|
+
const curves = useAsyncResource(view === "after" ? loadCurves : null, { keepPreviousData: true });
|
|
352
|
+
// Percentiles need only the board; the yield moves fill in when the curves arrive.
|
|
353
|
+
const after = useMemo(() => view === "after" ? projectAuctionAfter(listed, auctions, curves.data?.curves ?? new Map()) : null,
|
|
354
|
+
[auctions, curves.data, listed, view]);
|
|
355
|
+
const yieldsError = view === "after" ? curves.error ?? curves.data?.errors[0] ?? null : null;
|
|
235
356
|
const rows = useMemo(
|
|
236
|
-
() => visibleAuctions(
|
|
237
|
-
[
|
|
357
|
+
() => visibleAuctions(listed, { filter: "all", query: "", sort: sortPreference, ...(after ? { after } : {}) }),
|
|
358
|
+
[after, listed, sortPreference],
|
|
238
359
|
);
|
|
239
360
|
const selected = rows.find((auction) => auction.id === selectedId) ?? null;
|
|
240
361
|
|
|
@@ -255,17 +376,23 @@ export function TreasuryAuctionsPane({ focused, width, height }: PaneProps) {
|
|
|
255
376
|
const selectFilter = useCallback((next: AuctionFilter) => {
|
|
256
377
|
setFilter(next);
|
|
257
378
|
setDetailOpen(false);
|
|
258
|
-
}, []);
|
|
379
|
+
}, [setFilter]);
|
|
259
380
|
const cycleFilter = useCallback(() => {
|
|
260
|
-
setFilter(
|
|
381
|
+
setFilter(nextFilter(filter));
|
|
261
382
|
setDetailOpen(false);
|
|
262
|
-
}, []);
|
|
383
|
+
}, [filter, setFilter]);
|
|
263
384
|
const cycleSort = useCallback((step: 1 | -1) => {
|
|
264
385
|
setSortPreference((current) => {
|
|
265
|
-
const next = cycleSortPreference<AuctionColumnId>(AUCTION_SORT_COLUMN_IDS, current, step);
|
|
386
|
+
const next = cycleSortPreference<AuctionColumnId>(view === "after" ? AUCTION_AFTER_SORT_COLUMN_IDS : AUCTION_SORT_COLUMN_IDS, current, step);
|
|
266
387
|
return { columnId: next.columnId ?? DEFAULT_AUCTION_SORT.columnId, direction: next.direction };
|
|
267
388
|
});
|
|
268
|
-
}, []);
|
|
389
|
+
}, [setSortPreference, view]);
|
|
390
|
+
const selectView = useCallback((next: AuctionView) => {
|
|
391
|
+
setView(next);
|
|
392
|
+
// A sort the next view has no column for goes back to the newest first.
|
|
393
|
+
const columns = next === "after" ? AUCTION_AFTER_SORT_COLUMN_IDS : AUCTION_SORT_COLUMN_IDS;
|
|
394
|
+
if (!columns.includes(sortPreference.columnId)) setSortValue(null);
|
|
395
|
+
}, [setSortValue, setView, sortPreference.columnId]);
|
|
269
396
|
|
|
270
397
|
usePaneRefreshKey(() => void resource.reload(), { focused, enabled: !searchFocused });
|
|
271
398
|
|
|
@@ -296,16 +423,18 @@ export function TreasuryAuctionsPane({ focused, width, height }: PaneProps) {
|
|
|
296
423
|
}, [focusSearch, handlePaneKey]);
|
|
297
424
|
|
|
298
425
|
const showYear = auctionDatesShowYear(historyDays);
|
|
299
|
-
|
|
426
|
+
// A table that scrolls down keeps a cell for its scrollbar.
|
|
427
|
+
const columns = useMemo(() => buildAuctionColumns({ showYear, view, rows, width: width - 1 }), [rows, showYear, view, width]);
|
|
300
428
|
const renderAuctionRow = useCallback((
|
|
301
429
|
auction: TreasuryAuction,
|
|
302
430
|
column: AuctionColumn,
|
|
303
431
|
_index: number,
|
|
304
432
|
rowState: { selected: boolean },
|
|
305
|
-
) => renderAuctionCell(auction, column, rowState, showYear), [showYear]);
|
|
433
|
+
) => renderAuctionCell(auction, column, rowState, showYear, after?.get(auction.id)), [after, showYear]);
|
|
306
434
|
|
|
307
435
|
usePaneFooter(TREASURY_AUCTIONS_PANE_ID, () => {
|
|
308
436
|
const info = loadingErrorFooterInfo(loading, error);
|
|
437
|
+
if (yieldsError) info.push({ id: "yields", parts: [{ text: "Treasury yields unavailable", tone: "warning" as const }] });
|
|
309
438
|
if (savedAt != null) info.push(...savedCopyFooterInfo([savedAt]));
|
|
310
439
|
else if (stale) info.push(STALE_SEGMENT);
|
|
311
440
|
if (fetchedAt && savedAt == null) {
|
|
@@ -325,6 +454,7 @@ export function TreasuryAuctionsPane({ focused, width, height }: PaneProps) {
|
|
|
325
454
|
cycleFilter,
|
|
326
455
|
detailOpen,
|
|
327
456
|
error,
|
|
457
|
+
yieldsError,
|
|
328
458
|
fetchedAt,
|
|
329
459
|
focusSearch,
|
|
330
460
|
loading,
|
|
@@ -351,11 +481,26 @@ export function TreasuryAuctionsPane({ focused, width, height }: PaneProps) {
|
|
|
351
481
|
variant: "bare",
|
|
352
482
|
});
|
|
353
483
|
const tabs = tabStrip && <Box height={1} flexShrink={0} overflow="hidden">{tabStrip}</Box>;
|
|
484
|
+
const queryBar = (
|
|
485
|
+
<QueryBar
|
|
486
|
+
width={width}
|
|
487
|
+
search={{
|
|
488
|
+
value: searchQuery,
|
|
489
|
+
onChange: setSearchQuery,
|
|
490
|
+
placeholder: "type, 10Y, CUSIP, or date",
|
|
491
|
+
focused: focused && !detailOpen,
|
|
492
|
+
...searchProps,
|
|
493
|
+
}}
|
|
494
|
+
filters={[marketFilter]}
|
|
495
|
+
view={{ value: view, options: VIEW_OPTIONS, onChange: selectView }}
|
|
496
|
+
/>
|
|
497
|
+
);
|
|
354
498
|
|
|
355
499
|
if (loading && auctions.length === 0) {
|
|
356
500
|
return (
|
|
357
501
|
<Box flexDirection="column" width={width} height={height}>
|
|
358
502
|
{tabs}
|
|
503
|
+
{queryBar}
|
|
359
504
|
<PaneStatusBody loading align="center" loadingLabel="Loading Treasury auctions..." />
|
|
360
505
|
</Box>
|
|
361
506
|
);
|
|
@@ -365,6 +510,7 @@ export function TreasuryAuctionsPane({ focused, width, height }: PaneProps) {
|
|
|
365
510
|
return (
|
|
366
511
|
<Box flexDirection="column" width={width} height={height}>
|
|
367
512
|
{tabs}
|
|
513
|
+
{queryBar}
|
|
368
514
|
<Box padding={1}>
|
|
369
515
|
<EmptyState status={error ? "error" : "empty"} title="Treasury auctions unavailable." message={error} />
|
|
370
516
|
</Box>
|
|
@@ -379,20 +525,9 @@ export function TreasuryAuctionsPane({ focused, width, height }: PaneProps) {
|
|
|
379
525
|
focused={focused && !searchFocused}
|
|
380
526
|
detailOpen={detailOpen && !!selected}
|
|
381
527
|
onBack={() => setDetailOpen(false)}
|
|
382
|
-
detailContent={selected ? <TreasuryAuctionDetail auction={selected} width={width} /> : null}
|
|
528
|
+
detailContent={selected ? <TreasuryAuctionDetail auction={selected} width={width} after={after?.get(selected.id)} /> : null}
|
|
383
529
|
detailTitle={selected ? `${selected.secType} ${selected.securityTerm}` : undefined}
|
|
384
|
-
rootBefore={
|
|
385
|
-
<QueryBar
|
|
386
|
-
width={width}
|
|
387
|
-
search={{
|
|
388
|
-
value: searchQuery,
|
|
389
|
-
onChange: setSearchQuery,
|
|
390
|
-
placeholder: "type, 10Y, CUSIP, or date",
|
|
391
|
-
focused: focused && !detailOpen,
|
|
392
|
-
...searchProps,
|
|
393
|
-
}}
|
|
394
|
-
/>
|
|
395
|
-
)}
|
|
530
|
+
rootBefore={queryBar}
|
|
396
531
|
onRootKeyDown={handleRootKeyDown}
|
|
397
532
|
onDetailKeyDown={handlePaneKey}
|
|
398
533
|
selection={{
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ApiRequestError } from "../../../api-client/errors";
|
|
2
2
|
import { createThrottledFetch } from "../../../utils/throttled-fetch";
|
|
3
|
+
import { inClearingOrder } from "./client";
|
|
3
4
|
import type { TreasuryAuction } from "./types";
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -78,7 +79,7 @@ export function normalizeDirectAuction(raw: unknown): TreasuryAuction | null {
|
|
|
78
79
|
const securityType = text(record.securityType);
|
|
79
80
|
if (!cusip || !auctionDate || !securityType) return null;
|
|
80
81
|
const bill = securityType === "Bill";
|
|
81
|
-
return {
|
|
82
|
+
return inClearingOrder({
|
|
82
83
|
id: `${cusip}|${auctionDate}`,
|
|
83
84
|
cusip,
|
|
84
85
|
secType: text(record.inflationProtected) === "Yes" ? "TIPS" : text(record.floatingRate) === "Yes" ? "FRN" : securityType,
|
|
@@ -88,9 +89,11 @@ export function normalizeDirectAuction(raw: unknown): TreasuryAuction | null {
|
|
|
88
89
|
// A bill's `highRate` is its discount rate; a note or bond states its coupon elsewhere.
|
|
89
90
|
highDiscountRate: bill ? toNumber(record.highRate) : null,
|
|
90
91
|
avgMedDiscountRate: bill ? toNumber(record.medianRate) : null,
|
|
92
|
+
lowDiscountRate: bill ? toNumber(record.lowRate) : null,
|
|
91
93
|
highDiscountMargin: toNumber(record.highDiscountMargin),
|
|
92
94
|
highYield: toNumber(record.highYield),
|
|
93
95
|
avgMedYield: toNumber(record.medianYield),
|
|
96
|
+
lowYield: toNumber(record.lowYield),
|
|
94
97
|
highPrice: toNumber(record.highPrice),
|
|
95
98
|
lowPrice: toNumber(record.lowPrice),
|
|
96
99
|
avgMedPrice: toNumber(record.averagePrice),
|
|
@@ -101,7 +104,7 @@ export function normalizeDirectAuction(raw: unknown): TreasuryAuction | null {
|
|
|
101
104
|
primaryDealerAccepted: toNumber(record.primaryDealersCompetitiveParAwarded),
|
|
102
105
|
totalAccepted: toNumber(record.grandTotalParAwarded),
|
|
103
106
|
offeringAmount: toNumber(record.offeringAmount),
|
|
104
|
-
};
|
|
107
|
+
});
|
|
105
108
|
}
|
|
106
109
|
|
|
107
110
|
/**
|
|
@@ -22,12 +22,16 @@ export interface TreasuryAuction {
|
|
|
22
22
|
highDiscountMargin?: number | null;
|
|
23
23
|
/** Bill high (stop-out) discount rate, in percentage points. */
|
|
24
24
|
highDiscountRate: number | null;
|
|
25
|
-
/** Bill
|
|
25
|
+
/** Bill median discount rate, in percentage points (Treasury's average/median discount rate). */
|
|
26
26
|
avgMedDiscountRate: number | null;
|
|
27
|
+
/** Bill low discount rate, in percentage points. */
|
|
28
|
+
lowDiscountRate?: number | null;
|
|
27
29
|
/** High (stop-out) yield, reported by Notes, Bonds, and TIPS. */
|
|
28
30
|
highYield: number | null;
|
|
29
31
|
/** Median yield for notes, bonds and TIPS, as Treasury publishes it. */
|
|
30
32
|
avgMedYield: number | null;
|
|
33
|
+
/** Low yield for notes, bonds and TIPS. */
|
|
34
|
+
lowYield?: number | null;
|
|
31
35
|
highPrice: number | null;
|
|
32
36
|
lowPrice: number | null;
|
|
33
37
|
avgMedPrice: number | null;
|
|
@@ -54,6 +58,7 @@ export interface TreasuryAuctionRaw {
|
|
|
54
58
|
high_investment_rate?: string;
|
|
55
59
|
high_yield?: string;
|
|
56
60
|
avg_med_yield?: string;
|
|
61
|
+
low_yield?: string;
|
|
57
62
|
high_price?: string;
|
|
58
63
|
low_price?: string;
|
|
59
64
|
avg_med_price?: string;
|
|
@@ -69,4 +74,5 @@ export interface TreasuryAuctionRaw {
|
|
|
69
74
|
high_discnt_margin?: string;
|
|
70
75
|
high_discnt_rate?: string;
|
|
71
76
|
avg_med_discnt_rate?: string;
|
|
77
|
+
low_discnt_rate?: string;
|
|
72
78
|
}
|
|
@@ -5,7 +5,7 @@ import { volSurfaceHeadless } from "./headless";
|
|
|
5
5
|
export const volSurfaceModule: PluginModule = {
|
|
6
6
|
panes: [{
|
|
7
7
|
id: "vol-surface", name: "Volatility Surface", icon: "V", get component(): typeof import("./pane").VolSurfacePane { const { VolSurfacePane } = require("./pane"); return VolSurfacePane; },
|
|
8
|
-
defaultPosition: "right", tickerFollower: true, defaultMode: "floating", defaultFloatingSize: { width: 126, height: 36 },
|
|
8
|
+
defaultPosition: "right", shareItem: { ticker: true }, tickerFollower: true, defaultMode: "floating", defaultFloatingSize: { width: 126, height: 36 },
|
|
9
9
|
tableExport: true, headless: volSurfaceHeadless,
|
|
10
10
|
settings: {
|
|
11
11
|
title: "Volatility Surface Settings",
|
|
@@ -49,6 +49,7 @@ export const worldVenueMapModule: PluginModule = {
|
|
|
49
49
|
defaultMode: "floating",
|
|
50
50
|
defaultFloatingSize: { width: 124, height: 36 },
|
|
51
51
|
// Linked to a list, a map with the app's own layers (facilities) shows the selected company's.
|
|
52
|
+
shareItem: { ticker: true, argument: true },
|
|
52
53
|
tickerFollower: mapFollowsTicker,
|
|
53
54
|
// The layer picker comes from the server's catalog; without one the pane keeps its old settings.
|
|
54
55
|
settings: (context) => buildMapSettingsDef(context.settings, peekGeoCatalog()?.layers) ?? { fields: [] },
|
|
@@ -29,6 +29,8 @@ export const CURVE_OPTIONS: readonly CurveOption[] = [
|
|
|
29
29
|
{ id: "gb", label: "Gilt", aliases: ["gilt", "gilts", "uk", "gb", "gbp"] },
|
|
30
30
|
{ id: "jp", label: "JGB", aliases: ["jgb", "jgbs", "jp", "japan", "jpy"] },
|
|
31
31
|
{ id: "ca", label: "Canada", aliases: ["canada", "ca", "goc", "cad"] },
|
|
32
|
+
{ id: "mx", label: "Mexico", aliases: ["mexico", "mx", "mbono", "mbonos", "bono", "bonos", "cetes", "mxn"] },
|
|
33
|
+
{ id: "br", label: "Brazil", aliases: ["brazil", "br", "brl", "prefixado", "ltn", "ntn-f", "ntnf"] },
|
|
32
34
|
];
|
|
33
35
|
|
|
34
36
|
export function isCurveId(value: unknown): value is CurveId {
|
|
@@ -50,7 +52,7 @@ export function curveOption(id: CurveId): CurveOption {
|
|
|
50
52
|
* `GC`, `GC 2026-01-02`, `GC JGB`, `GC TIPS 2024-01-02`: a curve word and a
|
|
51
53
|
* date, either order. Words with no digit are no date: one that names no
|
|
52
54
|
* curve (`GC world`, `GC "South Africa"`) lists the curves and points at the
|
|
53
|
-
* world tab, which
|
|
55
|
+
* world tab, which sets them side by side, as does a second curve word.
|
|
54
56
|
*/
|
|
55
57
|
export function parseCurveArgument(value: unknown, now = new Date()): { curve: CurveId | null; date: string } {
|
|
56
58
|
const words = typeof value === "string" ? value.trim().split(/\s+/).filter(Boolean) : [];
|
|
@@ -58,7 +60,11 @@ export function parseCurveArgument(value: unknown, now = new Date()): { curve: C
|
|
|
58
60
|
const rest: string[] = [];
|
|
59
61
|
for (const word of words) {
|
|
60
62
|
const match = CURVE_OPTIONS.find((option) => option.aliases.includes(word.toLowerCase()));
|
|
61
|
-
if (match &&
|
|
63
|
+
if (match && curve && match.id !== curve) {
|
|
64
|
+
throw new Error(`GC shows one curve: ${curveOption(curve).aliases[0]} or ${match.aliases[0]}. `
|
|
65
|
+
+ "The world tab sets every market's 2- and 10-year yields side by side: gloom fn GC --tab world.");
|
|
66
|
+
}
|
|
67
|
+
if (match) curve = match.id;
|
|
62
68
|
else rest.push(word);
|
|
63
69
|
}
|
|
64
70
|
const text = rest.join(" ");
|
|
@@ -66,11 +72,11 @@ export function parseCurveArgument(value: unknown, now = new Date()): { curve: C
|
|
|
66
72
|
return { curve, date: yieldCurveDate(text || null, now) };
|
|
67
73
|
}
|
|
68
74
|
|
|
69
|
-
/** `Unknown curve "world"`, with the curves there are and where
|
|
75
|
+
/** `Unknown curve "world"`, with the curves there are and where they are side by side. */
|
|
70
76
|
export function unknownCurveMessage(word: string): string {
|
|
71
77
|
const names = CURVE_OPTIONS.map((option) => option.aliases[0]);
|
|
72
78
|
return `Unknown curve "${word}"; the curves are ${names.slice(0, -1).join(", ")} and ${names.at(-1)}. `
|
|
73
|
-
+ "
|
|
79
|
+
+ "The world tab sets their 2- and 10-year yields side by side: gloom fn GC --tab world.";
|
|
74
80
|
}
|
|
75
81
|
|
|
76
82
|
/**
|
|
@@ -112,6 +112,8 @@ const CURVE_PUBLISHERS: Record<CurveId, string> = {
|
|
|
112
112
|
gb: "Bank of England",
|
|
113
113
|
jp: "Japan Ministry of Finance",
|
|
114
114
|
ca: "Bank of Canada",
|
|
115
|
+
mx: "Banxico",
|
|
116
|
+
br: "Tesouro Nacional",
|
|
115
117
|
};
|
|
116
118
|
|
|
117
119
|
/** Whose business days each curve's dates are, so a report names the day it means. */
|
|
@@ -124,6 +126,8 @@ const CURVE_MARKETS: Record<CurveId, string> = {
|
|
|
124
126
|
gb: "UK",
|
|
125
127
|
jp: "Japan",
|
|
126
128
|
ca: "Canada",
|
|
129
|
+
mx: "Mexico",
|
|
130
|
+
br: "Brazil",
|
|
127
131
|
};
|
|
128
132
|
|
|
129
133
|
export function createYieldCurveHeadless(
|
|
@@ -136,10 +140,10 @@ export function createYieldCurveHeadless(
|
|
|
136
140
|
return {
|
|
137
141
|
shape: "rows",
|
|
138
142
|
argument: { kind: "free-text", optional: true, placeholder: "[curve] [date]",
|
|
139
|
-
description: "A curve (ust, tips, breakeven, euro, bund, gilt, jgb, canada) and a historical as-of date; omit for the latest UST curve." },
|
|
143
|
+
description: "A curve (ust, tips, breakeven, euro, bund, gilt, jgb, canada, mexico, brazil) and a historical as-of date; omit for the latest UST curve." },
|
|
140
144
|
options: [
|
|
141
145
|
{ key: "date", type: "string", settingKey: "asOfDate", placeholder: "date", description: `Historical as-of date, as ${DATE_OPTION_EXAMPLES}; uses the latest session on or before it.` },
|
|
142
|
-
{ key: "curve", type: "string", description: "ust (default), tips, breakeven, euro, bund, gilt, jgb or
|
|
146
|
+
{ key: "curve", type: "string", description: "ust (default), tips, breakeven, euro, bund, gilt, jgb, canada, mexico or brazil." },
|
|
143
147
|
{ key: "compare", type: "string", description: `Compare with a date (${DATE_OPTION_EXAMPLES}) or a span back from the curve's session (1D, 1W, 1M, 3M, 1Y).` },
|
|
144
148
|
{ key: "view", type: "enum", values: [{ value: "curve" }, { value: "difference", aliases: ["diff"] }],
|
|
145
149
|
description: "With a compare date: both curves, or the bp change by tenor as bars.",
|
|
@@ -415,8 +415,8 @@ const WORLD_COLUMNS: DataTableColumn[] = [
|
|
|
415
415
|
{ id: "asOf", label: "As of", width: 10, align: "left" },
|
|
416
416
|
];
|
|
417
417
|
const worldKey = (row: WorldRow) => row.id;
|
|
418
|
-
/** Palette slots far enough apart that
|
|
419
|
-
const MARKET_COLOR_SLOTS = [0, 1, 2, 3, 4, 7] as const;
|
|
418
|
+
/** Palette slots far enough apart that the markets' curves on one axis read apart; the orange and green come last. */
|
|
419
|
+
const MARKET_COLOR_SLOTS = [0, 1, 2, 3, 4, 7, 5, 8] as const;
|
|
420
420
|
|
|
421
421
|
/** One row per market, each on the session its publisher last printed. */
|
|
422
422
|
function WorldTab({ onOpen, focused, width, height }: {
|
|
@@ -504,7 +504,7 @@ export const yieldCurveModule: PluginModule = {
|
|
|
504
504
|
label: "Yield Curve",
|
|
505
505
|
description: "Government bond curves, a world grid, and USD SOFR swap rates, swap spreads and tenor history.",
|
|
506
506
|
keywords: ["yield", "curve", "treasury", "bonds", "rates", "gc", "interest", "tips", "breakeven", "bund", "gilt", "jgb",
|
|
507
|
-
"sovereign", "world", "forward", "swaps", "sofr", "ois", "swap spread", "2s10s", "steepener", "flattener"],
|
|
507
|
+
"mbono", "cetes", "prefixado", "sovereign", "world", "forward", "swaps", "sofr", "ois", "swap spread", "2s10s", "steepener", "flattener"],
|
|
508
508
|
shortcut: { prefix: "GC", argPlaceholder: "[curve] [date]", argKind: "text", argOptional: true },
|
|
509
509
|
headless: yieldCurveHeadless,
|
|
510
510
|
createInstance: (_context, options) => {
|
|
@@ -57,6 +57,16 @@ const CURVES: ReadonlyArray<{
|
|
|
57
57
|
name: (tenor) => BILL_TENORS.has(tenor) ? `Canada ${tenor} Treasury bill yield` : `Canada ${tenor} benchmark yield`,
|
|
58
58
|
tenors: ["1M", "3M", "6M", "1Y", "2Y", "3Y", "5Y", "7Y", "10Y", "30Y"],
|
|
59
59
|
},
|
|
60
|
+
{
|
|
61
|
+
curve: "mx", publisher: "Banxico", tags: ["Mexico", "M bono", "Mbono", "Cetes", "peso"],
|
|
62
|
+
name: (tenor) => tenor === "2Y" ? "Mexico 2Y Cetes yield" : `Mexico ${tenor} M bono yield`,
|
|
63
|
+
tenors: ["2Y", "10Y"],
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
curve: "br", publisher: "Tesouro Nacional", tags: ["Brazil", "prefixado", "LTN", "NTN-F", "real"],
|
|
67
|
+
name: (tenor) => `Brazil ${tenor} prefixado yield`,
|
|
68
|
+
tenors: ["2Y", "10Y"],
|
|
69
|
+
},
|
|
60
70
|
{
|
|
61
71
|
curve: "eu-aaa", publisher: "ECB", tags: ["euro area", "AAA", "euro"],
|
|
62
72
|
name: (tenor) => `Euro area AAA ${tenor} yield`,
|
|
@@ -25,7 +25,9 @@ export interface WorldRow {
|
|
|
25
25
|
points: CloudCurvePoint[];
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
const MARKETS: Record<string, string> = {
|
|
28
|
+
const MARKETS: Record<string, string> = {
|
|
29
|
+
us: "US", de: "Germany", gb: "UK", jp: "Japan", ca: "Canada", "eu-aaa": "Euro AAA", mx: "Mexico", br: "Brazil",
|
|
30
|
+
};
|
|
29
31
|
|
|
30
32
|
const valueAt = (points: readonly CloudCurvePoint[] | undefined, tenor: string) => {
|
|
31
33
|
const value = points?.find((point) => point.tenor === tenor)?.yield;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { ShortcutArgError } from "../types/plugin";
|
|
2
|
+
import { listingSuffixVenue } from "../sources/listing-symbols";
|
|
3
|
+
import { canonicalExchange, canonicalTickerKey, parsePublicTickerKey } from "../utils/exchanges";
|
|
4
|
+
import { listingAbroadVenue } from "../utils/sec";
|
|
2
5
|
|
|
3
6
|
/** Collections an unknown-name error lists, so the caller can retry with one. */
|
|
4
7
|
const LISTED_COLLECTIONS = 12;
|
|
@@ -33,6 +36,25 @@ export function findNamedCollection<T extends { id: string; name: string }>(
|
|
|
33
36
|
* first 60 are read.` Every function's list argument, in `fn` and in the
|
|
34
37
|
* command bar, reads a watchlist's name here.
|
|
35
38
|
*/
|
|
39
|
+
/**
|
|
40
|
+
* What a saved ticker is read as in a function's list: its symbol, with its
|
|
41
|
+
* venue for a listing abroad (ASML:AMS, 2330:TWSE), as the same symbols typed
|
|
42
|
+
* read. A bare `ASML` is the US line, so a watchlist read as `ASML`, `2330`
|
|
43
|
+
* compared the wrong listings and exported keys a join collided on. A symbol
|
|
44
|
+
* that names its venue reads by the one code RV and `compare` print: ASML:XAMS
|
|
45
|
+
* as ASML:AMS, a vendor's 2330.TW as 2330:TWSE. US listings and venues with
|
|
46
|
+
* no home market (futures, currencies, coins) stay bare.
|
|
47
|
+
*/
|
|
48
|
+
export function watchlistMemberSymbol(metadata: { ticker: string; exchange?: string | null }): string {
|
|
49
|
+
const { ticker } = metadata;
|
|
50
|
+
if (parsePublicTickerKey(ticker).exchange) return canonicalTickerKey(ticker);
|
|
51
|
+
const suffixed = listingSuffixVenue(ticker, metadata.exchange ?? undefined);
|
|
52
|
+
if (suffixed) return `${suffixed.symbol}:${suffixed.exchange}`;
|
|
53
|
+
const exchange = canonicalExchange(metadata.exchange ?? undefined);
|
|
54
|
+
const key = exchange ? `${ticker}:${exchange}` : ticker;
|
|
55
|
+
return listingAbroadVenue(key) ? key : ticker;
|
|
56
|
+
}
|
|
57
|
+
|
|
36
58
|
export function readWatchlistArgument(
|
|
37
59
|
typed: string,
|
|
38
60
|
watchlist: { name: string },
|