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
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { DataTableColumn } from "../../../components";
|
|
2
|
+
import { dropColumnsToFit } from "../../../components/ui/table-layout";
|
|
3
|
+
import { displayWidth } from "../../../utils/format";
|
|
2
4
|
import { compareSortValues, type SortDirection } from "../../../utils/sort-values";
|
|
3
5
|
import { AUCTION_HISTORY_ALL, AUCTION_HISTORY_DAYS, AUCTION_HISTORY_START, type AuctionHistoryWindow } from "./client";
|
|
4
6
|
import type { TreasuryAuction } from "./types";
|
|
7
|
+
import { auctionSearchMarket, isAuctionMarket, type AuctionMarket } from "./hk";
|
|
5
8
|
|
|
6
9
|
/**
|
|
7
10
|
* History windows, shortest first: 30 days to 10 years in days, then ALL,
|
|
@@ -20,9 +23,10 @@ const AUCTION_HISTORY_LABELS: Record<string, { label: string; phrase: string }>
|
|
|
20
23
|
[AUCTION_HISTORY_ALL]: { label: `All, since ${AUCTION_HISTORY_START.slice(0, 4)}`, phrase: `every auction since ${AUCTION_HISTORY_START}` },
|
|
21
24
|
};
|
|
22
25
|
|
|
23
|
-
/** The window as the settings menu names it: "120 days", "5 years". */
|
|
26
|
+
/** The window as the settings menu names it: "120 days", "5 years"; the default says so. */
|
|
24
27
|
export function auctionHistoryLabel(window: AuctionHistoryWindow): string {
|
|
25
|
-
|
|
28
|
+
const label = AUCTION_HISTORY_LABELS[window]?.label ?? `${window} days`;
|
|
29
|
+
return window === AUCTION_HISTORY_DAYS ? `${label} (default)` : label;
|
|
26
30
|
}
|
|
27
31
|
|
|
28
32
|
/** The window inside a sentence: "the last 120 days", "the last 5 years". */
|
|
@@ -48,7 +52,18 @@ export function auctionHistoryWindow(settings: Record<string, unknown> | undefin
|
|
|
48
52
|
export const AUCTION_SEARCH_FIELDS = "type, benchmark (10Y), term, CUSIP, or date (YYYY-MM-DD)";
|
|
49
53
|
|
|
50
54
|
export type AuctionColumnId =
|
|
51
|
-
| "date" | "type" | "term" | "rate" | "stopOut" | "btc" | "indirect" | "direct" | "dealer" | "size"
|
|
55
|
+
| "date" | "type" | "term" | "rate" | "stopOut" | "btc" | "indirect" | "direct" | "dealer" | "size" | "cusip"
|
|
56
|
+
| "btcPctl" | "indirectPctl" | "dealerPctl" | "after1d" | "after5d" | "after20d";
|
|
57
|
+
|
|
58
|
+
/** What the after view adds to a row: its percentiles and the yield's moves after it (after.ts). */
|
|
59
|
+
export interface AuctionAfterFigures {
|
|
60
|
+
btcPercentile: number | null;
|
|
61
|
+
indirectPercentile: number | null;
|
|
62
|
+
dealerPercentile: number | null;
|
|
63
|
+
after1d: number | null;
|
|
64
|
+
after5d: number | null;
|
|
65
|
+
after20d: number | null;
|
|
66
|
+
}
|
|
52
67
|
|
|
53
68
|
export interface AuctionColumn extends DataTableColumn {
|
|
54
69
|
id: AuctionColumnId;
|
|
@@ -75,8 +90,39 @@ export const AUCTION_SORT_COLUMN_IDS: readonly AuctionColumnId[] = [
|
|
|
75
90
|
"direct",
|
|
76
91
|
"dealer",
|
|
77
92
|
"size",
|
|
93
|
+
"cusip",
|
|
94
|
+
];
|
|
95
|
+
|
|
96
|
+
/** The after view's columns, in the order [ and ] step through them. */
|
|
97
|
+
export const AUCTION_AFTER_SORT_COLUMN_IDS: readonly AuctionColumnId[] = [
|
|
98
|
+
"date", "type", "term", "rate", "btc", "btcPctl", "indirectPctl", "dealerPctl", "after1d", "after5d", "after20d", "cusip",
|
|
78
99
|
];
|
|
79
100
|
|
|
101
|
+
/** `--sort` as typed, and the column it sorts. */
|
|
102
|
+
export const AUCTION_SORT_NAMES: ReadonlyArray<{ value: string; column: AuctionColumnId; aliases?: string[] }> = [
|
|
103
|
+
{ value: "date", column: "date" },
|
|
104
|
+
{ value: "type", column: "type" },
|
|
105
|
+
{ value: "term", column: "term" },
|
|
106
|
+
{ value: "rate", column: "rate", aliases: ["yield"] },
|
|
107
|
+
{ value: "vs-median", column: "stopOut", aliases: ["vs-med", "vs-average", "vs-avg", "stop-out", "stopout"] },
|
|
108
|
+
{ value: "btc", column: "btc", aliases: ["b/c", "bid-to-cover", "bc"] },
|
|
109
|
+
{ value: "indirect", column: "indirect" },
|
|
110
|
+
{ value: "direct", column: "direct" },
|
|
111
|
+
{ value: "dealer", column: "dealer" },
|
|
112
|
+
{ value: "size", column: "size" },
|
|
113
|
+
{ value: "cusip", column: "cusip", aliases: ["issue"] },
|
|
114
|
+
{ value: "btc-pctl", column: "btcPctl", aliases: ["btc-percentile", "bc-pctl"] },
|
|
115
|
+
{ value: "indirect-pctl", column: "indirectPctl", aliases: ["indirect-percentile"] },
|
|
116
|
+
{ value: "dealer-pctl", column: "dealerPctl", aliases: ["dealer-percentile"] },
|
|
117
|
+
{ value: "1d", column: "after1d", aliases: ["after-1d", "+1d"] },
|
|
118
|
+
{ value: "5d", column: "after5d", aliases: ["after-5d", "+5d"] },
|
|
119
|
+
{ value: "20d", column: "after20d", aliases: ["after-20d", "+20d"] },
|
|
120
|
+
];
|
|
121
|
+
|
|
122
|
+
/** The after view's columns are its own; the results view's sort by its own. */
|
|
123
|
+
export const isAfterColumn = (column: AuctionColumnId) =>
|
|
124
|
+
column === "btcPctl" || column === "indirectPctl" || column === "dealerPctl" || column === "after1d" || column === "after5d" || column === "after20d";
|
|
125
|
+
|
|
80
126
|
export type AuctionFilter = "all" | "bill" | "note" | "bond";
|
|
81
127
|
|
|
82
128
|
export const AUCTION_FILTERS: ReadonlyArray<{ value: AuctionFilter; label: string }> = [
|
|
@@ -133,7 +179,7 @@ interface Benchmark {
|
|
|
133
179
|
* at auction is what the market calls the auction, so a 5-year auction that
|
|
134
180
|
* reopens an older 7-year note is still the 5Y.
|
|
135
181
|
*/
|
|
136
|
-
function auctionBenchmark(term: string): Benchmark | null {
|
|
182
|
+
export function auctionBenchmark(term: string): Benchmark | null {
|
|
137
183
|
const parts = termParts(term);
|
|
138
184
|
if (!parts) return null;
|
|
139
185
|
if (parts.year) {
|
|
@@ -245,16 +291,45 @@ export function dealerPct(auction: TreasuryAuction): number | null {
|
|
|
245
291
|
}
|
|
246
292
|
|
|
247
293
|
/**
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
|
|
252
|
-
|
|
294
|
+
* Treasury has sold every note, bond and bill at a single price since November
|
|
295
|
+
* 1998, and publishes the median accepted bid in its average/median field.
|
|
296
|
+
* Before, most auctions were multiple-price and the field is the average.
|
|
297
|
+
*/
|
|
298
|
+
const SINGLE_PRICE_FROM = "1998-11-01";
|
|
299
|
+
|
|
300
|
+
/** Whether an auction's average/median figure is the median (single-price) rather than the average. */
|
|
301
|
+
export const publishesMedian = (auction: Pick<TreasuryAuction, "auctionDate">) => auction.auctionDate >= SINGLE_PRICE_FROM;
|
|
302
|
+
|
|
303
|
+
/** The detail's name for the stop-out spread: against the median, or the average before November 1998. */
|
|
304
|
+
export const stopOutLabel = (auction: TreasuryAuction) => publishesMedian(auction) ? "Stop-out vs median" : "Stop-out vs average";
|
|
305
|
+
|
|
306
|
+
/** The detail's name for the middle figure itself: "Median yield", "Average discount rate". */
|
|
307
|
+
export function middleRateLabel(auction: TreasuryAuction, rate: "yield" | "discount rate"): string {
|
|
308
|
+
return `${publishesMedian(auction) ? "Median" : "Average"} ${rate}`;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* The stop-out column's heading for a list: VS MED when every row is from
|
|
313
|
+
* November 1998 on, VS AVG when every row is older, both when it spans the change.
|
|
314
|
+
*/
|
|
315
|
+
export function stopOutColumnLabel(auctions: readonly TreasuryAuction[], style: "pane" | "report"): string {
|
|
316
|
+
const median = auctions.some(publishesMedian);
|
|
317
|
+
const average = auctions.some((auction) => !publishesMedian(auction));
|
|
318
|
+
const which = median && average ? ["AVG/MED", "average/median"] : average ? ["AVG", "average"] : ["MED", "median"];
|
|
319
|
+
return style === "pane" ? `VS ${which[0]}` : `Stop-out vs ${which[1]} (bp)`;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* The stop-out (high yield) minus the median yield Treasury publishes for the
|
|
324
|
+
* same auction (the average before November 1998: publishesMedian), in basis
|
|
325
|
+
* points; a wider gap means the last dollars had to clear well above where
|
|
326
|
+
* most of the auction priced. Bills compare discount rates, which is how they
|
|
327
|
+
* trade. FRNs and auctions missing either leg are null.
|
|
253
328
|
*
|
|
254
329
|
* This is not a tail: a tail is the stop-out against the 1 pm when-issued
|
|
255
330
|
* yield, which the source does not carry.
|
|
256
331
|
*/
|
|
257
|
-
export function
|
|
332
|
+
export function stopOutVsAvgBp(auction: TreasuryAuction): number | null {
|
|
258
333
|
if (auction.secType === "FRN") return null;
|
|
259
334
|
const bill = FILTER_TYPES.bill.has(auction.secType);
|
|
260
335
|
const high = bill ? auction.highDiscountRate : auction.highYield;
|
|
@@ -276,7 +351,16 @@ export function rateValue(auction: TreasuryAuction): number | null {
|
|
|
276
351
|
/** Treasury's name for the rate rateValue reports; a bill's High Rate is its discount rate. */
|
|
277
352
|
export function rateLabel(auction: TreasuryAuction): string {
|
|
278
353
|
if (auction.secType === "FRN") return "High discount margin";
|
|
279
|
-
return
|
|
354
|
+
return isBill(auction) ? "Investment rate" : "High yield";
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/** A bill or cash management bill: its headline rate is the investment rate, and it trades on its discount rate. */
|
|
358
|
+
export const isBill = (auction: TreasuryAuction) => FILTER_TYPES.bill.has(auction.secType);
|
|
359
|
+
|
|
360
|
+
/** The rate column's heading: a board of bills says its rate is the investment rate Treasury states beside the discount rate. */
|
|
361
|
+
export function rateColumnLabel(auctions: readonly TreasuryAuction[], style: "pane" | "report"): string {
|
|
362
|
+
const bills = auctions.length > 0 && auctions.every(isBill);
|
|
363
|
+
return style === "pane" ? bills ? "INV RATE" : "RATE" : bills ? "Investment rate" : "Rate";
|
|
280
364
|
}
|
|
281
365
|
|
|
282
366
|
/**
|
|
@@ -293,9 +377,14 @@ export function formatAuctionRate(auction: TreasuryAuction, value: number | null
|
|
|
293
377
|
return auction.secType === "FRN" ? `${(value * 100).toFixed(1)}bp` : `${value.toFixed(3)}%`;
|
|
294
378
|
}
|
|
295
379
|
|
|
296
|
-
/**
|
|
380
|
+
/**
|
|
381
|
+
* Announced auctions appear in the feed days before any results are published.
|
|
382
|
+
* An early bill whose investment rate was blanked (inClearingOrder) still has
|
|
383
|
+
* its discount rates, so it is a result, not an announcement.
|
|
384
|
+
*/
|
|
297
385
|
export function isPendingAuction(auction: TreasuryAuction): boolean {
|
|
298
|
-
return rateValue(auction) == null && auction.bidToCoverRatio == null
|
|
386
|
+
return rateValue(auction) == null && auction.bidToCoverRatio == null
|
|
387
|
+
&& auction.highDiscountRate == null && auction.avgMedDiscountRate == null && auction.avgMedYield == null;
|
|
299
388
|
}
|
|
300
389
|
|
|
301
390
|
/**
|
|
@@ -329,7 +418,7 @@ export function auctionSize(auction: TreasuryAuction): number | null {
|
|
|
329
418
|
return auction.offeringAmount ?? auction.totalAccepted;
|
|
330
419
|
}
|
|
331
420
|
|
|
332
|
-
function sortValue(auction: TreasuryAuction, columnId: AuctionColumnId): number | string | null {
|
|
421
|
+
function sortValue(auction: TreasuryAuction, columnId: AuctionColumnId, after?: AuctionAfterFigures): number | string | null {
|
|
333
422
|
switch (columnId) {
|
|
334
423
|
case "date": return auctionDateValue(auction.auctionDate);
|
|
335
424
|
case "type": return auction.secType;
|
|
@@ -338,24 +427,32 @@ function sortValue(auction: TreasuryAuction, columnId: AuctionColumnId): number
|
|
|
338
427
|
return days === Number.MAX_SAFE_INTEGER ? null : days;
|
|
339
428
|
}
|
|
340
429
|
case "rate": return rateValue(auction);
|
|
341
|
-
case "stopOut": return
|
|
430
|
+
case "stopOut": return stopOutVsAvgBp(auction);
|
|
342
431
|
case "btc": return auction.bidToCoverRatio;
|
|
343
432
|
case "indirect": return indirectPct(auction);
|
|
344
433
|
case "direct": return directPct(auction);
|
|
345
434
|
case "dealer": return dealerPct(auction);
|
|
346
435
|
case "size": return auctionSize(auction);
|
|
436
|
+
case "cusip": return auction.cusip;
|
|
437
|
+
case "btcPctl": return after?.btcPercentile ?? null;
|
|
438
|
+
case "indirectPctl": return after?.indirectPercentile ?? null;
|
|
439
|
+
case "dealerPctl": return after?.dealerPercentile ?? null;
|
|
440
|
+
case "after1d": return after?.after1d ?? null;
|
|
441
|
+
case "after5d": return after?.after5d ?? null;
|
|
442
|
+
case "after20d": return after?.after20d ?? null;
|
|
347
443
|
}
|
|
348
444
|
}
|
|
349
445
|
|
|
350
446
|
export function visibleAuctions(
|
|
351
447
|
auctions: readonly TreasuryAuction[],
|
|
352
|
-
options: { filter: AuctionFilter; query: string; sort: AuctionSortPreference },
|
|
448
|
+
options: { filter: AuctionFilter; query: string; sort: AuctionSortPreference; after?: ReadonlyMap<string, AuctionAfterFigures>; from?: string },
|
|
353
449
|
): TreasuryAuction[] {
|
|
354
450
|
return auctions
|
|
355
|
-
.filter((auction) => matchesFilter(auction, options.filter) && matchesAuctionQuery(auction, options.query)
|
|
451
|
+
.filter((auction) => matchesFilter(auction, options.filter) && matchesAuctionQuery(auction, options.query)
|
|
452
|
+
&& (!options.from || auction.auctionDate >= options.from))
|
|
356
453
|
.sort((left, right) => {
|
|
357
|
-
const leftValue = sortValue(left, options.sort.columnId);
|
|
358
|
-
const rightValue = sortValue(right, options.sort.columnId);
|
|
454
|
+
const leftValue = sortValue(left, options.sort.columnId, options.after?.get(left.id));
|
|
455
|
+
const rightValue = sortValue(right, options.sort.columnId, options.after?.get(right.id));
|
|
359
456
|
const comparison = compareSortValues(
|
|
360
457
|
typeof leftValue === "string" ? leftValue.toLowerCase() : leftValue,
|
|
361
458
|
typeof rightValue === "string" ? rightValue.toLowerCase() : rightValue,
|
|
@@ -369,7 +466,7 @@ export function visibleAuctions(
|
|
|
369
466
|
|
|
370
467
|
/** Text columns read best ascending; every metric reads best highest-first. */
|
|
371
468
|
export function firstAuctionSortDirection(columnId: AuctionColumnId): SortDirection {
|
|
372
|
-
return columnId === "type" || columnId === "term" ? "asc" : "desc";
|
|
469
|
+
return columnId === "type" || columnId === "term" || columnId === "cusip" ? "asc" : "desc";
|
|
373
470
|
}
|
|
374
471
|
|
|
375
472
|
/**
|
|
@@ -382,21 +479,160 @@ export function auctionDatesShowYear(window: AuctionHistoryWindow): boolean {
|
|
|
382
479
|
|
|
383
480
|
/**
|
|
384
481
|
* Widths are the data's own; the table widens a column to its label plus the
|
|
385
|
-
* sort arrow.
|
|
386
|
-
*
|
|
387
|
-
*
|
|
482
|
+
* sort arrow. TERM is as wide as the longest term listed, and the CUSIP closes
|
|
483
|
+
* the row where the pane has room for it, taking what width is left; a pane
|
|
484
|
+
* too narrow for the rest scrolls sideways instead of clipping a figure.
|
|
388
485
|
*/
|
|
389
|
-
export function buildAuctionColumns(
|
|
390
|
-
|
|
486
|
+
export function buildAuctionColumns(options: {
|
|
487
|
+
showYear?: boolean;
|
|
488
|
+
view?: "results" | "after";
|
|
489
|
+
rows?: readonly TreasuryAuction[];
|
|
490
|
+
/** The table's width; without one every column is listed. */
|
|
491
|
+
width?: number;
|
|
492
|
+
} = {}): AuctionColumn[] {
|
|
493
|
+
const { showYear = false, view = "results", rows = [], width } = options;
|
|
494
|
+
const term = Math.max(6, ...rows.map((auction) => displayWidth(auction.securityTerm)));
|
|
495
|
+
const lead: AuctionColumn[] = [
|
|
391
496
|
{ id: "date", label: "DATE", width: showYear ? 10 : 6, align: "left" },
|
|
392
497
|
{ id: "type", label: "TYPE", width: 6, align: "left" },
|
|
393
|
-
{ id: "term", label: "TERM", width:
|
|
394
|
-
{ id: "rate", label: "
|
|
395
|
-
|
|
498
|
+
{ id: "term", label: "TERM", width: term, align: "left" },
|
|
499
|
+
{ id: "rate", label: rateColumnLabel(rows, "pane"), width: 7, align: "right" },
|
|
500
|
+
];
|
|
501
|
+
const figures: AuctionColumn[] = view === "after" ? [
|
|
502
|
+
{ id: "btc", label: "B/C", width: 5, align: "right" },
|
|
503
|
+
{ id: "btcPctl", label: "B/C PCTL", width: 4, align: "right", title: "Bid-to-cover percentile against the tenor's last 24 auctions" },
|
|
504
|
+
{ id: "indirectPctl", label: "IND PCTL", width: 4, align: "right", title: "Indirect share percentile against the tenor's last 24 auctions" },
|
|
505
|
+
{ id: "dealerPctl", label: "DLR PCTL", width: 4, align: "right", title: "Dealer share percentile against the tenor's last 24 auctions" },
|
|
506
|
+
{ id: "after1d", label: "+1D BP", width: 5, align: "right", title: "Treasury yield change one session after the auction, bp" },
|
|
507
|
+
{ id: "after5d", label: "+5D BP", width: 5, align: "right", title: "Treasury yield change five sessions after the auction, bp" },
|
|
508
|
+
{ id: "after20d", label: "+20D BP", width: 5, align: "right", title: "Treasury yield change twenty sessions after the auction, bp" },
|
|
509
|
+
] : [
|
|
510
|
+
{ id: "stopOut", label: stopOutColumnLabel(rows, "pane"), width: 7, align: "right", title: "Stop-out vs median yield (average before November 1998), bp" },
|
|
396
511
|
{ id: "btc", label: "B/C", width: 5, align: "right" },
|
|
397
512
|
{ id: "indirect", label: "INDIRECT", width: 8, align: "right" },
|
|
398
513
|
{ id: "direct", label: "DIRECT", width: 6, align: "right" },
|
|
399
514
|
{ id: "dealer", label: "DEALER", width: 6, align: "right" },
|
|
400
515
|
{ id: "size", label: "SIZE", width: 7, align: "right" },
|
|
401
516
|
];
|
|
517
|
+
const columns: AuctionColumn[] = [...lead, ...figures, { id: "cusip", label: "CUSIP", width: 9, align: "left", flexGrow: 1 }];
|
|
518
|
+
if (width == null) return columns;
|
|
519
|
+
const shown = dropColumnsToFit(columns, width, ["cusip"]);
|
|
520
|
+
// Without the CUSIP nothing grows: the figures keep their places at the left.
|
|
521
|
+
return shown.length === columns.length ? shown : shown.map((column) => ({ ...column, flexGrow: undefined }));
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* What `AUCT 10Y --history-days 3650` asks of the pane, typed in the command
|
|
526
|
+
* bar as it is to `fn AUCT`: the search, and the window, market, group, view
|
|
527
|
+
* and sort given as flags (`--history-days`, `--historyDays` or `--history`;
|
|
528
|
+
* `--market`, `--filter`, `--view`, `--sort`), each as `--flag value` or
|
|
529
|
+
* `--flag=value`. A flag whose value is not one of its own is left out; a
|
|
530
|
+
* search naming Hong Kong (`HK 10Y`) picks its market and keeps the rest.
|
|
531
|
+
*/
|
|
532
|
+
function parseAuctionCommandArg(arg: string | undefined): {
|
|
533
|
+
search: string;
|
|
534
|
+
market?: AuctionMarket;
|
|
535
|
+
historyDays?: AuctionHistoryWindow;
|
|
536
|
+
filter?: AuctionFilter;
|
|
537
|
+
view?: "results" | "after";
|
|
538
|
+
/** The sort's name as `--sort` takes it: "btc-pctl". */
|
|
539
|
+
sort?: string;
|
|
540
|
+
} {
|
|
541
|
+
const tokens = (arg ?? "").trim().split(/\s+/).filter(Boolean);
|
|
542
|
+
const words: string[] = [];
|
|
543
|
+
const parsed: ReturnType<typeof parseAuctionCommandArg> = { search: "" };
|
|
544
|
+
for (let index = 0; index < tokens.length; index++) {
|
|
545
|
+
const token = tokens[index]!;
|
|
546
|
+
const flag = /^--([a-z-]+)(?:=(.*))?$/i.exec(token);
|
|
547
|
+
if (!flag) {
|
|
548
|
+
words.push(token);
|
|
549
|
+
continue;
|
|
550
|
+
}
|
|
551
|
+
const name = flag[1]!.toLowerCase().replace(/-/g, "");
|
|
552
|
+
const value = (flag[2] ?? tokens[++index] ?? "").toLowerCase();
|
|
553
|
+
if (name === "historydays" || name === "history") {
|
|
554
|
+
const window = auctionHistoryWindow({ historyDays: value });
|
|
555
|
+
if (value === AUCTION_HISTORY_ALL || String(window) === value) parsed.historyDays = window;
|
|
556
|
+
} else if (name === "market") {
|
|
557
|
+
if (isAuctionMarket(value)) parsed.market = value;
|
|
558
|
+
} else if (name === "filter") {
|
|
559
|
+
const filter = AUCTION_FILTERS.find((entry) => entry.value === value)?.value;
|
|
560
|
+
if (filter) parsed.filter = filter;
|
|
561
|
+
} else if (name === "view") {
|
|
562
|
+
if (value === "results" || value === "after") parsed.view = value;
|
|
563
|
+
} else if (name === "sort") {
|
|
564
|
+
const sort = auctionSortColumn(value);
|
|
565
|
+
const name = sort && AUCTION_SORT_NAMES.find((entry) => entry.column === sort)?.value;
|
|
566
|
+
if (name) parsed.sort = name;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
// A search naming Hong Kong's paper picks its market unless --market names one.
|
|
570
|
+
const named = auctionSearchMarket(words.join(" "));
|
|
571
|
+
parsed.market ??= named.market ?? undefined;
|
|
572
|
+
parsed.search = parsed.market === "hk" ? named.search : words.join(" ").trim();
|
|
573
|
+
return parsed;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* What `AUCT <arg>` asks of the pane: the search and every view key, defaults
|
|
578
|
+
* included, since an open pane merges a command's params into its own; a plain
|
|
579
|
+
* `AUCT 10Y` after `AUCT 7Y --view after --sort 5d --filter note` opens on
|
|
580
|
+
* results, newest first, all types. A window is a setting, sent when named.
|
|
581
|
+
*/
|
|
582
|
+
export function auctionCommandRequest(arg: string | undefined): {
|
|
583
|
+
params: Record<string, string>;
|
|
584
|
+
settings: Record<string, string> | null;
|
|
585
|
+
} {
|
|
586
|
+
const { search, market, historyDays, filter, view, sort } = parseAuctionCommandArg(arg);
|
|
587
|
+
return {
|
|
588
|
+
params: { search, auctionMarket: market ?? "us", auctionView: view ?? "results", auctionSort: sort ?? "date", auctionFilter: filter ?? "all" },
|
|
589
|
+
settings: historyDays != null ? { historyDays: String(historyDays) } : null,
|
|
590
|
+
};
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
/** The column `--sort` names, by its name or an alias; null for anything else. */
|
|
594
|
+
export function auctionSortColumn(value: string): AuctionColumnId | null {
|
|
595
|
+
const name = value.trim().toLowerCase();
|
|
596
|
+
return AUCTION_SORT_NAMES.find((entry) => entry.value === name || entry.aliases?.includes(name))?.column ?? null;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
/** A query for a market AUCT does not cover: another country's government paper. */
|
|
600
|
+
const NON_US_PAPER = /\b(jgb|jgbs|gilt|gilts|bund|bunds|bobl|schatz|oat|oats|btp|btps|bono|bonos|acgb|cgb|cgbs|ktb|ktbs|sgs|btf|euro|eur|gbp|jpy|uk|japan|japanese|german|germany|france|french|italy|italian|spain|canada|canadian|australia|australian|china|chinese|korea|singapore|india|indian|brazil|mexico)\b/i;
|
|
601
|
+
|
|
602
|
+
/** Whether a search names another market's government paper, which AUCT does not list. */
|
|
603
|
+
export function namesOtherMarket(query: string): boolean {
|
|
604
|
+
return NON_US_PAPER.test(query.trim());
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
/** A whole CUSIP: nine letters and digits with a digit. */
|
|
608
|
+
const isWholeCusip = (query: string) => /^[a-z0-9]{9}$/i.test(query.trim()) && /\d/.test(query);
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* Whether a longer window could list more rows for this search: not with
|
|
612
|
+
* every auction already read, not for another market's paper, not for a
|
|
613
|
+
* CUSIP whose first auction is listed (its reopenings come after it), and not
|
|
614
|
+
* for a date inside the window.
|
|
615
|
+
*/
|
|
616
|
+
export function widerWindowCouldAdd(query: string, rows: readonly TreasuryAuction[], window: AuctionHistoryWindow, now = Date.now()): boolean {
|
|
617
|
+
if (window === AUCTION_HISTORY_ALL) return false;
|
|
618
|
+
const text = query.trim();
|
|
619
|
+
if (!text) return true;
|
|
620
|
+
if (namesOtherMarket(text)) return false;
|
|
621
|
+
const from = new Date(now - window * 86_400_000).toISOString().slice(0, 10);
|
|
622
|
+
const date = /\b(\d{4})(?:-(\d{2}))?(?:-(\d{2}))?\b/.exec(text);
|
|
623
|
+
if (date && !parseBenchmarkQuery(text.toLowerCase())) {
|
|
624
|
+
// The latest day the search can mean: a year's last day, a month's last day, the day itself.
|
|
625
|
+
const latest = date[3] ? date[0] : date[2] ? `${date[1]}-${date[2]}-31` : `${date[1]}-12-31`;
|
|
626
|
+
return latest < from;
|
|
627
|
+
}
|
|
628
|
+
if (isWholeCusip(text)) {
|
|
629
|
+
// A note or bond reopening's term has a month part (9-Year 10-Month); its first auction's is whole (10-Year).
|
|
630
|
+
// A bill's term is whole either way: a 13-week bill can reopen a 26-week CUSIP, so a bill is never known first.
|
|
631
|
+
const first = rows.some((auction) => {
|
|
632
|
+
const parts = termParts(auction.securityTerm);
|
|
633
|
+
return !isBill(auction) && !!parts && Object.keys(parts).length === 1;
|
|
634
|
+
});
|
|
635
|
+
return !first;
|
|
636
|
+
}
|
|
637
|
+
return true;
|
|
402
638
|
}
|