gloomberb 0.20.4 → 0.20.6
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.
- package/README.md +3 -1
- package/README.zh-CN.md +1 -1
- package/bin/gloom +9 -0
- package/bin/without-bun.cjs +98 -0
- package/package.json +4 -1
- package/src/api-client/data.ts +148 -37
- package/src/api-client/hk-tenders.ts +59 -0
- package/src/api-client/index.ts +1 -0
- package/src/api-client/types/econ.ts +30 -0
- package/src/api-client/yield-curves.ts +1 -1
- package/src/app/global-shortcuts.ts +4 -1
- package/src/app/keybindings/actions.ts +6 -0
- package/src/app/keybindings/config.ts +2 -1
- package/src/app/keybindings/index.ts +1 -0
- package/src/app/keybindings/labels.ts +6 -1
- package/src/app/keybindings/resolve.ts +23 -4
- package/src/app/keybindings/terminal-keys.ts +35 -0
- package/src/app/pane-runtime/index.tsx +2 -2
- package/src/app/pane-runtime/ticker-open-runtime.ts +68 -40
- package/src/app.tsx +18 -13
- package/src/architecture/floating-promise-allowlist.json +313 -0
- package/src/architecture/ui-literals-allowlist.json +1 -1
- package/src/capabilities/chart-series.ts +27 -1
- package/src/cli/commands/keybindings.ts +5 -5
- package/src/cli/commands/market.ts +238 -57
- package/src/cli/commands/news-search.ts +81 -14
- package/src/cli/commands/overview.ts +27 -6
- package/src/cli/commands/remote.ts +16 -17
- package/src/cli/commands/system.ts +1 -1
- package/src/cli/commands/ticker.ts +3 -1
- package/src/cli/early-command.ts +2 -0
- package/src/cli/errors.ts +10 -1
- package/src/cli/fx-forward.ts +89 -7
- package/src/cli/fx-pair.ts +1 -1
- package/src/cli/fx-quote-rate.ts +23 -0
- package/src/cli/glossary.ts +19 -5
- package/src/cli/help.ts +1 -0
- package/src/cli/history-rows.ts +5 -3
- package/src/cli/index-roots.ts +5 -4
- package/src/cli/index.ts +40 -3
- package/src/cli/known-gaps.ts +38 -9
- package/src/cli/listing-arg.ts +17 -5
- package/src/cli/name-entries.ts +5 -1
- package/src/cli/not-a-ticker.ts +4 -0
- package/src/cli/options.ts +52 -3
- package/src/cli/output-file.ts +5 -3
- package/src/cli/pane-functions/catalog.ts +15 -0
- package/src/cli/pane-functions/function-help.ts +4 -4
- package/src/cli/pane-functions/headless.ts +9 -4
- package/src/cli/pane-functions/index.ts +6 -4
- package/src/cli/pane-functions/resolver.ts +2 -2
- package/src/cli/result.ts +21 -2
- package/src/cli/spreadsheet-hint.ts +7 -3
- package/src/cli/treasury-yields.ts +5 -3
- package/src/components/chart/composite/legend.tsx +40 -2
- package/src/components/command-bar/pane-settings.ts +2 -2
- package/src/components/command-bar/routes/root/results.ts +6 -2
- package/src/components/command-bar/workflow/tickers.ts +2 -2
- package/src/components/data-table/view.tsx +9 -2
- package/src/components/input-search-bar.tsx +9 -2
- package/src/components/layout/pane/header.tsx +2 -0
- package/src/components/layout/shell/pane/capture.ts +4 -1
- package/src/components/layout/status-bar.tsx +6 -1
- package/src/components/onboarding/first-run-workspace.ts +44 -2
- package/src/components/onboarding/onboarding-frame.tsx +11 -2
- package/src/components/onboarding/onboarding-keyboard.ts +16 -0
- package/src/components/onboarding/onboarding-wizard.tsx +8 -8
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +62 -1
- package/src/components/onboarding/use-onboarding-progress.ts +12 -4
- package/src/components/pane-settings-dialog/desktop.tsx +2 -2
- package/src/components/pane-settings-dialog/tui.tsx +2 -2
- package/src/components/pane-settings-dialog/value.ts +6 -0
- package/src/components/pane-settings-dialog.tsx +3 -3
- package/src/components/reader/detail-reader.tsx +4 -0
- package/src/components/ui/data-table/opentui/index.tsx +11 -4
- package/src/components/ui/data-table/opentui/model.ts +8 -6
- package/src/components/ui/data-table/types.ts +6 -1
- package/src/components/ui/index.ts +1 -1
- package/src/components/ui/page-stack-view.tsx +3 -0
- package/src/components/ui/pane-link-chip.tsx +269 -54
- package/src/components/ui/query-bar.tsx +2 -1
- package/src/components/ui/table-layout.ts +38 -1
- package/src/components/ui/tabs.tsx +97 -19
- package/src/core/state/app/layout-reducer.ts +7 -0
- package/src/core/state/app/layout.ts +44 -7
- package/src/core/state/app/state.ts +1 -1
- package/src/core/state/app/types.ts +22 -2
- package/src/docs/snapshot.json +30 -13
- package/src/market-data/depositary-pair.ts +5 -3
- package/src/market-data/market/change-basis.ts +9 -5
- package/src/market-data/market/dated-previous-close.ts +147 -17
- package/src/market-data/market/status.ts +17 -1
- package/src/market-data/quotes/contributions.ts +2 -0
- package/src/market-data/quotes/listing-enterprise-value.ts +50 -0
- package/src/plugins/builtin/alerts/metric-data.ts +15 -2
- package/src/plugins/builtin/analytics/risk-client.ts +10 -4
- package/src/plugins/builtin/analytics/risk-episodes.ts +5 -4
- package/src/plugins/builtin/analytics/risk-headless.ts +4 -2
- package/src/plugins/builtin/analytics/risk-sectors.ts +91 -0
- package/src/plugins/builtin/awards/index.tsx +1 -1
- package/src/plugins/builtin/backtest/headless.ts +1 -1
- package/src/plugins/builtin/buildout/index.tsx +1 -0
- package/src/plugins/builtin/catalysts/index.tsx +2 -2
- package/src/plugins/builtin/cds/headless.ts +4 -0
- package/src/plugins/builtin/cds/model.ts +0 -6
- package/src/plugins/builtin/chart-composer/formula.ts +16 -3
- package/src/plugins/builtin/chart-composer/headless-schema.ts +2 -0
- package/src/plugins/builtin/chart-composer/headless.ts +4 -2
- package/src/plugins/builtin/chart-composer/index.tsx +1 -0
- package/src/plugins/builtin/chart-composer/presets.ts +1 -0
- package/src/plugins/builtin/chat/content/composer.tsx +5 -4
- package/src/plugins/builtin/chat/content/index.tsx +12 -2
- package/src/plugins/builtin/chat/content/layout-metrics.ts +3 -3
- package/src/plugins/builtin/chat/content/open-targets.ts +3 -3
- package/src/plugins/builtin/chat/layout.ts +5 -2
- package/src/plugins/builtin/chat/message/pane-chip.tsx +61 -40
- package/src/plugins/builtin/chat/message/terminal.tsx +13 -15
- package/src/plugins/builtin/chat/pane-links/previews.ts +51 -5
- package/src/plugins/builtin/chat/pane-links/share-card.ts +36 -0
- package/src/plugins/builtin/cloud/askg/pane.tsx +55 -13
- package/src/plugins/builtin/cloud/askg/tool-display.ts +1 -0
- package/src/plugins/builtin/cloud/terminal-relay/redact.ts +5 -3
- package/src/plugins/builtin/commodity-balances/index.tsx +1 -0
- package/src/plugins/builtin/company-attention/index.tsx +1 -1
- package/src/plugins/builtin/company-kpis/headless.ts +3 -1
- package/src/plugins/builtin/company-kpis/index.tsx +2 -2
- package/src/plugins/builtin/cot/index.tsx +1 -1
- package/src/plugins/builtin/cpi/index.tsx +1 -1
- package/src/plugins/builtin/credit-boards/cdx-pane.tsx +20 -7
- package/src/plugins/builtin/credit-boards/client.ts +8 -0
- package/src/plugins/builtin/credit-boards/headless.ts +4 -1
- package/src/plugins/builtin/credit-boards/model.ts +58 -4
- package/src/plugins/builtin/credit-boards/series.ts +63 -6
- package/src/plugins/builtin/credit-boards/sovr-pane.tsx +3 -2
- package/src/plugins/builtin/credit-conditions/headless.ts +24 -6
- package/src/plugins/builtin/credit-conditions/index.tsx +1 -1
- package/src/plugins/builtin/credit-conditions/model.ts +12 -6
- package/src/plugins/builtin/credit-conditions/series.ts +2 -1
- package/src/plugins/builtin/crypto-board/index.tsx +1 -0
- package/src/plugins/builtin/dividend-yield/index.tsx +1 -0
- package/src/plugins/builtin/doe/index.tsx +1 -1
- package/src/plugins/builtin/earnings-calls/headless.ts +5 -1
- package/src/plugins/builtin/earnings-calls/index.tsx +1 -0
- package/src/plugins/builtin/econ/calendar-model.ts +115 -8
- package/src/plugins/builtin/econ/calendar-source.ts +7 -1
- package/src/plugins/builtin/econ/fred-catalog.ts +3 -1
- package/src/plugins/builtin/econ/index.tsx +42 -8
- package/src/plugins/builtin/econ/types.ts +3 -0
- package/src/plugins/builtin/econ-statistics/index.tsx +1 -0
- package/src/plugins/builtin/econ-statistics/pane.tsx +6 -0
- package/src/plugins/builtin/estimate-revisions/index.tsx +1 -0
- package/src/plugins/builtin/executives/index.tsx +1 -0
- package/src/plugins/builtin/filing-events/index.tsx +1 -0
- package/src/plugins/builtin/fixed-income/index.tsx +3 -0
- package/src/plugins/builtin/futures-curve/headless.ts +3 -3
- package/src/plugins/builtin/futures-curve/index.tsx +1 -1
- package/src/plugins/builtin/futures-curve/model.ts +18 -0
- package/src/plugins/builtin/fx-matrix/index.tsx +44 -14
- package/src/plugins/builtin/gpu/index.tsx +1 -1
- package/src/plugins/builtin/help/functions-table.tsx +1 -1
- package/src/plugins/builtin/help/index.tsx +11 -1
- package/src/plugins/builtin/help/keybindings-editor.tsx +7 -3
- package/src/plugins/builtin/holders/index.tsx +1 -0
- package/src/plugins/builtin/holders/report-header.ts +2 -2
- package/src/plugins/builtin/insider/index.tsx +1 -0
- package/src/plugins/builtin/iv-history/index.tsx +1 -1
- package/src/plugins/builtin/jobs/index.tsx +1 -0
- package/src/plugins/builtin/macro-day/headless.ts +27 -8
- package/src/plugins/builtin/macro-day/index.tsx +1 -1
- package/src/plugins/builtin/macro-day/model.ts +19 -3
- package/src/plugins/builtin/macro-day/pane.tsx +14 -9
- package/src/plugins/builtin/macro-day/releases.ts +25 -7
- package/src/plugins/builtin/market-valuation/index.tsx +1 -0
- package/src/plugins/builtin/market-valuation/pane.tsx +8 -0
- package/src/plugins/builtin/members/index.tsx +1 -1
- package/src/plugins/builtin/mna/index.tsx +1 -0
- package/src/plugins/builtin/news/index.tsx +1 -0
- package/src/plugins/builtin/news/wire/index.tsx +5 -1
- package/src/plugins/builtin/news/wire/news/detail-view.tsx +4 -0
- package/src/plugins/builtin/news/wire/news/list-search.ts +5 -2
- package/src/plugins/builtin/options/index.tsx +1 -0
- package/src/plugins/builtin/options-positioning/index.tsx +1 -0
- package/src/plugins/builtin/pe-band/index.tsx +1 -1
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +25 -0
- package/src/plugins/builtin/portfolio-list/cli/render.ts +20 -3
- package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +5 -1
- package/src/plugins/builtin/portfolio-list/headless.ts +15 -6
- package/src/plugins/builtin/power/index.tsx +1 -1
- package/src/plugins/builtin/realized-vol/index.tsx +1 -1
- package/src/plugins/builtin/research/headless-schema.ts +4 -3
- package/src/plugins/builtin/research/headless.ts +10 -4
- package/src/plugins/builtin/research/index.tsx +4 -0
- package/src/plugins/builtin/research/relative-valuation-columns.ts +145 -47
- package/src/plugins/builtin/research/relative-valuation-currency.ts +31 -0
- package/src/plugins/builtin/research/relative-valuation-headless.ts +25 -8
- package/src/plugins/builtin/research/relative-valuation-model.ts +40 -9
- package/src/plugins/builtin/research/relative-valuation-pane.tsx +3 -2
- package/src/plugins/builtin/research/relative-valuation-peers.ts +2 -2
- package/src/plugins/builtin/research-search/index.tsx +1 -0
- package/src/plugins/builtin/research-search/pane.tsx +8 -0
- package/src/plugins/builtin/revenue-breakdown/index.tsx +1 -0
- package/src/plugins/builtin/reverse-dcf/index.tsx +1 -1
- package/src/plugins/builtin/risk-factors/index.tsx +1 -0
- package/src/plugins/builtin/scanner/headless.ts +52 -13
- package/src/plugins/builtin/seasonality/index.tsx +1 -1
- package/src/plugins/builtin/sec/index.tsx +1 -0
- package/src/plugins/builtin/series-inventory.ts +1 -1
- package/src/plugins/builtin/shared/scanner-capture.ts +11 -3
- package/src/plugins/builtin/shared/series-list-detail.tsx +5 -0
- package/src/plugins/builtin/short-interest/index.tsx +1 -0
- package/src/plugins/builtin/social-mentions/index.tsx +1 -1
- package/src/plugins/builtin/supply-chain/index.tsx +1 -0
- package/src/plugins/builtin/thirteenf/api.ts +47 -4
- package/src/plugins/builtin/thirteenf/data.ts +43 -10
- package/src/plugins/builtin/thirteenf/headless.ts +55 -11
- package/src/plugins/builtin/thirteenf/model.ts +25 -9
- package/src/plugins/builtin/thirteenf/report-notes.ts +27 -6
- package/src/plugins/builtin/thirteenf/types.ts +2 -0
- package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +1 -1
- package/src/plugins/builtin/ticker-detail/data-panes/historical-prices.tsx +8 -7
- package/src/plugins/builtin/ticker-detail/data-panes/history-bars.ts +8 -5
- package/src/plugins/builtin/ticker-detail/financials/model.ts +18 -2
- package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +3 -3
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +6 -6
- package/src/plugins/builtin/ticker-detail/headless.ts +24 -17
- package/src/plugins/builtin/ticker-detail/index.tsx +4 -0
- package/src/plugins/builtin/ticker-detail/overview/model.ts +6 -4
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +6 -4
- package/src/plugins/builtin/time-sales/client.ts +9 -11
- package/src/plugins/builtin/time-sales/index.tsx +1 -1
- package/src/plugins/builtin/treasury-auctions/after.ts +267 -0
- package/src/plugins/builtin/treasury-auctions/cache.ts +54 -5
- package/src/plugins/builtin/treasury-auctions/client.ts +33 -2
- package/src/plugins/builtin/treasury-auctions/headless.ts +150 -22
- package/src/plugins/builtin/treasury-auctions/hk-headless.ts +126 -0
- package/src/plugins/builtin/treasury-auctions/hk-view.tsx +347 -0
- package/src/plugins/builtin/treasury-auctions/hk.ts +363 -0
- package/src/plugins/builtin/treasury-auctions/index.tsx +27 -4
- package/src/plugins/builtin/treasury-auctions/model.ts +264 -28
- package/src/plugins/builtin/treasury-auctions/pane.tsx +176 -41
- package/src/plugins/builtin/treasury-auctions/treasury-direct.ts +5 -2
- package/src/plugins/builtin/treasury-auctions/types.ts +7 -1
- package/src/plugins/builtin/vol-surface/index.tsx +1 -1
- package/src/plugins/builtin/world-venue-map/index.ts +1 -0
- package/src/plugins/builtin/yield-curve/curves.ts +10 -4
- package/src/plugins/builtin/yield-curve/headless.ts +6 -2
- package/src/plugins/builtin/yield-curve/index.tsx +3 -3
- package/src/plugins/builtin/yield-curve/series.ts +10 -0
- package/src/plugins/builtin/yield-curve/world.ts +3 -1
- package/src/portfolio/collection-name.ts +22 -0
- package/src/portfolio/column-values.ts +2 -1
- package/src/public/__snapshots__/public-api.test.ts.snap +4 -0
- package/src/public/remote.ts +7 -1
- package/src/remote/client.ts +191 -11
- package/src/remote/controller-utils.ts +13 -1
- package/src/remote/controller.ts +88 -26
- package/src/remote/endpoint.ts +24 -0
- package/src/remote/form.ts +59 -4
- package/src/remote/resources.ts +44 -18
- package/src/remote/schema.ts +21 -9
- package/src/remote/secrets.ts +12 -0
- package/src/remote/semantic-tree.tsx +14 -2
- package/src/remote/server.ts +2 -1
- package/src/remote/surface.tsx +192 -0
- package/src/remote/types.ts +5 -0
- package/src/renderers/dom/data-table/frozen-column.ts +3 -1
- package/src/renderers/dom/data-table/index.tsx +27 -9
- package/src/renderers/dom/data-table/row.tsx +2 -0
- package/src/renderers/electrobun/bun/desktop/backend.ts +27 -24
- package/src/renderers/electrobun/bun/desktop/detached-windows.ts +3 -3
- package/src/renderers/electrobun/bun/desktop/snapshot-commit.ts +77 -0
- package/src/renderers/electrobun/shared/protocol.ts +4 -0
- package/src/renderers/electrobun/view/backend-rpc.ts +3 -0
- package/src/renderers/electrobun/view/desktop/window/bridge.ts +3 -0
- package/src/renderers/opentui/host.tsx +6 -0
- package/src/series/standalone.ts +2 -2
- package/src/shares/api.ts +21 -4
- package/src/shares/item.ts +73 -0
- package/src/shares/pane-item.ts +205 -0
- package/src/shares/pane.ts +4 -0
- package/src/shares/payload.ts +9 -5
- package/src/sources/gloomberb-cloud/news.ts +2 -0
- package/src/sources/gloomberb-cloud/normalizers.ts +9 -5
- package/src/sources/provider-router/cache.ts +3 -1
- package/src/sync/controller.ts +17 -2
- package/src/sync/other-window-tabs.ts +32 -1
- package/src/sync/react.ts +4 -4
- package/src/tickers/renamed-listings.ts +105 -0
- package/src/tickers/search/index.ts +103 -16
- package/src/time-series/bar-spacing.ts +33 -0
- package/src/time-series/base-series.ts +21 -3
- package/src/time-series/chart-bounds.ts +31 -0
- package/src/time-series/field-catalog.ts +17 -0
- package/src/time-series/fundamentals.ts +143 -11
- package/src/time-series/ice-credit.ts +32 -6
- package/src/time-series/resolve.ts +11 -7
- package/src/time-series/session-bar.ts +78 -9
- package/src/time-series/studies/formula.ts +53 -10
- package/src/time-series/studies/pair.ts +18 -7
- package/src/time-series/studies/units.ts +49 -2
- package/src/time-series/types.ts +12 -0
- package/src/types/desktop-window.ts +2 -0
- package/src/types/financials.ts +7 -0
- package/src/types/headless.ts +8 -0
- package/src/types/plugin-pane-settings.ts +2 -0
- package/src/types/plugin-panes.ts +22 -0
- package/src/utils/central-banks.ts +86 -1
- package/src/utils/cli-output.ts +6 -3
- package/src/utils/datetime-format.ts +12 -3
- package/src/utils/depositary-receipt.ts +28 -3
- package/src/utils/ebitda.ts +128 -0
- package/src/utils/format.ts +1 -1
- package/src/utils/fundamentals.ts +14 -0
- package/src/utils/max-drawdown.ts +97 -16
- package/src/utils/shell-word.ts +13 -0
- package/src/utils/untrusted-text.ts +29 -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";
|
|
@@ -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";
|
|
@@ -133,8 +134,8 @@ import type { FxInterventionsPayload } from "../../api-client/fx-interventions";
|
|
|
133
134
|
import {
|
|
134
135
|
fxInterventionLatestNote, fxInterventionPair, fxInterventionWindowNote, loadFxInterventions, type FxInterventionPair,
|
|
135
136
|
} from "../../market-data/fx-interventions";
|
|
136
|
-
import { maxDrawdownText } from "../../utils/max-drawdown";
|
|
137
|
-
import { isPastPriceWindow, loadPriceWindowHistory, PRICE_WINDOW_FROM_HELP, PRICE_WINDOW_TO_HELP, priceWindowText, readPriceWindow, type PriceWindow } from "../../utils/price-window";
|
|
137
|
+
import { maxDrawdownText, maxRunUp, maxRunUpText } from "../../utils/max-drawdown";
|
|
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,
|
|
@@ -189,7 +190,7 @@ import { CRYPTO_BOARD_HINT, quoteNotes } from "./crypto-hints";
|
|
|
189
190
|
import { bareFuturesCode, futuresBoardContract, futuresContractByWord } from "../../market-data/futures-board";
|
|
190
191
|
import { commodityNamedIn, commoditySearchName } from "../../market-data/commodity-names";
|
|
191
192
|
import { newsEmptyMessage } from "./news-hints";
|
|
192
|
-
import {
|
|
193
|
+
import { centralBankInNews, centralBankShortNamed } from "../../utils/central-banks";
|
|
193
194
|
import {
|
|
194
195
|
closestStoriesReason,
|
|
195
196
|
commodityNewsRoute,
|
|
@@ -204,6 +205,8 @@ import {
|
|
|
204
205
|
newsSearchTextProblem,
|
|
205
206
|
newestFirst,
|
|
206
207
|
noMetalStoriesMessage,
|
|
208
|
+
searchCentralBankStories,
|
|
209
|
+
centralBankNewsReason,
|
|
207
210
|
noStoriesMessage,
|
|
208
211
|
quotedSearchCommand,
|
|
209
212
|
searchClosestNewsStories,
|
|
@@ -212,12 +215,13 @@ import {
|
|
|
212
215
|
} from "./news-search";
|
|
213
216
|
import { displayTimeZone, formatUtcDayTime, formatUtcTime } from "../../utils/utc-time";
|
|
214
217
|
import { localReportTiming } from "../../utils/report-timing";
|
|
215
|
-
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";
|
|
216
220
|
import { isFiniteNumber } from "../../utils/guards";
|
|
217
221
|
import { exportedFundamentals } from "../../utils/price-earnings";
|
|
218
222
|
import { withBankEnterpriseValue } from "../../utils/fundamentals";
|
|
219
223
|
import { fundamentalsFreshness, quotesFreshness, rowsFreshness, valuationFreshness } from "../freshness";
|
|
220
|
-
import { fxPairListing, fxQuoteRateObservation, METAL_NAMES, readFxQuoteRate } from "../fx-quote-rate";
|
|
224
|
+
import { fxPairListing, fxQuoteRateMove, fxQuoteRateObservation, METAL_NAMES, readFxQuoteRate } from "../fx-quote-rate";
|
|
221
225
|
import { quoteBarNotes } from "../../market-data/quotes/intraday-bar";
|
|
222
226
|
import { cedearRatioText, depositaryPairText, isReceiptSide, listingCedearRatio, listingDepositaryPair } from "../../market-data/depositary-pair";
|
|
223
227
|
import { isPesoDollarPair, loadPesoDollarRates, pesoDollarRateLines, pesoDollarRatesJson } from "../peso-dollar-rates";
|
|
@@ -300,7 +304,8 @@ import { knownGapMessage, subMinuteDataMessage } from "../known-gaps";
|
|
|
300
304
|
import { phraseSearchReport } from "./search";
|
|
301
305
|
import { secRegistrantMismatchMessage, SecRegistrantMismatchError, areDifferentCompanies } from "../../sources/sec-registrant";
|
|
302
306
|
import { isCryptoPairSymbol, isRoundTheClockCoin } from "../../utils/crypto-pair";
|
|
303
|
-
import { isUsListingExchange } from "../../utils/exchanges";
|
|
307
|
+
import { canonicalExchange, isUsListingExchange } from "../../utils/exchanges";
|
|
308
|
+
import { listingSuffixVenue } from "../../sources/listing-symbols";
|
|
304
309
|
import { resolveTickerInstrumentKind } from "../../tickers/instrument-kind";
|
|
305
310
|
import {
|
|
306
311
|
describeFormerIssuer, describeTickerChange, movedAwayChange, startTickerChangeLookup, tickerChangeLine, type FormerIssuer, type TickerChange,
|
|
@@ -309,11 +314,13 @@ import { noSecReportsNotice, nonUsSecListingVenue, secFilingItemCodes } from "..
|
|
|
309
314
|
import type { MarketContext } from "../types";
|
|
310
315
|
import { windowRows } from "../row-window";
|
|
311
316
|
import { answerQuote, errorMessage, notUsTickerSentence } from "../quote-answer";
|
|
312
|
-
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";
|
|
313
318
|
import {
|
|
319
|
+
describeCarrySides,
|
|
314
320
|
describeShortRate,
|
|
321
|
+
forwardCarry,
|
|
322
|
+
shortRateGrowthText,
|
|
315
323
|
formatForwardPoints,
|
|
316
|
-
formatRatePercent,
|
|
317
324
|
formatSignedPercent,
|
|
318
325
|
IMPLIED_FORWARD_LABEL,
|
|
319
326
|
impliedForward,
|
|
@@ -326,7 +333,7 @@ import { unavailableOnServer } from "../../plugins/builtin/shared/cloud-resource
|
|
|
326
333
|
const utcClock = (time: number) => new Date(time).toISOString().slice(11, 16);
|
|
327
334
|
|
|
328
335
|
/** `fx`'s forward form, for its usage line. */
|
|
329
|
-
const FX_FORWARD_USAGE = "fx <base>/<quote> --forward <tenor>";
|
|
336
|
+
const FX_FORWARD_USAGE = "fx [amount] <base>/<quote> --forward <tenor>";
|
|
330
337
|
import {
|
|
331
338
|
holderListFacts,
|
|
332
339
|
holderListPeriod,
|
|
@@ -723,15 +730,15 @@ function compareColumns() {
|
|
|
723
730
|
value: (row: QuoteRow) => exportFigure(row.rawPreviousClose),
|
|
724
731
|
format: (_value: unknown, row: QuoteRow) => yieldLevelCell(row.previousClose, row),
|
|
725
732
|
},
|
|
726
|
-
// A narrow terminal
|
|
733
|
+
// A narrow terminal moves these under their row, as the quote table does, before it cuts the names short.
|
|
727
734
|
// An export writes the range as plain numbers (12.5-13.1), and each end as a number in Day Low and Day High.
|
|
728
735
|
{
|
|
729
|
-
key: "dayRange", header: "Day Range", align: "right" as const,
|
|
736
|
+
key: "dayRange", header: "Day Range", align: "right" as const, stackPriority: 1,
|
|
730
737
|
value: (row: QuoteRow) => row.rawDayLow != null && row.rawDayHigh != null ? `${exportFigure(row.rawDayLow)}-${exportFigure(row.rawDayHigh)}` : "",
|
|
731
738
|
format: (_value: unknown, row: QuoteRow) => row.dayRange,
|
|
732
739
|
},
|
|
733
|
-
{ key: "volume", header: "Volume", align: "right" as const, format: formatCountCell,
|
|
734
|
-
{ key: "currency", header: "Cur", shrink: false,
|
|
740
|
+
{ key: "volume", header: "Volume", align: "right" as const, format: formatCountCell, stackPriority: 2 },
|
|
741
|
+
{ key: "currency", header: "Cur", shrink: false, stackPriority: 3, format: currencyCell },
|
|
735
742
|
...CHANGE_BASIS_EXPORT_COLUMNS,
|
|
736
743
|
...EXTENDED_CHANGE_EXPORT_COLUMNS,
|
|
737
744
|
...DAY_RANGE_EXPORT_COLUMNS,
|
|
@@ -779,6 +786,16 @@ function quoteSessionFields(quote: Quote | null | undefined) {
|
|
|
779
786
|
return quote?.changeBasis === "none" ? { ...fields, change: null, changePercent: null } : fields;
|
|
780
787
|
}
|
|
781
788
|
|
|
789
|
+
/**
|
|
790
|
+
* The listing a row names: a vendor's suffixed symbol as the listing its
|
|
791
|
+
* quote confirms (2330.TW as 2330:TWSE), as RV, the portfolios and the panes
|
|
792
|
+
* name it; any other as asked.
|
|
793
|
+
*/
|
|
794
|
+
function quoteRowSymbol(result: Pick<QuoteCliRecord, "target" | "quote">): string {
|
|
795
|
+
const venue = listingSuffixVenue(result.target.symbol, canonicalExchange(result.quote?.listingExchangeName || result.quote?.exchangeName) || undefined);
|
|
796
|
+
return venue ? `${venue.symbol}:${venue.exchange}` : result.target.symbol;
|
|
797
|
+
}
|
|
798
|
+
|
|
782
799
|
function quoteRows(results: QuoteCliRecord[], now = Date.now()) {
|
|
783
800
|
return results.map((result) => {
|
|
784
801
|
const quote = result.quote;
|
|
@@ -814,7 +831,7 @@ function quoteRows(results: QuoteCliRecord[], now = Date.now()) {
|
|
|
814
831
|
const previousClose = display.price != null && display.change != null ? display.price - display.change : quote?.previousClose;
|
|
815
832
|
const last = price(display.price);
|
|
816
833
|
return {
|
|
817
|
-
symbol: result
|
|
834
|
+
symbol: quoteRowSymbol(result),
|
|
818
835
|
name: quote?.name || result.listing?.name || "",
|
|
819
836
|
price: `${last}${per}`,
|
|
820
837
|
pence: penceFigure(display.price, quote, /\.(\d+)/.exec(last)?.[1]?.length ?? 0),
|
|
@@ -1312,9 +1329,13 @@ function refusedLine(refused: ReadonlyArray<{ input: string }>): string {
|
|
|
1312
1329
|
return `Not ${refused.length === 1 ? "a symbol" : "symbols"}, not quoted: ${refusedList(refused)}.`;
|
|
1313
1330
|
}
|
|
1314
1331
|
|
|
1315
|
-
/**
|
|
1332
|
+
/**
|
|
1333
|
+
* A symbol of a list that names no listing: `Not quoted: EQT:NYSE:US (Unknown exchange US for EQT:NYSE).`, or
|
|
1334
|
+
* after it a reason of several sentences: `Not quoted: iron ore. Iron ore: no live price (...). ...`.
|
|
1335
|
+
*/
|
|
1316
1336
|
function unreadLine({ symbol, error }: { symbol: string; error: ListingArgError }): string {
|
|
1317
|
-
|
|
1337
|
+
const reason = error.message.replace(/\.$/, "");
|
|
1338
|
+
return reason.includes(". ") ? `Not quoted: ${symbol}. ${reason}.` : `Not quoted: ${symbol} (${reason}).`;
|
|
1318
1339
|
}
|
|
1319
1340
|
|
|
1320
1341
|
/**
|
|
@@ -1618,11 +1639,16 @@ async function loadListingHistory(
|
|
|
1618
1639
|
const loaded = quote || window ? answered : await stoppedUsListingHistory(listing, market, loadRange, context, answered);
|
|
1619
1640
|
// With no quote and no bar in over a month, when the listing last traded is said first.
|
|
1620
1641
|
const lastTraded = quote || window ? null : noQuoteLastTraded(loaded);
|
|
1621
|
-
|
|
1642
|
+
// The size the bars were served in, else the one asked for, never their spacing alone: B95 on SGX trades a few
|
|
1643
|
+
// times a month, and its daily bars a week or two apart are still daily (requestedBarSize).
|
|
1644
|
+
const asked = window ? priceWindowInterval(window) : RANGE_HISTORY_RESOLUTION[loadRange];
|
|
1645
|
+
const resolution = loaded.resolution ?? (dailyOrLongerBarSize(asked).barSize
|
|
1646
|
+
? requestedBarSize(loaded.points.map((point) => new Date(point.date).getTime()), asked as "1d" | "1wk" | "1mo") : null);
|
|
1622
1647
|
// While the session trades the day's bar is the quote's, whatever range the history was cut for (withSessionBar).
|
|
1623
1648
|
// A window that ended before today has no session in progress.
|
|
1624
1649
|
const points = window && isPastPriceWindow(window) ? loaded.points
|
|
1625
|
-
: withSessionBar(loaded.points, quote, { now: Date.now(), venue: quote?.listingExchangeName || exchange || undefined
|
|
1650
|
+
: withSessionBar(loaded.points, quote, { now: Date.now(), venue: quote?.listingExchangeName || exchange || undefined,
|
|
1651
|
+
...dailyOrLongerBarSize(resolution) });
|
|
1626
1652
|
const fromQuote = points !== loaded.points;
|
|
1627
1653
|
const identity = listingIdentity(listing, quote);
|
|
1628
1654
|
// Without a quote currency, the listing metadata research reads (as `ticker` does) may still state it.
|
|
@@ -1676,7 +1702,8 @@ async function loadListingHistory(
|
|
|
1676
1702
|
...(volumeNote ? { note: volumeNote } : {}),
|
|
1677
1703
|
}) : rowsFreshness(data, {
|
|
1678
1704
|
...source,
|
|
1679
|
-
|
|
1705
|
+
// The size the heading names (served, else asked for), not the spacing a thin listing's few trades leave.
|
|
1706
|
+
...barHistoryFreshness(intraday ? null : interval ?? barResolutionFromDates(data.map((row) => row.date))),
|
|
1680
1707
|
observedKey: "date",
|
|
1681
1708
|
oldest: null,
|
|
1682
1709
|
cadenceExchange: venue,
|
|
@@ -1885,8 +1912,13 @@ async function runHistory(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
1885
1912
|
: { ...column, format: historyVolumeCell(() => missingVolume) });
|
|
1886
1913
|
// The largest fall from a close to a later one in the bars shown, said under the heading: within one contract
|
|
1887
1914
|
// of a continuous future, never from one month's close to another's across a roll.
|
|
1888
|
-
|
|
1915
|
+
// A yield (^TNX) falls and rises by its level, in bp, and its largest rise is said too.
|
|
1916
|
+
const yieldUnits = isYieldIndexSymbol(history.listing.symbol);
|
|
1917
|
+
const contractDrawdown = historyContractDrawdown(data, yieldUnits ? "yield" : "return");
|
|
1889
1918
|
const drawdown = contractDrawdown?.drawdown ?? null;
|
|
1919
|
+
const runUp = yieldUnits ? maxRunUp(data) : null;
|
|
1920
|
+
const moveText = interval ? { basis: `${BAR_INTERVAL_LABELS[interval]} closes${contractDrawdown?.contract ? `, ${contractDrawdown.contract}` : ""}`, price,
|
|
1921
|
+
date: (text: string) => intraday ? formatUtcTime(text) : text.slice(0, 10) } : null;
|
|
1890
1922
|
ctx.printResult({
|
|
1891
1923
|
data,
|
|
1892
1924
|
metadata: {
|
|
@@ -1904,6 +1936,7 @@ async function runHistory(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
1904
1936
|
unbrokenFrom: historyUnbrokenFrom(data) ?? data[0]?.date ?? null,
|
|
1905
1937
|
bars: data.length,
|
|
1906
1938
|
maxDrawdown: drawdown && contractDrawdown?.contract ? { ...drawdown, contract: contractDrawdown.contract } : drawdown,
|
|
1939
|
+
...(runUp ? { maxRunUp: runUp } : {}),
|
|
1907
1940
|
asOf: freshness?.asOf ?? null,
|
|
1908
1941
|
...(volume ? { volumeUnit: volume.unit, volumePeriod: interval === "1d" ? "UTC day" : interval } : {}),
|
|
1909
1942
|
...(stitched ? { backAdjust: { method: backAdjust, rolls: stitched.rolls, ...(stitched.unstitched.length > 0 ? { unstitched: stitched.unstitched } : {}) } } : {}),
|
|
@@ -1912,9 +1945,8 @@ async function runHistory(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
1912
1945
|
freshness,
|
|
1913
1946
|
}, {
|
|
1914
1947
|
heading: [listingHeading(frontMonthIdentity(identity, history.listing.symbol, data)), cliStyles.muted(historyFacts(unit, data).join(" · ")),
|
|
1915
|
-
...drawdown &&
|
|
1916
|
-
|
|
1917
|
-
date: (text) => intraday ? formatUtcTime(text) : text.slice(0, 10) }))] : []].join("\n"),
|
|
1948
|
+
...drawdown && moveText ? [cliStyles.muted(maxDrawdownText(drawdown, moveText))] : [],
|
|
1949
|
+
...runUp && moveText ? [cliStyles.muted(maxRunUpText(runUp, moveText))] : []].join("\n"),
|
|
1918
1950
|
dateKey: "date",
|
|
1919
1951
|
textColumns: [...textColumns, HISTORY_FLAG_TEXT_COLUMN],
|
|
1920
1952
|
// One header whatever the market is doing, for one symbol as for a list (historyExportColumns).
|
|
@@ -2502,7 +2534,7 @@ const newsRowNote = (row: Record<string, unknown>) => typeof row.summary === "st
|
|
|
2502
2534
|
async function printNewsSearch(
|
|
2503
2535
|
text: string,
|
|
2504
2536
|
articles: NewsArticle[],
|
|
2505
|
-
{ reason, empty, commodity = true, failure, ticker = null, closest = false }: {
|
|
2537
|
+
{ reason, empty, commodity = true, failure, ticker = null, closest = false, listing }: {
|
|
2506
2538
|
reason?: string;
|
|
2507
2539
|
empty?: string;
|
|
2508
2540
|
commodity?: boolean;
|
|
@@ -2511,6 +2543,8 @@ async function printNewsSearch(
|
|
|
2511
2543
|
ticker?: string | null;
|
|
2512
2544
|
/** No story has every word: these are the ones with the most. */
|
|
2513
2545
|
closest?: boolean;
|
|
2546
|
+
/** The listing the typed word also names, and how to read its news: a bank's short name ahead of a listing abroad. */
|
|
2547
|
+
listing?: { key: string; note: string };
|
|
2514
2548
|
},
|
|
2515
2549
|
ctx: Parameters<CliCommandDef["execute"]>[1],
|
|
2516
2550
|
) {
|
|
@@ -2521,7 +2555,8 @@ async function printNewsSearch(
|
|
|
2521
2555
|
ctx.printResult({
|
|
2522
2556
|
data: articles,
|
|
2523
2557
|
...(searched ? {} : { warnings: [`Searching stories for "${text}" failed: ${failure}`] }),
|
|
2524
|
-
metadata: { ticker, search: text, feed: null, ...(closestReason ? { match: "closest" } : {}), ...(route ? { futuresNews: route.command } : {})
|
|
2558
|
+
metadata: { ticker, search: text, feed: null, ...(closestReason ? { match: "closest" } : {}), ...(route ? { futuresNews: route.command } : {}),
|
|
2559
|
+
...(listing ? { listing: listing.key } : {}) },
|
|
2525
2560
|
freshness: rowsFreshness(newsRows(articles), cloudNewsFreshness(await cloudRealtimeAccess())),
|
|
2526
2561
|
}, {
|
|
2527
2562
|
heading: newsSearchHeading(text, [reason, closestReason].filter(Boolean).join(" · ") || undefined),
|
|
@@ -2529,6 +2564,7 @@ async function printNewsSearch(
|
|
|
2529
2564
|
columns: NEWS_COLUMNS,
|
|
2530
2565
|
rowNote: newsRowNote,
|
|
2531
2566
|
empty: named ? noStoriesMessage(text, route) : empty ?? (searched ? noStoriesMessage(text, null) : "No stories to show."),
|
|
2567
|
+
...(listing ? { footnote: listing.note } : {}),
|
|
2532
2568
|
});
|
|
2533
2569
|
}
|
|
2534
2570
|
|
|
@@ -2551,8 +2587,8 @@ async function tickerOfWord(word: string, market: MarketContext): Promise<{ symb
|
|
|
2551
2587
|
* name is in capitals, whose company news `news GOLD` keeps.
|
|
2552
2588
|
*/
|
|
2553
2589
|
async function printMetalNews(route: MetalNewsRoute, limit: number, ctx: Parameters<CliCommandDef["execute"]>[1], market?: MarketContext) {
|
|
2554
|
-
const search = searchNewsStories(route.metal, limit, [
|
|
2555
|
-
logFailure("cli.commands-market",
|
|
2590
|
+
const search = searchNewsStories(route.metal, limit, [route.topic]).then((found) => ({ found, failure: undefined }), (error: unknown) => {
|
|
2591
|
+
logFailure("cli.commands-market", `Search ${route.topic} news failed`)(error);
|
|
2556
2592
|
return { found: [] as NewsArticle[], failure: errorMessage(error) ?? "no answer" };
|
|
2557
2593
|
});
|
|
2558
2594
|
const word = route.word;
|
|
@@ -2564,8 +2600,8 @@ async function printMetalNews(route: MetalNewsRoute, limit: number, ctx: Paramet
|
|
|
2564
2600
|
const companyNews = ticker ? `gloom news ${ticker.symbol}` : null;
|
|
2565
2601
|
ctx.printResult({
|
|
2566
2602
|
data: found,
|
|
2567
|
-
...(failure === undefined ? {} : { warnings: [`Searching
|
|
2568
|
-
metadata: { ticker: null, search: route.metal, topics: [
|
|
2603
|
+
...(failure === undefined ? {} : { warnings: [`Searching ${route.label.toLowerCase()} stories for "${route.metal}" failed: ${failure}`] }),
|
|
2604
|
+
metadata: { ticker: null, search: route.metal, topics: [route.topic], feed: null, ...(companyNews ? { companyNews } : {}) },
|
|
2569
2605
|
freshness: rowsFreshness(newsRows(found), cloudNewsFreshness(await cloudRealtimeAccess())),
|
|
2570
2606
|
}, {
|
|
2571
2607
|
heading: metalNewsHeading(route),
|
|
@@ -2588,6 +2624,12 @@ async function runNews(rawArgs: string[], ctx: Parameters<CliCommandDef["execute
|
|
|
2588
2624
|
if (exchangeOption || feed) ctx.fail(`${exchangeOption ? "--exchange" : "--feed"} goes with a symbol, not with text to search stories for.`, "Usage: gloom news <query>");
|
|
2589
2625
|
const problem = newsSearchTextProblem(text);
|
|
2590
2626
|
if (problem) ctx.fail(problem);
|
|
2627
|
+
// "copom selic", "Bank of Mexico": the bank's latest decision stories, under every name it is reported by.
|
|
2628
|
+
const bank = centralBankInNews(text);
|
|
2629
|
+
if (bank) {
|
|
2630
|
+
await printNewsSearch(text, await searchCentralBankStories(bank, limit, text), { reason: centralBankNewsReason(bank), commodity: false }, ctx);
|
|
2631
|
+
return;
|
|
2632
|
+
}
|
|
2591
2633
|
const answer = await searchClosestNewsStories(text, limit);
|
|
2592
2634
|
await printNewsSearch(text, answer.found, { closest: answer.closest }, ctx);
|
|
2593
2635
|
return;
|
|
@@ -2602,6 +2644,28 @@ async function runNews(rawArgs: string[], ctx: Parameters<CliCommandDef["execute
|
|
|
2602
2644
|
await withMarketData(ctx, async (market) => {
|
|
2603
2645
|
const listing = args[0] ? await requireCliListing(args[0], exchangeOption, market, ctx) : null;
|
|
2604
2646
|
const quoteLoad = listing ? loadListingQuote(market.dataProvider, listing) : Promise.resolve(null);
|
|
2647
|
+
// A bank's short name typed on its own (ECB, FED, RBI) is the bank's stories ahead of a listing outside the US
|
|
2648
|
+
// that trades under it (ECB S.A. on the WSE, "No news" on 7 Nov 2026), which its venue still reaches (ECB:WSE).
|
|
2649
|
+
// A US listing (RBA, RB Global) keeps the name.
|
|
2650
|
+
const shortBank = listing && !listing.exchange && !feed && args.length === 1 ? centralBankShortNamed(args[0]!) : null;
|
|
2651
|
+
if (shortBank) {
|
|
2652
|
+
const quote = await quoteLoad;
|
|
2653
|
+
const identity = listingIdentity(listing!, quote);
|
|
2654
|
+
if (!isUsListingExchange(identity.exchange)) {
|
|
2655
|
+
const resolved = quote !== null || identity.name != null;
|
|
2656
|
+
const key = identity.exchange ? `${listing!.symbol}:${identity.exchange}` : null;
|
|
2657
|
+
const typed = args[0]!.trim();
|
|
2658
|
+
const stories = await searchCentralBankStories(shortBank, limit, typed).then((found) => ({ found, failure: undefined }), (error: unknown) => {
|
|
2659
|
+
logFailure("cli.commands-market", "Search a central bank's stories failed")(error);
|
|
2660
|
+
return { found: [], failure: errorMessage(error) ?? "no answer" };
|
|
2661
|
+
});
|
|
2662
|
+
await printNewsSearch(typed, stories.found, {
|
|
2663
|
+
reason: centralBankNewsReason(shortBank), commodity: false, failure: stories.failure,
|
|
2664
|
+
...(resolved && key ? { listing: { key, note: `${typed} is also ${identity.name ?? listing!.symbol} (${identity.exchange}): gloom news ${key}` } } : {}),
|
|
2665
|
+
}, ctx);
|
|
2666
|
+
return;
|
|
2667
|
+
}
|
|
2668
|
+
}
|
|
2605
2669
|
// A coin pair's feed searches for the coin when no story is filed under the pair, by the name its quote gives.
|
|
2606
2670
|
const coin = !!listing && !feed && isRoundTheClockCoin(listing.request.symbol, listing.request.exchange);
|
|
2607
2671
|
const loadNews = async () => market.dataProvider.getNews({
|
|
@@ -2658,23 +2722,28 @@ async function runNews(rawArgs: string[], ctx: Parameters<CliCommandDef["execute
|
|
|
2658
2722
|
return;
|
|
2659
2723
|
}
|
|
2660
2724
|
if (word && reason) {
|
|
2725
|
+
// A central bank's name no ticker answers to ("banxico") is its decision stories, under every name it goes by.
|
|
2726
|
+
const bank = !resolved && !commodity ? centralBankInNews(word) : null;
|
|
2661
2727
|
// The lookup that found no ticker already answered; a search that fails leaves that answer.
|
|
2662
|
-
const search = await searchNewsStories(word, limit).then((found) => ({ found, failure: undefined }), (error: unknown) => {
|
|
2728
|
+
const search = await (bank ? searchCentralBankStories(bank, limit, word) : searchNewsStories(word, limit)).then((found) => ({ found, failure: undefined }), (error: unknown) => {
|
|
2663
2729
|
logFailure("cli.commands-market", "Search news stories failed")(error);
|
|
2664
2730
|
return { found: [], failure: errorMessage(error) ?? "no answer" };
|
|
2665
2731
|
});
|
|
2666
2732
|
const searched = search.failure === undefined;
|
|
2667
|
-
await printNewsSearch(word, search.found, { reason
|
|
2733
|
+
await printNewsSearch(word, search.found, { reason: bank ? `${reason}; ${centralBankNewsReason(bank)}` : reason,
|
|
2734
|
+
empty: emptyMessage(searched && !commodity), commodity: !commodity, failure: search.failure }, ctx);
|
|
2668
2735
|
return;
|
|
2669
2736
|
}
|
|
2670
2737
|
const empty = emptyMessage(false);
|
|
2671
2738
|
// A bare coin ticker read as another listing (ETH, the Grayscale fund) says where the coin is, as `quote` does.
|
|
2672
2739
|
const read = listing ? [...listingReadNotes(listing), ...coinListingNotes(listing, quote)] : [];
|
|
2673
|
-
// A word that is also the company's name ("gold" for Gold.com Inc
|
|
2674
|
-
// to search the stories that mention it instead, when those stories
|
|
2740
|
+
// A word that is also the company's name ("gold" for Gold.com Inc., "peso" for PesoRama on the TSX Venture)
|
|
2741
|
+
// says once which ticker it found and how to search the stories that mention it instead, when those stories
|
|
2742
|
+
// are mostly about something else. The word is bare, so a listing abroad is one the lookup found, not one typed.
|
|
2675
2743
|
const typed = args[0]?.trim() ?? "";
|
|
2676
|
-
const wordHint = listing && resolved && !
|
|
2677
|
-
&& wordMeansMore(await searchNewsStories(typed, 20).catch(logFailure("cli.commands-market", "Search news stories for a ticker word failed", [])), listing.symbol
|
|
2744
|
+
const wordHint = listing && resolved && !feed && !exchangeOption && commonWordCandidate(typed, identity?.name)
|
|
2745
|
+
&& wordMeansMore(await searchNewsStories(typed, 20).catch(logFailure("cli.commands-market", "Search news stories for a ticker word failed", [])), listing.symbol,
|
|
2746
|
+
listing.exchange ? `${listing.symbol}:${listing.exchange}` : listing.symbol)
|
|
2678
2747
|
? `${typed} ${cliArrow("→")} ${identity?.name ?? listing.symbol} (ticker ${listing.symbol}). For stories that mention ${typed.toLowerCase()}, try: ${quotedSearchCommand(typed.toLowerCase())}`
|
|
2679
2748
|
: null;
|
|
2680
2749
|
ctx.printResult({
|
|
@@ -3531,7 +3600,17 @@ async function runOptions(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
3531
3600
|
/** What an options chain export's `interval` says: one quote snapshot, not bars. */
|
|
3532
3601
|
const OPTIONS_EXPORT_INTERVAL = "snapshot";
|
|
3533
3602
|
|
|
3534
|
-
/**
|
|
3603
|
+
/** Saturday or Sunday, for a YYYY-MM-DD day. */
|
|
3604
|
+
function isWeekendDay(date: string): boolean {
|
|
3605
|
+
const day = new Date(`${date}T00:00:00Z`).getUTCDay();
|
|
3606
|
+
return day === 0 || day === 6;
|
|
3607
|
+
}
|
|
3608
|
+
|
|
3609
|
+
/**
|
|
3610
|
+
* `fx --date`: a past day as YYYY-MM-DD, or today on a weekend, which reads the
|
|
3611
|
+
* Friday close; a weekday's close is not in yet, so today is refused then, as
|
|
3612
|
+
* is a day ahead.
|
|
3613
|
+
*/
|
|
3535
3614
|
function readFxDate(value: string, ctx: Parameters<CliCommandDef["execute"]>[1]): string {
|
|
3536
3615
|
let date: string;
|
|
3537
3616
|
try {
|
|
@@ -3541,8 +3620,9 @@ function readFxDate(value: string, ctx: Parameters<CliCommandDef["execute"]>[1])
|
|
|
3541
3620
|
}
|
|
3542
3621
|
if (!date) return ctx.fail("--date takes a day, such as --date 2026-09-02.");
|
|
3543
3622
|
const today = isoDateToday();
|
|
3544
|
-
|
|
3545
|
-
|
|
3623
|
+
// A weekend has no close of its own, so today's, on a Saturday or a Sunday, is the Friday close, which is final.
|
|
3624
|
+
if (date > today || (date === today && !isWeekendDay(date))) {
|
|
3625
|
+
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.");
|
|
3546
3626
|
}
|
|
3547
3627
|
return date;
|
|
3548
3628
|
}
|
|
@@ -3633,10 +3713,57 @@ async function runFxOnDate(
|
|
|
3633
3713
|
});
|
|
3634
3714
|
}
|
|
3635
3715
|
|
|
3716
|
+
/**
|
|
3717
|
+
* What one unit of `quote` (a forward's quote currency) is worth in the
|
|
3718
|
+
* reader's currency at spot, to show a carry in it: 1 when they are the same,
|
|
3719
|
+
* the forward's own spot inverted when the reader's is the pair's base,
|
|
3720
|
+
* otherwise the pair's own quote. Null when no conversion is needed; the
|
|
3721
|
+
* sentence saying why it is missing when no quote came back.
|
|
3722
|
+
*/
|
|
3723
|
+
async function carryInCurrency(
|
|
3724
|
+
quote: string,
|
|
3725
|
+
reader: string,
|
|
3726
|
+
base: string,
|
|
3727
|
+
spot: number,
|
|
3728
|
+
market: MarketContext,
|
|
3729
|
+
forceRefresh: boolean | undefined,
|
|
3730
|
+
): Promise<{ rate: number; text: string } | { missing: string } | null> {
|
|
3731
|
+
if (reader === quote) return null;
|
|
3732
|
+
const marketText = (rate: number) => {
|
|
3733
|
+
const quoted = quotedFxPair(quote, reader, rate);
|
|
3734
|
+
return `${quoted.pair} ${quoted.rate.toFixed(fxRateDigits(quoted.pair.slice(4), quoted.rate))}`;
|
|
3735
|
+
};
|
|
3736
|
+
if (reader === base) return { rate: 1 / spot, text: marketText(1 / spot) };
|
|
3737
|
+
// A failed read is said in the carry's warning, with the reason it gave; the forward itself stands.
|
|
3738
|
+
const read = await readFxQuoteRate(quote, reader, (targets, options) => market.dataProvider.getQuotesBatch(targets, options),
|
|
3739
|
+
{ forceRefresh: forceRefresh === true }).catch((error: unknown) => ({ failed: errorMessage(error) }));
|
|
3740
|
+
if (read && "rate" in read) return { rate: read.rate, text: marketText(read.rate) };
|
|
3741
|
+
const reason = read && "failed" in read && read.failed ? ` (${read.failed})` : "";
|
|
3742
|
+
return { missing: `The carry is not shown in ${reader}, your base currency: no ${quote}/${reader} rate came back${reason}.` };
|
|
3743
|
+
}
|
|
3744
|
+
|
|
3745
|
+
/**
|
|
3746
|
+
* `USD/MXN -0.68% on the day (previous close 18.75924)`: the move of the pair
|
|
3747
|
+
* as markets quote it, as `quote` gives it, whichever way round it was asked.
|
|
3748
|
+
*/
|
|
3749
|
+
function describeFxMove(currency: string, baseCurrency: string, rate: number, move: { percent: number; previousRate: number }): string {
|
|
3750
|
+
const now = quotedFxPair(currency, baseCurrency, rate);
|
|
3751
|
+
const before = quotedFxPair(currency, baseCurrency, move.previousRate);
|
|
3752
|
+
const percent = (now.rate / before.rate - 1) * 100;
|
|
3753
|
+
return `${now.pair} ${formatSignedPercent(percent, 2)} on the day (previous close ${before.rate.toFixed(fxRateDigits(before.pair.slice(4), before.rate))})`;
|
|
3754
|
+
}
|
|
3755
|
+
|
|
3636
3756
|
async function runFx(rawArgs: string[], ctx: Parameters<CliCommandDef["execute"]>[1]) {
|
|
3637
3757
|
const args = [...rawArgs];
|
|
3638
3758
|
const dateOption = takeOption(args, "--date");
|
|
3759
|
+
const forwardAsked = args.some((arg) => arg === "--forward" || arg.startsWith("--forward="));
|
|
3639
3760
|
const forwardOption = takeOption(args, "--forward");
|
|
3761
|
+
// `fx USD/BRL --forward` and `fx --forward USD/BRL` name no tenor: say what --forward takes, never print spot alone
|
|
3762
|
+
// or the bare usage line.
|
|
3763
|
+
if (forwardAsked && (!forwardOption?.trim() || (args.length === 0 && !/^\s*\d/.test(forwardOption)))) {
|
|
3764
|
+
const pair = args.length ? args.join(" ") : forwardOption?.trim() || "<base>/<quote>";
|
|
3765
|
+
ctx.fail("--forward takes a tenor: 30d, 2w, 3m, up to 1y.", `For the 3-month forward: gloom fx ${pair} --forward 3m`);
|
|
3766
|
+
}
|
|
3640
3767
|
if (args.length === 0) ctx.fail(`Usage: gloom ${FX_USAGE}`);
|
|
3641
3768
|
// A forward is implied from today's spot and the latest short rates, which are all Gloom Cloud serves.
|
|
3642
3769
|
if (dateOption != null && forwardOption != null) {
|
|
@@ -3655,9 +3782,11 @@ async function runFx(rawArgs: string[], ctx: Parameters<CliCommandDef["execute"]
|
|
|
3655
3782
|
const { request, amount, toUsdByDefault } = parsed;
|
|
3656
3783
|
const { currency, baseCurrency } = request;
|
|
3657
3784
|
const pair = `${currency}/${baseCurrency}`;
|
|
3658
|
-
if (tenor) {
|
|
3659
|
-
|
|
3660
|
-
|
|
3785
|
+
if (tenor && currency === baseCurrency) ctx.fail(`${pair} has no forward: both sides are ${currency}.`, `Usage: gloom ${FX_FORWARD_USAGE}`);
|
|
3786
|
+
// A carry is on an amount held: zero or less holds nothing, and a sign would turn who earns it around.
|
|
3787
|
+
if (tenor && amount != null && !(amount > 0)) {
|
|
3788
|
+
ctx.fail(`The carry is on an amount above zero; ${args[0]!.trim()} is not.`,
|
|
3789
|
+
`For the forward alone, drop the amount: gloom fx ${pair} --forward ${forwardOption}.`);
|
|
3661
3790
|
}
|
|
3662
3791
|
// The short rates are read alongside spot. A failed read is held as a value, not left to reject
|
|
3663
3792
|
// unobserved while spot loads, and is raised where the forward needs the rates.
|
|
@@ -3693,8 +3822,11 @@ async function runFx(rawArgs: string[], ctx: Parameters<CliCommandDef["execute"]
|
|
|
3693
3822
|
// A rate older than its feed's delay is stale, as `quote` says of the same quote.
|
|
3694
3823
|
const stale = observation?.stale === true;
|
|
3695
3824
|
const converted = amount == null ? null : amount * rate;
|
|
3825
|
+
// The day's move, as `quote` gives the pair's: against the previous daily close.
|
|
3826
|
+
const move = quoted ? fxQuoteRateMove(quoted) : null;
|
|
3696
3827
|
const row = {
|
|
3697
3828
|
currency, baseCurrency, rate, asOf, stale, pair, inverse: 1 / rate,
|
|
3829
|
+
...(move ? { changePercent: move.percent, previousClose: move.previousRate } : {}),
|
|
3698
3830
|
...(quoted ? { quotes: quoted.quotes.map(({ symbol }) => symbol), ...(quoted.viaUsd ? { via: "USD" } : {}) } : {}),
|
|
3699
3831
|
...(quoted?.derivedFrom ? { derived: true, derivedFrom: quoted.derivedFrom } : {}),
|
|
3700
3832
|
...(amount == null ? {} : { amount, converted }),
|
|
@@ -3722,7 +3854,8 @@ async function runFx(rawArgs: string[], ctx: Parameters<CliCommandDef["execute"]
|
|
|
3722
3854
|
const forwardDate = new Date(Math.floor(Date.now() / 86_400_000) * 86_400_000 + tenor.days * 86_400_000).toISOString().slice(0, 10);
|
|
3723
3855
|
const rateFields = (short: typeof base.rate) => ({
|
|
3724
3856
|
currency: short.currency, name: short.name, tenor: short.tenor, value: short.value, asOf: short.asOf,
|
|
3725
|
-
dayCountBasis: short.dayCountBasis,
|
|
3857
|
+
dayCountBasis: short.dayCountBasis, ...(short.compounding ? { compounding: short.compounding } : {}),
|
|
3858
|
+
publisher: short.publisher, sourceUrl: short.sourceUrl, stale: short.stale,
|
|
3726
3859
|
...(short.attribution ? { attribution: short.attribution } : {}),
|
|
3727
3860
|
});
|
|
3728
3861
|
// A publisher's licence asks for its attribution wherever its rate is shown (MAS's SORA).
|
|
@@ -3730,21 +3863,54 @@ async function runFx(rawArgs: string[], ctx: Parameters<CliCommandDef["execute"]
|
|
|
3730
3863
|
? [`${short.name}: ${short.attribution.text.replace(/\.$/, "")} (${short.attribution.licenceUrl}).`] : []))];
|
|
3731
3864
|
const staleRates = [base.rate, quote.rate].filter((short) => short.stale)
|
|
3732
3865
|
.map((short) => `${short.name} (${short.currency}) is the last copy read, dated ${short.asOf ?? "undated"}; its source could not be read since.`);
|
|
3866
|
+
// With an amount, the carry: the forward points on it over the tenor, in the quote currency and in the
|
|
3867
|
+
// reader's base currency at spot, and the side that earns it.
|
|
3868
|
+
const carry = amount == null ? null : forwardCarry(amount, implied);
|
|
3869
|
+
const readerCurrency = market.config.baseCurrency;
|
|
3870
|
+
const carryConversion = carry ? await carryInCurrency(baseCurrency, readerCurrency, currency, rate, market, ctx.cliOptions.refresh) : null;
|
|
3733
3871
|
const forwardRow = {
|
|
3734
3872
|
pair, tenor: tenor.label, days: tenor.days, forwardDate, spot: rate, spotAsOf: asOf, forward: implied.forward,
|
|
3735
3873
|
points: implied.points, pointSize: implied.pointSize, premiumPercent: implied.premiumPercent, annualizedPercent: implied.annualizedPercent,
|
|
3736
3874
|
baseRate: rateFields(base.rate), quoteRate: rateFields(quote.rate), method: "covered interest parity", label: IMPLIED_FORWARD_LABEL,
|
|
3875
|
+
...(carry ? {
|
|
3876
|
+
amount, carry: carry.value, carryCurrency: baseCurrency, carryEarnedBy: carry.earnedBy,
|
|
3877
|
+
...(carryConversion && "rate" in carryConversion
|
|
3878
|
+
? { carryConverted: carry.value * carryConversion.rate, carryConvertedCurrency: readerCurrency, carryConversionRate: carryConversion.rate }
|
|
3879
|
+
: {}),
|
|
3880
|
+
} : {}),
|
|
3737
3881
|
};
|
|
3738
|
-
const growth = (short: typeof base.rate) =>
|
|
3882
|
+
const growth = (short: typeof base.rate) => shortRateGrowthText(short, tenor.days);
|
|
3883
|
+
const compoundedOverBusinessDays = [base.rate, quote.rate].filter((short) => short.compounding === "business-252").map((short) => short.name);
|
|
3884
|
+
const compoundedDaily = [base.rate, quote.rate].filter((short) => short.compounding === "daily-365").map((short) => short.name);
|
|
3885
|
+
const simple = [base.rate, quote.rate].filter((short) => !short.compounding).map((short) => short.name);
|
|
3886
|
+
// How each leg grows, named: a compounded rate by how it compounds, the rest as simple interest.
|
|
3887
|
+
const growthNote = [
|
|
3888
|
+
...compoundedOverBusinessDays.length > 0
|
|
3889
|
+
? [`${compoundedOverBusinessDays.join(" and ")} compounds over business days (252 a year, taken as 252/365 of the ${tenor.days} days)`] : [],
|
|
3890
|
+
...compoundedDaily.length > 0 ? [`${compoundedDaily.join(" and ")} compounds daily on ACT/365`] : [],
|
|
3891
|
+
...simple.length === 2 ? [`each rate earns simple interest over the ${tenor.days} days`]
|
|
3892
|
+
: simple.length === 1 ? [`${simple[0]} earns simple interest`] : [],
|
|
3893
|
+
].join(", ");
|
|
3739
3894
|
// A currency typed as its name (yen) says which code it was read as, as the spot answer does.
|
|
3740
|
-
const forwardWarnings = [
|
|
3895
|
+
const forwardWarnings = [
|
|
3896
|
+
...request.readAs ?? [], ...rateNotes, ...staleRates,
|
|
3897
|
+
...toUsdByDefault && amount != null
|
|
3898
|
+
? [`No second currency given, so ${currency} is priced against USD; for another, write fx ${args[0]!.trim()} ${currency}/<to> --forward ${tenor.label}.`]
|
|
3899
|
+
: [],
|
|
3900
|
+
...carryConversion && "missing" in carryConversion ? [carryConversion.missing] : [],
|
|
3901
|
+
];
|
|
3741
3902
|
return ctx.printResult({ data: [forwardRow], freshness, ...(forwardWarnings.length > 0 ? { warnings: forwardWarnings } : {}) }, {
|
|
3742
3903
|
text: () => [
|
|
3743
3904
|
`${pair} ${tenor.label} forward ${formatFxRate(implied.forward)}, ${IMPLIED_FORWARD_LABEL}`,
|
|
3744
3905
|
`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})`,
|
|
3745
3906
|
`${currency} rate: ${describeShortRate(base.rate)}`,
|
|
3746
3907
|
`${baseCurrency} rate: ${describeShortRate(quote.rate)}`,
|
|
3747
|
-
`Covered interest parity: ${formatFxRate(rate)} × ${growth(quote.rate)} / ${growth(base.rate)};
|
|
3908
|
+
`Covered interest parity: ${formatFxRate(rate)} × ${growth(quote.rate)} / ${growth(base.rate)}; ${growthNote}, standing in for a ${tenor.label} term rate.`,
|
|
3909
|
+
...carry ? [
|
|
3910
|
+
`Carry on ${formatFxAmount(carry.amount, currency)} over ${tenor.days} days: ${formatFxAmount(carry.value, baseCurrency)}${carryConversion && "rate" in carryConversion
|
|
3911
|
+
? `, ${formatFxAmount(carry.value * carryConversion.rate, readerCurrency)} at spot ${carryConversion.text}` : ""}`,
|
|
3912
|
+
describeCarrySides(carry, currency, baseCurrency, tenor.days),
|
|
3913
|
+
] : [],
|
|
3748
3914
|
...attributions,
|
|
3749
3915
|
].join("\n"),
|
|
3750
3916
|
exportIdentity: { symbolOrSeries: pair, currencyOrUnit: `${baseCurrency} per ${currency}`, interval: `forward ${tenor.label}` },
|
|
@@ -3758,6 +3924,15 @@ async function runFx(rawArgs: string[], ctx: Parameters<CliCommandDef["execute"]
|
|
|
3758
3924
|
{ key: "points", header: "Points", align: "right" },
|
|
3759
3925
|
{ key: "premiumPercent", header: "Premium %", align: "right" },
|
|
3760
3926
|
{ key: "annualizedPercent", header: "Annualized %", align: "right" },
|
|
3927
|
+
...(carry ? [
|
|
3928
|
+
{ key: "amount", header: "Amount", align: "right" as const },
|
|
3929
|
+
{ key: "carry", header: "Carry", align: "right" as const },
|
|
3930
|
+
{ key: "carryCurrency", header: "Carry currency" },
|
|
3931
|
+
{ key: "carryEarnedBy", header: "Earned by" },
|
|
3932
|
+
...(carryConversion && "rate" in carryConversion ? [
|
|
3933
|
+
{ key: "carryConverted", header: `Carry (${readerCurrency})`, align: "right" as const },
|
|
3934
|
+
] : []),
|
|
3935
|
+
] : []),
|
|
3761
3936
|
],
|
|
3762
3937
|
});
|
|
3763
3938
|
}
|
|
@@ -3783,6 +3958,7 @@ async function runFx(rawArgs: string[], ctx: Parameters<CliCommandDef["execute"]
|
|
|
3783
3958
|
const metal = quoted?.derivedFrom ? (METAL_NAMES[currency] ? currency : baseCurrency) : null;
|
|
3784
3959
|
const rateText = [
|
|
3785
3960
|
describeFxRate(request, rate, quoted && !quoted.viaUsd ? quoted.quotes[0] : undefined),
|
|
3961
|
+
...move ? [describeFxMove(currency, baseCurrency, rate, move)] : [],
|
|
3786
3962
|
...quoted?.viaUsd ? [describeFxLegs(quoted.quotes)] : [],
|
|
3787
3963
|
...metal ? [`derived: ${METAL_NAMES[metal]!.toLowerCase()} from ${quoted!.derivedFrom}, the front-month future (spot ${METAL_NAMES[metal]!.toLowerCase()} is not quoted)`] : [],
|
|
3788
3964
|
...peso ? [`${peso.spotKind} rate`] : [],
|
|
@@ -3804,6 +3980,10 @@ async function runFx(rawArgs: string[], ctx: Parameters<CliCommandDef["execute"]
|
|
|
3804
3980
|
{ key: "stale", header: "Stale" },
|
|
3805
3981
|
{ key: "pair", header: "Pair" },
|
|
3806
3982
|
{ key: "inverse", header: "Inverse", align: "right" },
|
|
3983
|
+
...(move ? [
|
|
3984
|
+
{ key: "changePercent", header: "Chg %", align: "right" as const },
|
|
3985
|
+
{ key: "previousClose", header: "Previous close", align: "right" as const },
|
|
3986
|
+
] : []),
|
|
3807
3987
|
...(amount == null ? [] : [
|
|
3808
3988
|
{ key: "amount", header: "Amount", align: "right" as const },
|
|
3809
3989
|
{ key: "converted", header: "Converted", align: "right" as const },
|
|
@@ -3898,7 +4078,7 @@ export const marketDataCliCommands: BuiltinCliCommandDef[] = [
|
|
|
3898
4078
|
options: [EXCHANGE_OPTION, LIST_FILE_OPTION],
|
|
3899
4079
|
sections: [QUOTE_CSV_SECTION],
|
|
3900
4080
|
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",
|
|
3901
|
-
"quote --file holdings.csv --csv
|
|
4081
|
+
"quote --file holdings.csv --csv --output quotes.csv"],
|
|
3902
4082
|
},
|
|
3903
4083
|
execute: (args, ctx) => runQuote(args, ctx, "quote"),
|
|
3904
4084
|
},
|
|
@@ -3935,7 +4115,7 @@ export const marketDataCliCommands: BuiltinCliCommandDef[] = [
|
|
|
3935
4115
|
`Each range comes in one bar size: ${historyIntervalsByRange()}. The line under the heading, and the --json metadata, give the currency, the bar size actually served, the first and last bar and the bar count. A warning says when the bars are coarser, or start later, than the range asked for, and for a coin, which trades every day, names each day it has no bar for.`,
|
|
3936
4116
|
"A bar whose prices contradict each other (high below the open or close, or low above them) is left blank and flagged, such as high<open, with the count in a warning. A low under half the open and close, or a high over twice them, is left blank alone and flagged low<close/2 or high>2*open. --json rows carry currency, unit, interval and flag.",
|
|
3937
4117
|
"A break in the series flags the bar after it, which keeps its prices: gap after more than three months with no bar (weeks for weekly, daily and intraday bars), jump when the close is over 100 times the one before or under a hundredth of it. A warning names each break, and the heading says the date the series runs unbroken from.",
|
|
3938
|
-
"The heading's last line is the max drawdown of the bars shown: the largest fall from a close to a later close, with the peak and the trough, their dates, and the date a close got back to the peak, if one did (maxDrawdown in --json).",
|
|
4118
|
+
"The heading's last line is the max drawdown of the bars shown: the largest fall from a close to a later close, with the peak and the trough, their dates, and the date a close got back to the peak, if one did (maxDrawdown in --json). A yield (^TNX) reads it in bp, with its max run-up beside it: the largest rise from a close to a later close, found on its own (maxRunUp).",
|
|
3939
4119
|
],
|
|
3940
4120
|
}, {
|
|
3941
4121
|
title: "CSV",
|
|
@@ -3959,8 +4139,8 @@ export const marketDataCliCommands: BuiltinCliCommandDef[] = [
|
|
|
3959
4139
|
}],
|
|
3960
4140
|
examples: [
|
|
3961
4141
|
"history AAPL", "history BHP:ASX --range 5Y", "history JPM --from 2007 --to 2009", "history ZAR=X --range ALL", "history ZAR=X --tail 5",
|
|
3962
|
-
"history AAPL --range 5Y --csv
|
|
3963
|
-
"history --file holdings.txt --start 2024-01-01 --end 2024-12-31 --csv
|
|
4142
|
+
"history AAPL --range 5Y --csv --output aapl.csv", "history AAPL MSFT 000660.KS --range 1M --csv",
|
|
4143
|
+
"history --file holdings.txt --start 2024-01-01 --end 2024-12-31 --csv --output bars.csv",
|
|
3964
4144
|
],
|
|
3965
4145
|
},
|
|
3966
4146
|
unknownOptionHint: historyOptionHint,
|
|
@@ -4062,7 +4242,7 @@ export const marketDataCliCommands: BuiltinCliCommandDef[] = [
|
|
|
4062
4242
|
group: CLI_COMMAND_GROUPS.companyData,
|
|
4063
4243
|
usage: ["financials <symbol>"],
|
|
4064
4244
|
options: [EXCHANGE_OPTION, TABLE_SECTION_OPTION],
|
|
4065
|
-
examples: ["financials MSFT", "financials SAN:EPA", "financials MSFT --json", "financials MSFT --csv
|
|
4245
|
+
examples: ["financials MSFT", "financials SAN:EPA", "financials MSFT --json", "financials MSFT --csv --output msft.csv"],
|
|
4066
4246
|
},
|
|
4067
4247
|
unknownOptionHint: financialsOptionHint,
|
|
4068
4248
|
execute: (args, ctx) => runFinancials(args, ctx, "statements"),
|
|
@@ -4216,14 +4396,14 @@ export const marketDataCliCommands: BuiltinCliCommandDef[] = [
|
|
|
4216
4396
|
usage: ["fx <currency>", "fx <base>/<quote>", "fx <amount> <from>/<to>", "fx <amount> <from> <to>", "fx <pair> --date <day>", FX_FORWARD_USAGE],
|
|
4217
4397
|
options: [
|
|
4218
4398
|
{ 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` },
|
|
4219
|
-
{ 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" },
|
|
4399
|
+
{ 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" },
|
|
4220
4400
|
],
|
|
4221
4401
|
sections: [{
|
|
4222
4402
|
title: "Direction",
|
|
4223
4403
|
lines: [
|
|
4224
4404
|
"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.",
|
|
4225
4405
|
"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.",
|
|
4226
|
-
"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
|
|
4406
|
+
"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.",
|
|
4227
4407
|
],
|
|
4228
4408
|
}, {
|
|
4229
4409
|
title: "Amounts",
|
|
@@ -4233,16 +4413,17 @@ export const marketDataCliCommands: BuiltinCliCommandDef[] = [
|
|
|
4233
4413
|
}, {
|
|
4234
4414
|
title: "A past day",
|
|
4235
4415
|
lines: [
|
|
4236
|
-
"--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).",
|
|
4416
|
+
"--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).",
|
|
4237
4417
|
],
|
|
4238
4418
|
}, {
|
|
4239
4419
|
title: "Forwards",
|
|
4240
4420
|
lines: [
|
|
4241
|
-
"--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.",
|
|
4242
|
-
"The rates are SOFR (USD), €STR (EUR), SONIA (GBP)
|
|
4421
|
+
"--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.",
|
|
4422
|
+
"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.",
|
|
4423
|
+
"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.",
|
|
4243
4424
|
],
|
|
4244
4425
|
}],
|
|
4245
|
-
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"],
|
|
4426
|
+
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"],
|
|
4246
4427
|
},
|
|
4247
4428
|
execute: runFx,
|
|
4248
4429
|
},
|