@gloom-sh/terminal 0.20.14 → 0.20.17

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 (186) hide show
  1. package/package.json +1 -1
  2. package/src/api-client/data.ts +13 -3
  3. package/src/api-client/index.ts +54 -0
  4. package/src/api-client/install-experiments.ts +8 -7
  5. package/src/api-client/paths.ts +2 -1
  6. package/src/api-client/product-waitlist.ts +63 -0
  7. package/src/api-client/request.ts +4 -2
  8. package/src/api-client/types/billing.ts +45 -0
  9. package/src/api-client/types/econ.ts +3 -0
  10. package/src/api-client/yearly-plan.ts +132 -0
  11. package/src/app/global-shortcuts.ts +5 -3
  12. package/src/app/pane-runtime/index.tsx +2 -2
  13. package/src/app/pane-runtime/plugin-bindings.ts +3 -1
  14. package/src/app/pane-runtime/ticker-open-runtime.ts +6 -1
  15. package/src/app/since-last-visit/keys.ts +26 -0
  16. package/src/app/since-last-visit/model.ts +266 -0
  17. package/src/app/since-last-visit/strip.tsx +193 -0
  18. package/src/app/since-last-visit/use-since-last-visit.ts +289 -0
  19. package/src/app/since-last-visit/visit-tracker.ts +191 -0
  20. package/src/app.tsx +15 -0
  21. package/src/cli/commands/fred-series.ts +3 -1
  22. package/src/cli/commands/market.ts +8 -4
  23. package/src/cli/commands/overview.ts +65 -13
  24. package/src/cli/commands/system.ts +29 -1
  25. package/src/cli/commands/ticker.ts +12 -5
  26. package/src/cli/csv-export.ts +73 -0
  27. package/src/cli/desktop-pane-shot-api-policy.ts +4 -1
  28. package/src/cli/desktop-pane-shot-browser.ts +2 -1
  29. package/src/cli/desktop-pane-shot-view.ts +3 -7
  30. package/src/cli/desktop-pane-shot.ts +29 -30
  31. package/src/cli/help.ts +5 -2
  32. package/src/cli/history-rows.ts +24 -0
  33. package/src/cli/index.ts +4 -0
  34. package/src/cli/options.ts +29 -1
  35. package/src/cli/pane-functions/catalog.ts +41 -4
  36. package/src/cli/pane-functions/function-help.ts +1 -1
  37. package/src/cli/pane-functions/headless.ts +70 -3
  38. package/src/cli/pane-functions/index.ts +4 -4
  39. package/src/cli/pane-functions/resolver.ts +43 -0
  40. package/src/cli/pane-functions/screenshot-bridge.ts +4 -2
  41. package/src/cli/pane-functions/screenshot-payload.ts +3 -0
  42. package/src/cli/report-tables.ts +37 -8
  43. package/src/cli/result.ts +3 -6
  44. package/src/cli/shot-temp-dir.ts +30 -0
  45. package/src/cli/suffixed-listing-rows.ts +11 -0
  46. package/src/components/chart/composite/composite-chart.tsx +3 -3
  47. package/src/components/chart/composite/legend.tsx +37 -7
  48. package/src/components/command-bar/commands/direct/index.ts +31 -8
  49. package/src/components/command-bar/commands/registry.ts +7 -0
  50. package/src/components/command-bar/routes/root/command-items.ts +8 -0
  51. package/src/components/command-bar/routes/root/results.ts +16 -0
  52. package/src/components/company-logo.tsx +10 -3
  53. package/src/components/data-table/sections.ts +6 -1
  54. package/src/components/layout/pane/title.ts +6 -2
  55. package/src/components/layout/shell/index.tsx +5 -1
  56. package/src/components/layout/shell/ticker-link-menu.ts +12 -9
  57. package/src/components/ticker/badge/format.ts +12 -3
  58. package/src/components/ticker/badge/index.tsx +9 -3
  59. package/src/components/ticker/list-table-view.tsx +119 -17
  60. package/src/components/ui/data-table/display-columns.ts +19 -0
  61. package/src/components/ui/data-table/hooks.ts +2 -3
  62. package/src/components/ui/data-table/index.tsx +43 -9
  63. package/src/components/ui/data-table/types.ts +21 -0
  64. package/src/components/ui/data-table/visible-range.ts +11 -1
  65. package/src/core/state/app/layout-reducer.ts +3 -1
  66. package/src/core/state/app/layout.ts +2 -2
  67. package/src/data/config/layout.ts +14 -0
  68. package/src/data/config/store/normalize.ts +11 -1
  69. package/src/i18n/es.ts +38 -0
  70. package/src/i18n/ja.ts +38 -0
  71. package/src/i18n/ko.ts +38 -0
  72. package/src/i18n/zh-cn.ts +38 -0
  73. package/src/i18n/zh-tw.ts +38 -0
  74. package/src/layout/pane-follow.ts +141 -4
  75. package/src/layout/pane-layout-move.ts +10 -7
  76. package/src/layout/ticker-navigation.ts +13 -19
  77. package/src/layout/ticker-retarget.ts +3 -2
  78. package/src/market-data/market/index-level.ts +19 -0
  79. package/src/plugins/builtin/account-management/keyboard.ts +14 -0
  80. package/src/plugins/builtin/account-management/model.ts +2 -0
  81. package/src/plugins/builtin/account-management/pane.tsx +79 -7
  82. package/src/plugins/builtin/account-management/payment-recovery-row.tsx +97 -0
  83. package/src/plugins/builtin/account-management/yearly-plan-row.tsx +359 -0
  84. package/src/plugins/builtin/awards/pane.tsx +12 -10
  85. package/src/plugins/builtin/changelog/index.tsx +6 -44
  86. package/src/plugins/builtin/changelog/versions.ts +17 -68
  87. package/src/plugins/builtin/chart-composer/pane.tsx +4 -1
  88. package/src/plugins/builtin/cloud/askg/executor.ts +2 -1
  89. package/src/plugins/builtin/cloud/askg/sources.ts +2 -1
  90. package/src/plugins/builtin/cpi/pane.tsx +1 -1
  91. package/src/plugins/builtin/credit-conditions/series.ts +2 -2
  92. package/src/plugins/builtin/debt-maturities/model.ts +1 -1
  93. package/src/plugins/builtin/earnings/board-model.ts +12 -0
  94. package/src/plugins/builtin/earnings/board-table.ts +8 -5
  95. package/src/plugins/builtin/earnings/board.tsx +38 -18
  96. package/src/plugins/builtin/earnings/highlight.ts +47 -0
  97. package/src/plugins/builtin/earnings/history-table.ts +1 -1
  98. package/src/plugins/builtin/earnings/index.tsx +1 -1
  99. package/src/plugins/builtin/earnings-calls/pane.tsx +2 -2
  100. package/src/plugins/builtin/econ/calendar-model.ts +2 -0
  101. package/src/plugins/builtin/econ/fred-catalog.ts +1 -256
  102. package/src/plugins/builtin/econ-statistics/cache.ts +1 -1
  103. package/src/plugins/builtin/econ-statistics/client.ts +11 -10
  104. package/src/plugins/builtin/econ-statistics/detail.tsx +1 -0
  105. package/src/plugins/builtin/econ-statistics/headless.ts +42 -6
  106. package/src/plugins/builtin/econ-statistics/index.tsx +1 -0
  107. package/src/plugins/builtin/econ-statistics/pane.tsx +7 -2
  108. package/src/plugins/builtin/econ-statistics/stats.ts +2 -1
  109. package/src/plugins/builtin/econ-statistics/view.ts +9 -3
  110. package/src/plugins/builtin/estimate-revisions/model.ts +1 -1
  111. package/src/plugins/builtin/exposure/index.tsx +1 -1
  112. package/src/plugins/builtin/macro-day/model.ts +6 -4
  113. package/src/plugins/builtin/market-valuation/detail.tsx +3 -3
  114. package/src/plugins/builtin/market-valuation/headless.ts +11 -4
  115. package/src/plugins/builtin/market-valuation/pane.tsx +3 -1
  116. package/src/plugins/builtin/market-valuation/view.ts +14 -0
  117. package/src/plugins/builtin/news/wire/news/detail-view.tsx +20 -8
  118. package/src/plugins/builtin/pe-band/pane.tsx +1 -1
  119. package/src/plugins/builtin/portfolio-list/cli/render.ts +8 -1
  120. package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +176 -17
  121. package/src/plugins/builtin/portfolio-list/pane/groups.tsx +220 -0
  122. package/src/plugins/builtin/portfolio-list/pane/index.tsx +90 -15
  123. package/src/plugins/builtin/portfolio-list/table.tsx +13 -1
  124. package/src/plugins/builtin/research/corporate-actions-pane.tsx +4 -2
  125. package/src/plugins/builtin/research/relative-valuation-headless.ts +15 -5
  126. package/src/plugins/builtin/research/relative-valuation-model.ts +7 -1
  127. package/src/plugins/builtin/research/relative-valuation-pane.tsx +7 -4
  128. package/src/plugins/builtin/shared/fred-catalog.ts +256 -0
  129. package/src/plugins/builtin/shared/headless-options.ts +1 -1
  130. package/src/plugins/builtin/shared/series-cache.ts +3 -0
  131. package/src/plugins/builtin/shared/series-detail-chart.tsx +3 -0
  132. package/src/plugins/builtin/short-interest/watch-pane.tsx +7 -7
  133. package/src/plugins/builtin/social-mentions/model.ts +2 -2
  134. package/src/plugins/builtin/thirteenf/pane.tsx +1 -1
  135. package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +16 -0
  136. package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +8 -4
  137. package/src/plugins/builtin/ticker-detail/financials/model.ts +51 -16
  138. package/src/plugins/builtin/ticker-detail/financials/nopat.ts +16 -0
  139. package/src/plugins/builtin/ticker-detail/financials/ratios.ts +44 -13
  140. package/src/plugins/builtin/ticker-detail/financials/schema.ts +33 -2
  141. package/src/plugins/builtin/ticker-detail/financials/tab.tsx +4 -2
  142. package/src/plugins/builtin/ticker-detail/headless-schema.ts +30 -4
  143. package/src/plugins/builtin/ticker-detail/headless.ts +254 -34
  144. package/src/plugins/builtin/ticker-detail/overview/model.ts +7 -3
  145. package/src/plugins/builtin/ticker-detail/pharma-signals/eligibility.ts +32 -0
  146. package/src/plugins/builtin/ticker-detail/pharma-signals/tab.tsx +162 -0
  147. package/src/plugins/builtin/ticker-detail/pharma-signals/waitlist.ts +126 -0
  148. package/src/plugins/builtin/ticker-detail/research-groups.ts +6 -4
  149. package/src/plugins/builtin/ticker-detail/research-tabs.ts +11 -0
  150. package/src/plugins/builtin/time-sales/headless.ts +4 -1
  151. package/src/plugins/builtin/time-sales/pane.tsx +2 -0
  152. package/src/plugins/builtin/time-sales/window.ts +12 -0
  153. package/src/plugins/builtin/treasury-auctions/client.ts +4 -0
  154. package/src/plugins/builtin/treasury-auctions/treasury-direct.ts +2 -0
  155. package/src/plugins/builtin/treasury-daily/client.ts +23 -11
  156. package/src/portfolio/column-values.ts +20 -8
  157. package/src/portfolio/suffixed-listings.ts +3 -1
  158. package/src/portfolio/watchlist-groups.ts +212 -0
  159. package/src/react/ticker-source.ts +3 -1
  160. package/src/renderers/dom/styles.css +7 -0
  161. package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +2 -0
  162. package/src/sources/gloomberb-cloud/fred-publisher.ts +25 -0
  163. package/src/sources/gloomberb-cloud/fred-series.ts +1 -1
  164. package/src/state/app/bootstrap.ts +11 -0
  165. package/src/state/app/context/index.tsx +6 -0
  166. package/src/sync/collections-contributor.ts +5 -2
  167. package/src/sync/config-merge.ts +10 -2
  168. package/src/sync/sanitize.ts +28 -0
  169. package/src/telemetry/usage-counts.ts +17 -0
  170. package/src/time-series/base-series.ts +3 -0
  171. package/src/time-series/chart-seed.ts +1 -1
  172. package/src/time-series/financial-period-coverage.ts +4 -12
  173. package/src/time-series/ice-credit.ts +1 -0
  174. package/src/time-series/parsed-history-cache.ts +1 -1
  175. package/src/time-series/resolve.ts +1 -1
  176. package/src/time-series/types.ts +1 -0
  177. package/src/time-series/use-chart-resolution.ts +6 -1
  178. package/src/types/config.ts +32 -0
  179. package/src/types/headless.ts +9 -2
  180. package/src/types/plugin-context.ts +5 -0
  181. package/src/types/ticker.ts +14 -0
  182. package/src/ui/ascii-font.ts +1 -4
  183. package/src/utils/async-deadline.ts +2 -2
  184. package/src/utils/csv.ts +44 -5
  185. package/src/utils/futures-generic.ts +3 -0
  186. package/src/utils/throttled-fetch.ts +15 -1
@@ -4,6 +4,7 @@ import { MISSING_VALUE, formatNumber, pickUnit } from "../../../../utils/format"
4
4
  import { pricePointIntegrity } from "../../../../utils/price-history-integrity";
5
5
  import { formatPerShareNumber } from "../../../../utils/reported-money";
6
6
  import { hasStatementGap } from "../../../../utils/statement-gaps";
7
+ import { statementNopat } from "./nopat";
7
8
  import { debtAndLeases, leaseBasis, type LeaseBasis } from "../../../../utils/lease-liabilities";
8
9
  import { cashAndShortTermInvestments, excludesCashRunway, formatRunwayMonths, SHORT_RUNWAY_HISTORY, monthlyOperatingBurn, QUARTER_MONTHS, reportsShortTermTotal, runwayMonths, YEAR_MONTHS } from "../../../../utils/cash-runway";
9
10
  import {
@@ -21,17 +22,21 @@ import {
21
22
 
22
23
  /**
23
24
  * Why a ratio or one of its inputs has no number: a line the statements do
24
- * not carry for the period, a ratio whose denominator makes it meaningless
25
+ * not carry for the period, an average with no opening balance sheet on file
26
+ * (the period before the column's), a ratio whose denominator makes it meaningless
25
27
  * (a loss under P/E, negative equity under ROE), no close at the period end,
26
28
  * a close still loading, a quarter with fewer than four quarters to sum
27
29
  * for a trailing flow, or operations that brought cash in, where a runway
28
30
  * has no burn to divide by.
29
31
  */
30
- export type RatioGap = "not-reported" | "short-history" | "no-burn" | "not-meaningful" | "no-price" | "loading";
32
+ export type RatioGap = "not-reported" | "no-opening" | "short-history" | "no-burn" | "not-meaningful" | "no-price" | "loading";
31
33
  export type RatioAmount = number | RatioGap;
32
34
 
33
35
  export const RATIO_GAP_TEXT: Record<RatioGap, string> = {
34
36
  "not-reported": "not reported",
37
+ // An average of the opening and closing balance with no opening balance sheet on file: the oldest column's, a year's
38
+ // whose prior year is missing, a TTM column's without the quarter a year earlier.
39
+ "no-opening": "needs prior period",
35
40
  "short-history": SHORT_RUNWAY_HISTORY,
36
41
  "no-burn": "no burn",
37
42
  "not-meaningful": "N/M",
@@ -155,10 +160,11 @@ const balanceEnds = (...lines: BalanceLine[]) => ({ statement, opening }: RatioP
155
160
  return undefined;
156
161
  };
157
162
 
158
- /** The mean of the opening and closing balance. */
163
+ /** The mean of the opening and closing balance; a period with no opening balance sheet on file says it needs it. */
159
164
  const average = (...lines: BalanceLine[]) => {
160
165
  const ends = balanceEnds(...lines);
161
166
  return (period: RatioPeriod): RatioAmount => {
167
+ if (!period.opening) return "no-opening";
162
168
  const pair = ends(period);
163
169
  return pair ? (pair[0] + pair[1]) / 2 : "not-reported";
164
170
  };
@@ -201,6 +207,23 @@ const debtPlusEquity: BalanceLine = (statement) => {
201
207
  const common = equity(statement);
202
208
  return debt !== undefined && common !== undefined ? debt + common : undefined;
203
209
  };
210
+ /** Invested capital as ROIC reads it: the data vendor's line, else total debt plus equity. */
211
+ const investedCapital = line("investedCapital");
212
+
213
+ /**
214
+ * Invested capital less cash and short-term investments, averaged as ROIC averages it (both ends from the same
215
+ * line): the capital the operations use, so a debt-free company holding cash is not read as using it.
216
+ */
217
+ function averageOperatingCapital(period: RatioPeriod): RatioAmount {
218
+ const { statement, opening, shortTermTotalOnFile } = period;
219
+ if (!opening) return "no-opening";
220
+ const cash = (at: FinancialStatement) => cashAndShortTermInvestments(at, shortTermTotalOnFile)?.amount;
221
+ const [closeCash, openCash] = [cash(statement), cash(opening)];
222
+ if (closeCash === undefined || openCash === undefined) return "not-reported";
223
+ const ends = balanceEnds(investedCapital, debtPlusEquity)(period);
224
+ return ends ? (ends[0] - openCash + ends[1] - closeCash) / 2 : "not-reported";
225
+ }
226
+
204
227
  const freeCashFlow: BalanceLine = (statement) => {
205
228
  const reportedFlow = finite(statement.freeCashFlow);
206
229
  if (reportedFlow !== undefined) return reportedFlow;
@@ -240,14 +263,9 @@ const netIncome = flow("Net Income", line("netIncome"));
240
263
  const revenue = line("totalRevenue");
241
264
  const costOfRevenue = line("costOfRevenue");
242
265
 
243
- /** Operating income after tax at the period's effective rate; a pretax loss pays no tax. */
266
+ /** Operating income after tax at the period's effective rate; a pretax loss pays no tax (statementNopat). */
244
267
  function nopat({ statement }: RatioPeriod): RatioAmount {
245
- const operating = finite(statement.operatingIncome);
246
- const tax = finite(statement.taxProvision);
247
- const pretax = finite(statement.pretaxIncome);
248
- if (operating === undefined || tax === undefined || pretax === undefined) return "not-reported";
249
- const rate = pretax > 0 ? Math.min(1, Math.max(0, tax / pretax)) : 0;
250
- return operating * (1 - rate);
268
+ return reported(statementNopat(statement));
251
269
  }
252
270
 
253
271
  function dilutedEps({ statement }: RatioPeriod): RatioAmount {
@@ -366,7 +384,7 @@ export const RATIO_TABS: RatioTabDef[] = [
366
384
  inputs: [netIncome, { label: "Avg Equity", operator: "÷", format: "money", value: average(...equityLines) }],
367
385
  compute: ([income], period) => {
368
386
  const ends = equityEnds(period);
369
- return ends ? returnOnEquity(income!, ends) : "not-reported";
387
+ return ends ? returnOnEquity(income!, ends) : period.opening ? "not-reported" : "no-opening";
370
388
  },
371
389
  },
372
390
  {
@@ -384,7 +402,20 @@ export const RATIO_TABS: RatioTabDef[] = [
384
402
  signed: true,
385
403
  inputs: [
386
404
  { label: "NOPAT", format: "money", annualized: true, value: nopat },
387
- { label: "Avg Invested Capital", operator: "÷", format: "money", value: average(line("investedCapital"), debtPlusEquity) },
405
+ { label: "Avg Invested Capital", operator: "÷", format: "money", value: average(investedCapital, debtPlusEquity) },
406
+ ],
407
+ compute: ([income, base]) => over(income!, base!),
408
+ },
409
+ {
410
+ // ROIC with cash and short-term investments taken out of invested capital: Copart, debt free with its
411
+ // cash in its equity, reads its operations' return rather than one diluted by the cash.
412
+ id: "roic-ex-cash",
413
+ label: "ROIC ex Cash",
414
+ format: "percent",
415
+ signed: true,
416
+ inputs: [
417
+ { label: "NOPAT", format: "money", annualized: true, value: nopat },
418
+ { label: "Avg IC less Cash", operator: "÷", format: "money", value: averageOperatingCapital },
388
419
  ],
389
420
  compute: ([income, base]) => over(income!, base!),
390
421
  },
@@ -602,7 +633,7 @@ export const RATIO_TAB_KEYS = new Set(RATIO_TABS.map((tab) => tab.key));
602
633
  * report explains more than a missing close, and a close still loading may
603
634
  * yet arrive.
604
635
  */
605
- const GAP_ORDER: RatioGap[] = ["not-reported", "short-history", "no-burn", "not-meaningful", "no-price", "loading"];
636
+ const GAP_ORDER: RatioGap[] = ["not-reported", "no-opening", "short-history", "no-burn", "not-meaningful", "no-price", "loading"];
606
637
 
607
638
  function inputAmount(input: RatioInputDef, period: RatioPeriod): RatioAmount {
608
639
  if (!input.trailing || !period.quarterly) return input.value(period);
@@ -1,9 +1,26 @@
1
- import { revenueMargin } from "../../../../utils/growth";
1
+ import { revenueMargin, type Rate } from "../../../../utils/growth";
2
+ import type { FinancialStatement } from "../../../../types/financials";
2
3
  import type { FinancialSubTab } from "./model";
4
+ import { statementNopat } from "./nopat";
3
5
 
4
6
  /** A line over revenue: N/M where revenue is zero or negative. */
5
7
  const financialRatio = revenueMargin;
6
8
 
9
+ /** What went out on a line kept as a negative number (capex, acquisitions), as a positive amount. */
10
+ const spent = (value: number | undefined): number | undefined => (typeof value === "number" && Number.isFinite(value) ? Math.abs(value) : undefined);
11
+
12
+ /**
13
+ * The share of after-tax operating profit put back into the business: capex and acquisitions less D&A, over NOPAT
14
+ * (statementNopat). Acquisitions count where the statement reports them; N/M over NOPAT at or below zero.
15
+ */
16
+ function reinvestmentRate(statement: FinancialStatement): Rate | undefined {
17
+ const capex = spent(statement.capitalExpenditure);
18
+ const depreciation = statement.depreciationAndAmortization ?? statement.depreciationAmortizationDepletion;
19
+ const nopat = statementNopat(statement);
20
+ if (capex === undefined || typeof depreciation !== "number" || !Number.isFinite(depreciation) || nopat === undefined) return undefined;
21
+ return financialRatio(capex + (spent(statement.purchaseOfBusiness) ?? 0) - depreciation, nopat);
22
+ }
23
+
7
24
  const LOWER_IS_BETTER = "lower" as const;
8
25
  const NEUTRAL_GROWTH = "neutral" as const;
9
26
 
@@ -130,9 +147,23 @@ export const FINANCIAL_SUB_TABS: FinancialSubTab[] = [
130
147
  label: "Free Cash Flow",
131
148
  summaryKey: "freeCashFlow",
132
149
  defaultExpanded: true,
150
+ // Operating cash flow is the Operating group's own line below; a row here would repeat it.
133
151
  children: [
134
- { label: "Operating CF", key: "operatingCashFlow", format: "compact" },
135
152
  { label: "CapEx", key: "capitalExpenditure", format: "compact", outflow: true },
153
+ {
154
+ label: "CapEx / Revenue",
155
+ id: "capex-revenue",
156
+ compute: (statement) => financialRatio(spent(statement.capitalExpenditure), statement.totalRevenue),
157
+ format: "percent",
158
+ growthDirection: NEUTRAL_GROWTH,
159
+ },
160
+ {
161
+ label: "Reinvestment Rate",
162
+ id: "reinvestment-rate",
163
+ compute: reinvestmentRate,
164
+ format: "percent",
165
+ growthDirection: NEUTRAL_GROWTH,
166
+ },
136
167
  ],
137
168
  },
138
169
  {
@@ -150,10 +150,12 @@ export function ResolvedFinancialsTab({
150
150
  const [storedSubTab, setStoredSubTab] = usePaneStateValue<string>("financialSubTab", FINANCIAL_SUB_TABS[0]!.key);
151
151
  const resolvedSubTabKey = resolveFinancialSectionKey(storedSubTab);
152
152
  const subTabIdx = Math.max(0, FINANCIAL_SECTIONS.findIndex((tab) => tab.key === resolvedSubTabKey));
153
- // Ratios open collapsed: the inputs behind each one show on demand.
153
+ // Ratios open collapsed: the inputs behind each one show on demand. A capture of a ratio tab opens them all
154
+ // (`financialRatiosExpanded`), so the picture holds the inputs the report lists.
155
+ const [ratiosExpanded] = usePaneStateValue<boolean>("financialRatiosExpanded", false);
154
156
  const [collapsedGroups, setCollapsedGroups] = useState<Set<string>>(() => new Set([
155
157
  ...collectDefaultCollapsedGroupIds(FINANCIAL_SUB_TABS.flatMap((tab) => tab.rows)),
156
- ...RATIO_TABS.flatMap((tab) => tab.ratios.map((ratio) => ratio.id)),
158
+ ...ratiosExpanded ? [] : RATIO_TABS.flatMap((tab) => tab.ratios.map((ratio) => ratio.id)),
157
159
  ]));
158
160
  const [selectedRowId, setSelectedRowId] = useState<string | null>(null);
159
161
  const bodyScrollRef = useRef<ScrollBoxRenderable>(null);
@@ -7,6 +7,9 @@ import { PRICE_WINDOW_FROM_HELP, PRICE_WINDOW_TO_HELP } from "../../../utils/pri
7
7
  import type { HeadlessPaneOptionDef } from "../../../types/headless";
8
8
  import { QUOTE_MONITOR_MAX_TICKERS } from "../../../tickers/list";
9
9
 
10
+ /** The most tickers one FA report reads: each is a full statements load. */
11
+ const FINANCIAL_REPORT_MAX_TICKERS = 10;
12
+
10
13
  /** `--from 2007 --to 2009`: the report's bars for those dates. The pane keeps its range, so a capture refuses them. */
11
14
  const WINDOW_OPTIONS: HeadlessPaneOptionDef[] = [
12
15
  { key: "from", type: "string", placeholder: "year|date", description: PRICE_WINDOW_FROM_HELP, example: "--from 2007 --to 2009",
@@ -19,7 +22,12 @@ type PaneSchema = Pick<HeadlessPaneDefinition, "argument" | "options" | "discove
19
22
 
20
23
  export const paneSchemas = {
21
24
  "financial-analysis-pane": {
22
- argument: { kind: "ticker" },
25
+ // A ticker, or several in one long table; the pane, and so `shot`, shows one.
26
+ argument: {
27
+ kind: "tickers", maximum: FINANCIAL_REPORT_MAX_TICKERS, placeholder: "ticker",
28
+ description: `Company ticker, or up to ${FINANCIAL_REPORT_MAX_TICKERS} in one long table (Ticker, Period, Period End, Metric, Value, Unit).`,
29
+ examples: ["V MCO CPRT --statement profitability"],
30
+ },
23
31
  options: [
24
32
  FINANCIAL_PERIOD_OPTION,
25
33
  {
@@ -39,14 +47,32 @@ export const paneSchemas = {
39
47
  ],
40
48
  defaultValue: "income",
41
49
  },
50
+ {
51
+ key: "layout",
52
+ description: "wide: one ticker's periods as columns, as the pane shows them. long: a row per ticker, fiscal period and metric, each with its period end and unit, for pasting several companies into one table. Default wide for one ticker, long for several.",
53
+ type: "enum",
54
+ values: [{ value: "wide" }, { value: "long", aliases: ["tidy", "rows"] }],
55
+ example: "--layout long --csv",
56
+ shot: { reportOnly: "lays the report's rows out a row per period and metric" },
57
+ },
42
58
  ],
43
59
  discovery: {
44
60
  id: "financial-statements",
45
61
  aliases: ["financials", "financial statement", "income statement", "balance sheet", "cash flow statement", "financial ratios"],
46
- // `fn runway VKTX` is the liquidity view, where cash + ST investments, burn and runway are.
47
- opens: [{ words: ["runway", "cash runway", "burn", "cash burn", "months of cash"], argument: "", options: { statement: "liquidity" } }],
62
+ // What a memo asks for by name: `catalog roic` and `catalog "operating margin"` find FA, and `fn ROIC V` opens
63
+ // the tab with it, as `fn runway VKTX` is the liquidity view, where cash + ST investments, burn and runway are.
64
+ intents: [
65
+ "ROIC (return on invested capital), ROE, ROA and gross, operating and net margins, with NOPAT and invested capital",
66
+ "Capex, capex as a share of revenue, free cash flow and reinvestment rate by fiscal year",
67
+ ],
68
+ opens: [
69
+ { words: ["runway", "cash runway", "burn", "cash burn", "months of cash"], argument: "", options: { statement: "liquidity" } },
70
+ { words: ["roic", "return on invested capital", "nopat", "operating margin", "gross margin", "net margin", "margins"], argument: "",
71
+ options: { statement: "profitability" } },
72
+ { words: ["capex", "capital expenditure", "capital expenditures", "reinvestment rate"], argument: "", options: { statement: "cashflow" } },
73
+ ],
48
74
  limitations: [
49
- "One company per invocation; use GF for cross-company metric comparisons.",
75
+ "Several companies come as one long table, a row per figure; GF charts one metric across companies over more years.",
50
76
  "Excludes bank regulatory capital (CET1, risk-weighted assets) and REIT FFO/AFFO.",
51
77
  ],
52
78
  screenshotReadiness: "ready",