gloomberb 0.20.13 → 0.20.14

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.
Files changed (155) hide show
  1. package/package.json +2 -1
  2. package/patches/@opentui%2Fcore@0.3.2.patch +22 -4
  3. package/src/account/auth-dialog.tsx +22 -4
  4. package/src/account/auth-form.tsx +6 -1
  5. package/src/account/checkout-handoff.tsx +7 -14
  6. package/src/account/device-signin-dialog.tsx +35 -24
  7. package/src/api-client/crypto-markets.ts +10 -0
  8. package/src/api-client/errors.ts +3 -1
  9. package/src/api-client/money-markets.ts +7 -0
  10. package/src/api-client/request.ts +12 -2
  11. package/src/architecture/floating-promise-allowlist.json +0 -1
  12. package/src/brokers/signed-in/sign-in-dialog.tsx +38 -38
  13. package/src/cli/commands/market.ts +95 -23
  14. package/src/cli/commands/overview.ts +18 -4
  15. package/src/cli/errors.ts +3 -1
  16. package/src/cli/freshness.ts +7 -2
  17. package/src/cli/glossary.ts +10 -5
  18. package/src/cli/helpers.ts +8 -16
  19. package/src/cli/history-export.ts +4 -0
  20. package/src/cli/known-gaps.ts +2 -2
  21. package/src/cli/listing-arg.ts +79 -11
  22. package/src/cli/not-a-ticker.ts +4 -0
  23. package/src/cli/pane-functions/catalog.ts +29 -8
  24. package/src/cli/pane-functions/headless.ts +5 -2
  25. package/src/cli/pane-functions/options.ts +7 -0
  26. package/src/cli/pane-functions/resolver.ts +61 -15
  27. package/src/cli/result.ts +22 -4
  28. package/src/cli/symbol-args.ts +5 -3
  29. package/src/cli/symbol-list.ts +23 -10
  30. package/src/cli/symbol-rows.ts +135 -3
  31. package/src/cli/treasury-yields.ts +15 -1
  32. package/src/components/chart/composite/format.ts +2 -1
  33. package/src/components/chart/composite/panel-surface/axis-markers.ts +133 -0
  34. package/src/components/chart/composite/panel-surface/level-labels.tsx +78 -0
  35. package/src/components/chart/composite/panel-surface/overlays.ts +108 -0
  36. package/src/components/chart/composite/panel-surface/pan-coast.ts +54 -0
  37. package/src/components/chart/composite/panel-surface/panel-cursor.tsx +138 -0
  38. package/src/components/chart/composite/panel-surface/panel-levels.ts +47 -0
  39. package/src/components/chart/composite/panel-surface/plot-gestures.ts +403 -0
  40. package/src/components/chart/composite/panel-surface/plot-pointer.ts +65 -0
  41. package/src/components/chart/composite/panel-surface/plot-wheel.ts +102 -0
  42. package/src/components/chart/composite/panel-surface/pointer.ts +12 -0
  43. package/src/components/chart/composite/panel-surface/props.ts +79 -0
  44. package/src/components/chart/composite/panel-surface/tool-readout.ts +151 -0
  45. package/src/components/chart/composite/panel-surface/value-axis-gestures.ts +152 -0
  46. package/src/components/chart/composite/panel-surface.tsx +81 -1177
  47. package/src/components/command-bar/commands/collection-list.ts +1 -0
  48. package/src/components/command-bar/routes/root/results.ts +3 -2
  49. package/src/components/command-bar/routes/root/runtime.ts +3 -2
  50. package/src/components/command-bar/routes/root/selection.ts +3 -2
  51. package/src/components/command-bar/routes/root/shortcuts.ts +15 -0
  52. package/src/components/layout/pane/title.ts +10 -4
  53. package/src/components/pane-settings-dialog/tui.tsx +6 -3
  54. package/src/components/pane-settings-dialog.tsx +2 -1
  55. package/src/components/pane-template-wizard.tsx +2 -0
  56. package/src/components/ui/choice-dialog.tsx +1 -1
  57. package/src/components/ui/confirm-dialog.tsx +3 -2
  58. package/src/components/ui/frame.tsx +7 -3
  59. package/src/components/ui/icon.tsx +4 -2
  60. package/src/components/ui/list-view.tsx +8 -0
  61. package/src/components/ui/number-prompt-dialog.tsx +2 -1
  62. package/src/components/use-pane-notice-footer.tsx +3 -1
  63. package/src/docs/snapshot.json +2 -2
  64. package/src/i18n/es.ts +1 -0
  65. package/src/i18n/ja.ts +1 -0
  66. package/src/i18n/ko.ts +1 -0
  67. package/src/i18n/zh-cn.ts +1 -0
  68. package/src/i18n/zh-tw.ts +1 -0
  69. package/src/market-data/market/format.ts +35 -1
  70. package/src/market-data/quotes/contributions.ts +13 -0
  71. package/src/market-data/quotes/export-identity.ts +36 -1
  72. package/src/market-data/quotes/resolution.ts +16 -0
  73. package/src/plugins/builtin/account-management/password-dialog.tsx +2 -2
  74. package/src/plugins/builtin/analytics/risk-client.ts +12 -2
  75. package/src/plugins/builtin/analytics/risk-headless.ts +66 -6
  76. package/src/plugins/builtin/analytics/risk-math.ts +23 -6
  77. package/src/plugins/builtin/analytics/risk-model.ts +20 -9
  78. package/src/plugins/builtin/analytics/risk-pane.tsx +2 -2
  79. package/src/plugins/builtin/chart-composer/catalog-inventory.ts +5 -2
  80. package/src/plugins/builtin/chart-composer/editor.tsx +1 -0
  81. package/src/plugins/builtin/chart-composer/pane.tsx +1 -1
  82. package/src/plugins/builtin/chart-composer/quick-add.tsx +4 -1
  83. package/src/plugins/builtin/chart-composer/series-catalog.ts +17 -1
  84. package/src/plugins/builtin/cloud/plugin.tsx +2 -0
  85. package/src/plugins/builtin/cloud/thesis/module.tsx +2 -0
  86. package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +6 -2
  87. package/src/plugins/builtin/cpi/headless.ts +6 -1
  88. package/src/plugins/builtin/cpi/model.ts +17 -0
  89. package/src/plugins/builtin/cpi/pane.tsx +3 -1
  90. package/src/plugins/builtin/crypto-board/client.ts +6 -1
  91. package/src/plugins/builtin/crypto-board/headless.ts +10 -2
  92. package/src/plugins/builtin/crypto-board/model.ts +89 -11
  93. package/src/plugins/builtin/crypto-board/pane.tsx +20 -5
  94. package/src/plugins/builtin/dividend-yield/client.ts +24 -2
  95. package/src/plugins/builtin/dividend-yield/headless.ts +4 -2
  96. package/src/plugins/builtin/dividend-yield/ranking.ts +2 -1
  97. package/src/plugins/builtin/dividend-yield/view.ts +5 -1
  98. package/src/plugins/builtin/earnings/history-table.ts +8 -0
  99. package/src/plugins/builtin/earnings-ripple/index.tsx +2 -0
  100. package/src/plugins/builtin/econ/calendar-model.ts +17 -1
  101. package/src/plugins/builtin/econ/fred-catalog.ts +33 -4
  102. package/src/plugins/builtin/econ-statistics/headless.ts +21 -0
  103. package/src/plugins/builtin/macro-day/headless.ts +21 -10
  104. package/src/plugins/builtin/macro-day/model.ts +40 -3
  105. package/src/plugins/builtin/macro-day/pane.tsx +26 -8
  106. package/src/plugins/builtin/macro-day/releases.ts +24 -1
  107. package/src/plugins/builtin/money-markets/client.ts +4 -1
  108. package/src/plugins/builtin/money-markets/headless.ts +15 -4
  109. package/src/plugins/builtin/money-markets/index.tsx +1 -1
  110. package/src/plugins/builtin/money-markets/pane.tsx +7 -1
  111. package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +4 -2
  112. package/src/plugins/builtin/portfolio-list/cli/period-report.ts +61 -11
  113. package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +11 -3
  114. package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +2 -0
  115. package/src/plugins/builtin/portfolio-list/headless.ts +33 -6
  116. package/src/plugins/builtin/portfolio-list/pane/index.tsx +5 -3
  117. package/src/plugins/builtin/portfolio-list/pane/period-pnl.ts +24 -6
  118. package/src/plugins/builtin/portfolio-list/period-pnl.ts +16 -1
  119. package/src/plugins/builtin/portfolio-list/summary/index.tsx +4 -1
  120. package/src/plugins/builtin/portfolio-list/summary/totals.ts +6 -4
  121. package/src/plugins/builtin/portfolio-list/table.tsx +25 -15
  122. package/src/plugins/builtin/shared/cloud-upgrade.ts +4 -2
  123. package/src/plugins/builtin/shared/cpi-year-gap.ts +67 -0
  124. package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +45 -2
  125. package/src/plugins/builtin/ticker-detail/headless.ts +26 -1
  126. package/src/plugins/builtin/ticker-detail/overview/components.tsx +4 -5
  127. package/src/plugins/builtin/ticker-detail/overview/model.ts +4 -1
  128. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +10 -2
  129. package/src/portfolio/collection-name.ts +2 -1
  130. package/src/portfolio/column-values.ts +14 -4
  131. package/src/portfolio/listed-symbol.ts +4 -2
  132. package/src/portfolio/period-pnl.ts +51 -1
  133. package/src/renderers/dom/dialog-host.tsx +5 -5
  134. package/src/renderers/electrobun/view/remote/capability-invoker.ts +1 -1
  135. package/src/renderers/opentui/dialog-host.tsx +3 -4
  136. package/src/sources/gloomberb-cloud/normalizers.ts +5 -0
  137. package/src/sources/provider-router/history.ts +5 -2
  138. package/src/test-support/plugin-persistence.ts +12 -0
  139. package/src/tickers/company-name-listing.ts +4 -3
  140. package/src/tickers/company-name.ts +19 -1
  141. package/src/tickers/instrument-coverage.ts +27 -0
  142. package/src/tickers/search/home-listing.ts +38 -1
  143. package/src/tickers/search/index.ts +3 -2
  144. package/src/tickers/search/ranking.ts +21 -2
  145. package/src/time-series/base-series.ts +4 -0
  146. package/src/time-series/types.ts +5 -2
  147. package/src/types/financials.ts +13 -0
  148. package/src/types/headless.ts +2 -0
  149. package/src/ui/dialog-stack.ts +17 -0
  150. package/src/ui/dialog.tsx +6 -2
  151. package/src/utils/crypto-pair.ts +9 -0
  152. package/src/utils/exchanges.ts +13 -0
  153. package/src/utils/financial-statements.ts +60 -3
  154. package/src/utils/futures-generic.ts +14 -0
  155. package/src/utils/trailing-dividend.ts +13 -3
@@ -328,6 +328,7 @@ export async function addPastedListToWatchlist(options: {
328
328
  ),
329
329
  // A saved alias of a holding is the holding's own record, as for the single add.
330
330
  add: (ticker) => withCollectionMembership(resolveCollectionTicker(ticker, deps.getState().tickers, "watchlist", targetId), "watchlist", "add", targetId),
331
+ member: (ticker) => ticker.metadata.watchlists.includes(targetId),
331
332
  });
332
333
 
333
334
  for (const ticker of saved) {
@@ -18,7 +18,7 @@ import { isCollectionCommand, SECURITY_DESCRIPTION_SEARCH } from "../../helpers"
18
18
  import { recentPaneTemplateArg } from "../../pane-templates/items";
19
19
  import { dedupeById, PASTED_LIST_CATEGORY } from "../../view-model";
20
20
  import type { ResultItem } from "../../list/model";
21
- import { shortcutArgument, type parseRootShortcutIntent } from "./shortcuts";
21
+ import { commandShortcutQuery, shortcutArgument, type parseRootShortcutIntent } from "./shortcuts";
22
22
  import type { CommandBarRoute } from "../../workflow/types";
23
23
  import { createRootCommandItemBuilder } from "./command-items";
24
24
  import { buildRootShortcutItem } from "./shortcut-items";
@@ -301,7 +301,8 @@ export function buildRootResultModel(options: RootResultModelOptions): RootResul
301
301
  });
302
302
 
303
303
  const items: ResultItem[] = [];
304
- const match = matchPrefix(rootQuery, availableCommands);
304
+ // A command typed after its ticker (`MC FP Equity DES`) lists as typed first (`DES MC:EPA`).
305
+ const match = matchPrefix(commandShortcutQuery(rootQuery, rootShortcutIntent), availableCommands);
305
306
  // A pasted list, which the bar flattens into one line, leads with adding its symbols. The AI is still offered.
306
307
  const pastedList = rootShortcutIntent.kind === "none" && !match && rootQuery ? pastedRootList(rootQuery) : null;
307
308
  let initialIdx = 0;
@@ -17,7 +17,7 @@ import { buildRootResultModel, type RootResultModel } from "./results";
17
17
  import { useRootProviderSearch } from "./provider-search";
18
18
  import { isProviderResultItem } from "./search-providers";
19
19
  import { buildRootShortcutFeedback } from "./shortcut-feedback";
20
- import type { ShortcutIntent } from "./shortcuts";
20
+ import { commandShortcutQuery, type ShortcutIntent } from "./shortcuts";
21
21
  import { clampIndex } from "../../../../utils/math";
22
22
 
23
23
  /** Written the way a symbol is: up to five letters and a share class (AAPL, nvda, BRK.B). */
@@ -184,7 +184,8 @@ export function useCommandBarRootRuntime({
184
184
  */
185
185
  const pinnedRootRowRef = useRef<{ id: string; answer: string | null } | null>(null);
186
186
  const previousAnswerTookTopRef = useRef(0);
187
- const activeMatch = matchPrefix(rootQuery, availableCommands);
187
+ // `MC FP Equity DES` is `DES MC:EPA`, as `MC FP Equity GP` is `GP MC:EPA`.
188
+ const activeMatch = matchPrefix(commandShortcutQuery(rootQuery, rootShortcutIntent), availableCommands);
188
189
 
189
190
  const tickerSearchRouteQuery = currentRoute?.kind === "mode" && currentRoute.screen === "ticker-search"
190
191
  ? currentRoute.query
@@ -14,7 +14,7 @@ import {
14
14
  } from "../../helpers";
15
15
  import type { ResultItem } from "../../list/model";
16
16
  import { getPaneTemplateArgKind } from "../../pane-templates/items";
17
- import { parseRootShortcutIntent, shortcutArgument } from "./shortcuts";
17
+ import { commandShortcutQuery, parseRootShortcutIntent, shortcutArgument } from "./shortcuts";
18
18
  import { buildHelpArgumentItems } from "./help-items";
19
19
  import { recordFunctionOpen } from "../../../../telemetry/usage-counts";
20
20
 
@@ -127,7 +127,8 @@ export function buildImmediateRootSelection(options: RootSelectionCommandOptions
127
127
  });
128
128
  }
129
129
 
130
- const match = matchPrefix(options.query, options.availableCommands);
130
+ // `MC FP Equity DES` runs as `DES MC:EPA`, as `MC FP Equity GP` opens GP.
131
+ const match = matchPrefix(commandShortcutQuery(options.query, intent), options.availableCommands);
131
132
  if (!match) {
132
133
  return null;
133
134
  }
@@ -20,6 +20,8 @@ interface ShortcutIntentBase {
20
20
  completionQuery: string | null;
21
21
  /** The ticker in focus the argument was filled with, when none was typed. */
22
22
  inferredArg?: string;
23
+ /** Typed in Bloomberg's order, the ticker before the code (`MC FP Equity DES`). */
24
+ tickerFirst?: true;
23
25
  }
24
26
 
25
27
  interface CommandShortcutIntent extends ShortcutIntentBase {
@@ -43,6 +45,18 @@ export type ShortcutIntent =
43
45
  | PaneTemplateShortcutIntent
44
46
  | PluginCommandShortcutIntent;
45
47
 
48
+ /**
49
+ * The query a command runs as: one typed ticker first (`MC FP Equity DES`) in
50
+ * the code's own order (`DES MC:EPA`), so it lists, searches and opens on
51
+ * Enter as the code typed first does, as a pane's code typed after its ticker
52
+ * does (`MC FP Equity GP`). Any other query as typed.
53
+ */
54
+ export function commandShortcutQuery(query: string, intent: ShortcutIntent): string {
55
+ return intent.kind !== "none" && intent.source === "command" && intent.tickerFirst && intent.argText
56
+ ? `${intent.prefix} ${intent.argText}`
57
+ : query;
58
+ }
59
+
46
60
  interface ShortcutParseCandidate {
47
61
  prefix: string;
48
62
  label: string;
@@ -239,6 +253,7 @@ export function parseRootShortcutIntent({
239
253
  argText,
240
254
  completionQuery,
241
255
  ...(kind === "inferred-complete" && inferredArg && issuer ? { inferredArg } : {}),
256
+ ...(trimmed !== typed ? { tickerFirst: true as const } : {}),
242
257
  };
243
258
 
244
259
  if (match.source === "command" && match.command) {
@@ -8,8 +8,14 @@ import {
8
8
  import type { PaneDef } from "../../../types/plugin";
9
9
  import { paneTitleMnemonic, TITLE_TICKER } from "../../../layout/pane-follow";
10
10
  import { canFollowTickerSource, isTickerLinkPeer } from "../../../layout/ticker-navigation";
11
+ import { withoutCryptoVenueCode } from "../../../utils/crypto-pair";
11
12
  import { displayTickerKey } from "../../../utils/exchanges";
12
13
 
14
+ /** A ticker as a title names it: by its venue's own code, and a coin by its pair alone (USDT-USD, never USDT-USD:CCC). */
15
+ function titleTickerKey(key: string): string {
16
+ return withoutCryptoVenueCode(displayTickerKey(key));
17
+ }
18
+
13
19
  /**
14
20
  * A title a template wrote, its command and the ticker keys it opened on
15
21
  * ("FA 9992:XHKG", "RV 9992:XHKG,PLTR"), with each key by its venue's code
@@ -22,7 +28,7 @@ function displayStoredTitle(title: string): string {
22
28
  const parts = title.slice(mnemonic.length).split(/(\s*,\s*)/);
23
29
  const keys = parts.filter((_, index) => index % 2 === 0).map((key) => key.trim());
24
30
  if (!keys[0] || !keys.every((key) => TITLE_TICKER.test(key))) return title;
25
- return `${title.slice(0, mnemonic.length)}${parts.map((part, index) => index % 2 === 0 ? part.replace(part.trim(), displayTickerKey(part.trim())) : part).join("")}`;
31
+ return `${title.slice(0, mnemonic.length)}${parts.map((part, index) => index % 2 === 0 ? part.replace(part.trim(), titleTickerKey(part.trim())) : part).join("")}`;
26
32
  }
27
33
 
28
34
  /** Single-cell link glyph: emoji link icons render double-width in terminals. */
@@ -48,7 +54,7 @@ export function getBasePaneDisplayTitle(
48
54
 
49
55
  if (instance.paneId === TICKER_RESEARCH_PANE_ID) {
50
56
  const ticker = resolveTickerForPane(state as AppState, instance.instanceId);
51
- if (ticker) return displayTickerKey(ticker);
57
+ if (ticker) return titleTickerKey(ticker);
52
58
  const collectionId = resolveCollectionForPane(state as AppState, instance.instanceId);
53
59
  return state.config.portfolios.find((portfolio) => portfolio.id === collectionId)?.name
54
60
  ?? state.config.watchlists.find((watchlist) => watchlist.id === collectionId)?.name
@@ -62,7 +68,7 @@ export function getBasePaneDisplayTitle(
62
68
  : null;
63
69
  if (mnemonic) {
64
70
  const ticker = resolveTickerForPane(state as AppState, instance.instanceId);
65
- return ticker ? `${mnemonic} ${displayTickerKey(ticker)}` : mnemonic;
71
+ return ticker ? `${mnemonic} ${titleTickerKey(ticker)}` : mnemonic;
66
72
  }
67
73
 
68
74
  if (instance.title) return displayStoredTitle(instance.title);
@@ -78,7 +84,7 @@ export function getBasePaneDisplayTitle(
78
84
  if (paneDef.tickerSource) return t(paneDef.name);
79
85
 
80
86
  const ticker = resolveTickerForPane(state as AppState, instance.instanceId);
81
- return ticker ? `${t(paneDef.name)}: ${displayTickerKey(ticker)}` : t(paneDef.name);
87
+ return ticker ? `${t(paneDef.name)}: ${titleTickerKey(ticker)}` : t(paneDef.name);
82
88
  }
83
89
 
84
90
  export function getPaneDisplayTitle(
@@ -48,9 +48,9 @@ export function TuiDialogList({ descriptionColor, ...props }: ListViewProps & {
48
48
  );
49
49
  }
50
50
 
51
- export function TuiUnavailablePaneSettingsDialog() {
51
+ export function TuiUnavailablePaneSettingsDialog({ dismiss }: { dismiss?: () => void }) {
52
52
  return (
53
- <DialogFrame title={t("Pane Settings")} footer={t("Press esc to cancel")}>
53
+ <DialogFrame title={t("Pane Settings")} footer={t("Press esc to cancel")} onClose={dismiss}>
54
54
  <Text fg={colors.textDim}>{t("This pane is no longer configurable.")}</Text>
55
55
  </DialogFrame>
56
56
  );
@@ -58,6 +58,7 @@ export function TuiUnavailablePaneSettingsDialog() {
58
58
 
59
59
  export function TuiPaneSettingsDialogBody({
60
60
  title,
61
+ dismiss,
61
62
  fields,
62
63
  selectedIndex,
63
64
  settings,
@@ -66,6 +67,8 @@ export function TuiPaneSettingsDialogBody({
66
67
  onActivate,
67
68
  }: {
68
69
  title: string;
70
+ /** The close button in the title, for a mouse; Esc closes too. */
71
+ dismiss?: () => void;
69
72
  fields: PaneSettingField[];
70
73
  selectedIndex: number;
71
74
  settings: Record<string, unknown>;
@@ -76,7 +79,7 @@ export function TuiPaneSettingsDialogBody({
76
79
  }) {
77
80
  const notes = fields.map((field) => noteFor?.(field) ?? null);
78
81
  return (
79
- <DialogFrame title={t(title)}>
82
+ <DialogFrame title={t(title)} onClose={dismiss}>
80
83
  <TuiDialogList
81
84
  items={fields.map((field, index) => ({
82
85
  id: field.key,
@@ -209,7 +209,7 @@ export function PaneSettingsDialogContent({
209
209
  if (!descriptor) {
210
210
  return isDesktop
211
211
  ? <DesktopUnavailablePaneSettingsDialog dismiss={dismiss} />
212
- : <TuiUnavailablePaneSettingsDialog />;
212
+ : <TuiUnavailablePaneSettingsDialog dismiss={dismiss} />;
213
213
  }
214
214
 
215
215
  const title = descriptor.settingsDef.title ?? `${descriptor.paneDef.name} Settings`;
@@ -236,6 +236,7 @@ export function PaneSettingsDialogContent({
236
236
  ) : (
237
237
  <TuiPaneSettingsDialogBody
238
238
  title={title}
239
+ dismiss={dismiss}
239
240
  fields={fields}
240
241
  selectedIndex={selectedIndex}
241
242
  settings={descriptor.context.settings}
@@ -9,6 +9,7 @@ import { t, tf } from "../i18n";
9
9
 
10
10
  export function PaneTemplateInputStep({
11
11
  resolve,
12
+ dismiss,
12
13
  step,
13
14
  }: PromptContext<string> & { step: WizardStep }) {
14
15
  const inputRef = useRef<InputRenderable>(null);
@@ -21,6 +22,7 @@ export function PaneTemplateInputStep({
21
22
  return (
22
23
  <DialogFrame
23
24
  title={step.label}
25
+ onClose={dismiss}
24
26
  footer={step.defaultValue
25
27
  ? `Press Enter to use ${step.defaultValue}`
26
28
  : step.required === false
@@ -172,7 +172,7 @@ export function ChoiceDialog({
172
172
  }, searchable ? { allowEditable: true } : undefined);
173
173
 
174
174
  return (
175
- <DialogFrame title={title} footer={footer} showTitleDivider={false}>
175
+ <DialogFrame title={title} footer={footer} showTitleDivider={false} onClose={() => resolve("")}>
176
176
  {/* Never wider than the dialog: a phone is narrower than the cells asked for. The terminal's list spans its box,
177
177
  60 columns, so its scrollbar runs down the box's edge rather than through the middle of it. */}
178
178
  <Box flexDirection="column" {...(desktop ? { style: { width: fitDialogWidth(width) } } : { width: "100%" })}>
@@ -51,7 +51,7 @@ export interface ConfirmDialogProps extends PromptContext<boolean> {
51
51
  status?: ReactNode;
52
52
  /** While the confirmed work runs: the buttons are off and only Esc answers. */
53
53
  busy?: boolean;
54
- /** Adds the desktop close button beside the title. */
54
+ /** Adds the desktop close button beside the title; the terminal has its Cancel button. */
55
55
  onClose?: () => void;
56
56
  /**
57
57
  * Lays the buttons out as a form's Cancel and Submit: Cancel, then the
@@ -174,7 +174,8 @@ export function ConfirmDialog({
174
174
  title={title}
175
175
  footer={footer ?? keyLine}
176
176
  desktopFooter={null}
177
- onClose={onClose}
177
+ // The terminal's Cancel is its mouse close already: a second close in the title would only repeat it.
178
+ onClose={desktop ? onClose : undefined}
178
179
  >
179
180
  <Box flexDirection="column" {...(desktop ? { style: { width: fitDialogWidth(width) } } : { width })}>
180
181
  {renderBody(body)}
@@ -5,6 +5,7 @@ import { t } from "../../i18n";
5
5
  import type { ThemeColors } from "../../theme/colors";
6
6
  import { RADIUS, SPACE, controlBorderColour, surfaceRaisedColour } from "../../theme/ui-tokens";
7
7
  import { useThemeColors } from "../../theme/theme-context";
8
+ import { IconButton } from "./icon";
8
9
 
9
10
  export interface ModalSurfaceOptions {
10
11
  width?: string;
@@ -106,7 +107,7 @@ export interface DialogFrameProps {
106
107
  */
107
108
  desktopFooter?: DialogDesktopFooter | null;
108
109
  showTitleDivider?: boolean;
109
- /** Adds a close button at the right of the title (desktop). Esc still closes every dialog. */
110
+ /** Adds a close button at the right of the title, so the mouse can close it. Esc still closes every dialog. */
110
111
  onClose?: () => void;
111
112
  /**
112
113
  * Desktop: lets the frame shrink inside a dialog that caps its height, so a
@@ -130,8 +131,11 @@ export function DialogFrame({ title: rawTitle, subtitle, children, footer: rawFo
130
131
 
131
132
  return (
132
133
  <Box flexDirection="column">
133
- <Box height={1}>
134
- <Text fg={colors.text} attributes={TextAttributes.BOLD}>{title}</Text>
134
+ <Box height={1} flexDirection="row">
135
+ <Box flexGrow={1} flexShrink={1} overflow="hidden">
136
+ <Text fg={colors.text} attributes={TextAttributes.BOLD}>{title}</Text>
137
+ </Box>
138
+ {onClose && <IconButton icon="close" label="Close" onPress={() => onClose()} />}
135
139
  </Box>
136
140
  {subtitle && <Text fg={colors.textMuted} wrapText>{subtitle}</Text>}
137
141
  <Box height={1} />
@@ -1,7 +1,7 @@
1
1
  import { type ComponentType } from "react";
2
2
  import { Box, Text, useUiHost } from "../../ui";
3
3
  import { useThemeColors } from "../../theme/theme-context";
4
- import { useRemoteUiNode } from "../../remote/semantic-tree";
4
+ import { useRemoteUiNode, useRemoteUiScope } from "../../remote/semantic-tree";
5
5
  import { t } from "../../i18n";
6
6
 
7
7
  export type IconName =
@@ -160,12 +160,14 @@ export function IconButton({
160
160
  }: IconButtonProps) {
161
161
  const colors = useThemeColors();
162
162
  const label = t(rawLabel);
163
+ // Of the surface it is drawn in, as a kit Button is: a prompt's dialog's close is that prompt's.
164
+ const remoteScope = useRemoteUiScope();
163
165
  useRemoteUiNode({
164
166
  role: "button",
165
167
  label,
166
168
  disabled,
167
169
  actions: { press: () => { if (!disabled) onPress?.(); } },
168
- metadata: { icon, pressed },
170
+ metadata: { icon, pressed, ...(remoteScope ? { scope: remoteScope } : {}) },
169
171
  });
170
172
  const HostIconButton = useUiHost().IconButton as ComponentType<IconButtonProps> | undefined;
171
173
  if (HostIconButton) {
@@ -69,6 +69,12 @@ export interface ListViewProps {
69
69
  height?: number;
70
70
  flexGrow?: number;
71
71
  scrollable?: boolean;
72
+ /**
73
+ * Terminal: false scrolls without a scrollbar, so each row runs to the
74
+ * list's edge and a press on its last column picks it, as in a short
75
+ * suggestion drawer. The wheel and the keys still scroll it.
76
+ */
77
+ scrollbar?: boolean;
72
78
  selectOnHover?: boolean;
73
79
  autoScrollToIndex?: boolean;
74
80
  /**
@@ -205,6 +211,7 @@ export function ListView({
205
211
  height,
206
212
  flexGrow,
207
213
  scrollable = false,
214
+ scrollbar = true,
208
215
  selectOnHover = false,
209
216
  autoScrollToIndex = true,
210
217
  checkboxRows,
@@ -386,6 +393,7 @@ export function ListView({
386
393
  flexGrow={flexGrow}
387
394
  scrollY
388
395
  focusable={false}
396
+ {...(scrollbar ? {} : { verticalScrollbarOptions: { visible: false } })}
389
397
  {...(onMouseScroll ? { onMouseScroll } : {})}
390
398
  >
391
399
  <Box flexDirection="column" gap={terminalRowGap}>{rows}</Box>
@@ -28,6 +28,7 @@ export interface NumberPromptDialogProps extends PromptContext<number> {
28
28
  */
29
29
  export function NumberPromptDialog({
30
30
  resolve,
31
+ dismiss,
31
32
  title,
32
33
  initialValue,
33
34
  min,
@@ -44,7 +45,7 @@ export function NumberPromptDialog({
44
45
  }, []);
45
46
 
46
47
  return (
47
- <DialogFrame title={title}>
48
+ <DialogFrame title={title} onClose={dismiss}>
48
49
  <Box flexDirection="column" width={32}>
49
50
  <TextField
50
51
  inputRef={inputRef}
@@ -11,6 +11,7 @@ import { DialogFrame } from "./ui/frame";
11
11
  import { Prose } from "./ui/prose";
12
12
  import { logFailure } from "../utils/log-failure";
13
13
  import { markPaneNoticesSeen, usePaneNoticesSeen } from "./pane-notice-seen";
14
+ import { withoutCryptoVenueCode } from "../utils/crypto-pair";
14
15
 
15
16
  export interface UsePaneNoticeFooterOptions {
16
17
  registrationId: string;
@@ -82,7 +83,8 @@ export function usePaneNoticeFooter({
82
83
  const dialogOpen = useDialogState((state) => state.isOpen);
83
84
  const scopeActive = usePaneFooterScopeActive();
84
85
  const title = t(rawTitle);
85
- const noticeKey = JSON.stringify([...new Set(notices.map((notice) => notice.trim()).filter(Boolean))]);
86
+ // Said as a reader takes it: a coin's pair without the internal code of the venue it is charted on.
87
+ const noticeKey = JSON.stringify([...new Set(notices.map((notice) => withoutCryptoVenueCode(notice.trim())).filter(Boolean))]);
86
88
  const currentNotices = useMemo<readonly string[]>(() => JSON.parse(noticeKey), [noticeKey]);
87
89
  const active = enabled && scopeActive && currentNotices.length > 0;
88
90
  const seen = usePaneNoticesSeen(currentNotices);
@@ -8696,7 +8696,7 @@
8696
8696
  "title": "Futures curves and rolling (CTM)",
8697
8697
  "summary": "A futures curve lines up every contract month of one commodity, rising (contango) when storing costs money and falling (backwardation) when it is scarce now, and CTM shows it with the cost of rolling.",
8698
8698
  "chapter": "Futures, commodities and energy",
8699
- "minutes": 4
8699
+ "minutes": 5
8700
8700
  },
8701
8701
  {
8702
8702
  "url": "/academy/futures-commodities-energy/positioning-cot",
@@ -8729,7 +8729,7 @@
8729
8729
  {
8730
8730
  "url": "/academy/futures-commodities-energy/macro-days",
8731
8731
  "title": "How a stock reacts on macro days (MDAY)",
8732
- "summary": "MDAY compares how a US listing moves on CPI, jobs and Fed decision days with a normal day, over up to five years, and lists every release day with its move.",
8732
+ "summary": "MDAY compares how a US listing moves on CPI, jobs and central bank decision days with a normal day, over up to five years, and lists every release day with its figures and move.",
8733
8733
  "chapter": "Futures, commodities and energy",
8734
8734
  "minutes": 4
8735
8735
  },
package/src/i18n/es.ts CHANGED
@@ -1311,6 +1311,7 @@ export const es: Record<string, string> = {
1311
1311
  "Pro trial · {days}d left": "Prueba Pro · quedan {days} d",
1312
1312
  "{delay} delayed": "{delay} de retraso",
1313
1313
  "{delay} delayed · try Pro live": "{delay} de retraso · prueba Pro en directo",
1314
+ "Stock quotes are {minutes} min delayed without Pro.": "Sin Pro, las cotizaciones de acciones llegan con {minutes} min de retraso.",
1314
1315
  "Pro trial {days}d": "Prueba Pro {days} d",
1315
1316
  "Pro trial — ends {date}": "Prueba Pro: termina el {date}",
1316
1317
  "{amount}/mo": "{amount}/mes",
package/src/i18n/ja.ts CHANGED
@@ -697,6 +697,7 @@ export const ja: Record<string, string> = {
697
697
  "Pro trial · {days}d left": "Pro トライアル · 残り{days}日",
698
698
  "{delay} delayed": "{delay}遅延",
699
699
  "{delay} delayed · try Pro live": "{delay}遅延 · Pro のリアルタイムを試す",
700
+ "Stock quotes are {minutes} min delayed without Pro.": "Pro なしでは株価は{minutes}分遅れです。",
700
701
  "Pro trial {days}d": "Pro トライアル{days}日",
701
702
  "Pro trial — ends {date}": "Pro トライアル — {date} まで",
702
703
  "delayed": "遅延",
package/src/i18n/ko.ts CHANGED
@@ -695,6 +695,7 @@ export const ko: Record<string, string> = {
695
695
  "Pro trial · {days}d left": "Pro 체험 · {days}일 남음",
696
696
  "{delay} delayed": "{delay} 지연",
697
697
  "{delay} delayed · try Pro live": "{delay} 지연 · Pro 실시간 사용해 보기",
698
+ "Stock quotes are {minutes} min delayed without Pro.": "Pro가 없으면 주식 시세는 {minutes}분 지연됩니다.",
698
699
  "Pro trial {days}d": "Pro 체험 {days}일",
699
700
  "Pro trial — ends {date}": "Pro 체험 — {date} 종료",
700
701
  "delayed": "지연",
package/src/i18n/zh-cn.ts CHANGED
@@ -697,6 +697,7 @@ export const zhCN: Record<string, string> = {
697
697
  "Pro trial · {days}d left": "Pro 试用 · 剩余 {days} 天",
698
698
  "{delay} delayed": "延迟 {delay}",
699
699
  "{delay} delayed · try Pro live": "延迟 {delay} · 试用 Pro 实时数据",
700
+ "Stock quotes are {minutes} min delayed without Pro.": "未开通 Pro 时,股票行情延迟 {minutes} 分钟。",
700
701
  "Pro trial {days}d": "Pro 试用 {days} 天",
701
702
  "Pro trial — ends {date}": "Pro 试用 — {date} 结束",
702
703
  "delayed": "延迟",
package/src/i18n/zh-tw.ts CHANGED
@@ -697,6 +697,7 @@ export const zhTW: Record<string, string> = {
697
697
  "Pro trial · {days}d left": "Pro 試用 · 剩餘 {days} 天",
698
698
  "{delay} delayed": "延遲 {delay}",
699
699
  "{delay} delayed · try Pro live": "延遲 {delay} · 試用 Pro 即時資料",
700
+ "Stock quotes are {minutes} min delayed without Pro.": "未開通 Pro 時,股票報價延遲 {minutes} 分鐘。",
700
701
  "Pro trial {days}d": "Pro 試用 {days} 天",
701
702
  "Pro trial — ends {date}": "Pro 試用 — {date} 結束",
702
703
  "delayed": "延遲",
@@ -644,9 +644,14 @@ export function stablePriceFractionDigits(context: StablePriceContext): number {
644
644
  digits = 2;
645
645
  }
646
646
  if (kind !== "crypto" && reference !== undefined) digits = Math.max(digits, tinyPriceFractionDigits(reference));
647
+ // A coin's session prices raise its decimals only to six significant figures: a composite's close is computed,
648
+ // and one written to eight decimals (0.99880666) would pad every price, bid and range to eight as well.
649
+ const sessionCeiling = kind === "crypto" && reference !== undefined
650
+ ? Math.min(ceiling, Math.max(digits, 5 - Math.floor(Math.log10(reference))))
651
+ : ceiling;
647
652
  for (const price of context.sessionPrices ?? []) {
648
653
  const magnitude = positiveMagnitude(price);
649
- if (magnitude !== undefined) digits = Math.max(digits, writtenFractionDigits(magnitude, ceiling));
654
+ if (magnitude !== undefined) digits = Math.max(digits, writtenFractionDigits(magnitude, sessionCeiling));
650
655
  }
651
656
  return digits;
652
657
  }
@@ -751,6 +756,35 @@ export function formatMarketPriceWithCurrency(
751
756
  return `${hasNonZeroDigit(body) ? sign : ""}${prefix}${body}${suffix}`;
752
757
  }
753
758
 
759
+ const writtenDecimals = (text: string) => /\.(\d+)\D*$/.exec(text)?.[1]!.length ?? 0;
760
+
761
+ /**
762
+ * A range's low and high, both to one number of decimals, with `currency`'s
763
+ * sign when given. A coin's ends are rounded to its price's decimals first
764
+ * (stablePriceFractionDigits' six significant figures): a composite's low of
765
+ * 0.9989128 beside a high of 0.998990 is a float's tail, not a finer trade the
766
+ * price's decimals must keep.
767
+ */
768
+ export function formatMarketPriceRange(
769
+ low: number,
770
+ high: number,
771
+ options: MarketFormatOptions = {},
772
+ currency?: string,
773
+ ): [string, string] {
774
+ const format = (value: number, digits?: number) => {
775
+ const shown = digits === undefined ? options : { ...options, fixedFractionDigits: digits };
776
+ return currency === undefined ? formatMarketPrice(value, shown) : formatMarketPriceWithCurrency(value, currency, shown);
777
+ };
778
+ const coinDigits = resolveAssetDisplayKind(options) === "crypto" ? options.fixedFractionDigits : undefined;
779
+ const round = (value: number) => coinDigits === undefined || !Number.isFinite(value) ? value : Number(value.toFixed(coinDigits));
780
+ const ends = [round(low), round(high)] as const;
781
+ const texts: [string, string] = [format(ends[0]), format(ends[1])];
782
+ const digits = texts.map(writtenDecimals);
783
+ if (digits[0] === digits[1]) return texts;
784
+ const shared = Math.max(digits[0]!, digits[1]!);
785
+ return [format(ends[0], shared), format(ends[1], shared)];
786
+ }
787
+
754
788
  export function formatMarketCostWithCurrency(
755
789
  value: number | undefined,
756
790
  currency = "USD",
@@ -240,6 +240,17 @@ export function mergeQuoteContribution(
240
240
  else delete merged.yearRangeBasis;
241
241
  }
242
242
 
243
+ // What a coin's day range and volume measure goes with the range the merge keeps, as the 52-week range's does:
244
+ // a tick relaying the same range keeps the word, one with another range says its own or none.
245
+ if (next.high !== undefined || next.low !== undefined) {
246
+ const relayed = next.statsBasis === undefined && next.high === current.high && next.low === current.low;
247
+ const basis = relayed ? current.statsBasis : next.statsBasis;
248
+ if (basis) merged.statsBasis = basis;
249
+ else delete merged.statsBasis;
250
+ if (relayed ? current.rangeWidened : next.rangeWidened) merged.rangeWidened = true;
251
+ else delete merged.rangeWidened;
252
+ }
253
+
243
254
  // What this observation's move is from, when not its previous close (a coin's
244
255
  // 24 hours), is said with each one: a quote back on its
245
256
  // previous close drops an earlier "24h", and one on 24 hours drops the
@@ -263,6 +274,8 @@ export function mergeQuoteContribution(
263
274
  }
264
275
  // So is a close its daily closes could not date: the next reading says it again.
265
276
  if (next.previousCloseUndated === undefined) delete merged.previousCloseUndated;
277
+ // And the exchange whose own trade the price is: a composite or streamed tick after it names none.
278
+ if (next.priceVenue === undefined) delete merged.priceVenue;
266
279
 
267
280
  if (isOtherTradingDay(current, next)) {
268
281
  const record = merged as unknown as Record<string, unknown>;
@@ -3,6 +3,7 @@ import { isYieldIndexSymbol } from "../../tickers/index-roots";
3
3
  import { currencyPairCode } from "../../utils/currency-pair";
4
4
  import { parsePublicTickerKey } from "../../utils/exchanges";
5
5
  import { INDEX_POINTS_EXPORT_UNIT, isIndexLevel, YIELD_INDEX_EXPORT_UNIT } from "../market/index-level";
6
+ import { delayedFeedLagMs } from "../market/freshness";
6
7
  import { quoteHeadlineTime, quoteSessionStateLabel } from "../market/status";
7
8
  import { isQuoteStaleForCurrentSession } from "./freshness";
8
9
 
@@ -43,12 +44,46 @@ export type BrokerNameOf = (providerId: string) => string | null | undefined;
43
44
  * the broker whose feed it is, by its name. Blank for a source with no name
44
45
  * to give, never its internal id.
45
46
  */
46
- export function quoteSourceName(quote: Pick<Quote, "providerId"> | null | undefined, brokerName?: BrokerNameOf): string {
47
+ export function quoteSourceName(quote: Pick<Quote, "providerId" | "priceVenue"> | null | undefined, brokerName?: BrokerNameOf): string {
47
48
  if (!quote) return "";
49
+ // A coin priced by one exchange's own trade is that exchange's price, not the composite's.
50
+ if (quote.priceVenue && (!quote.providerId || quote.providerId === CLOUD_PROVIDER_ID)) return quote.priceVenue;
48
51
  if (!quote.providerId || quote.providerId === CLOUD_PROVIDER_ID) return CLOUD_SOURCE;
49
52
  return brokerName?.(quote.providerId)?.trim() || "";
50
53
  }
51
54
 
55
+ /**
56
+ * What a coin's day range and volume measure, as said beside them: `composite` (across exchanges), `composite +
57
+ * Coinbase` when the range was widened to take in the exchange's price, or `1 exchange` (one exchange's own day).
58
+ * Empty when the service does not say, as for anything but a coin.
59
+ */
60
+ export function quoteStatsBasisText(quote: Pick<Quote, "statsBasis" | "rangeWidened" | "priceVenue"> | null | undefined, range = true): string {
61
+ if (quote?.statsBasis === "exchange") return "1 exchange";
62
+ if (quote?.statsBasis !== "composite") return "";
63
+ return range && quote.rangeWidened && quote.priceVenue ? `composite + ${quote.priceVenue}` : "composite";
64
+ }
65
+
66
+ const UTC_WEEKDAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
67
+
68
+ /**
69
+ * Where a coin's price is from and when, as its header says it: the exchange whose own trade it is and that trade's
70
+ * time (`Coinbase · 21:53:40 UTC`), the composite of several exchanges and its time, or `composite · 15m delayed`
71
+ * when it is held back. A time from another UTC day leads with its weekday. Empty for a quote Gloom Cloud does not
72
+ * price, such as a broker's.
73
+ */
74
+ export function coinPriceVenueText(
75
+ quote: Pick<Quote, "providerId" | "priceVenue" | "dataSource" | "lastUpdated"> | null | undefined,
76
+ now = Date.now(),
77
+ ): string {
78
+ if (!quote || (quote.providerId && quote.providerId !== CLOUD_PROVIDER_ID)) return "";
79
+ const venue = quote.priceVenue ?? "composite";
80
+ if (!quote.priceVenue && quote.dataSource === "delayed") return `${venue} · ${delayedFeedLagMs("CCC") / 60_000}m delayed`;
81
+ if (!Number.isFinite(quote.lastUpdated) || quote.lastUpdated <= 0) return venue;
82
+ const at = new Date(quote.lastUpdated);
83
+ const day = Math.floor(quote.lastUpdated / 86_400_000) === Math.floor(now / 86_400_000) ? "" : `${UTC_WEEKDAYS[at.getUTCDay()]} `;
84
+ return `${venue} · ${day}${at.toISOString().slice(11, 19)} UTC`;
85
+ }
86
+
52
87
  /** Whether a quote's feed is live, delayed or stale, as the Feed cell of `quote` says it. */
53
88
  export function quoteExportFeed(quote: Quote | null | undefined, now = Date.now()): string {
54
89
  if (!quote) return "";
@@ -146,6 +146,19 @@ function sessionConfidenceRank(confidence?: SessionConfidence): number {
146
146
  }
147
147
  }
148
148
 
149
+ /**
150
+ * What a coin's day range measures, said of the range, so it comes with the
151
+ * provider whose range it is; and whether the service widened it to take in
152
+ * its exchange's price.
153
+ */
154
+ function dayRangeBasis(contributions: readonly QuoteContribution[], resolved: Partial<Quote>): Pick<Quote, "statsBasis" | "rangeWidened"> {
155
+ const source = contributions.find((quote) => quote.high === resolved.high && quote.low === resolved.low);
156
+ return {
157
+ ...(source?.statsBasis ? { statsBasis: source.statsBasis } : {}),
158
+ ...(source?.rangeWidened ? { rangeWidened: true } : {}),
159
+ };
160
+ }
161
+
149
162
  function toProvenance(quote: QuoteContribution | undefined): QuoteFieldProvenance | undefined {
150
163
  if (!quote?.providerId) return undefined;
151
164
  return {
@@ -512,6 +525,7 @@ export function resolveCanonicalQuote(
512
525
  low52w: resolved.low52w as Quote["low52w"],
513
526
  // Said of the range, so it comes with the provider whose range it is.
514
527
  yearRangeBasis: contributions.find((quote) => quote.high52w === resolved.high52w && quote.low52w === resolved.low52w)?.yearRangeBasis,
528
+ ...dayRangeBasis(contributions, resolved),
515
529
  // Said of the price, so it comes with it.
516
530
  dailyClose: priceProvider?.dailyClose,
517
531
  marketCap: resolved.marketCap as Quote["marketCap"],
@@ -547,6 +561,8 @@ export function resolveCanonicalQuote(
547
561
  indexSession: priceProvider?.indexSession,
548
562
  // A listing that no longer trades: the price is its last trade.
549
563
  delisting: priceProvider?.delisting,
564
+ // The one exchange whose own trade or book the price is, when it is one's.
565
+ ...(priceProvider?.priceVenue ? { priceVenue: priceProvider.priceVenue } : {}),
550
566
  // A perpetual's funding, open interest and premium are of the reading that gave its price.
551
567
  ...(priceProvider?.perpetual ? { perpetual: priceProvider.perpetual } : {}),
552
568
  bid: resolved.bid as Quote["bid"],
@@ -60,7 +60,7 @@ export function DeleteAccountPasswordDialog({
60
60
 
61
61
  const fieldWidth = 42;
62
62
  return (
63
- <DialogFrame title={t("Delete Account")}>
63
+ <DialogFrame title={t("Delete Account")} onClose={dismiss}>
64
64
  <Box flexDirection="column" gap={1}>
65
65
  <ClippedText text={t("Enter your password to delete your account.")} width={fieldWidth} cut={truncateWithEllipsis} wrap />
66
66
  <TextField
@@ -152,7 +152,7 @@ export function PasswordChangeDialog({
152
152
 
153
153
  const fieldWidth = 42;
154
154
  return (
155
- <DialogFrame title={t("Change Password")}>
155
+ <DialogFrame title={t("Change Password")} onClose={dismiss}>
156
156
  <Box flexDirection="column" gap={1}>
157
157
  <TextField
158
158
  label={t("Current Password")}