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
package/src/app.tsx
CHANGED
|
@@ -77,6 +77,8 @@ import { isPaneShareHandoff } from "./shares/location";
|
|
|
77
77
|
import { apiClient } from "./api-client";
|
|
78
78
|
import { reportTelemetryConfig } from "./telemetry/live-config";
|
|
79
79
|
import { AttentionCountsNotice } from "./app/attention-notice";
|
|
80
|
+
import { useSinceLastVisit } from "./app/since-last-visit/use-since-last-visit";
|
|
81
|
+
import { SinceLastVisitStrip } from "./app/since-last-visit/strip";
|
|
80
82
|
import { recordFunctionOpen } from "./telemetry/usage-counts";
|
|
81
83
|
import { logFailure } from "./utils/log-failure";
|
|
82
84
|
|
|
@@ -486,6 +488,17 @@ function AppInner({
|
|
|
486
488
|
}
|
|
487
489
|
}, [focusedTickerSymbol]);
|
|
488
490
|
|
|
491
|
+
// What moved in the user's tickers since their last visit: the main window
|
|
492
|
+
// only, never over setup or the sign-in gate, never in presentation mode.
|
|
493
|
+
const sinceLastVisit = useSinceLastVisit({
|
|
494
|
+
active: !appWideWorkElsewhere && !onboardingActive && !signInGateActive,
|
|
495
|
+
marketData,
|
|
496
|
+
pluginState: pluginRegistry.persistence.pluginState,
|
|
497
|
+
pluginsReady,
|
|
498
|
+
notify: notifyRequest,
|
|
499
|
+
});
|
|
500
|
+
const showSinceLastVisit = !!sinceLastVisit.recap && state.config.presentationMode !== true;
|
|
501
|
+
|
|
489
502
|
const chrome = useAppChromeShown();
|
|
490
503
|
const keybindingHost = useUiHost().kind === "opentui" ? "terminal" : "desktop";
|
|
491
504
|
const keybindings = useResolvedKeybindings(state.config.keybindings, keybindingHost);
|
|
@@ -547,6 +560,7 @@ function AppInner({
|
|
|
547
560
|
onRestartForUpdate={updatesEnabled && !isDetachedWindow ? restartToApplyUpdate : undefined}
|
|
548
561
|
/>
|
|
549
562
|
)}
|
|
563
|
+
{showSinceLastVisit ? <SinceLastVisitStrip strip={sinceLastVisit} /> : null}
|
|
550
564
|
<TransientLayoutProvider>
|
|
551
565
|
<Shell
|
|
552
566
|
pluginRegistry={pluginRegistry}
|
|
@@ -555,6 +569,7 @@ function AppInner({
|
|
|
555
569
|
desktopWindowBridge={desktopWindowBridge}
|
|
556
570
|
desktopDockPreview={desktopDockPreview}
|
|
557
571
|
commandBarNativeOccluder={commandBarNativeOccluder}
|
|
572
|
+
topBandRows={showSinceLastVisit ? 1 : 0}
|
|
558
573
|
/>
|
|
559
574
|
<StatusBar />
|
|
560
575
|
</TransientLayoutProvider>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"src/account/auth-dialog.tsx": ["void:dialog.prompt().then().finally()"],
|
|
3
3
|
"src/account/checkout-handoff.tsx": ["void:value.opened.then()"],
|
|
4
|
-
"src/account/device-signin-dialog.tsx": ["void:dialog.prompt().then().finally()"],
|
|
5
4
|
"src/account/device-signin.ts": ["void:this.run()"],
|
|
6
5
|
"src/account/email-auth-attempt.ts": ["void:function()"],
|
|
7
6
|
"src/account/verification-panel.tsx": ["void:check()","void:check()","void:check()","void:check()"],
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* exported here.
|
|
8
8
|
*/
|
|
9
9
|
import { useEffect, useRef, useState } from "react";
|
|
10
|
-
import { apiClient
|
|
10
|
+
import { apiClient } from "../../api-client";
|
|
11
11
|
import { SignInCodePanel } from "../../components/sign-in-code-panel";
|
|
12
12
|
import { Button } from "../../components/ui/button";
|
|
13
13
|
import { DialogActions } from "../../components/ui/dialog-actions";
|
|
@@ -17,11 +17,12 @@ import { useAppLanguage } from "../../i18n/react";
|
|
|
17
17
|
import { useViewport } from "../../react/input";
|
|
18
18
|
import { colors } from "../../theme/colors";
|
|
19
19
|
import { useThemeColors } from "../../theme/theme-context";
|
|
20
|
-
import { Box, Text,
|
|
20
|
+
import { Box, Text, useUiCapabilities } from "../../ui";
|
|
21
21
|
import { useDialog, useDialogKeyboard, type DialogApi, type PromptContext } from "../../ui/dialog";
|
|
22
|
+
import { clickOutsideWhileClean } from "../../ui/dialog-stack";
|
|
22
23
|
import { isPlainKey } from "../../utils/keyboard";
|
|
23
24
|
import { wrapTextLines } from "../../utils/text-wrap";
|
|
24
|
-
import {
|
|
25
|
+
import { promptDeviceSignIn } from "../../account/device-signin-dialog";
|
|
25
26
|
import type { BrokerReplacePrompt, SignedInBroker } from "./client";
|
|
26
27
|
import {
|
|
27
28
|
BrokerSignInController,
|
|
@@ -122,10 +123,7 @@ export function useBrokerSignInAttempt(
|
|
|
122
123
|
|
|
123
124
|
/** Gloom's device sign-in, stacked over whatever asked for it. True once signed in. */
|
|
124
125
|
export async function promptGloomSignIn(dialog: DialogApi): Promise<boolean> {
|
|
125
|
-
return !!await dialog
|
|
126
|
-
size: "full",
|
|
127
|
-
content: (context: unknown) => <DeviceSignInDialog {...(context as PromptContext<AuthUser | undefined>)} />,
|
|
128
|
-
});
|
|
126
|
+
return !!await promptDeviceSignIn(dialog);
|
|
129
127
|
}
|
|
130
128
|
|
|
131
129
|
/**
|
|
@@ -147,11 +145,14 @@ function BrokerSignInDialog({
|
|
|
147
145
|
write,
|
|
148
146
|
renew,
|
|
149
147
|
replace,
|
|
148
|
+
onCleanChange,
|
|
150
149
|
}: PromptContext<BrokerSignInOutcome> & {
|
|
151
150
|
broker: SignedInBroker;
|
|
152
151
|
write: boolean;
|
|
153
152
|
renew: boolean;
|
|
154
153
|
replace: BrokerReplacePrompt | null;
|
|
154
|
+
/** A click outside closes it only while no link is out: never while the broker may be connecting through one. */
|
|
155
|
+
onCleanChange?: (clean: boolean) => void;
|
|
155
156
|
}) {
|
|
156
157
|
useAppLanguage();
|
|
157
158
|
const { nativePaneChrome } = useUiCapabilities();
|
|
@@ -159,6 +160,8 @@ function BrokerSignInDialog({
|
|
|
159
160
|
// Close after a beat so "Connected" is visible; enter skips the wait. Signed
|
|
160
161
|
// out closes at once, for the host to sign in to Gloom.
|
|
161
162
|
const { snapshot, restart, finish } = useBrokerSignInAttempt(broker, write, resolve, { renew });
|
|
163
|
+
const pending = snapshot.phase === "waiting" || snapshot.phase === "connected";
|
|
164
|
+
useEffect(() => onCleanChange?.(!pending), [onCleanChange, pending]);
|
|
162
165
|
|
|
163
166
|
useDialogKeyboard((event) => {
|
|
164
167
|
event.stopPropagation();
|
|
@@ -197,27 +200,19 @@ function BrokerSignInDialog({
|
|
|
197
200
|
);
|
|
198
201
|
}
|
|
199
202
|
|
|
203
|
+
// The kit's frame, as every other dialog: its close button is a mouse's way out.
|
|
200
204
|
return (
|
|
201
|
-
<
|
|
202
|
-
<Box
|
|
203
|
-
<
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
205
|
+
<DialogFrame title={title} subtitle={subtitle} footer={t("r for a new link · esc to cancel")} onClose={dismiss}>
|
|
206
|
+
<Box flexDirection="column" alignItems="center">
|
|
207
|
+
<BrokerConnectView
|
|
208
|
+
broker={broker}
|
|
209
|
+
snapshot={snapshot}
|
|
210
|
+
height={Math.max(4, termHeight - TERMINAL_DIALOG_ROWS)}
|
|
211
|
+
width={Math.max(10, termWidth - TERMINAL_DIALOG_INSET)}
|
|
212
|
+
replace={replace}
|
|
213
|
+
/>
|
|
207
214
|
</Box>
|
|
208
|
-
|
|
209
|
-
<BrokerConnectView
|
|
210
|
-
broker={broker}
|
|
211
|
-
snapshot={snapshot}
|
|
212
|
-
height={Math.max(4, termHeight - TERMINAL_DIALOG_ROWS)}
|
|
213
|
-
width={Math.max(10, termWidth - TERMINAL_DIALOG_INSET)}
|
|
214
|
-
replace={replace}
|
|
215
|
-
/>
|
|
216
|
-
<Box height={1} />
|
|
217
|
-
<Box height={1}>
|
|
218
|
-
<Text fg={colors.textMuted}>{t("r for a new link · esc to cancel")}</Text>
|
|
219
|
-
</Box>
|
|
220
|
-
</Box>
|
|
215
|
+
</DialogFrame>
|
|
221
216
|
);
|
|
222
217
|
}
|
|
223
218
|
|
|
@@ -335,18 +330,23 @@ export function BrokerSignInDialogHost() {
|
|
|
335
330
|
void runBrokerSignIn(request.broker, request.write, {
|
|
336
331
|
isSignedIn: () => apiClient.isSignedIn(),
|
|
337
332
|
signInToGloom: () => promptGloomSignIn(dialog),
|
|
338
|
-
connectBroker: async (broker, write, renew) =>
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
333
|
+
connectBroker: async (broker, write, renew) => {
|
|
334
|
+
const { closeOnClickOutside, setClean } = clickOutsideWhileClean();
|
|
335
|
+
return await dialog.prompt<BrokerSignInOutcome>({
|
|
336
|
+
size: "full",
|
|
337
|
+
closeOnClickOutside,
|
|
338
|
+
content: (context: unknown) => (
|
|
339
|
+
<BrokerSignInDialog
|
|
340
|
+
{...(context as PromptContext<BrokerSignInOutcome>)}
|
|
341
|
+
broker={broker}
|
|
342
|
+
write={write}
|
|
343
|
+
renew={renew}
|
|
344
|
+
replace={request.replace ?? null}
|
|
345
|
+
onCleanChange={setClean}
|
|
346
|
+
/>
|
|
347
|
+
),
|
|
348
|
+
}) ?? "cancelled";
|
|
349
|
+
},
|
|
350
350
|
}, { renew: request.renew })
|
|
351
351
|
.then(request.resolve, () => request.resolve(false))
|
|
352
352
|
.finally(() => {
|
|
@@ -177,6 +177,7 @@ import {
|
|
|
177
177
|
historyPriceDecimals,
|
|
178
178
|
historyRolls,
|
|
179
179
|
historyRows,
|
|
180
|
+
historyTextVolumes,
|
|
180
181
|
historyUnit,
|
|
181
182
|
quotedPriceDivisor,
|
|
182
183
|
withDailyRebuiltBars,
|
|
@@ -243,6 +244,7 @@ import { isPesoDollarPair, loadPesoDollarRates, pesoDollarRateLines, pesoDollarR
|
|
|
243
244
|
import { withBalanceSheetRate } from "../../market-data/quotes/balance-sheet-rate";
|
|
244
245
|
import { regularSessionValuationPrice } from "../../market-data/quotes/regular-session-valuation";
|
|
245
246
|
import { atLivePriceEarnings } from "../../market-data/quotes/live-valuation";
|
|
247
|
+
import { quoteSourceName } from "../../market-data/quotes/export-identity";
|
|
246
248
|
import { viewMarketCapitalization } from "../../utils/market-capitalization";
|
|
247
249
|
import {
|
|
248
250
|
barHistoryFreshness,
|
|
@@ -317,11 +319,11 @@ import { withSavedCopy, type ReportFreshness } from "../pane-functions/freshness
|
|
|
317
319
|
import { isNotATickerMessage } from "../not-a-ticker";
|
|
318
320
|
import { useKnownCoins } from "../board-coins";
|
|
319
321
|
import { suggestUsTicker, type ListingSuggestion } from "../listing-suggestion";
|
|
320
|
-
import { quotedPhrase, splitSymbolArgs, symbolInputKey, uniqueSecuritySymbols } from "../symbol-args";
|
|
322
|
+
import { quotedPhrase, securityInputKey, splitSymbolArgs, symbolInputKey, uniqueSecuritySymbols } from "../symbol-args";
|
|
321
323
|
import { isCompanyNameInput } from "../../tickers/company-name-listing";
|
|
322
324
|
import { readNameEntries, readPhraseArgument } from "../name-entries";
|
|
323
325
|
import { readSymbolList, SymbolListError, type TypedForm } from "../symbol-list";
|
|
324
|
-
import { notASymbolError } from "../symbol-cells";
|
|
326
|
+
import { notASymbolError, type NotASymbolError } from "../symbol-cells";
|
|
325
327
|
import { cliPerpetualContract, perpetualContractStats, type PerpetualContractPayload } from "../perpetual-contract";
|
|
326
328
|
import { isSubMinuteInterval, knownGapMessage, subMinuteDataMessage } from "../known-gaps";
|
|
327
329
|
import { phraseSearchReport } from "./search";
|
|
@@ -542,7 +544,7 @@ async function readListedSymbols(
|
|
|
542
544
|
market: MarketContext,
|
|
543
545
|
ctx: Parameters<CliCommandDef["execute"]>[1],
|
|
544
546
|
usage: string,
|
|
545
|
-
): Promise<{ symbols: string[]; notes: string[]; typedForms: TypedForm[] }> {
|
|
547
|
+
): Promise<{ symbols: string[]; notes: string[]; typedForms: TypedForm[]; byLine: boolean }> {
|
|
546
548
|
try {
|
|
547
549
|
const typedForms: TypedForm[] = [];
|
|
548
550
|
const list = await readSymbolList({
|
|
@@ -553,7 +555,11 @@ async function readListedSymbols(
|
|
|
553
555
|
const where = file && file !== "-" ? file : args.includes("-") ? "standard input" : "what was given";
|
|
554
556
|
ctx.fail([`No symbols in ${where}.`, ...list.notes].join(" "), usage);
|
|
555
557
|
}
|
|
556
|
-
|
|
558
|
+
// A list of one entry a line from a file or standard input has a row for each of its lines (`listRows`), however
|
|
559
|
+
// many entries they read as: AAPL, a blank line and AAPL again are three rows. Typed arguments, a comma list and a
|
|
560
|
+
// table with a header keep a row per entry.
|
|
561
|
+
const byLine = typedForms.filter((form) => form.ownRow).length > 1;
|
|
562
|
+
return { symbols: uniqueEntries(list.symbols), notes: list.notes, typedForms, byLine };
|
|
557
563
|
} catch (error) {
|
|
558
564
|
if (error instanceof SymbolListError) ctx.fail(error.message, usage);
|
|
559
565
|
throw error;
|
|
@@ -764,7 +770,9 @@ const FEED_COLUMNS = [
|
|
|
764
770
|
header: "Feed",
|
|
765
771
|
shrink: false,
|
|
766
772
|
stackPriority: 4,
|
|
767
|
-
|
|
773
|
+
// A coin priced by one exchange's own trade names it on its row: `live · Coinbase`.
|
|
774
|
+
format: (value: unknown, row: QuoteRow) => value === "stale" || value === "nominal" ? cliStyles.warning(value)
|
|
775
|
+
: `${String(value ?? "")}${row.priceVenue ? ` · ${row.priceVenue}` : ""}`,
|
|
768
776
|
},
|
|
769
777
|
// A nominal price names the session it is from ("6 Nov close"), not the last print; JSON keeps both.
|
|
770
778
|
{ key: "updatedAt", header: "Updated", shrink: false, stackPriority: 5,
|
|
@@ -784,9 +792,9 @@ const CHANGE_BP_EXPORT_COLUMN = {
|
|
|
784
792
|
* read as one listing (`USDJPY Curncy`, `USDJPY`, `usdjpy`, `USD/JPY` are all USDJPY=X), and marks a row
|
|
785
793
|
* that repeats an earlier row's listing with that row's entry. After the columns an export already had.
|
|
786
794
|
*/
|
|
787
|
-
const LIST_INPUT_EXPORT_COLUMNS = [
|
|
788
|
-
{ key: "input", header: "input", value: (row
|
|
789
|
-
{ key: "duplicateOf", header: "duplicate_of", value: (row
|
|
795
|
+
const LIST_INPUT_EXPORT_COLUMNS: CliResultColumn<Record<string, unknown>>[] = [
|
|
796
|
+
{ key: "input", header: "input", value: (row) => row.input || null },
|
|
797
|
+
{ key: "duplicateOf", header: "duplicate_of", value: (row) => row.duplicateOf || null },
|
|
790
798
|
];
|
|
791
799
|
|
|
792
800
|
/** The day's low and high as numbers, after the columns an export already had. */
|
|
@@ -979,6 +987,7 @@ function quoteRows(results: QuoteCliRecord[], now = Date.now()) {
|
|
|
979
987
|
providerId: quote?.providerId ?? "",
|
|
980
988
|
source: quote?.dataSource ?? quote?.providerId ?? "",
|
|
981
989
|
feed: quoteFeedState(quote, now),
|
|
990
|
+
...quote?.priceVenue ? { priceVenue: quote.priceVenue } : {},
|
|
982
991
|
// When the price Last shows was observed: in a pre-market nothing has traded in, the close it stands at.
|
|
983
992
|
updatedAt: quote?.lastUpdated ? new Date(quoteHeadlineTime(quote)).toISOString() : "",
|
|
984
993
|
input: result.input ?? "",
|
|
@@ -1308,7 +1317,7 @@ async function runQuote(rawArgs: string[], ctx: Parameters<CliCommandDef["execut
|
|
|
1308
1317
|
}));
|
|
1309
1318
|
const tickerChanges = symbolChanges.map(({ change }) => change);
|
|
1310
1319
|
// A list's rows name the entry each is for, and mark one that is the same listing as an earlier row.
|
|
1311
|
-
const listInputs = listed && symbols.length > 1 ? quoteListInputs(asked, resolvedListings) : null;
|
|
1320
|
+
const listInputs = listed && (symbols.length > 1 || !!list?.byLine) ? quoteListInputs(asked, resolvedListings) : null;
|
|
1312
1321
|
const formerIssuers = symbolChanges.map(({ formerIssuer }) => formerIssuer);
|
|
1313
1322
|
// A symbol with no quote whose bars stopped over a month ago says when it last traded, in place of why no quote
|
|
1314
1323
|
// came: no longer listed on the service's record (FLAT, a retired ETN), else no trades since. Each costs a history
|
|
@@ -1439,7 +1448,8 @@ async function runQuote(rawArgs: string[], ctx: Parameters<CliCommandDef["execut
|
|
|
1439
1448
|
// An export of a list read from a file or standard input has a row for every line, in its order: one no listing was
|
|
1440
1449
|
// read for says why in its status, as its line on stderr does. The table keeps a row per listing.
|
|
1441
1450
|
const rows = listInputs && ctx.cliOptions.format !== "text"
|
|
1442
|
-
? listRows([...data, ...unread.map(unreadRow)
|
|
1451
|
+
? listRows([...data, ...unread.map(unreadRow), ...list?.byLine ? refused.map((error) => unlistedQuoteRow(error.input)) : []],
|
|
1452
|
+
symbols, list?.typedForms ?? [], unlistedQuoteRow)
|
|
1443
1453
|
: data;
|
|
1444
1454
|
const basisNotes = changeBasisNotes(data, now);
|
|
1445
1455
|
const midNotes = extendedMidNotes(data);
|
|
@@ -1453,6 +1463,7 @@ async function runQuote(rawArgs: string[], ctx: Parameters<CliCommandDef["execut
|
|
|
1453
1463
|
if (ctx.cliOptions.format !== "json") useKnownCoins();
|
|
1454
1464
|
// Only yield indices: their change is in bp, so the text header drops the percent sign (CSV keeps the percent it holds).
|
|
1455
1465
|
const yieldsOnly = data.length > 0 && data.every((row) => isYieldIndexSymbol(row.target.symbol));
|
|
1466
|
+
const venued = data.some((row) => row.quote?.priceVenue);
|
|
1456
1467
|
ctx.printResult({
|
|
1457
1468
|
data: rows,
|
|
1458
1469
|
warnings: warnings.length > 0 ? warnings : undefined,
|
|
@@ -1474,6 +1485,8 @@ async function runQuote(rawArgs: string[], ctx: Parameters<CliCommandDef["execut
|
|
|
1474
1485
|
|| row.currency || (row.yieldIndex ? YIELD_INDEX_EXPORT_UNIT : isIndexLevel(row.instrumentType) ? INDEX_POINTS_EXPORT_UNIT : null),
|
|
1475
1486
|
// Each row as of its own price (^TNX's 19:59 beside ^VIX's 21:15), as Updated says; a row with none is blank.
|
|
1476
1487
|
asOf: row.updatedAt || null,
|
|
1488
|
+
// Beside a coin priced by one exchange's own trade, which is cited to that exchange, each row names its own.
|
|
1489
|
+
...venued ? { source: quoteSourceName(row) } : {},
|
|
1477
1490
|
}),
|
|
1478
1491
|
// A row with no price or move says why in its status column, as the warnings do.
|
|
1479
1492
|
exportStatus: quoteExportStatus,
|
|
@@ -1505,30 +1518,64 @@ function unreadRow({ symbol, error }: { symbol: string; error: ListingArgError }
|
|
|
1505
1518
|
return { target: { symbol }, listing: { symbol, exchange: null, name: null }, quote: null, error: error.message, input: symbol };
|
|
1506
1519
|
}
|
|
1507
1520
|
|
|
1521
|
+
/**
|
|
1522
|
+
* Why a list's line names no listing, before any lookup: "blank line", or what it is
|
|
1523
|
+
* (`N/A` is "not a symbol", `1.899` "a number, not a symbol").
|
|
1524
|
+
*/
|
|
1525
|
+
function unlistedLineStatus(typed: string): string {
|
|
1526
|
+
return typed.trim() ? notASymbolError(typed)?.reason ?? "not a symbol" : "blank line";
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
/** The row of a list's line that names no listing (a blank line, `N/A`), its reason in the status column. */
|
|
1530
|
+
function unlistedQuoteRow(typed: string): QuoteCliRecord & { listing: ReturnType<typeof listingMetadata> } {
|
|
1531
|
+
return { target: { symbol: typed }, listing: { symbol: typed, exchange: null, name: null }, quote: null, error: unlistedLineStatus(typed), input: typed };
|
|
1532
|
+
}
|
|
1533
|
+
|
|
1508
1534
|
type ListRow = Pick<QuoteCliRecord, "input" | "duplicateOf" | "quote"> & { listing: { symbol: string; exchange: string | null } };
|
|
1509
1535
|
|
|
1510
1536
|
/**
|
|
1511
1537
|
* A list's rows, one for each line of its text as typed where several were read as one entry (`USDJPY` and
|
|
1512
|
-
* `usdjpy` are both USDJPY), in the order of the lines, else of the entries; a row
|
|
1513
|
-
* earlier row names that row's entry in `duplicateOf`.
|
|
1538
|
+
* `usdjpy` are both USDJPY, BRK.B and BRK-B one share class), in the order of the lines, else of the entries; a row
|
|
1539
|
+
* that is the same listing as an earlier row names that row's entry in `duplicateOf`. In a list of one entry a line,
|
|
1540
|
+
* a line no entry was read from (a blank line, `N/A`, a number) has its row too, from `unlisted`, so the rows line
|
|
1541
|
+
* up with the sheet's lines.
|
|
1514
1542
|
*/
|
|
1515
|
-
function listRows<Row extends ListRow>(
|
|
1543
|
+
function listRows<Row extends ListRow>(
|
|
1544
|
+
rows: readonly Row[],
|
|
1545
|
+
entries: readonly string[],
|
|
1546
|
+
forms: readonly TypedForm[],
|
|
1547
|
+
unlisted: (typed: string) => Row,
|
|
1548
|
+
): Row[] {
|
|
1549
|
+
// The entry each line reads as: its own, else the entry that is the same security spelled another way (BRK-B, BRK/B
|
|
1550
|
+
// for BRK.B), which the list read once.
|
|
1551
|
+
const keys = new Set(entries.map(symbolInputKey));
|
|
1552
|
+
const bySecurity = new Map<string, string>();
|
|
1553
|
+
for (const key of keys) if (!bySecurity.has(securityInputKey(key))) bySecurity.set(securityInputKey(key), key);
|
|
1554
|
+
const lineKey = (form: TypedForm) => keys.has(form.key) ? form.key : bySecurity.get(securityInputKey(form.key)) ?? form.key;
|
|
1516
1555
|
// An entry read from no line of its own (a name read as its words) goes after the line before it.
|
|
1517
1556
|
let last = -1;
|
|
1518
1557
|
const entryAt = new Map(entries.map((entry, index) => {
|
|
1519
|
-
const at = forms.findIndex((form) => form
|
|
1558
|
+
const at = forms.findIndex((form) => lineKey(form) === symbolInputKey(entry));
|
|
1520
1559
|
if (at >= 0) last = at;
|
|
1521
1560
|
return [entry, { at: at >= 0 ? at : last + 0.5, index }] as const;
|
|
1522
1561
|
}));
|
|
1562
|
+
const used = new Set<number>();
|
|
1523
1563
|
const placed = rows.flatMap((row, index) => {
|
|
1524
|
-
const typed = forms.flatMap((form, at) => form
|
|
1564
|
+
const typed = forms.flatMap((form, at) => lineKey(form) === symbolInputKey(row.input ?? "") ? [{ form, at }] : []);
|
|
1565
|
+
typed.forEach(({ at }) => used.add(at));
|
|
1525
1566
|
const place = entryAt.get(row.input ?? "") ?? { at: forms.length, index: entries.length + index };
|
|
1526
1567
|
return typed.length > 1 || (typed.length === 1 && typed[0]!.form.typed !== row.input)
|
|
1527
1568
|
? typed.map(({ form, at }) => ({ row: { ...row, input: form.typed }, at, index: place.index }))
|
|
1528
1569
|
: [{ row, ...place }];
|
|
1529
|
-
})
|
|
1570
|
+
});
|
|
1571
|
+
// A line of words read as several symbols (`AAPL MSFT`) has their rows.
|
|
1572
|
+
const readAsWords = (form: TypedForm) => !!form.typed && form.key.split(/\s+/).every((word) => keys.has(word) || bySecurity.has(securityInputKey(word)));
|
|
1573
|
+
const lines = forms.flatMap((form, at) => form.ownRow && !used.has(at) && !readAsWords(form)
|
|
1574
|
+
? [{ row: unlisted(form.typed), at, index: -1 }] : []);
|
|
1530
1575
|
const first = new Map<string, string>();
|
|
1531
|
-
return placed.map(({ row }) => {
|
|
1576
|
+
return [...placed, ...lines].sort((a, b) => a.at - b.at || a.index - b.index).map(({ row }) => {
|
|
1577
|
+
// A line that names no listing is no other line's repeat.
|
|
1578
|
+
if (!row.input?.trim() || notASymbolError(row.input)) return row;
|
|
1532
1579
|
const key = `${(row.quote?.symbol || row.listing.symbol).toUpperCase()}:${row.listing.exchange ?? ""}`;
|
|
1533
1580
|
const earlier = first.get(key);
|
|
1534
1581
|
if (earlier === undefined) first.set(key, row.input ?? "");
|
|
@@ -2153,7 +2200,9 @@ async function loadListingHistory(
|
|
|
2153
2200
|
const dayToDate = fromQuote && interval === "1d" && data.at(-1)?.partial === true;
|
|
2154
2201
|
// Signed out or free, the bars of a session in progress run as late as the delayed quote they end on, and say how late.
|
|
2155
2202
|
const sessionTrading = quote?.marketState === "REGULAR" || quote?.marketState === "PRE" || quote?.marketState === "POST";
|
|
2156
|
-
|
|
2203
|
+
// A coin priced by an exchange's own trade is still a reader without real-time access, whose bars stay held back.
|
|
2204
|
+
const barsHeldBack = quote?.dataSource === "delayed" || (quote?.priceVenue != null && intraday && await cloudRealtimeAccess() === false);
|
|
2205
|
+
const delayedTail = barsHeldBack && !quote?.delisting && (dayToDate || (intraday && sessionTrading));
|
|
2157
2206
|
// The source that served the bars, a broker or another source when Gloom Cloud could not.
|
|
2158
2207
|
const source = loaded.sourceName ? { source: loaded.sourceName } : {};
|
|
2159
2208
|
// A coin's volume unit, or what an index's volume counts (a day's total, an intraday count).
|
|
@@ -2286,8 +2335,9 @@ function historyTextColumns(intraday: boolean, price: (value: unknown, row: Reco
|
|
|
2286
2335
|
* market's shows it beside the venue, never as its volume, and a bar without
|
|
2287
2336
|
* volume in a history that reports it prints as missing, never as 0 or blank.
|
|
2288
2337
|
*/
|
|
2289
|
-
function historyVolumeCell(missingVolume: (row: Record<string, unknown>) => string) {
|
|
2290
|
-
|
|
2338
|
+
function historyVolumeCell(missingVolume: (row: Record<string, unknown>) => string, shown?: (row: Record<string, unknown>) => number | undefined) {
|
|
2339
|
+
// The newest bars' exact counts print at the step of the rest of the column (historyTextVolumes).
|
|
2340
|
+
return (value: unknown, row: Record<string, unknown>) => formatCountCell(shown?.(row) ?? value)
|
|
2291
2341
|
|| (typeof row.venueVolume === "number"
|
|
2292
2342
|
? cliStyles.muted(`${formatCountCell(row.venueVolume)} ${typeof row.volumeVenue === "string" ? row.volumeVenue : ""}`.trim())
|
|
2293
2343
|
: missingVolume(row));
|
|
@@ -2403,8 +2453,9 @@ async function runHistory(rawArgs: string[], ctx: Parameters<CliCommandDef["exec
|
|
|
2403
2453
|
const price = historyPrice(history.decimals);
|
|
2404
2454
|
// A bar without volume in a history that reports it prints as missing.
|
|
2405
2455
|
const missingVolume = historyReportsVolume(data) ? MISSING_VOLUME_TEXT : "";
|
|
2456
|
+
const textVolumes = historyTextVolumes(data, intraday);
|
|
2406
2457
|
const textColumns = historyTextColumns(intraday, price).map((column) => column.key !== "volume" ? column
|
|
2407
|
-
: { ...column, format: historyVolumeCell(() => missingVolume) });
|
|
2458
|
+
: { ...column, format: historyVolumeCell(() => missingVolume, (row) => textVolumes.get(String(row.date))) });
|
|
2408
2459
|
// The largest fall from a close to a later one in the bars shown, said under the heading: within one contract
|
|
2409
2460
|
// of a continuous future, never from one month's close to another's across a roll.
|
|
2410
2461
|
// A yield (^TNX) falls and rises by its level, in bp, and its largest rise is said too.
|
|
@@ -2738,11 +2789,16 @@ async function runHistoryList(
|
|
|
2738
2789
|
}
|
|
2739
2790
|
const served = listed.flatMap((entry) => "history" in entry && entry.history.data.length > 0 ? [entry.history] : []);
|
|
2740
2791
|
// A symbol with no bars, whether its request failed or came back empty, is one row with the reason.
|
|
2741
|
-
const
|
|
2792
|
+
const entryRows = (entry: ListedHistory): HistoryListRow[] => "history" in entry
|
|
2742
2793
|
? entry.history.data.length > 0
|
|
2743
2794
|
? entry.history.data.map((row) => ({ symbol: entry.history.listing.key, ...row }))
|
|
2744
2795
|
: [historyFailureRow(entry.history.listing.key, emptyHistoryNote(entry.history.listing.key, ask))]
|
|
2745
|
-
: [historyFailureRow(entry.symbol, entry.error)]
|
|
2796
|
+
: [historyFailureRow(entry.symbol, entry.error)];
|
|
2797
|
+
// An export of a list read from a file or standard input has rows for every line, in its order, as `quote` has:
|
|
2798
|
+
// each bar names the line it is for and the earlier line that is the same listing, and a line that names no
|
|
2799
|
+
// listing (a blank line, `N/A`) is one row with why.
|
|
2800
|
+
const fromList = (file !== undefined || args.includes("-")) && ctx.cliOptions.format !== "text";
|
|
2801
|
+
const rows: HistoryListRow[] = fromList ? historyListRows(listed, entryRows, refused, list) : listed.flatMap(entryRows);
|
|
2746
2802
|
const bySymbol = new Map(served.map((history) => [history.listing.key, history] as const));
|
|
2747
2803
|
const notes = [
|
|
2748
2804
|
...list.notes,
|
|
@@ -2805,11 +2861,12 @@ async function runHistoryList(
|
|
|
2805
2861
|
}
|
|
2806
2862
|
const decimals = (row: Record<string, unknown>) => bySymbol.get(String(row.symbol))?.decimals ?? 2;
|
|
2807
2863
|
const intraday = served.some((history) => history.intraday);
|
|
2864
|
+
const textVolumes = new Map(served.map((history) => [history.listing.key, historyTextVolumes(history.data, history.intraday)] as const));
|
|
2808
2865
|
const textColumns = historyTextColumns(intraday, (value, row) => historyPrice(decimals(row))(value)).map((column) => column.key !== "volume" ? column
|
|
2809
2866
|
: { ...column, format: historyVolumeCell((row) => {
|
|
2810
2867
|
const history = bySymbol.get(String(row.symbol));
|
|
2811
2868
|
return history && row.date && historyReportsVolume(history.data) ? MISSING_VOLUME_TEXT : "";
|
|
2812
|
-
}) });
|
|
2869
|
+
}, (row) => textVolumes.get(String(row.symbol))?.get(String(row.date))) });
|
|
2813
2870
|
ctx.printResult({
|
|
2814
2871
|
data: rows,
|
|
2815
2872
|
metadata: {
|
|
@@ -2829,7 +2886,7 @@ async function runHistoryList(
|
|
|
2829
2886
|
dateKey: "date",
|
|
2830
2887
|
textColumns: [{ key: "symbol", header: "Symbol", shrink: false }, ...textColumns,
|
|
2831
2888
|
{ key: "currency", header: "Cur", shrink: false, format: currencyCell }, HISTORY_FLAG_TEXT_COLUMN],
|
|
2832
|
-
columns: historyExportColumns(rows),
|
|
2889
|
+
columns: [...historyExportColumns(rows), ...fromList ? LIST_INPUT_EXPORT_COLUMNS : []],
|
|
2833
2890
|
exportStatus: historyExportStatus,
|
|
2834
2891
|
// Every row names its symbol, the currency its prices are in, its bar size and the as-of of its own symbol's bars.
|
|
2835
2892
|
exportIdentity: (row) => {
|
|
@@ -2848,6 +2905,24 @@ async function runHistoryList(
|
|
|
2848
2905
|
});
|
|
2849
2906
|
}
|
|
2850
2907
|
|
|
2908
|
+
/** `history`'s rows of a list read from a file or standard input, for each line in its order (`listRows`). */
|
|
2909
|
+
function historyListRows(
|
|
2910
|
+
listed: readonly ListedHistory[],
|
|
2911
|
+
entryRows: (entry: ListedHistory) => HistoryListRow[],
|
|
2912
|
+
refused: readonly NotASymbolError[],
|
|
2913
|
+
list: { symbols: string[]; typedForms: TypedForm[]; byLine: boolean },
|
|
2914
|
+
): HistoryListRow[] {
|
|
2915
|
+
type EntryRow = ListRow & { bars: HistoryListRow[] };
|
|
2916
|
+
const row = (input: string, symbol: string, bars: HistoryListRow[]): EntryRow => ({ input, quote: null, listing: { symbol, exchange: null }, bars });
|
|
2917
|
+
const unlisted = (typed: string) => row(typed, typed, [historyFailureRow(typed, unlistedLineStatus(typed))]);
|
|
2918
|
+
return listRows([
|
|
2919
|
+
...listed.map((entry) => row(entry.symbol, "history" in entry ? entry.history.listing.key : entry.symbol, entryRows(entry))),
|
|
2920
|
+
// A cell that is no symbol (`N/A`) has a row in a list of one entry a line only, as `quote`'s export has.
|
|
2921
|
+
...list.byLine ? refused.map((error) => unlisted(error.input)) : [],
|
|
2922
|
+
], list.symbols, list.typedForms, unlisted)
|
|
2923
|
+
.flatMap(({ bars, input, duplicateOf }) => bars.map((bar) => ({ ...bar, input, ...duplicateOf ? { duplicateOf } : {} })));
|
|
2924
|
+
}
|
|
2925
|
+
|
|
2851
2926
|
type FinancialsView = "statements" | "fundamentals" | "valuation";
|
|
2852
2927
|
|
|
2853
2928
|
const STATEMENT_COLUMNS: CliResultColumn<ReturnType<typeof financialStatementRows>[number]>[] = [
|
|
@@ -4758,8 +4833,9 @@ export const marketDataCliCommands: BuiltinCliCommandDef[] = [
|
|
|
4758
4833
|
}, {
|
|
4759
4834
|
title: "Several symbols",
|
|
4760
4835
|
lines: [
|
|
4761
|
-
`history AAPL MSFT 000660.KS
|
|
4762
|
-
"A symbol with no
|
|
4836
|
+
`history AAPL MSFT 000660.KS writes every symbol's bars in one long table, ${HISTORY_LIST_CONCURRENCY} symbols at a time; --file list.txt (- for standard input) reads one symbol a line. symbol_or_series, currency_or_unit and as_of name each row's symbol, unit and as-of.`,
|
|
4837
|
+
"A symbol with no bars is one row with why in status; the command fails only when none has any. A word typed on the command line that is no ticker fails it, and a bar size in a symbol's place (1s, 30s, 1m) says where the finest bars are. --tail 5 keeps each symbol's newest five bars.",
|
|
4838
|
+
"A --file list of one symbol a line has a row for every line, in its order: a blank line, or one that names no listing, is one row with why in status. A --file list's export adds input, the line as typed, and duplicate_of, the earlier line that is the same listing.",
|
|
4763
4839
|
"--wide sets the symbols side by side instead: one row per date, one close column per symbol headed with its unit (USDJPY=X close (JPY per USD)), a blank where a symbol has no bar that day. history USDJPY=X USDCHF=X EURCHF=X --csv --wide is a spreadsheet of the three closes; --tail 5 keeps the newest five dates.",
|
|
4764
4840
|
],
|
|
4765
4841
|
}, {
|
|
@@ -63,6 +63,8 @@ import {
|
|
|
63
63
|
} from "../../plugins/builtin/econ/calendar-model";
|
|
64
64
|
import { hasNoReleaseTime, hasNoStatedTime, type EconEvent } from "../../plugins/builtin/econ/types";
|
|
65
65
|
import { econRowFigures, figureWithCurrency } from "../../plugins/builtin/econ/figures";
|
|
66
|
+
import { cpiCalendarYearGapReason } from "../../plugins/builtin/shared/cpi-year-gap";
|
|
67
|
+
import { fredSeriesIdForName } from "../../plugins/builtin/econ/fred-catalog";
|
|
66
68
|
import { isoDate, rejectExtraArgs, requireArg, requireOneArg, takeFlag, takeOption } from "./command-utils";
|
|
67
69
|
import { buildCorrelationSeries } from "../../plugins/builtin/correlation/matrix/model";
|
|
68
70
|
import { alignDailyCloses, correlateDailyCloses } from "../../plugins/builtin/correlation/compute";
|
|
@@ -105,6 +107,9 @@ import {
|
|
|
105
107
|
import { fredProvenance, fredPublicationTime, notOnFredSource } from "../../sources/gloomberb-cloud/fred-attribution";
|
|
106
108
|
import { followsUsBondMarket, usBondMarketClosedNote } from "../../market-data/us-bond-market";
|
|
107
109
|
|
|
110
|
+
/** The Actual of a release its publisher could not compute; the notes say why. */
|
|
111
|
+
const NOT_PUBLISHED_TEXT = "not published";
|
|
112
|
+
|
|
108
113
|
// Batch quotes often omit names for indices and ETFs; these baskets are fixed, so name them here.
|
|
109
114
|
const BASKET_NAMES = new Map<string, string>([
|
|
110
115
|
...WORLD_INDICES.map((entry) => [entry.symbol, entry.name] as const),
|
|
@@ -664,8 +669,10 @@ async function runEcon(args: string[], ctx: Parameters<CliCommandDef["execute"]>
|
|
|
664
669
|
forecastText: event.forecast ?? null,
|
|
665
670
|
priorText: event.prior ?? null,
|
|
666
671
|
// A release past its time with no figure yet: "due 07:00 UTC, awaiting figure", then "no figure from the source"
|
|
667
|
-
// two hours on or once the release's other rows have theirs; null otherwise.
|
|
668
|
-
|
|
672
|
+
// two hours on or once the release's other rows have theirs; null otherwise. A US CPI y/y BLS could not publish
|
|
673
|
+
// (no index a year before) says so, and the notes say why.
|
|
674
|
+
actualStatus: cpiCalendarYearGapReason(event) ? NOT_PUBLISHED_TEXT
|
|
675
|
+
: ((gap) => gap ? figureGapText(event, gap) : null)(figureGap(event, now, inWindow)),
|
|
669
676
|
// The publisher's own clock, for rows Gloom Cloud adds from a bank's or a statistics office's calendar.
|
|
670
677
|
localTime: event.localTime ?? null,
|
|
671
678
|
timeZone: event.timeZone ?? null,
|
|
@@ -696,7 +703,12 @@ async function runEcon(args: string[], ctx: Parameters<CliCommandDef["execute"]>
|
|
|
696
703
|
// where the end is said.
|
|
697
704
|
const pastRows = pastListingRows(listed);
|
|
698
705
|
const listedPast = pastRows ? `No releases listed after ${listedThrough}; the rows after it are ${pastRows}` : null;
|
|
699
|
-
|
|
706
|
+
// Why a US CPI y/y row has no actual: "2026-11-10 Inflation Rate YoY: BLS published no October 2025 index, so no October 2026 y/y."
|
|
707
|
+
const unpublished = listed.flatMap((event) => {
|
|
708
|
+
const reason = cpiCalendarYearGapReason(event);
|
|
709
|
+
return reason ? [`${isoDate(event.date).slice(0, 10)} ${econEventName(event)}: ${reason}.`] : [];
|
|
710
|
+
});
|
|
711
|
+
const notes = [listedBefore, listedPast ?? listedAfter, ...(rows.length > 0 ? blankTimeNotes(rows) : []), ...unpublished,
|
|
700
712
|
rows.length > 0 && coverage ? coverage : null,
|
|
701
713
|
// A dash under Forecast on a release still to come is a consensus not in yet, not a missing figure.
|
|
702
714
|
listed.some(awaitsConsensus) ? NO_CONSENSUS_NOTE : null]
|
|
@@ -832,7 +844,9 @@ async function runFred(rawArgs: string[], ctx: Parameters<CliCommandDef["execute
|
|
|
832
844
|
if (changeGiven && !horizon) {
|
|
833
845
|
ctx.fail(change ? `Unknown change "${change}".` : "--change needs 1D or 1W.", "Use 1D (from the previous observation) or 1W (from a week before).");
|
|
834
846
|
}
|
|
835
|
-
const
|
|
847
|
+
const asked = requireOneArg(args, FRED_USAGE, "series", ctx);
|
|
848
|
+
// A series by its name (`3 month t-bill` is DTB3) when one alone fits it.
|
|
849
|
+
const seriesId = (/\s/.test(asked.trim()) ? fredSeriesIdForName(asked) : null) ?? asked.toUpperCase();
|
|
836
850
|
await withSavedFredSeries(ctx, () => printFredSeries(ctx, { seriesId, start, startDate, sortOrder, horizon }));
|
|
837
851
|
}
|
|
838
852
|
|