@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
@@ -0,0 +1,256 @@
1
+ import { fredSeriesUrl, seriesNotOnFred } from "../../../sources/gloomberb-cloud/fred-series";
2
+ import type { SeriesDefinition, SeriesFrequency } from "../../../series/types";
3
+
4
+ type FredRow = readonly [seriesId: string, name: string, unit: string, frequency: SeriesFrequency, publisher: string, tags?: readonly string[]];
5
+
6
+ /** What people call a Treasury bill: a t-bill, a tbill, cash parked in a money market. */
7
+ const BILL_TAGS = ["bill", "T-bill", "T-bills", "tbill", "tbills", "money markets", "money market"] as const;
8
+
9
+ /**
10
+ * The FRED series Gloom Cloud serves, by group, except the Treasury constant
11
+ * maturities (UST:2Y and so on, from the yield curve) and the credit spreads
12
+ * and yields (from the credit plugin). Ids follow the server's allowlist: a
13
+ * series added there is listed here to reach the catalog.
14
+ * Türkiye's CPI, Brazil's IPCA, MAS's SORA and NAHB's housing market index
15
+ * are served the same way but are not on FRED; their rows name TurkStat,
16
+ * IBGE, MAS and NAHB (`seriesNotOnFred`).
17
+ */
18
+ const GROUPS: ReadonlyArray<{ group: string; rows: readonly FredRow[] }> = [
19
+ {
20
+ group: "Rates",
21
+ rows: [
22
+ ["FEDFUNDS", "Fed funds effective rate (monthly)", "%", "monthly", "Federal Reserve Board", ["fed funds"]],
23
+ ["DFF", "Fed funds effective rate", "%", "daily", "Federal Reserve Board", ["fed funds"]],
24
+ ["EFFR", "Effective federal funds rate", "%", "daily", "Federal Reserve Bank of New York", ["EFFR", "money markets"]],
25
+ ["IORB", "Interest on reserve balances", "%", "daily", "Federal Reserve Board", ["IORB", "money markets"]],
26
+ ["DFEDTARU", "Fed funds target range, upper limit", "%", "daily", "Federal Reserve Board", ["fed funds", "policy rate"]],
27
+ ["DFEDTARL", "Fed funds target range, lower limit", "%", "daily", "Federal Reserve Board", ["fed funds", "policy rate"]],
28
+ ["ECBDFR", "ECB deposit facility rate", "%", "daily", "European Central Bank", ["ECB", "euro area", "policy rate"]],
29
+ ["DPRIME", "Bank prime loan rate", "%", "daily", "Federal Reserve Board"],
30
+ ["DFII5", "5Y TIPS real yield", "%", "daily", "Federal Reserve Board", ["treasury", "real yield"]],
31
+ ["DFII10", "10Y TIPS real yield", "%", "daily", "Federal Reserve Board", ["treasury", "real yield"]],
32
+ ["T10Y2Y", "10Y minus 2Y Treasury spread", "bp", "daily", "Federal Reserve Bank of St. Louis", ["treasury", "curve", "2s10s"]],
33
+ ["T10Y3M", "10Y minus 3M Treasury spread", "bp", "daily", "Federal Reserve Bank of St. Louis", ["treasury", "curve"]],
34
+ // The Federal Reserve Board's Kim-Wright estimates, a week or so behind.
35
+ ...Array.from({ length: 10 }, (_, index): FredRow =>
36
+ [`THREEFYTP${index + 1}`, `${index + 1}Y Treasury term premium (Kim-Wright)`, "%", "daily", "Federal Reserve Board", ["treasury", "term premium", "Kim-Wright"]]),
37
+ ["SOFR", "SOFR", "%", "daily", "Federal Reserve Bank of New York", ["secured overnight financing rate", "money markets"]],
38
+ ["SORA", "SORA (Singapore overnight rate average)", "%", "daily", "MAS", ["SGD", "Singapore", "MAS", "overnight", "money markets"]],
39
+ ["OBFR", "Overnight bank funding rate", "%", "daily", "Federal Reserve Bank of New York", ["OBFR", "money markets"]],
40
+ ["DTB4WK", "4-week Treasury bill rate", "%", "daily", "Federal Reserve Board", BILL_TAGS],
41
+ ["DTB3", "3-month Treasury bill rate", "%", "daily", "Federal Reserve Board", BILL_TAGS],
42
+ ["DTB6", "6-month Treasury bill rate", "%", "daily", "Federal Reserve Board", BILL_TAGS],
43
+ ["DTB1YR", "1-year Treasury bill rate", "%", "daily", "Federal Reserve Board", BILL_TAGS],
44
+ ["DCPF3M", "3-month AA financial commercial paper rate", "%", "daily", "Federal Reserve Board", ["commercial paper", "money markets"]],
45
+ ["DCPN3M", "3-month AA nonfinancial commercial paper rate", "%", "daily", "Federal Reserve Board", ["commercial paper", "money markets"]],
46
+ ["RRPONTSYD", "Overnight reverse repo at the Fed", "billion USD", "daily", "Federal Reserve Bank of New York", ["RRP", "liquidity", "money markets"]],
47
+ ["WDTGAL", "Treasury General Account", "million USD", "weekly", "Federal Reserve Board", ["TGA", "liquidity", "money markets"]],
48
+ ["WRESBAL", "Bank reserves at the Fed", "million USD", "weekly", "Federal Reserve Board", ["reserves", "liquidity", "money markets"]],
49
+ ["WALCL", "Fed total assets", "million USD", "weekly", "Federal Reserve Board", ["balance sheet", "liquidity"]],
50
+ ["M2SL", "M2 money stock", "billion USD", "monthly", "Federal Reserve Board", ["money supply", "liquidity"]],
51
+ ],
52
+ },
53
+ {
54
+ group: "Volatility",
55
+ rows: [
56
+ ["VIXCLS", "VIX", "index", "daily", "Cboe", ["volatility index", "30 day"]],
57
+ ["VXVCLS", "VIX 3M", "index", "daily", "Cboe", ["volatility index", "3 month"]],
58
+ ],
59
+ },
60
+ {
61
+ group: "Economy",
62
+ rows: [
63
+ ["GDP", "Gross domestic product", "billion USD", "quarterly", "Bureau of Economic Analysis", ["GDP", "growth"]],
64
+ ["GDPC1", "Real gross domestic product", "billion USD", "quarterly", "Bureau of Economic Analysis", ["GDP", "growth"]],
65
+ ["UNRATE", "Unemployment rate", "%", "monthly", "Bureau of Labor Statistics", ["labor", "jobs"]],
66
+ ["ICSA", "Initial jobless claims", "count", "weekly", "Department of Labor", ["labor", "claims"]],
67
+ ["PAYEMS", "Nonfarm payrolls", "thousand people", "monthly", "Bureau of Labor Statistics", ["labor", "jobs", "employment"]],
68
+ ["NPPTTL", "Private payroll employment (discontinued)", "thousand people", "monthly", "ADP Research Institute", ["labor", "jobs"]],
69
+ ["JTSJOL", "Job openings", "thousand jobs", "monthly", "Bureau of Labor Statistics", ["labor", "JOLTS"]],
70
+ ["OPHNFB", "Nonfarm labor productivity", "index", "quarterly", "Bureau of Labor Statistics", ["labor", "productivity"]],
71
+ ["ULCNFB", "Unit labor costs", "index", "quarterly", "Bureau of Labor Statistics", ["labor", "wages"]],
72
+ ["RSAFS", "Retail sales", "million USD", "monthly", "Census Bureau", ["consumer", "spending"]],
73
+ ["RSFSXMV", "Retail sales excluding autos", "million USD", "monthly", "Census Bureau", ["consumer", "spending"]],
74
+ ["UMCSENT", "University of Michigan consumer sentiment", "index", "monthly", "University of Michigan", ["consumer", "sentiment"]],
75
+ ["CSCICP03USM665S", "Consumer confidence (OECD)", "index", "monthly", "OECD", ["consumer", "sentiment"]],
76
+ ["HOUST", "Housing starts", "thousand units", "monthly", "Census Bureau", ["housing", "homebuilders"]],
77
+ ["PERMIT", "Building permits", "thousand units", "monthly", "Census Bureau", ["housing", "homebuilders"]],
78
+ ["EXHOSLUSM495S", "Existing home sales", "units", "monthly", "National Association of Realtors", ["housing", "homebuilders"]],
79
+ ["HSN1F", "New home sales", "thousand units", "monthly", "Census Bureau", ["housing", "homebuilders"]],
80
+ ["MORTGAGE30US", "30-year fixed mortgage rate (Freddie Mac PMMS)", "%", "weekly", "Freddie Mac", ["housing", "mortgage rate", "PMMS", "Freddie Mac", "homebuilders"]],
81
+ ["MORTGAGE15US", "15-year fixed mortgage rate (Freddie Mac PMMS)", "%", "weekly", "Freddie Mac", ["housing", "mortgage rate", "PMMS", "Freddie Mac", "homebuilders"]],
82
+ // Computed by Gloom Cloud: MORTGAGE30US less DGS10 on each PMMS date.
83
+ ["MORTGAGE30US10Y", "30-year mortgage rate minus 10Y Treasury, on the PMMS date", "bp", "weekly", "Freddie Mac and Federal Reserve Board", ["housing", "mortgage spread", "PMMS", "treasury", "homebuilders"]],
84
+ ["NAHBHMI", "NAHB housing market index (builder sentiment)", "index", "monthly", "NAHB", ["housing", "NAHB", "HMI", "homebuilders", "sentiment"]],
85
+ ["DGORDER", "Durable goods orders", "million USD", "monthly", "Census Bureau", ["manufacturing", "orders"]],
86
+ ["ADXTNO", "Durable goods orders excluding transportation", "million USD", "monthly", "Census Bureau", ["manufacturing", "orders"]],
87
+ ["AMTMNO", "Manufacturing new orders", "million USD", "monthly", "Census Bureau", ["manufacturing", "factory orders"]],
88
+ ["BOPGSTB", "Trade balance", "million USD", "monthly", "Bureau of Economic Analysis and Census Bureau", ["trade"]],
89
+ ["INDPRO", "Industrial production", "index", "monthly", "Federal Reserve Board", ["manufacturing", "output"]],
90
+ ["TCU", "Capacity utilization", "%", "monthly", "Federal Reserve Board", ["manufacturing"]],
91
+ ["PI", "Personal income", "billion USD", "monthly", "Bureau of Economic Analysis", ["consumer", "income"]],
92
+ ["PCE", "Personal consumption expenditures", "billion USD", "monthly", "Bureau of Economic Analysis", ["consumer", "spending"]],
93
+ ["NETFI", "Current account balance", "billion USD", "quarterly", "Bureau of Economic Analysis", ["trade", "external"]],
94
+ ],
95
+ },
96
+ {
97
+ group: "Defense & fiscal",
98
+ rows: [
99
+ ["FDEFX", "National defense spending (annual rate)", "billion USD", "quarterly", "Bureau of Economic Analysis", ["defense", "military", "DoD", "budget", "government spending", "GDP"]],
100
+ ["ADEFNO", "New orders for defense capital goods", "million USD", "monthly", "Census Bureau", ["defense", "military", "DoD", "orders", "manufacturing"]],
101
+ ["MTSO133FMS", "Federal outlays (Monthly Treasury Statement)", "million USD", "monthly", "U.S. Treasury", ["budget", "government spending", "fiscal", "deficit", "Treasury"]],
102
+ ],
103
+ },
104
+ {
105
+ group: "Inflation",
106
+ rows: [
107
+ ["CPIAUCSL", "CPI, all items", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "headline", "seasonally adjusted"]],
108
+ ["CPIAUCNS", "CPI, all items (not seasonally adjusted)", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "headline"]],
109
+ ["CPILFESL", "Core CPI", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "core", "ex food and energy"]],
110
+ ["CPILFENS", "Core CPI (not seasonally adjusted)", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "core"]],
111
+ ["CPIUFDSL", "CPI: Food", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component"]],
112
+ ["CUSR0000SAF11", "CPI: Food at home", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "groceries"]],
113
+ ["CUSR0000SEFV", "CPI: Food away from home", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "restaurants"]],
114
+ ["CPIENGSL", "CPI: Energy", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component"]],
115
+ ["CUSR0000SETB01", "CPI: Gasoline", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "energy"]],
116
+ ["CUSR0000SEHF01", "CPI: Electricity", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "energy"]],
117
+ ["CUSR0000SEHF02", "CPI: Utility gas service", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "energy"]],
118
+ ["CUSR0000SACL1E", "CPI: Core goods", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "goods"]],
119
+ ["CUSR0000SETA01", "CPI: New vehicles", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "goods", "cars"]],
120
+ ["CUSR0000SETA02", "CPI: Used cars and trucks", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "goods", "cars"]],
121
+ ["CPIAPPSL", "CPI: Apparel", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "goods"]],
122
+ ["CUSR0000SAM1", "CPI: Medical care goods", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "goods", "health"]],
123
+ ["CUSR0000SASLE", "CPI: Core services", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "services"]],
124
+ ["CUSR0000SAH1", "CPI: Shelter", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "services", "housing"]],
125
+ ["CUSR0000SEHA", "CPI: Rent", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "services", "housing"]],
126
+ ["CUSR0000SEHC", "CPI: Owners' equivalent rent", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "services", "housing", "OER"]],
127
+ ["CUSR0000SEHB", "CPI: Lodging away from home", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "services", "hotels"]],
128
+ ["CUSR0000SAM2", "CPI: Medical care services", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "services", "health"]],
129
+ ["CUSR0000SAS4", "CPI: Transportation services", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "services"]],
130
+ ["CUSR0000SETG01", "CPI: Airline fares", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "services", "travel"]],
131
+ ["PCEPI", "PCE price index", "index", "monthly", "Bureau of Economic Analysis", ["PCE", "headline"]],
132
+ ["PCEPILFE", "Core PCE price index", "index", "monthly", "Bureau of Economic Analysis", ["PCE", "core"]],
133
+ ["PPIACO", "Producer prices, all commodities", "index", "monthly", "Bureau of Labor Statistics", ["PPI"]],
134
+ ["PPIFIS", "Producer prices, final demand", "index", "monthly", "Bureau of Labor Statistics", ["PPI"]],
135
+ ["PPIFID", "Producer prices, final demand (not seasonally adjusted)", "index", "monthly", "Bureau of Labor Statistics", ["PPI"]],
136
+ ["IR", "Import prices", "index", "monthly", "Bureau of Labor Statistics", ["trade"]],
137
+ ["IQ", "Export prices", "index", "monthly", "Bureau of Labor Statistics", ["trade"]],
138
+ ["T5YIE", "5Y breakeven inflation", "%", "daily", "Federal Reserve Bank of St. Louis", ["breakeven", "expectations", "TIPS"]],
139
+ ["T10YIE", "10Y breakeven inflation", "%", "daily", "Federal Reserve Bank of St. Louis", ["breakeven", "expectations", "TIPS"]],
140
+ ["T5YIFR", "5Y, 5Y forward inflation expectation", "%", "daily", "Federal Reserve Bank of St. Louis", ["breakeven", "expectations", "5y5y"]],
141
+ ["TURCPIYOY", "Türkiye CPI, y/y", "%", "monthly", "TurkStat", ["CPI", "headline", "Turkey", "TR", "inflation", "lira"]],
142
+ ["TURCPIMOM", "Türkiye CPI, m/m", "%", "monthly", "TurkStat", ["CPI", "headline", "Turkey", "TR", "inflation", "lira"]],
143
+ ["BRAIPCAMOM", "Brazil IPCA, m/m", "%", "monthly", "IBGE", ["IPCA", "CPI", "headline", "Brazil", "BR", "Brazil inflation", "inflation", "real"]],
144
+ ["BRAIPCA15MOM", "Brazil IPCA-15 mid-month, m/m", "%", "monthly", "IBGE",
145
+ ["IPCA-15", "IPCA", "CPI", "mid-month", "Brazil", "BR", "Brazil inflation", "inflation", "real"]],
146
+ ],
147
+ },
148
+ {
149
+ group: "FX",
150
+ rows: [
151
+ ["DEXUSEU", "Euro (USD per EUR)", "USD", "daily", "Federal Reserve Board", ["EURUSD", "EUR", "euro"]],
152
+ ["DEXUSUK", "British pound (USD per GBP)", "USD", "daily", "Federal Reserve Board", ["GBPUSD", "GBP", "sterling", "pound"]],
153
+ ["DEXUSAL", "Australian dollar (USD per AUD)", "USD", "daily", "Federal Reserve Board", ["AUDUSD", "AUD"]],
154
+ ["DEXUSNZ", "New Zealand dollar (USD per NZD)", "USD", "daily", "Federal Reserve Board", ["NZDUSD", "NZD"]],
155
+ ["DEXJPUS", "Japanese yen (JPY per USD)", "JPY", "daily", "Federal Reserve Board", ["USDJPY", "JPY", "yen"]],
156
+ ["DEXCHUS", "Chinese yuan (CNY per USD)", "CNY", "daily", "Federal Reserve Board", ["USDCNY", "CNY", "renminbi", "yuan"]],
157
+ ["DEXINUS", "Indian rupee (INR per USD)", "INR", "daily", "Federal Reserve Board", ["USDINR", "INR"]],
158
+ ["DEXBZUS", "Brazilian real (BRL per USD)", "BRL", "daily", "Federal Reserve Board", ["USDBRL", "BRL"]],
159
+ ["DEXMXUS", "Mexican peso (MXN per USD)", "MXN", "daily", "Federal Reserve Board", ["USDMXN", "MXN"]],
160
+ ["DEXKOUS", "South Korean won (KRW per USD)", "KRW", "daily", "Federal Reserve Board", ["USDKRW", "KRW"]],
161
+ ["DEXCAUS", "Canadian dollar (CAD per USD)", "CAD", "daily", "Federal Reserve Board", ["USDCAD", "CAD"]],
162
+ ["DEXSZUS", "Swiss franc (CHF per USD)", "CHF", "daily", "Federal Reserve Board", ["USDCHF", "CHF", "franc", "swiss franc"]],
163
+ ["DEXTAUS", "Taiwan dollar (TWD per USD)", "TWD", "daily", "Federal Reserve Board", ["USDTWD", "TWD"]],
164
+ ["DEXHKUS", "Hong Kong dollar (HKD per USD)", "HKD", "daily", "Federal Reserve Board", ["USDHKD", "HKD"]],
165
+ ["DEXSIUS", "Singapore dollar (SGD per USD)", "SGD", "daily", "Federal Reserve Board", ["USDSGD", "SGD"]],
166
+ ["DEXTHUS", "Thai baht (THB per USD)", "THB", "daily", "Federal Reserve Board", ["USDTHB", "THB"]],
167
+ ["DEXMAUS", "Malaysian ringgit (MYR per USD)", "MYR", "daily", "Federal Reserve Board", ["USDMYR", "MYR"]],
168
+ ["DEXNOUS", "Norwegian krone (NOK per USD)", "NOK", "daily", "Federal Reserve Board", ["USDNOK", "NOK"]],
169
+ ["DEXSDUS", "Swedish krona (SEK per USD)", "SEK", "daily", "Federal Reserve Board", ["USDSEK", "SEK"]],
170
+ ["DEXDNUS", "Danish krone (DKK per USD)", "DKK", "daily", "Federal Reserve Board", ["USDDKK", "DKK"]],
171
+ ["DEXSLUS", "Sri Lankan rupee (LKR per USD)", "LKR", "daily", "Federal Reserve Board", ["USDLKR", "LKR"]],
172
+ ["DEXSFUS", "South African rand (ZAR per USD)", "ZAR", "daily", "Federal Reserve Board", ["USDZAR", "ZAR"]],
173
+ ["DEXVZUS", "Venezuelan bolivar (VES per USD)", "VES", "daily", "Federal Reserve Board", ["USDVES", "VES"]],
174
+ ["DTWEXBGS", "Broad dollar index", "index", "daily", "Federal Reserve Board", ["dollar", "trade weighted"]],
175
+ ["DTWEXAFEGS", "Dollar index against advanced economies", "index", "daily", "Federal Reserve Board", ["dollar", "trade weighted"]],
176
+ ["DTWEXEMEGS", "Dollar index against emerging markets", "index", "daily", "Federal Reserve Board", ["dollar", "trade weighted"]],
177
+ ["RTWEXBGS", "Real broad dollar index", "index", "monthly", "Federal Reserve Board", ["dollar", "trade weighted", "real"]],
178
+ ["RTWEXAFEGS", "Real dollar index against advanced economies", "index", "monthly", "Federal Reserve Board", ["dollar", "trade weighted", "real"]],
179
+ ["RTWEXEMEGS", "Real dollar index against emerging markets", "index", "monthly", "Federal Reserve Board", ["dollar", "trade weighted", "real"]],
180
+ ],
181
+ },
182
+ {
183
+ group: "Energy",
184
+ rows: [
185
+ ["DCOILWTICO", "WTI crude oil spot", "USD/barrel", "daily", "U.S. Energy Information Administration", ["oil", "crude"]],
186
+ ["WCOILWTICO", "WTI crude oil spot (weekly)", "USD/barrel", "weekly", "U.S. Energy Information Administration", ["oil", "crude"]],
187
+ ["DCOILBRENTEU", "Brent crude oil spot", "USD/barrel", "daily", "U.S. Energy Information Administration", ["oil", "crude"]],
188
+ ["DHHNGSP", "Henry Hub natural gas spot", "USD/MMBtu", "daily", "U.S. Energy Information Administration", ["natural gas"]],
189
+ ["NATURALGAS", "Natural gas consumption", "billion cubic feet", "monthly", "U.S. Energy Information Administration", ["natural gas"]],
190
+ ],
191
+ },
192
+ {
193
+ // The IMF's monthly world prices: the closest public series to LME copper and aluminium, which FUT does not list,
194
+ // and to iron ore, whose futures are licensed.
195
+ group: "Commodities",
196
+ rows: [
197
+ ["PCOPPUSDM", "Global price of copper", "USD/ton", "monthly", "International Monetary Fund", ["copper", "metals", "LME"]],
198
+ ["PALUMUSDM", "Global price of aluminum", "USD/ton", "monthly", "International Monetary Fund", ["aluminum", "aluminium", "metals", "LME"]],
199
+ ["PIORECRUSDM", "Global price of iron ore (dry metric ton)", "USD/ton", "monthly", "International Monetary Fund", ["iron ore", "iron", "steel", "metals"]],
200
+ ],
201
+ },
202
+ {
203
+ group: "Valuation",
204
+ rows: [
205
+ ["NCBEILQ027S", "Nonfinancial corporate equities (Z.1)", "million USD", "quarterly", "Federal Reserve Board", ["market cap", "Buffett"]],
206
+ ["FBCELLQ027S", "Financial sector corporate equities (Z.1)", "million USD", "quarterly", "Federal Reserve Board", ["market cap"]],
207
+ ["BOGZ1FL153064486Q", "Household corporate equity holdings (Z.1)", "million USD", "quarterly", "Federal Reserve Board", ["households", "equity allocation"]],
208
+ ["BOGZ1FL663067003Q", "Broker-dealer customer receivables (Z.1)", "million USD", "quarterly", "Federal Reserve Board", ["margin debt"]],
209
+ ["CPROFIT", "Corporate profits after tax", "billion USD", "quarterly", "Bureau of Economic Analysis", ["earnings", "profits"]],
210
+ ["TNWMVBSNNCB", "Nonfinancial corporate net worth (Z.1)", "million USD", "quarterly", "Federal Reserve Board", ["Tobin's Q"]],
211
+ ],
212
+ },
213
+ ];
214
+
215
+ /** The FRED series the rates and macro panes chart, each listed once. */
216
+ export const FRED_CATALOG_SERIES: readonly SeriesDefinition[] = GROUPS.flatMap(({ group, rows }) => (
217
+ rows.map(([seriesId, name, unit, frequency, publisher, tags]): SeriesDefinition => ({
218
+ id: `fred:${seriesId}`,
219
+ name,
220
+ unit,
221
+ frequency,
222
+ group,
223
+ ...(tags?.length ? { tags } : {}),
224
+ publisher,
225
+ // The licence a publisher's data comes under, which the catalog lists beside the series (SORA's).
226
+ ...(seriesNotOnFred(seriesId)?.attribution ? { limitation: seriesNotOnFred(seriesId)!.attribution } : {}),
227
+ url: fredSeriesUrl(seriesId),
228
+ expression: `FRED:${seriesId}`,
229
+ }))
230
+ ));
231
+
232
+ /** Spellings of a Treasury bill a person types, as the series names say it. */
233
+ const BILL_WORDS: ReadonlyArray<[RegExp, string]> = [
234
+ [/\bt-?bills?\b|\bt bills?\b|\btreasury bills?\b/g, "treasury bill"],
235
+ [/\b(\d+|three|six|one|four)[\s-]*(month|mo|m)\b/g, "$1-month"],
236
+ [/\bthree-month\b/g, "3-month"],
237
+ [/\bsix-month\b/g, "6-month"],
238
+ [/\b(\d+|four)[\s-]*(week|wk|w)\b/g, "$1-week"],
239
+ [/\bfour-week\b/g, "4-week"],
240
+ [/\b(1|one)[\s-]*(year|yr|y)\b/g, "1-year"],
241
+ ];
242
+
243
+ /**
244
+ * The served FRED series a name asks for, when one alone fits every word: `3 month t-bill` is DTB3. Null for an id
245
+ * (DTB3), for words several series fit and for none.
246
+ */
247
+ export function fredSeriesIdForName(text: string): string | null {
248
+ const normalized = BILL_WORDS.reduce((value, [pattern, replacement]) => value.replace(pattern, replacement), text.trim().toLowerCase());
249
+ const words = normalized.split(/\s+/).filter((word) => word && word !== "rate" && word !== "yield");
250
+ if (words.length < 2) return null;
251
+ const fits = FRED_CATALOG_SERIES.filter((series) => {
252
+ const name = `${series.name} ${(series.tags ?? []).join(" ")}`.toLowerCase();
253
+ return words.every((word) => name.includes(word));
254
+ });
255
+ return fits.length === 1 ? fits[0]!.id.replace(/^fred:/, "") : null;
256
+ }
@@ -36,7 +36,7 @@ export const FINANCIAL_PERIOD_OPTION: HeadlessPaneOptionDef = {
36
36
 
37
37
  export const FINANCIAL_PERIOD_COUNT_OPTION: HeadlessPaneOptionDef = {
38
38
  key: "periods",
39
- description: "Keep only the latest N annual or quarterly observations per ticker.",
39
+ description: "Keep only the latest N annual or quarterly periods per ticker; a period without a value stays as a gap.",
40
40
  type: "integer",
41
41
  aliases: ["years", "limit"],
42
42
  minimum: 1,
@@ -6,6 +6,9 @@ export interface DatedObservation {
6
6
  value: number | null;
7
7
  /** The day the value was released, when the source says (FRED's newest monthly figure). */
8
8
  releasedOn?: string;
9
+ firstReleased?: string;
10
+ revisedOn?: string;
11
+ firstReleaseValue?: number;
9
12
  }
10
13
 
11
14
  export interface SeriesCacheMetadata {
@@ -80,6 +80,7 @@ export function SeriesDetailChart({
80
80
  reference,
81
81
  resetKey,
82
82
  formatValue,
83
+ formatAxisValue,
83
84
  aboveChartRows = 0,
84
85
  aboveChart,
85
86
  belowChartRows = 0,
@@ -102,6 +103,7 @@ export function SeriesDetailChart({
102
103
  /** A new key drops the user's zoom and pan. */
103
104
  resetKey: string;
104
105
  formatValue: (value: number) => string;
106
+ formatAxisValue?: (value: number) => string;
105
107
  /** Rows kept for `aboveChart`, drawn between the figures and a drawable chart. */
106
108
  aboveChartRows?: number;
107
109
  aboveChart?: (chartWidth: number) => ReactNode;
@@ -159,6 +161,7 @@ export function SeriesDetailChart({
159
161
  viewportResetKey={resetKey}
160
162
  onViewportChange={setUserViewport}
161
163
  formatValue={(value) => formatValue(value)}
164
+ formatAxisValue={formatAxisValue}
162
165
  emptyMessage="Not enough chart data"
163
166
  />
164
167
  </>
@@ -16,7 +16,7 @@ import { colors } from "../../../theme/colors";
16
16
  import type { PaneProps } from "../../../types/plugin";
17
17
  import { Box, TextAttributes } from "../../../ui";
18
18
  import { formatShortDate } from "../../../utils/datetime-format";
19
- import { MISSING_VALUE, formatCompact, formatNumber } from "../../../utils/format";
19
+ import { MISSING_VALUE, displayWidth, formatCompact, formatNumber } from "../../../utils/format";
20
20
  import { nextHeaderSort, type SortDirection } from "../../../utils/sort-values";
21
21
  import { shortInterestPublicationSegments } from "./schedule";
22
22
  import { loadShortWatch } from "./watch-client";
@@ -55,6 +55,7 @@ const COLUMNS: WatchColumn[] = [
55
55
  ];
56
56
  const DEFAULT_SORT = { columnId: "setup" as ShortWatchSortId, direction: "desc" as SortDirection };
57
57
  const rowKey = (row: ShortWatchRow) => row.symbol;
58
+ const rowSetup = (row: ShortWatchRow) => row.error ?? (row.return1M == null ? "No month of daily closes" : setupLabel(row.setup));
58
59
 
59
60
  const day = (iso: string | null) => iso ? formatShortDate(`${iso}T00:00:00Z`, { year: false, utc: true, fallback: MISSING_VALUE }) : MISSING_VALUE;
60
61
  const signed = (value: number | null, digits = 1) => value == null ? MISSING_VALUE : `${value > 0 ? "+" : ""}${formatNumber(value, digits)}%`;
@@ -87,21 +88,19 @@ export function ShortWatchPane({ width, height, focused }: Pick<PaneProps, "widt
87
88
  // A date every row shares moves to the query bar; a column no row fills is left out.
88
89
  const settled = useMemo(() => sharedDate(rows, "settlementDate"), [rows]);
89
90
  const closed = useMemo(() => sharedDate(rows, "closeDate"), [rows]);
90
- const columns = useMemo(() => COLUMNS.filter((column) => !(column.id === "settlementDate" && settled)
91
+ const columns = useMemo(() => COLUMNS.map((column) => column.id === "setup"
92
+ ? { ...column, width: Math.max(column.width, ...rows.map((row) => Math.min(32, displayWidth(rowSetup(row))))) } : column)
93
+ .filter((column) => !(column.id === "settlementDate" && settled)
91
94
  && !(column.id === "closeDate" && closed)
92
95
  && !(column.id === "percentFloat" && rows.length > 0 && rows.every((row) => row.percentFloat == null))), [rows, settled, closed]);
93
96
  const [selected, setSelected] = usePluginPaneState<string | null>("short-watch:selected", null);
94
97
 
95
- const unreported = rows.filter((row) => !row.settlementDate).map((row) => row.symbol);
96
- const unpriced = rows.filter((row) => row.settlementDate && row.return1M == null).map((row) => row.symbol);
97
98
  usePaneNoticeFooter({
98
99
  registrationId: "short-watch-notices",
99
100
  focused,
100
101
  notices: [
101
102
  universe.symbols.length ? universe.notice : null,
102
103
  resource.data ? resource.error : null,
103
- unreported.length ? `No short interest settlement for ${unreported.join(", ")}.` : null,
104
- unpriced.length ? `No month of daily closes for ${unpriced.join(", ")}.` : null,
105
104
  ].filter((value): value is string => !!value),
106
105
  });
107
106
  // When the newest settlement listed was published and the next is due, as `fn SIW` dates it.
@@ -119,7 +118,8 @@ export function ShortWatchPane({ width, height, focused }: Pick<PaneProps, "widt
119
118
  const renderCell = useCallback((row: ShortWatchRow, column: WatchColumn): DataTableCell => {
120
119
  switch (column.id) {
121
120
  case "symbol": return { text: row.symbol, color: colors.textBright, attributes: TextAttributes.BOLD };
122
- case "setup": return { text: setupLabel(row.setup), color: row.setup === "crowded-rising" ? colors.warning : colors.textDim };
121
+ case "setup": return { text: rowSetup(row),
122
+ color: row.error || row.return1M == null || row.setup === "crowded-rising" ? colors.warning : colors.textDim };
123
123
  case "percentFloat": return { text: row.percentFloat == null ? MISSING_VALUE : `${formatNumber(row.percentFloat, 1)}%`,
124
124
  color: row.setup ? colors.textBright : colors.text, value: row.percentFloat ?? undefined };
125
125
  case "daysToCover": return { text: row.daysToCover == null ? MISSING_VALUE : formatNumber(row.daysToCover, 1), value: row.daysToCover ?? undefined };
@@ -47,8 +47,8 @@ export type SocialColumn = Omit<DataTableColumn, "id"> & { id: SocialColumnId };
47
47
  export const SOCIAL_COLUMNS: SocialColumn[] = [
48
48
  { id: "day", label: "DATE", width: 12, align: "left" },
49
49
  { id: "mentions", label: "POSTS", width: 9, align: "right" },
50
- { id: "ratio", label: "VS MEDIAN", width: 10, align: "right" },
51
- { id: "wikiViews", label: "WIKI", width: 8, align: "right" },
50
+ { id: "ratio", label: "VS MEDIAN", width: 10, align: "right", omitWhenEmpty: true },
51
+ { id: "wikiViews", label: "WIKI", width: 8, align: "right", omitWhenEmpty: true },
52
52
  { id: "redditMentions", label: "REDDIT", width: 8, align: "right" },
53
53
  { id: "stance", label: "STANCE", width: 8, align: "right" },
54
54
  { id: "topPost", label: "TOP POST", width: 24, flexGrow: 1, align: "left" },
@@ -178,7 +178,7 @@ function ThirteenFBrowserPane({ focused, width, height, onDetailChange }: PanePr
178
178
  const columns = useMemo(() => {
179
179
  if (browserMode !== "performance") return buildBrowserColumns(false);
180
180
  const history = rows[0]?.priorReturns ?? [];
181
- return [...buildBrowserColumns().filter(column => !["rows", "filed"].includes(column.id)), ...history.map((point, index) => ({ id: `return${index + 1}` as FundBrowserColumnId, label: point.quarter, width: 10, align: "right" as const }))];
181
+ return [...buildBrowserColumns().filter(column => !["rows", "filed"].includes(column.id)), ...history.map((point, index) => ({ id: `return${index + 1}` as FundBrowserColumnId, label: point.quarter, width: 10, align: "right" as const, omitWhenEmpty: true }))];
182
182
  }, [browserMode, rows]);
183
183
 
184
184
  useEffect(() => {
@@ -54,6 +54,22 @@ export function adrPairLegs(
54
54
  return { pair, receiptSide, receiptKey: pair.receipt, homeKey: home, otherKey: pair.receipt };
55
55
  }
56
56
 
57
+ /**
58
+ * Each leg's quote: the other line's from its own read, and the listing's own
59
+ * from its read or, while that has none (a read that failed), the quote its
60
+ * pane already shows. The pane heads with that price, so the tab never says
61
+ * it is unavailable beside it.
62
+ */
63
+ export function adrPairQuotes(
64
+ legs: AdrPairLegs,
65
+ read: { own: Quote | null | undefined; other: Quote | null | undefined },
66
+ paneQuote: Quote | null | undefined,
67
+ ): { receipt: Quote | null; home: Quote | null } {
68
+ const own = read.own ?? paneQuote ?? null;
69
+ const other = read.other ?? null;
70
+ return legs.receiptSide ? { receipt: own, home: other } : { receipt: other, home: own };
71
+ }
72
+
57
73
  /** The comparison from the two quotes and the home currency's USD value (as exchange rates are served). */
58
74
  export function adrPairComparison(
59
75
  legs: AdrPairLegs,
@@ -10,7 +10,7 @@ import { heldCurrencyUnit } from "../../../../utils/currency-units";
10
10
  import type { TickerResearchTabProps } from "../../../../types/plugin";
11
11
  import { Box } from "../../../../ui";
12
12
  import { useOpenDescription } from "../../shared/open-description";
13
- import { adrPairComparison, adrPairFigures, adrPairInputRows, adrPairLegs, type AdrPairInputRow } from "./model";
13
+ import { adrPairComparison, adrPairFigures, adrPairInputRows, adrPairLegs, adrPairQuotes, type AdrPairInputRow } from "./model";
14
14
 
15
15
  // The price and its time first: a narrow pane keeps them and drops the role.
16
16
  const COLUMNS: DataTableColumn[] = [
@@ -37,9 +37,12 @@ export function AdrPairResearchTab({ width, height, focused }: TickerResearchTab
37
37
  // Both legs through the quote path, so each is read alike whichever side the pane is on.
38
38
  const ownEntry = useQuoteEntry(legs ? ticker?.metadata.ticker ?? symbol : null, ticker);
39
39
  const otherEntry = useQuoteEntry(legs?.otherKey ?? null, null);
40
+ const quotes = legs
41
+ ? adrPairQuotes(legs, { own: resolveEntryData(ownEntry), other: resolveEntryData(otherEntry) }, financials?.quote)
42
+ : { receipt: null, home: null };
43
+ const receiptQuote = quotes.receipt;
44
+ const homeQuote = quotes.home;
40
45
  const [receiptEntry, homeEntry] = legs?.receiptSide ? [ownEntry, otherEntry] : [otherEntry, ownEntry];
41
- const receiptQuote = resolveEntryData(receiptEntry);
42
- const homeQuote = resolveEntryData(homeEntry);
43
46
  // The home price's currency, a minor unit read as its own (GBp as GBP), as the comparison reads it.
44
47
  const homeCurrency = homeQuote?.currency ? heldCurrencyUnit(homeQuote.currency).currency : "";
45
48
  const observed = useFxRateObservations([homeCurrency]).get(homeCurrency);
@@ -53,7 +56,8 @@ export function AdrPairResearchTab({ width, height, focused }: TickerResearchTab
53
56
 
54
57
  if (!legs) return <EmptyState title="No ADR pair for this listing." />;
55
58
  const pending = (entry: typeof receiptEntry) => !entry || entry.phase === "loading" || entry.phase === "idle";
56
- const loading = !comparison && (pending(receiptEntry) || pending(homeEntry));
59
+ // A leg with a quote is not waiting on its read.
60
+ const loading = !comparison && ((!receiptQuote && pending(receiptEntry)) || (!homeQuote && pending(homeEntry)));
57
61
  const error = !comparison && !loading
58
62
  ? `Prices unavailable for ${!receiptQuote ? legs.receiptKey : legs.homeKey}.`
59
63
  : null;
@@ -10,7 +10,6 @@ import {
10
10
  displayWidth,
11
11
  formatGrowthShort,
12
12
  formatNumber,
13
- formatWithDivisor,
14
13
  padTo,
15
14
  pickUnit,
16
15
  } from "../../../../utils/format";
@@ -283,7 +282,20 @@ function formatFinancialValue(
283
282
  if (value == null || !Number.isFinite(value)) return MISSING_VALUE;
284
283
  if (row.format === "eps") return formatPerShareNumber(value);
285
284
  if (row.format === "percent") return `${formatNumber(value * 100, 1)}%`;
286
- return formatWithDivisor(value, row.divisor);
285
+ return formatFinancialAmount(value, row.divisor);
286
+ }
287
+
288
+ /**
289
+ * An amount in the table's one unit, to about three significant figures: `23.73` and `1,265.6`, a line a
290
+ * thousandth of the others as `0.001` rather than `0.00`, so no row needs a unit of its own.
291
+ */
292
+ export function formatFinancialAmount(value: number, divisor: number): string {
293
+ const scaled = value / divisor;
294
+ const magnitude = Math.abs(scaled);
295
+ if (magnitude >= 100) return formatNumber(scaled, 1);
296
+ if (magnitude >= 1 || scaled === 0) return scaled.toFixed(2);
297
+ if (magnitude >= 0.001) return scaled.toFixed(3);
298
+ return Number(scaled.toPrecision(2)).toString();
287
299
  }
288
300
 
289
301
  /**
@@ -300,9 +312,11 @@ export function formatFinancialHeader(date: string, currency?: string, dateSourc
300
312
  }
301
313
 
302
314
  /**
303
- * A report column's header (`gloom fn FA`): `formatFinancialHeader`, with a
304
- * half in the quarterly list named as one (`H1 FY26 2026-06-30`, or
305
- * `6M 2026-06-30` off the fiscal calendar), and a column Gloom Cloud filled
315
+ * A report column's header (`gloom fn FA`): the fiscal period as the pane's
316
+ * column names it and the day it ends (`FY2026 2026-09-30 USD bn (SEC
317
+ * date)`, `TTM Q3 FY26 2026-09-30 USD`), with a half in the quarterly list
318
+ * named as one (`H1 FY26 2026-06-30`, or `6M 2026-06-30` off the fiscal
319
+ * calendar), and a column Gloom Cloud filled
306
320
  * from the company's results announcements dated by them alone (fillDate):
307
321
  * `(announced 2026-08-20)` for its own results, `(comparative in the
308
322
  * 2026-08-20 announcement)` for a later period's comparative column. `rows`
@@ -316,11 +330,17 @@ export function financialReportHeader(
316
330
  rows: readonly FinancialStatement[] = [],
317
331
  ): string {
318
332
  const { date, dateSource } = statement;
319
- if (date === "TTM") return formatFinancialHeader(date, currency, dateSource, false, statement.aggregation?.periodEnd).trim();
333
+ // The fiscal period as the pane names it (`FY2026`, `Q3 FY26`, `TTM Q3 FY26`), then the day it ends.
334
+ const named = (name: string, end: string) => (name.endsWith(end) ? name : `${name} ${end}`);
335
+ if (date === "TTM") {
336
+ const end = statement.aggregation?.periodEnd;
337
+ const period = end ? named(financialColumnLabel(statement, kind, yearEndMonth), end) : "TTM";
338
+ return currency ? `${period} ${currency}` : period;
339
+ }
320
340
  const end = date.slice(0, 10);
321
341
  const months = kind === "quarterly" ? statementPeriodMonths(statement) : undefined;
322
342
  const longer = months && months > 3 ? longerPeriodLabel(end, months, yearEndMonth) : null;
323
- const period = !longer ? end : longer.endsWith(end) ? longer : `${longer} ${end}`;
343
+ const period = named(longer ?? financialColumnLabel(statement, kind, yearEndMonth), end);
324
344
  const filled = statement.filledFrom?.source === "results" ? fillDate(statement, rows) : null;
325
345
  const source = filled ? fillDateText(filled) : dateSource === "sec" ? "SEC date" : "provider date";
326
346
  return `${currency ? `${period} ${currency}` : period} (${source})`;
@@ -501,9 +521,11 @@ function resolveMetricUnit(
501
521
  }
502
522
 
503
523
  /**
504
- * The money unit most rows share (`bn`), said once beside the currency. Rows
505
- * in that unit drop their `(bn)`, and money rows too small for any unit are
506
- * shown in it; rows in another unit, and share counts, keep theirs.
524
+ * The money unit of the whole table (`bn`), said once beside the currency:
525
+ * the unit most rows would take on their own. Every money row is shown in it,
526
+ * a smaller line to more decimals (formatFinancialAmount), so a column copied
527
+ * out of the table is in one unit and no row carries a `(mn)` of its own.
528
+ * Share counts are no money and keep theirs.
507
529
  */
508
530
  export function shareFinancialUnit<T extends { unitLabel: string; label: string; moneyUnit: string | null; divisor: number }>(
509
531
  rows: readonly T[],
@@ -513,11 +535,7 @@ export function shareFinancialUnit<T extends { unitLabel: string; label: string;
513
535
  const unit = [...counts].sort((left, right) => right[1] - left[1])[0]?.[0];
514
536
  if (!unit) return { rows: [...rows], unit: undefined };
515
537
  return {
516
- rows: rows.map((row) => {
517
- if (row.moneyUnit === unit) return { ...row, unitLabel: row.label };
518
- if (row.moneyUnit === "") return { ...row, unitLabel: row.label, moneyUnit: unit, divisor: UNIT_DIVISORS[unit]! };
519
- return row;
520
- }),
538
+ rows: rows.map((row) => row.moneyUnit == null ? row : { ...row, unitLabel: row.label, moneyUnit: unit, divisor: UNIT_DIVISORS[unit]! }),
521
539
  unit,
522
540
  };
523
541
  }
@@ -527,6 +545,8 @@ export function buildFinancialRows(
527
545
  statements: FinancialStatement[],
528
546
  collapsedGroups: ReadonlySet<string>,
529
547
  depth = 0,
548
+ /** The lines the table already shows, above this one: a line equal to one of them is left out. */
549
+ shown: Array<Pick<MetricDef, "key" | "compute" | "format">> = [],
530
550
  ): FinancialTableRow[] {
531
551
  const rows: FinancialTableRow[] = [];
532
552
 
@@ -534,6 +554,11 @@ export function buildFinancialRows(
534
554
  if (!hasFinancialRowValue(def, statements)) continue;
535
555
 
536
556
  if (!isFinancialGroup(def)) {
557
+ // The same amount under another name further down (CapEx, then Purchase PPE) is shown once, where it is
558
+ // reported in every period the line above is; a line that differs in any period stays.
559
+ if (shown.some((line) => line.format === (def.format ?? "compact") && (line.key !== def.key || line.compute !== def.compute)
560
+ && repeatsLine(def, line, statements))) continue;
561
+ shown.push({ key: def.key, compute: def.compute, format: def.format ?? "compact" });
537
562
  const { unitLabel, moneyUnit, divisor, format } = resolveMetricUnit(statements, def, def.label);
538
563
  rows.push({
539
564
  kind: "metric",
@@ -561,6 +586,7 @@ export function buildFinancialRows(
561
586
  ? resolveMetricUnit(statements, { key: def.summaryKey, format: def.format ?? "compact" }, def.label)
562
587
  : { unitLabel: def.label, moneyUnit: null, divisor: 1, format: def.format ?? "compact" };
563
588
 
589
+ if (def.summaryKey) shown.push({ key: def.summaryKey, format: def.format ?? "compact" });
564
590
  rows.push({
565
591
  kind: "group",
566
592
  id: def.id,
@@ -577,7 +603,7 @@ export function buildFinancialRows(
577
603
  });
578
604
 
579
605
  if (expanded) {
580
- rows.push(...buildFinancialRows(children, statements, collapsedGroups, depth + 1));
606
+ rows.push(...buildFinancialRows(children, statements, collapsedGroups, depth + 1, shown));
581
607
  }
582
608
  }
583
609
 
@@ -618,6 +644,12 @@ interface FinancialTableModelRow {
618
644
  summaryKey?: keyof FinancialStatement;
619
645
  label: string;
620
646
  unitLabel: string;
647
+ /** How the row's figures read: money or a share count (`compact`), per-share earnings, or a percent of a fraction. */
648
+ format: FinancialMetricFormat;
649
+ /** What a `compact` figure is divided by to read in the row's unit (1e9 for `bn`). */
650
+ divisor: number;
651
+ /** The money unit word the figures are in (`bn`); null for share counts, per-share figures and percents. */
652
+ moneyUnit: string | null;
621
653
  depth: number;
622
654
  growthDirection: FinancialGrowthDirection;
623
655
  cells: FinancialTableCellModel[];
@@ -783,6 +815,9 @@ export function buildFinancialTableModel(
783
815
  summaryKey: row.kind === "group" ? row.summaryKey : undefined,
784
816
  label: row.label,
785
817
  unitLabel: row.unitLabel,
818
+ format: row.format,
819
+ divisor: row.divisor,
820
+ moneyUnit: row.moneyUnit,
786
821
  depth: row.depth,
787
822
  growthDirection: row.growthDirection,
788
823
  cells,
@@ -0,0 +1,16 @@
1
+ import type { FinancialStatement } from "../../../../types/financials";
2
+
3
+ const finite = (value: unknown): number | undefined => (typeof value === "number" && Number.isFinite(value) ? value : undefined);
4
+
5
+ /**
6
+ * Operating income after tax at the period's effective rate (tax provision ÷ pretax income, held between 0% and
7
+ * 100%); a pretax loss pays no tax. Undefined when a line is missing. ROIC and the reinvestment rate read it.
8
+ */
9
+ export function statementNopat(statement: FinancialStatement): number | undefined {
10
+ const operating = finite(statement.operatingIncome);
11
+ const tax = finite(statement.taxProvision);
12
+ const pretax = finite(statement.pretaxIncome);
13
+ if (operating === undefined || tax === undefined || pretax === undefined) return undefined;
14
+ const rate = pretax > 0 ? Math.min(1, Math.max(0, tax / pretax)) : 0;
15
+ return operating * (1 - rate);
16
+ }