gloomberb 0.20.5 → 0.20.7

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 (185) hide show
  1. package/README.md +1 -1
  2. package/README.zh-CN.md +1 -1
  3. package/package.json +2 -1
  4. package/src/api-client/data.ts +10 -2
  5. package/src/api-client/fund-facts.ts +20 -4
  6. package/src/api-client/hk-tenders.ts +59 -0
  7. package/src/api-client/index.ts +1 -0
  8. package/src/api-client/socket.ts +4 -4
  9. package/src/api-client/types/econ.ts +20 -2
  10. package/src/app.tsx +18 -13
  11. package/src/architecture/floating-promise-allowlist.json +313 -0
  12. package/src/architecture/shortcut-labels-allowlist.json +1 -0
  13. package/src/cli/commands/market.ts +197 -57
  14. package/src/cli/commands/news-search.ts +22 -7
  15. package/src/cli/commands/overview.ts +12 -6
  16. package/src/cli/commands/search.ts +19 -3
  17. package/src/cli/commands/ticker.ts +3 -1
  18. package/src/cli/desktop-pane-shot.ts +61 -0
  19. package/src/cli/early-command.ts +2 -0
  20. package/src/cli/errors.ts +10 -1
  21. package/src/cli/fx-forward.ts +76 -12
  22. package/src/cli/fx-pair.ts +1 -1
  23. package/src/cli/fx-quote-rate.ts +23 -0
  24. package/src/cli/help.ts +1 -0
  25. package/src/cli/index-roots.ts +5 -4
  26. package/src/cli/index.ts +40 -3
  27. package/src/cli/known-gaps.ts +11 -8
  28. package/src/cli/listing-arg.ts +6 -4
  29. package/src/cli/options.ts +52 -3
  30. package/src/cli/output-file.ts +5 -3
  31. package/src/cli/pane-functions/catalog.ts +15 -0
  32. package/src/cli/pane-functions/dom.ts +4 -4
  33. package/src/cli/pane-functions/freshness.ts +38 -5
  34. package/src/cli/pane-functions/function-help.ts +4 -4
  35. package/src/cli/pane-functions/headless.ts +9 -4
  36. package/src/cli/pane-functions/index.ts +6 -4
  37. package/src/cli/pane-functions/resolver.ts +2 -2
  38. package/src/cli/pane-functions/screenshot-assessment.ts +16 -4
  39. package/src/cli/quote-answer.ts +57 -1
  40. package/src/cli/result.ts +38 -2
  41. package/src/cli/spreadsheet-hint.ts +7 -3
  42. package/src/cli/treasury-yields.ts +5 -3
  43. package/src/components/chart/composite/legend.tsx +40 -2
  44. package/src/components/command-bar/workflow/tickers.ts +2 -2
  45. package/src/components/data-table/view.tsx +9 -2
  46. package/src/components/ui/data-table/opentui/index.tsx +11 -4
  47. package/src/components/ui/data-table/opentui/model.ts +8 -6
  48. package/src/components/ui/data-table/types.ts +6 -1
  49. package/src/components/ui/table-layout.ts +38 -1
  50. package/src/docs/snapshot.json +58 -19
  51. package/src/i18n/es.ts +2 -0
  52. package/src/i18n/ja.ts +2 -0
  53. package/src/i18n/ko.ts +2 -0
  54. package/src/i18n/zh-cn.ts +2 -0
  55. package/src/i18n/zh-tw.ts +2 -0
  56. package/src/market-data/market/change-basis.ts +57 -12
  57. package/src/market-data/market/dated-previous-close.ts +184 -10
  58. package/src/market-data/market/freshness.ts +18 -6
  59. package/src/market-data/market/status.ts +9 -1
  60. package/src/market-data/published-nse-sessions.ts +16 -1
  61. package/src/market-data/quotes/contributions.ts +2 -0
  62. package/src/market-data/quotes/freshness.ts +15 -0
  63. package/src/market-data/quotes/listing-enterprise-value.ts +50 -0
  64. package/src/plugins/builtin/alerts/alert-engine.ts +15 -0
  65. package/src/plugins/builtin/alerts/cli.ts +22 -9
  66. package/src/plugins/builtin/alerts/headless.ts +1 -1
  67. package/src/plugins/builtin/alerts/index.tsx +5 -1
  68. package/src/plugins/builtin/alerts/metric-command.ts +1 -1
  69. package/src/plugins/builtin/alerts/metric-data.ts +15 -2
  70. package/src/plugins/builtin/backtest/headless.ts +1 -1
  71. package/src/plugins/builtin/cds/model.ts +0 -6
  72. package/src/plugins/builtin/chart-composer/formula.ts +16 -3
  73. package/src/plugins/builtin/chart-composer/headless-schema.ts +2 -0
  74. package/src/plugins/builtin/chart-composer/headless.ts +2 -1
  75. package/src/plugins/builtin/chart-composer/presets.ts +1 -0
  76. package/src/plugins/builtin/cloud/askg/pane.tsx +55 -13
  77. package/src/plugins/builtin/credit-boards/cdx-pane.tsx +20 -7
  78. package/src/plugins/builtin/credit-boards/client.ts +8 -0
  79. package/src/plugins/builtin/credit-boards/headless.ts +4 -1
  80. package/src/plugins/builtin/credit-boards/model.ts +58 -4
  81. package/src/plugins/builtin/credit-boards/series.ts +63 -6
  82. package/src/plugins/builtin/credit-boards/sovr-pane.tsx +3 -2
  83. package/src/plugins/builtin/credit-conditions/headless.ts +24 -6
  84. package/src/plugins/builtin/credit-conditions/index.tsx +1 -1
  85. package/src/plugins/builtin/credit-conditions/model.ts +12 -6
  86. package/src/plugins/builtin/credit-conditions/series.ts +2 -1
  87. package/src/plugins/builtin/econ/calendar-model.ts +41 -7
  88. package/src/plugins/builtin/econ/calendar-source.ts +7 -1
  89. package/src/plugins/builtin/econ/index.tsx +41 -8
  90. package/src/plugins/builtin/econ/types.ts +3 -0
  91. package/src/plugins/builtin/fixed-income/index.tsx +2 -0
  92. package/src/plugins/builtin/fx-matrix/index.tsx +44 -14
  93. package/src/plugins/builtin/help/keybindings-editor.tsx +6 -2
  94. package/src/plugins/builtin/holders/fund-holders.ts +22 -1
  95. package/src/plugins/builtin/holders/headless.ts +5 -4
  96. package/src/plugins/builtin/holders/pane.tsx +7 -3
  97. package/src/plugins/builtin/holders/report-header.ts +23 -0
  98. package/src/plugins/builtin/members/client.ts +1 -1
  99. package/src/plugins/builtin/members/headless.ts +2 -0
  100. package/src/plugins/builtin/members/model.ts +10 -8
  101. package/src/plugins/builtin/members/pane.tsx +4 -1
  102. package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +5 -2
  103. package/src/plugins/builtin/portfolio-list/cli/render.ts +86 -26
  104. package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +5 -1
  105. package/src/plugins/builtin/portfolio-list/headless.ts +2 -1
  106. package/src/plugins/builtin/portfolio-list/income.ts +46 -22
  107. package/src/plugins/builtin/portfolio-list/pane/data.ts +16 -6
  108. package/src/plugins/builtin/portfolio-list/pane/index.tsx +5 -4
  109. package/src/plugins/builtin/portfolio-list/use-throttled-ticker-order.ts +40 -3
  110. package/src/plugins/builtin/research/headless-schema.ts +4 -3
  111. package/src/plugins/builtin/research/relative-valuation-columns.ts +145 -47
  112. package/src/plugins/builtin/research/relative-valuation-currency.ts +31 -0
  113. package/src/plugins/builtin/research/relative-valuation-headless.ts +25 -8
  114. package/src/plugins/builtin/research/relative-valuation-model.ts +40 -9
  115. package/src/plugins/builtin/research/relative-valuation-pane.tsx +3 -2
  116. package/src/plugins/builtin/research/relative-valuation-peers.ts +2 -2
  117. package/src/plugins/builtin/sec/fund-facts.ts +25 -5
  118. package/src/plugins/builtin/shared/report-freshness.ts +15 -6
  119. package/src/plugins/builtin/supply-chain/model.ts +18 -6
  120. package/src/plugins/builtin/thirteenf/api.ts +47 -4
  121. package/src/plugins/builtin/ticker-detail/data-panes/historical-prices.tsx +8 -7
  122. package/src/plugins/builtin/ticker-detail/data-panes/history-bars.ts +8 -5
  123. package/src/plugins/builtin/ticker-detail/financials/model.ts +6 -2
  124. package/src/plugins/builtin/ticker-detail/financials/tab.tsx +1 -1
  125. package/src/plugins/builtin/ticker-detail/headless.ts +6 -4
  126. package/src/plugins/builtin/treasury-auctions/cache.ts +36 -2
  127. package/src/plugins/builtin/treasury-auctions/headless.ts +42 -4
  128. package/src/plugins/builtin/treasury-auctions/hk-headless.ts +126 -0
  129. package/src/plugins/builtin/treasury-auctions/hk-view.tsx +347 -0
  130. package/src/plugins/builtin/treasury-auctions/hk.ts +363 -0
  131. package/src/plugins/builtin/treasury-auctions/index.tsx +14 -1
  132. package/src/plugins/builtin/treasury-auctions/model.ts +16 -8
  133. package/src/plugins/builtin/treasury-auctions/pane.tsx +45 -21
  134. package/src/portfolio/collection-name.ts +22 -0
  135. package/src/portfolio/column-values.ts +3 -0
  136. package/src/portfolio/valuation-basis.ts +23 -1
  137. package/src/renderers/dom/data-table/frozen-column.ts +3 -1
  138. package/src/renderers/dom/data-table/index.tsx +27 -9
  139. package/src/renderers/dom/data-table/row.tsx +2 -0
  140. package/src/renderers/electrobun/bun/desktop/backend.ts +27 -24
  141. package/src/renderers/electrobun/bun/desktop/detached-windows.ts +3 -3
  142. package/src/renderers/electrobun/bun/desktop/snapshot-commit.ts +77 -0
  143. package/src/renderers/electrobun/shared/protocol.ts +4 -0
  144. package/src/renderers/electrobun/view/backend-rpc.ts +3 -0
  145. package/src/renderers/electrobun/view/desktop/window/bridge.ts +3 -0
  146. package/src/sources/gloomberb-cloud/normalizers.ts +9 -5
  147. package/src/sources/provider-router/cache.ts +3 -1
  148. package/src/state/hooks/quote-streaming.ts +14 -6
  149. package/src/sync/controller.ts +17 -2
  150. package/src/sync/other-window-tabs.ts +32 -1
  151. package/src/sync/react.ts +4 -4
  152. package/src/tickers/instrument-kind.ts +22 -1
  153. package/src/tickers/search/index.ts +5 -0
  154. package/src/tickers/terminal-codes.ts +17 -5
  155. package/src/time-series/bar-spacing.ts +33 -0
  156. package/src/time-series/base-series.ts +21 -3
  157. package/src/time-series/chart-bounds.ts +31 -0
  158. package/src/time-series/field-catalog.ts +17 -0
  159. package/src/time-series/fundamentals/current-valuation.ts +244 -0
  160. package/src/time-series/fundamentals/historical-valuation.ts +99 -0
  161. package/src/time-series/fundamentals/metric-ids.ts +61 -0
  162. package/src/time-series/fundamentals/period-points.ts +104 -0
  163. package/src/time-series/fundamentals/quarterly-ttm.ts +220 -0
  164. package/src/time-series/fundamentals/series.ts +164 -0
  165. package/src/time-series/fundamentals/source-statements.ts +177 -0
  166. package/src/time-series/fundamentals/statement-fields.ts +154 -0
  167. package/src/time-series/fundamentals/statement-merge.ts +124 -0
  168. package/src/time-series/fundamentals/statement.ts +114 -0
  169. package/src/time-series/fundamentals/valuation-multiples.ts +50 -0
  170. package/src/time-series/fundamentals.ts +18 -1275
  171. package/src/time-series/ice-credit.ts +32 -6
  172. package/src/time-series/resolve.ts +9 -5
  173. package/src/time-series/session-bar.ts +78 -9
  174. package/src/time-series/studies/formula.ts +53 -10
  175. package/src/time-series/studies/pair.ts +18 -7
  176. package/src/time-series/studies/units.ts +49 -2
  177. package/src/time-series/types.ts +12 -0
  178. package/src/types/desktop-window.ts +2 -0
  179. package/src/types/financials.ts +15 -0
  180. package/src/types/headless.ts +8 -0
  181. package/src/utils/cli-output.ts +6 -3
  182. package/src/utils/debug-log.ts +29 -0
  183. package/src/utils/ebitda.ts +128 -0
  184. package/src/utils/format.ts +1 -1
  185. package/src/utils/shell-word.ts +13 -0
@@ -2,7 +2,7 @@ import { logFailure } from "../../utils/log-failure";
2
2
  import { normalizeTickerSymbol } from "../../tickers/search/ranking";
3
3
  import type { CliCommandDef } from "../../types/plugin";
4
4
  import { TIME_RANGES, type TimeRange } from "../../time-series/range";
5
- import { CHART_RESOLUTION_STEP_MS } from "../../time-series/resolution";
5
+ import { CHART_RESOLUTION_STEP_MS, RANGE_HISTORY_RESOLUTION } from "../../time-series/resolution";
6
6
  import { yearToDateStartIndex } from "../../market-data/market/year-to-date";
7
7
  import type { EarningsEvent, MarketDataRequestContext, QuoteBatchResult, QuoteSubscriptionTarget, SecFilingItem } from "../../types/data-provider";
8
8
  import { companyDataNotes, type CompanyFrom } from "../../types/company-from";
@@ -60,7 +60,7 @@ import {
60
60
  ratingReason,
61
61
  } from "../../plugins/builtin/research/analyst-model";
62
62
  import { getPublishedUsEquityCalendarYears, getPublishedUsEquitySession } from "../../market-data/published-us-sessions";
63
- import { awaitingFirstDelayedPrint, isQuoteStaleForCurrentSession, noPrintsTodayText } from "../../market-data/quotes/freshness";
63
+ import { awaitingFirstDelayedPrint, isQuoteStaleForCurrentSession, noPrintsTodayText, nominalPriceText } from "../../market-data/quotes/freshness";
64
64
  import {
65
65
  coinOptionsAlternativesText, isCoinWithoutOptions, isOptionsUnavailableError, listedOptionsAlternative, optionsUnavailableTitle,
66
66
  } from "../../market-data/options-alternatives";
@@ -74,6 +74,7 @@ import { loadBankFigures } from "../bank-section";
74
74
  import { latestFinancialPeriod } from "../../utils/latest-financial-period";
75
75
  import type { FuturesContractTermsPayload } from "../../api-client/futures-curve";
76
76
  import { currencyCodeLabel } from "../../utils/currency-units";
77
+ import { fxRateDigits, quotedFxPair } from "../../utils/currency-pair";
77
78
  import {
78
79
  futuresContractLines, futuresPricePer, futuresRollLines, futuresTickOption, isFuturesInstrument, loadFuturesPriceUnit, loadUsdPerMmbtu, usdPerMmbtuText, type UsdPerMmbtu,
79
80
  } from "../../market-data/futures-contract";
@@ -134,7 +135,7 @@ import {
134
135
  fxInterventionLatestNote, fxInterventionPair, fxInterventionWindowNote, loadFxInterventions, type FxInterventionPair,
135
136
  } from "../../market-data/fx-interventions";
136
137
  import { maxDrawdownText, maxRunUp, maxRunUpText } from "../../utils/max-drawdown";
137
- import { isPastPriceWindow, loadPriceWindowHistory, PRICE_WINDOW_FROM_HELP, PRICE_WINDOW_TO_HELP, priceWindowText, readPriceWindow, type PriceWindow } from "../../utils/price-window";
138
+ import { isPastPriceWindow, loadPriceWindowHistory, PRICE_WINDOW_FROM_HELP, PRICE_WINDOW_TO_HELP, priceWindowInterval, priceWindowText, readPriceWindow, type PriceWindow } from "../../utils/price-window";
138
139
  import {
139
140
  BAR_INTERVAL_LABELS,
140
141
  closedPeriodBarDay,
@@ -214,12 +215,13 @@ import {
214
215
  } from "./news-search";
215
216
  import { displayTimeZone, formatUtcDayTime, formatUtcTime } from "../../utils/utc-time";
216
217
  import { localReportTiming } from "../../utils/report-timing";
217
- import { DAY_SO_FAR_TEXT, withSessionBar } from "../../time-series/session-bar";
218
+ import { DAY_SO_FAR_TEXT, dailyOrLongerBarSize, withSessionBar } from "../../time-series/session-bar";
219
+ import { requestedBarSize } from "../../time-series/bar-spacing";
218
220
  import { isFiniteNumber } from "../../utils/guards";
219
221
  import { exportedFundamentals } from "../../utils/price-earnings";
220
222
  import { withBankEnterpriseValue } from "../../utils/fundamentals";
221
223
  import { fundamentalsFreshness, quotesFreshness, rowsFreshness, valuationFreshness } from "../freshness";
222
- import { fxPairListing, fxQuoteRateObservation, METAL_NAMES, readFxQuoteRate } from "../fx-quote-rate";
224
+ import { fxPairListing, fxQuoteRateMove, fxQuoteRateObservation, METAL_NAMES, readFxQuoteRate } from "../fx-quote-rate";
223
225
  import { quoteBarNotes } from "../../market-data/quotes/intraday-bar";
224
226
  import { cedearRatioText, depositaryPairText, isReceiptSide, listingCedearRatio, listingDepositaryPair } from "../../market-data/depositary-pair";
225
227
  import { isPesoDollarPair, loadPesoDollarRates, pesoDollarRateLines, pesoDollarRatesJson } from "../peso-dollar-rates";
@@ -302,7 +304,8 @@ import { knownGapMessage, subMinuteDataMessage } from "../known-gaps";
302
304
  import { phraseSearchReport } from "./search";
303
305
  import { secRegistrantMismatchMessage, SecRegistrantMismatchError, areDifferentCompanies } from "../../sources/sec-registrant";
304
306
  import { isCryptoPairSymbol, isRoundTheClockCoin } from "../../utils/crypto-pair";
305
- import { isUsListingExchange } from "../../utils/exchanges";
307
+ import { canonicalExchange, isUsListingExchange } from "../../utils/exchanges";
308
+ import { listingSuffixVenue } from "../../sources/listing-symbols";
306
309
  import { resolveTickerInstrumentKind } from "../../tickers/instrument-kind";
307
310
  import {
308
311
  describeFormerIssuer, describeTickerChange, movedAwayChange, startTickerChangeLookup, tickerChangeLine, type FormerIssuer, type TickerChange,
@@ -311,9 +314,11 @@ import { noSecReportsNotice, nonUsSecListingVenue, secFilingItemCodes } from "..
311
314
  import type { MarketContext } from "../types";
312
315
  import { windowRows } from "../row-window";
313
316
  import { answerQuote, errorMessage, notUsTickerSentence } from "../quote-answer";
314
- import { crossRate, describeFxConversion, describeFxLegs, describeFxRate, formatFxRate, FX_USAGE, parseFxArgs, type FxQuotedFigure } from "../fx-pair";
317
+ import { crossRate, describeFxConversion, describeFxLegs, describeFxRate, formatFxAmount, formatFxRate, FX_USAGE, parseFxArgs, type FxQuotedFigure } from "../fx-pair";
315
318
  import {
319
+ describeCarrySides,
316
320
  describeShortRate,
321
+ forwardCarry,
317
322
  shortRateGrowthText,
318
323
  formatForwardPoints,
319
324
  formatSignedPercent,
@@ -328,7 +333,7 @@ import { unavailableOnServer } from "../../plugins/builtin/shared/cloud-resource
328
333
  const utcClock = (time: number) => new Date(time).toISOString().slice(11, 16);
329
334
 
330
335
  /** `fx`'s forward form, for its usage line. */
331
- const FX_FORWARD_USAGE = "fx <base>/<quote> --forward <tenor>";
336
+ const FX_FORWARD_USAGE = "fx [amount] <base>/<quote> --forward <tenor>";
332
337
  import {
333
338
  holderListFacts,
334
339
  holderListPeriod,
@@ -349,7 +354,7 @@ import {
349
354
  unvaluedHoldersNote,
350
355
  } from "../../plugins/builtin/holders/report-rows";
351
356
  import { fetchBeneficialOwners } from "../../plugins/builtin/holders/beneficial-client";
352
- import { fundHoldersAnswer } from "../../plugins/builtin/holders/fund-holders";
357
+ import { noHoldersAnswer } from "../../plugins/builtin/holders/fund-holders";
353
358
  import { centralBankEventsMessage } from "../central-bank-events";
354
359
  import { classSharesAsOf, classSharesToday } from "../../plugins/builtin/holders/client";
355
360
  import {
@@ -413,15 +418,20 @@ type FinancialsCliData = TickerFinancials & {
413
418
  providerId: string | null;
414
419
  };
415
420
 
421
+ /** The ranges as other tools spell them, which `--range` reads too: a week of sessions is 5d. */
422
+ const HISTORY_RANGE_ALIASES = "5d, 1mo, 3mo, 6mo, 1y, 5y and max";
423
+
416
424
  /**
417
425
  * A range as typed, in any case and as other tools spell it: `1mo`, `1m` and
418
- * `1 month` are 1M, `1wk` 1W, `5yr` 5Y, `max` ALL.
426
+ * `1 month` are 1M, `1wk` and `5d` (a week's five sessions) 1W, `5yr` 5Y,
427
+ * `max` ALL.
419
428
  */
420
429
  export function readHistoryRange(value: string): HistoryRange | null {
421
430
  const typed = value.trim().toUpperCase().replace(/\s+/g, "");
422
431
  if (typed === "MAX") return "ALL";
423
432
  const spelled = /^(\d+)(D|DAYS?|W|WKS?|WEEKS?|M|MOS?|MONTHS?|Y|YRS?|YEARS?)$/.exec(typed);
424
433
  const range = (spelled ? `${spelled[1]}${spelled[2]![0]}` : typed) as HistoryRange;
434
+ if (range === "5D" as HistoryRange || range === "7D" as HistoryRange) return "1W";
425
435
  return VALID_RANGES.has(range) ? range : null;
426
436
  }
427
437
 
@@ -437,7 +447,7 @@ function rangeTypedAsSymbol(entry: string): HistoryRange | null {
437
447
 
438
448
  function parseRange(value: string | undefined, ctx: Parameters<CliCommandDef["execute"]>[1]): HistoryRange {
439
449
  const range = readHistoryRange(value ?? "1Y");
440
- if (!range) ctx.fail(`Unknown range "${value}".`, `Use one of ${HISTORY_RANGES.join(", ")}.`);
450
+ if (!range) ctx.fail(`Unknown range "${value}".`, `Use one of ${HISTORY_RANGES.join(", ")}, or ${HISTORY_RANGE_ALIASES}.`);
441
451
  return range!;
442
452
  }
443
453
 
@@ -688,14 +698,14 @@ function quoteColumns() {
688
698
  return [
689
699
  ...QUOTE_LEAD_COLUMNS.map((column) => EXTENDED_KEYS.has(column.key) ? { ...column, stackPriority: 1 } : column),
690
700
  { key: "currency", header: "Cur", shrink: false, stackPriority: 3, format: currencyCell },
691
- // Whether the price is real-time, delayed or stale: a feed state, not where it came from. A stale
692
- // row says so here, so the closing line's "N of M stale" always points at rows the table marks.
701
+ // Whether the price is real-time, delayed, stale or nominal: a feed state, not where it came from. A stale or
702
+ // nominal row says so here, so the closing line's "N of M stale" or "N of M nominal" always points at rows the table marks.
693
703
  {
694
704
  key: "feed",
695
705
  header: "Feed",
696
706
  shrink: false,
697
707
  stackPriority: 4,
698
- format: (value: unknown) => value === "stale" ? cliStyles.warning(value) : String(value ?? ""),
708
+ format: (value: unknown) => value === "stale" || value === "nominal" ? cliStyles.warning(value) : String(value ?? ""),
699
709
  },
700
710
  { key: "updatedAt", header: "Updated", shrink: false, stackPriority: 5 },
701
711
  ...CHANGE_BASIS_EXPORT_COLUMNS,
@@ -725,24 +735,28 @@ function compareColumns() {
725
735
  value: (row: QuoteRow) => exportFigure(row.rawPreviousClose),
726
736
  format: (_value: unknown, row: QuoteRow) => yieldLevelCell(row.previousClose, row),
727
737
  },
728
- // A narrow terminal drops these before it cuts the names short.
738
+ // A narrow terminal moves these under their row, as the quote table does, before it cuts the names short.
729
739
  // An export writes the range as plain numbers (12.5-13.1), and each end as a number in Day Low and Day High.
730
740
  {
731
- key: "dayRange", header: "Day Range", align: "right" as const, optional: true, dropPriority: 1,
741
+ key: "dayRange", header: "Day Range", align: "right" as const, stackPriority: 1,
732
742
  value: (row: QuoteRow) => row.rawDayLow != null && row.rawDayHigh != null ? `${exportFigure(row.rawDayLow)}-${exportFigure(row.rawDayHigh)}` : "",
733
743
  format: (_value: unknown, row: QuoteRow) => row.dayRange,
734
744
  },
735
- { key: "volume", header: "Volume", align: "right" as const, format: formatCountCell, optional: true, dropPriority: 2 },
736
- { key: "currency", header: "Cur", shrink: false, optional: true, dropPriority: 3, format: currencyCell },
745
+ { key: "volume", header: "Volume", align: "right" as const, format: formatCountCell, stackPriority: 2 },
746
+ { key: "currency", header: "Cur", shrink: false, stackPriority: 3, format: currencyCell },
737
747
  ...CHANGE_BASIS_EXPORT_COLUMNS,
738
748
  ...EXTENDED_CHANGE_EXPORT_COLUMNS,
739
749
  ...DAY_RANGE_EXPORT_COLUMNS,
740
750
  ];
741
751
  }
742
752
 
743
- /** What the Feed cell says: stale wins over the feed's own live or delayed, as the closing line counts it. */
744
- function quoteFeedState(quote: QuoteCliRecord["quote"], now: number): "stale" | "live" | "delayed" | "" {
753
+ /**
754
+ * What the Feed cell says: nominal for a price nothing traded at (Quote.nominalPrice), then stale, over the feed's
755
+ * own live or delayed, as the closing line counts them.
756
+ */
757
+ function quoteFeedState(quote: QuoteCliRecord["quote"], now: number): "nominal" | "stale" | "live" | "delayed" | "" {
745
758
  if (!quote) return "";
759
+ if (quote.nominalPrice) return "nominal";
746
760
  if (isQuoteStaleForCurrentSession(quote, now)) return "stale";
747
761
  return quote.dataSource === "live" || quote.dataSource === "delayed" ? quote.dataSource : "";
748
762
  }
@@ -781,6 +795,16 @@ function quoteSessionFields(quote: Quote | null | undefined) {
781
795
  return quote?.changeBasis === "none" ? { ...fields, change: null, changePercent: null } : fields;
782
796
  }
783
797
 
798
+ /**
799
+ * The listing a row names: a vendor's suffixed symbol as the listing its
800
+ * quote confirms (2330.TW as 2330:TWSE), as RV, the portfolios and the panes
801
+ * name it; any other as asked.
802
+ */
803
+ function quoteRowSymbol(result: Pick<QuoteCliRecord, "target" | "quote">): string {
804
+ const venue = listingSuffixVenue(result.target.symbol, canonicalExchange(result.quote?.listingExchangeName || result.quote?.exchangeName) || undefined);
805
+ return venue ? `${venue.symbol}:${venue.exchange}` : result.target.symbol;
806
+ }
807
+
784
808
  function quoteRows(results: QuoteCliRecord[], now = Date.now()) {
785
809
  return results.map((result) => {
786
810
  const quote = result.quote;
@@ -816,7 +840,7 @@ function quoteRows(results: QuoteCliRecord[], now = Date.now()) {
816
840
  const previousClose = display.price != null && display.change != null ? display.price - display.change : quote?.previousClose;
817
841
  const last = price(display.price);
818
842
  return {
819
- symbol: result.target.symbol,
843
+ symbol: quoteRowSymbol(result),
820
844
  name: quote?.name || result.listing?.name || "",
821
845
  price: `${last}${per}`,
822
846
  pence: penceFigure(display.price, quote, /\.(\d+)/.exec(last)?.[1]?.length ?? 0),
@@ -1230,7 +1254,7 @@ async function runQuote(rawArgs: string[], ctx: Parameters<CliCommandDef["execut
1230
1254
  const ended = stopped && liveCompanies[index] ? `${stopped}. ${liveCompanies[index]}` : stopped;
1231
1255
  // Open by its venue's calendar, before the delayed feed's first print: Last is the previous close until then.
1232
1256
  const awaiting = ended ? null : awaitingFirstDelayedPrint(row.quote, now);
1233
- const quiet = ended || awaiting ? null : noPrintsTodayText(row.quote, now);
1257
+ const quiet = ended || awaiting ? null : nominalPriceText(row.quote) ?? noPrintsTodayText(row.quote, now);
1234
1258
  const waiting = awaiting && row.quote
1235
1259
  ? `${label}: open since ${utcClock(awaiting.open)} UTC; Last is the previous close until the first delayed print, about ${utcClock(awaiting.expected)} UTC`
1236
1260
  : null;
@@ -1263,12 +1287,18 @@ async function runQuote(rawArgs: string[], ctx: Parameters<CliCommandDef["execut
1263
1287
  const columns = [...commandName === "compare" ? compareColumns() : quoteColumns(), ...holdsYield ? [CHANGE_BP_EXPORT_COLUMN] : []];
1264
1288
  const basisNotes = changeBasisNotes(data, now);
1265
1289
  const midNotes = extendedMidNotes(data);
1290
+ // Another listing a row's code names (00700 on TWSE is 700.HK on HKEX) is said under the table, not as a warning on the row.
1291
+ const listingNotes = answers.flatMap((answer) => answer.footnotes ?? []);
1292
+ const exportNotes = [...midNotes, ...listingNotes];
1293
+ const footnotes = [...basisNotes, ...listingNotes];
1294
+ // JSON has no table to put them under: they stay with its warnings.
1295
+ const warnings = [...notes, ...ctx.cliOptions.format === "json" ? listingNotes : []];
1266
1296
  if (ctx.cliOptions.format !== "json") await primeBoardCoins(notes);
1267
1297
  // Only yield indices: their change is in bp, so the text header drops the percent sign (CSV keeps the percent it holds).
1268
1298
  const yieldsOnly = data.length > 0 && data.every((row) => isYieldIndexSymbol(row.target.symbol));
1269
1299
  ctx.printResult({
1270
1300
  data,
1271
- warnings: notes.length > 0 ? notes : undefined,
1301
+ warnings: warnings.length > 0 ? warnings : undefined,
1272
1302
  // A Cboe yield index stops at its 15:00 ET close, before the Treasury's curve is taken: the line says so, so its
1273
1303
  // close does not read as a contradiction of DGS10 or GC for the same day.
1274
1304
  // Dated by the quotes as served, which say whether one is the saved copy.
@@ -1290,9 +1320,9 @@ async function runQuote(rawArgs: string[], ctx: Parameters<CliCommandDef["execut
1290
1320
  }),
1291
1321
  // A row with no price or move says why in its status column, as the warnings do.
1292
1322
  exportStatus: quoteExportStatus,
1293
- ...(midNotes.length > 0 ? { exportNotes: midNotes } : {}),
1323
+ ...(exportNotes.length > 0 ? { exportNotes } : {}),
1294
1324
  details: quoteDetailsText,
1295
- ...(basisNotes.length ? { footnote: basisNotes.join("\n") } : {}),
1325
+ ...(footnotes.length ? { footnote: footnotes.join("\n") } : {}),
1296
1326
  columns,
1297
1327
  textColumns: quoteTextColumns(yieldsOnly
1298
1328
  ? columns.map((column) => column.key === "changePercent" ? { ...column, header: "Chg" } : column)
@@ -1624,11 +1654,16 @@ async function loadListingHistory(
1624
1654
  const loaded = quote || window ? answered : await stoppedUsListingHistory(listing, market, loadRange, context, answered);
1625
1655
  // With no quote and no bar in over a month, when the listing last traded is said first.
1626
1656
  const lastTraded = quote || window ? null : noQuoteLastTraded(loaded);
1627
- const { resolution } = loaded;
1657
+ // The size the bars were served in, else the one asked for, never their spacing alone: B95 on SGX trades a few
1658
+ // times a month, and its daily bars a week or two apart are still daily (requestedBarSize).
1659
+ const asked = window ? priceWindowInterval(window) : RANGE_HISTORY_RESOLUTION[loadRange];
1660
+ const resolution = loaded.resolution ?? (dailyOrLongerBarSize(asked).barSize
1661
+ ? requestedBarSize(loaded.points.map((point) => new Date(point.date).getTime()), asked as "1d" | "1wk" | "1mo") : null);
1628
1662
  // While the session trades the day's bar is the quote's, whatever range the history was cut for (withSessionBar).
1629
1663
  // A window that ended before today has no session in progress.
1630
1664
  const points = window && isPastPriceWindow(window) ? loaded.points
1631
- : withSessionBar(loaded.points, quote, { now: Date.now(), venue: quote?.listingExchangeName || exchange || undefined });
1665
+ : withSessionBar(loaded.points, quote, { now: Date.now(), venue: quote?.listingExchangeName || exchange || undefined,
1666
+ ...dailyOrLongerBarSize(resolution) });
1632
1667
  const fromQuote = points !== loaded.points;
1633
1668
  const identity = listingIdentity(listing, quote);
1634
1669
  // Without a quote currency, the listing metadata research reads (as `ticker` does) may still state it.
@@ -1682,7 +1717,8 @@ async function loadListingHistory(
1682
1717
  ...(volumeNote ? { note: volumeNote } : {}),
1683
1718
  }) : rowsFreshness(data, {
1684
1719
  ...source,
1685
- ...barHistoryFreshness(intraday ? null : barResolutionFromDates(data.map((row) => row.date))),
1720
+ // The size the heading names (served, else asked for), not the spacing a thin listing's few trades leave.
1721
+ ...barHistoryFreshness(intraday ? null : interval ?? barResolutionFromDates(data.map((row) => row.date))),
1686
1722
  observedKey: "date",
1687
1723
  oldest: null,
1688
1724
  cadenceExchange: venue,
@@ -2716,11 +2752,13 @@ async function runNews(rawArgs: string[], ctx: Parameters<CliCommandDef["execute
2716
2752
  const empty = emptyMessage(false);
2717
2753
  // A bare coin ticker read as another listing (ETH, the Grayscale fund) says where the coin is, as `quote` does.
2718
2754
  const read = listing ? [...listingReadNotes(listing), ...coinListingNotes(listing, quote)] : [];
2719
- // A word that is also the company's name ("gold" for Gold.com Inc.) says once which ticker it found and how
2720
- // to search the stories that mention it instead, when those stories are mostly about something else.
2755
+ // A word that is also the company's name ("gold" for Gold.com Inc., "peso" for PesoRama on the TSX Venture)
2756
+ // says once which ticker it found and how to search the stories that mention it instead, when those stories
2757
+ // are mostly about something else. The word is bare, so a listing abroad is one the lookup found, not one typed.
2721
2758
  const typed = args[0]?.trim() ?? "";
2722
- const wordHint = listing && resolved && !listing.exchange && !feed && !exchangeOption && commonWordCandidate(typed, identity?.name)
2723
- && wordMeansMore(await searchNewsStories(typed, 20).catch(logFailure("cli.commands-market", "Search news stories for a ticker word failed", [])), listing.symbol)
2759
+ const wordHint = listing && resolved && !feed && !exchangeOption && commonWordCandidate(typed, identity?.name)
2760
+ && wordMeansMore(await searchNewsStories(typed, 20).catch(logFailure("cli.commands-market", "Search news stories for a ticker word failed", [])), listing.symbol,
2761
+ listing.exchange ? `${listing.symbol}:${listing.exchange}` : listing.symbol)
2724
2762
  ? `${typed} ${cliArrow("→")} ${identity?.name ?? listing.symbol} (ticker ${listing.symbol}). For stories that mention ${typed.toLowerCase()}, try: ${quotedSearchCommand(typed.toLowerCase())}`
2725
2763
  : null;
2726
2764
  ctx.printResult({
@@ -3123,9 +3161,10 @@ async function runHolders(
3123
3161
  (found) => found.holders.length === 0,
3124
3162
  { command: commandName, noun: "holder data" },
3125
3163
  ).catch(async (error: unknown) => {
3126
- // A fund has no ownership breakdown: say so, and what reads it, rather than the source's NO_DATA.
3127
- const fund = await fundHoldersAnswer(listing.symbol, error, await quoted, apiClient);
3128
- if (fund) fail(fund.message, fund.details.join("\n") || undefined, NO_DATA_CODE);
3164
+ // A fund has no ownership breakdown, and a listing may have no holders on record: say so
3165
+ // (and what reads a fund) rather than the source's NO_DATA.
3166
+ const none = await noHoldersAnswer(listing.key, listing.request.exchange, error, await quoted, apiClient);
3167
+ if (none) fail(none.message, none.details.join("\n") || undefined, NO_DATA_CODE);
3129
3168
  throw error;
3130
3169
  }),
3131
3170
  quoted,
@@ -3577,7 +3616,17 @@ async function runOptions(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
3577
3616
  /** What an options chain export's `interval` says: one quote snapshot, not bars. */
3578
3617
  const OPTIONS_EXPORT_INTERVAL = "snapshot";
3579
3618
 
3580
- /** `fx --date`: a past day as YYYY-MM-DD; today's close is not in yet, so it is refused, as is a day ahead. */
3619
+ /** Saturday or Sunday, for a YYYY-MM-DD day. */
3620
+ function isWeekendDay(date: string): boolean {
3621
+ const day = new Date(`${date}T00:00:00Z`).getUTCDay();
3622
+ return day === 0 || day === 6;
3623
+ }
3624
+
3625
+ /**
3626
+ * `fx --date`: a past day as YYYY-MM-DD, or today on a weekend, which reads the
3627
+ * Friday close; a weekday's close is not in yet, so today is refused then, as
3628
+ * is a day ahead.
3629
+ */
3581
3630
  function readFxDate(value: string, ctx: Parameters<CliCommandDef["execute"]>[1]): string {
3582
3631
  let date: string;
3583
3632
  try {
@@ -3587,8 +3636,9 @@ function readFxDate(value: string, ctx: Parameters<CliCommandDef["execute"]>[1])
3587
3636
  }
3588
3637
  if (!date) return ctx.fail("--date takes a day, such as --date 2026-09-02.");
3589
3638
  const today = isoDateToday();
3590
- if (date >= today) {
3591
- return ctx.fail(`${date} has no daily close yet: --date takes a day before today (${today}).`, "Without --date, fx gives the latest rate.");
3639
+ // A weekend has no close of its own, so today's, on a Saturday or a Sunday, is the Friday close, which is final.
3640
+ if (date > today || (date === today && !isWeekendDay(date))) {
3641
+ return ctx.fail(`${date} has no daily close yet: --date takes a day before today (${today} UTC), or today on a weekend.`, "Without --date, fx gives the latest rate.");
3592
3642
  }
3593
3643
  return date;
3594
3644
  }
@@ -3679,6 +3729,46 @@ async function runFxOnDate(
3679
3729
  });
3680
3730
  }
3681
3731
 
3732
+ /**
3733
+ * What one unit of `quote` (a forward's quote currency) is worth in the
3734
+ * reader's currency at spot, to show a carry in it: 1 when they are the same,
3735
+ * the forward's own spot inverted when the reader's is the pair's base,
3736
+ * otherwise the pair's own quote. Null when no conversion is needed; the
3737
+ * sentence saying why it is missing when no quote came back.
3738
+ */
3739
+ async function carryInCurrency(
3740
+ quote: string,
3741
+ reader: string,
3742
+ base: string,
3743
+ spot: number,
3744
+ market: MarketContext,
3745
+ forceRefresh: boolean | undefined,
3746
+ ): Promise<{ rate: number; text: string } | { missing: string } | null> {
3747
+ if (reader === quote) return null;
3748
+ const marketText = (rate: number) => {
3749
+ const quoted = quotedFxPair(quote, reader, rate);
3750
+ return `${quoted.pair} ${quoted.rate.toFixed(fxRateDigits(quoted.pair.slice(4), quoted.rate))}`;
3751
+ };
3752
+ if (reader === base) return { rate: 1 / spot, text: marketText(1 / spot) };
3753
+ // A failed read is said in the carry's warning, with the reason it gave; the forward itself stands.
3754
+ const read = await readFxQuoteRate(quote, reader, (targets, options) => market.dataProvider.getQuotesBatch(targets, options),
3755
+ { forceRefresh: forceRefresh === true }).catch((error: unknown) => ({ failed: errorMessage(error) }));
3756
+ if (read && "rate" in read) return { rate: read.rate, text: marketText(read.rate) };
3757
+ const reason = read && "failed" in read && read.failed ? ` (${read.failed})` : "";
3758
+ return { missing: `The carry is not shown in ${reader}, your base currency: no ${quote}/${reader} rate came back${reason}.` };
3759
+ }
3760
+
3761
+ /**
3762
+ * `USD/MXN -0.68% on the day (previous close 18.75924)`: the move of the pair
3763
+ * as markets quote it, as `quote` gives it, whichever way round it was asked.
3764
+ */
3765
+ function describeFxMove(currency: string, baseCurrency: string, rate: number, move: { percent: number; previousRate: number }): string {
3766
+ const now = quotedFxPair(currency, baseCurrency, rate);
3767
+ const before = quotedFxPair(currency, baseCurrency, move.previousRate);
3768
+ const percent = (now.rate / before.rate - 1) * 100;
3769
+ return `${now.pair} ${formatSignedPercent(percent, 2)} on the day (previous close ${before.rate.toFixed(fxRateDigits(before.pair.slice(4), before.rate))})`;
3770
+ }
3771
+
3682
3772
  async function runFx(rawArgs: string[], ctx: Parameters<CliCommandDef["execute"]>[1]) {
3683
3773
  const args = [...rawArgs];
3684
3774
  const dateOption = takeOption(args, "--date");
@@ -3708,9 +3798,11 @@ async function runFx(rawArgs: string[], ctx: Parameters<CliCommandDef["execute"]
3708
3798
  const { request, amount, toUsdByDefault } = parsed;
3709
3799
  const { currency, baseCurrency } = request;
3710
3800
  const pair = `${currency}/${baseCurrency}`;
3711
- if (tenor) {
3712
- if (amount != null) ctx.fail("--forward prices a pair, not an amount.", `Usage: gloom ${FX_FORWARD_USAGE}`);
3713
- if (currency === baseCurrency) ctx.fail(`${pair} has no forward: both sides are ${currency}.`, `Usage: gloom ${FX_FORWARD_USAGE}`);
3801
+ if (tenor && currency === baseCurrency) ctx.fail(`${pair} has no forward: both sides are ${currency}.`, `Usage: gloom ${FX_FORWARD_USAGE}`);
3802
+ // A carry is on an amount held: zero or less holds nothing, and a sign would turn who earns it around.
3803
+ if (tenor && amount != null && !(amount > 0)) {
3804
+ ctx.fail(`The carry is on an amount above zero; ${args[0]!.trim()} is not.`,
3805
+ `For the forward alone, drop the amount: gloom fx ${pair} --forward ${forwardOption}.`);
3714
3806
  }
3715
3807
  // The short rates are read alongside spot. A failed read is held as a value, not left to reject
3716
3808
  // unobserved while spot loads, and is raised where the forward needs the rates.
@@ -3746,8 +3838,11 @@ async function runFx(rawArgs: string[], ctx: Parameters<CliCommandDef["execute"]
3746
3838
  // A rate older than its feed's delay is stale, as `quote` says of the same quote.
3747
3839
  const stale = observation?.stale === true;
3748
3840
  const converted = amount == null ? null : amount * rate;
3841
+ // The day's move, as `quote` gives the pair's: against the previous daily close.
3842
+ const move = quoted ? fxQuoteRateMove(quoted) : null;
3749
3843
  const row = {
3750
3844
  currency, baseCurrency, rate, asOf, stale, pair, inverse: 1 / rate,
3845
+ ...(move ? { changePercent: move.percent, previousClose: move.previousRate } : {}),
3751
3846
  ...(quoted ? { quotes: quoted.quotes.map(({ symbol }) => symbol), ...(quoted.viaUsd ? { via: "USD" } : {}) } : {}),
3752
3847
  ...(quoted?.derivedFrom ? { derived: true, derivedFrom: quoted.derivedFrom } : {}),
3753
3848
  ...(amount == null ? {} : { amount, converted }),
@@ -3784,24 +3879,54 @@ async function runFx(rawArgs: string[], ctx: Parameters<CliCommandDef["execute"]
3784
3879
  ? [`${short.name}: ${short.attribution.text.replace(/\.$/, "")} (${short.attribution.licenceUrl}).`] : []))];
3785
3880
  const staleRates = [base.rate, quote.rate].filter((short) => short.stale)
3786
3881
  .map((short) => `${short.name} (${short.currency}) is the last copy read, dated ${short.asOf ?? "undated"}; its source could not be read since.`);
3882
+ // With an amount, the carry: the forward points on it over the tenor, in the quote currency and in the
3883
+ // reader's base currency at spot, and the side that earns it.
3884
+ const carry = amount == null ? null : forwardCarry(amount, implied);
3885
+ const readerCurrency = market.config.baseCurrency;
3886
+ const carryConversion = carry ? await carryInCurrency(baseCurrency, readerCurrency, currency, rate, market, ctx.cliOptions.refresh) : null;
3787
3887
  const forwardRow = {
3788
3888
  pair, tenor: tenor.label, days: tenor.days, forwardDate, spot: rate, spotAsOf: asOf, forward: implied.forward,
3789
3889
  points: implied.points, pointSize: implied.pointSize, premiumPercent: implied.premiumPercent, annualizedPercent: implied.annualizedPercent,
3790
3890
  baseRate: rateFields(base.rate), quoteRate: rateFields(quote.rate), method: "covered interest parity", label: IMPLIED_FORWARD_LABEL,
3891
+ ...(carry ? {
3892
+ amount, carry: carry.value, carryCurrency: baseCurrency, carryEarnedBy: carry.earnedBy,
3893
+ ...(carryConversion && "rate" in carryConversion
3894
+ ? { carryConverted: carry.value * carryConversion.rate, carryConvertedCurrency: readerCurrency, carryConversionRate: carryConversion.rate }
3895
+ : {}),
3896
+ } : {}),
3791
3897
  };
3792
3898
  const growth = (short: typeof base.rate) => shortRateGrowthText(short, tenor.days);
3793
- const compounded = [base.rate, quote.rate].filter((short) => short.compounding === "business-252").map((short) => short.name);
3899
+ const compoundedOverBusinessDays = [base.rate, quote.rate].filter((short) => short.compounding === "business-252").map((short) => short.name);
3900
+ const compoundedDaily = [base.rate, quote.rate].filter((short) => short.compounding === "daily-365").map((short) => short.name);
3901
+ const simple = [base.rate, quote.rate].filter((short) => !short.compounding).map((short) => short.name);
3902
+ // How each leg grows, named: a compounded rate by how it compounds, the rest as simple interest.
3903
+ const growthNote = [
3904
+ ...compoundedOverBusinessDays.length > 0
3905
+ ? [`${compoundedOverBusinessDays.join(" and ")} compounds over business days (252 a year, taken as 252/365 of the ${tenor.days} days)`] : [],
3906
+ ...compoundedDaily.length > 0 ? [`${compoundedDaily.join(" and ")} compounds daily on ACT/365`] : [],
3907
+ ...simple.length === 2 ? [`each rate earns simple interest over the ${tenor.days} days`]
3908
+ : simple.length === 1 ? [`${simple[0]} earns simple interest`] : [],
3909
+ ].join(", ");
3794
3910
  // A currency typed as its name (yen) says which code it was read as, as the spot answer does.
3795
- const forwardWarnings = [...request.readAs ?? [], ...rateNotes, ...staleRates];
3911
+ const forwardWarnings = [
3912
+ ...request.readAs ?? [], ...rateNotes, ...staleRates,
3913
+ ...toUsdByDefault && amount != null
3914
+ ? [`No second currency given, so ${currency} is priced against USD; for another, write fx ${args[0]!.trim()} ${currency}/<to> --forward ${tenor.label}.`]
3915
+ : [],
3916
+ ...carryConversion && "missing" in carryConversion ? [carryConversion.missing] : [],
3917
+ ];
3796
3918
  return ctx.printResult({ data: [forwardRow], freshness, ...(forwardWarnings.length > 0 ? { warnings: forwardWarnings } : {}) }, {
3797
3919
  text: () => [
3798
3920
  `${pair} ${tenor.label} forward ${formatFxRate(implied.forward)}, ${IMPLIED_FORWARD_LABEL}`,
3799
3921
  `Spot ${formatFxRate(rate)} · forward points ${formatForwardPoints(implied.points)} (pips of ${implied.pointSize}) · ${implied.premiumPercent >= 0 ? "premium" : "discount"} ${formatSignedPercent(implied.premiumPercent)} over ${tenor.days} days to ${forwardDate}, ${formatSignedPercent(implied.annualizedPercent, 2)} a year (×360/${tenor.days})`,
3800
3922
  `${currency} rate: ${describeShortRate(base.rate)}`,
3801
3923
  `${baseCurrency} rate: ${describeShortRate(quote.rate)}`,
3802
- `Covered interest parity: ${formatFxRate(rate)} × ${growth(quote.rate)} / ${growth(base.rate)}; ${compounded.length > 0
3803
- ? `${compounded.join(" and ")} compounds over business days (252 a year, taken as 252/365 of the ${tenor.days} days), the other rate earns simple interest`
3804
- : `each rate earns simple interest over the ${tenor.days} days`}, standing in for a ${tenor.label} term rate.`,
3924
+ `Covered interest parity: ${formatFxRate(rate)} × ${growth(quote.rate)} / ${growth(base.rate)}; ${growthNote}, standing in for a ${tenor.label} term rate.`,
3925
+ ...carry ? [
3926
+ `Carry on ${formatFxAmount(carry.amount, currency)} over ${tenor.days} days: ${formatFxAmount(carry.value, baseCurrency)}${carryConversion && "rate" in carryConversion
3927
+ ? `, ${formatFxAmount(carry.value * carryConversion.rate, readerCurrency)} at spot ${carryConversion.text}` : ""}`,
3928
+ describeCarrySides(carry, currency, baseCurrency, tenor.days),
3929
+ ] : [],
3805
3930
  ...attributions,
3806
3931
  ].join("\n"),
3807
3932
  exportIdentity: { symbolOrSeries: pair, currencyOrUnit: `${baseCurrency} per ${currency}`, interval: `forward ${tenor.label}` },
@@ -3815,6 +3940,15 @@ async function runFx(rawArgs: string[], ctx: Parameters<CliCommandDef["execute"]
3815
3940
  { key: "points", header: "Points", align: "right" },
3816
3941
  { key: "premiumPercent", header: "Premium %", align: "right" },
3817
3942
  { key: "annualizedPercent", header: "Annualized %", align: "right" },
3943
+ ...(carry ? [
3944
+ { key: "amount", header: "Amount", align: "right" as const },
3945
+ { key: "carry", header: "Carry", align: "right" as const },
3946
+ { key: "carryCurrency", header: "Carry currency" },
3947
+ { key: "carryEarnedBy", header: "Earned by" },
3948
+ ...(carryConversion && "rate" in carryConversion ? [
3949
+ { key: "carryConverted", header: `Carry (${readerCurrency})`, align: "right" as const },
3950
+ ] : []),
3951
+ ] : []),
3818
3952
  ],
3819
3953
  });
3820
3954
  }
@@ -3840,6 +3974,7 @@ async function runFx(rawArgs: string[], ctx: Parameters<CliCommandDef["execute"]
3840
3974
  const metal = quoted?.derivedFrom ? (METAL_NAMES[currency] ? currency : baseCurrency) : null;
3841
3975
  const rateText = [
3842
3976
  describeFxRate(request, rate, quoted && !quoted.viaUsd ? quoted.quotes[0] : undefined),
3977
+ ...move ? [describeFxMove(currency, baseCurrency, rate, move)] : [],
3843
3978
  ...quoted?.viaUsd ? [describeFxLegs(quoted.quotes)] : [],
3844
3979
  ...metal ? [`derived: ${METAL_NAMES[metal]!.toLowerCase()} from ${quoted!.derivedFrom}, the front-month future (spot ${METAL_NAMES[metal]!.toLowerCase()} is not quoted)`] : [],
3845
3980
  ...peso ? [`${peso.spotKind} rate`] : [],
@@ -3861,6 +3996,10 @@ async function runFx(rawArgs: string[], ctx: Parameters<CliCommandDef["execute"]
3861
3996
  { key: "stale", header: "Stale" },
3862
3997
  { key: "pair", header: "Pair" },
3863
3998
  { key: "inverse", header: "Inverse", align: "right" },
3999
+ ...(move ? [
4000
+ { key: "changePercent", header: "Chg %", align: "right" as const },
4001
+ { key: "previousClose", header: "Previous close", align: "right" as const },
4002
+ ] : []),
3864
4003
  ...(amount == null ? [] : [
3865
4004
  { key: "amount", header: "Amount", align: "right" as const },
3866
4005
  { key: "converted", header: "Converted", align: "right" as const },
@@ -3955,7 +4094,7 @@ export const marketDataCliCommands: BuiltinCliCommandDef[] = [
3955
4094
  options: [EXCHANGE_OPTION, LIST_FILE_OPTION],
3956
4095
  sections: [QUOTE_CSV_SECTION],
3957
4096
  examples: ["quote AAPL MSFT NVDA", "quote SAN:EPA BHP:ASX", "quote BTC-USD EURUSD=X", "quote binance:BZUSDT", "quote AAPL --json", "quote --file holdings.csv",
3958
- "quote --file holdings.csv --csv > quotes.csv"],
4097
+ "quote --file holdings.csv --csv --output quotes.csv"],
3959
4098
  },
3960
4099
  execute: (args, ctx) => runQuote(args, ctx, "quote"),
3961
4100
  },
@@ -3978,7 +4117,7 @@ export const marketDataCliCommands: BuiltinCliCommandDef[] = [
3978
4117
  group: CLI_COMMAND_GROUPS.research,
3979
4118
  usage: [HISTORY_USAGE, "history --file <path> [--range <range> | --from <year|date> [--to <year|date>]]"],
3980
4119
  options: [
3981
- { flags: "--range <range>", description: `${HISTORY_RANGES.join(", ")} (default 1Y); ${HISTORY_YTD_RANGE}; ${HISTORY_ALL_RANGE}` },
4120
+ { flags: "--range <range>", description: `${HISTORY_RANGES.join(", ")} (default 1Y), or as other tools write them: ${HISTORY_RANGE_ALIASES}; ${HISTORY_YTD_RANGE}; ${HISTORY_ALL_RANGE}` },
3982
4121
  { flags: "--from <year|date>, --start <year|date>", description: `${PRICE_WINDOW_FROM_HELP}. Up to five years come in daily bars, up to twenty weekly, longer monthly` },
3983
4122
  { flags: "--to <year|date>, --end <year|date>", description: PRICE_WINDOW_TO_HELP },
3984
4123
  { flags: "--file <path>", description: "Read the symbols from a text or CSV file, one per line (- reads standard input), and write every symbol's bars in one table" },
@@ -4016,8 +4155,8 @@ export const marketDataCliCommands: BuiltinCliCommandDef[] = [
4016
4155
  }],
4017
4156
  examples: [
4018
4157
  "history AAPL", "history BHP:ASX --range 5Y", "history JPM --from 2007 --to 2009", "history ZAR=X --range ALL", "history ZAR=X --tail 5",
4019
- "history AAPL --range 5Y --csv > aapl.csv", "history AAPL MSFT 000660.KS --range 1M --csv",
4020
- "history --file holdings.txt --start 2024-01-01 --end 2024-12-31 --csv > bars.csv",
4158
+ "history AAPL --range 5Y --csv --output aapl.csv", "history AAPL MSFT 000660.KS --range 1M --csv",
4159
+ "history --file holdings.txt --start 2024-01-01 --end 2024-12-31 --csv --output bars.csv",
4021
4160
  ],
4022
4161
  },
4023
4162
  unknownOptionHint: historyOptionHint,
@@ -4119,7 +4258,7 @@ export const marketDataCliCommands: BuiltinCliCommandDef[] = [
4119
4258
  group: CLI_COMMAND_GROUPS.companyData,
4120
4259
  usage: ["financials <symbol>"],
4121
4260
  options: [EXCHANGE_OPTION, TABLE_SECTION_OPTION],
4122
- examples: ["financials MSFT", "financials SAN:EPA", "financials MSFT --json", "financials MSFT --csv > msft.csv"],
4261
+ examples: ["financials MSFT", "financials SAN:EPA", "financials MSFT --json", "financials MSFT --csv --output msft.csv"],
4123
4262
  },
4124
4263
  unknownOptionHint: financialsOptionHint,
4125
4264
  execute: (args, ctx) => runFinancials(args, ctx, "statements"),
@@ -4273,14 +4412,14 @@ export const marketDataCliCommands: BuiltinCliCommandDef[] = [
4273
4412
  usage: ["fx <currency>", "fx <base>/<quote>", "fx <amount> <from>/<to>", "fx <amount> <from> <to>", "fx <pair> --date <day>", FX_FORWARD_USAGE],
4274
4413
  options: [
4275
4414
  { flags: "--date <day>", description: `The rate at that day's daily FX close, such as a transaction date (${DATE_OPTION_EXAMPLES}); a weekend or holiday reads the trading day before it` },
4276
- { flags: "--forward <tenor>", description: "The forward implied by both currencies' short rates (covered interest parity), not a dealer quote: 30d, 2w, 3m, up to 1y; today's only, so not with --date" },
4415
+ { flags: "--forward <tenor>", description: "The forward implied by both currencies' short rates (covered interest parity), not a dealer quote: 30d, 2w, 3m, up to 1y; with an amount, the carry on it and who earns it; today's only, so not with --date" },
4277
4416
  ],
4278
4417
  sections: [{
4279
4418
  title: "Direction",
4280
4419
  lines: [
4281
4420
  "A bare code is one unit of it in your base currency. A pair reads as markets quote it: USD/NGN is how many NGN one USD buys. Two codes neither of which is USD, such as ZAR/NGN, cross through their USD rates.",
4282
4421
  "A currency's name stands for its code: fx yen is JPY, fx rand ZAR, fx Swiss franc CHF, and the answer says which it read. A name several currencies share (peso, dollar, franc, krona, rupee) lists them: write one as its code.",
4283
- "The answer states both directions: 1 NGN = 0.000752791 USD (USD/NGN 1328.39). --json, --csv and --ndjson carry rate (base currency per currency), pair, inverse, asOf and stale.",
4422
+ "The answer states both directions: 1 NGN = 0.000752791 USD (USD/NGN 1328.39), then the day's move of the pair as markets quote it, against its previous daily close, as quote gives it. --json, --csv and --ndjson carry rate (base currency per currency), pair, inverse, asOf, stale, and changePercent and previousClose of the rate as asked.",
4284
4423
  ],
4285
4424
  }, {
4286
4425
  title: "Amounts",
@@ -4290,16 +4429,17 @@ export const marketDataCliCommands: BuiltinCliCommandDef[] = [
4290
4429
  }, {
4291
4430
  title: "A past day",
4292
4431
  lines: [
4293
- "--date gives the rate at that day's daily FX close instead of the latest: fx USD/CAD --date 2026-09-02, or with an amount, fx 1250 USD/CAD --date 2026-09-02. Each currency's USD pair is read at its close of that day and crossed through USD, as the latest rate is. A weekend or market holiday has no close: the answer then gives the trading day before it and says so. The source line dates the close; --json adds date (the day asked for) and asOf (the close used).",
4432
+ "--date gives the rate at that day's daily FX close instead of the latest: fx USD/CAD --date 2026-09-02, or with an amount, fx 1250 USD/CAD --date 2026-09-02. Each currency's USD pair is read at its close of that day and crossed through USD, as the latest rate is. A weekend or market holiday has no close: the answer then gives the trading day before it and says so, today included on a Saturday or Sunday. The source line dates the close; --json adds date (the day asked for) and asOf (the close used).",
4294
4433
  ],
4295
4434
  }, {
4296
4435
  title: "Forwards",
4297
4436
  lines: [
4298
- "--forward <tenor> gives the forward implied by covered interest parity: spot × (1 + quote rate × days/basis) / (1 + base rate × days/basis), with the forward points (pips of 0.0001, 0.01 against JPY) and the premium over spot for the period and a year. It is implied by rates, not a dealer quote.",
4299
- "The rates are SOFR (USD), €STR (EUR), SONIA (GBP) and TIIE 28d (MXN), each with its day and publisher. A pair whose rate is missing says which one. Tenors count calendar days from today: 30d, 2w, 3m, 1y. The forward is today's: it does not take --date, as only the latest short rates are served.",
4437
+ "--forward <tenor> gives the forward implied by covered interest parity: spot × (1 + quote rate × days/basis) / (1 + base rate × days/basis), a compounded rate (CDI, ZARONIA) grown as it compounds, with the forward points (pips of 0.0001, 0.01 against JPY) and the premium over spot for the period and a year. It is implied by rates, not a dealer quote.",
4438
+ "The rates are SOFR (USD), €STR (EUR), SONIA (GBP), TIIE 28d (MXN), CDI (BRL), SORA (SGD) and ZARONIA (ZAR), and for TRY the CBRT's policy rate (one-week repo), each with its day and publisher. A pair whose rate is missing says which one. Tenors count calendar days from today: 30d, 2w, 3m, 1y. The forward is today's: it does not take --date, as only the latest short rates are served.",
4439
+ "An amount in front gives the carry on it: fx 5000000 USD/MXN --forward 30d is the forward points on 5,000,000 USD over the 30 days, in MXN and in your base currency at spot, and which side earns it. The side holding the currency whose rate earns more over the tenor earns it: short USD/MXN (selling USD forward) when the forward is above spot. The amount is above zero, and a forward at spot has no carry.",
4300
4440
  ],
4301
4441
  }],
4302
- examples: ["fx EUR", "fx NGN", "fx yen", "fx USD/NGN", "fx ZAR/NGN", "fx 1234.5 EUR/USD", "fx 1234,5 EUR USD", "fx USD/CAD --date 2026-09-02", "fx JPY --json", "fx USD/MXN --forward 30d", "fx EUR/USD --forward 3m"],
4442
+ examples: ["fx EUR", "fx NGN", "fx yen", "fx USD/NGN", "fx ZAR/NGN", "fx 1234.5 EUR/USD", "fx 1234,5 EUR USD", "fx USD/CAD --date 2026-09-02", "fx JPY --json", "fx USD/MXN --forward 30d", "fx EUR/USD --forward 3m", "fx 5000000 USD/MXN --forward 30d"],
4303
4443
  },
4304
4444
  execute: runFx,
4305
4445
  },