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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { apiClient } from "../../api-client";
|
|
2
2
|
import type { NewsArticle } from "../../news/types";
|
|
3
|
-
import { mapCloudNewsArticle } from "../../sources/gloomberb-cloud/news";
|
|
3
|
+
import { ENERGY_NEWS_TOPIC, mapCloudNewsArticle, METALS_NEWS_TOPIC } from "../../sources/gloomberb-cloud/news";
|
|
4
|
+
import { centralBankNewsQueries, centralBankNewsTopic, storyNamesCentralBank, type CentralBank } from "../../utils/central-banks";
|
|
4
5
|
import { cliStyles } from "../../utils/cli-output";
|
|
5
6
|
import { logFailure } from "../../utils/log-failure";
|
|
6
7
|
import { commodityNamedIn, commoditySearchName, isCommodityName } from "../../market-data/commodity-names";
|
|
@@ -126,15 +127,27 @@ export function closestStoriesReason(text: string): string {
|
|
|
126
127
|
|
|
127
128
|
/** A metal's market news, for what `news` was given: its name, its future, or its board code. */
|
|
128
129
|
export interface MetalNewsRoute {
|
|
129
|
-
/** The metal the stories are searched for, in METALS: "gold". */
|
|
130
|
+
/** The metal the stories are searched for, in METALS: "gold"; for oil, in ENERGY. */
|
|
130
131
|
metal: string;
|
|
131
132
|
contract: FuturesContract;
|
|
132
133
|
/** Why what was typed reads as the metal, under the heading; null for the metal's own name. */
|
|
133
134
|
reason: string | null;
|
|
134
135
|
/** The name as typed, which in capitals may be a ticker too ("gold", GOLD for Gold.com Inc.). */
|
|
135
136
|
word: string | null;
|
|
137
|
+
/** The market's stories the search is kept to: METALS, or ENERGY for oil. */
|
|
138
|
+
topic: string;
|
|
139
|
+
/** What the heading calls those stories: "Metals", "Energy". */
|
|
140
|
+
label: string;
|
|
136
141
|
}
|
|
137
142
|
|
|
143
|
+
/**
|
|
144
|
+
* The words that are the oil market, searched in its energy stories as a
|
|
145
|
+
* metal's name is in METALS: "oil" otherwise found Oil India's stories under
|
|
146
|
+
* the iPath ETN that trades as OIL, and stories that name oil are mostly
|
|
147
|
+
* companies'. Brent, gas and the rest keep their futures route.
|
|
148
|
+
*/
|
|
149
|
+
const ENERGY_MARKET_WORDS: ReadonlySet<string> = new Set(["oil", "crude"]);
|
|
150
|
+
|
|
138
151
|
/**
|
|
139
152
|
* A metal's market news for a metal's future (GC=F, SI=F, HG=F, PL=F, PA=F,
|
|
140
153
|
* ALI=F) or its name typed as a word (gold, Silver, copper): news filed under
|
|
@@ -148,30 +161,69 @@ export function metalNewsRoute(typed: string): MetalNewsRoute | null {
|
|
|
148
161
|
if (/=F$/i.test(text)) {
|
|
149
162
|
const contract = futuresBoardContract(text);
|
|
150
163
|
const metal = contract?.sector === "metals" ? commoditySearchName(contract) : null;
|
|
151
|
-
return contract && metal ? { metal, contract, reason: `the commodity ${contract.symbol} trades`, word: null } : null;
|
|
164
|
+
return contract && metal ? { metal, contract, reason: `the commodity ${contract.symbol} trades`, word: null, ...METALS_MARKET } : null;
|
|
152
165
|
}
|
|
153
166
|
if (!/^\p{L}{3,}$/u.test(text) || !/\p{Ll}/u.test(text)) return null;
|
|
154
167
|
// One word of letters: the metal's names are one word each (gold, aluminium).
|
|
155
168
|
const contract = commodityNamedIn(text);
|
|
156
|
-
|
|
169
|
+
if (contract?.sector === "metals") return { metal: text.toLowerCase(), contract, reason: null, word: text, ...METALS_MARKET };
|
|
170
|
+
return contract?.sector === "energy" && ENERGY_MARKET_WORDS.has(text.toLowerCase())
|
|
171
|
+
? { metal: text.toLowerCase(), contract, reason: null, word: text, ...ENERGY_MARKET } : null;
|
|
157
172
|
}
|
|
158
173
|
|
|
174
|
+
const METALS_MARKET = { topic: METALS_NEWS_TOPIC, label: "Metals" } as const;
|
|
175
|
+
const ENERGY_MARKET = { topic: ENERGY_NEWS_TOPIC, label: "Energy" } as const;
|
|
176
|
+
|
|
159
177
|
/** A metal's market news for its board code typed bare (GC, SI, HG) where no listing answers to it. */
|
|
160
178
|
export function metalCodeNewsRoute(typed: string): MetalNewsRoute | null {
|
|
161
179
|
const code = typed.trim().toUpperCase();
|
|
162
180
|
const contract = /^[A-Z]{2,3}$/.test(code) ? futuresBoardContract(code) : null;
|
|
163
181
|
const metal = contract?.sector === "metals" ? commoditySearchName(contract) : null;
|
|
164
|
-
return contract && metal ? { metal, contract, reason: `${code} is the futures board's code for ${contract.name}`, word: null } : null;
|
|
182
|
+
return contract && metal ? { metal, contract, reason: `${code} is the futures board's code for ${contract.name}`, word: null, ...METALS_MARKET } : null;
|
|
165
183
|
}
|
|
166
184
|
|
|
167
185
|
/** The line above a metal's market news: "Metals news matching "gold"", with why what was typed reads as the metal. */
|
|
168
186
|
export function metalNewsHeading(route: MetalNewsRoute): string {
|
|
169
|
-
return `${cliStyles.bold(
|
|
187
|
+
return `${cliStyles.bold(`${route.label} news matching "${route.metal}"`)}${route.reason ? cliStyles.muted(` · ${route.reason}`) : ""}`;
|
|
170
188
|
}
|
|
171
189
|
|
|
172
190
|
/** What a metal's market news says when no story is tagged METALS: every story that names it is one search away. */
|
|
173
191
|
export function noMetalStoriesMessage(route: MetalNewsRoute): string {
|
|
174
|
-
return `No
|
|
192
|
+
return `No ${route.label.toLowerCase()} stories match "${route.metal}". For every story that mentions it, try: ${quotedSearchCommand(route.metal)}`;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* A central bank's latest decision stories, for its name or the committee and
|
|
197
|
+
* rate its decisions go by (`centralBankInNews`): the text as typed and every
|
|
198
|
+
* name it is reported under (`centralBankNewsQueries`), each with what else
|
|
199
|
+
* the text asks (`centralBankNewsTopic`: "rate cut" of "fed rate cut"),
|
|
200
|
+
* searched at once, newest first, and only the stories that name the bank.
|
|
201
|
+
* "banxico" alone found May's cut, not November's, reported as the Bank of
|
|
202
|
+
* Mexico's. Fails only when every search failed.
|
|
203
|
+
*/
|
|
204
|
+
export async function searchCentralBankStories(bank: CentralBank, limit: number, typed = ""): Promise<NewsArticle[]> {
|
|
205
|
+
const topic = centralBankNewsTopic(bank, typed);
|
|
206
|
+
const queries = new Map<string, string>();
|
|
207
|
+
for (const query of [typed.trim(), ...centralBankNewsQueries(bank).map((name) => topic ? `${name} ${topic}` : name)]) {
|
|
208
|
+
if (query && !queries.has(query.toLowerCase())) queries.set(query.toLowerCase(), query);
|
|
209
|
+
}
|
|
210
|
+
const answers = await Promise.allSettled([...queries.values()].map((query) => searchNewsStories(query, limit)));
|
|
211
|
+
const found = answers.flatMap((answer) => answer.status === "fulfilled" ? answer.value : []);
|
|
212
|
+
const failed = answers.find((answer): answer is PromiseRejectedResult => answer.status === "rejected");
|
|
213
|
+
if (failed && answers.every((answer) => answer.status === "rejected")) throw failed.reason;
|
|
214
|
+
const seen = new Set<string>();
|
|
215
|
+
const unique = found.filter((article) => {
|
|
216
|
+
const key = article.id || article.url;
|
|
217
|
+
if (seen.has(key) || !storyNamesCentralBank(bank, `${article.title} ${article.summary ?? ""}`)) return false;
|
|
218
|
+
seen.add(key);
|
|
219
|
+
return true;
|
|
220
|
+
});
|
|
221
|
+
return newestFirst(unique).slice(0, limit);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/** What the heading says of a central bank's stories: "the Bank of Mexico's stories, under each name it is reported by". */
|
|
225
|
+
export function centralBankNewsReason(bank: CentralBank): string {
|
|
226
|
+
return `the ${bank.name}'s stories, under each name it is reported by`;
|
|
175
227
|
}
|
|
176
228
|
|
|
177
229
|
/** The futures news route a search offers when no story matches it: `gloom news KC=F` for "arabica". */
|
|
@@ -44,6 +44,7 @@ import {
|
|
|
44
44
|
eventCountry,
|
|
45
45
|
matchesCountry,
|
|
46
46
|
matchesEventSearch,
|
|
47
|
+
policyDecisionsNamed,
|
|
47
48
|
matchesImpact,
|
|
48
49
|
NO_CONSENSUS_NOTE,
|
|
49
50
|
noScheduledReleasesMessage,
|
|
@@ -409,6 +410,19 @@ function econEmptyMessage(from: string | null, listedThrough: string | null, sto
|
|
|
409
410
|
: `No matching events${range} through ${listedThrough}.`;
|
|
410
411
|
}
|
|
411
412
|
|
|
413
|
+
/**
|
|
414
|
+
* What an empty search for a bank's own names could mean: `selic` is the
|
|
415
|
+
* Copom's decision, none of which falls in the window, and CBR has the rate
|
|
416
|
+
* and its next decision. Only a bank of the countries asked for; null for
|
|
417
|
+
* any other search.
|
|
418
|
+
*/
|
|
419
|
+
function policyDecisionHint(search: string, countries: string): string | null {
|
|
420
|
+
const named = policyDecisionsNamed(search, countries);
|
|
421
|
+
if (named.length === 0) return null;
|
|
422
|
+
const events = named.map(({ country, event }) => `${event} (${country})`).join(", ");
|
|
423
|
+
return `"${search}" is the ${events}; none falls in this window. The rate and its next decision: gloom fn CBR.`;
|
|
424
|
+
}
|
|
425
|
+
|
|
412
426
|
/**
|
|
413
427
|
* A date option, read as an ISO date; null when it was not given. `expand`
|
|
414
428
|
* reads a shorthand as a full date first, and `form` is how the message names
|
|
@@ -592,7 +606,8 @@ async function runEcon(args: string[], ctx: Parameters<CliCommandDef["execute"]>
|
|
|
592
606
|
}, {
|
|
593
607
|
dateKey: "date",
|
|
594
608
|
defaultLimit: 50,
|
|
595
|
-
empty: allUnscheduled ? noScheduledReleasesMessage(unscheduled)
|
|
609
|
+
empty: allUnscheduled ? noScheduledReleasesMessage(unscheduled)
|
|
610
|
+
: [econEmptyMessage(from, listedThrough, listedAfter != null), search == null ? null : policyDecisionHint(search, country)].filter(Boolean).join(" "),
|
|
596
611
|
...(footnote ? { footnote } : {}),
|
|
597
612
|
// What the text says under the table, a script reads in the CSV's closing lines.
|
|
598
613
|
exportNotes: notes,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { getDataDir } from "../../data/config/store";
|
|
2
2
|
import type { CliCommandContext } from "../../types/plugin";
|
|
3
|
-
import { sendRemoteControlRequest } from "../../remote/client";
|
|
3
|
+
import { RemoteAppError, RemoteAppNotRunningError, sendRemoteControlRequest } from "../../remote/client";
|
|
4
4
|
import type { RemoteAppKind, RemoteControlRequest, RemoteControlResponse } from "../../remote/types";
|
|
5
5
|
import { CLI_COMMAND_GROUPS } from "../help";
|
|
6
6
|
import type { BuiltinCliCommandDef } from "../command-options";
|
|
7
|
+
import { failWithError } from "../errors";
|
|
7
8
|
|
|
8
9
|
interface RemoteArgs {
|
|
9
10
|
args: string[];
|
|
@@ -34,7 +35,7 @@ export const remoteCliCommand: BuiltinCliCommandDef = {
|
|
|
34
35
|
{ flags: "--interval <ms>", description: "How often watch polls, at least 100 (default 1000)" },
|
|
35
36
|
{ flags: "--dry-run", description: "Check a call, patch, or batch without applying it" },
|
|
36
37
|
],
|
|
37
|
-
examples: ["remote
|
|
38
|
+
examples: ["remote help", "remote get app://snapshot", "remote get app://form", "remote watch app://layout/current --limit 5"],
|
|
38
39
|
},
|
|
39
40
|
execute: async (rawArgs, ctx) => {
|
|
40
41
|
const parsed = parseRemoteArgs(rawArgs);
|
|
@@ -46,10 +47,12 @@ export const remoteCliCommand: BuiltinCliCommandDef = {
|
|
|
46
47
|
|
|
47
48
|
// No data folder means this profile never opened the app, so none is running to drive.
|
|
48
49
|
const dataDir = await getDataDir();
|
|
49
|
-
if (!dataDir)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
if (!dataDir) failToReachApp(new RemoteAppNotRunningError(parsed.appKind));
|
|
51
|
+
const send = (request: RemoteControlRequest) => sendRemoteControlRequest(request, { dataDir, appKind: parsed.appKind })
|
|
52
|
+
.catch((error: unknown) => {
|
|
53
|
+
if (error instanceof RemoteAppError) failToReachApp(error);
|
|
54
|
+
throw error;
|
|
55
|
+
});
|
|
53
56
|
|
|
54
57
|
if (action === "watch") {
|
|
55
58
|
const resource = parsed.args[1];
|
|
@@ -59,25 +62,21 @@ export const remoteCliCommand: BuiltinCliCommandDef = {
|
|
|
59
62
|
}
|
|
60
63
|
const limit = ctx.cliOptions.limit ?? Number.POSITIVE_INFINITY;
|
|
61
64
|
for (let index = 0; index < limit; index += 1) {
|
|
62
|
-
|
|
63
|
-
dataDir,
|
|
64
|
-
appKind: parsed.appKind,
|
|
65
|
-
});
|
|
66
|
-
printRemoteResponse(response, ctx);
|
|
65
|
+
printRemoteResponse(await send({ type: "get", resource }), ctx);
|
|
67
66
|
if (index < limit - 1) await new Promise((resolve) => setTimeout(resolve, parsed.intervalMs));
|
|
68
67
|
}
|
|
69
68
|
return;
|
|
70
69
|
}
|
|
71
70
|
|
|
72
|
-
|
|
73
|
-
const response = await sendRemoteControlRequest(request, {
|
|
74
|
-
dataDir,
|
|
75
|
-
appKind: parsed.appKind,
|
|
76
|
-
});
|
|
77
|
-
printRemoteResponse(response, ctx);
|
|
71
|
+
printRemoteResponse(await send(buildRemoteRequest(action, parsed, ctx.cliOptions.dryRun)), ctx);
|
|
78
72
|
},
|
|
79
73
|
};
|
|
80
74
|
|
|
75
|
+
/** No app answers, two do, or one cannot be reached from here: with how to start one, which to pick, or what may block it. */
|
|
76
|
+
function failToReachApp(error: RemoteAppError): never {
|
|
77
|
+
return failWithError({ code: error.code, message: error.message, details: error.details });
|
|
78
|
+
}
|
|
79
|
+
|
|
81
80
|
function parseRemoteArgs(rawArgs: string[]): RemoteArgs {
|
|
82
81
|
const args: string[] = [];
|
|
83
82
|
let appKind: RemoteAppKind | undefined;
|
|
@@ -283,7 +283,7 @@ export function createSystemCliCommands(): CliCommandDef[] {
|
|
|
283
283
|
"config set timezone Asia/Tokyo",
|
|
284
284
|
"config get keybindings",
|
|
285
285
|
"config set keybindings.actions.ticker-search \"Ctrl+T\"",
|
|
286
|
-
"config set keybindings.commands.Alt+
|
|
286
|
+
"config set keybindings.commands.Alt+D \"DES AAPL\"",
|
|
287
287
|
],
|
|
288
288
|
},
|
|
289
289
|
execute: async (args, ctx) => {
|
package/src/cli/fx-forward.ts
CHANGED
|
@@ -72,11 +72,10 @@ export interface ImpliedForward {
|
|
|
72
72
|
export function impliedForward(
|
|
73
73
|
spot: number,
|
|
74
74
|
days: number,
|
|
75
|
-
base: Pick<CloudShortRate, "dayCountBasis"> & { value: number },
|
|
76
|
-
quote: Pick<CloudShortRate, "dayCountBasis"> & { value: number; currency: string },
|
|
75
|
+
base: Pick<CloudShortRate, "dayCountBasis" | "compounding"> & { value: number },
|
|
76
|
+
quote: Pick<CloudShortRate, "dayCountBasis" | "compounding"> & { value: number; currency: string },
|
|
77
77
|
): ImpliedForward {
|
|
78
|
-
const
|
|
79
|
-
const forward = spot * growth(quote) / growth(base);
|
|
78
|
+
const forward = spot * shortRateGrowth(quote, days) / shortRateGrowth(base, days);
|
|
80
79
|
const pointSize = forwardPointSize(quote.currency);
|
|
81
80
|
const premiumPercent = (forward / spot - 1) * 100;
|
|
82
81
|
return {
|
|
@@ -89,6 +88,24 @@ export function impliedForward(
|
|
|
89
88
|
};
|
|
90
89
|
}
|
|
91
90
|
|
|
91
|
+
/**
|
|
92
|
+
* What one unit grows to over `days` at a short rate: simple interest on its
|
|
93
|
+
* day count, or, for a rate compounded over 252 business days (CDI),
|
|
94
|
+
* (1 + r)^(days / 365), business days taken as 252/365 of the calendar days.
|
|
95
|
+
*/
|
|
96
|
+
function shortRateGrowth(rate: Pick<CloudShortRate, "dayCountBasis" | "compounding"> & { value: number }, days: number): number {
|
|
97
|
+
return rate.compounding === "business-252"
|
|
98
|
+
? (1 + rate.value / 100) ** (days / 365)
|
|
99
|
+
: 1 + (rate.value / 100) * days / rate.dayCountBasis;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** `(1 + 3.92% × 92/360)`, or `(1 + 13.65%)^(92/365)` for a compounded rate: one leg of the parity, as `fx --forward` prints it. */
|
|
103
|
+
export function shortRateGrowthText(rate: Pick<CloudShortRate, "dayCountBasis" | "compounding"> & { value: number }, days: number): string {
|
|
104
|
+
return rate.compounding === "business-252"
|
|
105
|
+
? `(1 + ${formatRatePercent(rate.value)})^(${days}/365)`
|
|
106
|
+
: `(1 + ${formatRatePercent(rate.value)} × ${days}/${rate.dayCountBasis})`;
|
|
107
|
+
}
|
|
108
|
+
|
|
92
109
|
/** A rate the forward can use: listed for the currency, with a value. */
|
|
93
110
|
export type ShortRateLookup = { rate: CloudShortRate & { value: number } } | { error: string };
|
|
94
111
|
|
|
@@ -109,7 +126,7 @@ export function shortRateFor(currency: string, rates: readonly CloudShortRate[])
|
|
|
109
126
|
}
|
|
110
127
|
|
|
111
128
|
/** `6.776%`: a rate as its publisher prints it, to four decimals at most. */
|
|
112
|
-
|
|
129
|
+
function formatRatePercent(value: number): string {
|
|
113
130
|
return `${Number(value.toFixed(4))}%`;
|
|
114
131
|
}
|
|
115
132
|
|
|
@@ -124,7 +141,8 @@ export function formatForwardPoints(points: number): string {
|
|
|
124
141
|
return `${points >= 0 ? "+" : ""}${points.toFixed(1)}`;
|
|
125
142
|
}
|
|
126
143
|
|
|
127
|
-
/** `TIIE 28d 6.776% (Banco de México, 2026-10-20; ACT/360)`. */
|
|
144
|
+
/** `TIIE 28d 6.776% (Banco de México, 2026-10-20; ACT/360)`, `CDI 13.65% (Banco Central do Brasil, 2026-11-05; BUS/252 compounded)`. */
|
|
128
145
|
export function describeShortRate(rate: CloudShortRate & { value: number }): string {
|
|
129
|
-
|
|
146
|
+
const basis = rate.compounding === "business-252" ? "BUS/252 compounded" : `ACT/${rate.dayCountBasis}`;
|
|
147
|
+
return `${rate.name} ${formatRatePercent(rate.value)} (${rate.publisher}, ${rate.asOf ?? "undated"}; ${basis})`;
|
|
130
148
|
}
|
package/src/cli/glossary.ts
CHANGED
|
@@ -66,15 +66,17 @@ export const GLOSSARY: readonly GlossaryEntry[] = [
|
|
|
66
66
|
+ "Every winning bid is filled at it; for TIPS it is a real yield.",
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
|
-
term: "Stop-out vs
|
|
70
|
-
shown: ["Stop-out vs
|
|
71
|
-
definition: "The high (stop-out) yield minus the auction's
|
|
69
|
+
term: "Stop-out vs median", aliases: ["stop-out vs med", "vs med", "stop-out vs average", "stop-out vs avg", "vs avg"], functions: ["AUCT"],
|
|
70
|
+
shown: ["Stop-out vs median", "Stop-out vs average", "Stop-out vs average/median", "VS MED", "VS AVG", "VS AVG/MED"],
|
|
71
|
+
definition: "The high (stop-out) yield minus the auction's median yield, in basis points; bills compare discount rates. "
|
|
72
|
+
+ "Treasury has sold at a single price since November 1998 and publishes the median accepted bid; before, most auctions "
|
|
73
|
+
+ "were multiple-price and the figure is the average, so older auctions read stop-out vs average. "
|
|
72
74
|
+ "A wider gap means the last accepted bids cleared well above where most of the auction priced.",
|
|
73
75
|
},
|
|
74
76
|
{
|
|
75
77
|
term: "Tail", aliases: ["tailed", "tailing", "auction tail"], functions: ["AUCT"], shown: ["tail"],
|
|
76
78
|
definition: "How far an auction's high yield cleared above the when-issued yield at the 1 pm bid deadline; a tail reads as weak demand. "
|
|
77
|
-
+ "AUCT cannot show one, as its source has no when-issued yields, so it shows stop-out vs
|
|
79
|
+
+ "AUCT cannot show one, as its source has no when-issued yields, so it shows stop-out vs median instead.",
|
|
78
80
|
},
|
|
79
81
|
{
|
|
80
82
|
term: "When-issued", short: "WI", aliases: ["when issued", "wi yield", "when-issued yield"], functions: ["AUCT"],
|
|
@@ -87,6 +89,18 @@ export const GLOSSARY: readonly GlossaryEntry[] = [
|
|
|
87
89
|
definition: "A bill's yield at the highest accepted (stop-out) rate, restated as a bond-equivalent yield so it compares with "
|
|
88
90
|
+ "note yields. It reads higher than the bill's discount rate.",
|
|
89
91
|
},
|
|
92
|
+
{
|
|
93
|
+
term: "Discount rate", aliases: ["bank discount rate", "high discount rate", "discount yield"], functions: ["AUCT"],
|
|
94
|
+
shown: ["Discount rate"],
|
|
95
|
+
definition: "How a bill is bid and quoted: the discount from face value as an annual rate on a 360-day year. "
|
|
96
|
+
+ "The auction's high discount rate is the one its investment rate restates.",
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
term: "Auction percentile", aliases: ["b/c percentile", "b/c pctl", "indirect percentile", "dealer percentile"], functions: ["AUCT"],
|
|
100
|
+
shown: ["B/C pctl", "Indirect pctl", "Dealer pctl"],
|
|
101
|
+
definition: "Where an auction's bid-to-cover, indirect or dealer share ranks among the previous 24 auctions of the same "
|
|
102
|
+
+ "tenor and type, from 0 (the lowest) to 100 (the highest). Blank with fewer than 12 before it.",
|
|
103
|
+
},
|
|
90
104
|
{
|
|
91
105
|
term: "High discount margin", aliases: ["discount margin", "frn margin"], functions: ["AUCT"],
|
|
92
106
|
shown: ["High discount margin", "FRN"],
|
|
@@ -1005,7 +1019,7 @@ export interface GlossaryLookup {
|
|
|
1005
1019
|
/** The entries the query names: by the term, its abbreviation or an alias. */
|
|
1006
1020
|
exact: GlossaryEntry[];
|
|
1007
1021
|
/**
|
|
1008
|
-
* The others whose names hold each word of the query: `stop-out` finds stop-out vs
|
|
1022
|
+
* The others whose names hold each word of the query: `stop-out` finds stop-out vs median. Beside a term the
|
|
1009
1023
|
* query names they hold the words whole; otherwise a word start is enough, and the whole ones come first.
|
|
1010
1024
|
*/
|
|
1011
1025
|
partial: GlossaryEntry[];
|
package/src/cli/history-rows.ts
CHANGED
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
isWickFlag, latestTradeIndex, missingVolumeNotice, pricePointIntegrityFlags, pricePointValues, pricePointWickFlags,
|
|
20
20
|
} from "../utils/price-history-integrity";
|
|
21
21
|
import { formatUtcTime } from "../utils/utc-time";
|
|
22
|
-
import { maxDrawdown, type MaxDrawdown } from "../utils/max-drawdown";
|
|
22
|
+
import { maxDrawdown, type DrawdownScale, type MaxDrawdown } from "../utils/max-drawdown";
|
|
23
23
|
import { historyCoverageNotice } from "../sources/history-coverage";
|
|
24
24
|
import { barLastSession, barPeriodToDate, type BarPeriodToDate } from "../market-data/market/bar-period";
|
|
25
25
|
import { barSizeFromGap, medianBarGap } from "../time-series/bar-spacing";
|
|
@@ -486,12 +486,14 @@ function historyContractRuns<Row extends Pick<HistoryRow, "contract" | "roll">>(
|
|
|
486
486
|
*/
|
|
487
487
|
export function historyContractDrawdown(
|
|
488
488
|
rows: readonly Pick<HistoryRow, "date" | "close" | "contract" | "roll">[],
|
|
489
|
+
scale: DrawdownScale = "return",
|
|
489
490
|
): { drawdown: MaxDrawdown; contract: string | null } | null {
|
|
490
491
|
const runs = historyContractRuns(rows);
|
|
491
492
|
let deepest: { drawdown: MaxDrawdown; contract: string | null } | null = null;
|
|
493
|
+
const depth = (drawdown: MaxDrawdown) => drawdown.bp ?? drawdown.drawdown;
|
|
492
494
|
for (const run of runs) {
|
|
493
|
-
const drawdown = maxDrawdown(run.rows);
|
|
494
|
-
if (drawdown && (!deepest || drawdown
|
|
495
|
+
const drawdown = maxDrawdown(run.rows, scale);
|
|
496
|
+
if (drawdown && (!deepest || depth(drawdown) < depth(deepest.drawdown))) deepest = { drawdown, contract: runs.length > 1 ? run.contract : null };
|
|
495
497
|
}
|
|
496
498
|
return deepest;
|
|
497
499
|
}
|
package/src/cli/known-gaps.ts
CHANGED
|
@@ -98,7 +98,14 @@ export const MUNI_LINE = "Municipal bonds: no AAA muni curve (MMD and BVAL are l
|
|
|
98
98
|
* carriers"). An entry without `words` matches the whole query alone, since
|
|
99
99
|
* its terms are words of company names too ("carbon", "second").
|
|
100
100
|
*/
|
|
101
|
-
const KNOWN_GAPS: ReadonlyArray<{
|
|
101
|
+
const KNOWN_GAPS: ReadonlyArray<{
|
|
102
|
+
terms: readonly string[];
|
|
103
|
+
words?: readonly string[];
|
|
104
|
+
tickers?: readonly string[];
|
|
105
|
+
/** A price the terminal has none of: where a ticker goes, the query answers this line rather than a company's name holding its words. */
|
|
106
|
+
unquoted?: boolean;
|
|
107
|
+
message: string;
|
|
108
|
+
}> = [
|
|
102
109
|
{
|
|
103
110
|
terms: ["EUA", "EUAs", "EU ETS", "EU allowance", "EU allowances", "EU carbon", "carbon", "carbon allowance", "carbon allowances",
|
|
104
111
|
"carbon price", "carbon prices", "carbon credits", "emission allowances", "emissions allowances"],
|
|
@@ -127,6 +134,17 @@ const KNOWN_GAPS: ReadonlyArray<{ terms: readonly string[]; words?: readonly str
|
|
|
127
134
|
message: "Baltic indices (BDI, Capesize, Panamax, Supramax) and freight forwards (FFA) are not covered. Traded proxies: BDRY (freight futures ETF), "
|
|
128
135
|
+ "SBLK, GNK, DSX (dry-bulk shipowners); chokepoint transits: fn CHOKE; news \"dry bulk\".",
|
|
129
136
|
},
|
|
137
|
+
{
|
|
138
|
+
// Live iron ore futures (SGX, DCE, CME) are licensed; the IMF's monthly world price is the one the terminal has.
|
|
139
|
+
// "iron ore" typed for a quote was Kumba Iron Ore's stock, which its own name still finds.
|
|
140
|
+
terms: ["iron ore", "iron ore price", "iron ore prices", "iron ore futures", "iron ore 62", "62% Fe", "iron ore 62% Fe",
|
|
141
|
+
"iron ore fines", "SGX iron ore", "DCE iron ore", "iron ore spot"],
|
|
142
|
+
words: ["price", "prices", "futures", "future", "spot", "62", "fe", "cfr", "china", "fines", "monthly", "chart", "today",
|
|
143
|
+
"current", "latest", "live", "quote", "the", "of"],
|
|
144
|
+
unquoted: true,
|
|
145
|
+
message: "Iron ore: no live price (SGX, DCE and CME iron ore futures are licensed). The IMF's monthly world price: gloom fred PIORECRUSDM. "
|
|
146
|
+
+ "Producers: VALE, RIO, BHP, KIO:JSE (Kumba Iron Ore).",
|
|
147
|
+
},
|
|
130
148
|
{
|
|
131
149
|
// What the terminal has for munis, and what it does not: the AAA curve every muni ratio quotes is licensed.
|
|
132
150
|
terms: ["muni", "munis", "municipal", "municipals", "municipal bond", "municipal bonds", "muni bond", "muni bonds", "muni fund", "muni funds",
|
|
@@ -497,6 +515,14 @@ function namesKnownGap(gap: (typeof KNOWN_GAPS)[number], query: string): boolean
|
|
|
497
515
|
return named.size > 0 && asked.every((word) => named.has(word) || gap.words!.includes(word));
|
|
498
516
|
}
|
|
499
517
|
|
|
518
|
+
/**
|
|
519
|
+
* The line for a price the terminal has none of, typed where a ticker goes ("iron ore"), so it is never read as the
|
|
520
|
+
* company whose name holds its words (Kumba Iron Ore); null for anything else.
|
|
521
|
+
*/
|
|
522
|
+
export function unquotedGapMessage(query: string): string | null {
|
|
523
|
+
return KNOWN_GAPS.find((gap) => gap.unquoted && namesKnownGap(gap, query))?.message ?? null;
|
|
524
|
+
}
|
|
525
|
+
|
|
500
526
|
/**
|
|
501
527
|
* The line for a query that names a known subject ("carbon allowances", "EUA", "panamax rates"), a Treasury yield
|
|
502
528
|
* typed as a ticker (US10Y), a topic with no function ("defense budget"), or a macro release no series carries
|
package/src/cli/listing-arg.ts
CHANGED
|
@@ -42,7 +42,8 @@ import { stripStrayEdges } from "./symbol-args";
|
|
|
42
42
|
import { isNoProviderMessage, isNoSourceAnswer, isProviderBusy } from "../sources/provider-errors";
|
|
43
43
|
import { dashedCoinPair, exchangeLineCoinListing, isSpotCommodityOrCurrencyPair, MAJOR_COIN_NAMES, TOP_COIN_NAMES } from "../utils/crypto-pair";
|
|
44
44
|
import { boardCoinFor, primeBoardCoins } from "./board-coins";
|
|
45
|
-
import { knownGapMessage } from "./known-gaps";
|
|
45
|
+
import { knownGapMessage, unquotedGapMessage } from "./known-gaps";
|
|
46
|
+
import { renamedListingFor, renamedListingReadAs, renamedListingSymbol } from "../tickers/renamed-listings";
|
|
46
47
|
import { currencyPairSpelling } from "../utils/currency-pair";
|
|
47
48
|
import { bareFuturesCode, futuresContractByCode, futuresContractByWord, listedFuturesSymbol } from "../market-data/futures-board";
|
|
48
49
|
import { classifyInstrumentType, kindFromListingSyntax } from "../tickers/instrument-kind";
|
|
@@ -1288,6 +1289,15 @@ export async function resolveCliListing(
|
|
|
1288
1289
|
const { message, details } = fredSeriesNotListing(fred);
|
|
1289
1290
|
throw new ListingArgError(message, details);
|
|
1290
1291
|
}
|
|
1292
|
+
// "iron ore" has no live price: it says so and where the monthly one is, never Kumba Iron Ore's stock.
|
|
1293
|
+
const unquoted = exchangeOption?.trim() ? null : unquotedGapMessage(typed);
|
|
1294
|
+
if (unquoted) throw new ListingArgError(unquoted);
|
|
1295
|
+
// A listing that moved to a new symbol (ELET3, "eletrobras") is the one it trades as now, saying so.
|
|
1296
|
+
const renamed = exchangeOption?.trim() ? null : renamedListingFor(typed);
|
|
1297
|
+
if (renamed) {
|
|
1298
|
+
const now = await resolveCliListing(renamedListingSymbol(renamed), null, deps, options);
|
|
1299
|
+
return { ...now, readAs: [renamedListingReadAs(typed, renamed), now.readAs].filter(Boolean).join(" "), readFromName: true };
|
|
1300
|
+
}
|
|
1291
1301
|
const read = await readTerminalCodeArg(deps.dataProvider, typed);
|
|
1292
1302
|
// A company's name, an entry of a comma list (`WHR, Whirlpool Corporation`), is the listing search names for it.
|
|
1293
1303
|
// A name before a legal form ("SAP SE", "SIEMENS AG") is looked up first: SE is also SIX Swiss's market code.
|
package/src/cli/name-entries.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { splitSymbolWords } from "./symbol-args";
|
|
|
8
8
|
import { isNumberCell } from "./symbol-cells";
|
|
9
9
|
import { isProviderBusy, type ProviderBusyError } from "../sources/provider-errors";
|
|
10
10
|
import { unknownBloombergMarket } from "../tickers/terminal-codes";
|
|
11
|
+
import { renamedListingFor } from "../tickers/renamed-listings";
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* The entries of a list (`splitSymbolArgs`, or a file's lines) as the symbols
|
|
@@ -110,7 +111,8 @@ export type PhraseReading =
|
|
|
110
111
|
|
|
111
112
|
/**
|
|
112
113
|
* One quoted argument with spaces: a company's name when search finds the
|
|
113
|
-
* company (`"Whirlpool Corporation"`)
|
|
114
|
+
* company (`"Whirlpool Corporation"`) or it is a renamed company's former
|
|
115
|
+
* name (renamed-listings.ts), else a pasted line of symbols when no
|
|
114
116
|
* word is one the source says is not a ticker (`"AAPL MSFT"`), else a phrase
|
|
115
117
|
* (`"10 year yield"`), which is never split into symbols such as YEAR and
|
|
116
118
|
* YIELD. The words are asked in one batch beside the name search, not a
|
|
@@ -125,6 +127,8 @@ export async function readPhraseArgument(
|
|
|
125
127
|
dataProvider: Pick<DataProvider, "search" | "getQuotesBatch">,
|
|
126
128
|
): Promise<PhraseReading> {
|
|
127
129
|
if (unknownBloombergMarket(phrase) || await readTerminalCodeArg(dataProvider, phrase)) return { kind: "symbols", symbols: [phrase] };
|
|
130
|
+
// A renamed company's former name ("Centrais Elétricas Brasileiras") is the listing it trades as now.
|
|
131
|
+
if (renamedListingFor(phrase)) return { kind: "name", name: phrase };
|
|
128
132
|
const words = splitSymbolWords([phrase]);
|
|
129
133
|
const numbered = words.some(isNumberCell);
|
|
130
134
|
const asked = words.filter((word) => !word.includes(":") && !isNumberCell(word)).map((word) => word.replace(/^\$/, "").toUpperCase());
|
package/src/cli/not-a-ticker.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { futuresContractByWord } from "../market-data/futures-board";
|
|
2
2
|
import { notATickerSymbol } from "../sources/provider-errors";
|
|
3
|
+
import { renamedListingFor, renamedListingHint } from "../tickers/renamed-listings";
|
|
3
4
|
import { boardCoinFor } from "./board-coins";
|
|
4
5
|
import { currencyNameHint } from "./currency-name-hint";
|
|
5
6
|
import { splitSymbolArgs, splitSymbolWords } from "./symbol-args";
|
|
@@ -52,6 +53,9 @@ export function withSearchHints(text: string, args: readonly string[], isFredSer
|
|
|
52
53
|
const typed = typedSymbol(symbol, args);
|
|
53
54
|
const id = typed.toUpperCase();
|
|
54
55
|
if (/^[A-Z0-9]+$/.test(id) && isFredSeries(id)) return `${sentence} Try \`gloom fred ${id}\`.`;
|
|
56
|
+
// A listing that moved to a new symbol (ELET3 is AXIA3) points to it, never to a search for the dead one.
|
|
57
|
+
const renamed = renamedListingFor(typed);
|
|
58
|
+
if (renamed) return `${sentence} ${renamedListingHint(renamed)}`;
|
|
55
59
|
const coin = boardCoinFor(id);
|
|
56
60
|
if (coin) return `${sentence} Did you mean ${coin.symbol}${coin.name && coin.name.toUpperCase() !== coin.symbol ? ` (${coin.name})` : ""}?`;
|
|
57
61
|
const tenor = treasuryYieldTenor(typed);
|
|
@@ -1000,8 +1000,8 @@ export const FUNCTION_HELP: Readonly<Record<string, FunctionHelp>> = {
|
|
|
1000
1000
|
bloomberg: ["CRD"],
|
|
1001
1001
|
},
|
|
1002
1002
|
AUCT: {
|
|
1003
|
-
summary: "Bill, note, bond and TIPS auction results: high rate, stop-out
|
|
1004
|
-
usage: ["AUCT", "AUCT 10Y", "AUCT 91282CRF0"],
|
|
1003
|
+
summary: "Bill, note, bond and TIPS auction results: high rate (a bill's investment rate, with its discount rate), the stop-out's spread against the published average (the median from Nov 1998), bid-to-cover, indirect, direct and dealer takedown and size, with the auctions announced next. The after view ranks each auction's B/C, indirect and dealer share against its tenor's last 24 and gives the Treasury yield's move 1, 5 and 20 sessions later. Searchable by benchmark (10Y) or CUSIP; history reaches back to 1979 (--history-days all).",
|
|
1004
|
+
usage: ["AUCT", "AUCT 10Y", "AUCT 91282CRF0", "AUCT 7Y --history-days 3650 --view after --sort btc-pctl"],
|
|
1005
1005
|
keys: [SEARCH, key("f", "ilter"), OPEN],
|
|
1006
1006
|
data: same("Daily, after each auction"),
|
|
1007
1007
|
bloomberg: ["AUCT"],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PluginRegistry } from "../../plugins/registry";
|
|
2
2
|
import { fuzzyFilter } from "../../utils/fuzzy-search";
|
|
3
3
|
import type { ResultItem } from "./list/model";
|
|
4
|
-
import { summarizePaneSettingValue } from "../pane-settings-dialog/value";
|
|
4
|
+
import { paneSettingValue, summarizePaneSettingValue } from "../pane-settings-dialog/value";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* The focused pane's settings as root search results. The bar only finds a
|
|
@@ -21,7 +21,7 @@ export function buildPaneSettingResultItems(options: {
|
|
|
21
21
|
const category = descriptor.settingsDef.title || "Pane Settings";
|
|
22
22
|
const paneLabel = descriptor.pane.title || descriptor.paneDef.name || descriptor.pane.paneId;
|
|
23
23
|
const items = descriptor.settingsDef.fields.map((field): ResultItem => {
|
|
24
|
-
const currentValue = descriptor.context.settings
|
|
24
|
+
const currentValue = paneSettingValue(field, descriptor.context.settings);
|
|
25
25
|
const actionSearchText = field.type === "action"
|
|
26
26
|
? `${field.actionId} ${field.actionLabel ?? ""}`
|
|
27
27
|
: "";
|
|
@@ -409,14 +409,18 @@ export function buildRootResultModel(options: RootResultModelOptions): RootResul
|
|
|
409
409
|
.filter((command) => command.id !== "quit")
|
|
410
410
|
.map((command) => commandToItem(command))
|
|
411
411
|
.filter((item): item is ResultItem => item !== null);
|
|
412
|
+
const pluginItems = pluginCommandItems();
|
|
413
|
+
// A layout action that is also a command (Add a Desk, DESK) is listed once, as the command.
|
|
414
|
+
const commandRows = new Set([...commandItems, ...pluginItems].map((item) => `${item.label}\u0000${item.right ?? ""}`));
|
|
412
415
|
const allItems = [
|
|
413
416
|
...commandItems,
|
|
414
|
-
...buildLayoutItems("", { confirmDangerousActions: true })
|
|
417
|
+
...buildLayoutItems("", { confirmDangerousActions: true })
|
|
418
|
+
.filter((item) => !commandRows.has(`${item.label}\u0000${item.right ?? ""}`)),
|
|
415
419
|
...buildPaneSettingItems(state.focusedPaneId, rootQuery),
|
|
416
420
|
...paneShortcutItems({ includePromptableTickerTemplates: true }),
|
|
417
421
|
...nonShortcutPaneTemplateItems(),
|
|
418
422
|
...tickerActionItems(),
|
|
419
|
-
...
|
|
423
|
+
...pluginItems,
|
|
420
424
|
];
|
|
421
425
|
if (pastedList) items.push(pastedListItem(pastedList, executeCollectionCommand));
|
|
422
426
|
items.push(...rankMatchBlock(allItems, providerMatchItems, rootQuery));
|
|
@@ -31,7 +31,8 @@ export function InputSearchBar({
|
|
|
31
31
|
width: number | "100%";
|
|
32
32
|
focusToken: number;
|
|
33
33
|
inputRef: RefObject<InputRenderable | null>;
|
|
34
|
-
|
|
34
|
+
/** Longest first: a field too narrow for one shows the next that fits. */
|
|
35
|
+
placeholder: string | readonly string[];
|
|
35
36
|
debounceMs: number;
|
|
36
37
|
/** Leading marker; override when a pane shows more than one field. */
|
|
37
38
|
glyph?: string;
|
|
@@ -137,7 +138,7 @@ export function InputSearchBar({
|
|
|
137
138
|
ref={inputRef}
|
|
138
139
|
value={draft}
|
|
139
140
|
focused={focused && active}
|
|
140
|
-
placeholder={placeholder}
|
|
141
|
+
placeholder={fittedPlaceholder(placeholder, typeof width === "number" ? width - (appearance === "strip" ? 2 : 0) : null)}
|
|
141
142
|
placeholderColor={placeholderText()}
|
|
142
143
|
textColor={colors.text}
|
|
143
144
|
focusedTextColor={colors.text}
|
|
@@ -156,6 +157,12 @@ export function InputSearchBar({
|
|
|
156
157
|
);
|
|
157
158
|
}
|
|
158
159
|
|
|
160
|
+
/** The first placeholder that fits `room` cells (all of them when the field has no fixed width), else the last. */
|
|
161
|
+
function fittedPlaceholder(placeholder: string | readonly string[], room: number | null): string {
|
|
162
|
+
if (typeof placeholder === "string") return placeholder;
|
|
163
|
+
return placeholder.find((text) => room === null || text.length <= room) ?? placeholder.at(-1) ?? "";
|
|
164
|
+
}
|
|
165
|
+
|
|
159
166
|
const SEARCH_ICON_STYLE = { marginRight: "var(--gloom-space-xs)" } as const;
|
|
160
167
|
|
|
161
168
|
const SEARCH_STRIP_STYLE = {
|
|
@@ -409,6 +409,7 @@ export function PaneHeader({
|
|
|
409
409
|
activeValue={stack.active}
|
|
410
410
|
onSelect={stack.onSelect}
|
|
411
411
|
variant="header"
|
|
412
|
+
background={backgroundColor}
|
|
412
413
|
focused={visuallyFocused}
|
|
413
414
|
keyboardNavigation={false}
|
|
414
415
|
paneMenu={false}
|
|
@@ -468,6 +469,7 @@ export function PaneHeader({
|
|
|
468
469
|
activeValue={tabs.activeValue}
|
|
469
470
|
onSelect={tabs.onSelect}
|
|
470
471
|
variant="header"
|
|
472
|
+
background={backgroundColor}
|
|
471
473
|
focused={tabs.focused}
|
|
472
474
|
keyboardNavigation={tabs.keyboardNavigation}
|
|
473
475
|
onAdd={tabs.onAdd}
|
|
@@ -10,6 +10,7 @@ import { pinnedTabTime } from "../../../../state/app/tab-cursor";
|
|
|
10
10
|
import type { LayoutConfig } from "../../../../types/config";
|
|
11
11
|
import { useRendererHost, useUiCapabilities, type NativeRendererHost } from "../../../../ui";
|
|
12
12
|
import { buildPaneSharePayload } from "../../../../shares/pane";
|
|
13
|
+
import { paneShareItemFor } from "../../../../shares/pane-item";
|
|
13
14
|
import { preparePaneShare } from "../../../../shares/prepare";
|
|
14
15
|
import { sharePaneLink, type PaneShareView } from "../../../../shares/flow";
|
|
15
16
|
import { reportPaneBug } from "../../../../shares/bug-report-flow";
|
|
@@ -74,6 +75,7 @@ export function useShellPaneCapture(options: UseShellPaneCaptureOptions): void {
|
|
|
74
75
|
const pane = current.paneMap.get(paneId);
|
|
75
76
|
if (!pane) throw new Error("Focus a pane to share it.");
|
|
76
77
|
const state = stateRef.current;
|
|
78
|
+
const personalData = panePersonalData({ registry: current.pluginRegistry, state, layout: current.layout, pane });
|
|
77
79
|
return {
|
|
78
80
|
sharePayload: publicSharing ? buildPaneSharePayload(
|
|
79
81
|
pluginRegistry,
|
|
@@ -82,8 +84,9 @@ export function useShellPaneCapture(options: UseShellPaneCaptureOptions): void {
|
|
|
82
84
|
resolveTickerForPane(state, paneId),
|
|
83
85
|
state.tickers,
|
|
84
86
|
pinnedTabTime(state),
|
|
87
|
+
paneShareItemFor({ pane, state, registry: pluginRegistry, personal: personalData !== null }),
|
|
85
88
|
) : null,
|
|
86
|
-
personalData
|
|
89
|
+
personalData,
|
|
87
90
|
};
|
|
88
91
|
}, [pluginRegistry, publicSharing, stateRef]);
|
|
89
92
|
|