gloomberb 0.19.3 → 0.19.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/package.json +4 -2
- package/src/api-client/errors.ts +8 -0
- package/src/api-client/index.ts +18 -0
- package/src/api-client/request.ts +295 -42
- package/src/api-client/socket.ts +95 -0
- package/src/app/keybindings/actions.ts +1 -1
- package/src/app/pane-runtime/index.tsx +1 -1
- package/src/app/pane-runtime/ticker-inspector-runtime.ts +1 -1
- package/src/app/pane-runtime/ticker-open-runtime.ts +1 -1
- package/src/app/pane-runtime/ticker-open-target.ts +12 -2
- package/src/cli/commands/command-utils.ts +4 -0
- package/src/cli/commands/market.ts +119 -27
- package/src/cli/commands/search.ts +1 -1
- package/src/cli/commands/ticker.ts +10 -6
- package/src/cli/currency-name-hint.ts +60 -0
- package/src/cli/desktop-pane-shot-api-policy.ts +10 -2
- package/src/cli/desktop-pane-shot.ts +2 -1
- package/src/cli/history-rows.ts +18 -1
- package/src/cli/known-gaps.ts +17 -2
- package/src/cli/not-a-ticker.ts +5 -3
- package/src/cli/pane-functions/catalog.ts +9 -1
- package/src/cli/pane-functions/headless.ts +7 -3
- package/src/cli/pane-functions/market-session.ts +6 -7
- package/src/cli/series-search.ts +4 -5
- package/src/components/chart/composite/panel-bitmap.ts +28 -2
- package/src/components/chart/composite/time-axis.ts +17 -2
- package/src/components/command-bar/action-runtime.ts +2 -0
- package/src/components/command-bar/commands/direct/runtime.ts +3 -3
- package/src/components/command-bar/helpers.ts +2 -0
- package/src/components/command-bar/list/model.ts +9 -0
- package/src/components/command-bar/pane-actions.ts +46 -35
- package/src/components/command-bar/pane-templates/workflow.ts +6 -0
- package/src/components/command-bar/panel/index.tsx +30 -3
- package/src/components/command-bar/panel/types.ts +7 -0
- package/src/components/command-bar/routes/root/results.ts +4 -4
- package/src/components/command-bar/routes/root/selection.ts +3 -2
- package/src/components/command-bar/routes/ticker-search/actions.ts +21 -16
- package/src/components/command-bar/routing/launch-request.ts +3 -2
- package/src/components/command-bar/routing/list-state.ts +4 -1
- package/src/components/command-bar/surface/index.tsx +15 -1
- package/src/components/layout/floating-pane.tsx +10 -0
- package/src/components/layout/pane/frame.tsx +6 -0
- package/src/components/layout/pane/header.tsx +244 -42
- package/src/components/layout/pane/index.tsx +20 -2
- package/src/components/layout/shell/active-drag.ts +160 -28
- package/src/components/layout/shell/drag/index.ts +99 -96
- package/src/components/layout/shell/drag/live.ts +3 -17
- package/src/components/layout/shell/drag/magnets.ts +304 -0
- package/src/components/layout/shell/drag/overlays.tsx +77 -75
- package/src/components/layout/shell/drag/runtime.ts +12 -7
- package/src/components/layout/shell/index.tsx +66 -32
- package/src/components/layout/shell/native/pointer-runtime.ts +7 -2
- package/src/components/layout/shell/native/surfaces.ts +1 -9
- package/src/components/layout/shell/native/window-state.ts +21 -25
- package/src/components/layout/shell/pane/layers.tsx +153 -24
- package/src/components/layout/shell/shortcuts.ts +4 -1
- package/src/components/layout/shell/terminal-pointer-runtime.ts +24 -1
- package/src/components/layout/shell/window-mode/overlays.tsx +14 -6
- package/src/components/layout/status-bar.tsx +75 -6
- package/src/components/layout/window-controls.tsx +96 -35
- package/src/components/layout/window-fullscreen.ts +20 -0
- package/src/components/quote-flash.ts +36 -32
- package/src/core/app-runtime.ts +4 -1
- package/src/core/connection-health.ts +76 -1
- package/src/core/state/app/command-bar-launch.ts +12 -0
- package/src/core/state/app/layout.ts +4 -3
- package/src/core/state/app/types.ts +4 -1
- package/src/data/config/layout.ts +2 -2
- package/src/data/config/store/fold-panes.ts +6 -1
- package/src/i18n/es.ts +8 -1
- package/src/i18n/ja.ts +8 -1
- package/src/i18n/ko.ts +8 -1
- package/src/i18n/zh-cn.ts +8 -1
- package/src/i18n/zh-tw.ts +8 -1
- package/src/layout/pane-follow.ts +3 -2
- package/src/layout/pane-layout-move.ts +2 -1
- package/src/layout/pane-manager/dock-stack.ts +38 -0
- package/src/layout/pane-manager/dock-tree.ts +76 -15
- package/src/layout/pane-manager/docking.ts +48 -6
- package/src/layout/pane-manager/floating-actions.ts +12 -3
- package/src/layout/pane-manager/floating-placement.ts +189 -0
- package/src/layout/pane-manager/floating.ts +23 -4
- package/src/layout/pane-manager/gridlock.ts +16 -4
- package/src/layout/pane-manager/hidden-panes.ts +30 -1
- package/src/layout/pane-manager/index.ts +2 -0
- package/src/layout/pane-manager/layout-state.ts +17 -0
- package/src/layout/pane-manager/types.ts +4 -1
- package/src/layout/ticker-retarget.ts +88 -0
- package/src/layout-marketplace/cloud.ts +9 -1
- package/src/market-data/connection-follow.ts +68 -0
- package/src/market-data/coordinator/entries.ts +15 -3
- package/src/market-data/coordinator/events.ts +17 -1
- package/src/market-data/coordinator/financials.ts +20 -7
- package/src/market-data/coordinator/index.ts +217 -4
- package/src/market-data/coordinator/quotes.ts +10 -0
- package/src/market-data/frame-scheduler.ts +47 -10
- package/src/market-data/frame-wake.ts +74 -0
- package/src/market-data/futures-board.ts +7 -6
- package/src/market-data/hooks.tsx +43 -3
- package/src/market-data/performance.ts +78 -9
- package/src/market-data/request-types.ts +6 -3
- package/src/news/aggregator.ts +12 -1
- package/src/plugins/builtin/alerts/cli.ts +2 -1
- package/src/plugins/builtin/analytics/risk-evidence.ts +1 -0
- package/src/plugins/builtin/attention/evidence.ts +1 -1
- package/src/plugins/builtin/awards/client.ts +1 -1
- package/src/plugins/builtin/awards/evidence.ts +1 -1
- package/src/plugins/builtin/awards/pane.tsx +2 -1
- package/src/plugins/builtin/bond-calculator/math.ts +1 -1
- package/src/plugins/builtin/broker-manager/footer.ts +3 -2
- package/src/plugins/builtin/broker-manager/index.tsx +2 -1
- package/src/plugins/builtin/broker-manager/keyboard.ts +2 -1
- package/src/plugins/builtin/buildout/company/pane.tsx +2 -1
- package/src/plugins/builtin/buildout/model/index.ts +6 -0
- package/src/plugins/builtin/buildout/pane/index.tsx +2 -1
- package/src/plugins/builtin/catalysts/evidence.ts +1 -1
- package/src/plugins/builtin/catalysts/pane.tsx +2 -1
- package/src/plugins/builtin/chart-composer/headless.ts +40 -1
- package/src/plugins/builtin/chart-composer/index.tsx +13 -0
- package/src/plugins/builtin/chat/controller/index.ts +10 -3
- package/src/plugins/builtin/chat/controller/session-runtime.ts +9 -2
- package/src/plugins/builtin/chat/status-widget.tsx +3 -1
- package/src/plugins/builtin/cloud-tweets/table.tsx +3 -2
- package/src/plugins/builtin/comment-letters/client.ts +2 -1
- package/src/plugins/builtin/company-kpis/client.ts +1 -1
- package/src/plugins/builtin/company-kpis/pane.tsx +2 -1
- package/src/plugins/builtin/company-kpis/screenshot-evidence.ts +3 -2
- package/src/plugins/builtin/cot/headless.ts +9 -3
- package/src/plugins/builtin/cot/model.ts +44 -3
- package/src/plugins/builtin/credit-documents/client.ts +1 -1
- package/src/plugins/builtin/credit-documents/evidence.ts +1 -1
- package/src/plugins/builtin/credit-documents/pane.tsx +2 -1
- package/src/plugins/builtin/earnings-calls/pane.tsx +1 -1
- package/src/plugins/builtin/earnings-ripple/index.tsx +6 -1
- package/src/plugins/builtin/econ/calendar-model.ts +2 -0
- package/src/plugins/builtin/econ/fred-catalog.ts +5 -5
- package/src/plugins/builtin/econ/print-watch.ts +3 -1
- package/src/plugins/builtin/futures/series.ts +16 -1
- package/src/plugins/builtin/fx-matrix/headless.ts +4 -2
- package/src/plugins/builtin/fx-matrix/index.tsx +37 -3
- package/src/plugins/builtin/fx-matrix/pairs.ts +15 -0
- package/src/plugins/builtin/gpu/headless.ts +2 -1
- package/src/plugins/builtin/help/function-card.tsx +2 -1
- package/src/plugins/builtin/help/index.tsx +3 -2
- package/src/plugins/builtin/insider/display.ts +45 -6
- package/src/plugins/builtin/ipo-calendar/model.ts +2 -0
- package/src/plugins/builtin/iv-history/client.ts +2 -1
- package/src/plugins/builtin/iv-history/headless.ts +2 -1
- package/src/plugins/builtin/jobs/pages.ts +4 -4
- package/src/plugins/builtin/kelly-sizer/headless.ts +2 -1
- package/src/plugins/builtin/market-heatmap/index.tsx +2 -1
- package/src/plugins/builtin/members/client.ts +1 -1
- package/src/plugins/builtin/mna/distress/client.ts +1 -0
- package/src/plugins/builtin/mna/pane.tsx +4 -1
- package/src/plugins/builtin/options/market-reference.ts +1 -1
- package/src/plugins/builtin/options/open-interest-as-of.ts +3 -1
- package/src/plugins/builtin/options/view.tsx +2 -1
- package/src/plugins/builtin/options-calculator/evidence.ts +1 -1
- package/src/plugins/builtin/options-scenario/csp-screen-pane.tsx +1 -1
- package/src/plugins/builtin/options-scenario/csp-screen.ts +8 -4
- package/src/plugins/builtin/options-scenario/csp.ts +28 -9
- package/src/plugins/builtin/options-scenario/evidence.ts +5 -4
- package/src/plugins/builtin/options-scenario/pane.tsx +2 -1
- package/src/plugins/builtin/perps/client.ts +1 -1
- package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +2 -1
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +7 -3
- package/src/plugins/builtin/portfolio-list/use-throttled-memo.ts +10 -19
- package/src/plugins/builtin/research/analyst-model.ts +1 -0
- package/src/plugins/builtin/research/equity-diagnostic-pane.tsx +2 -1
- package/src/plugins/builtin/research/index.tsx +1 -0
- package/src/plugins/builtin/research/relative-valuation-currency.ts +1 -1
- package/src/plugins/builtin/research/relative-valuation-peers.ts +2 -1
- package/src/plugins/builtin/research-search/command-bar-search.ts +3 -1
- package/src/plugins/builtin/research-search/snippet.ts +1 -0
- package/src/plugins/builtin/revenue-breakdown/client.ts +3 -2
- package/src/plugins/builtin/seasonality/headless.ts +2 -1
- package/src/plugins/builtin/sec/command-bar-search.ts +3 -2
- package/src/plugins/builtin/sec/index.tsx +7 -4
- package/src/plugins/builtin/sec/row-summaries.ts +28 -12
- package/src/plugins/builtin/sectors/client.ts +18 -8
- package/src/plugins/builtin/sectors/index.tsx +19 -5
- package/src/plugins/builtin/short-interest/watch-client.ts +2 -1
- package/src/plugins/builtin/social-mentions/client.ts +2 -1
- package/src/plugins/builtin/supply-chain/client.ts +1 -1
- package/src/plugins/builtin/supply-chain/evidence.ts +1 -1
- package/src/plugins/builtin/supply-chain/graph-pane.tsx +2 -1
- package/src/plugins/builtin/supply-chain/pane.tsx +2 -1
- package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +1 -1
- package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +24 -4
- package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +1 -1
- package/src/plugins/builtin/ticker-detail/overview/pane.tsx +4 -1
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +25 -2
- package/src/plugins/builtin/time-sales/client.ts +1 -0
- package/src/plugins/builtin/vol-surface/client.ts +2 -1
- package/src/plugins/builtin/yield-curve/headless.ts +3 -1
- package/src/portfolio/column-values.ts +76 -10
- package/src/react/async-resource.ts +12 -0
- package/src/remote/controller.ts +3 -1
- package/src/renderers/browser/app-services.ts +8 -1
- package/src/renderers/browser/cloud-transport.ts +6 -1
- package/src/renderers/cloudflare/worker.ts +24 -2
- package/src/renderers/dom/host/box.tsx +204 -176
- package/src/renderers/dom/host/style.ts +49 -20
- package/src/renderers/dom/host/text.tsx +3 -2
- package/src/renderers/dom/styles.css +32 -0
- package/src/renderers/electrobun/bun/desktop/backend.ts +2 -0
- package/src/renderers/electrobun/bun/desktop/host-requests.ts +25 -1
- package/src/renderers/electrobun/bun/desktop/relaunch.ts +9 -1
- package/src/renderers/electrobun/bun/desktop/windows-script.ts +9 -6
- package/src/renderers/electrobun/bun/window/windows-native.ts +26 -1
- package/src/renderers/electrobun/shared/protocol.ts +6 -0
- package/src/renderers/electrobun/view/ui-host.tsx +7 -0
- package/src/renderers/electrobun/view/window-fullscreen.ts +10 -3
- package/src/shares/portable-layout.ts +99 -2
- package/src/sources/provider-router/index.ts +9 -3
- package/src/sources/provider-router/sources.ts +26 -1
- package/src/sync/core-contributors.ts +18 -4
- package/src/time-series/price-units.ts +11 -0
- package/src/time-series/resolve.ts +12 -0
- package/src/types/config.ts +17 -1
- package/src/types/plugin.ts +6 -0
- package/src/ui/host.tsx +2 -0
- package/src/utils/currency-names.ts +20 -0
- package/src/utils/currency-pair.ts +6 -0
- package/src/utils/exchange-rate-snapshot.ts +20 -2
- package/src/utils/fx-market-hours.ts +43 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { currenciesNamed } from "../utils/currency-names";
|
|
2
|
+
import { dollarPairListing } from "../utils/currency-pair";
|
|
3
|
+
|
|
4
|
+
/** A currency a name typed in words stands for, and its pair against the dollar as a listing. */
|
|
5
|
+
export interface NamedCurrencyPair {
|
|
6
|
+
/** The words as typed: `swiss franc`. */
|
|
7
|
+
typed: string;
|
|
8
|
+
code: string;
|
|
9
|
+
/** USDCHF=X for the franc, EURUSD=X for the euro. */
|
|
10
|
+
pair: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The one currency words name (`swiss franc` is CHF, `yen` JPY) with its
|
|
15
|
+
* pair against the dollar. Null for words that name none, several (`peso`)
|
|
16
|
+
* or the dollar itself, which has no pair of its own.
|
|
17
|
+
*/
|
|
18
|
+
export function namedCurrencyPair(typed: string): NamedCurrencyPair | null {
|
|
19
|
+
const words = typed.trim().replace(/\s+/g, " ");
|
|
20
|
+
if (!words || /[^\p{L}\s.'-]/u.test(words)) return null;
|
|
21
|
+
const named = currenciesNamed(words);
|
|
22
|
+
const code = named.length === 1 ? named[0]!.code : null;
|
|
23
|
+
return code && code !== "USD" ? { typed: words, code, pair: dollarPairListing(code) } : null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** "swiss franc is a currency (CHF), not a ticker.", then what to run: `gloom fx CHF` for its rate, `gloom history USDCHF=X` for its pair. */
|
|
27
|
+
function currencyStop(named: NamedCurrencyPair, command: string): { message: string; details: string } {
|
|
28
|
+
return {
|
|
29
|
+
message: `${named.typed} is a currency (${named.code}), not a ticker.`,
|
|
30
|
+
details: `Its rate: gloom fx ${named.code}\nIts pair: gloom ${command} ${named.pair}`,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The stop for a symbol command given a currency's name in several words
|
|
36
|
+
* (`history swiss franc`, `quote japanese yen`), which would otherwise read
|
|
37
|
+
* each word as a symbol (SWISS, a Copenhagen listing). One word is a ticker
|
|
38
|
+
* first (`history real` is The RealReal); `currencyNameMiss` names its
|
|
39
|
+
* currency once it fails as one. Null for anything else.
|
|
40
|
+
*/
|
|
41
|
+
export function currencyNameStop(words: readonly string[], command: string): { message: string; details: string } | null {
|
|
42
|
+
const typed = words.map((word) => word.trim()).filter(Boolean);
|
|
43
|
+
if (typed.length === 0 || typed.some((word) => word.startsWith("-"))) return null;
|
|
44
|
+
const phrase = typed.join(" ");
|
|
45
|
+
if (!/\s/.test(phrase)) return null;
|
|
46
|
+
const named = namedCurrencyPair(phrase);
|
|
47
|
+
return named ? currencyStop(named, command) : null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** The stop for one word that failed as a symbol and names a currency (`history yen`), else null. */
|
|
51
|
+
export function currencyNameMiss(word: string, command: string): { message: string; details: string } | null {
|
|
52
|
+
const named = namedCurrencyPair(word);
|
|
53
|
+
return named ? currencyStop(named, command) : null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** The hint after "Not a ticker: YEN." for a word that names a currency: "Try `gloom fx JPY` for the yen's rate, or its pair USDJPY=X." */
|
|
57
|
+
export function currencyNameHint(typed: string): string | null {
|
|
58
|
+
const named = namedCurrencyPair(typed);
|
|
59
|
+
return named ? `Try \`gloom fx ${named.code}\` for the ${named.typed}'s rate, or its pair ${named.pair}.` : null;
|
|
60
|
+
}
|
|
@@ -16,11 +16,14 @@ const AUTH_IN_FAMILY = /^\/cloud\/auth(?:\/|$)/;
|
|
|
16
16
|
* session cut to its user, see `isShotSessionPath`), plan prices, the service
|
|
17
17
|
* probe, the roadmap, the layout gallery (marketplace and team layouts),
|
|
18
18
|
* theses, and a signed-in broker's catalog, connection status, holdings,
|
|
19
|
-
* orders and fills.
|
|
19
|
+
* orders and fills. The Buildout plan is one: its answer is the plan and its
|
|
20
|
+
* prices, never the token `POST /account/buildout/token` mints, which stays
|
|
21
|
+
* refused, so the Buildout panes cannot be drawn with a plan's data.
|
|
20
22
|
*/
|
|
21
23
|
const READ_PATHS = [
|
|
22
24
|
/^\/auth\/get-session$/,
|
|
23
25
|
/^\/account\/cloud$/,
|
|
26
|
+
/^\/account\/buildout$/,
|
|
24
27
|
/^\/pricing$/,
|
|
25
28
|
/^\/health$/,
|
|
26
29
|
/^\/roadmap$/,
|
|
@@ -30,8 +33,13 @@ const READ_PATHS = [
|
|
|
30
33
|
/^\/brokers\/connectors$/,
|
|
31
34
|
/^\/brokers\/[a-z][a-z0-9-]{0,31}(?:\/(?:snapshot|orders|executions))?$/,
|
|
32
35
|
];
|
|
33
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* Reads sent as a POST because their query is a list or a definition: batches,
|
|
38
|
+
* scans, analyses and the equity screen's query. Its saved-screen writes,
|
|
39
|
+
* ticker check and export are not here.
|
|
40
|
+
*/
|
|
34
41
|
const READ_POSTS = new Set([
|
|
42
|
+
"/cloud/equity-screener/query",
|
|
35
43
|
"/cloud/exposure/analyze",
|
|
36
44
|
"/cloud/perps/equities",
|
|
37
45
|
"/market/financials/batch",
|
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
type ShotApiSocketCall,
|
|
31
31
|
type ShotApiSocketReply,
|
|
32
32
|
} from "./desktop-pane-shot-routes";
|
|
33
|
+
import { SHOT_REQUEST_REFUSED } from "../api-client/errors";
|
|
33
34
|
import { SESSION_COOKIE_NAMES } from "../api-client/session-cookie";
|
|
34
35
|
import { isShotApiRequestAllowed, isShotSessionPath } from "./desktop-pane-shot-api-policy";
|
|
35
36
|
import { renderElectrobunViewHtml } from "../renderers/dom/build-assets";
|
|
@@ -472,7 +473,7 @@ async function proxyShotApiRequest(
|
|
|
472
473
|
const basePath = baseUrl.pathname.replace(/\/+$/, "");
|
|
473
474
|
let path = requestUrl.pathname.slice(SHOT_API_PROXY_PREFIX.length) || "/";
|
|
474
475
|
let method = request.method.toUpperCase();
|
|
475
|
-
if (!isShotApiRequestAllowed(method, path)) return shotApiError(
|
|
476
|
+
if (!isShotApiRequestAllowed(method, path)) return shotApiError(SHOT_REQUEST_REFUSED, 403);
|
|
476
477
|
const headers = new Headers();
|
|
477
478
|
for (const name of SHOT_API_REQUEST_HEADERS) {
|
|
478
479
|
const value = request.headers.get(name);
|
package/src/cli/history-rows.ts
CHANGED
|
@@ -511,12 +511,24 @@ export function historyVolume(
|
|
|
511
511
|
* with a volume says the same (`historyVolumeBasis`): `volume in USD per UTC day, aggregate across venues`, `volume in
|
|
512
512
|
* USD summed over 3 spot venues`.
|
|
513
513
|
*/
|
|
514
|
-
|
|
514
|
+
function historyVolumeText(volume: HistoryVolume, interval: ManualChartResolution | null, basis: string | null = null): string {
|
|
515
515
|
const text = interval === "1d" ? `volume in ${volume.unit} per UTC day` : `volume in ${volume.unit}`;
|
|
516
516
|
if (!basis) return text;
|
|
517
517
|
return basis === "aggregate" ? `${text}, aggregate across venues` : `${text} summed over ${basis}`;
|
|
518
518
|
}
|
|
519
519
|
|
|
520
|
+
/**
|
|
521
|
+
* What the status line says of a history's volume: a coin's unit and basis
|
|
522
|
+
* (historyVolumeText), or, for bars whose volume has no unit to state, what
|
|
523
|
+
* it counts when the history says (`volume basis: daily total` on an index's
|
|
524
|
+
* daily bars, `volume basis: intraday count` on its hourly ones, which sum
|
|
525
|
+
* below the day's). Null when neither is known.
|
|
526
|
+
*/
|
|
527
|
+
export function historyVolumeNote(volume: HistoryVolume | null, interval: ManualChartResolution | null, basis: string | null): string | null {
|
|
528
|
+
if (volume) return historyVolumeText(volume, interval, basis);
|
|
529
|
+
return basis ? `volume basis: ${basis}` : null;
|
|
530
|
+
}
|
|
531
|
+
|
|
520
532
|
/** What the volume of every bar that has one counts, when they all say the same; null otherwise. */
|
|
521
533
|
export function historyVolumeBasis(rows: readonly Pick<HistoryRow, "volume" | "volumeBasis">[]): string | null {
|
|
522
534
|
const bases = new Set(rows.filter((row) => row.volume != null).map((row) => row.volumeBasis ?? null));
|
|
@@ -738,6 +750,11 @@ export function historyUnit(listing: string, quote: { currency?: string; instrum
|
|
|
738
750
|
: { kind: "unknown", currency: null, unit: null };
|
|
739
751
|
}
|
|
740
752
|
|
|
753
|
+
/** The unit an export names for a history's prices: a pair's quote currency per base (`JPY per USD`), else its currency or unit. */
|
|
754
|
+
export function historyExportUnit(unit: HistoryUnit): string | null {
|
|
755
|
+
return unit.kind === "pair" ? unit.unit : unit.currency ?? unit.unit;
|
|
756
|
+
}
|
|
757
|
+
|
|
741
758
|
function historyDate(value: string): string {
|
|
742
759
|
return value.length > 10 ? formatUtcTime(value) : value;
|
|
743
760
|
}
|
package/src/cli/known-gaps.ts
CHANGED
|
@@ -5,6 +5,9 @@ import { parsePublicTickerKey } from "../utils/exchanges";
|
|
|
5
5
|
import { listingAbroadVenue } from "../utils/sec";
|
|
6
6
|
import { nimCommand } from "./bank-section";
|
|
7
7
|
import { treasuryYieldLine, treasuryYieldTenor } from "./treasury-yields";
|
|
8
|
+
import { namedCurrencyPair } from "./currency-name-hint";
|
|
9
|
+
import { dollarPairListing } from "../utils/currency-pair";
|
|
10
|
+
import { currencyCodeTyped } from "../utils/currency-names";
|
|
8
11
|
|
|
9
12
|
/**
|
|
10
13
|
* What a listing is to a sub-minute ask: a US listing, which has a tape; one
|
|
@@ -347,9 +350,21 @@ const COMMAND_POINTERS: ReadonlyArray<{
|
|
|
347
350
|
},
|
|
348
351
|
];
|
|
349
352
|
|
|
350
|
-
/** The command for a query that names a setting ("light theme")
|
|
353
|
+
/** The command for a query that names a setting ("light theme"), a portfolio report ("drip") or a currency ("yen"), else null. */
|
|
351
354
|
export function commandPointer(query: string): string | null {
|
|
352
|
-
return findCommandPointer(query)?.line ??
|
|
355
|
+
return findCommandPointer(query)?.line ?? currencyPointer(query);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* `fx` for a query that is one currency, by its code (`jpy`, `CHF`) or its
|
|
360
|
+
* name (`yen`, `swiss franc`): its rate and its pair. A code that is also an
|
|
361
|
+
* English word counts only in capitals (`TRY`, not "try"). Null for the
|
|
362
|
+
* dollar, which has no pair of its own, and for anything else.
|
|
363
|
+
*/
|
|
364
|
+
function currencyPointer(query: string): string | null {
|
|
365
|
+
const code = currencyCodeTyped(query) ?? namedCurrencyPair(query)?.code;
|
|
366
|
+
if (!code || code === "USD") return null;
|
|
367
|
+
return `The ${code} rate: gloom fx ${code}; its pair's history: gloom history ${dollarPairListing(code)}`;
|
|
353
368
|
}
|
|
354
369
|
|
|
355
370
|
/**
|
package/src/cli/not-a-ticker.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { notATickerSymbol } from "../sources/provider-errors";
|
|
2
2
|
import { boardCoinFor } from "./board-coins";
|
|
3
|
+
import { currencyNameHint } from "./currency-name-hint";
|
|
3
4
|
import { splitSymbolArgs, splitSymbolWords } from "./symbol-args";
|
|
4
5
|
import { treasuryYieldHint, treasuryYieldTenor } from "./treasury-yields";
|
|
5
6
|
|
|
6
7
|
// "Not a ticker: APPLE." as the router words it; the symbol ends at the sentence's own period.
|
|
7
|
-
// One that already names what to try (a search, a FRED series, a yield, the pair search offered) is left alone.
|
|
8
|
-
const NOT_A_TICKER_SENTENCE = /Not a ticker: ((?:(?!\.\s)[^\n`\x1b])+?)\.(?=\s|\x1b|$)(?! Try `gloom (?:search|fred|quote) | Did you mean )/g;
|
|
8
|
+
// One that already names what to try (a search, a FRED series, a yield, a currency's rate, the pair search offered) is left alone.
|
|
9
|
+
const NOT_A_TICKER_SENTENCE = /Not a ticker: ((?:(?!\.\s)[^\n`\x1b])+?)\.(?=\s|\x1b|$)(?! Try `gloom (?:search|fred|quote|fx) | Did you mean )/g;
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* The symbol as the user typed it on the command line (`Apple`), not as the router saw it (`APPLE`).
|
|
@@ -53,7 +54,8 @@ export function withSearchHints(text: string, args: readonly string[], isFredSer
|
|
|
53
54
|
const coin = boardCoinFor(id);
|
|
54
55
|
if (coin) return `${sentence} Did you mean ${coin.symbol}${coin.name && coin.name.toUpperCase() !== coin.symbol ? ` (${coin.name})` : ""}?`;
|
|
55
56
|
const tenor = treasuryYieldTenor(typed);
|
|
56
|
-
|
|
57
|
+
// A currency's name (`yen`) is its rate and its pair, not a ticker search could find.
|
|
58
|
+
return `${sentence} ${tenor ? treasuryYieldHint(tenor) : currencyNameHint(typed) ?? searchHint(typed)}`;
|
|
57
59
|
})
|
|
58
60
|
: named;
|
|
59
61
|
}
|
|
@@ -647,6 +647,9 @@ export function limitationSentence(text: string): string {
|
|
|
647
647
|
return !trimmed || /[.!?]["')\]]*$/.test(trimmed) ? trimmed : `${trimmed}.`;
|
|
648
648
|
}
|
|
649
649
|
|
|
650
|
+
/** A data requirement that is an account: a sign-in (free or verified) or Gloom Pro, as `catalog` names under Requires. */
|
|
651
|
+
const ACCOUNT_REQUIREMENT = /\bsign-in\b|\baccount\b|\bPro\b/;
|
|
652
|
+
|
|
650
653
|
/**
|
|
651
654
|
* Names as lines of at most `width`, each name whole and the names apart by
|
|
652
655
|
* semicolons, since a name may hold a comma (Furnishings, Fixtures & Appliances).
|
|
@@ -688,7 +691,12 @@ function renderCatalogEntry(entry: PaneCatalogEntry): string {
|
|
|
688
691
|
const mnemonics = new Set([entry.token, ...entry.aliases].map((value) => value.toLowerCase()));
|
|
689
692
|
const keywords = capability.aliases.filter((keyword) => !mnemonics.has(keyword.toLowerCase()));
|
|
690
693
|
if (keywords.length > 0) stats.push(["Keywords", keywords.join(", ")]);
|
|
691
|
-
|
|
694
|
+
// "Requires" is what a reader must have, a sign-in or Pro; the rest says where the data comes from, which a
|
|
695
|
+
// signed-out run reads too (COT's CFTC history, CBR's rates).
|
|
696
|
+
const required = capability.dataRequirements.filter((requirement) => ACCOUNT_REQUIREMENT.test(requirement));
|
|
697
|
+
const sources = capability.dataRequirements.filter((requirement) => !ACCOUNT_REQUIREMENT.test(requirement));
|
|
698
|
+
if (required.length > 0) stats.push(["Requires", required.join(", ")]);
|
|
699
|
+
if (sources.length > 0) stats.push(["Data", sources.join(", ")]);
|
|
692
700
|
if (capability.limitations.length > 0) stats.push(["Limitations", capability.limitations.map(limitationSentence).join(" ")]);
|
|
693
701
|
lines.push(renderStats(stats));
|
|
694
702
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { currencyRateUnitText } from "../../time-series/price-units";
|
|
1
2
|
import { getSharedRegistry } from "../../plugins/registry";
|
|
2
3
|
import { seriesExpression, seriesNamedBy } from "../../series/registry";
|
|
3
4
|
import { findCachedPortfolioAccount } from "../../plugins/builtin/portfolio-list/cached-account";
|
|
@@ -378,7 +379,9 @@ export function serializeHeadlessPaneResult(
|
|
|
378
379
|
case "series": {
|
|
379
380
|
const series = result as HeadlessSeriesResult;
|
|
380
381
|
// `textDecimals` and `textCompact` only shape the text report; JSON keeps every digit and does not carry them.
|
|
381
|
-
return { ...common, series: series.series.map(({ textDecimals: _decimals, textCompact: _compact, ...kept }) =>
|
|
382
|
+
return { ...common, series: series.series.map(({ textDecimals: _decimals, textCompact: _compact, ...kept }) => (
|
|
383
|
+
kept.unit ? { ...kept, unit: currencyRateUnitText(kept.unit) } : kept
|
|
384
|
+
)), ...(series.stats ? { stats: series.stats } : {}) };
|
|
382
385
|
}
|
|
383
386
|
case "snapshot": {
|
|
384
387
|
const snapshot = result as HeadlessSnapshotResult;
|
|
@@ -600,7 +603,7 @@ function renderSeries(result: HeadlessSeriesResult): string[] {
|
|
|
600
603
|
name: series.name?.trim() || null,
|
|
601
604
|
latest: latest ? seriesLatestDate(series, latest.date) : "-",
|
|
602
605
|
value: seriesValue(series, latest?.value ?? latest?.close ?? null),
|
|
603
|
-
unit: series.unit?.trim()
|
|
606
|
+
unit: series.unit?.trim() ? currencyRateUnitText(series.unit.trim()) : null,
|
|
604
607
|
points: observationCount(series),
|
|
605
608
|
};
|
|
606
609
|
});
|
|
@@ -646,7 +649,8 @@ function seriesTable(series: HeadlessSeries): CliReportTable {
|
|
|
646
649
|
title: series.label,
|
|
647
650
|
identity: {
|
|
648
651
|
...(series.symbol?.trim() ? { symbolOrSeries: series.symbol.trim() } : {}),
|
|
649
|
-
|
|
652
|
+
// A rate reads `JPY per USD` here as in every other export.
|
|
653
|
+
...(series.unit?.trim() ? { currencyOrUnit: currencyRateUnitText(series.unit.trim()) } : {}),
|
|
650
654
|
...(series.interval?.trim() ? { interval: series.interval.trim() } : {}),
|
|
651
655
|
},
|
|
652
656
|
columns: [dates.every((date) => date.length <= 10) ? "Date" : "Time", ...fields.map(header)],
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
nextRegularSessionOpen,
|
|
9
9
|
} from "../../market-data/market/freshness";
|
|
10
10
|
import { futuresWeekendClosure } from "../../market-data/market/futures-week";
|
|
11
|
-
import { currentFxClosureStart, isFxMarketOpen } from "../../utils/fx-market-hours";
|
|
11
|
+
import { currentFxClosureStart, isFxMarketOpen, isFxWeekClosePrint } from "../../utils/fx-market-hours";
|
|
12
12
|
import { zonedDateKey } from "../../utils/zoned-date-time";
|
|
13
13
|
import type { ReportTime } from "../../utils/utc-time";
|
|
14
14
|
import type { QuoteIndexSession } from "../../types/financials";
|
|
@@ -118,7 +118,6 @@ function quotedSessions({ timeZone, current, regular }: QuoteIndexSession, now:
|
|
|
118
118
|
|
|
119
119
|
/** The venue spot FX pairs trade on. It has no session calendar here; its week is in `fx-market-hours`. */
|
|
120
120
|
const FX_VENUE = "CCY";
|
|
121
|
-
const DAY_MS = 24 * 60 * 60_000;
|
|
122
121
|
|
|
123
122
|
/**
|
|
124
123
|
* The newest observation is its venue's latest close: the venue has not
|
|
@@ -128,13 +127,13 @@ const DAY_MS = 24 * 60 * 60_000;
|
|
|
128
127
|
function closeDateOf(observation: SessionObservation, session: VenueSession, now: number): string | null {
|
|
129
128
|
const time = observation.time;
|
|
130
129
|
if (!time || time.dateOnly) return null;
|
|
131
|
-
// FX closes once a week, Friday 17:00 New York time
|
|
132
|
-
//
|
|
133
|
-
//
|
|
134
|
-
//
|
|
130
|
+
// FX closes once a week, Friday 17:00 New York time: a print in its last
|
|
131
|
+
// minute is that Friday's close. An earlier print of the day (20:39Z) is no
|
|
132
|
+
// close, and a tick after it, over the weekend, is no price of the week:
|
|
133
|
+
// both keep their own time.
|
|
135
134
|
const weekClose = canonicalExchange(observation.exchange) === FX_VENUE ? currentFxClosureStart(now) : null;
|
|
136
135
|
if (weekClose != null) {
|
|
137
|
-
return time.time
|
|
136
|
+
return isFxWeekClosePrint(time.time, weekClose) ? zonedDateKey(weekClose - 1, "America/New_York") : null;
|
|
138
137
|
}
|
|
139
138
|
if (session.last && session.timeZone) {
|
|
140
139
|
if (session.last.open != null && time.time < session.last.open) return null;
|
package/src/cli/series-search.ts
CHANGED
|
@@ -82,27 +82,26 @@ function shellArgument(expression: string): string {
|
|
|
82
82
|
|
|
83
83
|
/**
|
|
84
84
|
* The series part of `catalog` or `search`: a table of the first `limit`
|
|
85
|
-
* matches with the expression `fn G` charts, and how to see the rest
|
|
85
|
+
* matches with the expression `fn G` charts, and how to see the rest:
|
|
86
|
+
* `catalog <words> --all`, which lists every one.
|
|
86
87
|
*/
|
|
87
88
|
export function renderSeriesMatches(
|
|
88
89
|
query: string,
|
|
89
90
|
matches: readonly SeriesMatch[],
|
|
90
91
|
limit: number,
|
|
91
92
|
width: number,
|
|
92
|
-
/** Where the rest are listed: `shot CAT` from the catalog, the catalog from a search. */
|
|
93
|
-
rest: "catalog" | "data-catalog" = "data-catalog",
|
|
94
93
|
): string {
|
|
95
94
|
if (matches.length === 0) return "";
|
|
96
95
|
const shown = matches.slice(0, limit);
|
|
97
96
|
const count = shown.length < matches.length ? `${shown.length} of ${matches.length}` : String(matches.length);
|
|
98
|
-
const
|
|
97
|
+
const words = query.replace(/"/g, "").trim();
|
|
99
98
|
// A FRED series named by its id is also one `gloom fred` prints.
|
|
100
99
|
const asked = query.trim().toUpperCase().replace(/^FRED:/, "");
|
|
101
100
|
const fred = matches.find((match) => match.exact && fredSeriesIdOf(match.expression) === asked);
|
|
102
101
|
const hint = fred
|
|
103
102
|
? `Print it with gloom fred ${asked}; chart it with gloom fn G ${fred.expression}.`
|
|
104
103
|
: shown.length < matches.length
|
|
105
|
-
? `Chart one with gloom fn G <chart>; gloom
|
|
104
|
+
? `Chart one with gloom fn G <chart>; gloom catalog ${shellArgument(words)} --all lists all ${matches.length}.`
|
|
106
105
|
: "Chart one with gloom fn G <chart>.";
|
|
107
106
|
return [
|
|
108
107
|
`${renderSection(`Series for "${query}"`)} ${cliStyles.muted(`(${count})`)}`,
|
|
@@ -77,6 +77,13 @@ export function useCompositePanelBitmap({
|
|
|
77
77
|
const desktopRenderedSizeRef = useRef<{ pixelWidth: number; pixelHeight: number } | null>(null);
|
|
78
78
|
const desktopCancelRenderRef = useRef<(() => void) | null>(null);
|
|
79
79
|
const desktopActiveRef = useRef(false);
|
|
80
|
+
/** What the current desktop bitmap was drawn from. */
|
|
81
|
+
const desktopDrawnRef = useRef<{
|
|
82
|
+
panel: CompositePanelScene;
|
|
83
|
+
pixelWidth: number;
|
|
84
|
+
pixelHeight: number;
|
|
85
|
+
colors: CompositeChartColors;
|
|
86
|
+
} | null>(null);
|
|
80
87
|
const pixelWidth = bitmapSize?.pixelWidth ?? null;
|
|
81
88
|
const pixelHeight = bitmapSize?.pixelHeight ?? null;
|
|
82
89
|
|
|
@@ -84,6 +91,18 @@ export function useCompositePanelBitmap({
|
|
|
84
91
|
? { panel, pixelWidth, pixelHeight, colors }
|
|
85
92
|
: null;
|
|
86
93
|
|
|
94
|
+
// New data at the size and palette already drawn (a live quote moving the
|
|
95
|
+
// last bar) is drawn in this render. Drawn in the layout effect, its state
|
|
96
|
+
// update would render the panel a second time, a commit per tick; the paint
|
|
97
|
+
// is the same either way, since the effect also draws before it.
|
|
98
|
+
const drawn = desktopDrawnRef.current;
|
|
99
|
+
if (isDesktopWeb && desktopActiveRef.current && desktopBitmapRef.current && drawn && drawn.panel !== panel
|
|
100
|
+
&& drawn.pixelWidth === pixelWidth && drawn.pixelHeight === pixelHeight && drawn.colors === colors
|
|
101
|
+
&& desktopCancelRenderRef.current === null && !desktopUnpaintedRef.current && !revealed) {
|
|
102
|
+
desktopBitmapRef.current = renderPanelBitmap(panel, { pixelWidth, pixelHeight }, colors);
|
|
103
|
+
desktopDrawnRef.current = { panel, pixelWidth, pixelHeight, colors };
|
|
104
|
+
}
|
|
105
|
+
|
|
87
106
|
// The cursor is drawn as a separate overlay, so the plot raster stays cached
|
|
88
107
|
// (and resident in the terminal) while the crosshair moves.
|
|
89
108
|
const terminalBitmap = useMemo(() => {
|
|
@@ -114,6 +133,7 @@ export function useCompositePanelBitmap({
|
|
|
114
133
|
};
|
|
115
134
|
desktopRenderedColorsRef.current = input.colors;
|
|
116
135
|
desktopBitmapRef.current = next;
|
|
136
|
+
desktopDrawnRef.current = input;
|
|
117
137
|
setDesktopBitmap(next);
|
|
118
138
|
// A chart that fills its box when it opens takes its measured size
|
|
119
139
|
// before its first paint, by the end of the frame after next. Later
|
|
@@ -140,6 +160,7 @@ export function useCompositePanelBitmap({
|
|
|
140
160
|
desktopRequestedSizeRef.current = null;
|
|
141
161
|
desktopRenderedSizeRef.current = null;
|
|
142
162
|
desktopBitmapRef.current = null;
|
|
163
|
+
desktopDrawnRef.current = null;
|
|
143
164
|
setDesktopBitmap((current) => current === null ? current : null);
|
|
144
165
|
return;
|
|
145
166
|
}
|
|
@@ -158,7 +179,11 @@ export function useCompositePanelBitmap({
|
|
|
158
179
|
|
|
159
180
|
if (!desktopBitmapRef.current || sizeAlreadyRendered || desktopRenderedColorsRef.current !== colors || desktopUnpaintedRef.current || revealed) {
|
|
160
181
|
cancelRender();
|
|
161
|
-
|
|
182
|
+
const current = desktopDrawnRef.current;
|
|
183
|
+
// The render drew this data already.
|
|
184
|
+
const drawnNow = !!desktopBitmapRef.current && current?.panel === panel && current.colors === colors
|
|
185
|
+
&& current.pixelWidth === pixelWidth && current.pixelHeight === pixelHeight;
|
|
186
|
+
if (!drawnNow) render();
|
|
162
187
|
return;
|
|
163
188
|
}
|
|
164
189
|
|
|
@@ -176,5 +201,6 @@ export function useCompositePanelBitmap({
|
|
|
176
201
|
}, []);
|
|
177
202
|
|
|
178
203
|
if (!bitmapSize) return null;
|
|
179
|
-
|
|
204
|
+
// The state only renders the panel again; the ref also holds what this render drew.
|
|
205
|
+
return isDesktopWeb ? desktopBitmapRef.current ?? desktopBitmap : terminalBitmap;
|
|
180
206
|
}
|
|
@@ -492,6 +492,17 @@ function addCandidate(
|
|
|
492
492
|
if (!duplicate) candidates.push(candidate);
|
|
493
493
|
}
|
|
494
494
|
|
|
495
|
+
/**
|
|
496
|
+
* Blank cells a regular tick keeps from the start and end labels: half the
|
|
497
|
+
* room between two ticks, from 3 to 5 cells. Those two are the longest labels
|
|
498
|
+
* on the axis (a date with its year), and a tick closer than that reads as a
|
|
499
|
+
* part of one ("Oct Oct 29 2026") instead of a mark of its own.
|
|
500
|
+
*/
|
|
501
|
+
function endpointLabelGap(interval: CompositeTimeAxisInterval, span: number, axisWidth: number): number {
|
|
502
|
+
const tickRoom = (axisWidth * interval.approximateMs) / span;
|
|
503
|
+
return clamp(Math.round(tickRoom / 2), 3, 5);
|
|
504
|
+
}
|
|
505
|
+
|
|
495
506
|
function layoutTimeAxis({
|
|
496
507
|
startTime,
|
|
497
508
|
endTime,
|
|
@@ -641,6 +652,9 @@ function layoutTimeAxis({
|
|
|
641
652
|
const minimumGap = interval.unit === "month" || interval.unit === "year" ? 2 : 1;
|
|
642
653
|
let previousTimestamp = firstTimestamp;
|
|
643
654
|
let previousEnd = startLabel.length - 1;
|
|
655
|
+
const endpointGap = endpointLabelGap(interval, span, axisWidth);
|
|
656
|
+
// The first tick follows the start label, the rest follow a tick.
|
|
657
|
+
let previousGap = endpointGap;
|
|
644
658
|
for (const candidate of candidates.filter((entry) => !entry.boundary)) {
|
|
645
659
|
const label = formatInteriorLabel(candidate.timestamp, previousTimestamp, interval, clock);
|
|
646
660
|
// A year boundary inside the final year would repeat the right endpoint's year.
|
|
@@ -648,8 +662,8 @@ function layoutTimeAxis({
|
|
|
648
662
|
const center = candidate.ratio * Math.max(axisWidth - 1, 0);
|
|
649
663
|
const start = resolveLabelStart(center, label, axisWidth);
|
|
650
664
|
const end = start + label.length - 1;
|
|
651
|
-
if (start <= previousEnd +
|
|
652
|
-
if (end >= endStart -
|
|
665
|
+
if (start <= previousEnd + previousGap) continue;
|
|
666
|
+
if (end >= endStart - endpointGap) continue;
|
|
653
667
|
writeLabel(axis, start, label);
|
|
654
668
|
placed.push({
|
|
655
669
|
timestamp: candidate.timestamp,
|
|
@@ -660,6 +674,7 @@ function layoutTimeAxis({
|
|
|
660
674
|
});
|
|
661
675
|
previousTimestamp = candidate.timestamp;
|
|
662
676
|
previousEnd = end;
|
|
677
|
+
previousGap = minimumGap;
|
|
663
678
|
}
|
|
664
679
|
|
|
665
680
|
writeLabel(axis, endStart, endLabel);
|
|
@@ -74,6 +74,7 @@ export function useCommandBarActionRuntime({
|
|
|
74
74
|
tickers,
|
|
75
75
|
}: UseCommandBarActionRuntimeOptions) {
|
|
76
76
|
const {
|
|
77
|
+
changePaneTicker,
|
|
77
78
|
duplicatePane,
|
|
78
79
|
focusTicker,
|
|
79
80
|
persistLayoutChange,
|
|
@@ -90,6 +91,7 @@ export function useCommandBarActionRuntime({
|
|
|
90
91
|
readTickerSearchCache,
|
|
91
92
|
writeTickerSearchCache,
|
|
92
93
|
} = useCommandBarTickerSearchActions({
|
|
94
|
+
changePaneTicker,
|
|
93
95
|
closeAll,
|
|
94
96
|
dispatch,
|
|
95
97
|
focusTicker,
|
|
@@ -14,7 +14,7 @@ import { normalizeTickerInput } from "../../../../tickers/search";
|
|
|
14
14
|
import { useRendererHost } from "../../../../ui";
|
|
15
15
|
import type { ThemePickerHandle } from "../../theme-picker";
|
|
16
16
|
import type { Command } from "../registry";
|
|
17
|
-
import type
|
|
17
|
+
import { SECURITY_DESCRIPTION_SEARCH, type CollectionCommandId } from "../../helpers";
|
|
18
18
|
import {
|
|
19
19
|
runDirectCommandAction,
|
|
20
20
|
} from "./index";
|
|
@@ -93,7 +93,7 @@ export function useCommandBarDirectCommandRuntime({
|
|
|
93
93
|
closeAll({ revertThemePreview: false });
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
|
-
openModeRoute("ticker-search", "");
|
|
96
|
+
openModeRoute("ticker-search", "", SECURITY_DESCRIPTION_SEARCH);
|
|
97
97
|
return;
|
|
98
98
|
}
|
|
99
99
|
|
|
@@ -113,7 +113,7 @@ export function useCommandBarDirectCommandRuntime({
|
|
|
113
113
|
closeAll({ revertThemePreview: false });
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
|
-
openModeRoute("ticker-search", trimmed);
|
|
116
|
+
openModeRoute("ticker-search", trimmed, SECURITY_DESCRIPTION_SEARCH);
|
|
117
117
|
}, [
|
|
118
118
|
activeCollectionId,
|
|
119
119
|
activeTickerSymbol,
|
|
@@ -15,6 +15,8 @@ export {
|
|
|
15
15
|
export type RouteCommandId = "security-description" | "layout";
|
|
16
16
|
export type CollectionCommandId = "add-watchlist" | "add-portfolio" | "remove-watchlist" | "remove-portfolio";
|
|
17
17
|
|
|
18
|
+
export { SECURITY_DESCRIPTION_SEARCH } from "../../core/state/app/command-bar-launch";
|
|
19
|
+
|
|
18
20
|
export function isRouteCommandId(commandId: string): commandId is RouteCommandId {
|
|
19
21
|
return commandId === "security-description"
|
|
20
22
|
|| commandId === "layout";
|
|
@@ -40,6 +40,12 @@ export interface ResultItem {
|
|
|
40
40
|
listing?: TickerListingRef;
|
|
41
41
|
/** Materialize this exact listing when another command consumes the row. */
|
|
42
42
|
resolveTicker?: () => Promise<TickerRecord>;
|
|
43
|
+
/**
|
|
44
|
+
* A ticker row's three choices: `des` opens it as DES does (the row's `action`), `new` in a
|
|
45
|
+
* new research pane (its `secondaryAction`), and `pane` changes the focused pane's ticker, as
|
|
46
|
+
* ticker search's Enter does.
|
|
47
|
+
*/
|
|
48
|
+
pickTicker?: (how: TickerPick) => void;
|
|
43
49
|
/**
|
|
44
50
|
* What the pane this row opens will load, so the bar can warm it while the
|
|
45
51
|
* row is the pick. Unset when only opening can tell (a broker contract, a
|
|
@@ -73,6 +79,9 @@ export interface ResultItem {
|
|
|
73
79
|
action: () => void | Promise<void>;
|
|
74
80
|
}
|
|
75
81
|
|
|
82
|
+
/** What choosing a ticker row does; see `ResultItem.pickTicker`. */
|
|
83
|
+
export type TickerPick = "des" | "pane" | "new";
|
|
84
|
+
|
|
76
85
|
/** A row plain Enter can run, so the untouched selection may rest on it. */
|
|
77
86
|
export function isDefaultSelectable(item: ResultItem): boolean {
|
|
78
87
|
return item.disabled !== true && item.defaultSelectable !== false;
|