@gloom-sh/terminal 0.20.16 → 0.20.18
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/package.json +3 -1
- package/src/account/auth-dialog.tsx +19 -1
- package/src/account/billing.ts +2 -1
- package/src/account/heard-from-question.tsx +235 -0
- package/src/account/heard-from.ts +97 -0
- package/src/api-client/data.ts +16 -5
- package/src/api-client/heard-from.ts +72 -0
- package/src/api-client/index.ts +63 -6
- package/src/api-client/mna.ts +18 -0
- package/src/api-client/supply-chain.ts +9 -0
- package/src/api-client/types/billing.ts +35 -1
- package/src/api-client/types/econ.ts +3 -0
- package/src/app/global-shortcuts.ts +5 -3
- package/src/app/pro-welcome/keys.ts +27 -0
- package/src/app/pro-welcome/model.ts +158 -0
- package/src/app/pro-welcome/row.tsx +176 -0
- package/src/app/pro-welcome/use-pro-welcome.ts +156 -0
- package/src/app/runtime/external-profile-changes.ts +135 -0
- package/src/app.tsx +33 -2
- package/src/architecture/core-builtin-allowlist.json +1 -1
- package/src/architecture/floating-promise-allowlist.json +0 -1
- package/src/architecture/shortcut-labels-allowlist.json +1 -0
- package/src/cli/alert-listing.ts +98 -0
- package/src/cli/commands/fred-series.ts +3 -1
- package/src/cli/commands/market.ts +138 -22
- package/src/cli/commands/overview.ts +72 -14
- package/src/cli/commands/plugins.ts +3 -2
- package/src/cli/commands/search.ts +30 -6
- package/src/cli/context.ts +16 -5
- package/src/cli/csv-export.ts +74 -0
- package/src/cli/desktop-pane-shot.ts +75 -11
- package/src/cli/glossary.ts +64 -10
- package/src/cli/help.ts +4 -2
- package/src/cli/history-demergers.ts +117 -0
- package/src/cli/history-rows.ts +6 -2
- package/src/cli/index.ts +1 -0
- package/src/cli/known-gaps.ts +16 -0
- package/src/cli/known-us-stocks.ts +18 -0
- package/src/cli/listing-arg.ts +105 -15
- package/src/cli/pane-functions/catalog-snapshot-build.ts +83 -0
- package/src/cli/pane-functions/catalog-snapshot.json +866 -0
- package/src/cli/pane-functions/catalog-snapshot.ts +62 -0
- package/src/cli/pane-functions/catalog.ts +50 -16
- package/src/cli/pane-functions/data.ts +16 -4
- package/src/cli/pane-functions/dom.ts +24 -6
- package/src/cli/pane-functions/freshness.ts +17 -1
- package/src/cli/pane-functions/headless.ts +7 -2
- package/src/cli/pane-functions/index.ts +102 -44
- package/src/cli/pane-functions/resolver.ts +8 -5
- package/src/cli/pane-functions/screenshot-assessment.ts +30 -7
- package/src/cli/pane-functions/screenshot-bridge.ts +4 -2
- package/src/cli/pane-functions/screenshot-payload.ts +21 -0
- package/src/cli/pane-functions/screenshot-render.ts +3 -1
- package/src/cli/quote-answer.ts +32 -16
- package/src/cli/registry.ts +22 -2
- package/src/cli/report-tables.ts +17 -3
- package/src/cli/result.ts +8 -10
- package/src/cli/series-search.ts +45 -6
- package/src/cli/shot-temp-dir.ts +4 -9
- package/src/components/chart/composite/legend.tsx +80 -25
- package/src/components/chart/composite/panel-surface/panel-cursor.tsx +3 -3
- package/src/components/chart/composite/price-axis-labels.tsx +7 -5
- package/src/components/chart-table/header.tsx +9 -0
- package/src/components/chart-table/layout.ts +11 -11
- package/src/components/command-bar/pane-templates/items.ts +17 -1
- package/src/components/command-bar/routes/root/provider-search.ts +10 -1
- package/src/components/command-bar/routes/root/results.ts +34 -2
- package/src/components/command-bar/routes/root/runtime.ts +8 -1
- package/src/components/command-bar/routes/ticker-search/route.ts +5 -0
- package/src/components/command-bar/workflow/alert.ts +19 -8
- package/src/components/data-table/view.tsx +15 -2
- package/src/components/form-modal/content.tsx +9 -4
- package/src/components/index.ts +1 -1
- package/src/components/layout/header.tsx +9 -5
- package/src/components/layout/pane/capture-status.ts +6 -0
- package/src/components/layout/pane/footer/index.tsx +2 -0
- package/src/components/layout/pane/footer/model.ts +113 -15
- package/src/components/layout/pane/header.tsx +16 -2
- package/src/components/market-board/index.tsx +4 -2
- package/src/components/onboarding/onboarding-frame.tsx +6 -2
- package/src/components/onboarding/onboarding-keyboard.ts +7 -1
- package/src/components/onboarding/onboarding-wizard.tsx +3 -1
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +24 -15
- package/src/components/onboarding/setup-cards.ts +36 -0
- package/src/components/onboarding/use-onboarding-progress.ts +22 -1
- package/src/components/onboarding/wizard-account.ts +6 -1
- package/src/components/onboarding/wizard-model.ts +32 -6
- package/src/components/onboarding/wizard-positions.ts +1 -1
- package/src/components/sign-in-gate.tsx +3 -1
- package/src/components/toggle-list.tsx +6 -8
- package/src/components/ui/confirm-dialog.tsx +47 -7
- package/src/components/ui/data-table/display-columns.ts +4 -1
- package/src/components/ui/data-table/hooks.ts +2 -3
- package/src/components/ui/data-table/index.tsx +4 -1
- package/src/components/ui/data-table/types.ts +19 -4
- package/src/components/ui/data-table/visible-range.ts +11 -1
- package/src/components/ui/display.tsx +17 -2
- package/src/components/ui/index.ts +1 -1
- package/src/components/ui/stat-grid.tsx +4 -0
- package/src/components/ui/status.tsx +13 -1
- package/src/components/ui/table-layout.ts +2 -1
- package/src/components/use-pane-notice-footer.tsx +16 -3
- package/src/data/config/store/index.ts +31 -0
- package/src/data/config/store/node.ts +61 -11
- package/src/data/config/store/normalize.ts +4 -6
- package/src/data/config/store/shared-file.ts +309 -0
- package/src/data/profile-merge.ts +299 -0
- package/src/data/sqlite/checkpointer.ts +11 -1
- package/src/data/sqlite/database.ts +1 -1
- package/src/data/ticker-repository.ts +134 -10
- package/src/data/ticker-store.ts +67 -0
- package/src/data/ticker-writes.ts +5 -0
- package/src/i18n/es.ts +27 -0
- package/src/i18n/ja.ts +27 -0
- package/src/i18n/ko.ts +27 -0
- package/src/i18n/zh-cn.ts +27 -0
- package/src/i18n/zh-tw.ts +27 -0
- package/src/layout-marketplace/gallery-desktop.tsx +2 -2
- package/src/market-data/ah-pair.ts +103 -0
- package/src/market-data/depositary-pair.ts +6 -2
- package/src/market-data/hooks.tsx +33 -2
- package/src/market-data/market/change-basis.ts +2 -1
- package/src/market-data/market/header-market.ts +11 -0
- package/src/market-data/split-terms.ts +28 -0
- package/src/plugins/builtin/account-management/footer.ts +1 -1
- package/src/plugins/builtin/account-management/keyboard.ts +4 -0
- package/src/plugins/builtin/account-management/model.ts +1 -0
- package/src/plugins/builtin/account-management/pane.tsx +75 -7
- package/src/plugins/builtin/account-management/payment-recovery-row.tsx +12 -5
- package/src/plugins/builtin/account-management/pro-cancel.tsx +197 -0
- package/src/plugins/builtin/account-management/trial-cancel.ts +1 -1
- package/src/plugins/builtin/alerts/cli-move.ts +2 -2
- package/src/plugins/builtin/alerts/cli.ts +36 -30
- package/src/plugins/builtin/alerts/constants.ts +10 -0
- package/src/plugins/builtin/alerts/earnings-listing.ts +20 -0
- package/src/plugins/builtin/alerts/format.ts +24 -8
- package/src/plugins/builtin/alerts/index.tsx +38 -9
- package/src/plugins/builtin/alerts/move-checks.ts +7 -0
- package/src/plugins/builtin/alerts/pane.tsx +1 -1
- package/src/plugins/builtin/alerts/quotes.ts +26 -2
- package/src/plugins/builtin/alerts/scheduled.ts +6 -1
- package/src/plugins/builtin/alerts/types.ts +7 -0
- package/src/plugins/builtin/analytics/manual-value.ts +61 -0
- package/src/plugins/builtin/analytics/risk-book.ts +7 -7
- package/src/plugins/builtin/analytics/risk-client.ts +26 -13
- package/src/plugins/builtin/analytics/risk-headless.ts +13 -8
- package/src/plugins/builtin/analytics/risk-model.ts +92 -4
- package/src/plugins/builtin/analytics/risk-pane.tsx +85 -38
- package/src/plugins/builtin/awards/pane.tsx +7 -3
- package/src/plugins/builtin/broker-trading/orders.tsx +2 -2
- package/src/plugins/builtin/central-bank-rates/model.ts +8 -2
- package/src/plugins/builtin/central-bank-rates/pane.tsx +5 -3
- package/src/plugins/builtin/chart-composer/cli-options.ts +4 -2
- package/src/plugins/builtin/chart-composer/data-catalog-pane.tsx +2 -6
- package/src/plugins/builtin/chart-composer/pane.tsx +9 -3
- package/src/plugins/builtin/cloud/auth-actions.tsx +11 -6
- package/src/plugins/builtin/cloud/company-picker.tsx +5 -3
- package/src/plugins/builtin/cloud/upgrade-command.ts +1 -1
- package/src/plugins/builtin/company-kpis/headless.ts +9 -4
- package/src/plugins/builtin/company-kpis/latest.ts +45 -0
- package/src/plugins/builtin/company-kpis/model.ts +38 -8
- package/src/plugins/builtin/company-kpis/pane.tsx +22 -8
- package/src/plugins/builtin/composite/alt-data.ts +20 -0
- package/src/plugins/builtin/composite/application.ts +14 -0
- package/src/plugins/builtin/composite/broker.ts +12 -0
- package/src/plugins/builtin/composite/credit.ts +33 -0
- package/src/plugins/builtin/composite/crypto.ts +10 -0
- package/src/plugins/builtin/composite/earnings.ts +12 -0
- package/src/plugins/builtin/composite/filings.ts +13 -0
- package/src/plugins/builtin/composite/futures-commodities.ts +23 -0
- package/src/plugins/builtin/composite/global-markets.ts +12 -0
- package/src/plugins/builtin/composite/options-volatility.ts +23 -0
- package/src/plugins/builtin/composite/ownership.ts +23 -0
- package/src/plugins/builtin/composite/portfolio.ts +10 -0
- package/src/plugins/builtin/composite/quant.ts +15 -0
- package/src/plugins/builtin/composite/rates-macro.ts +30 -0
- package/src/plugins/builtin/composite/screeners.ts +11 -0
- package/src/plugins/builtin/composite/shared.ts +11 -0
- package/src/plugins/builtin/composite/ticker-core.ts +36 -0
- package/src/plugins/builtin/congress-trades/headless.ts +31 -3
- package/src/plugins/builtin/correlation/index.tsx +13 -17
- package/src/plugins/builtin/correlation/matrix/model.ts +18 -0
- package/src/plugins/builtin/credit-conditions/series.ts +2 -2
- package/src/plugins/builtin/dividend-yield/client.ts +57 -16
- package/src/plugins/builtin/dividend-yield/headless.ts +17 -11
- package/src/plugins/builtin/dividend-yield/model.ts +4 -3
- package/src/plugins/builtin/dividend-yield/pane.tsx +22 -18
- package/src/plugins/builtin/dividend-yield/ranking.ts +1 -1
- package/src/plugins/builtin/dividend-yield/types.ts +4 -0
- package/src/plugins/builtin/dividend-yield/view.ts +23 -12
- package/src/plugins/builtin/earnings/board-model.ts +12 -0
- package/src/plugins/builtin/earnings/board-table.ts +7 -4
- package/src/plugins/builtin/earnings/board.tsx +2 -2
- package/src/plugins/builtin/earnings/fiscal-quarter.ts +39 -0
- package/src/plugins/builtin/earnings/headless.ts +7 -4
- package/src/plugins/builtin/earnings/highlight.ts +1 -1
- package/src/plugins/builtin/earnings/history-model.ts +6 -4
- package/src/plugins/builtin/earnings/history-table.ts +4 -3
- package/src/plugins/builtin/earnings-calls/pane.tsx +8 -2
- package/src/plugins/builtin/econ/calendar-model.ts +18 -0
- package/src/plugins/builtin/econ/fred-catalog.ts +1 -256
- package/src/plugins/builtin/econ/index.tsx +3 -0
- package/src/plugins/builtin/econ-statistics/cache.ts +1 -1
- package/src/plugins/builtin/econ-statistics/client.ts +11 -10
- package/src/plugins/builtin/econ-statistics/detail.tsx +1 -0
- package/src/plugins/builtin/econ-statistics/headless.ts +42 -6
- package/src/plugins/builtin/econ-statistics/index.tsx +1 -0
- package/src/plugins/builtin/econ-statistics/pane.tsx +7 -2
- package/src/plugins/builtin/econ-statistics/stats.ts +2 -1
- package/src/plugins/builtin/econ-statistics/view.ts +9 -3
- package/src/plugins/builtin/equity-screener/headless.ts +4 -1
- package/src/plugins/builtin/equity-screener/model.ts +7 -6
- package/src/plugins/builtin/estimate-revisions/headless.ts +1 -1
- package/src/plugins/builtin/exposure/model.ts +10 -0
- package/src/plugins/builtin/exposure/pane.tsx +10 -3
- package/src/plugins/builtin/fx-matrix/amount.ts +15 -1
- package/src/plugins/builtin/fx-matrix/headless.ts +12 -6
- package/src/plugins/builtin/fx-matrix/index.tsx +23 -5
- package/src/plugins/builtin/fx-matrix/settings.ts +9 -4
- package/src/plugins/builtin/kelly-sizer/pane.tsx +9 -4
- package/src/plugins/builtin/market-valuation/pane.tsx +22 -10
- package/src/plugins/builtin/mna/detail.tsx +67 -6
- package/src/plugins/builtin/mna/headless.ts +128 -13
- package/src/plugins/builtin/mna/model.ts +219 -16
- package/src/plugins/builtin/mna/pane.tsx +34 -6
- package/src/plugins/builtin/money-markets/model.ts +14 -5
- package/src/plugins/builtin/money-markets/pane.tsx +4 -3
- package/src/plugins/builtin/news/wire/news/footer.ts +3 -8
- package/src/plugins/builtin/options-scenario/csp-screen-pane.tsx +22 -6
- package/src/plugins/builtin/options-scenario/csp-screen.ts +39 -12
- package/src/plugins/builtin/options-scenario/strategy-screen.ts +7 -5
- package/src/plugins/builtin/pe-band/client.ts +13 -1
- package/src/plugins/builtin/pe-band/headless.ts +2 -2
- package/src/plugins/builtin/pe-band/model.ts +63 -10
- package/src/plugins/builtin/pe-band/pane.tsx +5 -5
- package/src/plugins/builtin/portfolio-list/allocation-rows.ts +26 -7
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +66 -13
- package/src/plugins/builtin/portfolio-list/cli/render.ts +76 -33
- package/src/plugins/builtin/portfolio-list/headless.ts +69 -22
- package/src/plugins/builtin/portfolio-list/pane/data.ts +3 -3
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +29 -14
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +2 -2
- package/src/plugins/builtin/relative-rotation/pane.tsx +2 -3
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +5 -1
- package/src/plugins/builtin/research/event-model.ts +31 -13
- package/src/plugins/builtin/research/headless.ts +8 -1
- package/src/plugins/builtin/research/relative-valuation-pane.tsx +19 -17
- package/src/plugins/builtin/sectors/index.tsx +6 -9
- package/src/plugins/builtin/shared/cloud-upgrade.ts +1 -1
- package/src/plugins/builtin/shared/earnings-report.ts +19 -4
- package/src/plugins/builtin/shared/fred-catalog.ts +256 -0
- package/src/plugins/builtin/shared/report-freshness.ts +2 -3
- package/src/plugins/builtin/shared/series-cache.ts +3 -0
- package/src/plugins/builtin/shared/series-detail-chart.tsx +3 -0
- package/src/plugins/builtin/short-interest/watch-pane.tsx +7 -7
- package/src/plugins/builtin/supply-chain/client.ts +34 -9
- package/src/plugins/builtin/supply-chain/evidence.ts +3 -2
- package/src/plugins/builtin/supply-chain/flow.tsx +4 -3
- package/src/plugins/builtin/supply-chain/graph-model.ts +14 -7
- package/src/plugins/builtin/supply-chain/graph-pane.tsx +3 -1
- package/src/plugins/builtin/supply-chain/graph.tsx +6 -3
- package/src/plugins/builtin/supply-chain/headless.ts +19 -4
- package/src/plugins/builtin/supply-chain/model.ts +50 -6
- package/src/plugins/builtin/supply-chain/pane.tsx +76 -16
- package/src/plugins/builtin/ticker-detail/adr-pair/ah.ts +62 -0
- package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +119 -20
- package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +67 -1
- package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +31 -16
- package/src/plugins/builtin/ticker-detail/overview/model.ts +17 -1
- package/src/plugins/builtin/ticker-detail/overview/pane.tsx +4 -0
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +9 -2
- package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +9 -2
- package/src/plugins/builtin/ticker-detail/quote-monitor/index.tsx +5 -2
- package/src/plugins/builtin/time-sales/headless.ts +4 -1
- package/src/plugins/builtin/time-sales/pane.tsx +2 -0
- package/src/plugins/builtin/time-sales/window.ts +12 -0
- package/src/plugins/builtin/treasury-auctions/client.ts +4 -0
- package/src/plugins/builtin/treasury-auctions/treasury-direct.ts +2 -0
- package/src/plugins/builtin/treasury-daily/client.ts +23 -11
- package/src/plugins/builtin/volatility/model.ts +17 -0
- package/src/plugins/builtin/volatility/pane.tsx +13 -4
- package/src/plugins/builtin/world-indices/index.tsx +2 -0
- package/src/plugins/builtin/world-indices/table.tsx +15 -0
- package/src/plugins/builtin/world-venue-map/evidence.ts +3 -2
- package/src/plugins/builtin/world-venue-map/headless.ts +28 -16
- package/src/plugins/builtin/world-venue-map/index.ts +19 -6
- package/src/plugins/builtin/world-venue-map/layered-pane.tsx +9 -5
- package/src/plugins/builtin/world-venue-map/layers.ts +33 -11
- package/src/plugins/builtin/world-venue-map/map.tsx +12 -0
- package/src/plugins/builtin/world-venue-map/pane.tsx +35 -6
- package/src/plugins/builtin/world-venue-map/place.ts +119 -0
- package/src/plugins/catalog-data.ts +20 -0
- package/src/plugins/catalog-lazy.ts +51 -0
- package/src/plugins/catalog-ui.ts +16 -18
- package/src/plugins/host-smoke.ts +5 -2
- package/src/portfolio/allocation.ts +79 -19
- package/src/portfolio/cash-balances.ts +76 -0
- package/src/portfolio/mutations.ts +43 -8
- package/src/public/__snapshots__/public-api.test.ts.snap +1 -0
- package/src/renderers/desktop/window-layouts.ts +14 -0
- package/src/renderers/dom/data-table/row.tsx +2 -0
- package/src/renderers/dom/host/tabs.tsx +57 -8
- package/src/renderers/dom/styles.css +13 -5
- package/src/renderers/electrobun/bun/desktop/backend-requests.ts +4 -0
- package/src/renderers/electrobun/bun/desktop/backend.ts +22 -1
- package/src/renderers/electrobun/bun/window/native-min-size.ts +6 -1
- package/src/renderers/electrobun/shared/protocol.ts +4 -0
- package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +2 -0
- package/src/renderers/electrobun/view/cli-pane-shot-frame.tsx +50 -12
- package/src/renderers/electrobun/view/remote/ticker-repository.ts +10 -0
- package/src/series/standalone-catalog.ts +5 -4
- package/src/series/standalone.ts +13 -7
- package/src/sources/gloomberb-cloud/fred-publisher.ts +25 -0
- package/src/sources/gloomberb-cloud/fred-series.ts +1 -1
- package/src/sources/gloomberb-cloud/index.ts +14 -3
- package/src/sources/gloomberb-cloud/perpetuals.ts +60 -3
- package/src/sources/provider-router/financials.ts +20 -13
- package/src/sources/provider-router/index.ts +4 -0
- package/src/sources/provider-router/search.ts +1 -0
- package/src/sync/collections-contributor.ts +3 -1
- package/src/sync/config-merge.ts +10 -1
- package/src/sync/sanitize.ts +26 -2
- package/src/tickers/company-name-listing.ts +16 -2
- package/src/tickers/listing-fate.ts +12 -8
- package/src/tickers/renamed-listings.ts +43 -10
- package/src/tickers/search/home-listing.ts +28 -0
- package/src/tickers/search/index.ts +19 -7
- package/src/tickers/terminal-codes.ts +11 -1
- package/src/time-series/base-series.ts +3 -0
- package/src/time-series/ice-credit.ts +1 -0
- package/src/time-series/resolve.ts +3 -1
- package/src/time-series/spec.ts +2 -2
- package/src/time-series/types.ts +2 -1
- package/src/types/data-provider.ts +11 -0
- package/src/types/financials.ts +39 -3
- package/src/types/headless.ts +4 -2
- package/src/types/ticker.ts +10 -2
- package/src/utils/cli-output.ts +1 -1
- package/src/utils/declared-dividends.ts +13 -1
- package/src/utils/dividend-cash.ts +5 -1
- package/src/utils/forward-dividend.ts +4 -3
- package/src/utils/remove-folder.ts +37 -0
- package/src/utils/throttled-fetch.ts +15 -1
- package/src/utils/trailing-dividend.ts +1 -1
- package/src/plugins/builtin/composite-plugins.ts +0 -285
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { splitShareTerms } from "../../../market-data/split-terms";
|
|
1
2
|
import type {
|
|
2
3
|
AnalystEstimateRecord,
|
|
3
4
|
AnalystResearchData,
|
|
@@ -16,7 +17,9 @@ import {
|
|
|
16
17
|
} from "../../../utils/format";
|
|
17
18
|
import { computeTTM } from "../ticker-detail/financials/aggregation";
|
|
18
19
|
import { classifyInstrumentType } from "../../../tickers/instrument-kind";
|
|
19
|
-
import { declaredDividends } from "../../../utils/declared-dividends";
|
|
20
|
+
import { declaredDividendCash, declaredDividends } from "../../../utils/declared-dividends";
|
|
21
|
+
import { fiscalPeriodText, fiscalQuarterInYear, fiscalQuarterText, fiscalYearText } from "../earnings/fiscal-quarter";
|
|
22
|
+
import { fiscalYearEndMonth } from "../../../utils/fiscal-period";
|
|
20
23
|
import { isReasonCode, readableStatus } from "../../../utils/reason-codes";
|
|
21
24
|
import { fundamentalsEpsCurrency, SERVED_TRAILING_EPS } from "../../../utils/fundamentals";
|
|
22
25
|
import { isNotMeaningful, NOT_MEANINGFUL, NOT_MEANINGFUL_TEXT, NOT_MEANINGFUL_TONE, type Rate } from "../../../utils/growth";
|
|
@@ -29,14 +32,13 @@ import {
|
|
|
29
32
|
epsSurprise,
|
|
30
33
|
inFiscalMonth,
|
|
31
34
|
isProvisionalActual,
|
|
32
|
-
quarterLabel,
|
|
33
35
|
showsEpsBasis,
|
|
34
36
|
type EpsBasisName,
|
|
35
37
|
} from "../shared/earnings-report";
|
|
36
38
|
|
|
37
39
|
export const CORPORATE_ACTION_COVERAGE = "Split-feed factors may include spinoff price adjustments. Merger terms, spinoff distributions, and security conversions are not covered.";
|
|
38
40
|
|
|
39
|
-
export type EventStatus = "Earnings" | "Q Est" | "FY Est" | "TTM" | "Dividend" | "Factor";
|
|
41
|
+
export type EventStatus = "Earnings" | "Q Est" | "FY Est" | "TTM" | "Dividend" | "Split" | "Factor";
|
|
40
42
|
|
|
41
43
|
export interface EventRow {
|
|
42
44
|
id: string;
|
|
@@ -165,14 +167,17 @@ function buildEstimatePairs(data: AnalystResearchData | null): EstimatePair[] {
|
|
|
165
167
|
return [...pairs.values()];
|
|
166
168
|
}
|
|
167
169
|
|
|
168
|
-
function formatEstimateDetail(pair: EstimatePair): string {
|
|
170
|
+
function formatEstimateDetail(pair: EstimatePair, relative?: string): string {
|
|
169
171
|
const analystCounts: string[] = [];
|
|
170
172
|
if (pair.eps?.analysts != null) analystCounts.push(`${pair.eps.analysts} EPS`);
|
|
171
173
|
if (pair.revenue?.analysts != null) analystCounts.push(`${pair.revenue.analysts} rev`);
|
|
172
|
-
|
|
173
|
-
return
|
|
174
|
+
const counts = analystCounts.length ? `${analystCounts.join(" / ")} analysts` : "Consensus";
|
|
175
|
+
return relative ? `${relative}, ${counts}` : counts;
|
|
174
176
|
}
|
|
175
177
|
|
|
178
|
+
/** An estimate period the fiscal calendar names: the current or next quarter or year. */
|
|
179
|
+
const NAMED_ESTIMATE_PERIOD = /^(?:cur|next) (?:qtr|yr)$/;
|
|
180
|
+
|
|
176
181
|
/**
|
|
177
182
|
* An estimate's growth over its year-ago figure: the source's, except off a year-ago figure at or below zero, where
|
|
178
183
|
* it is N/M whatever the source worked out (a loss of 0.40 to a profit of 0.10 is no +125%). Undefined where there is none.
|
|
@@ -210,6 +215,8 @@ function estimateValue(growth: Rate | undefined): string {
|
|
|
210
215
|
* the figure `ticker` prints as EPS (TTM) (the filed quarters' when they give one, see time-series/filed-trailing-eps).
|
|
211
216
|
*/
|
|
212
217
|
export type EventFinancials = Pick<TickerFinancials, "quarterlyStatements" | "financialCurrency"> & {
|
|
218
|
+
/** The years, whose last end names the fiscal quarters (`Q1 FY2027`) as GUIDE and ERN do. */
|
|
219
|
+
annualStatements?: readonly Pick<FinancialStatement, "date">[];
|
|
213
220
|
fundamentals?: Pick<NonNullable<TickerFinancials["fundamentals"]>, "eps" | "epsCurrency" | "financialCurrency" | "marketCapCurrency" | "trailingEpsSource"> | null;
|
|
214
221
|
/** The listing's currency, which says whether an unlabelled EPS can be in the statements' (fundamentalsCurrency), and its type. */
|
|
215
222
|
quote?: Pick<NonNullable<TickerFinancials["quote"]>, "currency" | "instrumentType"> | null;
|
|
@@ -336,6 +343,7 @@ function eventSortRank(status: EventStatus): number {
|
|
|
336
343
|
case "Earnings": return 2;
|
|
337
344
|
case "TTM": return 3;
|
|
338
345
|
case "Dividend": return 4;
|
|
346
|
+
case "Split":
|
|
339
347
|
case "Factor": return 5;
|
|
340
348
|
}
|
|
341
349
|
}
|
|
@@ -367,6 +375,8 @@ export function buildEventRows(
|
|
|
367
375
|
if (ttm) rows.push(ttm);
|
|
368
376
|
|
|
369
377
|
const earningsIds = earningsRowIds(earnings);
|
|
378
|
+
// Quarters and years by the names GUIDE and ERN give them (Q1 FY2027), where the company's years say when they end.
|
|
379
|
+
const yearEnd = fiscalYearEndMonth(financials?.annualStatements ?? []);
|
|
370
380
|
// An upcoming report often arrives without a currency; the feed's reported
|
|
371
381
|
// quarters give it when they all agree on one.
|
|
372
382
|
const feedCurrencies = new Set(earnings.map((earning) => earning.currency).filter(Boolean));
|
|
@@ -390,7 +400,7 @@ export function buildEventRows(
|
|
|
390
400
|
dateType: earning.dateType,
|
|
391
401
|
status: "Earnings",
|
|
392
402
|
// The fiscal quarter, never the time of day ("After Hours"), which the row keeps as reportTime.
|
|
393
|
-
period:
|
|
403
|
+
period: fiscalPeriodText(earning.fiscalPeriod ?? statement?.date, fiscalQuarterInYear(earning.fiscalPeriod ?? statement?.date, yearEnd)),
|
|
394
404
|
...(earning.time?.trim() ? { reportTime: earning.time.trim() } : {}),
|
|
395
405
|
detail: upcomingEarningsDetail(earning),
|
|
396
406
|
epsCurrency: earning.currency ?? (earning.epsActual == null ? feedCurrency : reportedCurrency),
|
|
@@ -426,12 +436,16 @@ export function buildEventRows(
|
|
|
426
436
|
const isFiscal = isFiscalEstimatePeriod(pair.period);
|
|
427
437
|
if (!isFiscal && isReportedQuarter(pair.date, reportedPeriodEnds)) continue;
|
|
428
438
|
const growth = estimatePairGrowth(pair);
|
|
439
|
+
const relative = formatPeriod(pair.period);
|
|
440
|
+
const named = !NAMED_ESTIMATE_PERIOD.test(relative) ? null
|
|
441
|
+
: isFiscal ? fiscalYearText(pair.date, yearEnd) : fiscalQuarterText(fiscalQuarterInYear(pair.date, yearEnd));
|
|
429
442
|
rows.push({
|
|
430
443
|
id: `estimate:${pair.date}:${pair.period}`,
|
|
431
444
|
date: pair.date,
|
|
432
445
|
status: isFiscal ? "FY Est" : "Q Est",
|
|
433
|
-
|
|
434
|
-
|
|
446
|
+
// Named as the company's fiscal calendar names it; which one it is from today ("cur qtr") leads the detail.
|
|
447
|
+
period: named ?? relative,
|
|
448
|
+
detail: formatEstimateDetail(pair, named ? relative : undefined),
|
|
435
449
|
providerId: estimates?.providerId,
|
|
436
450
|
fetchedAt: estimates?.fetchedAt,
|
|
437
451
|
estimateInputs: {
|
|
@@ -466,25 +480,29 @@ export function buildEventRows(
|
|
|
466
480
|
|
|
467
481
|
// Declared and unpaid: its own row at its ex-date, apart from the paid distributions above.
|
|
468
482
|
for (const dividend of declaredDividends(data)) {
|
|
483
|
+
const cash = declaredDividendCash(dividend, data?.currency ?? currency);
|
|
469
484
|
rows.push({
|
|
470
485
|
id: `div-declared:${dividend.exDate}`,
|
|
471
486
|
date: dividend.exDate,
|
|
472
487
|
status: "Dividend",
|
|
473
488
|
period: MISSING_VALUE,
|
|
474
489
|
// A one-off beside the regular payments says so: "Declared special, payable 2026-11-25".
|
|
475
|
-
detail: `Declared${dividend.special ? " special" : ""}${dividend.payDate ? `, payable ${dividend.payDate}` : ""}`,
|
|
476
|
-
value:
|
|
490
|
+
detail: `Declared${dividend.special ? " special" : ""}${cash.estimate ? `, ${cash.estimate}` : ""}${dividend.payDate ? `, payable ${dividend.payDate}` : ""}`,
|
|
491
|
+
value: cash.amount,
|
|
477
492
|
tone: "positive",
|
|
478
493
|
});
|
|
479
494
|
}
|
|
480
495
|
|
|
481
496
|
for (const split of data?.splits ?? []) {
|
|
497
|
+
// A factor of whole share counts is a split, said in its terms (DBS's bonus issue: 11-for-10, 1 new share for
|
|
498
|
+
// every 10 held); any other may be a spinoff's price adjustment, and says no more than that.
|
|
499
|
+
const terms = splitShareTerms(split);
|
|
482
500
|
rows.push({
|
|
483
501
|
id: `split:${split.date}:${split.description ?? ""}`,
|
|
484
502
|
date: split.date,
|
|
485
|
-
status: "Factor",
|
|
503
|
+
status: terms ? "Split" : "Factor",
|
|
486
504
|
period: MISSING_VALUE,
|
|
487
|
-
detail: "Split/adjustment",
|
|
505
|
+
detail: terms ?? "Split/adjustment",
|
|
488
506
|
providerDescription: split.description,
|
|
489
507
|
adjustmentFactor: split.fromFactor && split.toFactor ? split.toFactor / split.fromFactor : split.ratio,
|
|
490
508
|
value: split.fromFactor && split.toFactor
|
|
@@ -53,6 +53,12 @@ function matchesKind(row: EventRow, kind: string): boolean {
|
|
|
53
53
|
return row.status === "Earnings" && row.earningsState === "reported";
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
/** The newest of the sources' read times (ISO instants); null when none says. */
|
|
57
|
+
function newestRead(...times: Array<string | undefined>): string | null {
|
|
58
|
+
const read = times.filter((time): time is string => !!time && Number.isFinite(Date.parse(time)));
|
|
59
|
+
return read.length ? read.reduce((newest, time) => (Date.parse(time) > Date.parse(newest) ? time : newest)) : null;
|
|
60
|
+
}
|
|
61
|
+
|
|
56
62
|
function projectEarningsEstimatesHeadless(
|
|
57
63
|
sources: EarningsEstimateSources,
|
|
58
64
|
args: HeadlessPaneLoadArgs,
|
|
@@ -76,13 +82,14 @@ function projectEarningsEstimatesHeadless(
|
|
|
76
82
|
});
|
|
77
83
|
const errors = [...(sources.errors ?? []), ...(notice?.failed ? [notice.text] : [])];
|
|
78
84
|
const unmatchedReportedPeriods = matching.filter((row) => row.earningsState === "reported" && !row.fiscalPeriodEnd).map((row) => row.date);
|
|
79
|
-
if (unmatchedReportedPeriods.length) errors.push(`No statement period identified for ${unmatchedReportedPeriods.length} reported earnings row(s); quarterly revenue is unavailable.`);
|
|
80
85
|
|
|
81
86
|
return {
|
|
82
87
|
columns: ESTIMATE_COLUMNS,
|
|
83
88
|
rows,
|
|
84
89
|
errors: errors.length ? errors : undefined,
|
|
85
90
|
metadata: {
|
|
91
|
+
// When Gloom Cloud read the figures (the newer of the earnings rows' and the estimates' reads): the export's as_of.
|
|
92
|
+
asOf: newestRead(sources.actions?.fetchedAt, sources.estimates?.fetchedAt),
|
|
86
93
|
currency: sources.currency,
|
|
87
94
|
kind,
|
|
88
95
|
total: matching.length,
|
|
@@ -5,7 +5,6 @@ import { TextAttributes } from "../../../ui";
|
|
|
5
5
|
import {
|
|
6
6
|
DataTableView,
|
|
7
7
|
usePaneStatusFooter,
|
|
8
|
-
usePaneNoticeFooter,
|
|
9
8
|
type DataTableCell,
|
|
10
9
|
type DataTableColumn,
|
|
11
10
|
type DataTableKeyEvent,
|
|
@@ -183,6 +182,17 @@ interface PeerSnapshot {
|
|
|
183
182
|
error?: string;
|
|
184
183
|
}
|
|
185
184
|
|
|
185
|
+
/** What concerns one peer's row, each a sentence: why its figures failed or are old, and why its EV/Sales reads as it does. */
|
|
186
|
+
function relativeRowNotes(row: RelativeRow): string[] {
|
|
187
|
+
return [
|
|
188
|
+
row.error ? `${row.error.replace(/\.$/, "")}.` : null,
|
|
189
|
+
row.quoteStale ? "Its quote is stale." : null,
|
|
190
|
+
row.fundamentalsProvenance?.stale ? `${RELATIVE_VALUATION_STALE_FUNDAMENTALS_NOTICE}.` : null,
|
|
191
|
+
row.evSalesUnavailable ?? null,
|
|
192
|
+
row.evSalesNote ?? null,
|
|
193
|
+
].filter((note): note is string => !!note);
|
|
194
|
+
}
|
|
195
|
+
|
|
186
196
|
function peerQuoteKey(symbol: string): string {
|
|
187
197
|
return buildQuoteKey({ symbol: normalizeSymbol(symbol), exchange: "", instrument: null });
|
|
188
198
|
}
|
|
@@ -342,21 +352,9 @@ export function RelativeValuationPane({ focused, width, height }: PaneProps) {
|
|
|
342
352
|
[comparableRows, order],
|
|
343
353
|
);
|
|
344
354
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
const status = [error, peerError,
|
|
348
|
-
missingFx ? "Market-cap FX unavailable" : null].filter(Boolean).join(" · ") || null;
|
|
349
|
-
|
|
350
|
-
usePaneNoticeFooter({
|
|
351
|
-
registrationId: "relative-valuation-notices",
|
|
352
|
-
notices: [
|
|
353
|
-
...rows.filter((row) => row.fundamentalsProvenance?.stale)
|
|
354
|
-
.map((row) => `${row.symbol}: ${RELATIVE_VALUATION_STALE_FUNDAMENTALS_NOTICE}.`),
|
|
355
|
-
...rows.flatMap((row) => row.evSalesUnavailable ? [`${row.symbol}: ${row.evSalesUnavailable}`] : []),
|
|
356
|
-
...rows.flatMap((row) => row.evSalesNote ? [`${row.symbol}: ${row.evSalesNote}`] : []),
|
|
357
|
-
],
|
|
358
|
-
focused,
|
|
359
|
-
});
|
|
355
|
+
// The footer says what concerns the whole comparison; what concerns one peer is on its row (its symbol
|
|
356
|
+
// in the warning colour) and, for the selected row, under the table (`rowNote`).
|
|
357
|
+
const status = [error, peerError, missingFx ? "Market-cap FX unavailable" : null].filter(Boolean).join(" · ") || null;
|
|
360
358
|
|
|
361
359
|
useClampSelectedIndex(rows.length, selectedIdx, setSelectedIdx);
|
|
362
360
|
|
|
@@ -387,7 +385,7 @@ export function RelativeValuationPane({ focused, width, height }: PaneProps) {
|
|
|
387
385
|
if (row.notMeaningful.forwardPE) return notMeaningfulCell();
|
|
388
386
|
return { text: `${formatPriceEarnings(row.reportedMultiples.forwardPE)}${row.forwardPEPeriod ? ` ${row.forwardPEPeriod}` : ""}`, color: colors.text };
|
|
389
387
|
case "evSales":
|
|
390
|
-
// A withdrawn EV says so, one at or below zero reads N/M as a P/E over a loss does; the
|
|
388
|
+
// A withdrawn EV says so, one at or below zero reads N/M as a P/E over a loss does; the row's note says why.
|
|
391
389
|
if (row.evSales == null && row.notMeaningful.evSales) return notMeaningfulCell();
|
|
392
390
|
return row.evSales == null && row.evSalesUnavailable
|
|
393
391
|
? { text: "EV n/a", color: colors.textDim }
|
|
@@ -437,6 +435,10 @@ export function RelativeValuationPane({ focused, width, height }: PaneProps) {
|
|
|
437
435
|
onHeaderClick={handleHeaderClick}
|
|
438
436
|
getItemKey={(row) => row.symbol}
|
|
439
437
|
renderCell={renderCell}
|
|
438
|
+
rowNote={(row) => {
|
|
439
|
+
const notes = relativeRowNotes(row);
|
|
440
|
+
return notes.length ? `${canonicalTickerKey(row.symbol)}: ${notes.join(" ")}` : null;
|
|
441
|
+
}}
|
|
440
442
|
selectedTextOverridesCellColor
|
|
441
443
|
getExportMetadata={() => sortedRows.flatMap((row) => [
|
|
442
444
|
[row.symbol, "Quote as of", parseDisplayDate(row.quoteAsOf)?.toISOString() ?? "unavailable", "Stale", String(row.quoteStale ?? "unknown")],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from "react";
|
|
2
2
|
import { Box } from "../../../ui";
|
|
3
|
-
import { DataTableView, usePaneFooter,
|
|
3
|
+
import { DataTableView, usePaneFooter, usePaneTabs, type DataTableCell, type DataTableKeyEvent, type DataTableVisibleRange } from "../../../components";
|
|
4
4
|
import { handleRefreshKey, loadingErrorFooterInfo } from "../../../components/data-table/table-pane";
|
|
5
5
|
import type { PaneProps } from "../../../types/plugin";
|
|
6
6
|
import type { PluginModule } from "../plugin-module";
|
|
@@ -304,7 +304,7 @@ function EtfBoard({ collectionId, focused, width, height, rootBefore }: EtfBoard
|
|
|
304
304
|
case "name":
|
|
305
305
|
return { text: row.name, color: colors.text };
|
|
306
306
|
case "etf":
|
|
307
|
-
return { text: row.etf, color: colors.textDim };
|
|
307
|
+
return { text: row.etf, color: !row.loading && sectorRowIssues(row).length > 0 ? colors.warning : colors.textDim };
|
|
308
308
|
case "price":
|
|
309
309
|
if (row.loading && row.price === null) {
|
|
310
310
|
return { text: "…", color: colors.textDim };
|
|
@@ -352,13 +352,9 @@ function EtfBoard({ collectionId, focused, width, height, rootBefore }: EtfBoard
|
|
|
352
352
|
|
|
353
353
|
const updatedAgo = useUpdatedAgo(lastRefreshMs);
|
|
354
354
|
const returnAsOfDate = rows.map((row) => row.returnAsOfDate).filter((date): date is string => !!date).sort().at(-1);
|
|
355
|
-
//
|
|
356
|
-
//
|
|
357
|
-
//
|
|
358
|
-
const rowIssueNotices = rows
|
|
359
|
-
.filter((row) => !row.loading && sectorRowIssues(row).length > 0)
|
|
360
|
-
.map((row) => `${row.etf}: ${sectorRowIssues(row).join(" · ")}`);
|
|
361
|
-
usePaneNoticeFooter({ registrationId: "sectors:row-issues", notices: rowIssueNotices, focused });
|
|
355
|
+
// A row with a value the source could not supply says so on that row: its
|
|
356
|
+
// ETF in the warning colour, and the reason under the table while it is
|
|
357
|
+
// selected (`rowNote`). The footer is for the whole board.
|
|
362
358
|
|
|
363
359
|
// Signed out or free, the ETFs' quotes are delayed ones.
|
|
364
360
|
const quoteDelay = useQuoteDelayFooter(rows.map((row) => (row.loading ? null : { dataSource: row.quoteDataSource })), "sectors-delay");
|
|
@@ -406,6 +402,7 @@ function EtfBoard({ collectionId, focused, width, height, rootBefore }: EtfBoard
|
|
|
406
402
|
onHeaderClick={handleHeaderClick}
|
|
407
403
|
getItemKey={(row) => row.etf}
|
|
408
404
|
renderCell={renderCell}
|
|
405
|
+
rowNote={(row) => !row.loading && sectorRowIssues(row).length > 0 ? `${row.etf}: ${sectorRowIssues(row).join("; ")}.` : null}
|
|
409
406
|
selectedTextOverridesCellColor
|
|
410
407
|
emptyStateTitle={loadError ?? "No sectors selected."}
|
|
411
408
|
/>
|
|
@@ -245,7 +245,7 @@ export function useCloudUpgradeAction(placement: string): (options?: unknown) =>
|
|
|
245
245
|
if (resolvePlanAccess(apiClient.getCurrentUser()).hasProAccess) return;
|
|
246
246
|
void openUpgradeRef.current({ ...checkout, recordIntent: false });
|
|
247
247
|
};
|
|
248
|
-
if (requestAuthDialog({ mode: "signup", onSignedIn: continueSignedIn, ...(checkout.reason ? { reason: checkout.reason } : {}) })) {
|
|
248
|
+
if (requestAuthDialog({ mode: "signup", onSignedIn: continueSignedIn, checkout: true, ...(checkout.reason ? { reason: checkout.reason } : {}) })) {
|
|
249
249
|
if (checkout.recordIntent !== false) recordUpgradeIntent(checkout.placement);
|
|
250
250
|
return;
|
|
251
251
|
}
|
|
@@ -47,6 +47,20 @@ export function isProvisionalActual(row: { epsActual?: number | null; epsActualS
|
|
|
47
47
|
return row.epsActual != null && row.epsActualSource === "press-release";
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
/**
|
|
51
|
+
* A reported quarter with an actual and no consensus on record says so where
|
|
52
|
+
* its estimate would be, so a blank surprise never reads as a lost figure.
|
|
53
|
+
*/
|
|
54
|
+
export const NO_CONSENSUS = "no consensus";
|
|
55
|
+
|
|
56
|
+
/** NO_CONSENSUS where a column is narrow. */
|
|
57
|
+
export const NO_CONSENSUS_SHORT = "no est";
|
|
58
|
+
|
|
59
|
+
/** A beat stated without its estimate (`difference`) still had a consensus. */
|
|
60
|
+
export function lacksConsensus(row: { epsActual?: number | null; epsEstimate?: number | null; difference?: number | null }): boolean {
|
|
61
|
+
return row.epsActual != null && row.epsEstimate == null && row.difference == null;
|
|
62
|
+
}
|
|
63
|
+
|
|
50
64
|
/** What a provisional figure is, in every report's metadata. */
|
|
51
65
|
export const PROVISIONAL_NOTE = "A provisional EPS (or sales) figure is the company's own press release's, read from its results filing minutes after it is out, on the basis the consensus is measured on. The earnings calendar's figure replaces it, usually the next day.";
|
|
52
66
|
|
|
@@ -67,9 +81,9 @@ type EarningsRecord = CorporateActionsData["earnings"][number];
|
|
|
67
81
|
|
|
68
82
|
/**
|
|
69
83
|
* What follows an earnings row's EPS, one phrase per part. A reported row
|
|
70
|
-
* names its basis, whether the figure is provisional, and its beat
|
|
71
|
-
* pending one whether its date is
|
|
72
|
-
* estimate's basis.
|
|
84
|
+
* names its basis, whether the figure is provisional, and its beat, or that
|
|
85
|
+
* no consensus is on record for it; a pending one whether its date is
|
|
86
|
+
* announced, its analysts and an adjusted estimate's basis.
|
|
73
87
|
*/
|
|
74
88
|
export function earningsDetailParts(earning: EarningsRecord): string[] {
|
|
75
89
|
if (earning.epsActual == null) {
|
|
@@ -78,7 +92,8 @@ export function earningsDetailParts(earning: EarningsRecord): string[] {
|
|
|
78
92
|
earningsEpsBasis(earning.epsBasis) === "adjusted" ? BASIS_TEXT.adjusted : null].filter((part): part is string => !!part);
|
|
79
93
|
}
|
|
80
94
|
return [BASIS_TEXT[epsBasisName(earningsEpsBasis(earning.epsBasis))], isProvisionalActual(earning) ? "provisional" : null,
|
|
81
|
-
|
|
95
|
+
lacksConsensus(earning) ? NO_CONSENSUS
|
|
96
|
+
: earning.difference == null ? null : `${earning.difference > 0 ? "+" : ""}${formatNumber(earning.difference, 2)} vs est`]
|
|
82
97
|
.filter((part): part is string => !!part);
|
|
83
98
|
}
|
|
84
99
|
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import { fredSeriesUrl, seriesNotOnFred } from "../../../sources/gloomberb-cloud/fred-series";
|
|
2
|
+
import type { SeriesDefinition, SeriesFrequency } from "../../../series/types";
|
|
3
|
+
|
|
4
|
+
type FredRow = readonly [seriesId: string, name: string, unit: string, frequency: SeriesFrequency, publisher: string, tags?: readonly string[]];
|
|
5
|
+
|
|
6
|
+
/** What people call a Treasury bill: a t-bill, a tbill, cash parked in a money market. */
|
|
7
|
+
const BILL_TAGS = ["bill", "T-bill", "T-bills", "tbill", "tbills", "money markets", "money market"] as const;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The FRED series Gloom Cloud serves, by group, except the Treasury constant
|
|
11
|
+
* maturities (UST:2Y and so on, from the yield curve) and the credit spreads
|
|
12
|
+
* and yields (from the credit plugin). Ids follow the server's allowlist: a
|
|
13
|
+
* series added there is listed here to reach the catalog.
|
|
14
|
+
* Türkiye's CPI, Brazil's IPCA, MAS's SORA and NAHB's housing market index
|
|
15
|
+
* are served the same way but are not on FRED; their rows name TurkStat,
|
|
16
|
+
* IBGE, MAS and NAHB (`seriesNotOnFred`).
|
|
17
|
+
*/
|
|
18
|
+
const GROUPS: ReadonlyArray<{ group: string; rows: readonly FredRow[] }> = [
|
|
19
|
+
{
|
|
20
|
+
group: "Rates",
|
|
21
|
+
rows: [
|
|
22
|
+
["FEDFUNDS", "Fed funds effective rate (monthly)", "%", "monthly", "Federal Reserve Board", ["fed funds"]],
|
|
23
|
+
["DFF", "Fed funds effective rate", "%", "daily", "Federal Reserve Board", ["fed funds"]],
|
|
24
|
+
["EFFR", "Effective federal funds rate", "%", "daily", "Federal Reserve Bank of New York", ["EFFR", "money markets"]],
|
|
25
|
+
["IORB", "Interest on reserve balances", "%", "daily", "Federal Reserve Board", ["IORB", "money markets"]],
|
|
26
|
+
["DFEDTARU", "Fed funds target range, upper limit", "%", "daily", "Federal Reserve Board", ["fed funds", "policy rate"]],
|
|
27
|
+
["DFEDTARL", "Fed funds target range, lower limit", "%", "daily", "Federal Reserve Board", ["fed funds", "policy rate"]],
|
|
28
|
+
["ECBDFR", "ECB deposit facility rate", "%", "daily", "European Central Bank", ["ECB", "euro area", "policy rate"]],
|
|
29
|
+
["DPRIME", "Bank prime loan rate", "%", "daily", "Federal Reserve Board"],
|
|
30
|
+
["DFII5", "5Y TIPS real yield", "%", "daily", "Federal Reserve Board", ["treasury", "real yield"]],
|
|
31
|
+
["DFII10", "10Y TIPS real yield", "%", "daily", "Federal Reserve Board", ["treasury", "real yield"]],
|
|
32
|
+
["T10Y2Y", "10Y minus 2Y Treasury spread", "bp", "daily", "Federal Reserve Bank of St. Louis", ["treasury", "curve", "2s10s"]],
|
|
33
|
+
["T10Y3M", "10Y minus 3M Treasury spread", "bp", "daily", "Federal Reserve Bank of St. Louis", ["treasury", "curve"]],
|
|
34
|
+
// The Federal Reserve Board's Kim-Wright estimates, a week or so behind.
|
|
35
|
+
...Array.from({ length: 10 }, (_, index): FredRow =>
|
|
36
|
+
[`THREEFYTP${index + 1}`, `${index + 1}Y Treasury term premium (Kim-Wright)`, "%", "daily", "Federal Reserve Board", ["treasury", "term premium", "Kim-Wright"]]),
|
|
37
|
+
["SOFR", "SOFR", "%", "daily", "Federal Reserve Bank of New York", ["secured overnight financing rate", "money markets"]],
|
|
38
|
+
["SORA", "SORA (Singapore overnight rate average)", "%", "daily", "MAS", ["SGD", "Singapore", "MAS", "overnight", "money markets"]],
|
|
39
|
+
["OBFR", "Overnight bank funding rate", "%", "daily", "Federal Reserve Bank of New York", ["OBFR", "money markets"]],
|
|
40
|
+
["DTB4WK", "4-week Treasury bill rate", "%", "daily", "Federal Reserve Board", BILL_TAGS],
|
|
41
|
+
["DTB3", "3-month Treasury bill rate", "%", "daily", "Federal Reserve Board", BILL_TAGS],
|
|
42
|
+
["DTB6", "6-month Treasury bill rate", "%", "daily", "Federal Reserve Board", BILL_TAGS],
|
|
43
|
+
["DTB1YR", "1-year Treasury bill rate", "%", "daily", "Federal Reserve Board", BILL_TAGS],
|
|
44
|
+
["DCPF3M", "3-month AA financial commercial paper rate", "%", "daily", "Federal Reserve Board", ["commercial paper", "money markets"]],
|
|
45
|
+
["DCPN3M", "3-month AA nonfinancial commercial paper rate", "%", "daily", "Federal Reserve Board", ["commercial paper", "money markets"]],
|
|
46
|
+
["RRPONTSYD", "Overnight reverse repo at the Fed", "billion USD", "daily", "Federal Reserve Bank of New York", ["RRP", "liquidity", "money markets"]],
|
|
47
|
+
["WDTGAL", "Treasury General Account", "million USD", "weekly", "Federal Reserve Board", ["TGA", "liquidity", "money markets"]],
|
|
48
|
+
["WRESBAL", "Bank reserves at the Fed", "million USD", "weekly", "Federal Reserve Board", ["reserves", "liquidity", "money markets"]],
|
|
49
|
+
["WALCL", "Fed total assets", "million USD", "weekly", "Federal Reserve Board", ["balance sheet", "liquidity"]],
|
|
50
|
+
["M2SL", "M2 money stock", "billion USD", "monthly", "Federal Reserve Board", ["money supply", "liquidity"]],
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
group: "Volatility",
|
|
55
|
+
rows: [
|
|
56
|
+
["VIXCLS", "VIX", "index", "daily", "Cboe", ["volatility index", "30 day"]],
|
|
57
|
+
["VXVCLS", "VIX 3M", "index", "daily", "Cboe", ["volatility index", "3 month"]],
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
group: "Economy",
|
|
62
|
+
rows: [
|
|
63
|
+
["GDP", "Gross domestic product", "billion USD", "quarterly", "Bureau of Economic Analysis", ["GDP", "growth"]],
|
|
64
|
+
["GDPC1", "Real gross domestic product", "billion USD", "quarterly", "Bureau of Economic Analysis", ["GDP", "growth"]],
|
|
65
|
+
["UNRATE", "Unemployment rate", "%", "monthly", "Bureau of Labor Statistics", ["labor", "jobs"]],
|
|
66
|
+
["ICSA", "Initial jobless claims", "count", "weekly", "Department of Labor", ["labor", "claims"]],
|
|
67
|
+
["PAYEMS", "Nonfarm payrolls", "thousand people", "monthly", "Bureau of Labor Statistics", ["labor", "jobs", "employment"]],
|
|
68
|
+
["NPPTTL", "Private payroll employment (discontinued)", "thousand people", "monthly", "ADP Research Institute", ["labor", "jobs"]],
|
|
69
|
+
["JTSJOL", "Job openings", "thousand jobs", "monthly", "Bureau of Labor Statistics", ["labor", "JOLTS"]],
|
|
70
|
+
["OPHNFB", "Nonfarm labor productivity", "index", "quarterly", "Bureau of Labor Statistics", ["labor", "productivity"]],
|
|
71
|
+
["ULCNFB", "Unit labor costs", "index", "quarterly", "Bureau of Labor Statistics", ["labor", "wages"]],
|
|
72
|
+
["RSAFS", "Retail sales", "million USD", "monthly", "Census Bureau", ["consumer", "spending"]],
|
|
73
|
+
["RSFSXMV", "Retail sales excluding autos", "million USD", "monthly", "Census Bureau", ["consumer", "spending"]],
|
|
74
|
+
["UMCSENT", "University of Michigan consumer sentiment", "index", "monthly", "University of Michigan", ["consumer", "sentiment"]],
|
|
75
|
+
["CSCICP03USM665S", "Consumer confidence (OECD)", "index", "monthly", "OECD", ["consumer", "sentiment"]],
|
|
76
|
+
["HOUST", "Housing starts", "thousand units", "monthly", "Census Bureau", ["housing", "homebuilders"]],
|
|
77
|
+
["PERMIT", "Building permits", "thousand units", "monthly", "Census Bureau", ["housing", "homebuilders"]],
|
|
78
|
+
["EXHOSLUSM495S", "Existing home sales", "units", "monthly", "National Association of Realtors", ["housing", "homebuilders"]],
|
|
79
|
+
["HSN1F", "New home sales", "thousand units", "monthly", "Census Bureau", ["housing", "homebuilders"]],
|
|
80
|
+
["MORTGAGE30US", "30-year fixed mortgage rate (Freddie Mac PMMS)", "%", "weekly", "Freddie Mac", ["housing", "mortgage rate", "PMMS", "Freddie Mac", "homebuilders"]],
|
|
81
|
+
["MORTGAGE15US", "15-year fixed mortgage rate (Freddie Mac PMMS)", "%", "weekly", "Freddie Mac", ["housing", "mortgage rate", "PMMS", "Freddie Mac", "homebuilders"]],
|
|
82
|
+
// Computed by Gloom Cloud: MORTGAGE30US less DGS10 on each PMMS date.
|
|
83
|
+
["MORTGAGE30US10Y", "30-year mortgage rate minus 10Y Treasury, on the PMMS date", "bp", "weekly", "Freddie Mac and Federal Reserve Board", ["housing", "mortgage spread", "PMMS", "treasury", "homebuilders"]],
|
|
84
|
+
["NAHBHMI", "NAHB housing market index (builder sentiment)", "index", "monthly", "NAHB", ["housing", "NAHB", "HMI", "homebuilders", "sentiment"]],
|
|
85
|
+
["DGORDER", "Durable goods orders", "million USD", "monthly", "Census Bureau", ["manufacturing", "orders"]],
|
|
86
|
+
["ADXTNO", "Durable goods orders excluding transportation", "million USD", "monthly", "Census Bureau", ["manufacturing", "orders"]],
|
|
87
|
+
["AMTMNO", "Manufacturing new orders", "million USD", "monthly", "Census Bureau", ["manufacturing", "factory orders"]],
|
|
88
|
+
["BOPGSTB", "Trade balance", "million USD", "monthly", "Bureau of Economic Analysis and Census Bureau", ["trade"]],
|
|
89
|
+
["INDPRO", "Industrial production", "index", "monthly", "Federal Reserve Board", ["manufacturing", "output"]],
|
|
90
|
+
["TCU", "Capacity utilization", "%", "monthly", "Federal Reserve Board", ["manufacturing"]],
|
|
91
|
+
["PI", "Personal income", "billion USD", "monthly", "Bureau of Economic Analysis", ["consumer", "income"]],
|
|
92
|
+
["PCE", "Personal consumption expenditures", "billion USD", "monthly", "Bureau of Economic Analysis", ["consumer", "spending"]],
|
|
93
|
+
["NETFI", "Current account balance", "billion USD", "quarterly", "Bureau of Economic Analysis", ["trade", "external"]],
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
group: "Defense & fiscal",
|
|
98
|
+
rows: [
|
|
99
|
+
["FDEFX", "National defense spending (annual rate)", "billion USD", "quarterly", "Bureau of Economic Analysis", ["defense", "military", "DoD", "budget", "government spending", "GDP"]],
|
|
100
|
+
["ADEFNO", "New orders for defense capital goods", "million USD", "monthly", "Census Bureau", ["defense", "military", "DoD", "orders", "manufacturing"]],
|
|
101
|
+
["MTSO133FMS", "Federal outlays (Monthly Treasury Statement)", "million USD", "monthly", "U.S. Treasury", ["budget", "government spending", "fiscal", "deficit", "Treasury"]],
|
|
102
|
+
],
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
group: "Inflation",
|
|
106
|
+
rows: [
|
|
107
|
+
["CPIAUCSL", "CPI, all items", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "headline", "seasonally adjusted"]],
|
|
108
|
+
["CPIAUCNS", "CPI, all items (not seasonally adjusted)", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "headline"]],
|
|
109
|
+
["CPILFESL", "Core CPI", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "core", "ex food and energy"]],
|
|
110
|
+
["CPILFENS", "Core CPI (not seasonally adjusted)", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "core"]],
|
|
111
|
+
["CPIUFDSL", "CPI: Food", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component"]],
|
|
112
|
+
["CUSR0000SAF11", "CPI: Food at home", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "groceries"]],
|
|
113
|
+
["CUSR0000SEFV", "CPI: Food away from home", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "restaurants"]],
|
|
114
|
+
["CPIENGSL", "CPI: Energy", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component"]],
|
|
115
|
+
["CUSR0000SETB01", "CPI: Gasoline", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "energy"]],
|
|
116
|
+
["CUSR0000SEHF01", "CPI: Electricity", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "energy"]],
|
|
117
|
+
["CUSR0000SEHF02", "CPI: Utility gas service", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "energy"]],
|
|
118
|
+
["CUSR0000SACL1E", "CPI: Core goods", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "goods"]],
|
|
119
|
+
["CUSR0000SETA01", "CPI: New vehicles", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "goods", "cars"]],
|
|
120
|
+
["CUSR0000SETA02", "CPI: Used cars and trucks", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "goods", "cars"]],
|
|
121
|
+
["CPIAPPSL", "CPI: Apparel", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "goods"]],
|
|
122
|
+
["CUSR0000SAM1", "CPI: Medical care goods", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "goods", "health"]],
|
|
123
|
+
["CUSR0000SASLE", "CPI: Core services", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "services"]],
|
|
124
|
+
["CUSR0000SAH1", "CPI: Shelter", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "services", "housing"]],
|
|
125
|
+
["CUSR0000SEHA", "CPI: Rent", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "services", "housing"]],
|
|
126
|
+
["CUSR0000SEHC", "CPI: Owners' equivalent rent", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "services", "housing", "OER"]],
|
|
127
|
+
["CUSR0000SEHB", "CPI: Lodging away from home", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "services", "hotels"]],
|
|
128
|
+
["CUSR0000SAM2", "CPI: Medical care services", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "services", "health"]],
|
|
129
|
+
["CUSR0000SAS4", "CPI: Transportation services", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "services"]],
|
|
130
|
+
["CUSR0000SETG01", "CPI: Airline fares", "index", "monthly", "Bureau of Labor Statistics", ["CPI", "component", "services", "travel"]],
|
|
131
|
+
["PCEPI", "PCE price index", "index", "monthly", "Bureau of Economic Analysis", ["PCE", "headline"]],
|
|
132
|
+
["PCEPILFE", "Core PCE price index", "index", "monthly", "Bureau of Economic Analysis", ["PCE", "core"]],
|
|
133
|
+
["PPIACO", "Producer prices, all commodities", "index", "monthly", "Bureau of Labor Statistics", ["PPI"]],
|
|
134
|
+
["PPIFIS", "Producer prices, final demand", "index", "monthly", "Bureau of Labor Statistics", ["PPI"]],
|
|
135
|
+
["PPIFID", "Producer prices, final demand (not seasonally adjusted)", "index", "monthly", "Bureau of Labor Statistics", ["PPI"]],
|
|
136
|
+
["IR", "Import prices", "index", "monthly", "Bureau of Labor Statistics", ["trade"]],
|
|
137
|
+
["IQ", "Export prices", "index", "monthly", "Bureau of Labor Statistics", ["trade"]],
|
|
138
|
+
["T5YIE", "5Y breakeven inflation", "%", "daily", "Federal Reserve Bank of St. Louis", ["breakeven", "expectations", "TIPS"]],
|
|
139
|
+
["T10YIE", "10Y breakeven inflation", "%", "daily", "Federal Reserve Bank of St. Louis", ["breakeven", "expectations", "TIPS"]],
|
|
140
|
+
["T5YIFR", "5Y, 5Y forward inflation expectation", "%", "daily", "Federal Reserve Bank of St. Louis", ["breakeven", "expectations", "5y5y"]],
|
|
141
|
+
["TURCPIYOY", "Türkiye CPI, y/y", "%", "monthly", "TurkStat", ["CPI", "headline", "Turkey", "TR", "inflation", "lira"]],
|
|
142
|
+
["TURCPIMOM", "Türkiye CPI, m/m", "%", "monthly", "TurkStat", ["CPI", "headline", "Turkey", "TR", "inflation", "lira"]],
|
|
143
|
+
["BRAIPCAMOM", "Brazil IPCA, m/m", "%", "monthly", "IBGE", ["IPCA", "CPI", "headline", "Brazil", "BR", "Brazil inflation", "inflation", "real"]],
|
|
144
|
+
["BRAIPCA15MOM", "Brazil IPCA-15 mid-month, m/m", "%", "monthly", "IBGE",
|
|
145
|
+
["IPCA-15", "IPCA", "CPI", "mid-month", "Brazil", "BR", "Brazil inflation", "inflation", "real"]],
|
|
146
|
+
],
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
group: "FX",
|
|
150
|
+
rows: [
|
|
151
|
+
["DEXUSEU", "Euro (USD per EUR)", "USD", "daily", "Federal Reserve Board", ["EURUSD", "EUR", "euro"]],
|
|
152
|
+
["DEXUSUK", "British pound (USD per GBP)", "USD", "daily", "Federal Reserve Board", ["GBPUSD", "GBP", "sterling", "pound"]],
|
|
153
|
+
["DEXUSAL", "Australian dollar (USD per AUD)", "USD", "daily", "Federal Reserve Board", ["AUDUSD", "AUD"]],
|
|
154
|
+
["DEXUSNZ", "New Zealand dollar (USD per NZD)", "USD", "daily", "Federal Reserve Board", ["NZDUSD", "NZD"]],
|
|
155
|
+
["DEXJPUS", "Japanese yen (JPY per USD)", "JPY", "daily", "Federal Reserve Board", ["USDJPY", "JPY", "yen"]],
|
|
156
|
+
["DEXCHUS", "Chinese yuan (CNY per USD)", "CNY", "daily", "Federal Reserve Board", ["USDCNY", "CNY", "renminbi", "yuan"]],
|
|
157
|
+
["DEXINUS", "Indian rupee (INR per USD)", "INR", "daily", "Federal Reserve Board", ["USDINR", "INR"]],
|
|
158
|
+
["DEXBZUS", "Brazilian real (BRL per USD)", "BRL", "daily", "Federal Reserve Board", ["USDBRL", "BRL"]],
|
|
159
|
+
["DEXMXUS", "Mexican peso (MXN per USD)", "MXN", "daily", "Federal Reserve Board", ["USDMXN", "MXN"]],
|
|
160
|
+
["DEXKOUS", "South Korean won (KRW per USD)", "KRW", "daily", "Federal Reserve Board", ["USDKRW", "KRW"]],
|
|
161
|
+
["DEXCAUS", "Canadian dollar (CAD per USD)", "CAD", "daily", "Federal Reserve Board", ["USDCAD", "CAD"]],
|
|
162
|
+
["DEXSZUS", "Swiss franc (CHF per USD)", "CHF", "daily", "Federal Reserve Board", ["USDCHF", "CHF", "franc", "swiss franc"]],
|
|
163
|
+
["DEXTAUS", "Taiwan dollar (TWD per USD)", "TWD", "daily", "Federal Reserve Board", ["USDTWD", "TWD"]],
|
|
164
|
+
["DEXHKUS", "Hong Kong dollar (HKD per USD)", "HKD", "daily", "Federal Reserve Board", ["USDHKD", "HKD"]],
|
|
165
|
+
["DEXSIUS", "Singapore dollar (SGD per USD)", "SGD", "daily", "Federal Reserve Board", ["USDSGD", "SGD"]],
|
|
166
|
+
["DEXTHUS", "Thai baht (THB per USD)", "THB", "daily", "Federal Reserve Board", ["USDTHB", "THB"]],
|
|
167
|
+
["DEXMAUS", "Malaysian ringgit (MYR per USD)", "MYR", "daily", "Federal Reserve Board", ["USDMYR", "MYR"]],
|
|
168
|
+
["DEXNOUS", "Norwegian krone (NOK per USD)", "NOK", "daily", "Federal Reserve Board", ["USDNOK", "NOK"]],
|
|
169
|
+
["DEXSDUS", "Swedish krona (SEK per USD)", "SEK", "daily", "Federal Reserve Board", ["USDSEK", "SEK"]],
|
|
170
|
+
["DEXDNUS", "Danish krone (DKK per USD)", "DKK", "daily", "Federal Reserve Board", ["USDDKK", "DKK"]],
|
|
171
|
+
["DEXSLUS", "Sri Lankan rupee (LKR per USD)", "LKR", "daily", "Federal Reserve Board", ["USDLKR", "LKR"]],
|
|
172
|
+
["DEXSFUS", "South African rand (ZAR per USD)", "ZAR", "daily", "Federal Reserve Board", ["USDZAR", "ZAR"]],
|
|
173
|
+
["DEXVZUS", "Venezuelan bolivar (VES per USD)", "VES", "daily", "Federal Reserve Board", ["USDVES", "VES"]],
|
|
174
|
+
["DTWEXBGS", "Broad dollar index", "index", "daily", "Federal Reserve Board", ["dollar", "trade weighted"]],
|
|
175
|
+
["DTWEXAFEGS", "Dollar index against advanced economies", "index", "daily", "Federal Reserve Board", ["dollar", "trade weighted"]],
|
|
176
|
+
["DTWEXEMEGS", "Dollar index against emerging markets", "index", "daily", "Federal Reserve Board", ["dollar", "trade weighted"]],
|
|
177
|
+
["RTWEXBGS", "Real broad dollar index", "index", "monthly", "Federal Reserve Board", ["dollar", "trade weighted", "real"]],
|
|
178
|
+
["RTWEXAFEGS", "Real dollar index against advanced economies", "index", "monthly", "Federal Reserve Board", ["dollar", "trade weighted", "real"]],
|
|
179
|
+
["RTWEXEMEGS", "Real dollar index against emerging markets", "index", "monthly", "Federal Reserve Board", ["dollar", "trade weighted", "real"]],
|
|
180
|
+
],
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
group: "Energy",
|
|
184
|
+
rows: [
|
|
185
|
+
["DCOILWTICO", "WTI crude oil spot", "USD/barrel", "daily", "U.S. Energy Information Administration", ["oil", "crude"]],
|
|
186
|
+
["WCOILWTICO", "WTI crude oil spot (weekly)", "USD/barrel", "weekly", "U.S. Energy Information Administration", ["oil", "crude"]],
|
|
187
|
+
["DCOILBRENTEU", "Brent crude oil spot", "USD/barrel", "daily", "U.S. Energy Information Administration", ["oil", "crude"]],
|
|
188
|
+
["DHHNGSP", "Henry Hub natural gas spot", "USD/MMBtu", "daily", "U.S. Energy Information Administration", ["natural gas"]],
|
|
189
|
+
["NATURALGAS", "Natural gas consumption", "billion cubic feet", "monthly", "U.S. Energy Information Administration", ["natural gas"]],
|
|
190
|
+
],
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
// The IMF's monthly world prices: the closest public series to LME copper and aluminium, which FUT does not list,
|
|
194
|
+
// and to iron ore, whose futures are licensed.
|
|
195
|
+
group: "Commodities",
|
|
196
|
+
rows: [
|
|
197
|
+
["PCOPPUSDM", "Global price of copper", "USD/ton", "monthly", "International Monetary Fund", ["copper", "metals", "LME"]],
|
|
198
|
+
["PALUMUSDM", "Global price of aluminum", "USD/ton", "monthly", "International Monetary Fund", ["aluminum", "aluminium", "metals", "LME"]],
|
|
199
|
+
["PIORECRUSDM", "Global price of iron ore (dry metric ton)", "USD/ton", "monthly", "International Monetary Fund", ["iron ore", "iron", "steel", "metals"]],
|
|
200
|
+
],
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
group: "Valuation",
|
|
204
|
+
rows: [
|
|
205
|
+
["NCBEILQ027S", "Nonfinancial corporate equities (Z.1)", "million USD", "quarterly", "Federal Reserve Board", ["market cap", "Buffett"]],
|
|
206
|
+
["FBCELLQ027S", "Financial sector corporate equities (Z.1)", "million USD", "quarterly", "Federal Reserve Board", ["market cap"]],
|
|
207
|
+
["BOGZ1FL153064486Q", "Household corporate equity holdings (Z.1)", "million USD", "quarterly", "Federal Reserve Board", ["households", "equity allocation"]],
|
|
208
|
+
["BOGZ1FL663067003Q", "Broker-dealer customer receivables (Z.1)", "million USD", "quarterly", "Federal Reserve Board", ["margin debt"]],
|
|
209
|
+
["CPROFIT", "Corporate profits after tax", "billion USD", "quarterly", "Bureau of Economic Analysis", ["earnings", "profits"]],
|
|
210
|
+
["TNWMVBSNNCB", "Nonfinancial corporate net worth (Z.1)", "million USD", "quarterly", "Federal Reserve Board", ["Tobin's Q"]],
|
|
211
|
+
],
|
|
212
|
+
},
|
|
213
|
+
];
|
|
214
|
+
|
|
215
|
+
/** The FRED series the rates and macro panes chart, each listed once. */
|
|
216
|
+
export const FRED_CATALOG_SERIES: readonly SeriesDefinition[] = GROUPS.flatMap(({ group, rows }) => (
|
|
217
|
+
rows.map(([seriesId, name, unit, frequency, publisher, tags]): SeriesDefinition => ({
|
|
218
|
+
id: `fred:${seriesId}`,
|
|
219
|
+
name,
|
|
220
|
+
unit,
|
|
221
|
+
frequency,
|
|
222
|
+
group,
|
|
223
|
+
...(tags?.length ? { tags } : {}),
|
|
224
|
+
publisher,
|
|
225
|
+
// The licence a publisher's data comes under, which the catalog lists beside the series (SORA's).
|
|
226
|
+
...(seriesNotOnFred(seriesId)?.attribution ? { limitation: seriesNotOnFred(seriesId)!.attribution } : {}),
|
|
227
|
+
url: fredSeriesUrl(seriesId),
|
|
228
|
+
expression: `FRED:${seriesId}`,
|
|
229
|
+
}))
|
|
230
|
+
));
|
|
231
|
+
|
|
232
|
+
/** Spellings of a Treasury bill a person types, as the series names say it. */
|
|
233
|
+
const BILL_WORDS: ReadonlyArray<[RegExp, string]> = [
|
|
234
|
+
[/\bt-?bills?\b|\bt bills?\b|\btreasury bills?\b/g, "treasury bill"],
|
|
235
|
+
[/\b(\d+|three|six|one|four)[\s-]*(month|mo|m)\b/g, "$1-month"],
|
|
236
|
+
[/\bthree-month\b/g, "3-month"],
|
|
237
|
+
[/\bsix-month\b/g, "6-month"],
|
|
238
|
+
[/\b(\d+|four)[\s-]*(week|wk|w)\b/g, "$1-week"],
|
|
239
|
+
[/\bfour-week\b/g, "4-week"],
|
|
240
|
+
[/\b(1|one)[\s-]*(year|yr|y)\b/g, "1-year"],
|
|
241
|
+
];
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* The served FRED series a name asks for, when one alone fits every word: `3 month t-bill` is DTB3. Null for an id
|
|
245
|
+
* (DTB3), for words several series fit and for none.
|
|
246
|
+
*/
|
|
247
|
+
export function fredSeriesIdForName(text: string): string | null {
|
|
248
|
+
const normalized = BILL_WORDS.reduce((value, [pattern, replacement]) => value.replace(pattern, replacement), text.trim().toLowerCase());
|
|
249
|
+
const words = normalized.split(/\s+/).filter((word) => word && word !== "rate" && word !== "yield");
|
|
250
|
+
if (words.length < 2) return null;
|
|
251
|
+
const fits = FRED_CATALOG_SERIES.filter((series) => {
|
|
252
|
+
const name = `${series.name} ${(series.tags ?? []).join(" ")}`.toLowerCase();
|
|
253
|
+
return words.every((word) => name.includes(word));
|
|
254
|
+
});
|
|
255
|
+
return fits.length === 1 ? fits[0]!.id.replace(/^fred:/, "") : null;
|
|
256
|
+
}
|