gloomberb 0.20.13 → 0.20.16
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 +2 -1
- package/patches/@opentui%2Fcore@0.3.2.patch +22 -4
- package/src/account/auth-dialog.tsx +22 -4
- package/src/account/auth-form.tsx +6 -1
- package/src/account/checkout-handoff.tsx +7 -14
- package/src/account/device-signin-dialog.tsx +35 -24
- package/src/api-client/crypto-markets.ts +10 -0
- package/src/api-client/errors.ts +3 -1
- package/src/api-client/index.ts +54 -0
- package/src/api-client/install-experiments.ts +8 -7
- package/src/api-client/money-markets.ts +7 -0
- package/src/api-client/paths.ts +2 -1
- package/src/api-client/product-waitlist.ts +63 -0
- package/src/api-client/request.ts +16 -4
- package/src/api-client/types/billing.ts +45 -0
- package/src/api-client/yearly-plan.ts +132 -0
- package/src/app/global-shortcuts.ts +5 -3
- package/src/app/pane-runtime/index.tsx +2 -2
- package/src/app/pane-runtime/plugin-bindings.ts +3 -1
- package/src/app/pane-runtime/ticker-open-runtime.ts +6 -1
- package/src/app/since-last-visit/keys.ts +26 -0
- package/src/app/since-last-visit/model.ts +266 -0
- package/src/app/since-last-visit/strip.tsx +193 -0
- package/src/app/since-last-visit/use-since-last-visit.ts +289 -0
- package/src/app/since-last-visit/visit-tracker.ts +191 -0
- package/src/app.tsx +15 -0
- package/src/architecture/floating-promise-allowlist.json +0 -1
- package/src/brokers/signed-in/sign-in-dialog.tsx +38 -38
- package/src/cli/commands/market.ts +103 -27
- package/src/cli/commands/overview.ts +18 -4
- package/src/cli/commands/system.ts +29 -1
- package/src/cli/commands/ticker.ts +12 -5
- package/src/cli/desktop-pane-shot-api-policy.ts +4 -1
- package/src/cli/desktop-pane-shot-browser.ts +2 -1
- package/src/cli/desktop-pane-shot-view.ts +3 -7
- package/src/cli/desktop-pane-shot.ts +26 -28
- package/src/cli/errors.ts +3 -1
- package/src/cli/freshness.ts +7 -2
- package/src/cli/glossary.ts +10 -5
- package/src/cli/help.ts +1 -0
- package/src/cli/helpers.ts +8 -16
- package/src/cli/history-export.ts +4 -0
- package/src/cli/history-rows.ts +24 -0
- package/src/cli/index.ts +4 -0
- package/src/cli/known-gaps.ts +2 -2
- package/src/cli/listing-arg.ts +79 -11
- package/src/cli/not-a-ticker.ts +4 -0
- package/src/cli/options.ts +29 -1
- package/src/cli/pane-functions/catalog.ts +70 -12
- package/src/cli/pane-functions/function-help.ts +1 -1
- package/src/cli/pane-functions/headless.ts +68 -3
- package/src/cli/pane-functions/index.ts +2 -2
- package/src/cli/pane-functions/options.ts +7 -0
- package/src/cli/pane-functions/resolver.ts +104 -15
- package/src/cli/pane-functions/screenshot-payload.ts +3 -0
- package/src/cli/report-tables.ts +20 -5
- package/src/cli/result.ts +22 -4
- package/src/cli/shot-temp-dir.ts +30 -0
- package/src/cli/suffixed-listing-rows.ts +11 -0
- package/src/cli/symbol-args.ts +5 -3
- package/src/cli/symbol-list.ts +23 -10
- package/src/cli/symbol-rows.ts +135 -3
- package/src/cli/treasury-yields.ts +15 -1
- package/src/components/chart/composite/composite-chart.tsx +3 -3
- package/src/components/chart/composite/format.ts +2 -1
- package/src/components/chart/composite/panel-surface/axis-markers.ts +133 -0
- package/src/components/chart/composite/panel-surface/level-labels.tsx +78 -0
- package/src/components/chart/composite/panel-surface/overlays.ts +108 -0
- package/src/components/chart/composite/panel-surface/pan-coast.ts +54 -0
- package/src/components/chart/composite/panel-surface/panel-cursor.tsx +138 -0
- package/src/components/chart/composite/panel-surface/panel-levels.ts +47 -0
- package/src/components/chart/composite/panel-surface/plot-gestures.ts +403 -0
- package/src/components/chart/composite/panel-surface/plot-pointer.ts +65 -0
- package/src/components/chart/composite/panel-surface/plot-wheel.ts +102 -0
- package/src/components/chart/composite/panel-surface/pointer.ts +12 -0
- package/src/components/chart/composite/panel-surface/props.ts +79 -0
- package/src/components/chart/composite/panel-surface/tool-readout.ts +151 -0
- package/src/components/chart/composite/panel-surface/value-axis-gestures.ts +152 -0
- package/src/components/chart/composite/panel-surface.tsx +81 -1177
- package/src/components/command-bar/commands/collection-list.ts +1 -0
- package/src/components/command-bar/commands/direct/index.ts +31 -8
- package/src/components/command-bar/commands/registry.ts +7 -0
- package/src/components/command-bar/routes/root/command-items.ts +8 -0
- package/src/components/command-bar/routes/root/results.ts +19 -2
- package/src/components/command-bar/routes/root/runtime.ts +3 -2
- package/src/components/command-bar/routes/root/selection.ts +3 -2
- package/src/components/command-bar/routes/root/shortcuts.ts +15 -0
- package/src/components/company-logo.tsx +10 -3
- package/src/components/data-table/sections.ts +6 -1
- package/src/components/layout/pane/title.ts +16 -6
- package/src/components/layout/shell/index.tsx +5 -1
- package/src/components/layout/shell/ticker-link-menu.ts +12 -9
- package/src/components/pane-settings-dialog/tui.tsx +6 -3
- package/src/components/pane-settings-dialog.tsx +2 -1
- package/src/components/pane-template-wizard.tsx +2 -0
- package/src/components/ticker/badge/format.ts +12 -3
- package/src/components/ticker/badge/index.tsx +9 -3
- package/src/components/ticker/list-table-view.tsx +119 -17
- package/src/components/ui/choice-dialog.tsx +1 -1
- package/src/components/ui/confirm-dialog.tsx +3 -2
- package/src/components/ui/data-table/display-columns.ts +16 -0
- package/src/components/ui/data-table/index.tsx +40 -9
- package/src/components/ui/data-table/types.ts +14 -0
- package/src/components/ui/frame.tsx +7 -3
- package/src/components/ui/icon.tsx +4 -2
- package/src/components/ui/list-view.tsx +8 -0
- package/src/components/ui/number-prompt-dialog.tsx +2 -1
- package/src/components/use-pane-notice-footer.tsx +3 -1
- package/src/core/state/app/layout-reducer.ts +3 -1
- package/src/core/state/app/layout.ts +2 -2
- package/src/data/config/layout.ts +14 -0
- package/src/data/config/store/normalize.ts +11 -1
- package/src/docs/snapshot.json +2 -2
- package/src/i18n/es.ts +39 -0
- package/src/i18n/ja.ts +39 -0
- package/src/i18n/ko.ts +39 -0
- package/src/i18n/zh-cn.ts +39 -0
- package/src/i18n/zh-tw.ts +39 -0
- package/src/layout/pane-follow.ts +141 -4
- package/src/layout/pane-layout-move.ts +10 -7
- package/src/layout/ticker-navigation.ts +13 -19
- package/src/layout/ticker-retarget.ts +3 -2
- package/src/market-data/market/format.ts +35 -1
- package/src/market-data/market/index-level.ts +19 -0
- package/src/market-data/quotes/contributions.ts +13 -0
- package/src/market-data/quotes/export-identity.ts +36 -1
- package/src/market-data/quotes/resolution.ts +16 -0
- package/src/plugins/builtin/account-management/keyboard.ts +14 -0
- package/src/plugins/builtin/account-management/model.ts +2 -0
- package/src/plugins/builtin/account-management/pane.tsx +79 -7
- package/src/plugins/builtin/account-management/password-dialog.tsx +2 -2
- package/src/plugins/builtin/account-management/payment-recovery-row.tsx +97 -0
- package/src/plugins/builtin/account-management/yearly-plan-row.tsx +359 -0
- package/src/plugins/builtin/analytics/risk-client.ts +12 -2
- package/src/plugins/builtin/analytics/risk-headless.ts +66 -6
- package/src/plugins/builtin/analytics/risk-math.ts +23 -6
- package/src/plugins/builtin/analytics/risk-model.ts +20 -9
- package/src/plugins/builtin/analytics/risk-pane.tsx +2 -2
- package/src/plugins/builtin/awards/pane.tsx +6 -8
- package/src/plugins/builtin/changelog/index.tsx +6 -44
- package/src/plugins/builtin/changelog/versions.ts +17 -68
- package/src/plugins/builtin/chart-composer/catalog-inventory.ts +5 -2
- package/src/plugins/builtin/chart-composer/editor.tsx +1 -0
- package/src/plugins/builtin/chart-composer/pane.tsx +1 -1
- package/src/plugins/builtin/chart-composer/quick-add.tsx +4 -1
- package/src/plugins/builtin/chart-composer/series-catalog.ts +17 -1
- package/src/plugins/builtin/cloud/askg/executor.ts +2 -1
- package/src/plugins/builtin/cloud/askg/sources.ts +2 -1
- package/src/plugins/builtin/cloud/plugin.tsx +2 -0
- package/src/plugins/builtin/cloud/thesis/module.tsx +2 -0
- package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +6 -2
- package/src/plugins/builtin/cpi/headless.ts +6 -1
- package/src/plugins/builtin/cpi/model.ts +17 -0
- package/src/plugins/builtin/cpi/pane.tsx +4 -2
- package/src/plugins/builtin/crypto-board/client.ts +6 -1
- package/src/plugins/builtin/crypto-board/headless.ts +10 -2
- package/src/plugins/builtin/crypto-board/model.ts +89 -11
- package/src/plugins/builtin/crypto-board/pane.tsx +20 -5
- package/src/plugins/builtin/debt-maturities/model.ts +1 -1
- package/src/plugins/builtin/dividend-yield/client.ts +24 -2
- package/src/plugins/builtin/dividend-yield/headless.ts +4 -2
- package/src/plugins/builtin/dividend-yield/ranking.ts +2 -1
- package/src/plugins/builtin/dividend-yield/view.ts +5 -1
- package/src/plugins/builtin/earnings/board-table.ts +1 -1
- package/src/plugins/builtin/earnings/board.tsx +36 -16
- package/src/plugins/builtin/earnings/highlight.ts +47 -0
- package/src/plugins/builtin/earnings/history-table.ts +9 -1
- package/src/plugins/builtin/earnings/index.tsx +1 -1
- package/src/plugins/builtin/earnings-calls/pane.tsx +2 -2
- package/src/plugins/builtin/earnings-ripple/index.tsx +2 -0
- package/src/plugins/builtin/econ/calendar-model.ts +17 -1
- package/src/plugins/builtin/econ/fred-catalog.ts +33 -4
- package/src/plugins/builtin/econ-statistics/headless.ts +21 -0
- package/src/plugins/builtin/estimate-revisions/model.ts +1 -1
- package/src/plugins/builtin/exposure/index.tsx +1 -1
- package/src/plugins/builtin/macro-day/headless.ts +21 -10
- package/src/plugins/builtin/macro-day/model.ts +42 -3
- package/src/plugins/builtin/macro-day/pane.tsx +26 -8
- package/src/plugins/builtin/macro-day/releases.ts +24 -1
- package/src/plugins/builtin/market-valuation/detail.tsx +3 -3
- package/src/plugins/builtin/market-valuation/headless.ts +11 -4
- package/src/plugins/builtin/market-valuation/pane.tsx +3 -1
- package/src/plugins/builtin/market-valuation/view.ts +14 -0
- package/src/plugins/builtin/money-markets/client.ts +4 -1
- package/src/plugins/builtin/money-markets/headless.ts +15 -4
- package/src/plugins/builtin/money-markets/index.tsx +1 -1
- package/src/plugins/builtin/money-markets/pane.tsx +7 -1
- package/src/plugins/builtin/news/wire/news/detail-view.tsx +20 -8
- package/src/plugins/builtin/pe-band/pane.tsx +1 -1
- package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +4 -2
- package/src/plugins/builtin/portfolio-list/cli/period-report.ts +61 -11
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +11 -3
- package/src/plugins/builtin/portfolio-list/cli/render.ts +8 -1
- package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +178 -17
- package/src/plugins/builtin/portfolio-list/headless.ts +33 -6
- package/src/plugins/builtin/portfolio-list/pane/groups.tsx +220 -0
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +95 -18
- package/src/plugins/builtin/portfolio-list/pane/period-pnl.ts +24 -6
- package/src/plugins/builtin/portfolio-list/period-pnl.ts +16 -1
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +4 -1
- package/src/plugins/builtin/portfolio-list/summary/totals.ts +6 -4
- package/src/plugins/builtin/portfolio-list/table.tsx +38 -16
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +4 -2
- package/src/plugins/builtin/research/relative-valuation-headless.ts +15 -5
- package/src/plugins/builtin/research/relative-valuation-model.ts +7 -1
- package/src/plugins/builtin/research/relative-valuation-pane.tsx +7 -4
- package/src/plugins/builtin/shared/cloud-upgrade.ts +4 -2
- package/src/plugins/builtin/shared/cpi-year-gap.ts +67 -0
- package/src/plugins/builtin/shared/headless-options.ts +1 -1
- package/src/plugins/builtin/social-mentions/model.ts +2 -2
- package/src/plugins/builtin/thirteenf/pane.tsx +1 -1
- package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +45 -2
- package/src/plugins/builtin/ticker-detail/financials/model.ts +51 -16
- package/src/plugins/builtin/ticker-detail/financials/nopat.ts +16 -0
- package/src/plugins/builtin/ticker-detail/financials/ratios.ts +44 -13
- package/src/plugins/builtin/ticker-detail/financials/schema.ts +33 -2
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +4 -2
- package/src/plugins/builtin/ticker-detail/headless-schema.ts +30 -4
- package/src/plugins/builtin/ticker-detail/headless.ts +280 -35
- package/src/plugins/builtin/ticker-detail/overview/components.tsx +4 -5
- package/src/plugins/builtin/ticker-detail/overview/model.ts +9 -2
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +10 -2
- package/src/plugins/builtin/ticker-detail/pharma-signals/eligibility.ts +32 -0
- package/src/plugins/builtin/ticker-detail/pharma-signals/tab.tsx +162 -0
- package/src/plugins/builtin/ticker-detail/pharma-signals/waitlist.ts +126 -0
- package/src/plugins/builtin/ticker-detail/research-groups.ts +6 -4
- package/src/plugins/builtin/ticker-detail/research-tabs.ts +11 -0
- package/src/portfolio/collection-name.ts +2 -1
- package/src/portfolio/column-values.ts +34 -12
- package/src/portfolio/listed-symbol.ts +4 -2
- package/src/portfolio/period-pnl.ts +51 -1
- package/src/portfolio/suffixed-listings.ts +3 -1
- package/src/portfolio/watchlist-groups.ts +212 -0
- package/src/react/ticker-source.ts +3 -1
- package/src/renderers/dom/dialog-host.tsx +5 -5
- package/src/renderers/dom/styles.css +7 -0
- package/src/renderers/electrobun/view/remote/capability-invoker.ts +1 -1
- package/src/renderers/opentui/dialog-host.tsx +3 -4
- package/src/sources/gloomberb-cloud/normalizers.ts +5 -0
- package/src/sources/provider-router/history.ts +5 -2
- package/src/state/app/bootstrap.ts +11 -0
- package/src/state/app/context/index.tsx +6 -0
- package/src/sync/collections-contributor.ts +5 -2
- package/src/sync/config-merge.ts +10 -2
- package/src/sync/sanitize.ts +28 -0
- package/src/telemetry/usage-counts.ts +17 -0
- package/src/test-support/plugin-persistence.ts +12 -0
- package/src/tickers/company-name-listing.ts +4 -3
- package/src/tickers/company-name.ts +19 -1
- package/src/tickers/instrument-coverage.ts +27 -0
- package/src/tickers/search/home-listing.ts +38 -1
- package/src/tickers/search/index.ts +3 -2
- package/src/tickers/search/ranking.ts +21 -2
- package/src/time-series/base-series.ts +4 -0
- package/src/time-series/chart-seed.ts +1 -1
- package/src/time-series/financial-period-coverage.ts +4 -12
- package/src/time-series/parsed-history-cache.ts +1 -1
- package/src/time-series/resolve.ts +1 -1
- package/src/time-series/types.ts +5 -2
- package/src/time-series/use-chart-resolution.ts +6 -1
- package/src/types/config.ts +32 -0
- package/src/types/financials.ts +13 -0
- package/src/types/headless.ts +7 -0
- package/src/types/plugin-context.ts +5 -0
- package/src/types/ticker.ts +14 -0
- package/src/ui/ascii-font.ts +1 -4
- package/src/ui/dialog-stack.ts +17 -0
- package/src/ui/dialog.tsx +6 -2
- package/src/utils/async-deadline.ts +2 -2
- package/src/utils/crypto-pair.ts +9 -0
- package/src/utils/csv.ts +44 -5
- package/src/utils/exchanges.ts +13 -0
- package/src/utils/financial-statements.ts +60 -3
- package/src/utils/futures-generic.ts +17 -0
- package/src/utils/trailing-dividend.ts +13 -3
|
@@ -312,8 +312,9 @@ export function filledPeriodsNote(
|
|
|
312
312
|
// A TTM Gloom Cloud built from the year and the half since it says how.
|
|
313
313
|
const basis = statements.find(({ aggregation }) => aggregation?.kind === "annual-plus-interim")?.aggregation?.basis;
|
|
314
314
|
const trailing = basis ? `TTM is ${basis}, from the company's results announcements.` : null;
|
|
315
|
+
const withheld = withheldLinesNote(statements, shown);
|
|
315
316
|
const filled = filledPeriods(statements, shown);
|
|
316
|
-
if (filled.length === 0) return trailing;
|
|
317
|
+
if (filled.length === 0) return [trailing, withheld].filter(Boolean).join(" ") || null;
|
|
317
318
|
const sources = [...new Set(filled.map((period) => period.source))];
|
|
318
319
|
let note: string;
|
|
319
320
|
// Each announcement dates its own periods: "TTM revenue; 2025-12-31 revenue (published 2026-03-25)", and
|
|
@@ -327,7 +328,60 @@ export function filledPeriodsNote(
|
|
|
327
328
|
const read = filled.map(({ stamp }) => stamp.date).sort().at(-1);
|
|
328
329
|
note = `From ${sources.join(" and ")} (read ${read}): ${filled.map(({ period, fields }) => `${period} ${fields.join(", ")}`).join("; ")}.`;
|
|
329
330
|
}
|
|
330
|
-
return [note, omittedLinesNote(statements, shown), trailing].filter(Boolean).join(" ");
|
|
331
|
+
return [note, omittedLinesNote(statements, shown), trailing, withheld].filter(Boolean).join(" ");
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
type WithheldLines = Record<string, { value?: number; reason?: string } | undefined>;
|
|
335
|
+
|
|
336
|
+
/** The lines a row says Gloom Cloud left blank (`withheld`), read through a cast: the type does not name it. */
|
|
337
|
+
function withheldOf(row: FinancialStatement | undefined): WithheldLines | undefined {
|
|
338
|
+
const withheld = (row as { withheld?: unknown } | undefined)?.withheld;
|
|
339
|
+
return withheld && typeof withheld === "object" ? withheld as WithheldLines : undefined;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/** Keeps the lines either row withholds as below zero blank in their merge, and says so on it. */
|
|
343
|
+
function withholdBelowZero(merged: FinancialStatement, rows: ReadonlyArray<FinancialStatement | undefined>): void {
|
|
344
|
+
const withheld = Object.assign({}, ...rows.map(withheldOf).reverse()) as WithheldLines;
|
|
345
|
+
if (Object.keys(withheld).length === 0) return;
|
|
346
|
+
const values = merged as unknown as Record<string, unknown>;
|
|
347
|
+
values.withheld = withheld;
|
|
348
|
+
for (const [field, entry] of Object.entries(withheld)) {
|
|
349
|
+
const value = values[field];
|
|
350
|
+
if (entry?.reason === "below-zero" && typeof value === "number" && value < 0) delete values[field];
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/** Expense lines Gloom Cloud serves blank where the statements source gives them below zero (the row's `withheld`). */
|
|
355
|
+
const WITHHELD_LINES: Record<string, string> = {
|
|
356
|
+
costOfRevenue: "cost of revenue",
|
|
357
|
+
sellingGeneralAndAdministration: "SG&A",
|
|
358
|
+
sellingAndMarketingExpense: "selling and marketing",
|
|
359
|
+
generalAndAdministrativeExpense: "G&A",
|
|
360
|
+
researchAndDevelopment: "R&D",
|
|
361
|
+
operatingExpense: "operating expenses",
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* "SG&A blank for 2026-06-30, 2025-12-31, 2025-06-30: source value below zero.": lines Gloom Cloud left blank
|
|
366
|
+
* rather than serve an impossible figure (CATL's SG&A, read by the source as a difference of years to date it
|
|
367
|
+
* counts otherwise). `shown` keeps the lines the table has a row for. Null when none is.
|
|
368
|
+
*/
|
|
369
|
+
function withheldLinesNote(statements: readonly Pick<FinancialStatement, "date">[], shown?: ReadonlySet<string>): string | null {
|
|
370
|
+
const ends = new Map<string, string[]>();
|
|
371
|
+
for (const row of statements) {
|
|
372
|
+
const withheld = withheldOf(row as FinancialStatement);
|
|
373
|
+
if (!withheld || !/^\d{4}-\d{2}-\d{2}/.test(row.date)) continue;
|
|
374
|
+
for (const [field, entry] of Object.entries(withheld)) {
|
|
375
|
+
const line = WITHHELD_LINES[field];
|
|
376
|
+
if (!line || entry?.reason !== "below-zero" || (shown && !shown.has(field))) continue;
|
|
377
|
+
// Another source's figure for it, merged in, is shown: not blank.
|
|
378
|
+
if (typeof (row as unknown as Record<string, unknown>)[field] === "number") continue;
|
|
379
|
+
ends.set(line, [...ends.get(line) ?? [], row.date.slice(0, 10)]);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
if (ends.size === 0) return null;
|
|
383
|
+
const lines = [...ends].map(([line, dates]) => `${line} blank for ${[...new Set(dates)].sort().reverse().join(", ")}`).join("; ");
|
|
384
|
+
return `${lines}: source value below zero.`;
|
|
331
385
|
}
|
|
332
386
|
|
|
333
387
|
/** "2026-09-30, 2026-06-30 revenue left blank: the company's results announcements count it otherwise than the statements source." */
|
|
@@ -377,7 +431,7 @@ export function quarterRows<T extends Pick<FinancialStatement, "filledFrom">>(ro
|
|
|
377
431
|
|
|
378
432
|
export const SEC_EPS_BASIS_NOTICE = "SEC EPS uses corroborated split-adjusted share bases. Unverified bases are unavailable.";
|
|
379
433
|
|
|
380
|
-
const STATEMENT_METADATA_KEYS = new Set(["date", "dateSource", "accountingStandard", "providerDate", "dateEvidence", "currency", "availableAt", "fieldAvailability", "epsBasis", "fieldSources", "unavailableFields", "withdrawnObservations", "operatingResult", "operatingResultAggregation", "earningsResult", "unavailableEarnings", "filledFrom"]);
|
|
434
|
+
const STATEMENT_METADATA_KEYS = new Set(["date", "dateSource", "accountingStandard", "providerDate", "dateEvidence", "currency", "availableAt", "fieldAvailability", "epsBasis", "fieldSources", "unavailableFields", "withdrawnObservations", "operatingResult", "operatingResultAggregation", "earningsResult", "unavailableEarnings", "filledFrom", "withheld"]);
|
|
381
435
|
const NEARBY_PERIOD_END_MS = 7 * 24 * 60 * 60 * 1_000;
|
|
382
436
|
|
|
383
437
|
/** An explicit field map is authoritative: omitted fields have unknown availability. */
|
|
@@ -588,6 +642,9 @@ export function mergeFinancialStatementRows(
|
|
|
588
642
|
}
|
|
589
643
|
}
|
|
590
644
|
|
|
645
|
+
// A line Gloom Cloud left blank as below zero stays blank: no other copy's figure below zero (a copy saved
|
|
646
|
+
// before, or another source's) fills it.
|
|
647
|
+
withholdBelowZero(merged, [row, fallback]);
|
|
591
648
|
// A gap either report declares for the period survives the other's value.
|
|
592
649
|
mergeStatementGaps(merged, [row, fallback]);
|
|
593
650
|
const fill = retainedFill(merged, [row, fallback]);
|
|
@@ -231,6 +231,23 @@ export function futuresContractMonth(code: string): { root: string; month: numbe
|
|
|
231
231
|
return { root: match[1]!, month: (2000 + Number(match[3])) * 12 + MONTH_CODES.indexOf(match[2]!) };
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
+
/**
|
|
235
|
+
* A dated contract typed without its venue (ZQZ26), named as its quote is, with
|
|
236
|
+
* the venue that lists its root: ZQZ26.CBT, as WIRP prints it. A Bloomberg
|
|
237
|
+
* root reads as the exchange's (FFZ26 is ZQZ26.CBT). Null for a root Gloom
|
|
238
|
+
* Cloud does not archive and for any other code.
|
|
239
|
+
*/
|
|
240
|
+
export function venueOfDatedContract(code: string): string | null {
|
|
241
|
+
const match = /^([A-Z0-9]{1,4}?)([FGHJKMNQUVXZ])(\d{2})$/.exec(code.trim().toUpperCase());
|
|
242
|
+
if (!match) return null;
|
|
243
|
+
const year = 2000 + Number(match[3]);
|
|
244
|
+
const currentYear = new Date().getUTCFullYear();
|
|
245
|
+
if (year < currentYear - 1 || year > currentYear + 10) return null;
|
|
246
|
+
const root = ALIASES[match[1]!] ?? match[1]!;
|
|
247
|
+
const venue = ROOT_VENUES[root];
|
|
248
|
+
return venue ? `${root}${match[2]}${match[3]}.${venue}` : null;
|
|
249
|
+
}
|
|
250
|
+
|
|
234
251
|
/** A root's contract for a delivery month as `futuresContractMonth` counts it: CL and 2026 × 12 + 11 are CLZ26. */
|
|
235
252
|
export function futuresContractCode(root: string, month: number): string {
|
|
236
253
|
return `${root}${MONTH_CODES[month % 12]}${String(Math.floor(month / 12) % 100).padStart(2, "0")}`;
|
|
@@ -34,13 +34,23 @@ const MAX_LATE_GRACE_DAYS = 30;
|
|
|
34
34
|
export const LATE_GRACE_DAYS = [...new Set(Object.values(REGULAR_CADENCE)
|
|
35
35
|
.map((cadence) => Math.min(cadence.halfPeriodDays, MAX_LATE_GRACE_DAYS)))];
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* How far past two years the cadence looks when those two years hold a single ex-date: an annual payer whose
|
|
39
|
+
* ex-date came a few days later than the year before (Moutai's June 25, 2021 and June 30, 2022) has one in
|
|
40
|
+
* them for those days, and read as no cadence its trailing cash fell to nothing until the late one went ex.
|
|
41
|
+
*/
|
|
42
|
+
export const CADENCE_GRACE_DAYS = MAX_LATE_GRACE_DAYS;
|
|
43
|
+
|
|
37
44
|
/** Cadence of ex-dates in the two years ending at `asOf`, ignoring later payments. */
|
|
38
45
|
export function inferCadence(payments: readonly Pick<CashDistribution, "exDate">[], asOf: Date): DistributionCadence | null {
|
|
39
|
-
const
|
|
40
|
-
// Old suspensions or a former schedule must not redefine a fund's recent cadence.
|
|
41
|
-
const dates = [...new Set(payments.filter((payment) => payment.exDate > cutoff && payment.exDate <= asOf)
|
|
46
|
+
const within = (cutoff: Date) => [...new Set(payments.filter((payment) => payment.exDate > cutoff && payment.exDate <= asOf)
|
|
42
47
|
.map((payment) => payment.exDate.getTime()))]
|
|
43
48
|
.sort((a, b) => a - b);
|
|
49
|
+
const cutoff = calendarMonthsBefore(asOf, 24);
|
|
50
|
+
// Old suspensions or a former schedule must not redefine a fund's recent cadence.
|
|
51
|
+
let dates = within(cutoff);
|
|
52
|
+
// A single ex-date in two years: the one before it, if only days past them, says the cadence.
|
|
53
|
+
if (dates.length === 1) dates = within(new Date(cutoff.getTime() - CADENCE_GRACE_DAYS * DAY));
|
|
44
54
|
if (dates.length < 2) return null;
|
|
45
55
|
const avgGapDays = (dates.at(-1)! - dates[0]!) / (dates.length - 1) / DAY;
|
|
46
56
|
if (Math.abs(avgGapDays - 30) < 8) return "monthly";
|