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.
Files changed (217) hide show
  1. package/README.md +2 -0
  2. package/bin/gloom +9 -0
  3. package/bin/without-bun.cjs +98 -0
  4. package/package.json +3 -1
  5. package/src/api-client/data.ts +138 -35
  6. package/src/api-client/types/econ.ts +12 -0
  7. package/src/api-client/yield-curves.ts +1 -1
  8. package/src/app/global-shortcuts.ts +4 -1
  9. package/src/app/keybindings/actions.ts +6 -0
  10. package/src/app/keybindings/config.ts +2 -1
  11. package/src/app/keybindings/index.ts +1 -0
  12. package/src/app/keybindings/labels.ts +6 -1
  13. package/src/app/keybindings/resolve.ts +23 -4
  14. package/src/app/keybindings/terminal-keys.ts +35 -0
  15. package/src/app/pane-runtime/index.tsx +2 -2
  16. package/src/app/pane-runtime/ticker-open-runtime.ts +68 -40
  17. package/src/architecture/ui-literals-allowlist.json +1 -1
  18. package/src/capabilities/chart-series.ts +27 -1
  19. package/src/cli/commands/keybindings.ts +5 -5
  20. package/src/cli/commands/market.ts +78 -21
  21. package/src/cli/commands/news-search.ts +59 -7
  22. package/src/cli/commands/overview.ts +16 -1
  23. package/src/cli/commands/remote.ts +16 -17
  24. package/src/cli/commands/system.ts +1 -1
  25. package/src/cli/fx-forward.ts +25 -7
  26. package/src/cli/glossary.ts +19 -5
  27. package/src/cli/history-rows.ts +5 -3
  28. package/src/cli/known-gaps.ts +27 -1
  29. package/src/cli/listing-arg.ts +11 -1
  30. package/src/cli/name-entries.ts +5 -1
  31. package/src/cli/not-a-ticker.ts +4 -0
  32. package/src/cli/pane-functions/function-help.ts +2 -2
  33. package/src/components/command-bar/pane-settings.ts +2 -2
  34. package/src/components/command-bar/routes/root/results.ts +6 -2
  35. package/src/components/input-search-bar.tsx +9 -2
  36. package/src/components/layout/pane/header.tsx +2 -0
  37. package/src/components/layout/shell/pane/capture.ts +4 -1
  38. package/src/components/layout/status-bar.tsx +6 -1
  39. package/src/components/onboarding/first-run-workspace.ts +44 -2
  40. package/src/components/onboarding/onboarding-frame.tsx +11 -2
  41. package/src/components/onboarding/onboarding-keyboard.ts +16 -0
  42. package/src/components/onboarding/onboarding-wizard.tsx +8 -8
  43. package/src/components/onboarding/portfolio-step/positions-panel.tsx +62 -1
  44. package/src/components/onboarding/use-onboarding-progress.ts +12 -4
  45. package/src/components/pane-settings-dialog/desktop.tsx +2 -2
  46. package/src/components/pane-settings-dialog/tui.tsx +2 -2
  47. package/src/components/pane-settings-dialog/value.ts +6 -0
  48. package/src/components/pane-settings-dialog.tsx +3 -3
  49. package/src/components/reader/detail-reader.tsx +4 -0
  50. package/src/components/ui/index.ts +1 -1
  51. package/src/components/ui/page-stack-view.tsx +3 -0
  52. package/src/components/ui/pane-link-chip.tsx +269 -54
  53. package/src/components/ui/query-bar.tsx +2 -1
  54. package/src/components/ui/tabs.tsx +97 -19
  55. package/src/core/state/app/layout-reducer.ts +7 -0
  56. package/src/core/state/app/layout.ts +44 -7
  57. package/src/core/state/app/state.ts +1 -1
  58. package/src/core/state/app/types.ts +22 -2
  59. package/src/docs/snapshot.json +27 -10
  60. package/src/market-data/depositary-pair.ts +5 -3
  61. package/src/market-data/market/dated-previous-close.ts +94 -15
  62. package/src/market-data/market/status.ts +17 -1
  63. package/src/plugins/builtin/analytics/risk-client.ts +10 -4
  64. package/src/plugins/builtin/analytics/risk-episodes.ts +5 -4
  65. package/src/plugins/builtin/analytics/risk-headless.ts +4 -2
  66. package/src/plugins/builtin/analytics/risk-sectors.ts +91 -0
  67. package/src/plugins/builtin/awards/index.tsx +1 -1
  68. package/src/plugins/builtin/buildout/index.tsx +1 -0
  69. package/src/plugins/builtin/catalysts/index.tsx +2 -2
  70. package/src/plugins/builtin/cds/headless.ts +4 -0
  71. package/src/plugins/builtin/chart-composer/headless.ts +2 -1
  72. package/src/plugins/builtin/chart-composer/index.tsx +1 -0
  73. package/src/plugins/builtin/chat/content/composer.tsx +5 -4
  74. package/src/plugins/builtin/chat/content/index.tsx +12 -2
  75. package/src/plugins/builtin/chat/content/layout-metrics.ts +3 -3
  76. package/src/plugins/builtin/chat/content/open-targets.ts +3 -3
  77. package/src/plugins/builtin/chat/layout.ts +5 -2
  78. package/src/plugins/builtin/chat/message/pane-chip.tsx +61 -40
  79. package/src/plugins/builtin/chat/message/terminal.tsx +13 -15
  80. package/src/plugins/builtin/chat/pane-links/previews.ts +51 -5
  81. package/src/plugins/builtin/chat/pane-links/share-card.ts +36 -0
  82. package/src/plugins/builtin/cloud/askg/tool-display.ts +1 -0
  83. package/src/plugins/builtin/cloud/terminal-relay/redact.ts +5 -3
  84. package/src/plugins/builtin/commodity-balances/index.tsx +1 -0
  85. package/src/plugins/builtin/company-attention/index.tsx +1 -1
  86. package/src/plugins/builtin/company-kpis/headless.ts +3 -1
  87. package/src/plugins/builtin/company-kpis/index.tsx +2 -2
  88. package/src/plugins/builtin/cot/index.tsx +1 -1
  89. package/src/plugins/builtin/cpi/index.tsx +1 -1
  90. package/src/plugins/builtin/crypto-board/index.tsx +1 -0
  91. package/src/plugins/builtin/dividend-yield/index.tsx +1 -0
  92. package/src/plugins/builtin/doe/index.tsx +1 -1
  93. package/src/plugins/builtin/earnings-calls/headless.ts +5 -1
  94. package/src/plugins/builtin/earnings-calls/index.tsx +1 -0
  95. package/src/plugins/builtin/econ/calendar-model.ts +74 -1
  96. package/src/plugins/builtin/econ/fred-catalog.ts +3 -1
  97. package/src/plugins/builtin/econ/index.tsx +1 -0
  98. package/src/plugins/builtin/econ-statistics/index.tsx +1 -0
  99. package/src/plugins/builtin/econ-statistics/pane.tsx +6 -0
  100. package/src/plugins/builtin/estimate-revisions/index.tsx +1 -0
  101. package/src/plugins/builtin/executives/index.tsx +1 -0
  102. package/src/plugins/builtin/filing-events/index.tsx +1 -0
  103. package/src/plugins/builtin/fixed-income/index.tsx +1 -0
  104. package/src/plugins/builtin/futures-curve/headless.ts +3 -3
  105. package/src/plugins/builtin/futures-curve/index.tsx +1 -1
  106. package/src/plugins/builtin/futures-curve/model.ts +18 -0
  107. package/src/plugins/builtin/gpu/index.tsx +1 -1
  108. package/src/plugins/builtin/help/functions-table.tsx +1 -1
  109. package/src/plugins/builtin/help/index.tsx +11 -1
  110. package/src/plugins/builtin/help/keybindings-editor.tsx +1 -1
  111. package/src/plugins/builtin/holders/index.tsx +1 -0
  112. package/src/plugins/builtin/holders/report-header.ts +2 -2
  113. package/src/plugins/builtin/insider/index.tsx +1 -0
  114. package/src/plugins/builtin/iv-history/index.tsx +1 -1
  115. package/src/plugins/builtin/jobs/index.tsx +1 -0
  116. package/src/plugins/builtin/macro-day/headless.ts +27 -8
  117. package/src/plugins/builtin/macro-day/index.tsx +1 -1
  118. package/src/plugins/builtin/macro-day/model.ts +19 -3
  119. package/src/plugins/builtin/macro-day/pane.tsx +14 -9
  120. package/src/plugins/builtin/macro-day/releases.ts +25 -7
  121. package/src/plugins/builtin/market-valuation/index.tsx +1 -0
  122. package/src/plugins/builtin/market-valuation/pane.tsx +8 -0
  123. package/src/plugins/builtin/members/index.tsx +1 -1
  124. package/src/plugins/builtin/mna/index.tsx +1 -0
  125. package/src/plugins/builtin/news/index.tsx +1 -0
  126. package/src/plugins/builtin/news/wire/index.tsx +5 -1
  127. package/src/plugins/builtin/news/wire/news/detail-view.tsx +4 -0
  128. package/src/plugins/builtin/news/wire/news/list-search.ts +5 -2
  129. package/src/plugins/builtin/options/index.tsx +1 -0
  130. package/src/plugins/builtin/options-positioning/index.tsx +1 -0
  131. package/src/plugins/builtin/pe-band/index.tsx +1 -1
  132. package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +25 -0
  133. package/src/plugins/builtin/portfolio-list/headless.ts +15 -6
  134. package/src/plugins/builtin/power/index.tsx +1 -1
  135. package/src/plugins/builtin/realized-vol/index.tsx +1 -1
  136. package/src/plugins/builtin/research/headless.ts +10 -4
  137. package/src/plugins/builtin/research/index.tsx +4 -0
  138. package/src/plugins/builtin/research-search/index.tsx +1 -0
  139. package/src/plugins/builtin/research-search/pane.tsx +8 -0
  140. package/src/plugins/builtin/revenue-breakdown/index.tsx +1 -0
  141. package/src/plugins/builtin/reverse-dcf/index.tsx +1 -1
  142. package/src/plugins/builtin/risk-factors/index.tsx +1 -0
  143. package/src/plugins/builtin/scanner/headless.ts +52 -13
  144. package/src/plugins/builtin/seasonality/index.tsx +1 -1
  145. package/src/plugins/builtin/sec/index.tsx +1 -0
  146. package/src/plugins/builtin/series-inventory.ts +1 -1
  147. package/src/plugins/builtin/shared/scanner-capture.ts +11 -3
  148. package/src/plugins/builtin/shared/series-list-detail.tsx +5 -0
  149. package/src/plugins/builtin/short-interest/index.tsx +1 -0
  150. package/src/plugins/builtin/social-mentions/index.tsx +1 -1
  151. package/src/plugins/builtin/supply-chain/index.tsx +1 -0
  152. package/src/plugins/builtin/thirteenf/data.ts +43 -10
  153. package/src/plugins/builtin/thirteenf/headless.ts +55 -11
  154. package/src/plugins/builtin/thirteenf/model.ts +25 -9
  155. package/src/plugins/builtin/thirteenf/report-notes.ts +27 -6
  156. package/src/plugins/builtin/thirteenf/types.ts +2 -0
  157. package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +1 -1
  158. package/src/plugins/builtin/ticker-detail/financials/model.ts +12 -0
  159. package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +3 -3
  160. package/src/plugins/builtin/ticker-detail/financials/tab.tsx +5 -5
  161. package/src/plugins/builtin/ticker-detail/headless.ts +18 -13
  162. package/src/plugins/builtin/ticker-detail/index.tsx +4 -0
  163. package/src/plugins/builtin/ticker-detail/overview/model.ts +6 -4
  164. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +6 -4
  165. package/src/plugins/builtin/time-sales/client.ts +9 -11
  166. package/src/plugins/builtin/time-sales/index.tsx +1 -1
  167. package/src/plugins/builtin/treasury-auctions/after.ts +267 -0
  168. package/src/plugins/builtin/treasury-auctions/cache.ts +18 -3
  169. package/src/plugins/builtin/treasury-auctions/client.ts +33 -2
  170. package/src/plugins/builtin/treasury-auctions/headless.ts +109 -19
  171. package/src/plugins/builtin/treasury-auctions/index.tsx +14 -4
  172. package/src/plugins/builtin/treasury-auctions/model.ts +256 -28
  173. package/src/plugins/builtin/treasury-auctions/pane.tsx +139 -28
  174. package/src/plugins/builtin/treasury-auctions/treasury-direct.ts +5 -2
  175. package/src/plugins/builtin/treasury-auctions/types.ts +7 -1
  176. package/src/plugins/builtin/vol-surface/index.tsx +1 -1
  177. package/src/plugins/builtin/world-venue-map/index.ts +1 -0
  178. package/src/plugins/builtin/yield-curve/curves.ts +10 -4
  179. package/src/plugins/builtin/yield-curve/headless.ts +6 -2
  180. package/src/plugins/builtin/yield-curve/index.tsx +3 -3
  181. package/src/plugins/builtin/yield-curve/series.ts +10 -0
  182. package/src/plugins/builtin/yield-curve/world.ts +3 -1
  183. package/src/portfolio/column-values.ts +2 -1
  184. package/src/public/__snapshots__/public-api.test.ts.snap +4 -0
  185. package/src/public/remote.ts +7 -1
  186. package/src/remote/client.ts +191 -11
  187. package/src/remote/controller-utils.ts +13 -1
  188. package/src/remote/controller.ts +88 -26
  189. package/src/remote/endpoint.ts +24 -0
  190. package/src/remote/form.ts +59 -4
  191. package/src/remote/resources.ts +44 -18
  192. package/src/remote/schema.ts +21 -9
  193. package/src/remote/secrets.ts +12 -0
  194. package/src/remote/semantic-tree.tsx +14 -2
  195. package/src/remote/server.ts +2 -1
  196. package/src/remote/surface.tsx +192 -0
  197. package/src/remote/types.ts +5 -0
  198. package/src/renderers/opentui/host.tsx +6 -0
  199. package/src/series/standalone.ts +2 -2
  200. package/src/shares/api.ts +21 -4
  201. package/src/shares/item.ts +73 -0
  202. package/src/shares/pane-item.ts +205 -0
  203. package/src/shares/pane.ts +4 -0
  204. package/src/shares/payload.ts +9 -5
  205. package/src/sources/gloomberb-cloud/news.ts +2 -0
  206. package/src/tickers/renamed-listings.ts +105 -0
  207. package/src/tickers/search/index.ts +103 -16
  208. package/src/time-series/resolve.ts +2 -2
  209. package/src/types/financials.ts +1 -0
  210. package/src/types/plugin-pane-settings.ts +2 -0
  211. package/src/types/plugin-panes.ts +22 -0
  212. package/src/utils/central-banks.ts +86 -1
  213. package/src/utils/datetime-format.ts +12 -3
  214. package/src/utils/depositary-receipt.ts +28 -3
  215. package/src/utils/fundamentals.ts +14 -0
  216. package/src/utils/max-drawdown.ts +97 -16
  217. package/src/utils/untrusted-text.ts +29 -0
@@ -2,9 +2,10 @@ import type { HeadlessPaneDefinition } from "../../../types/plugin";
2
2
  import { resolveHeadlessInstrument } from "../shared/headless-market-data";
3
3
  import { loadMacroDayEarnings, loadMacroDayHistory, loadMacroDaySeriesHistory, loadMacroReleases, macroDayEarningsNotice, type MacroDayEarnings } from "./client";
4
4
  import { fredSeriesArgument } from "../../../series/fred-argument";
5
- import { formatMacroDayMove, macroDayEventLabel, macroDayStats, matchesSurprise, projectMacroDays, type MacroDayStats } from "./model";
5
+ import { formatMacroDayMove, macroDayEventLabel, macroDayReleaseName, macroDayStats, macroFigureGapNotices, matchesSurprise, projectMacroDays, type MacroDayEvent,
6
+ type MacroDayStats } from "./model";
6
7
  import { MACRO_EVENT_KINDS, MACRO_EVENT_LABELS, MACRO_RELEASE_SOURCES, MACRO_SURPRISE_LABELS, MACRO_SURPRISES, staleMacroReleasesNotice,
7
- type MacroEventKind, type MacroSurprise } from "./releases";
8
+ type MacroEventKind, type MacroReleaseFigures, type MacroSurprise } from "./releases";
8
9
 
9
10
  // A mean that rounds to zero reads 0.00%, never -0.00%.
10
11
  const percent = (value: unknown) => typeof value !== "number" ? "--" : /[1-9]/.test((value * 100).toFixed(2)) ? `${(value * 100).toFixed(2)}%` : "0.00%";
@@ -22,7 +23,8 @@ export const macroDayHeadless: HeadlessPaneDefinition<"bundle"> = {
22
23
  discovery: { screenshotReadiness: "live-dom", limitations: [
23
24
  "US listings, or a FRED series (FRED:T10Y2Y, whose moves in a rate or spread read in bp); close-to-close on the release day.",
24
25
  "Published CPI, jobs and FOMC days, and Brazil's IPCA days from Gloom Cloud; sessions after the list's last covered day (releasesThrough) are left out.",
25
- "Actual, forecast and prior for the days Gloom Cloud has them (the US headlines from its kept economic calendar, IPCA from the central bank's SGS series); --surprise keeps the days that came in hot, cool or in line with the forecast.",
26
+ "Actual, forecast and prior for the days Gloom Cloud has them (the US headlines from its kept economic calendar, under either feed's title; an FOMC day's are the federal funds target range and whether it held or moved; IPCA from the central bank's SGS series); --surprise keeps the days that came in hot, cool or in line with the forecast.",
27
+ "A release day without figures says why: before the kept calendar starts, or listed without them.",
26
28
  "A release day that is also the reaction session of the company's own earnings report is marked earnings and left out of the release averages and the normal day.",
27
29
  ] },
28
30
  options: [
@@ -61,6 +63,15 @@ export const macroDayHeadless: HeadlessPaneDefinition<"bundle"> = {
61
63
  // The days the filter keeps get a row of their own: how the name moved on hot CPI days.
62
64
  const selected = surprise === "all" ? [] : [row(`${MACRO_SURPRISE_LABELS[surprise]} ${release === "all" ? "release"
63
65
  : MACRO_EVENT_LABELS[release as MacroEventKind]}`, macroDayStats(events, model.normal.meanAbs))];
66
+ // A day without figures says why: before the kept calendar (one note for them all), or the calendar's own gap.
67
+ const figuresFrom = releases.figuresFrom;
68
+ const beforeCalendar = (event: MacroDayEvent) => !!figuresFrom && event.kind !== "ipca" && !event.figures && event.date < figuresFrom;
69
+ const missing = (event: MacroDayEvent) => event.figures ? null : event.figuresMissing
70
+ ?? (beforeCalendar(event) ? `before ${figuresFrom}, when Gloom Cloud's economic calendar starts` : null);
71
+ const figureNotes = [
72
+ ...(events.some(beforeCalendar) ? [`Release days before ${figuresFrom} have no actual, forecast or prior: Gloom Cloud's economic calendar starts then.`] : []),
73
+ ...macroFigureGapNotices(events),
74
+ ];
64
75
  return {
65
76
  sections: [
66
77
  { title: "By release", columns: [{ key: "label", header: "Day" }, { key: "count", header: "Days" },
@@ -68,18 +79,26 @@ export const macroDayHeadless: HeadlessPaneDefinition<"bundle"> = {
68
79
  { key: "mean", header: header("Avg move"), format: move }, { key: "hitRate", header: "Up", format: share }],
69
80
  rows: [...model.kinds.map((kind) => row(MACRO_EVENT_LABELS[kind], model.byKind[kind])), ...selected,
70
81
  row(model.kinds.includes("ipca") ? "Any US release" : "Any release", model.allEvents), ...(model.earnings.count ? [row("Earnings", model.earnings)] : []), row("Normal day", model.normal)] },
71
- { title: "Release days", columns: [{ key: "date", header: "Date" }, { key: "event", header: "Release" },
82
+ { title: "Release days", columns: [{ key: "date", header: "Date" },
83
+ // The text table reads the decision beside its release (FOMC held), as the pane does; exports keep the two apart.
84
+ { key: "event", header: "Release", textFormat: (_value, row) => macroDayEventLabel({ kind: row.kind as MacroEventKind,
85
+ earnings: row.earnings === true, figures: typeof row.decision === "string" ? { decision: row.decision } as MacroReleaseFigures : null }) },
72
86
  { key: "actual", header: "Actual" }, { key: "forecast", header: "Forecast" }, { key: "prior", header: "Prior" },
73
87
  { key: "surprise", header: "Surprise" },
74
88
  { key: "session", header: "Session" }, { key: "move", header: header("Move"), format: move }, { key: "multiple", header: "vs normal", format: multiple }],
75
- rows: events.map(({ figures, ...event }) => ({ ...event, event: macroDayEventLabel(event), actual: figures?.actual ?? null,
76
- forecast: figures?.forecast ?? null, prior: figures?.prior ?? null, surprise: figures?.surprise ?? null,
77
- ...(figures ? { headline: figures.event } : {}) })) },
89
+ rows: events.map((day) => {
90
+ const { figures, figuresMissing: _gap, ...event } = day;
91
+ const why = missing(day);
92
+ return { ...event, event: macroDayReleaseName(day), actual: figures?.actual ?? null,
93
+ forecast: figures?.forecast ?? null, prior: figures?.prior ?? null, surprise: figures?.surprise ?? null,
94
+ ...(figures ? { headline: figures.event } : {}), ...(figures?.decision ? { decision: figures.decision } : {}),
95
+ ...(why ? { figuresMissing: why } : {}) };
96
+ }) },
78
97
  ],
79
98
  complete: !history.stale && !earnings.stale && !history.error && !notes.length && model.events.length > 0,
80
99
  unavailableSymbols: model.events.length ? [] : [symbol],
81
100
  errors: history.error ? [history.error] : [],
82
- ...(notes.length ? { notes } : {}),
101
+ ...(notes.length || figureNotes.length ? { notes: [...notes, ...figureNotes] } : {}),
83
102
  metadata: { unit: yieldMoves ? `change in the ${seriesId ? "rate" : "yield"} in percentage points, close to close on the release day`
84
103
  : "decimal return, close to close on the release day", start: model.start, asOf: model.asOf,
85
104
  releasesThrough: releases.coveredThrough, releaseSources: Object.values(MACRO_RELEASE_SOURCES),
@@ -7,7 +7,7 @@ import { LOOKBACK_OPTIONS, MacroDayPane } from "./pane";
7
7
  export const macroDayModule: PluginModule = {
8
8
  panes: [{
9
9
  id: "macro-day", name: "Macro-Day Reaction", icon: "M", component: MacroDayPane,
10
- defaultPosition: "right", tickerFollower: true, defaultMode: "floating", defaultFloatingSize: { width: 76, height: 26 },
10
+ defaultPosition: "right", shareItem: { ticker: true }, tickerFollower: true, defaultMode: "floating", defaultFloatingSize: { width: 76, height: 26 },
11
11
  tableExport: true,
12
12
  settings: { title: "Macro-Day Reaction Settings", fields: [
13
13
  { key: "lookbackYears", label: "Lookback", type: "select", options: LOOKBACK_OPTIONS },
@@ -62,6 +62,8 @@ export interface MacroDayEvent {
62
62
  multiple: number | null;
63
63
  /** What the release came out with, when the list has it. */
64
64
  figures: MacroReleaseFigures | null;
65
+ /** Why it has none, when the list says. */
66
+ figuresMissing?: string;
65
67
  }
66
68
 
67
69
  export interface MacroDayStats {
@@ -97,10 +99,23 @@ export interface MacroDayModel {
97
99
  asOf: string | null;
98
100
  }
99
101
 
100
- /** The release's name, with the earnings marker on a day that is the ticker's own report reaction. */
101
- export const macroDayEventLabel = (event: Pick<MacroDayEvent, "kind" | "earnings">) =>
102
+ /** The release's name as it reads in the table: a policy decision's move after it (FOMC held), and the earnings marker. */
103
+ export const macroDayEventLabel = (event: Pick<MacroDayEvent, "kind" | "earnings" | "figures">) =>
104
+ [MACRO_EVENT_LABELS[event.kind], macroDayEventNote(event)].filter(Boolean).join(" ");
105
+
106
+ /** The release's name alone, with the earnings marker, as exports name it: the decision is a field of its own. */
107
+ export const macroDayReleaseName = (event: Pick<MacroDayEvent, "kind" | "earnings">) =>
102
108
  event.earnings ? `${MACRO_EVENT_LABELS[event.kind]} (earnings)` : MACRO_EVENT_LABELS[event.kind];
103
109
 
110
+ /** One line for each release day the economic calendar covers that has no figures, saying why. */
111
+ export const macroFigureGapNotices = (events: readonly Pick<MacroDayEvent, "kind" | "date" | "figures" | "figuresMissing">[]) =>
112
+ events.filter((event) => !event.figures && event.figuresMissing)
113
+ .map((event) => `${event.date} ${MACRO_EVENT_LABELS[event.kind]} has no figures: ${event.figuresMissing}.`);
114
+
115
+ /** What a row adds to its release's name: a policy decision's move, and the earnings marker. */
116
+ export const macroDayEventNote = (event: Pick<MacroDayEvent, "earnings" | "figures">) =>
117
+ [event.figures?.decision, event.earnings ? "(earnings)" : null].filter(Boolean).join(" ");
118
+
104
119
  /** Daily labels at UTC midnight name that date; any other stamp reads in New York. */
105
120
  function sessionDate(time: number): string {
106
121
  if (time % DAY_MS === 0) return new Date(time).toISOString().slice(0, 10);
@@ -215,7 +230,8 @@ export function projectMacroDays(history: readonly PricePoint[], options: {
215
230
  const move = moves.get(session);
216
231
  if (move == null || (session !== release.date && skipsAnotherWeekday(release.date, sessions[at - 1]!, session))) continue;
217
232
  if (US_KINDS.has(release.kind)) reactionSessions.add(session);
218
- found.push({ kind: release.kind, date: release.date, session, move, figures: release.figures ?? null });
233
+ found.push({ kind: release.kind, date: release.date, session, move, figures: release.figures ?? null,
234
+ ...(release.figuresMissing ? { figuresMissing: release.figuresMissing } : {}) });
219
235
  }
220
236
 
221
237
  const normalMoves = [...moves].filter(([date]) => !reactionSessions.has(date)).map(([, move]) => move);
@@ -14,7 +14,8 @@ import type { PaneProps } from "../../../types/plugin";
14
14
  import { Box } from "../../../ui";
15
15
  import { loadMacroDayEarnings, loadMacroDayHistory, loadMacroReleases, macroDayEarningsNotice } from "./client";
16
16
  import {
17
- formatMacroDayMove, macroDayEventLabel, macroDayMoveDecimals, macroDayStats, matchesSurprise, projectMacroDays, type MacroDayEvent,
17
+ formatMacroDayMove, macroDayEventLabel, macroDayEventNote, macroDayMoveDecimals, macroDayStats, matchesSurprise, macroFigureGapNotices,
18
+ projectMacroDays, type MacroDayEvent,
18
19
  type MacroDayModel, type MacroDayMoveBasis,
19
20
  } from "./model";
20
21
  import { MACRO_EVENT_KINDS, MACRO_EVENT_LABELS, MACRO_SURPRISE_LABELS, MACRO_SURPRISES, staleMacroReleasesNotice, type MacroEventKind,
@@ -26,7 +27,6 @@ const SURPRISE_OPTIONS = [{ value: "all", label: "All" }, ...MACRO_SURPRISES.map
26
27
 
27
28
  const times = (value: number | null | undefined) => value == null ? "--" : `${value.toFixed(1)}x`;
28
29
 
29
- const EARNINGS_MARK = "earnings";
30
30
  const DATE: DataTableColumn = { id: "date", label: "Date", width: 19, align: "left" };
31
31
  /** The move and its multiple of a normal day's; a yield's move is in basis points, and its header says so. */
32
32
  const moveColumns = (basis: MacroDayMoveBasis): DataTableColumn[] => [
@@ -44,14 +44,16 @@ function figureColumns(rows: readonly MacroDayEvent[]): DataTableColumn[] {
44
44
  }
45
45
 
46
46
  /**
47
- * With every release listed, the release's name, widened to take the earnings marker where a row has one. With one
48
- * selected, a column only for the marker: every row would repeat the name.
47
+ * With every release listed, the release's name, widened to take a policy decision and the earnings marker where a row
48
+ * has them. With one selected, a column only for those: every row would repeat the name.
49
49
  */
50
50
  export function columnsFor(release: string, rows: readonly MacroDayEvent[], basis: MacroDayMoveBasis = "return"): DataTableColumn[] {
51
- const marked = rows.some((event) => event.earnings);
52
51
  const values = [...figureColumns(rows), ...moveColumns(basis)];
53
- if (release === "all") return [DATE, { id: "release", label: "Release", width: marked ? 15 : 8, align: "left" }, ...values];
54
- return marked ? [DATE, { id: "release", label: "Note", width: EARNINGS_MARK.length, align: "left" }, ...values] : [DATE, ...values];
52
+ if (release === "all") return [DATE, { id: "release", label: "Release", align: "left",
53
+ width: tableColumnWidth({ label: "Release", width: Math.max(6, ...rows.map((event) => displayWidth(macroDayEventLabel(event)))) }) }, ...values];
54
+ const notes = rows.map((event) => displayWidth(macroDayEventNote(event)));
55
+ return notes.some(Boolean) ? [DATE, { id: "release", label: "Note", align: "left", width: tableColumnWidth({ label: "Note", width: Math.max(...notes) }) },
56
+ ...values] : [DATE, ...values];
55
57
  }
56
58
 
57
59
  /** By the sign the text shows: an average that rounds to 0.00% (or 0.0bp) is neither up nor down. */
@@ -127,8 +129,11 @@ export function MacroDayPane({ width, height, focused }: PaneProps) {
127
129
  [model, release, surprise, rows]);
128
130
  const columns = useMemo(() => columnsFor(release, rows, model?.basis), [model?.basis, release, rows]);
129
131
 
132
+ // A covered release day the calendar left without figures says why; days before the calendar are the docs' to explain.
133
+ const figureGaps = useMemo(() => macroFigureGapNotices(rows), [rows]);
130
134
  usePaneNoticeFooter({ registrationId: "macro-day-notices", focused,
131
- notices: [...new Set([identityError, history.error, history.data?.error, releasesNotice, earningsNotice].filter((value): value is string => !!value))] });
135
+ notices: [...new Set([identityError, history.error, history.data?.error, releasesNotice, earningsNotice, ...figureGaps]
136
+ .filter((value): value is string => !!value))] });
132
137
  usePaneFooter("macro-day", () => ({ info: [
133
138
  ...(history.loading ? [{ id: "loading", parts: [{ text: "loading history", tone: "muted" as const }] }] : []),
134
139
  ...(history.data?.stale || history.data?.earnings.stale ? [{ id: "stale", parts: [{ text: "stale history", tone: "warning" as const }] }] : []),
@@ -137,7 +142,7 @@ export function MacroDayPane({ width, height, focused }: PaneProps) {
137
142
 
138
143
  const renderCell = useCallback((event: MacroDayEvent, column: DataTableColumn): DataTableCell => {
139
144
  if (column.id === "date") return { text: event.session === event.date ? event.date : `${event.date} → ${event.session.slice(5)}`, value: event.date };
140
- if (column.id === "release") return { text: release === "all" ? macroDayEventLabel(event) : event.earnings ? EARNINGS_MARK : "" };
145
+ if (column.id === "release") return { text: release === "all" ? macroDayEventLabel(event) : macroDayEventNote(event) };
141
146
  // The print colored against the consensus, as the economic calendar colors it.
142
147
  if (column.id === "actual") return { text: event.figures?.actual ?? "", color: event.figures?.surprise === "hot" ? colors.positive
143
148
  : event.figures?.surprise === "cool" ? colors.negative : undefined };
@@ -39,15 +39,25 @@ export interface MacroReleaseFigures {
39
39
  forecast: string | null;
40
40
  prior: string | null;
41
41
  surprise: MacroSurprise | null;
42
+ /** A policy decision's move: "held", "cut 25bp", "raised 50bp". */
43
+ decision?: string;
42
44
  }
43
45
 
44
- export interface MacroRelease { kind: MacroEventKind; date: string; figures?: MacroReleaseFigures }
46
+ export interface MacroRelease {
47
+ kind: MacroEventKind;
48
+ date: string;
49
+ figures?: MacroReleaseFigures;
50
+ /** Why a day Gloom Cloud's economic calendar covers has no figures: it lists the release without them, or not at all. */
51
+ figuresMissing?: string;
52
+ }
45
53
 
46
54
  export interface MacroReleaseList {
47
55
  /** Oldest first. */
48
56
  releases: MacroRelease[];
49
57
  /** The last day the list is complete for: later sessions are left out, release day or not. */
50
58
  coveredThrough: string;
59
+ /** The first day Gloom Cloud's economic calendar covers: US days before it have no figures. */
60
+ figuresFrom?: string;
51
61
  }
52
62
 
53
63
  const DAY_MS = 86_400_000;
@@ -70,19 +80,24 @@ function servedFigures(value: unknown): MacroReleaseFigures | undefined {
70
80
  const event = text(figures?.event);
71
81
  if (!event) return undefined;
72
82
  const surprise = MACRO_SURPRISES.find((candidate) => candidate === figures?.surprise) ?? null;
73
- return { event, actual: text(figures?.actual), forecast: text(figures?.forecast), prior: text(figures?.prior), surprise };
83
+ const decision = text(figures?.decision);
84
+ return { event, actual: text(figures?.actual), forecast: text(figures?.forecast), prior: text(figures?.prior), surprise,
85
+ ...(decision ? { decision } : {}) };
74
86
  }
75
87
 
76
88
  /**
77
89
  * The served list extends the floor past its end; the floor keeps its own
78
90
  * days up to there. IPCA, which the floor does not carry, is the served list's
79
91
  * through its end, and left out when the server lists none. Every day takes
80
- * the figures the server has for it. A served list that breaks the contract,
81
- * or ends no later than the floor, adds nothing.
92
+ * the figures the server has for it, or the reason it gives for having none;
93
+ * US days before its economic calendar (`figuresFrom`) have none. A served
94
+ * list that breaks the contract, or ends no later than the floor, adds
95
+ * nothing.
82
96
  */
83
97
  export function mergeMacroReleases(floor: MacroReleaseList, served: unknown): MacroReleaseList {
84
98
  const payload = served as { coveredThrough?: unknown; releases?: Partial<Record<MacroEventKind, unknown>>;
85
- figures?: Partial<Record<MacroEventKind, Record<string, unknown>>> } | null;
99
+ figures?: Partial<Record<MacroEventKind, Record<string, unknown>>>; figuresFrom?: unknown;
100
+ figureGaps?: Partial<Record<MacroEventKind, Record<string, unknown>>> } | null;
86
101
  const coveredThrough = payload?.coveredThrough;
87
102
  if (!isDate(coveredThrough) || coveredThrough <= floor.coveredThrough) return floor;
88
103
  const later: MacroRelease[] = [];
@@ -97,11 +112,14 @@ export function mergeMacroReleases(floor: MacroReleaseList, served: unknown): Ma
97
112
  if (Array.isArray(ipca) && ipca.every(isDate)) {
98
113
  for (const date of new Set(ipca)) if (date <= coveredThrough) later.push({ kind: "ipca", date });
99
114
  }
115
+ const figuresFrom = isDate(payload?.figuresFrom) ? payload.figuresFrom : null;
100
116
  const figuresOf = (release: MacroRelease): MacroRelease => {
101
117
  const figures = servedFigures(payload?.figures?.[release.kind]?.[release.date]);
102
- return figures ? { ...release, figures } : release;
118
+ if (figures) return { ...release, figures };
119
+ const missing = text(payload?.figureGaps?.[release.kind]?.[release.date]);
120
+ return missing ? { ...release, figuresMissing: missing } : release;
103
121
  };
104
- return { releases: [...floor.releases, ...later].map(figuresOf).sort(byDate), coveredThrough };
122
+ return { releases: [...floor.releases, ...later].map(figuresOf).sort(byDate), coveredThrough, ...(figuresFrom ? { figuresFrom } : {}) };
105
123
  }
106
124
 
107
125
  /** Whole days from the list's last covered day to today in New York. */
@@ -40,6 +40,7 @@ export const marketValuationModule: PluginModule = {
40
40
  id: MARKET_VALUATION_PANE_ID,
41
41
  name: "Market Valuation",
42
42
  icon: "V",
43
+ shareItem: { open: true, argument: true },
43
44
  get component(): typeof import("./pane").MarketValuationPane { const { MarketValuationPane } = require("./pane"); return MarketValuationPane; },
44
45
  defaultPosition: "right",
45
46
  defaultMode: "floating",
@@ -66,6 +66,13 @@ function buildColumns(width: number, stacked: boolean): Column[] {
66
66
  ];
67
67
  }
68
68
 
69
+ /** A link to the pane names the indicator its chart shows, with its reading. */
70
+ function indicatorShareItem(row: IndicatorRow) {
71
+ const cells = cellsFor(row);
72
+ const reading = row.view?.zone ? [cells.value.text, row.view.zone.label].filter(Boolean).join(" · ") : null;
73
+ return { title: row.indicator.label, excerpt: reading };
74
+ }
75
+
69
76
  // Stable table adapters so memoized rows survive pane re-renders.
70
77
  const indicatorKey = (row: IndicatorRow) => row.indicator.id;
71
78
  const renderIndicatorCell = (row: IndicatorRow, column: Column) => cellsFor(row)[column.id];
@@ -124,6 +131,7 @@ export function MarketValuationPane({ focused, width, height }: PaneProps) {
124
131
  onSelect: setIndicatorId,
125
132
  reload: refresh,
126
133
  range: { value: range, options: RANGE_VIEW_OPTIONS, onChange: setRange, chartRange: true },
134
+ shareItem: indicatorShareItem,
127
135
  });
128
136
  const { selected } = list;
129
137
  const selectedView = selected?.view;
@@ -6,7 +6,7 @@ export const membersPlugin: GloomPlugin = {
6
6
  id: "members", name: "Index and ETF members", version: "1.0.0", description: "ETF holdings, member returns, contributions, breadth and index changes", toggleable: true,
7
7
  setup(ctx) { fundBreadthCache.attach(ctx.persistence); fundListCache.attach(ctx.persistence); fundMembersCache.attach(ctx.persistence); fundChangesCache.attach(ctx.persistence); },
8
8
  dispose() { fundBreadthCache.reset(); fundListCache.reset(); fundMembersCache.reset(); fundChangesCache.reset(); },
9
- panes: [{ id: "members", name: "Index and ETF members", icon: "M", get component(): typeof import("./pane").MembersPane { const { MembersPane } = require("./pane"); return MembersPane; }, tickerFollower: true,
9
+ panes: [{ id: "members", name: "Index and ETF members", icon: "M", get component(): typeof import("./pane").MembersPane { const { MembersPane } = require("./pane"); return MembersPane; }, shareItem: { ticker: true }, tickerFollower: true,
10
10
  defaultPosition: "right", defaultMode: "floating", defaultFloatingSize: { width: 132, height: 32 }, tableExport: true,
11
11
  settings: { fields: [{ key: "tab", label: "View", type: "select", options: TABS }] } }],
12
12
  paneTemplates: [{ id: "members-pane", paneId: "members", label: "Index and ETF members", description: "ETF holdings, member returns, daily contributions, breadth and index changes.",
@@ -35,6 +35,7 @@ export const mnaModule: PluginModule = {
35
35
  // MA and DIST open this pane: DIST sets the tab param, MA a ticker.
36
36
  identitySettings: ["ticker"],
37
37
  defaultPosition: "right",
38
+ shareItem: { ticker: true },
38
39
  tickerFollower: true,
39
40
  instruments: ["equity"],
40
41
  defaultMode: "floating",
@@ -193,6 +193,7 @@ export const tickerNewsModule: PluginModule = {
193
193
  icon: "C",
194
194
  component: TickerNewsView,
195
195
  defaultPosition: "right",
196
+ shareItem: { open: true, ticker: true },
196
197
  tickerFollower: true,
197
198
  defaultMode: "floating",
198
199
  defaultFloatingSize: { width: 100, height: 32 },
@@ -67,11 +67,12 @@ let disposeBreakingNewsNotifications: (() => void) | null = null;
67
67
  const NEWS_REPORT_FRESHNESS: PaneDef["reportFreshness"] = { status: "not-a-feed", basis: "published stories" };
68
68
 
69
69
  const newsWirePanes: PluginModule["panes"] = [
70
- { id: "news-top", reportFreshness: NEWS_REPORT_FRESHNESS, name: "Top News", icon: "T", component: TopPane, defaultPosition: "right", defaultMode: "floating", defaultFloatingSize: { width: 90, height: 30 } },
70
+ { id: "news-top", reportFreshness: NEWS_REPORT_FRESHNESS, name: "Top News", icon: "T", shareItem: { open: true }, component: TopPane, defaultPosition: "right", defaultMode: "floating", defaultFloatingSize: { width: 90, height: 30 } },
71
71
  {
72
72
  id: "news-feed",
73
73
  name: "News Feed",
74
74
  icon: "N",
75
+ shareItem: { open: true },
75
76
  component: FeedPane,
76
77
  defaultPosition: "right",
77
78
  defaultMode: "floating",
@@ -83,6 +84,7 @@ const newsWirePanes: PluginModule["panes"] = [
83
84
  reportFreshness: NEWS_REPORT_FRESHNESS,
84
85
  name: TOPIC_NEWS_TITLE,
85
86
  icon: "S",
87
+ shareItem: { open: true, argument: true },
86
88
  component: IndustryPane,
87
89
  defaultPosition: "right",
88
90
  defaultMode: "floating",
@@ -95,6 +97,7 @@ const newsWirePanes: PluginModule["panes"] = [
95
97
  reportArgument: { kind: "free-text", placeholder: "story id", description: "The id of the story to open.", identifier: true },
96
98
  name: "Story",
97
99
  icon: "A",
100
+ shareItem: { open: true },
98
101
  component: NewsStoryPane,
99
102
  defaultPosition: "right",
100
103
  defaultMode: "floating",
@@ -105,6 +108,7 @@ const newsWirePanes: PluginModule["panes"] = [
105
108
  reportFreshness: NEWS_REPORT_FRESHNESS,
106
109
  name: "Breaking News",
107
110
  icon: "!",
111
+ shareItem: { open: true },
108
112
  component: BreakingPane,
109
113
  defaultPosition: "right",
110
114
  defaultMode: "floating",
@@ -18,6 +18,8 @@ import { logFailure } from "../../../../../utils/log-failure";
18
18
  import { mergeNewsArticle } from "../../../../../news/news-model";
19
19
  import { usePluginPaneState } from "../../../../runtime";
20
20
  import { formatNewsCategory } from "../categories";
21
+ import { shareItemExcerpt } from "../../../../../shares/item";
22
+ import { usePaneShareItem } from "../../../../../shares/pane-item";
21
23
 
22
24
  function hasStoryItems(article: MarketNewsItem | null): boolean {
23
25
  return (article?.items?.length ?? 0) > 0;
@@ -233,6 +235,8 @@ export function NewsDetailView({ item, focused, width, showTitle = true }: {
233
235
  showTitle?: boolean;
234
236
  }) {
235
237
  const { nativePaneChrome } = useUiCapabilities();
238
+ // The story is what a link to the pane is about: its headline and summary.
239
+ usePaneShareItem(() => ({ title: item.title, excerpt: shareItemExcerpt(item.summary) }));
236
240
  const tickers = useMemo(
237
241
  () => collectNewsDisplayTickers(item.tickers),
238
242
  [item.tickers],
@@ -3,8 +3,11 @@ import { usePaneFooter, useQueryBarSearch } from "../../../../../components";
3
3
  import type { NewsArticle } from "../../../../../news/types";
4
4
  import { filterNewsArticles } from "../filter-articles";
5
5
 
6
- /** Only what the list has loaded is filtered; older stories load as the list scrolls. */
7
- export const NEWS_LIST_SEARCH_PLACEHOLDER = "filter loaded stories";
6
+ /**
7
+ * Only what the list has loaded is filtered; older stories load as the list scrolls. A narrow pane's field shows
8
+ * the short form whole rather than "filter loaded st".
9
+ */
10
+ export const NEWS_LIST_SEARCH_PLACEHOLDER = ["filter loaded stories", "filter stories"] as const;
8
11
 
9
12
  export function useNewsListSearch<T extends NewsArticle>(articles: readonly T[]) {
10
13
  const [searchQuery, setSearchQuery] = useState("");
@@ -99,6 +99,7 @@ export const optionsModule: PluginModule = {
99
99
  icon: "O",
100
100
  component: OptionsPane,
101
101
  defaultPosition: "right",
102
+ shareItem: { ticker: true },
102
103
  tickerFollower: true,
103
104
  // An option the person holds shows their position.
104
105
  personalData: (context) => (holdsActiveTicker(context) ? "holdings" : null),
@@ -46,6 +46,7 @@ export const optionsPositioningModule: PluginModule = {
46
46
  icon: "O",
47
47
  get component(): typeof import("./pane").OptionsPositioningPane { const { OptionsPositioningPane } = require("./pane"); return OptionsPositioningPane; },
48
48
  defaultPosition: "right",
49
+ shareItem: { ticker: true },
49
50
  tickerFollower: true,
50
51
  defaultMode: "floating",
51
52
  defaultFloatingSize: { width: 104, height: 34 },
@@ -6,7 +6,7 @@ import { LOOKBACK_OPTIONS, PeBandPane } from "./pane";
6
6
  export const peBandModule: PluginModule = {
7
7
  panes: [{
8
8
  id: "pe-band", name: "P/E Band", icon: "P", component: PeBandPane,
9
- defaultPosition: "right", tickerFollower: true, instruments: ["equity"], defaultMode: "floating", defaultFloatingSize: { width: 90, height: 30 },
9
+ defaultPosition: "right", shareItem: { ticker: true }, tickerFollower: true, instruments: ["equity"], defaultMode: "floating", defaultFloatingSize: { width: 90, height: 30 },
10
10
  tableExport: true,
11
11
  settings: { title: "P/E Band Settings", fields: [
12
12
  { key: "lookbackYears", label: "Lookback", type: "select", options: LOOKBACK_OPTIONS },
@@ -406,6 +406,10 @@ async function setPositionCommand(
406
406
  }
407
407
  await store.saveTicker(result.ticker);
408
408
  if (adopted) await saveConfig(adopted);
409
+ // Said, never silent: a book named "LatAm Book USD" otherwise totals in BRL from its first PETR4 lot on.
410
+ const currencyNote = adopted && portfolioCurrency !== portfolio.currency
411
+ ? firstPositionCurrencyNote(portfolio, portfolioCurrency) : null;
412
+ if (currencyNote?.warning) notes.push(currencyNote.text);
409
413
  const saved = savedListingName(result.ticker);
410
414
  const quantity = formatMarketQuantity(shares, { assetCategory: result.ticker.metadata.assetCategory });
411
415
  // A cost in another currency converts at the rate it was bought at when the lot has one, else at the close of the
@@ -426,6 +430,7 @@ async function setPositionCommand(
426
430
  ...(future ? { contractMultiplier: multiplier ?? null, contractSize: size?.size ?? null } : {}),
427
431
  ...(purchaseDate ? { dateAcquired: purchaseDate } : {}),
428
432
  ...(foreign ? { costFxRate: boughtRate, costFxCurrency: portfolioCurrency, costFxDate: rateDate } : {}),
433
+ ...(currencyNote ? { totalsCurrency: portfolioCurrency } : {}),
429
434
  },
430
435
  warnings: notes.length > 0 ? notes : undefined,
431
436
  }, {
@@ -447,6 +452,7 @@ async function setPositionCommand(
447
452
  ? `Cost converted at today's rate into ${portfolioCurrency}: the FX close of the purchase date could not be read.`
448
453
  : `Cost converted at today's rate into ${portfolioCurrency}; add --date or --cost-fx to use the rate when bought.`)]
449
454
  : []),
455
+ ...(currencyNote && !currencyNote.warning ? [cliStyles.muted(currencyNote.text)] : []),
450
456
  ].join("\n"),
451
457
  });
452
458
  } catch (error) {
@@ -455,6 +461,25 @@ async function setPositionCommand(
455
461
  });
456
462
  }
457
463
 
464
+ /**
465
+ * What the first position of a book that follows its holdings' currency says
466
+ * when it moves the book off the one it had: a line, `"LatAm Book USD" now
467
+ * totals in BRL, its first position's currency.`, and a warning only when
468
+ * the book holds cash or targets already, which were set beside its old
469
+ * totals: `..., its cash and targets included. To keep USD, recreate it with
470
+ * --currency USD.`
471
+ */
472
+ function firstPositionCurrencyNote(portfolio: Portfolio, adopted: string): { text: string; warning: boolean } {
473
+ const note = `"${portfolio.name}" now totals in ${adopted}, its first position's currency`;
474
+ const held = [
475
+ portfolio.cash && portfolio.cash.amount !== 0 ? "cash" : null,
476
+ Object.keys(portfolio.targetWeights ?? {}).length > 0 ? "targets" : null,
477
+ ].filter((part): part is string => part !== null);
478
+ if (held.length === 0) return { text: `${note}.`, warning: false };
479
+ const was = portfolio.currency;
480
+ return { text: `${note}, its ${held.join(" and ")} included. To keep ${was}, recreate it with --currency ${was}.`, warning: true };
481
+ }
482
+
458
483
  /**
459
484
  * Sets the position, saying how to go on when the lots it replaces were
460
485
  * bought at FX rates one position cannot keep: give the whole position's rate.
@@ -32,7 +32,7 @@ import { valuationBasisLabel, type PortfolioValuationBasis } from "../../../port
32
32
  import { futuresQuantityText, isFuturesTicker } from "../../../portfolio/futures-positions";
33
33
  import { dailyFuturesHistory, loadPortfolioFuturesTerms } from "../../../portfolio/futures-terms";
34
34
  import { loadPurchaseDateCostFx } from "../../../portfolio/cost-fx";
35
- import { EXTENDED_SESSION_LABELS, quoteHeadlineTime, type ExtendedSession } from "../../../market-data/market/status";
35
+ import { EXTENDED_SESSION_LABELS, getCompletedRegularSessionDisplay, quoteHeadlineTime, type ExtendedSession } from "../../../market-data/market/status";
36
36
  import {
37
37
  BROKER_ACCOUNT_MISSING_NOTE,
38
38
  CASH_SYMBOL,
@@ -53,6 +53,13 @@ import { REPORT_ROWS } from "../shared/headless-options";
53
53
  import { readPriceWindow, type PriceWindow } from "../../../utils/price-window";
54
54
  import { loadPeriodPnl, periodBasisText, periodBoughtText, periodUnpricedText } from "./period-pnl";
55
55
 
56
+ /** An extended print without a known regular close cannot supply a regular-session change. */
57
+ function regularChangeFields(quote: Quote | undefined, change: unknown) {
58
+ const known = quote && (!quote.marketState || quote.marketState === "REGULAR" || getCompletedRegularSessionDisplay(quote));
59
+ const value = known && typeof change === "number" && Number.isFinite(change) ? change : null;
60
+ return { changePercent: value, changeBasis: value == null ? null : "regular-session" };
61
+ }
62
+
56
63
  const DEFAULT_ROW_LIMIT = 50;
57
64
  const MAX_ROW_LIMIT = 200;
58
65
 
@@ -94,7 +101,7 @@ const POSITION_COLUMNS: HeadlessPaneColumn[] = [
94
101
  { key: "avgCost", header: "Avg Cost", align: "right", format: unitMoney("positionCurrency"), description: "Per unit, in the position's currency." },
95
102
  { key: "price", header: "Last", align: "right", format: unitMoney("priceCurrency"), description: "In the quote's currency." },
96
103
  { key: "priceCurrency", header: "Ccy" },
97
- { key: "changePercent", header: "Chg", align: "right", format: percent },
104
+ { key: "changePercent", header: "Regular %", align: "right", format: percent },
98
105
  { key: "marketValue", header: "Mkt Val", align: "right", format: wholeAmount, description: "In the portfolio's currency; negative for shorts." },
99
106
  { key: "unrealizedPnl", header: "P&L", align: "right", format: amount, description: "Unrealized, in the portfolio's currency." },
100
107
  { key: "weight", header: "Weight", align: "right", format: weight, description: "Percent of the total value, cash included; unpriced holdings are left out." },
@@ -147,7 +154,7 @@ const WATCHLIST_COLUMNS: HeadlessPaneColumn[] = [
147
154
  { key: "exchange", header: "Exchange" },
148
155
  { key: "price", header: "Last", align: "right" },
149
156
  { key: "priceCurrency", header: "Ccy" },
150
- { key: "changePercent", header: "Chg", align: "right", format: percent },
157
+ { key: "changePercent", header: "Regular %", align: "right", format: percent },
151
158
  ];
152
159
 
153
160
  /**
@@ -359,7 +366,8 @@ async function portfolioHoldings(
359
366
  // Last and Chg are the regular session; market value and P&L are at `valuationPrice`.
360
367
  price: finite(row.quotePrice),
361
368
  priceCurrency: row.quoteCurrency ?? null,
362
- changePercent: finite(headline?.changePercent),
369
+ ...regularChangeFields(quotes.get(ticker.metadata.ticker), headline?.changePercent),
370
+ extendedChangeBasis: extended ? "from-regular-close" : null,
363
371
  ...extendedQuoteFields(extended),
364
372
  marketValue,
365
373
  unrealizedPnl: finite(row.unrealizedPnl),
@@ -467,7 +475,7 @@ const PERIOD_COLUMNS: HeadlessPaneColumn[] = [
467
475
  { key: "shares", header: "Qty", align: "right", format: quantity },
468
476
  { key: "startPrice", header: "Start", align: "right", format: unitMoney("priceCurrency"), description: "The close before the window, in the quote's currency." },
469
477
  { key: "endPrice", header: "End", align: "right", format: unitMoney("priceCurrency"), description: "The last close in the window, in the quote's currency." },
470
- { key: "changePercent", header: "Chg", align: "right", format: percent },
478
+ { key: "changePercent", header: "Period %", align: "right", format: percent },
471
479
  { key: "pnl", header: "P&L", align: "right", format: amount, description: "The price move times the units held now, in the portfolio's currency at the end's rate." },
472
480
  { key: "contribution", header: "Contribution", align: "right", format: percent, description: "P&L over the book's value at the start, gross when it holds a short, in percent." },
473
481
  ];
@@ -584,7 +592,8 @@ async function watchlistHoldings(
584
592
  exchange: ticker.metadata.exchange || null,
585
593
  price: finite(headline?.price ?? quote?.price),
586
594
  priceCurrency: quote?.currency ?? null,
587
- changePercent: finite(headline ? headline.changePercent : quote?.changePercent),
595
+ ...regularChangeFields(quote, headline ? headline.changePercent : quote?.changePercent),
596
+ extendedChangeBasis: extended ? "from-regular-close" : null,
588
597
  ...extendedQuoteFields(extended),
589
598
  };
590
599
  });
@@ -14,7 +14,7 @@ const CACHES = [powerBoardCache, powerHistoryCache, powerDetailCache, powerPrice
14
14
  export const powerModule: PluginModule = {
15
15
  series: [...DAY_AHEAD_SERIES, ...CARBON_SERIES, ...GAS_STORAGE_SERIES],
16
16
  // POWER sets the symbol param, EPWR the prices tab.
17
- panes: [{ id: "power", name: "Power & Grid", icon: "P", get component(): typeof import("./pane").PowerPane { const { PowerPane } = require("./pane"); return PowerPane; }, defaultPosition: "right", defaultMode: "floating", identitySettings: ["tab", "symbol"],
17
+ panes: [{ id: "power", name: "Power & Grid", icon: "P", shareItem: { argument: true }, get component(): typeof import("./pane").PowerPane { const { PowerPane } = require("./pane"); return PowerPane; }, defaultPosition: "right", defaultMode: "floating", identitySettings: ["tab", "symbol"],
18
18
  defaultFloatingSize: { width: 132, height: 34 }, tableExport: true, headless: powerHeadless }],
19
19
  paneTemplates: [{ id: "power-pane", paneId: "power", label: "Power & Grid",
20
20
  description: "Pro: interconnection queues, historical MW and outcomes, datacenter loads, utility exposure and generation capacity, with primary evidence.",
@@ -6,7 +6,7 @@ import { ESTIMATOR_OPTIONS, WINDOW_OPTIONS } from "./settings";
6
6
  export const realizedVolModule: PluginModule = {
7
7
  panes: [{
8
8
  id: "realized-vol", name: "Realized Volatility", icon: "V", get component(): typeof import("./pane").RealizedVolPane { const { RealizedVolPane } = require("./pane"); return RealizedVolPane; },
9
- defaultPosition: "right", tickerFollower: true, defaultMode: "floating", defaultFloatingSize: { width: 112, height: 36 },
9
+ defaultPosition: "right", shareItem: { ticker: true }, tickerFollower: true, defaultMode: "floating", defaultFloatingSize: { width: 112, height: 36 },
10
10
  tableExport: true,
11
11
  quickSettings: [{ type: "toggle", key: "showIv", icon: "zap", label: "Current ATM IV" }],
12
12
  settings: { title: "Realized Volatility Settings", fields: [
@@ -30,6 +30,8 @@ export interface EarningsEstimatesHeadlessDependencies {
30
30
  ): Promise<EarningsEstimateSources>;
31
31
  }
32
32
 
33
+ const ESTIMATE_COLUMNS = [...EARNINGS_ESTIMATE_COLUMNS, { key: "epsBasis", header: "EPS basis" }];
34
+
33
35
  const defaultDependencies: EarningsEstimatesHeadlessDependencies = {
34
36
  async loadSources(symbol, context) {
35
37
  const { actions, estimates, financials, currency, ...failures } = await loadEventSources(context.marketData, symbol);
@@ -63,7 +65,11 @@ function projectEarningsEstimatesHeadless(
63
65
  sources.financials,
64
66
  sources.currency,
65
67
  ).filter((row) => matchesKind(row, kind));
66
- const rows = matching.slice(0, limit).map((row) => ({ ...row }));
68
+ const rows = matching.slice(0, limit).map((row) => ({ ...row,
69
+ ...(row.status === "Q Est" || row.status === "FY Est" ? {
70
+ epsBasis: row.estimateInputs?.eps?.epsBasis === "gaap" ? "GAAP" : row.estimateInputs?.eps?.epsBasis === "adjusted" ? "adjusted" : "unknown",
71
+ } : {}),
72
+ }));
67
73
  const notice = eventSourceNotice({ variant: "earnings-estimates", symbol: args.symbols[0] ?? String(args.argument ?? ""),
68
74
  actions: sources.actions, estimates: sources.estimates,
69
75
  actionsError: sources.actions ? null : "Source unavailable", estimatesError: sources.estimates ? null : "Source unavailable",
@@ -73,7 +79,7 @@ function projectEarningsEstimatesHeadless(
73
79
  if (unmatchedReportedPeriods.length) errors.push(`No statement period identified for ${unmatchedReportedPeriods.length} reported earnings row(s); quarterly revenue is unavailable.`);
74
80
 
75
81
  return {
76
- columns: EARNINGS_ESTIMATE_COLUMNS,
82
+ columns: ESTIMATE_COLUMNS,
77
83
  rows,
78
84
  errors: errors.length ? errors : undefined,
79
85
  metadata: {
@@ -83,7 +89,7 @@ function projectEarningsEstimatesHeadless(
83
89
  returned: rows.length,
84
90
  truncated: rows.length < matching.length,
85
91
  coverageNote: notice?.text,
86
- epsBasis: `${EPS_BASIS_NOTE} The TTM row's EPS is the GAAP diluted trailing figure ticker shows as EPS (TTM): the last four filed quarters', or Gloom Cloud's TTM (named so) when they give none, or the four statement quarters' diluted EPS when neither is there; reported quarters of different bases are never summed, and the row adds an adjusted sum only when all four quarters are adjusted.`,
92
+ epsBasis: `Estimate basis is unknown unless the estimate source explicitly identifies GAAP or adjusted; never assume it matches a reported quarter. ${EPS_BASIS_NOTE} The TTM row's EPS is the GAAP diluted trailing figure ticker shows as EPS (TTM): the last four filed quarters', or Gloom Cloud's TTM (named so) when they give none, or the four statement quarters' diluted EPS when neither is there; reported quarters of different bases are never summed, and the row adds an adjusted sum only when all four quarters are adjusted.`,
87
93
  dateNote: "Fiscal period dates are not announcement dates. Revenue is attached only to an identified statement period.",
88
94
  unmatchedReportedPeriods,
89
95
  },
@@ -124,7 +130,7 @@ export function createEarningsEstimatesHeadless(
124
130
  maximum: 200,
125
131
  },
126
132
  ],
127
- columns: EARNINGS_ESTIMATE_COLUMNS,
133
+ columns: ESTIMATE_COLUMNS,
128
134
  describe: (args) => `Earnings Estimates | ${String(args.argument)}`,
129
135
  async load(args, context) {
130
136
  return projectEarningsEstimatesHeadless(