@gloom-sh/terminal 0.20.22 → 0.20.23

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 (195) hide show
  1. package/package.json +1 -1
  2. package/src/account/heard-from-question.tsx +6 -4
  3. package/src/account/heard-from.ts +3 -4
  4. package/src/api-client/exchange-announcements.ts +2 -2
  5. package/src/api-client/heard-from.ts +5 -7
  6. package/src/api-client/ownership-disclosures.ts +38 -5
  7. package/src/api-client/types/ticker-data.ts +3 -1
  8. package/src/architecture/dom-cell-metrics-allowlist.json +2 -2
  9. package/src/cli/commands/market.ts +5 -3
  10. package/src/cli/commands/overview.ts +7 -9
  11. package/src/cli/listing-arg.ts +45 -18
  12. package/src/cli/pane-functions/catalog-snapshot.json +2 -2
  13. package/src/cli/pane-functions/data.ts +3 -1
  14. package/src/cli/pane-functions/freshness.ts +6 -1
  15. package/src/cli/pane-functions/function-help.ts +0 -2
  16. package/src/cli/pane-functions/market-session.ts +12 -2
  17. package/src/cli/pane-functions/screenshot-payload.ts +3 -1
  18. package/src/cli/symbol-list.ts +52 -14
  19. package/src/cli/ticker-resolution.ts +133 -38
  20. package/src/components/chart/composite/composite-chart.tsx +12 -0
  21. package/src/components/chart/composite/types.ts +18 -0
  22. package/src/components/chart/composite/use-composite-chart-keyboard.ts +38 -15
  23. package/src/components/chart-table/header.tsx +11 -5
  24. package/src/components/chart-table/selection.ts +20 -1
  25. package/src/components/data-table/view.tsx +2 -0
  26. package/src/components/feed-data-table/stack-view.tsx +85 -5
  27. package/src/components/layout/pane/header.tsx +12 -30
  28. package/src/components/ticker/badge/index.tsx +9 -4
  29. package/src/components/ticker/badge/list.tsx +3 -1
  30. package/src/components/ui/data-table/index.tsx +7 -1
  31. package/src/components/ui/data-table/muted-row.tsx +47 -0
  32. package/src/components/ui/data-table/opentui/index.tsx +42 -11
  33. package/src/components/ui/data-table/spill.ts +36 -0
  34. package/src/components/ui/data-table/types.ts +17 -1
  35. package/src/components/ui/data-table/use-column-order.ts +11 -0
  36. package/src/components/ui/icon.tsx +50 -3
  37. package/src/components/ui/list-view.tsx +2 -2
  38. package/src/components/ui/table-layout.ts +32 -0
  39. package/src/components/ui/terminal-hover-label.tsx +49 -0
  40. package/src/components/use-pinned-moment.ts +222 -13
  41. package/src/core/state/app/state.ts +11 -2
  42. package/src/core/state/app/types.ts +2 -1
  43. package/src/data/sqlite/access.ts +14 -1
  44. package/src/data/sqlite/checkpointer.ts +2 -2
  45. package/src/data/sqlite/database.ts +4 -0
  46. package/src/docs/snapshot.json +180 -26
  47. package/src/i18n/es.ts +1 -0
  48. package/src/i18n/ja.ts +1 -0
  49. package/src/i18n/ko.ts +1 -0
  50. package/src/i18n/zh-cn.ts +1 -0
  51. package/src/i18n/zh-tw.ts +1 -0
  52. package/src/market-data/market/freshness.ts +2 -2
  53. package/src/market-data/market/globex-day.ts +14 -0
  54. package/src/market-data/published-us-sessions.ts +3 -2
  55. package/src/market-data/quotes/live-valuation.ts +4 -2
  56. package/src/market-data/quotes/metadata.ts +48 -5
  57. package/src/market-data/quotes/regular-session-valuation.ts +12 -1
  58. package/src/plugins/builtin/alerts/history-pane.tsx +19 -3
  59. package/src/plugins/builtin/broker-trading/orders.tsx +4 -2
  60. package/src/plugins/builtin/chat/attachments/desktop.tsx +46 -12
  61. package/src/plugins/builtin/chat/channels.ts +5 -2
  62. package/src/plugins/builtin/chat/content/composer-runtime.ts +64 -65
  63. package/src/plugins/builtin/chat/content/footer.tsx +17 -7
  64. package/src/plugins/builtin/chat/content/index.tsx +108 -36
  65. package/src/plugins/builtin/chat/content/new-dm-dialog.tsx +21 -8
  66. package/src/plugins/builtin/chat/content/selection-runtime.ts +16 -0
  67. package/src/plugins/builtin/chat/content/shortcuts.ts +3 -0
  68. package/src/plugins/builtin/chat/content/snapshot.ts +37 -13
  69. package/src/plugins/builtin/chat/content/transcript.tsx +12 -0
  70. package/src/plugins/builtin/chat/content/types.ts +2 -0
  71. package/src/plugins/builtin/chat/controller/channels.ts +15 -15
  72. package/src/plugins/builtin/chat/controller/index.ts +140 -34
  73. package/src/plugins/builtin/chat/controller/lifecycle.ts +8 -12
  74. package/src/plugins/builtin/chat/controller/persistence.ts +32 -4
  75. package/src/plugins/builtin/chat/controller/send.ts +41 -17
  76. package/src/plugins/builtin/chat/controller/session-runtime.ts +28 -27
  77. package/src/plugins/builtin/chat/controller/state.ts +17 -8
  78. package/src/plugins/builtin/chat/controller/storage.ts +41 -4
  79. package/src/plugins/builtin/chat/controller/view.ts +6 -3
  80. package/src/plugins/builtin/chat/index.tsx +1 -1
  81. package/src/plugins/builtin/chat/layout.ts +8 -1
  82. package/src/plugins/builtin/chat/message/desktop.tsx +15 -11
  83. package/src/plugins/builtin/chat/message/header.tsx +112 -30
  84. package/src/plugins/builtin/chat/message/reactions.tsx +10 -11
  85. package/src/plugins/builtin/chat/message/render-state.ts +4 -2
  86. package/src/plugins/builtin/chat/message/terminal.tsx +13 -15
  87. package/src/plugins/builtin/chat/message/types.ts +5 -0
  88. package/src/plugins/builtin/cloud-tweets/table.tsx +25 -2
  89. package/src/plugins/builtin/company-kpis/model.ts +11 -3
  90. package/src/plugins/builtin/correlation/compute.ts +6 -1
  91. package/src/plugins/builtin/custom-view/loader.ts +95 -34
  92. package/src/plugins/builtin/custom-view/pane.tsx +31 -41
  93. package/src/plugins/builtin/custom-view/table.ts +201 -0
  94. package/src/plugins/builtin/dividend-yield/client.ts +14 -17
  95. package/src/plugins/builtin/dividend-yield/headless.ts +0 -1
  96. package/src/plugins/builtin/dividend-yield/model.ts +45 -6
  97. package/src/plugins/builtin/dividend-yield/pane.tsx +70 -7
  98. package/src/plugins/builtin/dividend-yield/types.ts +2 -3
  99. package/src/plugins/builtin/dividend-yield/view.ts +22 -2
  100. package/src/plugins/builtin/econ/calendar-model.ts +135 -0
  101. package/src/plugins/builtin/econ/columns.ts +132 -0
  102. package/src/plugins/builtin/econ/index.tsx +25 -65
  103. package/src/plugins/builtin/holders/disclosures-view.tsx +9 -6
  104. package/src/plugins/builtin/holders/disclosures.ts +20 -6
  105. package/src/plugins/builtin/holders/headless.ts +2 -2
  106. package/src/plugins/builtin/ipo-calendar/model.ts +30 -1
  107. package/src/plugins/builtin/ipo-calendar/pane.tsx +7 -3
  108. package/src/plugins/builtin/kelly-sizer/headless.ts +9 -4
  109. package/src/plugins/builtin/kelly-sizer/pane.tsx +19 -9
  110. package/src/plugins/builtin/kelly-sizer/units.ts +26 -0
  111. package/src/plugins/builtin/market-halts/pane.tsx +14 -2
  112. package/src/plugins/builtin/news/wire/news/row.ts +5 -12
  113. package/src/plugins/builtin/news/wire/news/table.tsx +32 -41
  114. package/src/plugins/builtin/pe-band/headless.ts +1 -1
  115. package/src/plugins/builtin/pe-band/model.ts +41 -18
  116. package/src/plugins/builtin/pe-band/pane.tsx +6 -5
  117. package/src/plugins/builtin/perps/equity-row.tsx +4 -6
  118. package/src/plugins/builtin/perps/markets-section.tsx +19 -15
  119. package/src/plugins/builtin/perps/model.ts +10 -2
  120. package/src/plugins/builtin/portfolio-list/cli/import-positions.ts +6 -18
  121. package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +1 -1
  122. package/src/plugins/builtin/portfolio-list/pane/purchase-date-fx.ts +1 -1
  123. package/src/plugins/builtin/portfolio-list/positions-import/index.tsx +1 -1
  124. package/src/plugins/builtin/portfolio-list/positions-import/lookup.ts +28 -57
  125. package/src/plugins/builtin/research/event-data.ts +3 -1
  126. package/src/plugins/builtin/research/event-model.ts +17 -15
  127. package/src/plugins/builtin/research/relative-valuation-columns.ts +19 -6
  128. package/src/plugins/builtin/research/relative-valuation-headless.ts +1 -1
  129. package/src/plugins/builtin/scanner/flow-pane.tsx +10 -0
  130. package/src/plugins/builtin/sec/exchange-filings.ts +32 -7
  131. package/src/plugins/builtin/sec/headless.ts +8 -8
  132. package/src/plugins/builtin/sec/index.tsx +69 -29
  133. package/src/plugins/builtin/shared/report-freshness.ts +4 -1
  134. package/src/plugins/builtin/ticker-detail/financials/aggregation.ts +1 -2
  135. package/src/plugins/builtin/ticker-detail/financials/exchange-table.tsx +61 -0
  136. package/src/plugins/builtin/ticker-detail/financials/model.ts +38 -4
  137. package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +9 -2
  138. package/src/plugins/builtin/ticker-detail/financials/tab.tsx +68 -39
  139. package/src/plugins/builtin/ticker-detail/headless.ts +4 -1
  140. package/src/plugins/builtin/ticker-detail/overview/model.ts +61 -15
  141. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +5 -0
  142. package/src/plugins/builtin/time-sales/model.ts +16 -9
  143. package/src/plugins/builtin/time-sales/pane.tsx +27 -24
  144. package/src/plugins/builtin/treasury-daily/client.ts +43 -9
  145. package/src/plugins/builtin/treasury-daily/pane.tsx +48 -27
  146. package/src/plugins/builtin/treasury-daily/resource.ts +33 -0
  147. package/src/portfolio/positions-import/parse.ts +14 -6
  148. package/src/portfolio/positions-import/plan.ts +3 -2
  149. package/src/react/async-resource.ts +3 -1
  150. package/src/renderers/dom/data-table/index.tsx +40 -0
  151. package/src/renderers/dom/data-table/row.tsx +39 -3
  152. package/src/renderers/dom/desktop/icons.tsx +147 -3
  153. package/src/renderers/dom/desktop/popover.tsx +2 -2
  154. package/src/renderers/dom/host/media-surface.tsx +204 -45
  155. package/src/renderers/dom/host/tabs.tsx +1 -0
  156. package/src/renderers/dom/styles.css +14 -2
  157. package/src/renderers/electrobun/bun/desktop/backend.ts +2 -0
  158. package/src/renderers/electrobun/bun/desktop/rpc-timing.ts +9 -3
  159. package/src/renderers/electrobun/shared/protocol.ts +2 -0
  160. package/src/renderers/electrobun/view/backend-rpc.ts +5 -2
  161. package/src/renderers/electrobun/view/rpc-timeout.ts +44 -3
  162. package/src/sources/gloomberb-cloud/index.ts +8 -7
  163. package/src/sources/gloomberb-cloud/normalizers.ts +7 -2
  164. package/src/sources/listing-symbols.ts +7 -1
  165. package/src/sources/provider-router/cache.ts +5 -4
  166. package/src/sources/provider-router/financials.ts +40 -18
  167. package/src/state/app/tab-cursor.ts +47 -6
  168. package/src/telemetry/stall-clocks.ts +3 -0
  169. package/src/telemetry/stall-reports.ts +12 -3
  170. package/src/telemetry/windows-process-activity.ts +41 -0
  171. package/src/telemetry/windows-time.ts +32 -0
  172. package/src/test-support/scoped-earnings.ts +24 -0
  173. package/src/tickers/terminal-codes.ts +1 -6
  174. package/src/time-series/daily-valuation.ts +13 -6
  175. package/src/time-series/filed-trailing-eps.ts +16 -3
  176. package/src/time-series/fundamentals/current-valuation.ts +8 -0
  177. package/src/time-series/fundamentals/historical-valuation.ts +20 -0
  178. package/src/time-series/fundamentals/series.ts +13 -1
  179. package/src/time-series/valuation-currency.ts +2 -0
  180. package/src/types/financials.ts +46 -10
  181. package/src/ui/dialog-context.ts +8 -0
  182. package/src/utils/datetime-format.ts +23 -1
  183. package/src/utils/declared-dividends.ts +12 -2
  184. package/src/utils/exchange-announcements.ts +4 -1
  185. package/src/utils/exchange-notation.generated.ts +3 -1
  186. package/src/utils/exchanges.ts +2 -1
  187. package/src/utils/fundamentals.ts +1 -0
  188. package/src/utils/main-thread-stall.ts +9 -1
  189. package/src/utils/rpc-timeout-error.ts +36 -11
  190. package/src/utils/sec.ts +3 -1
  191. package/src/utils/share-multiples.ts +1 -1
  192. package/src/utils/stall-process-activity.ts +70 -0
  193. package/src/utils/statement-scope.ts +103 -0
  194. package/src/utils/trailing-eps.ts +1 -1
  195. package/src/utils/zoned-date-time.ts +1 -0
@@ -1,13 +1,11 @@
1
1
  import type { AppTickerRepositoryPort } from "../../../../core/app-service-ports";
2
+ import { ListingArgError } from "../../../../cli/listing-arg";
3
+ import { StagedTickerRepository } from "../../../../cli/staged-tickers";
4
+ import { resolveTickersForCli } from "../../../../cli/ticker-resolution";
2
5
  import type { ImportSymbolResolution } from "../../../../portfolio/positions-import/plan";
3
- import { isProviderBusy } from "../../../../sources/provider-errors";
4
- import { AmbiguousTickerError, resolveTickerSearch, upsertTickerFromSearchResult } from "../../../../tickers/search";
6
+ import { movedAwayChange, tickerChangeLine } from "../../../../tickers/ticker-changes";
5
7
  import type { DataProvider } from "../../../../types/data-provider";
6
8
  import type { TickerRecord } from "../../../../types/ticker";
7
- import { mapWithConcurrency } from "../../../../utils/concurrency";
8
-
9
- /** Symbols looked up at once: a broker export is tens of rows, and search answers each in a request. */
10
- const LOOKUP_CONCURRENCY = 4;
11
9
 
12
10
  export interface PositionSymbolLookup {
13
11
  resolutions: Map<string, ImportSymbolResolution>;
@@ -16,63 +14,36 @@ export interface PositionSymbolLookup {
16
14
  }
17
15
 
18
16
  /**
19
- * A store that keeps the listings a lookup makes in memory, so a preview the
20
- * person cancels saves nothing. Reads fall through to the saved tickers.
21
- */
22
- function stagedStore(base: AppTickerRepositoryPort, staged: Map<string, TickerRecord>): AppTickerRepositoryPort {
23
- return {
24
- loadTicker: async (symbol) => staged.get(symbol) ?? await base.loadTicker(symbol),
25
- loadAllTickers: async () => {
26
- const merged = new Map((await base.loadAllTickers()).map((ticker) => [ticker.metadata.ticker, ticker] as const));
27
- for (const [key, ticker] of staged) merged.set(key, ticker);
28
- return [...merged.values()];
29
- },
30
- saveTicker: async (ticker) => { staged.set(ticker.metadata.ticker, ticker); },
31
- createTicker: async (metadata) => {
32
- const ticker: TickerRecord = { metadata };
33
- staged.set(metadata.ticker, ticker);
34
- return ticker;
35
- },
36
- deleteTicker: async () => { throw new Error("A preview deletes no tickers."); },
37
- };
38
- }
39
-
40
- function lookupError(symbol: string, error: unknown): string {
41
- if (error instanceof AmbiguousTickerError) return `${symbol} names several listings; add the one you hold with the add row`;
42
- if (isProviderBusy(error)) return "search was busy; import the file again";
43
- return "ticker lookup failed";
44
- }
45
-
46
- /**
47
- * Each of a file's symbols as the listing the add row would take it to, or
48
- * why it has none. Nothing is saved: listings not saved yet are listed in
49
- * `unsaved` for the import to save.
17
+ * Resolve a current snapshot without saving previews or moving a position to
18
+ * a successor ticker. Historical lookups can still resolve the old listing.
50
19
  */
51
20
  export async function lookUpPositionSymbols(
52
21
  symbols: readonly string[],
53
22
  { tickers, store, dataProvider }: {
54
- tickers: ReadonlyMap<string, TickerRecord>;
23
+ tickers?: ReadonlyMap<string, TickerRecord>;
55
24
  store: AppTickerRepositoryPort;
56
25
  dataProvider: DataProvider;
57
- },
26
+ }, options?: Pick<NonNullable<Parameters<typeof resolveTickersForCli>[4]>, "onRetry" | "onProgress">,
58
27
  ): Promise<PositionSymbolLookup> {
59
- const staged = new Map<string, TickerRecord>();
60
- const staging = stagedStore(store, staged);
61
- const settled = await mapWithConcurrency(symbols, LOOKUP_CONCURRENCY, async (symbol): Promise<ImportSymbolResolution> => {
62
- try {
63
- const resolved = await resolveTickerSearch({ query: symbol, activeTicker: null, tickers, dataProvider });
64
- if (!resolved) return { error: `No ticker match found for "${symbol}".` };
65
- if (resolved.kind === "local") return { ticker: resolved.ticker };
66
- return { ticker: (await upsertTickerFromSearchResult(staging, resolved.result)).ticker };
67
- } catch (error) {
68
- return { error: lookupError(symbol, error) };
28
+ const staging = new StagedTickerRepository(store);
29
+ const resolutions = new Map<string, ImportSymbolResolution>();
30
+ const unsaved = new Set<string>();
31
+ if (symbols.length === 0) return { resolutions, unsaved };
32
+ for (const lookup of await resolveTickersForCli(symbols, staging, dataProvider, undefined, { ...options, currentSnapshot: true })) {
33
+ if (lookup.error) {
34
+ const details = lookup.error instanceof ListingArgError ? lookup.error.details : null;
35
+ resolutions.set(lookup.input, { error: [lookup.error.message, details].filter(Boolean).join(" ").replace(/\s*\n\s*/g, " ") });
36
+ continue;
37
+ }
38
+ const change = tickerChangeLine(lookup.change);
39
+ if (lookup.listingEnd || movedAwayChange(lookup.change)) {
40
+ resolutions.set(lookup.input, { error: [lookup.listingEnd, change].filter(Boolean).join(" ") });
41
+ continue;
69
42
  }
70
- });
71
- // Two of the file's symbols for one new listing (BRK.B, BRK-B) each made it: both take the record kept.
72
- const resolutions = new Map(symbols.map((symbol, index) => {
73
- const resolution = settled[index]!;
74
- const kept = "ticker" in resolution ? staged.get(resolution.ticker.metadata.ticker) : undefined;
75
- return [symbol, kept ? { ticker: kept } : resolution] as const;
76
- }));
77
- return { resolutions, unsaved: new Set(staged.keys()) };
43
+ const key = lookup.ticker.metadata.ticker;
44
+ const ticker = await staging.loadTicker(key) ?? lookup.ticker;
45
+ if (tickers && !tickers.has(key)) unsaved.add(key);
46
+ resolutions.set(lookup.input, { ticker, notes: change ? [change] : [] });
47
+ }
48
+ return { resolutions, unsaved };
78
49
  }
@@ -26,6 +26,7 @@ export function useEventData(variant: "corporate-actions" | "earnings-estimates"
26
26
  const { financials: tickerFinancials } = usePaneTicker();
27
27
  const quarterlyStatements = tickerFinancials?.quarterlyStatements;
28
28
  const annualStatements = tickerFinancials?.annualStatements;
29
+ const statementScope = tickerFinancials?.statementScope;
29
30
  const financialCurrency = tickerFinancials?.financialCurrency;
30
31
  const trailingEps = tickerFinancials?.fundamentals?.eps;
31
32
  const trailingEpsCurrency = tickerFinancials?.fundamentals?.epsCurrency;
@@ -43,13 +44,14 @@ export function useEventData(variant: "corporate-actions" | "earnings-estimates"
43
44
  quarterlyStatements: quarterlyStatements ?? [],
44
45
  // Their last end names the fiscal quarters (Q1 FY2027), as GUIDE and ERN name them.
45
46
  annualStatements: annualStatements ?? [],
47
+ statementScope,
46
48
  financialCurrency,
47
49
  fundamentals: { eps: trailingEps, epsCurrency: trailingEpsCurrency, financialCurrency: fundamentalsCurrency, marketCapCurrency, trailingEpsSource },
48
50
  quote: quoteCurrency || quoteType || quoteName ? { currency: quoteCurrency ?? "", instrumentType: quoteType, name: quoteName, exchangeName: quoteExchange } : null,
49
51
  quoteMetadata: metadataType ? { instrumentType: metadataType } : null,
50
52
  } : null),
51
53
  [annualStatements, financialCurrency, fundamentalsCurrency, marketCapCurrency, metadataType, quarterlyStatements, quoteCurrency, quoteExchange, quoteName, quoteType,
52
- trailingEps, trailingEpsCurrency, trailingEpsSource],
54
+ statementScope, trailingEps, trailingEpsCurrency, trailingEpsSource],
53
55
  );
54
56
  const actionsLoader = useCallback((nextSymbol: string, nextExchange: string, forceRefresh: boolean) => {
55
57
  if (!dataProvider?.getCorporateActions) throw new Error("Corporate actions source unavailable");
@@ -23,6 +23,7 @@ import {
23
23
  } from "../../../utils/format";
24
24
  import { formatFilingDate } from "../../../utils/datetime-format";
25
25
  import { computeTTM } from "../ticker-detail/financials/aggregation";
26
+ import { listingOwnsRow } from "../../../utils/statement-scope";
26
27
  import { classifyInstrumentType } from "../../../tickers/instrument-kind";
27
28
  import { isIndianEtfListing } from "../../../market-data/fund-actions";
28
29
  import { parsePublicTickerKey } from "../../../utils/exchanges";
@@ -142,10 +143,10 @@ function isFiscalEstimatePeriod(period: string): boolean {
142
143
  }
143
144
 
144
145
  function sortedQuarterlyStatements(
145
- financials: Pick<TickerFinancials, "quarterlyStatements"> | null,
146
+ financials: Pick<TickerFinancials, "quarterlyStatements" | "statementScope"> | null,
146
147
  ): FinancialStatement[] {
147
- return [...(financials?.quarterlyStatements ?? [])]
148
- .filter((statement) => statement.date)
148
+ return (financials?.quarterlyStatements ?? [])
149
+ .filter((statement) => statement.date && listingOwnsRow(financials?.statementScope, statement))
149
150
  .sort((left, right) => left.date.localeCompare(right.date));
150
151
  }
151
152
 
@@ -245,9 +246,9 @@ function estimateValue(growth: Rate | undefined): string {
245
246
  * What the TTM row reads: the statements for its four quarters and revenue, and the trailing EPS of the fundamentals,
246
247
  * the figure `ticker` prints as EPS (TTM) (the filed quarters' when they give one, see time-series/filed-trailing-eps).
247
248
  */
248
- export type EventFinancials = Pick<TickerFinancials, "quarterlyStatements" | "financialCurrency"> & {
249
+ export type EventFinancials = Pick<TickerFinancials, "quarterlyStatements" | "financialCurrency" | "statementScope"> & {
249
250
  /** The years, whose last end names the fiscal quarters (`Q1 FY2027`) as GUIDE and ERN do. */
250
- annualStatements?: readonly Pick<FinancialStatement, "date">[];
251
+ annualStatements?: readonly Pick<FinancialStatement, "date" | "statementScope">[];
251
252
  fundamentals?: Pick<NonNullable<TickerFinancials["fundamentals"]>, "eps" | "epsCurrency" | "financialCurrency" | "marketCapCurrency" | "trailingEpsSource"> | null;
252
253
  /** The listing's currency, which says whether an unlabelled EPS can be in the statements' (fundamentalsCurrency), and its type. */
253
254
  quote?: Pick<NonNullable<TickerFinancials["quote"]>, "currency" | "instrumentType" | "exchangeName" | "listingExchangeName" | "name"> | null;
@@ -302,7 +303,7 @@ function ttmRow(
302
303
  const latest = latestFour.at(-1);
303
304
  const trailingEps = financials?.fundamentals?.eps;
304
305
  const served = typeof trailingEps === "number" && Number.isFinite(trailingEps);
305
- const eps = served ? trailingEps : ttm.eps;
306
+ const eps = served ? trailingEps : financials?.statementScope ? undefined : ttm.eps;
306
307
  const adjusted = eps == null ? null : adjustedQuarterSum(latestFour, earnings);
307
308
  return {
308
309
  id: `ttm:${latest?.date ?? ""}`,
@@ -424,7 +425,7 @@ export function buildEventRows(
424
425
 
425
426
  const earningsIds = earningsRowIds(earnings);
426
427
  // Quarters and years by the names GUIDE and ERN give them (Q1 FY2027), where the company's years say when they end.
427
- const yearEnd = fiscalYearEndMonth(financials?.annualStatements ?? []);
428
+ const yearEnd = fiscalYearEndMonth(financials?.annualStatements?.filter(row => listingOwnsRow(financials.statementScope, row)) ?? []);
428
429
  // An upcoming report often arrives without a currency; the feed's reported
429
430
  // quarters give it when they all agree on one.
430
431
  const feedCurrencies = new Set(earnings.map((earning) => earning.currency).filter(Boolean));
@@ -432,7 +433,8 @@ export function buildEventRows(
432
433
  // So do the oldest reported quarters (before 2024), which the feed leaves unlabelled, but only where the
433
434
  // company's own EPS is in that currency too: one company's EPS then reads in one unit down the table, and an
434
435
  // unlabelled figure nothing else vouches for stays unlabelled.
435
- const reportedCurrency = feedCurrency && fundamentalsEpsCurrency(financials) === feedCurrency ? feedCurrency : undefined;
436
+ const listingCurrency = !financials?.statementScope || financials.statementScope.basis === "standalone" ? fundamentalsEpsCurrency(financials) : undefined;
437
+ const reportedCurrency = feedCurrency && listingCurrency === feedCurrency ? feedCurrency : undefined;
436
438
  // The history's EPS before a price adjustment is adjusted for it (CTVA's before the VYLR spin-off of 2026-10-01): said
437
439
  // on the row. A release's own EPS is as the company reported it, whatever its date.
438
440
  const adjustments = priceAdjustments(data?.splits, data?.demergers);
@@ -720,7 +722,7 @@ function yearOnYear(estimate: AnalystEstimateRecord | undefined): string | null
720
722
 
721
723
  /**
722
724
  * The Events tab's opening block: what is next, each with how far away it is.
723
- * The next report and its consensus EPS and revenue for the quarter it covers,
725
+ * The next report with calendar EPS (or quarter EPS if absent), quarter revenue,
724
726
  * the next ex-date with its amount (the last one while none is known), and the
725
727
  * next catalyst. A fund has its ex-dates only.
726
728
  */
@@ -738,12 +740,12 @@ export function buildNextUp(rows: readonly EventRow[], options: NextUpOptions):
738
740
  } else if (quarter) {
739
741
  figures.push({ id: "next-report", label: "Next report", value: quarterName(quarter), detail: "not dated yet" });
740
742
  }
741
- const eps = report?.epsEstimate ?? quarter?.qEps;
742
- const epsCurrency = report?.epsEstimate != null ? report.epsCurrency : quarter?.epsCurrency;
743
- if (eps != null) {
744
- const analysts = report?.epsEstimate != null ? report.epsAnalysts : quarter?.estimateInputs?.eps?.analysts;
745
- const growth = yearOnYear(quarter?.estimateInputs?.eps);
746
- figures.push({ id: "eps-estimate", label: "EPS est", value: formatEventMetric(eps, epsCurrency, "eps"),
743
+ const quarterEps = quarter?.estimateInputs?.eps;
744
+ const { amount, currency, analysts, growth } = report?.epsEstimate != null
745
+ ? { amount: report.epsEstimate, currency: report.epsCurrency, analysts: report.epsAnalysts, growth: null }
746
+ : { amount: quarter?.qEps, currency: quarter?.epsCurrency, analysts: quarterEps?.analysts, growth: yearOnYear(quarterEps) };
747
+ if (amount != null) {
748
+ figures.push({ id: "eps-estimate", label: "EPS est", value: formatEventMetric(amount, currency, "eps"),
747
749
  ...detailForms([analysts ? `${analysts} ${analysts === 1 ? "analyst" : "analysts"}` : null, growth], [growth]) });
748
750
  }
749
751
  if (quarter?.qRevenue != null) {
@@ -13,7 +13,7 @@ import { currentTrailingValuation, latestTrailingStatement, listingStatementConv
13
13
  import { refusedLock } from "../shared/cloud-denied";
14
14
  import { resolveHeadlessInstrument } from "../shared/headless-market-data";
15
15
  import { loadShortInterest } from "../short-interest/client";
16
- import { buildShortWatchRow } from "../short-interest/watch-model";
16
+ import { settlementPercentFloat } from "../short-interest/model";
17
17
  import { analystTargetCurrency, formatAnalystPrice, recommendationTotal } from "./analyst-model";
18
18
  import { peerDatesText } from "./relative-valuation-basis";
19
19
 
@@ -148,6 +148,11 @@ export function extraColumns(ids: readonly ExtraColumnId[]): { text: HeadlessPan
148
148
  ...spec.columns,
149
149
  { key: spec.sourceKey, header: `${spec.label} source`, format: text },
150
150
  { key: spec.asOfKey, header: `${spec.label} as of`, format: text, shrink: false },
151
+ ...spec === COLUMN_SPECS.shortInterest ? [
152
+ { key: "shortInterestSettlementSource", header: "Short settlement source", format: text },
153
+ { key: "shortInterestSettlementDate", header: "Short settlement date", format: text, shrink: false },
154
+ { key: "shortInterestFloatAsOf", header: "Short float count as of", format: text, shrink: false },
155
+ ] : [],
151
156
  ]),
152
157
  };
153
158
  }
@@ -197,12 +202,20 @@ async function loadShortInterestFields(symbols: readonly string[], financials: R
197
202
  if (!bare) return;
198
203
  try {
199
204
  const result = await loadShortInterest(bare, ctx.apiClient);
200
- const row = buildShortWatchRow({ symbol, records: result.records, floatShares: financials.get(symbol)?.fundamentals?.floatShares ?? null, history: null });
201
- if (!row.settlementDate) return;
205
+ const fundamentals = financials.get(symbol)?.fundamentals;
206
+ const latest = result.records.reduce<(typeof result.records)[number] | null>((current, record) =>
207
+ current && current.settlementDate > record.settlementDate ? current : record, null);
208
+ if (!latest) return;
209
+ const date = latest.settlementDate.toISOString().slice(0, 10);
210
+ const ratio = settlementPercentFloat(latest, fundamentals?.floatShares);
211
+ const source = SHORT_INTEREST_SOURCES[result.source];
202
212
  Object.assign(out.fields.get(symbol)!, {
203
- shortInterestPercentFloat: row.percentFloat,
204
- shortInterestSource: SHORT_INTEREST_SOURCES[result.source] ?? "FINRA",
205
- shortInterestAsOf: row.settlementDate,
213
+ shortInterestPercentFloat: ratio,
214
+ shortInterestSource: ratio == null ? null : source,
215
+ shortInterestAsOf: ratio == null ? null : date,
216
+ shortInterestSettlementSource: source,
217
+ shortInterestSettlementDate: date,
218
+ shortInterestFloatAsOf: ratio == null || latest.shortPercentFloat != null ? null : fundamentals?.floatSharesAsOf ?? null,
206
219
  });
207
220
  } catch (error) {
208
221
  out.errors.push(failureMessage(label, error, symbol));
@@ -288,7 +288,7 @@ export const relativeValuationHeadless: HeadlessPaneDefinition<"rows"> = {
288
288
  ...(selection ? { peerSelection: selection } : {}),
289
289
  ...(converted ? { marketCapConversion: { currency: capCurrency, rates: converted.conversions,
290
290
  basis: "marketCap is converted into one currency (the asked one, else the peers' own when they share one, else the base currency) at each currency's US dollar rate, the rate the app's converted totals use; marketCapNative and marketCapNativeCurrency keep the cap as served." } } : {}),
291
- ...(extraIds.length > 0 ? { addedColumnsBasis: "Each added column keeps its own source and as-of beside it: short interest at its FINRA settlement date, analyst targets at retrieval (converted with the caps under --currency, targetMeanNative keeping the served one), the next earnings date at the calendar's retrieval, gross margin and EV/EBITDA at the end of the latest quarter they sum. EV/EBITDA is the listing's enterprise value over the trailing four quarters of operating income plus D&A, as GE's EV/EBITDA ends." } : {}),
291
+ ...(extraIds.length > 0 ? { addedColumnsBasis: "Each added column keeps its own source and as-of beside it. Short % Float divides shares short at settlement by the available float; settlement and any float observation date are reported separately. Analyst targets are dated at retrieval (converted with the caps under --currency, targetMeanNative keeping the served one), the next earnings date at the calendar's retrieval, gross margin and EV/EBITDA at the end of the latest quarter they sum. EV/EBITDA is the listing's enterprise value over the trailing four quarters of operating income plus D&A, as GE's EV/EBITDA ends." } : {}),
292
292
  quoteBasis: "quoteAsOf dates Last; extendedUpdatedAt dates the separate extended print. Stale quote fields are excluded from comparison; reportedQuote retains the source observation.",
293
293
  priceBasis: "price, change and changePercent are the regular session: after the close, its close and that close's move. A pre-market, after-hours or overnight print is in extendedPrice, extendedChange and extendedChangePercent, measured from that close (extendedMark when it is a bid and ask midpoint). marketCap, the P/E multiples, evSales (through the equity part of the enterprise value) and fcfYield are measured at that regular session price.",
294
294
  fundamentalsBasis: "Provider multiples and operating metrics retain independent fundamentalsProvenance. Retrieval time does not establish the valuation date.",
@@ -22,6 +22,7 @@ import type { CompositeAxisDomain } from "../../../components/chart/composite/ty
22
22
  import { useAsyncResource, useAutoRefresh, usePluginAppActions, usePluginPaneState } from "../../../public/react";
23
23
  import { useAppSelector, usePaneSettingValue, usePaneStateValue } from "../../../state/app/context";
24
24
  import { colors } from "../../../theme/colors";
25
+ import { usePinnedList } from "../../../components/use-pinned-moment";
25
26
  import type { ResolvedSeries } from "../../../time-series/types";
26
27
  import { TICKER_RESEARCH_PANE_ID } from "../../../types/config";
27
28
  import type { PaneProps } from "../../../types/plugin";
@@ -142,6 +143,7 @@ function signedColor(value: number): string {
142
143
 
143
144
  // Stable table adapters so memoized rows survive feed ticks.
144
145
  const eventKey = (event: ScannerFlowEvent) => event.id;
146
+ const eventMoment = (event: ScannerFlowEvent) => event.at;
145
147
  const tideKey = (row: FlowTideRow) => String(row.at);
146
148
  const tideDate = (row: FlowTideRow) => new Date(row.at);
147
149
  const strikeKey = (row: FlowStrikeRow) => row.id;
@@ -374,6 +376,13 @@ function FlowPane({ focused, width, height }: PaneProps) {
374
376
  setSelectedId(event.id);
375
377
  setCursorSymbol(event.underlying);
376
378
  }, [setCursorSymbol]);
379
+ // A crosshair pinned in the tab picks the newest print by then and mutes
380
+ // the later ones. Following it moves only the row: the linked ticker
381
+ // changes when the user picks a print, never under a chart setting the pin.
382
+ const { isAfterPin } = usePinnedList<ScannerFlowEvent>("flow-prints:pin", {
383
+ follows: tab === "prints",
384
+ rows: events, getId: eventKey, moment: eventMoment, selectedId, select: setSelectedId,
385
+ });
377
386
 
378
387
  if (feed.denied) {
379
388
  return <ScannerDeniedState scanner="flow" reason={feed.deniedReason} placement="flow-wall" width={width} height={height} />;
@@ -439,6 +448,7 @@ function FlowPane({ focused, width, height }: PaneProps) {
439
448
  getItemKey={eventKey}
440
449
  onActivate={(event) => pinTicker(event.underlying, { floating: true, paneType: TICKER_RESEARCH_PANE_ID })}
441
450
  renderCell={renderCell}
451
+ isRowMuted={isAfterPin}
442
452
  selectedTextOverridesCellColor
443
453
  emptyContent={
444
454
  !feed.payload
@@ -3,9 +3,10 @@ import type { HeadlessPaneRow } from "../../../types/plugin";
3
3
  import { exchangeAnnouncementsPublisher, exchangeAnnouncementsVenue, issuerFilingSuffixVenue, isRoutineReturn } from "../../../utils/exchange-announcements";
4
4
  import { nonUsSecListingVenue } from "../../../utils/sec";
5
5
 
6
- // The extended archives are bounded. The pane reveals their rows as the user scrolls.
7
- export const EXCHANGE_FILING_HISTORY_LIMIT = 200;
6
+ export const HKEX_FILING_HISTORY_LIMIT = 100;
8
7
  export const PRESENTATIONS_FORM = "presentations";
8
+ export const RECENT_EXCHANGE_FILING_LIMIT = 50;
9
+ const SGX_OWNERSHIP_FORM = "sgx-ownership";
9
10
 
10
11
  interface ExchangeFilingForm {
11
12
  value: string;
@@ -13,12 +14,36 @@ interface ExchangeFilingForm {
13
14
  kind: NonNullable<ExchangeAnnouncementsRequest["kind"]>;
14
15
  }
15
16
 
16
- const presentations: ExchangeFilingForm = { value: PRESENTATIONS_FORM, label: "Presentations", kind: PRESENTATIONS_FORM };
17
- const sgxResults: ExchangeFilingForm = { value: "sgx-results", label: "Results & presentations", kind: "results" };
17
+ const presentations: readonly ExchangeFilingForm[] = [
18
+ { value: PRESENTATIONS_FORM, label: "Presentations", kind: PRESENTATIONS_FORM },
19
+ ];
20
+ const noForms: readonly ExchangeFilingForm[] = [];
21
+ const exchangeForms = new Map<string, readonly ExchangeFilingForm[]>([
22
+ ["HKEX", [{ value: "hkex-results", label: "Results", kind: "results" }]],
23
+ ["JPX", [{ value: "jpx-results", label: "Results & presentations", kind: "results" }]],
24
+ ["SGX", [
25
+ { value: "sgx-results", label: "Results & presentations", kind: "results" },
26
+ { value: SGX_OWNERSHIP_FORM, label: "Ownership disclosures", kind: "ownership" },
27
+ ]],
28
+ ["HOSE", [{ value: "hose-results", label: "Results & presentations", kind: "results" }]],
29
+ ["HNX", [{ value: "hnx-results", label: "Results & presentations", kind: "results" }]],
30
+ ["TWSE", presentations],
31
+ ["TPEX", presentations],
32
+ ]);
33
+
34
+ export function exchangeFilingForms(venue: string | undefined): readonly ExchangeFilingForm[] {
35
+ return exchangeForms.get(venue ?? "") ?? noForms;
36
+ }
37
+
38
+ export function emptyOwnershipArchive(stale: boolean | undefined) {
39
+ return stale ? "Ownership archive unavailable or incomplete." : "No ownership disclosures in the past year.";
40
+ }
18
41
 
19
- export function exchangeFilingForm(venue: string | undefined): ExchangeFilingForm | undefined {
20
- if (venue === "TWSE" || venue === "TPEX") return presentations;
21
- if (venue === "SGX") return sgxResults;
42
+ // The extended archives are bounded. The pane reveals their rows as the user scrolls.
43
+ export function exchangeFilingHistoryLimit(venue: string | undefined, kind?: ExchangeAnnouncementsRequest["kind"]): number {
44
+ if (venue === "HKEX" && kind === "results") return HKEX_FILING_HISTORY_LIMIT;
45
+ return kind || venue === "JPX" || venue === "BURSAMY" || venue === "HNX" || venue === "HOSE"
46
+ ? 200 : RECENT_EXCHANGE_FILING_LIMIT;
22
47
  }
23
48
 
24
49
  export function localFilingListing(symbol: string, exchange?: string) {
@@ -15,7 +15,7 @@ import type { FundFactsPayload } from "../../../api-client/fund-facts";
15
15
  import { errorMessage } from "../../../utils/errors";
16
16
  import { filingStoryNote, loadFilingStories, type FilingStory } from "../insider/filing-stories";
17
17
  import { logFailure } from "../../../utils/log-failure";
18
- import { EXCHANGE_FILING_HISTORY_LIMIT, exchangeFilingForm, latestFilingRows, localFilingListing, localFilingRows, PRESENTATIONS_FORM } from "./exchange-filings";
18
+ import { emptyOwnershipArchive, exchangeFilingForms, exchangeFilingHistoryLimit, HKEX_FILING_HISTORY_LIMIT, latestFilingRows, localFilingListing, localFilingRows, PRESENTATIONS_FORM } from "./exchange-filings";
19
19
  import type { ExchangeAnnouncementsPayload, ExchangeAnnouncementsRequest } from "../../../api-client/exchange-announcements";
20
20
  import { loadSecFilings } from "./client";
21
21
  import { ETF_FILING_FORMS, filterFilingsByForms, fundSeriesFilings, loadShownSecFilings, SEC_FILING_FETCH_LIMIT } from "./forms";
@@ -162,7 +162,7 @@ export function createSecHeadless(dependencies: SecHeadlessDependencies = defaul
162
162
  {
163
163
  key: "form",
164
164
  shot: { reportOnly: "picks the report's rows by form; the pane's Form filter picks a group of forms" },
165
- description: "Only this SEC form and its amendments, such as 8-K, 10-K or 13D. Use presentations for Taiwan investor conference decks or results for Singapore results and presentations.",
165
+ description: "Only this SEC form and its amendments, such as 8-K, 10-K or 13D. Use presentations for Taiwan investor conference decks, results for Hong Kong, Japan, Singapore and Vietnam earnings materials, or ownership for Singapore ownership disclosures.",
166
166
  type: "string",
167
167
  placeholder: "form",
168
168
  example: "--form 8-K",
@@ -182,16 +182,15 @@ export function createSecHeadless(dependencies: SecHeadlessDependencies = defaul
182
182
  const limit = Number(args.options.limit);
183
183
  const form = typeof args.options.form === "string" ? args.options.form.trim() : "";
184
184
  const localListing = localFilingListing(symbol);
185
- const availableKind = exchangeFilingForm(localListing?.exchange)?.kind;
186
- const localKind = form.toLowerCase() === availableKind ? availableKind : undefined;
185
+ const localKind = exchangeFilingForms(localListing?.exchange).find(option => option.kind === form.toLowerCase())?.kind;
187
186
  const presentations = localKind === PRESENTATIONS_FORM;
188
187
  const load = (count: number) => dependencies.loadFilings(symbol, count, args, ctx);
189
188
  // A form filter searches every filing listed for the issuer and keeps the supplements it names; without
190
189
  // one, a bank's pricing supplements and a trust's other funds stay out unless --all, as in `filings`.
191
190
  const listing = !form || localKind ? localListing : null;
192
- const localLimit = localKind || listing?.exchange === "JPX"
193
- ? Math.min(EXCHANGE_FILING_HISTORY_LIMIT, limit)
194
- : listing?.exchange === "HKEX" && args.options.all !== true ? 100 : Math.min(50, limit);
191
+ const localLimit = listing?.exchange === "HKEX" && !localKind && args.options.all !== true
192
+ ? HKEX_FILING_HISTORY_LIMIT
193
+ : Math.min(exchangeFilingHistoryLimit(listing?.exchange, localKind), limit);
195
194
  const [us, local] = await Promise.allSettled([
196
195
  localKind ? Promise.resolve({ filings: [], hidden: null })
197
196
  : loadShownSecFilings(load, limit, { form: form || null, all: args.options.all === true }),
@@ -224,7 +223,8 @@ export function createSecHeadless(dependencies: SecHeadlessDependencies = defaul
224
223
  freshness: { source: publishers, status: "not-a-feed", basis: hasCatalogueDate ? "filings and catalogue dates" : "filed data", observedKey: "filedAt" },
225
224
  ...(localKind && !combined.length ? { empty: presentations
226
225
  ? exchange.stale ? "MOPS presentation archive incomplete." : "No investor conference presentations in the past year."
227
- : exchange.stale ? "SGX results archive incomplete." : "No SGX results or presentations in the past year." } : {}),
226
+ : localKind === "ownership" ? emptyOwnershipArchive(exchange.stale)
227
+ : exchange.stale ? "Exchange results archive incomplete." : "No results or presentations in the exchange archive." } : {}),
228
228
  metadata: { symbol, returned: combined.length, exchangePage: exchange.page,
229
229
  ...(exchange.dateSource ? { exchangeDateSource: exchange.dateSource } : {}),
230
230
  ...(localKind ? { form: localKind, total: exchange.total, retrievedAt: exchange.retrievedAt, stale: exchange.stale ?? false } : {}),