gloomberb 0.20.4 → 0.20.5
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 +2 -0
- package/bin/gloom +9 -0
- package/bin/without-bun.cjs +98 -0
- package/package.json +3 -1
- package/src/api-client/data.ts +138 -35
- package/src/api-client/types/econ.ts +12 -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/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 +78 -21
- package/src/cli/commands/news-search.ts +59 -7
- package/src/cli/commands/overview.ts +16 -1
- package/src/cli/commands/remote.ts +16 -17
- package/src/cli/commands/system.ts +1 -1
- package/src/cli/fx-forward.ts +25 -7
- package/src/cli/glossary.ts +19 -5
- package/src/cli/history-rows.ts +5 -3
- package/src/cli/known-gaps.ts +27 -1
- package/src/cli/listing-arg.ts +11 -1
- package/src/cli/name-entries.ts +5 -1
- package/src/cli/not-a-ticker.ts +4 -0
- package/src/cli/pane-functions/function-help.ts +2 -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/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/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/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 +27 -10
- package/src/market-data/depositary-pair.ts +5 -3
- package/src/market-data/market/dated-previous-close.ts +94 -15
- package/src/market-data/market/status.ts +17 -1
- 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/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/chart-composer/headless.ts +2 -1
- package/src/plugins/builtin/chart-composer/index.tsx +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/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/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 +74 -1
- package/src/plugins/builtin/econ/fred-catalog.ts +3 -1
- package/src/plugins/builtin/econ/index.tsx +1 -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 +1 -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/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 +1 -1
- 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/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.ts +10 -4
- package/src/plugins/builtin/research/index.tsx +4 -0
- 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/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/financials/model.ts +12 -0
- package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +3 -3
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +5 -5
- package/src/plugins/builtin/ticker-detail/headless.ts +18 -13
- 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 +18 -3
- package/src/plugins/builtin/treasury-auctions/client.ts +33 -2
- package/src/plugins/builtin/treasury-auctions/headless.ts +109 -19
- package/src/plugins/builtin/treasury-auctions/index.tsx +14 -4
- package/src/plugins/builtin/treasury-auctions/model.ts +256 -28
- package/src/plugins/builtin/treasury-auctions/pane.tsx +139 -28
- 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/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/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/tickers/renamed-listings.ts +105 -0
- package/src/tickers/search/index.ts +103 -16
- package/src/time-series/resolve.ts +2 -2
- package/src/types/financials.ts +1 -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/datetime-format.ts +12 -3
- package/src/utils/depositary-receipt.ts +28 -3
- package/src/utils/fundamentals.ts +14 -0
- package/src/utils/max-drawdown.ts +97 -16
- package/src/utils/untrusted-text.ts +29 -0
|
@@ -21,15 +21,15 @@ import type {
|
|
|
21
21
|
import type { DataProvider } from "../../types/data-provider";
|
|
22
22
|
import type { PaneDef, PinTickerOptions } from "../../types/plugin";
|
|
23
23
|
import type { BrokerContractRef } from "../../types/instrument";
|
|
24
|
-
import type { TickerRecord } from "../../types/ticker";
|
|
25
24
|
import {
|
|
26
25
|
resolveTickerOpenTarget,
|
|
27
26
|
tickerOpenFailureMessage,
|
|
28
27
|
type TickerOpenTarget,
|
|
29
28
|
} from "../../tickers/open-target";
|
|
30
29
|
import {
|
|
31
|
-
createLocalTickerSearchCandidates,
|
|
32
30
|
findExactTickerSearchMatch,
|
|
31
|
+
normalizeTickerInput,
|
|
32
|
+
savedTickerForQuery,
|
|
33
33
|
upsertTickerFromSearchResult,
|
|
34
34
|
} from "../../tickers/search";
|
|
35
35
|
import { offerTickerListings, publishTickerOpenTarget as publishOpenTarget } from "./ticker-open-target";
|
|
@@ -41,8 +41,11 @@ import { tickerInstrumentLabel } from "../../tickers/instrument-label";
|
|
|
41
41
|
import { markTickerPaneOpening } from "../../state/opening-ticker-panes";
|
|
42
42
|
import { stableStringify } from "../../utils/hash";
|
|
43
43
|
|
|
44
|
+
type LayoutHistoryEntry = AppState["layoutHistory"][number];
|
|
45
|
+
|
|
44
46
|
interface UseAppTickerOpenRuntimeOptions {
|
|
45
|
-
|
|
47
|
+
/** `trackTicker: false` keeps a pane still looking its ticker up out of the recent tickers. */
|
|
48
|
+
activatePane: (paneId: string, options?: { trackTicker?: boolean }) => void;
|
|
46
49
|
buildPaneInstance: (paneType: string, options?: {
|
|
47
50
|
title?: string;
|
|
48
51
|
binding?: PaneBinding;
|
|
@@ -66,6 +69,10 @@ interface PaneAhead {
|
|
|
66
69
|
symbol: string;
|
|
67
70
|
/** The pane focused before it opened, which focus goes back to when nothing opens. */
|
|
68
71
|
sourcePaneId: string | null;
|
|
72
|
+
/** The layout it opened in, its undo history before the open, and that history as the open left it. */
|
|
73
|
+
layoutIndex: number;
|
|
74
|
+
historyBefore: LayoutHistoryEntry;
|
|
75
|
+
historyOpened: LayoutHistoryEntry | undefined;
|
|
69
76
|
stopOpening: () => void;
|
|
70
77
|
}
|
|
71
78
|
|
|
@@ -125,14 +132,6 @@ function findTargetPane(
|
|
|
125
132
|
return { existing, keepBinding };
|
|
126
133
|
}
|
|
127
134
|
|
|
128
|
-
/**
|
|
129
|
-
* Whether the app holds a ticker the key names, so opening it resolves here
|
|
130
|
-
* without a network lookup, as `resolveTickerSearch` reads a saved symbol.
|
|
131
|
-
*/
|
|
132
|
-
function holdsTicker(tickers: ReadonlyMap<string, TickerRecord>, symbol: string): boolean {
|
|
133
|
-
return tickers.has(symbol) || !!findExactTickerSearchMatch(createLocalTickerSearchCandidates(tickers.values()), symbol);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
135
|
/** Whether a pane opened ahead is still in the layout on its key: not closed, nor pointed at another ticker. */
|
|
137
136
|
function isPaneAheadInPlace(layout: LayoutConfig, ahead: PaneAhead): boolean {
|
|
138
137
|
const instance = findPaneInstance(layout, ahead.instanceId);
|
|
@@ -194,7 +193,8 @@ export function useAppTickerOpenRuntime({
|
|
|
194
193
|
|
|
195
194
|
/**
|
|
196
195
|
* Adds a new pane of `paneType` bound to `binding`, floating or docked as
|
|
197
|
-
* asked, and focuses it. `
|
|
196
|
+
* asked, and focuses it. `opening` runs with its id before it is placed, for
|
|
197
|
+
* a pane still looking its ticker up, which stays out of the recent tickers.
|
|
198
198
|
*/
|
|
199
199
|
const addTickerPane = useCallback((
|
|
200
200
|
paneType: string,
|
|
@@ -202,11 +202,11 @@ export function useAppTickerOpenRuntime({
|
|
|
202
202
|
binding: PaneBinding,
|
|
203
203
|
title: string,
|
|
204
204
|
options?: PinTickerOptions,
|
|
205
|
-
|
|
205
|
+
opening?: (instanceId: string) => void,
|
|
206
206
|
): string | null => {
|
|
207
207
|
const instance = buildPaneInstance(paneType, { title, binding });
|
|
208
208
|
if (!instance) return null;
|
|
209
|
-
|
|
209
|
+
opening?.(instance.instanceId);
|
|
210
210
|
|
|
211
211
|
const currentState = stateRef.current;
|
|
212
212
|
const currentLayout = currentState.config.layout;
|
|
@@ -228,7 +228,7 @@ export function useAppTickerOpenRuntime({
|
|
|
228
228
|
if (paneType === TICKER_RESEARCH_PANE_ID && options?.tabId) {
|
|
229
229
|
dispatch({ type: "UPDATE_PANE_STATE", paneId: instance.instanceId, patch: { ...options.tabState, activeTabId: options.tabId } });
|
|
230
230
|
}
|
|
231
|
-
activatePane(instance.instanceId);
|
|
231
|
+
activatePane(instance.instanceId, opening ? { trackTicker: false } : undefined);
|
|
232
232
|
return instance.instanceId;
|
|
233
233
|
}, [activatePane, buildPaneInstance, dispatch, persistLayout, pluginRegistry, stateRef]);
|
|
234
234
|
|
|
@@ -285,16 +285,17 @@ export function useAppTickerOpenRuntime({
|
|
|
285
285
|
* a slow connection), bound to the key as given and marked as opening; the
|
|
286
286
|
* lookup settles it (`settlePaneAhead`). Null when the open waits for the
|
|
287
287
|
* lookup instead: another pane type, a broker contract, a ticker the app
|
|
288
|
-
* holds (it resolves here, at once), or a
|
|
288
|
+
* holds however the key spells it (it resolves here, at once), or a
|
|
289
|
+
* research pane already on the key.
|
|
289
290
|
*/
|
|
290
291
|
const openPaneAhead = useCallback((rawSymbol: string, options?: PinTickerOptions): PaneAhead | null => {
|
|
291
292
|
const paneType = normalizePaneId(options?.paneType ?? TICKER_RESEARCH_PANE_ID);
|
|
292
293
|
const paneDef = pluginRegistry.panes.get(paneType);
|
|
293
|
-
const symbol = rawSymbol
|
|
294
|
+
const symbol = normalizeTickerInput(null, rawSymbol);
|
|
294
295
|
if (paneType !== TICKER_RESEARCH_PANE_ID || !paneDef || !symbol || options?.instrument) return null;
|
|
295
296
|
const state = stateRef.current;
|
|
296
297
|
const layout = state.config.layout;
|
|
297
|
-
if (
|
|
298
|
+
if (savedTickerForQuery(rawSymbol, state.tickers)) return null;
|
|
298
299
|
if (!options?.forceNewPane && layout.instances.some((instance) => instance.paneId === paneType
|
|
299
300
|
&& instance.binding?.kind === "fixed" && instance.binding.symbol === symbol && isPaneInLayout(layout, instance.instanceId))) return null;
|
|
300
301
|
const binding: PaneBinding = {
|
|
@@ -304,13 +305,16 @@ export function useAppTickerOpenRuntime({
|
|
|
304
305
|
...(options?.listing ? { listing: options.listing } : {}),
|
|
305
306
|
};
|
|
306
307
|
const sourcePaneId = state.focusedPaneId;
|
|
308
|
+
const layoutIndex = state.config.activeLayoutIndex;
|
|
309
|
+
const historyBefore = state.layoutHistory[layoutIndex] ?? { past: [], future: [] };
|
|
307
310
|
// Marked before it is placed, so its first frame already says it is loading.
|
|
308
311
|
let stopOpening = () => {};
|
|
309
312
|
const instanceId = addTickerPane(paneType, paneDef, binding, tickerInstrumentLabel(symbol, options?.instrument), options, (id) => {
|
|
310
313
|
stopOpening = markTickerPaneOpening(id);
|
|
311
314
|
});
|
|
312
315
|
if (!instanceId) return null;
|
|
313
|
-
|
|
316
|
+
const historyOpened = stateRef.current.layoutHistory[layoutIndex];
|
|
317
|
+
return { instanceId, symbol, sourcePaneId, layoutIndex, historyBefore, historyOpened, stopOpening };
|
|
314
318
|
}, [addTickerPane, pluginRegistry, stateRef]);
|
|
315
319
|
|
|
316
320
|
/**
|
|
@@ -318,8 +322,9 @@ export function useAppTickerOpenRuntime({
|
|
|
318
322
|
* listing found, or gives way to a pane already showing that listing, or
|
|
319
323
|
* closes when nothing opens (no listing, or a choice of listings the
|
|
320
324
|
* command bar now offers), focus going back where it was. A pane closed or
|
|
321
|
-
* pointed at another ticker meanwhile is left alone.
|
|
322
|
-
*
|
|
325
|
+
* pointed at another ticker meanwhile is left alone. The undo history and
|
|
326
|
+
* the recent tickers end as if the open had waited for the lookup. True
|
|
327
|
+
* when the open landed in a pane.
|
|
323
328
|
*/
|
|
324
329
|
const settlePaneAhead = useCallback((
|
|
325
330
|
ahead: PaneAhead,
|
|
@@ -330,34 +335,57 @@ export function useAppTickerOpenRuntime({
|
|
|
330
335
|
if (target) publishTickerOpenTarget(target);
|
|
331
336
|
const state = stateRef.current;
|
|
332
337
|
const layout = state.config.layout;
|
|
333
|
-
|
|
334
|
-
const focusedHere = state.focusedPaneId === ahead.instanceId;
|
|
338
|
+
const inPlace = isPaneAheadInPlace(layout, ahead);
|
|
339
|
+
const focusedHere = inPlace && state.focusedPaneId === ahead.instanceId;
|
|
335
340
|
const without = removePane(layout, ahead.instanceId);
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
341
|
+
const resolved = target ? targetPaneBinding(target, options) : null;
|
|
342
|
+
const existing = inPlace && target && resolved
|
|
343
|
+
? findTargetPane(state, without, TICKER_RESEARCH_PANE_ID, target, resolved.instrument, options, typed).existing
|
|
344
|
+
: null;
|
|
345
|
+
const instance = findPaneInstance(layout, ahead.instanceId);
|
|
346
|
+
const settled = target && resolved && !existing ? {
|
|
347
|
+
binding: resolved.binding,
|
|
348
|
+
title: inPlace && instance?.title && instance.title !== tickerInstrumentLabel(ahead.symbol, options?.instrument)
|
|
349
|
+
? instance.title
|
|
350
|
+
: tickerInstrumentLabel(target.symbol, resolved.instrument),
|
|
351
|
+
} : null;
|
|
352
|
+
// The steps taken while it loaded hold it on its key. An open that came to nothing leaves
|
|
353
|
+
// no step, and the history it found comes back whole when nothing was done since.
|
|
354
|
+
const settleHistory = () => {
|
|
355
|
+
if (stateRef.current.config.activeLayoutIndex !== ahead.layoutIndex) return;
|
|
356
|
+
const untouched = !settled && state.layoutHistory[ahead.layoutIndex] === ahead.historyOpened;
|
|
357
|
+
dispatch({
|
|
358
|
+
type: "SETTLE_OPENING_PANE",
|
|
359
|
+
settlement: { paneId: ahead.instanceId, symbol: ahead.symbol, settled, ...(untouched ? { before: ahead.historyBefore } : {}) },
|
|
360
|
+
});
|
|
361
|
+
};
|
|
362
|
+
if (!inPlace || !instance) {
|
|
363
|
+
settleHistory();
|
|
339
364
|
return false;
|
|
340
365
|
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
366
|
+
if (!settled) {
|
|
367
|
+
if (existing) {
|
|
368
|
+
persistLayout(without, { pushHistory: false });
|
|
369
|
+
if (options?.tabId) {
|
|
370
|
+
dispatch({ type: "UPDATE_PANE_STATE", paneId: existing.instanceId, patch: { ...options.tabState, activeTabId: options.tabId } });
|
|
371
|
+
}
|
|
372
|
+
if (focusedHere) focusVisiblePane(existing.instanceId, without);
|
|
373
|
+
} else {
|
|
374
|
+
const backTo = ahead.sourcePaneId && isPaneInLayout(without, ahead.sourcePaneId) ? ahead.sourcePaneId : null;
|
|
375
|
+
persistLayout(without, { pushHistory: false, ...(focusedHere ? { focusedPaneId: backTo } : {}) });
|
|
347
376
|
}
|
|
348
|
-
|
|
349
|
-
return
|
|
377
|
+
settleHistory();
|
|
378
|
+
return !!existing;
|
|
350
379
|
}
|
|
351
|
-
|
|
352
|
-
const title = !instance.title || instance.title === tickerInstrumentLabel(ahead.symbol, options?.instrument)
|
|
353
|
-
? tickerInstrumentLabel(target.symbol, instrument)
|
|
354
|
-
: instance.title;
|
|
355
|
-
if (title !== instance.title || stableStringify(instance.binding) !== stableStringify(binding)) {
|
|
380
|
+
if (settled.title !== instance.title || stableStringify(instance.binding) !== stableStringify(settled.binding)) {
|
|
356
381
|
persistLayout({
|
|
357
382
|
...layout,
|
|
358
|
-
instances: layout.instances.map((pane) => pane.instanceId === ahead.instanceId ? { ...pane,
|
|
383
|
+
instances: layout.instances.map((pane) => pane.instanceId === ahead.instanceId ? { ...pane, ...settled } : pane),
|
|
359
384
|
}, { pushHistory: false });
|
|
360
385
|
}
|
|
386
|
+
settleHistory();
|
|
387
|
+
// Focusing it left its key out of the recent tickers; the listing found goes in.
|
|
388
|
+
if (focusedHere && target) dispatch({ type: "TRACK_TICKER", symbol: target.symbol });
|
|
361
389
|
return true;
|
|
362
390
|
}, [dispatch, focusVisiblePane, persistLayout, publishTickerOpenTarget, stateRef]);
|
|
363
391
|
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"src/components/ui/pane-link-chip.tsx": {
|
|
44
44
|
"literals": {
|
|
45
45
|
"font weight": 1,
|
|
46
|
-
"radius":
|
|
46
|
+
"radius": 2,
|
|
47
47
|
"spacing": 2
|
|
48
48
|
},
|
|
49
49
|
"why": "Chat's pane-link chip, moved here unchanged so Ask Gloom's sources draw the same chip; its literals were allowed in chat (its own owner and conventions), and moving it onto the tokens would change every chip in chat."
|
|
@@ -20,6 +20,26 @@ import type {
|
|
|
20
20
|
} from "./types";
|
|
21
21
|
|
|
22
22
|
export const CHART_SERIES_CAPABILITY_KIND = "chart-series";
|
|
23
|
+
|
|
24
|
+
/** Words that ask for a government bond yield. */
|
|
25
|
+
const BOND_YIELD_WORDS = /\b(?:yield|yields|bond|bonds|treasury|treasuries|gilt|gilts|bund|bunds|govt|sovereign|mbono|bono|cetes|prefixado|jgb)\b/i;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* What a chart says of a `CAP:` series nothing answers to, whether no source
|
|
29
|
+
* has its first word or its source has no series by the rest: that it is not
|
|
30
|
+
* covered, and where the nearest series are, never that a plugin or provider
|
|
31
|
+
* should be enabled (none would chart it). A government yield the curves do
|
|
32
|
+
* not carry (`CAP:bond-yield:za-10y`) points at the catalog of those they do
|
|
33
|
+
* and the world grid of 2- and 10-year yields.
|
|
34
|
+
*/
|
|
35
|
+
export function uncoveredCapabilityMessage(capabilityId: string, seriesId?: string): string {
|
|
36
|
+
const name = seriesId ? `${capabilityId}:${seriesId}` : capabilityId;
|
|
37
|
+
const words = name.replace(/[^A-Za-z0-9]+/g, " ");
|
|
38
|
+
const nearest = BOND_YIELD_WORDS.test(words)
|
|
39
|
+
? "The government yields a chart can name are listed by gloom catalog \"10Y government bond\" (CAP:bond-yield:de-10y, UST:10Y); the 2- and 10-year yields of every market GC covers are on gloom fn GC --tab world."
|
|
40
|
+
: "Series a chart can name: SYMBOL, SYMBOL:field, FUT:code, UST:maturity, FRED:series and GEO:series; gloom catalog lists them.";
|
|
41
|
+
return `CAP:${name} is not covered: no chart series is called "${name}". ${nearest}`;
|
|
42
|
+
}
|
|
23
43
|
export const MAX_CHART_SERIES_CATALOG_ITEMS = 32;
|
|
24
44
|
export const MAX_CHART_SERIES_POINTS = 20_000;
|
|
25
45
|
|
|
@@ -351,5 +371,11 @@ export function createChartSeriesResolver(invoker: CapabilityInvoker) {
|
|
|
351
371
|
source.capabilityId,
|
|
352
372
|
"resolve",
|
|
353
373
|
{ seriesId: source.seriesId, viewport } satisfies ChartSeriesResolveRequest,
|
|
354
|
-
)
|
|
374
|
+
).catch((error: unknown) => {
|
|
375
|
+
// No source registered under the id: it is not covered. A source turned off still says to turn it on.
|
|
376
|
+
if (error instanceof Error && error.message === `Capability "${source.capabilityId}" is not available.`) {
|
|
377
|
+
throw new Error(uncoveredCapabilityMessage(source.capabilityId, source.seriesId));
|
|
378
|
+
}
|
|
379
|
+
throw error;
|
|
380
|
+
});
|
|
355
381
|
}
|
|
@@ -44,10 +44,10 @@ export function describeKeybindingsForCli(config: AppConfig): Record<string, unk
|
|
|
44
44
|
* table is the terminal's and the desktop's at once, so an action either has
|
|
45
45
|
* keeps its key.
|
|
46
46
|
*/
|
|
47
|
-
function takenByCoreAction(config: AppConfig, chords: readonly KeyChord[], exceptId?: string): string | null {
|
|
47
|
+
function takenByCoreAction(config: AppConfig, chords: readonly KeyChord[], exceptId?: string, command = false): string | null {
|
|
48
48
|
const resolved = resolveKeybindings(config.keybindings);
|
|
49
49
|
for (const chord of chords) {
|
|
50
|
-
const core = coreActionOnChord(resolved, chord, exceptId);
|
|
50
|
+
const core = coreActionOnChord(resolved, chord, exceptId, { command });
|
|
51
51
|
if (core) return takenChordMessage(formatChordForHost(chord, "terminal"), core);
|
|
52
52
|
}
|
|
53
53
|
return null;
|
|
@@ -87,7 +87,7 @@ export function applyKeybindingCliSet(config: AppConfig, key: string, rawValue:
|
|
|
87
87
|
const chords = [];
|
|
88
88
|
for (const text of value.split(/\s+/)) {
|
|
89
89
|
const chord = parseKeyChord(text);
|
|
90
|
-
if (!chord) return { ok: false, message: `"${text}" is not a key chord. Examples: Ctrl+T, CmdOrCtrl+Shift+F, Alt+
|
|
90
|
+
if (!chord) return { ok: false, message: `"${text}" is not a key chord. Examples: Ctrl+T, CmdOrCtrl+Shift+F, Alt+D, F5, \`` };
|
|
91
91
|
chords.push(chord);
|
|
92
92
|
}
|
|
93
93
|
const taken = takenByCoreAction(config, chords, target);
|
|
@@ -101,7 +101,7 @@ export function applyKeybindingCliSet(config: AppConfig, key: string, rawValue:
|
|
|
101
101
|
|
|
102
102
|
if (section === "commands") {
|
|
103
103
|
const chord = parseKeyChord(target);
|
|
104
|
-
if (!chord) return { ok: false, message: `"${target}" is not a key chord. Examples: Alt+
|
|
104
|
+
if (!chord) return { ok: false, message: `"${target}" is not a key chord. Examples: Alt+D, CmdOrCtrl+Shift+N, F5` };
|
|
105
105
|
if (UNBIND_WORDS.has(value.toLowerCase()) || value === "") {
|
|
106
106
|
return {
|
|
107
107
|
ok: true,
|
|
@@ -112,7 +112,7 @@ export function applyKeybindingCliSet(config: AppConfig, key: string, rawValue:
|
|
|
112
112
|
if (isTypingChord(chord)) {
|
|
113
113
|
return { ok: false, message: `"${target}" would fire while typing; command bindings need Ctrl, Cmd, Alt or a function key.` };
|
|
114
114
|
}
|
|
115
|
-
const taken = takenByCoreAction(config, [chord]);
|
|
115
|
+
const taken = takenByCoreAction(config, [chord], undefined, true);
|
|
116
116
|
if (taken) return { ok: false, message: taken };
|
|
117
117
|
return {
|
|
118
118
|
ok: true,
|
|
@@ -133,7 +133,7 @@ import type { FxInterventionsPayload } from "../../api-client/fx-interventions";
|
|
|
133
133
|
import {
|
|
134
134
|
fxInterventionLatestNote, fxInterventionPair, fxInterventionWindowNote, loadFxInterventions, type FxInterventionPair,
|
|
135
135
|
} from "../../market-data/fx-interventions";
|
|
136
|
-
import { maxDrawdownText } from "../../utils/max-drawdown";
|
|
136
|
+
import { maxDrawdownText, maxRunUp, maxRunUpText } from "../../utils/max-drawdown";
|
|
137
137
|
import { isPastPriceWindow, loadPriceWindowHistory, PRICE_WINDOW_FROM_HELP, PRICE_WINDOW_TO_HELP, priceWindowText, readPriceWindow, type PriceWindow } from "../../utils/price-window";
|
|
138
138
|
import {
|
|
139
139
|
BAR_INTERVAL_LABELS,
|
|
@@ -189,7 +189,7 @@ import { CRYPTO_BOARD_HINT, quoteNotes } from "./crypto-hints";
|
|
|
189
189
|
import { bareFuturesCode, futuresBoardContract, futuresContractByWord } from "../../market-data/futures-board";
|
|
190
190
|
import { commodityNamedIn, commoditySearchName } from "../../market-data/commodity-names";
|
|
191
191
|
import { newsEmptyMessage } from "./news-hints";
|
|
192
|
-
import {
|
|
192
|
+
import { centralBankInNews, centralBankShortNamed } from "../../utils/central-banks";
|
|
193
193
|
import {
|
|
194
194
|
closestStoriesReason,
|
|
195
195
|
commodityNewsRoute,
|
|
@@ -204,6 +204,8 @@ import {
|
|
|
204
204
|
newsSearchTextProblem,
|
|
205
205
|
newestFirst,
|
|
206
206
|
noMetalStoriesMessage,
|
|
207
|
+
searchCentralBankStories,
|
|
208
|
+
centralBankNewsReason,
|
|
207
209
|
noStoriesMessage,
|
|
208
210
|
quotedSearchCommand,
|
|
209
211
|
searchClosestNewsStories,
|
|
@@ -312,8 +314,8 @@ import { answerQuote, errorMessage, notUsTickerSentence } from "../quote-answer"
|
|
|
312
314
|
import { crossRate, describeFxConversion, describeFxLegs, describeFxRate, formatFxRate, FX_USAGE, parseFxArgs, type FxQuotedFigure } from "../fx-pair";
|
|
313
315
|
import {
|
|
314
316
|
describeShortRate,
|
|
317
|
+
shortRateGrowthText,
|
|
315
318
|
formatForwardPoints,
|
|
316
|
-
formatRatePercent,
|
|
317
319
|
formatSignedPercent,
|
|
318
320
|
IMPLIED_FORWARD_LABEL,
|
|
319
321
|
impliedForward,
|
|
@@ -1312,9 +1314,13 @@ function refusedLine(refused: ReadonlyArray<{ input: string }>): string {
|
|
|
1312
1314
|
return `Not ${refused.length === 1 ? "a symbol" : "symbols"}, not quoted: ${refusedList(refused)}.`;
|
|
1313
1315
|
}
|
|
1314
1316
|
|
|
1315
|
-
/**
|
|
1317
|
+
/**
|
|
1318
|
+
* A symbol of a list that names no listing: `Not quoted: EQT:NYSE:US (Unknown exchange US for EQT:NYSE).`, or
|
|
1319
|
+
* after it a reason of several sentences: `Not quoted: iron ore. Iron ore: no live price (...). ...`.
|
|
1320
|
+
*/
|
|
1316
1321
|
function unreadLine({ symbol, error }: { symbol: string; error: ListingArgError }): string {
|
|
1317
|
-
|
|
1322
|
+
const reason = error.message.replace(/\.$/, "");
|
|
1323
|
+
return reason.includes(". ") ? `Not quoted: ${symbol}. ${reason}.` : `Not quoted: ${symbol} (${reason}).`;
|
|
1318
1324
|
}
|
|
1319
1325
|
|
|
1320
1326
|
/**
|
|
@@ -1885,8 +1891,13 @@ async function runHistory(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
1885
1891
|
: { ...column, format: historyVolumeCell(() => missingVolume) });
|
|
1886
1892
|
// The largest fall from a close to a later one in the bars shown, said under the heading: within one contract
|
|
1887
1893
|
// of a continuous future, never from one month's close to another's across a roll.
|
|
1888
|
-
|
|
1894
|
+
// A yield (^TNX) falls and rises by its level, in bp, and its largest rise is said too.
|
|
1895
|
+
const yieldUnits = isYieldIndexSymbol(history.listing.symbol);
|
|
1896
|
+
const contractDrawdown = historyContractDrawdown(data, yieldUnits ? "yield" : "return");
|
|
1889
1897
|
const drawdown = contractDrawdown?.drawdown ?? null;
|
|
1898
|
+
const runUp = yieldUnits ? maxRunUp(data) : null;
|
|
1899
|
+
const moveText = interval ? { basis: `${BAR_INTERVAL_LABELS[interval]} closes${contractDrawdown?.contract ? `, ${contractDrawdown.contract}` : ""}`, price,
|
|
1900
|
+
date: (text: string) => intraday ? formatUtcTime(text) : text.slice(0, 10) } : null;
|
|
1890
1901
|
ctx.printResult({
|
|
1891
1902
|
data,
|
|
1892
1903
|
metadata: {
|
|
@@ -1904,6 +1915,7 @@ async function runHistory(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
1904
1915
|
unbrokenFrom: historyUnbrokenFrom(data) ?? data[0]?.date ?? null,
|
|
1905
1916
|
bars: data.length,
|
|
1906
1917
|
maxDrawdown: drawdown && contractDrawdown?.contract ? { ...drawdown, contract: contractDrawdown.contract } : drawdown,
|
|
1918
|
+
...(runUp ? { maxRunUp: runUp } : {}),
|
|
1907
1919
|
asOf: freshness?.asOf ?? null,
|
|
1908
1920
|
...(volume ? { volumeUnit: volume.unit, volumePeriod: interval === "1d" ? "UTC day" : interval } : {}),
|
|
1909
1921
|
...(stitched ? { backAdjust: { method: backAdjust, rolls: stitched.rolls, ...(stitched.unstitched.length > 0 ? { unstitched: stitched.unstitched } : {}) } } : {}),
|
|
@@ -1912,9 +1924,8 @@ async function runHistory(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
1912
1924
|
freshness,
|
|
1913
1925
|
}, {
|
|
1914
1926
|
heading: [listingHeading(frontMonthIdentity(identity, history.listing.symbol, data)), cliStyles.muted(historyFacts(unit, data).join(" · ")),
|
|
1915
|
-
...drawdown &&
|
|
1916
|
-
|
|
1917
|
-
date: (text) => intraday ? formatUtcTime(text) : text.slice(0, 10) }))] : []].join("\n"),
|
|
1927
|
+
...drawdown && moveText ? [cliStyles.muted(maxDrawdownText(drawdown, moveText))] : [],
|
|
1928
|
+
...runUp && moveText ? [cliStyles.muted(maxRunUpText(runUp, moveText))] : []].join("\n"),
|
|
1918
1929
|
dateKey: "date",
|
|
1919
1930
|
textColumns: [...textColumns, HISTORY_FLAG_TEXT_COLUMN],
|
|
1920
1931
|
// One header whatever the market is doing, for one symbol as for a list (historyExportColumns).
|
|
@@ -2502,7 +2513,7 @@ const newsRowNote = (row: Record<string, unknown>) => typeof row.summary === "st
|
|
|
2502
2513
|
async function printNewsSearch(
|
|
2503
2514
|
text: string,
|
|
2504
2515
|
articles: NewsArticle[],
|
|
2505
|
-
{ reason, empty, commodity = true, failure, ticker = null, closest = false }: {
|
|
2516
|
+
{ reason, empty, commodity = true, failure, ticker = null, closest = false, listing }: {
|
|
2506
2517
|
reason?: string;
|
|
2507
2518
|
empty?: string;
|
|
2508
2519
|
commodity?: boolean;
|
|
@@ -2511,6 +2522,8 @@ async function printNewsSearch(
|
|
|
2511
2522
|
ticker?: string | null;
|
|
2512
2523
|
/** No story has every word: these are the ones with the most. */
|
|
2513
2524
|
closest?: boolean;
|
|
2525
|
+
/** The listing the typed word also names, and how to read its news: a bank's short name ahead of a listing abroad. */
|
|
2526
|
+
listing?: { key: string; note: string };
|
|
2514
2527
|
},
|
|
2515
2528
|
ctx: Parameters<CliCommandDef["execute"]>[1],
|
|
2516
2529
|
) {
|
|
@@ -2521,7 +2534,8 @@ async function printNewsSearch(
|
|
|
2521
2534
|
ctx.printResult({
|
|
2522
2535
|
data: articles,
|
|
2523
2536
|
...(searched ? {} : { warnings: [`Searching stories for "${text}" failed: ${failure}`] }),
|
|
2524
|
-
metadata: { ticker, search: text, feed: null, ...(closestReason ? { match: "closest" } : {}), ...(route ? { futuresNews: route.command } : {})
|
|
2537
|
+
metadata: { ticker, search: text, feed: null, ...(closestReason ? { match: "closest" } : {}), ...(route ? { futuresNews: route.command } : {}),
|
|
2538
|
+
...(listing ? { listing: listing.key } : {}) },
|
|
2525
2539
|
freshness: rowsFreshness(newsRows(articles), cloudNewsFreshness(await cloudRealtimeAccess())),
|
|
2526
2540
|
}, {
|
|
2527
2541
|
heading: newsSearchHeading(text, [reason, closestReason].filter(Boolean).join(" · ") || undefined),
|
|
@@ -2529,6 +2543,7 @@ async function printNewsSearch(
|
|
|
2529
2543
|
columns: NEWS_COLUMNS,
|
|
2530
2544
|
rowNote: newsRowNote,
|
|
2531
2545
|
empty: named ? noStoriesMessage(text, route) : empty ?? (searched ? noStoriesMessage(text, null) : "No stories to show."),
|
|
2546
|
+
...(listing ? { footnote: listing.note } : {}),
|
|
2532
2547
|
});
|
|
2533
2548
|
}
|
|
2534
2549
|
|
|
@@ -2551,8 +2566,8 @@ async function tickerOfWord(word: string, market: MarketContext): Promise<{ symb
|
|
|
2551
2566
|
* name is in capitals, whose company news `news GOLD` keeps.
|
|
2552
2567
|
*/
|
|
2553
2568
|
async function printMetalNews(route: MetalNewsRoute, limit: number, ctx: Parameters<CliCommandDef["execute"]>[1], market?: MarketContext) {
|
|
2554
|
-
const search = searchNewsStories(route.metal, limit, [
|
|
2555
|
-
logFailure("cli.commands-market",
|
|
2569
|
+
const search = searchNewsStories(route.metal, limit, [route.topic]).then((found) => ({ found, failure: undefined }), (error: unknown) => {
|
|
2570
|
+
logFailure("cli.commands-market", `Search ${route.topic} news failed`)(error);
|
|
2556
2571
|
return { found: [] as NewsArticle[], failure: errorMessage(error) ?? "no answer" };
|
|
2557
2572
|
});
|
|
2558
2573
|
const word = route.word;
|
|
@@ -2564,8 +2579,8 @@ async function printMetalNews(route: MetalNewsRoute, limit: number, ctx: Paramet
|
|
|
2564
2579
|
const companyNews = ticker ? `gloom news ${ticker.symbol}` : null;
|
|
2565
2580
|
ctx.printResult({
|
|
2566
2581
|
data: found,
|
|
2567
|
-
...(failure === undefined ? {} : { warnings: [`Searching
|
|
2568
|
-
metadata: { ticker: null, search: route.metal, topics: [
|
|
2582
|
+
...(failure === undefined ? {} : { warnings: [`Searching ${route.label.toLowerCase()} stories for "${route.metal}" failed: ${failure}`] }),
|
|
2583
|
+
metadata: { ticker: null, search: route.metal, topics: [route.topic], feed: null, ...(companyNews ? { companyNews } : {}) },
|
|
2569
2584
|
freshness: rowsFreshness(newsRows(found), cloudNewsFreshness(await cloudRealtimeAccess())),
|
|
2570
2585
|
}, {
|
|
2571
2586
|
heading: metalNewsHeading(route),
|
|
@@ -2588,6 +2603,12 @@ async function runNews(rawArgs: string[], ctx: Parameters<CliCommandDef["execute
|
|
|
2588
2603
|
if (exchangeOption || feed) ctx.fail(`${exchangeOption ? "--exchange" : "--feed"} goes with a symbol, not with text to search stories for.`, "Usage: gloom news <query>");
|
|
2589
2604
|
const problem = newsSearchTextProblem(text);
|
|
2590
2605
|
if (problem) ctx.fail(problem);
|
|
2606
|
+
// "copom selic", "Bank of Mexico": the bank's latest decision stories, under every name it is reported by.
|
|
2607
|
+
const bank = centralBankInNews(text);
|
|
2608
|
+
if (bank) {
|
|
2609
|
+
await printNewsSearch(text, await searchCentralBankStories(bank, limit, text), { reason: centralBankNewsReason(bank), commodity: false }, ctx);
|
|
2610
|
+
return;
|
|
2611
|
+
}
|
|
2591
2612
|
const answer = await searchClosestNewsStories(text, limit);
|
|
2592
2613
|
await printNewsSearch(text, answer.found, { closest: answer.closest }, ctx);
|
|
2593
2614
|
return;
|
|
@@ -2602,6 +2623,28 @@ async function runNews(rawArgs: string[], ctx: Parameters<CliCommandDef["execute
|
|
|
2602
2623
|
await withMarketData(ctx, async (market) => {
|
|
2603
2624
|
const listing = args[0] ? await requireCliListing(args[0], exchangeOption, market, ctx) : null;
|
|
2604
2625
|
const quoteLoad = listing ? loadListingQuote(market.dataProvider, listing) : Promise.resolve(null);
|
|
2626
|
+
// A bank's short name typed on its own (ECB, FED, RBI) is the bank's stories ahead of a listing outside the US
|
|
2627
|
+
// that trades under it (ECB S.A. on the WSE, "No news" on 7 Nov 2026), which its venue still reaches (ECB:WSE).
|
|
2628
|
+
// A US listing (RBA, RB Global) keeps the name.
|
|
2629
|
+
const shortBank = listing && !listing.exchange && !feed && args.length === 1 ? centralBankShortNamed(args[0]!) : null;
|
|
2630
|
+
if (shortBank) {
|
|
2631
|
+
const quote = await quoteLoad;
|
|
2632
|
+
const identity = listingIdentity(listing!, quote);
|
|
2633
|
+
if (!isUsListingExchange(identity.exchange)) {
|
|
2634
|
+
const resolved = quote !== null || identity.name != null;
|
|
2635
|
+
const key = identity.exchange ? `${listing!.symbol}:${identity.exchange}` : null;
|
|
2636
|
+
const typed = args[0]!.trim();
|
|
2637
|
+
const stories = await searchCentralBankStories(shortBank, limit, typed).then((found) => ({ found, failure: undefined }), (error: unknown) => {
|
|
2638
|
+
logFailure("cli.commands-market", "Search a central bank's stories failed")(error);
|
|
2639
|
+
return { found: [], failure: errorMessage(error) ?? "no answer" };
|
|
2640
|
+
});
|
|
2641
|
+
await printNewsSearch(typed, stories.found, {
|
|
2642
|
+
reason: centralBankNewsReason(shortBank), commodity: false, failure: stories.failure,
|
|
2643
|
+
...(resolved && key ? { listing: { key, note: `${typed} is also ${identity.name ?? listing!.symbol} (${identity.exchange}): gloom news ${key}` } } : {}),
|
|
2644
|
+
}, ctx);
|
|
2645
|
+
return;
|
|
2646
|
+
}
|
|
2647
|
+
}
|
|
2605
2648
|
// A coin pair's feed searches for the coin when no story is filed under the pair, by the name its quote gives.
|
|
2606
2649
|
const coin = !!listing && !feed && isRoundTheClockCoin(listing.request.symbol, listing.request.exchange);
|
|
2607
2650
|
const loadNews = async () => market.dataProvider.getNews({
|
|
@@ -2658,13 +2701,16 @@ async function runNews(rawArgs: string[], ctx: Parameters<CliCommandDef["execute
|
|
|
2658
2701
|
return;
|
|
2659
2702
|
}
|
|
2660
2703
|
if (word && reason) {
|
|
2704
|
+
// A central bank's name no ticker answers to ("banxico") is its decision stories, under every name it goes by.
|
|
2705
|
+
const bank = !resolved && !commodity ? centralBankInNews(word) : null;
|
|
2661
2706
|
// The lookup that found no ticker already answered; a search that fails leaves that answer.
|
|
2662
|
-
const search = await searchNewsStories(word, limit).then((found) => ({ found, failure: undefined }), (error: unknown) => {
|
|
2707
|
+
const search = await (bank ? searchCentralBankStories(bank, limit, word) : searchNewsStories(word, limit)).then((found) => ({ found, failure: undefined }), (error: unknown) => {
|
|
2663
2708
|
logFailure("cli.commands-market", "Search news stories failed")(error);
|
|
2664
2709
|
return { found: [], failure: errorMessage(error) ?? "no answer" };
|
|
2665
2710
|
});
|
|
2666
2711
|
const searched = search.failure === undefined;
|
|
2667
|
-
await printNewsSearch(word, search.found, { reason
|
|
2712
|
+
await printNewsSearch(word, search.found, { reason: bank ? `${reason}; ${centralBankNewsReason(bank)}` : reason,
|
|
2713
|
+
empty: emptyMessage(searched && !commodity), commodity: !commodity, failure: search.failure }, ctx);
|
|
2668
2714
|
return;
|
|
2669
2715
|
}
|
|
2670
2716
|
const empty = emptyMessage(false);
|
|
@@ -3636,7 +3682,14 @@ async function runFxOnDate(
|
|
|
3636
3682
|
async function runFx(rawArgs: string[], ctx: Parameters<CliCommandDef["execute"]>[1]) {
|
|
3637
3683
|
const args = [...rawArgs];
|
|
3638
3684
|
const dateOption = takeOption(args, "--date");
|
|
3685
|
+
const forwardAsked = args.some((arg) => arg === "--forward" || arg.startsWith("--forward="));
|
|
3639
3686
|
const forwardOption = takeOption(args, "--forward");
|
|
3687
|
+
// `fx USD/BRL --forward` and `fx --forward USD/BRL` name no tenor: say what --forward takes, never print spot alone
|
|
3688
|
+
// or the bare usage line.
|
|
3689
|
+
if (forwardAsked && (!forwardOption?.trim() || (args.length === 0 && !/^\s*\d/.test(forwardOption)))) {
|
|
3690
|
+
const pair = args.length ? args.join(" ") : forwardOption?.trim() || "<base>/<quote>";
|
|
3691
|
+
ctx.fail("--forward takes a tenor: 30d, 2w, 3m, up to 1y.", `For the 3-month forward: gloom fx ${pair} --forward 3m`);
|
|
3692
|
+
}
|
|
3640
3693
|
if (args.length === 0) ctx.fail(`Usage: gloom ${FX_USAGE}`);
|
|
3641
3694
|
// A forward is implied from today's spot and the latest short rates, which are all Gloom Cloud serves.
|
|
3642
3695
|
if (dateOption != null && forwardOption != null) {
|
|
@@ -3722,7 +3775,8 @@ async function runFx(rawArgs: string[], ctx: Parameters<CliCommandDef["execute"]
|
|
|
3722
3775
|
const forwardDate = new Date(Math.floor(Date.now() / 86_400_000) * 86_400_000 + tenor.days * 86_400_000).toISOString().slice(0, 10);
|
|
3723
3776
|
const rateFields = (short: typeof base.rate) => ({
|
|
3724
3777
|
currency: short.currency, name: short.name, tenor: short.tenor, value: short.value, asOf: short.asOf,
|
|
3725
|
-
dayCountBasis: short.dayCountBasis,
|
|
3778
|
+
dayCountBasis: short.dayCountBasis, ...(short.compounding ? { compounding: short.compounding } : {}),
|
|
3779
|
+
publisher: short.publisher, sourceUrl: short.sourceUrl, stale: short.stale,
|
|
3726
3780
|
...(short.attribution ? { attribution: short.attribution } : {}),
|
|
3727
3781
|
});
|
|
3728
3782
|
// A publisher's licence asks for its attribution wherever its rate is shown (MAS's SORA).
|
|
@@ -3735,7 +3789,8 @@ async function runFx(rawArgs: string[], ctx: Parameters<CliCommandDef["execute"]
|
|
|
3735
3789
|
points: implied.points, pointSize: implied.pointSize, premiumPercent: implied.premiumPercent, annualizedPercent: implied.annualizedPercent,
|
|
3736
3790
|
baseRate: rateFields(base.rate), quoteRate: rateFields(quote.rate), method: "covered interest parity", label: IMPLIED_FORWARD_LABEL,
|
|
3737
3791
|
};
|
|
3738
|
-
const growth = (short: typeof base.rate) =>
|
|
3792
|
+
const growth = (short: typeof base.rate) => shortRateGrowthText(short, tenor.days);
|
|
3793
|
+
const compounded = [base.rate, quote.rate].filter((short) => short.compounding === "business-252").map((short) => short.name);
|
|
3739
3794
|
// A currency typed as its name (yen) says which code it was read as, as the spot answer does.
|
|
3740
3795
|
const forwardWarnings = [...request.readAs ?? [], ...rateNotes, ...staleRates];
|
|
3741
3796
|
return ctx.printResult({ data: [forwardRow], freshness, ...(forwardWarnings.length > 0 ? { warnings: forwardWarnings } : {}) }, {
|
|
@@ -3744,7 +3799,9 @@ async function runFx(rawArgs: string[], ctx: Parameters<CliCommandDef["execute"]
|
|
|
3744
3799
|
`Spot ${formatFxRate(rate)} · forward points ${formatForwardPoints(implied.points)} (pips of ${implied.pointSize}) · ${implied.premiumPercent >= 0 ? "premium" : "discount"} ${formatSignedPercent(implied.premiumPercent)} over ${tenor.days} days to ${forwardDate}, ${formatSignedPercent(implied.annualizedPercent, 2)} a year (×360/${tenor.days})`,
|
|
3745
3800
|
`${currency} rate: ${describeShortRate(base.rate)}`,
|
|
3746
3801
|
`${baseCurrency} rate: ${describeShortRate(quote.rate)}`,
|
|
3747
|
-
`Covered interest parity: ${formatFxRate(rate)} × ${growth(quote.rate)} / ${growth(base.rate)};
|
|
3802
|
+
`Covered interest parity: ${formatFxRate(rate)} × ${growth(quote.rate)} / ${growth(base.rate)}; ${compounded.length > 0
|
|
3803
|
+
? `${compounded.join(" and ")} compounds over business days (252 a year, taken as 252/365 of the ${tenor.days} days), the other rate earns simple interest`
|
|
3804
|
+
: `each rate earns simple interest over the ${tenor.days} days`}, standing in for a ${tenor.label} term rate.`,
|
|
3748
3805
|
...attributions,
|
|
3749
3806
|
].join("\n"),
|
|
3750
3807
|
exportIdentity: { symbolOrSeries: pair, currencyOrUnit: `${baseCurrency} per ${currency}`, interval: `forward ${tenor.label}` },
|
|
@@ -3935,7 +3992,7 @@ export const marketDataCliCommands: BuiltinCliCommandDef[] = [
|
|
|
3935
3992
|
`Each range comes in one bar size: ${historyIntervalsByRange()}. The line under the heading, and the --json metadata, give the currency, the bar size actually served, the first and last bar and the bar count. A warning says when the bars are coarser, or start later, than the range asked for, and for a coin, which trades every day, names each day it has no bar for.`,
|
|
3936
3993
|
"A bar whose prices contradict each other (high below the open or close, or low above them) is left blank and flagged, such as high<open, with the count in a warning. A low under half the open and close, or a high over twice them, is left blank alone and flagged low<close/2 or high>2*open. --json rows carry currency, unit, interval and flag.",
|
|
3937
3994
|
"A break in the series flags the bar after it, which keeps its prices: gap after more than three months with no bar (weeks for weekly, daily and intraday bars), jump when the close is over 100 times the one before or under a hundredth of it. A warning names each break, and the heading says the date the series runs unbroken from.",
|
|
3938
|
-
"The heading's last line is the max drawdown of the bars shown: the largest fall from a close to a later close, with the peak and the trough, their dates, and the date a close got back to the peak, if one did (maxDrawdown in --json).",
|
|
3995
|
+
"The heading's last line is the max drawdown of the bars shown: the largest fall from a close to a later close, with the peak and the trough, their dates, and the date a close got back to the peak, if one did (maxDrawdown in --json). A yield (^TNX) reads it in bp, with its max run-up beside it: the largest rise from a close to a later close, found on its own (maxRunUp).",
|
|
3939
3996
|
],
|
|
3940
3997
|
}, {
|
|
3941
3998
|
title: "CSV",
|