@gloom-sh/terminal 0.19.5 → 0.19.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/patches/@opentui%2Fcore@0.3.2.patch +86 -25
- package/src/api-client/equity-screener.ts +23 -0
- package/src/app/pane-runtime/index.tsx +2 -0
- package/src/app/pane-runtime/plugin-bindings.ts +10 -1
- package/src/app.tsx +63 -16
- package/src/cli/commands/market.ts +149 -10
- package/src/cli/commands/search.ts +21 -3
- package/src/cli/commands/ticker.ts +74 -33
- package/src/cli/glossary.ts +3 -3
- package/src/cli/known-gaps.ts +8 -0
- package/src/cli/listing-arg.ts +12 -0
- package/src/cli/pane-functions/capabilities.ts +2 -0
- package/src/cli/pane-functions/catalog.ts +22 -4
- package/src/cli/pane-functions/function-help.ts +8 -5
- package/src/cli/pane-functions/headless.ts +4 -3
- package/src/cli/pane-functions/resolver.ts +75 -2
- package/src/cli/quote-answer.ts +9 -0
- package/src/cli/symbol-list.ts +54 -2
- package/src/cli/symbol-rows.ts +14 -2
- package/src/cli/ticker-resolution.ts +89 -20
- package/src/components/chart/composite/axis-overlays.tsx +60 -27
- package/src/components/chart/composite/composite-chart.tsx +118 -63
- package/src/components/chart/composite/cursor-source.ts +111 -0
- package/src/components/chart/composite/format.ts +168 -6
- package/src/components/chart/composite/legend.tsx +8 -4
- package/src/components/chart/composite/panel-labels.ts +20 -1
- package/src/components/chart/composite/panel-surface.tsx +201 -92
- package/src/components/chart/composite/price-axis-labels.tsx +92 -46
- package/src/components/chart/composite/price-series.ts +31 -8
- package/src/components/chart/composite/scene.ts +154 -59
- package/src/components/chart/composite/series-axis-tags.tsx +4 -2
- package/src/components/chart/composite/time-axis.ts +13 -5
- package/src/components/chart/composite/time-scale.ts +211 -56
- package/src/components/chart/composite/types.ts +11 -1
- package/src/components/chart/composite/use-composite-chart-keyboard.ts +32 -12
- package/src/components/chart/curve/curve-surface.tsx +5 -2
- package/src/components/chart/curve/model.ts +4 -1
- package/src/components/chart/native/use-bitmap-metrics.ts +81 -0
- package/src/components/chart/static/series.ts +3 -0
- package/src/components/command-bar/commands/collection-list.ts +81 -0
- package/src/components/command-bar/commands/direct/index.ts +6 -0
- package/src/components/command-bar/commands/registry.ts +8 -0
- package/src/components/command-bar/layout-items/current-layout.ts +22 -1
- package/src/components/command-bar/layout-items/focused-pane.ts +22 -1
- package/src/components/command-bar/pane-templates/items.ts +19 -3
- package/src/components/command-bar/pane-templates/workflow.ts +5 -0
- package/src/components/command-bar/routes/root/results.ts +23 -3
- package/src/components/command-bar/routes/root/selection.ts +4 -2
- package/src/components/command-bar/routes/root/shortcut-feedback.ts +1 -1
- package/src/components/command-bar/routes/root/shortcut-items.ts +3 -4
- package/src/components/command-bar/routes/root/shortcuts.ts +58 -14
- package/src/components/command-bar/routes/root/ticker-first.ts +32 -0
- package/src/components/command-bar/surface/environment.ts +2 -0
- package/src/components/command-bar/view-model.ts +7 -0
- package/src/components/command-bar/workflow/ops.ts +2 -1
- package/src/components/command-bar/workflow/tickers.ts +20 -0
- package/src/components/layout/shell/menu.ts +15 -1
- package/src/components/layout/shell/pane/actions.ts +4 -0
- package/src/components/layout/shell/ticker-link-menu.ts +12 -3
- package/src/components/layout/status-bar.tsx +20 -0
- package/src/components/onboarding/onboarding-keyboard.ts +5 -1
- package/src/components/onboarding/onboarding-wizard.tsx +15 -4
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +8 -5
- package/src/components/onboarding/use-onboarding-progress.ts +20 -1
- package/src/components/price-sparkline/view.tsx +14 -6
- package/src/components/ticker/badge/index.tsx +8 -4
- package/src/components/ticker/badge/list.tsx +23 -7
- package/src/components/ui/column-grid.tsx +8 -2
- package/src/components/ui/data-table/opentui/model.ts +4 -1
- package/src/components/ui/tabs.tsx +5 -2
- package/src/core/state/app/layout.ts +18 -3
- package/src/core/state/app/state.ts +2 -0
- package/src/core/state/app/types.ts +5 -0
- package/src/data/config/layout.ts +3 -0
- package/src/data/config/store/normalize.ts +39 -4
- package/src/i18n/es.ts +10 -0
- package/src/i18n/ja.ts +10 -0
- package/src/i18n/ko.ts +10 -0
- package/src/i18n/zh-cn.ts +10 -0
- package/src/i18n/zh-tw.ts +10 -0
- package/src/layout/pane-manager/floating-placement.ts +7 -4
- package/src/layout/pane-manager/floating.ts +5 -2
- package/src/market-data/bond-funds.ts +19 -0
- package/src/market-data/futures-contract.ts +14 -3
- package/src/market-data/market/freshness.ts +18 -0
- package/src/market-data/market/status.ts +15 -2
- package/src/plugins/builtin/bond-calculator/headless.ts +2 -1
- package/src/plugins/builtin/bond-calculator/index.tsx +1 -1
- package/src/plugins/builtin/bond-calculator/model.ts +14 -5
- package/src/plugins/builtin/bond-calculator/pane.tsx +1 -1
- package/src/plugins/builtin/buildout/cells.tsx +25 -45
- package/src/plugins/builtin/buildout/detail/company.tsx +3 -3
- package/src/plugins/builtin/buildout/detail/index.tsx +1 -1
- package/src/plugins/builtin/buildout/detail/intel.tsx +4 -7
- package/src/plugins/builtin/buildout/detail/site.tsx +4 -4
- package/src/plugins/builtin/buildout/detail/ui.tsx +39 -38
- package/src/plugins/builtin/buildout/format.ts +23 -1
- package/src/plugins/builtin/buildout/model/types.ts +1 -0
- package/src/plugins/builtin/buildout/pane/index.tsx +2 -8
- package/src/plugins/builtin/buildout/table-model.ts +12 -4
- package/src/plugins/builtin/cds/headless.ts +1 -0
- package/src/plugins/builtin/cds/index.tsx +1 -1
- package/src/plugins/builtin/cloud/plugin.tsx +2 -0
- package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +28 -3
- package/src/plugins/builtin/correlation/headless.ts +3 -2
- package/src/plugins/builtin/crypto-board/pane.tsx +5 -4
- package/src/plugins/builtin/debt-maturities/headless.ts +11 -2
- package/src/plugins/builtin/debt-maturities/model.ts +66 -0
- package/src/plugins/builtin/debt-maturities/pane.tsx +23 -4
- package/src/plugins/builtin/earnings-ripple/pane.tsx +1 -1
- package/src/plugins/builtin/econ/calendar-model.ts +28 -6
- package/src/plugins/builtin/equity-screener/client.ts +1 -1
- package/src/plugins/builtin/equity-screener/criterion-editor.tsx +4 -16
- package/src/plugins/builtin/equity-screener/headless.ts +4 -2
- package/src/plugins/builtin/equity-screener/ideas.ts +67 -3
- package/src/plugins/builtin/equity-screener/model.ts +180 -12
- package/src/plugins/builtin/equity-screener/pane.tsx +52 -12
- package/src/plugins/builtin/equity-screener/screen-check.ts +7 -4
- package/src/plugins/builtin/equity-screener/watchlist.ts +33 -0
- package/src/plugins/builtin/futures-curve/client.ts +19 -0
- package/src/plugins/builtin/futures-curve/headless.ts +52 -13
- package/src/plugins/builtin/futures-curve/index.tsx +1 -1
- package/src/plugins/builtin/futures-curve/model.ts +77 -6
- package/src/plugins/builtin/futures-curve/pane.tsx +19 -3
- package/src/plugins/builtin/macro-day/client.ts +41 -0
- package/src/plugins/builtin/macro-day/headless.ts +19 -9
- package/src/plugins/builtin/macro-day/model.ts +3 -1
- package/src/plugins/builtin/market-movers/index.tsx +4 -3
- package/src/plugins/builtin/mna/distress/headless.ts +1 -0
- package/src/plugins/builtin/perps/pane.tsx +3 -1
- package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +17 -0
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +2 -1
- package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +2 -1
- package/src/plugins/builtin/rate-path/headless.ts +24 -10
- package/src/plugins/builtin/research/event-model.ts +10 -3
- package/src/plugins/builtin/research/events-headless.ts +20 -2
- package/src/plugins/builtin/sec/fund-facts.ts +17 -1
- package/src/plugins/builtin/sec/index.tsx +1 -1
- package/src/plugins/builtin/shared/members-menu.tsx +103 -38
- package/src/plugins/builtin/short-interest/publications-model.ts +22 -1
- package/src/plugins/builtin/short-interest/publications-pane.tsx +13 -4
- package/src/plugins/builtin/short-interest/watch-model.ts +1 -1
- package/src/plugins/builtin/time-sales/pane.tsx +3 -2
- package/src/plugins/builtin/trace-bonds/client.ts +7 -4
- package/src/plugins/builtin/trace-bonds/index.tsx +1 -1
- package/src/plugins/builtin/volatility/client.ts +6 -1
- package/src/plugins/builtin/volatility/headless.ts +0 -1
- package/src/plugins/builtin/yield-curve/curves.ts +15 -0
- package/src/plugins/builtin/yield-curve/headless.ts +6 -1
- package/src/plugins/builtin/yield-curve/index.tsx +5 -8
- package/src/plugins/host-modules.ts +22 -3
- package/src/plugins/host-smoke.ts +6 -3
- package/src/portfolio/collection-name.ts +19 -0
- package/src/renderers/browser/http-proxy-transport.ts +78 -8
- package/src/renderers/cloudflare/http-proxy.ts +13 -2
- package/src/renderers/cloudflare/proxy-session.ts +47 -24
- package/src/renderers/cloudflare/worker.ts +15 -2
- package/src/renderers/desktop/geometry.ts +279 -0
- package/src/renderers/desktop/screen-setup.ts +246 -0
- package/src/renderers/desktop/sequential-window-host.ts +179 -0
- package/src/renderers/desktop/test-utils.ts +71 -0
- package/src/renderers/desktop/window-controller.ts +433 -0
- package/src/renderers/desktop/window-host.ts +70 -0
- package/src/renderers/desktop/window-layouts.ts +630 -0
- package/src/renderers/dom/data-frames.ts +15 -4
- package/src/renderers/electrobun/bun/application-menu/click.ts +1 -0
- package/src/renderers/electrobun/bun/application-menu/index.ts +4 -1
- package/src/renderers/electrobun/bun/desktop/backend-requests.ts +19 -8
- package/src/renderers/electrobun/bun/desktop/backend.ts +320 -19
- package/src/renderers/electrobun/bun/desktop/detached-windows.ts +83 -61
- package/src/renderers/electrobun/bun/desktop/host-requests.ts +4 -14
- package/src/renderers/electrobun/bun/desktop/initialization.ts +30 -11
- package/src/renderers/electrobun/bun/desktop/screen-setup-file.ts +55 -0
- package/src/renderers/electrobun/bun/desktop/state-broadcaster.ts +44 -8
- package/src/renderers/electrobun/bun/desktop/workspace/index.ts +298 -97
- package/src/renderers/electrobun/bun/desktop/workspace/requests.ts +44 -6
- package/src/renderers/electrobun/bun/index.ts +4 -97
- package/src/renderers/electrobun/bun/window/electrobun-window-host.ts +306 -0
- package/src/renderers/electrobun/bun/window/focus.ts +0 -25
- package/src/renderers/electrobun/bun/window/remembered-frame.ts +4 -82
- package/src/renderers/electrobun/shared/protocol.ts +44 -2
- package/src/renderers/electrobun/view/backend-rpc.ts +15 -0
- package/src/renderers/electrobun/view/desktop/window/bridge.ts +63 -3
- package/src/renderers/electrobun/view/main.tsx +13 -7
- package/src/series/fred-argument.ts +17 -0
- package/src/sources/provider-router/financial-routes.ts +7 -1
- package/src/state/app/context/index.tsx +16 -2
- package/src/state/desktop-windows.ts +63 -0
- package/src/sync/other-window-tabs.ts +62 -0
- package/src/tickers/company-name-listing.ts +23 -3
- package/src/tickers/listing-fate.ts +147 -1
- package/src/tickers/terminal-codes.ts +5 -0
- package/src/time-series/types.ts +6 -0
- package/src/types/config.ts +10 -1
- package/src/types/desktop-window.ts +71 -2
- package/src/types/financials.ts +4 -0
- package/src/types/headless.ts +19 -0
- package/src/types/plugin.ts +6 -0
- package/src/ui/index.tsx +14 -13
- package/src/ui/same-props.ts +58 -0
- package/src/utils/cli-output.ts +33 -4
- package/src/utils/format.ts +7 -2
- package/src/utils/futures-generic.ts +12 -0
- package/src/utils/http-proxy-upstream.ts +6 -2
- package/src/utils/plugin-proxy-hosts.json +0 -4
- package/src/utils/plugin-proxy-hosts.ts +22 -0
- package/src/utils/sec-filings.ts +7 -1
|
@@ -14,22 +14,30 @@ import { MAX_CORRELATION_TICKERS } from "../correlation/settings";
|
|
|
14
14
|
import { ROTATION_LIMIT } from "../relative-rotation/model";
|
|
15
15
|
import { SHORT_WATCH_LIMIT } from "../short-interest/watch-model";
|
|
16
16
|
|
|
17
|
-
/** One
|
|
17
|
+
/** One member of a theme, a fund or a screen's matches, in the order its list shows it. */
|
|
18
18
|
export interface MemberListing {
|
|
19
19
|
symbol: string;
|
|
20
20
|
name?: string | null;
|
|
21
21
|
exchange?: string | null;
|
|
22
|
+
/** The listing's quote currency; theme and fund members are US listings in dollars. */
|
|
23
|
+
currency?: string | null;
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
/** The members a pane shows, and what to call them. */
|
|
25
27
|
export interface MemberList {
|
|
26
|
-
/** Names the members in dialog titles: a theme's name or a
|
|
28
|
+
/** Names the members in dialog titles: a theme's name, a fund's ticker or a screen's name. */
|
|
27
29
|
title: string;
|
|
28
30
|
/** The name the save dialog suggests. */
|
|
29
31
|
watchlistName: string;
|
|
30
32
|
members: readonly MemberListing[];
|
|
31
33
|
/** A search narrowing the list: what was typed and how many members the whole list has. */
|
|
32
34
|
search?: { query: string; total: number } | null;
|
|
35
|
+
/** What the dialogs and the report call them, plural: members unless said (a screen's are matches). */
|
|
36
|
+
noun?: string;
|
|
37
|
+
/** How many the whole list holds when `members` is its first part, as a screen's first page of matches is. */
|
|
38
|
+
total?: number;
|
|
39
|
+
/** Whether to offer the functions that take a list of tickers (RRG, CORR, SIW, RIPL); on unless false. */
|
|
40
|
+
openIn?: boolean;
|
|
33
41
|
}
|
|
34
42
|
|
|
35
43
|
interface MemberDestination {
|
|
@@ -98,23 +106,52 @@ export function memberDestinationChoices(symbols: readonly string[], destination
|
|
|
98
106
|
/**
|
|
99
107
|
* The dialog text for `count` distinct members. A search says what it matched
|
|
100
108
|
* and how many members the whole list has, so a saved or opened subset never
|
|
101
|
-
* reads as the whole fund
|
|
109
|
+
* reads as the whole fund; so does a list that is the first part of a larger
|
|
110
|
+
* one (`total`), as a screen's loaded matches are.
|
|
102
111
|
*/
|
|
103
|
-
function memberListText(list: Pick<MemberList, "title" | "search">, count: number) {
|
|
112
|
+
export function memberListText(list: Pick<MemberList, "title" | "search" | "noun" | "total">, count: number) {
|
|
113
|
+
const noun = list.noun ?? "members";
|
|
104
114
|
const query = list.search?.query.trim();
|
|
105
115
|
const search = query ? { query, total: list.search!.total } : null;
|
|
106
116
|
const saved = Math.min(count, MEMBER_WATCHLIST_LIMIT);
|
|
117
|
+
const total = Math.max(count, list.total ?? count);
|
|
107
118
|
return {
|
|
108
|
-
openTitle: search ? tf("Open {title}
|
|
109
|
-
: tf("Open {title}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
: tf("
|
|
119
|
+
openTitle: search ? tf("Open {title} {noun} matching \"{query}\" in", { title: list.title, noun, query: search.query })
|
|
120
|
+
: tf("Open {title} {noun} in", { title: list.title, noun }),
|
|
121
|
+
saveTitle: tf("Save {title} {noun} to", { title: list.title, noun }),
|
|
122
|
+
saveBody: saved < count
|
|
123
|
+
? search ? tf("The first {count} of the {matching} {noun} matching \"{query}\", as listed.", { count: saved, matching: count, noun, query: search.query })
|
|
124
|
+
: tf("The first {count} of {total} {noun}, as listed.", { count: saved, total, noun })
|
|
125
|
+
: search ? tf("{count} of {total} {noun} match \"{query}\".", { count, total: search.total, noun, query: search.query })
|
|
126
|
+
: saved < total ? tf("The first {count} of {total} {noun}, as listed.", { count: saved, total, noun })
|
|
127
|
+
: tf("All {count} {noun}.", { count, noun }),
|
|
115
128
|
};
|
|
116
129
|
}
|
|
117
130
|
|
|
131
|
+
/** The save dialog's choice that names a new watchlist rather than one already there. */
|
|
132
|
+
export const NEW_WATCHLIST_CHOICE = "watchlist:new";
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Where a list can be saved: a new watchlist, then each watchlist there is,
|
|
136
|
+
* in the order the app lists them, with how many tickers it holds.
|
|
137
|
+
*/
|
|
138
|
+
export function watchlistTargetChoices(
|
|
139
|
+
watchlists: readonly { id: string; name: string }[],
|
|
140
|
+
tickers: ReadonlyMap<string, TickerRecord>,
|
|
141
|
+
) {
|
|
142
|
+
const held = new Map<string, number>();
|
|
143
|
+
for (const ticker of tickers.values())
|
|
144
|
+
for (const id of ticker.metadata.watchlists) held.set(id, (held.get(id) ?? 0) + 1);
|
|
145
|
+
return [
|
|
146
|
+
{ id: NEW_WATCHLIST_CHOICE, label: t("New watchlist…") },
|
|
147
|
+
...watchlists.map((watchlist) => ({
|
|
148
|
+
id: watchlist.id,
|
|
149
|
+
label: watchlist.name,
|
|
150
|
+
detail: tf("{count} tickers", { count: held.get(watchlist.id) ?? 0 }),
|
|
151
|
+
})),
|
|
152
|
+
];
|
|
153
|
+
}
|
|
154
|
+
|
|
118
155
|
/** The requested name, numbered when a watchlist already has that name or id. */
|
|
119
156
|
export function uniqueWatchlistName(requested: string, watchlists: readonly { id: string; name: string }[]): string {
|
|
120
157
|
const base = requested.trim();
|
|
@@ -158,18 +195,20 @@ export function planMemberWatchlist(
|
|
|
158
195
|
}
|
|
159
196
|
continue;
|
|
160
197
|
}
|
|
161
|
-
// Theme and fund members are US listings quoted in dollars
|
|
162
|
-
// left to the ticker's profile,
|
|
163
|
-
|
|
198
|
+
// Theme and fund members are US listings quoted in dollars; a screen's
|
|
199
|
+
// matches say their currency. The sector is left to the ticker's profile,
|
|
200
|
+
// so a list never mixes two sector schemes.
|
|
201
|
+
create.push({ ticker: key, name: member.name || symbol, exchange, currency: member.currency?.trim() || "USD",
|
|
164
202
|
portfolios: [], watchlists: [watchlistId], positions: [], custom: {}, tags: [] });
|
|
165
203
|
}
|
|
166
204
|
return { create, update, count: seen.size };
|
|
167
205
|
}
|
|
168
206
|
|
|
169
207
|
/**
|
|
170
|
-
* Pane menu entries for a list of members (a theme's, a fund's
|
|
171
|
-
* RRG, CORR, SIW or RIPL, or save them
|
|
172
|
-
*
|
|
208
|
+
* Pane menu entries for a list of members (a theme's, a fund's, a screen's
|
|
209
|
+
* matches): open them in RRG, CORR, SIW or RIPL, or save them to a new
|
|
210
|
+
* watchlist or one already there. Functions of disabled plugins are left out;
|
|
211
|
+
* each destination gets as many as it takes.
|
|
173
212
|
*/
|
|
174
213
|
export function useMembersMenu(registrationId: string, list: MemberList | null) {
|
|
175
214
|
const dialog = useOptionalDialog();
|
|
@@ -185,8 +224,9 @@ export function useMembersMenu(registrationId: string, list: MemberList | null)
|
|
|
185
224
|
registry.paneTemplates.has(destination.templateId)
|
|
186
225
|
&& !registry.getDisabledPaneTemplateOwner?.(destination.templateId, disabledPlugins)
|
|
187
226
|
));
|
|
188
|
-
const choices = memberDestinationChoices(symbols, destinations);
|
|
227
|
+
const choices = list.openIn === false ? [] : memberDestinationChoices(symbols, destinations);
|
|
189
228
|
const text = memberListText(list, symbols.length);
|
|
229
|
+
const noun = list.noun ?? "members";
|
|
190
230
|
const openIn = () => {
|
|
191
231
|
void dialog.prompt<string>({
|
|
192
232
|
closeOnClickOutside: true,
|
|
@@ -198,16 +238,21 @@ export function useMembersMenu(registrationId: string, list: MemberList | null)
|
|
|
198
238
|
if (choice) createPaneFromTemplate(choice.id, { symbols: choice.symbols, arg: formatTickerListInput(choice.symbols) });
|
|
199
239
|
}).catch(logFailure("shared.members-menu", "Open members in a function failed"));
|
|
200
240
|
};
|
|
201
|
-
const
|
|
241
|
+
const saveToWatchlist = async (target: { name: string } | { id: string }) => {
|
|
202
242
|
// The writes hold the app for about a second with a hundred names; let the dialog close on screen first.
|
|
203
243
|
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
244
|
+
let watchlist = "id" in target ? getState().config.watchlists.find((entry) => entry.id === target.id) : undefined;
|
|
245
|
+
if ("name" in target) {
|
|
246
|
+
const requested = uniqueWatchlistName(target.name, getState().config.watchlists);
|
|
247
|
+
await createFormCollectionActions({ dataProvider: registry.marketData, dispatch, getState, pluginRegistry: registry,
|
|
248
|
+
tickerRepository: registry.tickerRepository }, (body, options) => {
|
|
249
|
+
if (options?.type === "error") notify({ body, type: "error" });
|
|
250
|
+
}).createWatchlist(requested);
|
|
251
|
+
watchlist = getState().config.watchlists.find((entry) => entry.name === requested);
|
|
252
|
+
if (!watchlist) throw new Error(t("The watchlist was not created."));
|
|
253
|
+
}
|
|
254
|
+
if (!watchlist) throw new Error(t("The watchlist is no longer there."));
|
|
255
|
+
const name = watchlist.name;
|
|
211
256
|
const plan = planMemberWatchlist(getState().tickers, watchlist.id, list.members);
|
|
212
257
|
// One ticker that fails to save leaves the others on the list; the toast says how many made it.
|
|
213
258
|
let failed = 0;
|
|
@@ -238,23 +283,43 @@ export function useMembersMenu(registrationId: string, list: MemberList | null)
|
|
|
238
283
|
}
|
|
239
284
|
for (const ticker of created) registry.events.emit("ticker:added", { symbol: ticker.metadata.ticker, ticker });
|
|
240
285
|
notify(failed
|
|
241
|
-
? { type: "error", body: tf("Saved {saved} of {count}
|
|
242
|
-
: { type: "success", body: tf("Saved {count}
|
|
286
|
+
? { type: "error", body: tf("Saved {saved} of {count} {noun} to {name}. {failed} could not be added.", { saved: plan.count - failed, count: plan.count, noun, name, failed }) }
|
|
287
|
+
: { type: "success", body: tf("Saved {count} {noun} to {name}.", { count: plan.count, noun, name }) });
|
|
288
|
+
};
|
|
289
|
+
const save = (target: { name: string } | { id: string }) => {
|
|
290
|
+
saveToWatchlist(target).catch((error: unknown) => {
|
|
291
|
+
notify({ type: "error", body: error instanceof Error ? error.message : t("The watchlist was not saved.") });
|
|
292
|
+
});
|
|
293
|
+
};
|
|
294
|
+
const nameNewWatchlist = () => {
|
|
295
|
+
// 54 columns fill the dialog; the prompt's default field is wider and runs past its frame.
|
|
296
|
+
void dialog.prompt<string>({
|
|
297
|
+
closeOnClickOutside: true,
|
|
298
|
+
content: (context: PromptContext<string>) => <TextPromptDialog {...context} title={t("New Watchlist")}
|
|
299
|
+
body={[text.saveBody]} label={t("Name")} initialValue={list.watchlistName} confirmLabel={t("Save")} width={54} />,
|
|
300
|
+
}).then((name) => {
|
|
301
|
+
if (name?.trim()) save({ name });
|
|
302
|
+
}).catch(logFailure("shared.members-menu", "Open save members as watchlist prompt failed"));
|
|
243
303
|
};
|
|
244
304
|
return [
|
|
245
305
|
...(choices.length ? [{ id: "members-open-in", label: t("Open Members In…"), onSelect: openIn }] : []),
|
|
246
|
-
{ id: "members-save-watchlist", label: t("Save
|
|
247
|
-
//
|
|
306
|
+
{ id: "members-save-watchlist", label: t("Save to Watchlist…"), onSelect: () => {
|
|
307
|
+
// With no watchlist yet there is nothing to choose: the name comes first.
|
|
308
|
+
const watchlists = getState().config.watchlists;
|
|
309
|
+
if (!watchlists.length) {
|
|
310
|
+
nameNewWatchlist();
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
248
313
|
void dialog.prompt<string>({
|
|
249
314
|
closeOnClickOutside: true,
|
|
250
|
-
content: (context: PromptContext<string>) => <
|
|
251
|
-
|
|
252
|
-
}).then((
|
|
253
|
-
if (!
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
});
|
|
257
|
-
}).catch(logFailure("shared.members-menu", "Open save members
|
|
315
|
+
content: (context: PromptContext<string>) => <ChoiceDialog {...context} title={text.saveTitle}
|
|
316
|
+
choices={watchlistTargetChoices(watchlists, getState().tickers)} footer={text.saveBody} />,
|
|
317
|
+
}).then((id) => {
|
|
318
|
+
if (!id) return;
|
|
319
|
+
// The name prompt opens once the choice has closed and handed focus back, so its field takes the keys.
|
|
320
|
+
if (id === NEW_WATCHLIST_CHOICE) setTimeout(nameNewWatchlist, 0);
|
|
321
|
+
else save({ id });
|
|
322
|
+
}).catch(logFailure("shared.members-menu", "Open save members to watchlist choice failed"));
|
|
258
323
|
} },
|
|
259
324
|
];
|
|
260
325
|
}, [createPaneFromTemplate, dialog, disabledPlugins, dispatch, getState, list, notify]);
|
|
@@ -32,7 +32,28 @@ const ATS_COLUMNS: PublicationColumn[] = [
|
|
|
32
32
|
{ id: "atsTrades", label: "ATS TRADES", detailLabel: "ATS trades", width: 14, align: "right", format: shares },
|
|
33
33
|
{ id: "nonAtsTrades", label: "NON-ATS TRADES", detailLabel: "Non-ATS trades", width: 16, align: "right", format: shares },
|
|
34
34
|
];
|
|
35
|
-
|
|
35
|
+
/**
|
|
36
|
+
* What every fail row names: one CUSIP and one security, as a ticker with a
|
|
37
|
+
* single issue has. A shared value is said once above the table (and in the
|
|
38
|
+
* export's notes), not on every row; a ticker with several CUSIPs, or a
|
|
39
|
+
* security the filings spell differently over time, keeps the column.
|
|
40
|
+
*/
|
|
41
|
+
interface FailIdentity {
|
|
42
|
+
cusip: string | null;
|
|
43
|
+
security: string | null;
|
|
44
|
+
}
|
|
45
|
+
const NO_IDENTITY: FailIdentity = { cusip: null, security: null };
|
|
46
|
+
export function sharedFailIdentity(rows: readonly PublicationRow[]): FailIdentity {
|
|
47
|
+
const shared = (id: "cusip" | "description"): string | null => {
|
|
48
|
+
const values = new Set(rows.map((row) => row[id]));
|
|
49
|
+
const [value] = values;
|
|
50
|
+
return values.size === 1 && typeof value === "string" && value.trim() ? value : null;
|
|
51
|
+
};
|
|
52
|
+
return rows.length ? { cusip: shared("cusip"), security: shared("description") } : NO_IDENTITY;
|
|
53
|
+
}
|
|
54
|
+
export const publicationColumns = (kind: PublicationKind, shared: FailIdentity = NO_IDENTITY) => kind === "ftd"
|
|
55
|
+
? FTD_COLUMNS.filter((column) => !(column.id === "cusip" && shared.cusip) && !(column.id === "description" && shared.security))
|
|
56
|
+
: ATS_COLUMNS;
|
|
36
57
|
export function publicationRows(data: PublicationPayload): PublicationRow[] {
|
|
37
58
|
return data.history.toReversed().map((row) => "cusip" in row
|
|
38
59
|
? { ...row, id: `${row.date}:${row.cusip}` }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback, useMemo } from "react";
|
|
2
|
-
import { DataTableStackView, EmptyState, PaneStatusBody, usePaneNoticeFooter, usePaneStatusLinkFooter, type DataTableCell } from "../../../components";
|
|
2
|
+
import { DataTableStackView, EmptyState, PaneStatusBody, StatGrid, usePaneNoticeFooter, usePaneStatusLinkFooter, type DataTableCell, type StatItem } from "../../../components";
|
|
3
3
|
import { ageFooterSegment } from "../../../components/layout/pane/footer";
|
|
4
4
|
import { DetailReader } from "../../../components/reader/detail-reader";
|
|
5
5
|
import { usePaneRefreshKey } from "../../../components/data-table/table-pane";
|
|
@@ -10,7 +10,7 @@ import type { PaneProps } from "../../../types/plugin";
|
|
|
10
10
|
import { isKnownNonUsEquityTicker } from "../../../utils/sec";
|
|
11
11
|
import { listingIdentity } from "../shared/ticker-request";
|
|
12
12
|
import { cachedPublication, loadPublication, type PublicationKind } from "./publications-client";
|
|
13
|
-
import { publicationCell, publicationColumns, publicationRows, type PublicationColumn, type PublicationRow } from "./publications-model";
|
|
13
|
+
import { publicationCell, publicationColumns, publicationRows, sharedFailIdentity, type PublicationColumn, type PublicationRow } from "./publications-model";
|
|
14
14
|
|
|
15
15
|
function renderCell(row: PublicationRow, column: PublicationColumn, _index: number, state: { selected: boolean }): DataTableCell {
|
|
16
16
|
const value = row[column.id] ?? null;
|
|
@@ -27,7 +27,14 @@ export function ShortSidePublicationPane({ kind, width, height, focused }: Pick<
|
|
|
27
27
|
});
|
|
28
28
|
const data = resource.data?.payload;
|
|
29
29
|
const rows = useMemo(() => data ? publicationRows(data) : [], [data]);
|
|
30
|
-
const
|
|
30
|
+
const shared = useMemo(() => kind === "ftd" ? sharedFailIdentity(rows) : undefined, [kind, rows]);
|
|
31
|
+
// The open detail names every fact of its row; the table drops what every row shares.
|
|
32
|
+
const detailColumns = publicationColumns(kind);
|
|
33
|
+
const columns = publicationColumns(kind, shared);
|
|
34
|
+
const identity = useMemo<StatItem[]>(() => [
|
|
35
|
+
...(shared?.cusip ? [{ id: "cusip", label: "CUSIP", value: shared.cusip }] : []),
|
|
36
|
+
...(shared?.security ? [{ id: "security", label: "Security", value: shared.security }] : []),
|
|
37
|
+
], [shared]);
|
|
31
38
|
const [selectedId, setSelectedId] = usePluginPaneState<string | null>(`${kind}:selected`, null);
|
|
32
39
|
const [openId, setOpenId] = usePluginPaneState<string | null>(`${kind}:open`, null);
|
|
33
40
|
const rowKey = (row: PublicationRow) => `${symbol}:${row.id}`;
|
|
@@ -51,12 +58,14 @@ export function ShortSidePublicationPane({ kind, width, height, focused }: Pick<
|
|
|
51
58
|
{data ? <DataTableStackView<PublicationRow, PublicationColumn>
|
|
52
59
|
focused={focused} rootWidth={width} rootHeight={height} columns={columns} items={rows} freezeFirstColumn
|
|
53
60
|
sortColumnId={null} sortDirection="desc" emptyStateTitle={`No published ${subject} for this stock.`}
|
|
61
|
+
rootBefore={identity.length ? <StatGrid items={identity} width={width} /> : undefined}
|
|
62
|
+
getExportMetadata={() => [...(shared?.cusip ? [["cusip", shared.cusip]] : []), ...(shared?.security ? [["security", shared.security]] : [])]}
|
|
54
63
|
getItemKey={rowKey} renderCell={renderCell} resetScrollKey={`${kind}:${symbol}`}
|
|
55
64
|
selection={{ kind: "index", selectedIndex: rows.length ? selectedIndex : -1, onChange: (index) => setSelectedId(rows[index] ? rowKey(rows[index]!) : null) }}
|
|
56
65
|
onActivate={(row) => setOpenId(rowKey(row))} detailOpen={!!openRow} onBack={() => setOpenId(null)}
|
|
57
66
|
detailTitle={openRow ? kind === "ftd" ? `${openRow.date} · ${openRow.cusip}` : `Week of ${openRow.date}` : undefined}
|
|
58
67
|
detailContent={openRow ? <DetailReader width={width} resetScrollKey={rowKey(openRow)} facts={[
|
|
59
|
-
...
|
|
68
|
+
...detailColumns.filter((column) => column.id !== "date" && column.id !== "cusip").map((column) => ({ label: column.detailLabel,
|
|
60
69
|
value: openRow[column.id] == null ? "Not published" : typeof openRow[column.id] === "number" && column.id !== "atsSharePercent" && column.id !== "price"
|
|
61
70
|
? Number(openRow[column.id]).toLocaleString("en-US", { maximumFractionDigits: 6 }) : publicationCell(column, openRow[column.id] ?? null) })),
|
|
62
71
|
{ label: "Published through", value: data.sourceAsOf ?? "--" },
|
|
@@ -26,7 +26,7 @@ const LISTED_TYPES = new Set(["", "STK", "EQUITY", "COMMONSTOCK", "ADR", "ETF",
|
|
|
26
26
|
export type ShortWatchSetup = "crowded-rising" | "crowded";
|
|
27
27
|
|
|
28
28
|
export function setupLabel(setup: ShortWatchSetup | null): string {
|
|
29
|
-
return setup === "crowded-rising" ? "Crowded,
|
|
29
|
+
return setup === "crowded-rising" ? "Crowded, px up" : setup === "crowded" ? "Crowded" : "";
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export interface ShortWatchRow {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect, useMemo, useRef, useState } from "react";
|
|
1
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
2
|
import { Box } from "../../../ui";
|
|
3
3
|
import { usePaneSettingValue, useShortcut } from "../../../public/react";
|
|
4
4
|
import { createDataTableCsv } from "../../../components/data-table/export";
|
|
@@ -124,7 +124,8 @@ function TimeSalesView({ width, height, focused, symbol, exchange }: PaneProps &
|
|
|
124
124
|
...(!data.connected || resource.snapshotOnly ? [{ id: "snapshot", parts: [{ text: "snapshot", tone: "warning" as const }] }] : [])] : [] });
|
|
125
125
|
const quoteColumns = useMemo(() => dropColumnsToFit(QUOTES, width - 1, QUOTE_DROP_ORDER), [width]);
|
|
126
126
|
const columns = tab === "quotes" ? quoteColumns : TRADES;
|
|
127
|
-
|
|
127
|
+
// Kept between prints, so the tab strip skips the renders the tape gives the pane.
|
|
128
|
+
const selectTab = useCallback((value: string) => { setTab(value); setDetail(null); setSelected(null); }, [setTab]);
|
|
128
129
|
const { strip: tabStrip, rows: tabRows } = usePaneTabs({ tabs: TABS, activeValue: tab, onSelect: selectTab, focused: focused && !detail, dense: true });
|
|
129
130
|
const renderCell = (row: TapeRow, column: DataTableColumn): DataTableCell => {
|
|
130
131
|
if (row.trade) {
|
|
@@ -257,6 +257,9 @@ function bondId(raw: Record<string, unknown>, index: number): string {
|
|
|
257
257
|
function parseBond(raw: unknown, index: number): CorporateBond | null {
|
|
258
258
|
const record = recordOrNull(raw);
|
|
259
259
|
if (!record) return null;
|
|
260
|
+
// A price of zero is no sale (a cancelled or defaulted print): the bond is listed with no last sale, never one at 0.
|
|
261
|
+
const price = numericOrNull(record.lastSalePrice);
|
|
262
|
+
const sold = price == null || price > 0;
|
|
260
263
|
return {
|
|
261
264
|
id: bondId(record, index),
|
|
262
265
|
issuerName: textOrNull(record.issuerName) ?? "",
|
|
@@ -264,10 +267,10 @@ function parseBond(raw: unknown, index: number): CorporateBond | null {
|
|
|
264
267
|
symbol: textOrNull(record.issueSymbolIdentifier),
|
|
265
268
|
couponRate: numericOrNull(record.couponRate),
|
|
266
269
|
maturityDate: saleDate(record.maturityDate),
|
|
267
|
-
lastSalePrice:
|
|
268
|
-
lastSaleYield: numericOrNull(record.lastSaleYield),
|
|
269
|
-
priceChangeNumber: saleChange(numericOrNull(record.priceChangeNumber),
|
|
270
|
-
lastTradeDate: saleDate(record.lastTradeDate),
|
|
270
|
+
lastSalePrice: sold ? price : null,
|
|
271
|
+
lastSaleYield: sold ? numericOrNull(record.lastSaleYield) : null,
|
|
272
|
+
priceChangeNumber: sold ? saleChange(numericOrNull(record.priceChangeNumber), price) : null,
|
|
273
|
+
lastTradeDate: sold ? saleDate(record.lastTradeDate) : null,
|
|
271
274
|
traceGradeCode: textOrNull(record.traceGradeCode),
|
|
272
275
|
};
|
|
273
276
|
}
|
|
@@ -24,7 +24,7 @@ export const traceBondsModule: PluginModule = {
|
|
|
24
24
|
label: "Corporate Bond Tape",
|
|
25
25
|
description: "Latest corporate and agency bond sales: issuer, coupon, price, yield, and grade.",
|
|
26
26
|
keywords: ["bond", "bonds", "corporate", "agency", "coupon", "yield", "issuer", "cusip", "credit", "fixed income", "trace"],
|
|
27
|
-
shortcut: { prefix: "TRACE", argKind: "text", argOptional: true, argPlaceholder: "issuer, symbol or CUSIP" },
|
|
27
|
+
shortcut: { prefix: "TRACE", argKind: "text", argOptional: true, focusedIssuer: true, argPlaceholder: "issuer, symbol or CUSIP" },
|
|
28
28
|
headless: traceBondsHeadless,
|
|
29
29
|
// Its sales date a capture, never the stock quote of a ticker typed as its argument (`TRACE CMLSQ`).
|
|
30
30
|
reportFreshness: { source: "FINRA", status: "not-a-feed", basis: "last sales" },
|
|
@@ -16,7 +16,12 @@ import { abortable, abortError } from "../../../utils/async-deadline";
|
|
|
16
16
|
import { errorMessage } from "../../../utils/errors";
|
|
17
17
|
import { savedCopyAt } from "../../../data/saved-copies";
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Source reads in flight at once: the board's 23 closes and series in three
|
|
21
|
+
* rounds, not six. Each round is a request's wait, which a shot of the board
|
|
22
|
+
* and `fn VIX` sit through in turn.
|
|
23
|
+
*/
|
|
24
|
+
const VOLATILITY_LOAD_CONCURRENCY = 8;
|
|
20
25
|
const VOLATILITY_HISTORY_LIMIT = 400;
|
|
21
26
|
export interface VolatilityLoadResult {
|
|
22
27
|
data: VolatilityData;
|
|
@@ -56,7 +56,6 @@ export function createVolatilityHeadless(dependencies: VolatilityHeadlessDepende
|
|
|
56
56
|
discovery: { screenshotReadiness: "live-dom", limitations: [
|
|
57
57
|
"Daily histories may contain isolated index observations; sparse coverage has no daily change or annual percentile.",
|
|
58
58
|
"Thin histories do not support daily changes or one-year percentiles.",
|
|
59
|
-
"The existing sources do not supply a VIX futures curve.",
|
|
60
59
|
] },
|
|
61
60
|
async load(args, context) {
|
|
62
61
|
const result = await dependencies.load(args, context);
|
|
@@ -6,6 +6,8 @@ import type { CurveBasis } from "./forward";
|
|
|
6
6
|
import { yieldSpreads, type YieldLookbackCurves } from "./chart";
|
|
7
7
|
import { completeYieldCurve, loadHistoricalYieldCurve, yieldCurveDate } from "./history";
|
|
8
8
|
import { DATE_OPTION_FORMATS, dateOptionHint, readCalendarDate } from "../../../utils/calendar-date";
|
|
9
|
+
import { formatBasisPoints } from "../../../utils/basis-points";
|
|
10
|
+
import { formatPercentileRank } from "../../../utils/format";
|
|
9
11
|
import { isYieldObservationDate, loadYieldCurve, type YieldPoint } from "./treasury-data";
|
|
10
12
|
|
|
11
13
|
export type CurveId = CloudCurveId;
|
|
@@ -166,6 +168,19 @@ export function curveSpreadFigures(data: CurveData | null, lookbacks: YieldLookb
|
|
|
166
168
|
.map(({ id, spread, change1d }) => ({ id, value: spread, change1d, percentile1y: null }));
|
|
167
169
|
}
|
|
168
170
|
|
|
171
|
+
/**
|
|
172
|
+
* A spread as GC reads it, the pane's figure and the report's row alike: its
|
|
173
|
+
* level ("+38bp"), and under it the day's move and where it sits in the last
|
|
174
|
+
* year ("+1bp 1D · 20 pctl 1Y"), the rank left out when the source has none.
|
|
175
|
+
*/
|
|
176
|
+
export function curveSpreadText(figure: CurveSpreadFigure): { value: string; detail: string } {
|
|
177
|
+
return {
|
|
178
|
+
value: figure.value == null ? "--" : formatBasisPoints(figure.value),
|
|
179
|
+
detail: [`${figure.change1d == null ? "--" : formatBasisPoints(figure.change1d)} 1D`,
|
|
180
|
+
...(figure.percentile1y == null ? [] : [formatPercentileRank(figure.percentile1y, "1Y")])].join(" · "),
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
|
|
169
184
|
/**
|
|
170
185
|
* A curve on the requested date (its last session on or before it) or its
|
|
171
186
|
* latest. Treasuries fall back to FRED when the stored curve cannot be read,
|
|
@@ -3,7 +3,7 @@ import type {
|
|
|
3
3
|
HeadlessPaneDefinition,
|
|
4
4
|
} from "../../../types/plugin";
|
|
5
5
|
import {
|
|
6
|
-
compareDate, curveCutoff, curveIdOf, curveOption, curveSpreadFigures, curveTenorMove, loadComparePoints,
|
|
6
|
+
compareDate, curveCutoff, curveIdOf, curveOption, curveSpreadFigures, curveSpreadText, curveTenorMove, loadComparePoints,
|
|
7
7
|
parseCompareInput, parseCurveArgument, unknownCurveMessage, type CurveData, type CurveId,
|
|
8
8
|
} from "./curves";
|
|
9
9
|
import { yieldTenorRows, type YieldLookbackCurves } from "./chart";
|
|
@@ -241,6 +241,11 @@ export function createYieldCurveHeadless(
|
|
|
241
241
|
...(requestedDate ? { basis: "historical curve" } : { basis: "daily curve", cadence: "daily" }) },
|
|
242
242
|
...(comparePoints ? { columns: compareColumns(compareAsOf) } : ranked ? { columns: RANKED_COLUMNS } : {}),
|
|
243
243
|
...(ranked ? { notes: [RANK_NOTE] } : {}),
|
|
244
|
+
// The spreads the pane shows over its table, each with its day move and where it sits in the last year.
|
|
245
|
+
...(spreads.length ? { textSections: [{ title: "Spreads", entries: spreads.map((figure) => {
|
|
246
|
+
const text = curveSpreadText(figure);
|
|
247
|
+
return { key: figure.id, label: figure.id, value: bp(figure.value), formatted: `${text.value} ${text.detail}` };
|
|
248
|
+
}) }] } : {}),
|
|
244
249
|
rows: rows.map((point) => {
|
|
245
250
|
const compare = compareAt(point.maturity);
|
|
246
251
|
const change = tenorRows.get(point.maturity)?.change1d ?? null;
|
|
@@ -20,7 +20,6 @@ import { GOVERNMENT_BOND_SERIES, TREASURY_SERIES } from "./series";
|
|
|
20
20
|
import { useAutoRefresh } from "../../../react/auto-refresh";
|
|
21
21
|
import { usePaneStatusFooter } from "../../../components/layout/pane/status-footer";
|
|
22
22
|
import { savedCopyFooterSegment, type PaneFooterSegment } from "../../../components/layout/pane/footer";
|
|
23
|
-
import { formatPercentileRank } from "../../../utils/format";
|
|
24
23
|
import { SERIES_COLORS } from "../../../theme/series-colors";
|
|
25
24
|
import type { CurveSeries } from "../../../components/chart/curve";
|
|
26
25
|
import { yieldCurveHeadless } from "./headless";
|
|
@@ -29,7 +28,7 @@ import {
|
|
|
29
28
|
type YieldTenorRow,
|
|
30
29
|
} from "./chart";
|
|
31
30
|
import {
|
|
32
|
-
compareDate, curveCutoff, curveIdOf, CURVE_OPTIONS, curveSpreadFigures, curveTenorMove, loadComparePoints,
|
|
31
|
+
compareDate, curveCutoff, curveIdOf, CURVE_OPTIONS, curveSpreadFigures, curveSpreadText, curveTenorMove, loadComparePoints,
|
|
33
32
|
parseCompareInput, parseCurveArgument, type CurveId,
|
|
34
33
|
} from "./curves";
|
|
35
34
|
import { formatMoveRank, MOVE_HORIZONS } from "../shared/move-rank";
|
|
@@ -291,11 +290,9 @@ function CurveTab({ curve, onCurveChange, focused, width, height }: {
|
|
|
291
290
|
// last year; an inverted one is the warning the curve's shape gives. Then the
|
|
292
291
|
// selected tenor's 1D and 1W moves, ranked by size against its whole history.
|
|
293
292
|
const figures = useMemo<StatItem[]>(() => [
|
|
294
|
-
...curveSpreadFigures(current, lookbackCurves).map((
|
|
295
|
-
id, label: id,
|
|
296
|
-
|
|
297
|
-
...(percentile1y == null ? [] : [formatPercentileRank(percentile1y, "1Y")])].join(" · "),
|
|
298
|
-
tone: value != null && Math.round(value * 100) < 0 ? "warning" : undefined,
|
|
293
|
+
...curveSpreadFigures(current, lookbackCurves).map((figure): StatItem => ({
|
|
294
|
+
id: figure.id, label: figure.id, ...curveSpreadText(figure),
|
|
295
|
+
tone: figure.value != null && Math.round(figure.value * 100) < 0 ? "warning" : undefined,
|
|
299
296
|
})),
|
|
300
297
|
...(selectedId ? MOVE_HORIZONS : []).flatMap((horizon): StatItem[] => {
|
|
301
298
|
const move = curveTenorMove(current, selectedId!, horizon);
|
|
@@ -507,7 +504,7 @@ export const yieldCurveModule: PluginModule = {
|
|
|
507
504
|
label: "Yield Curve",
|
|
508
505
|
description: "Government bond curves, a world grid, and USD SOFR swap rates, swap spreads and tenor history.",
|
|
509
506
|
keywords: ["yield", "curve", "treasury", "bonds", "rates", "gc", "interest", "tips", "breakeven", "bund", "gilt", "jgb",
|
|
510
|
-
"sovereign", "world", "forward", "swaps", "sofr", "ois", "swap spread"],
|
|
507
|
+
"sovereign", "world", "forward", "swaps", "sofr", "ois", "swap spread", "2s10s", "steepener", "flattener"],
|
|
511
508
|
shortcut: { prefix: "GC", argPlaceholder: "[curve] [date]", argKind: "text", argOptional: true },
|
|
512
509
|
headless: yieldCurveHeadless,
|
|
513
510
|
createInstance: (_context, options) => {
|
|
@@ -23,6 +23,25 @@ interface HostModule {
|
|
|
23
23
|
native?: true;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* A CommonJS package's exports as an ES module's: each property of its
|
|
28
|
+
* `module.exports` a named export, beside `default`.
|
|
29
|
+
*
|
|
30
|
+
* The terminal binary and the desktop app's terminal are bundled with
|
|
31
|
+
* `--splitting` (scripts/build.ts, scripts/install-electrobun-tui-shim.ts),
|
|
32
|
+
* and once any module default-imports React, as the OpenTUI renderer does,
|
|
33
|
+
* Bun answers `import("react")` with a chunk that exports `module.exports`
|
|
34
|
+
* as `default` and nothing else. Served like that, a plugin's
|
|
35
|
+
* `import React from "react"` linked and its `import { useEffect } from
|
|
36
|
+
* "react"` did not, and nearly every plugin failed to load there.
|
|
37
|
+
*/
|
|
38
|
+
async function importCommonJs(load: HostModuleImporter): Promise<object> {
|
|
39
|
+
const namespace = (await load()) as Record<string, unknown>;
|
|
40
|
+
const moduleExports = namespace.default;
|
|
41
|
+
if (moduleExports === null || typeof moduleExports !== "object") return namespace;
|
|
42
|
+
return { ...moduleExports, ...namespace };
|
|
43
|
+
}
|
|
44
|
+
|
|
26
45
|
/**
|
|
27
46
|
* Every specifier a plugin may import that must resolve to the host's copy.
|
|
28
47
|
* Anything else is a plugin's own dependency and gets bundled normally.
|
|
@@ -37,9 +56,9 @@ interface HostModule {
|
|
|
37
56
|
* desktop and break in the TUI.
|
|
38
57
|
*/
|
|
39
58
|
const HOST_MODULES: Readonly<Record<string, HostModule>> = {
|
|
40
|
-
"react": { load: () => import("react") },
|
|
41
|
-
"react/jsx-runtime": { load: () => import("react/jsx-runtime") },
|
|
42
|
-
"react/jsx-dev-runtime": { load: () => import("react/jsx-dev-runtime") },
|
|
59
|
+
"react": { load: () => importCommonJs(() => import("react")) },
|
|
60
|
+
"react/jsx-runtime": { load: () => importCommonJs(() => import("react/jsx-runtime")) },
|
|
61
|
+
"react/jsx-dev-runtime": { load: () => importCommonJs(() => import("react/jsx-dev-runtime")) },
|
|
43
62
|
"gloomberb/types/plugin": { load: () => import("../types/plugin") },
|
|
44
63
|
"gloomberb/types/persistence": { load: () => import("../types/persistence") },
|
|
45
64
|
// Type modules also export runtime values (`TICKER_RESEARCH_PANE_ID`,
|
|
@@ -7,13 +7,15 @@ import { loadExternalPlugin } from "./loader";
|
|
|
7
7
|
/**
|
|
8
8
|
* The plugin the smoke writes: one import from each kind of module a real
|
|
9
9
|
* plugin uses. `react` and the JSX runtime have to be the host's own
|
|
10
|
-
* instance,
|
|
10
|
+
* instance, imported by name as registry plugins do: a host that served
|
|
11
|
+
* React's default export alone passed a default import and failed every
|
|
12
|
+
* plugin. `gloomberb/ui` is shared state, `gloomberb/types/config` is a
|
|
11
13
|
* value from a module that used to be bundled from the package directory,
|
|
12
14
|
* and `smoke-dep` stands in for a dependency `bun install` put in the
|
|
13
15
|
* plugin's own `node_modules`.
|
|
14
16
|
*/
|
|
15
17
|
const SMOKE_PLUGIN_SOURCE = `
|
|
16
|
-
import React from "react";
|
|
18
|
+
import React, { memo, useCallback, useEffect, useState, useSyncExternalStore } from "react";
|
|
17
19
|
import { Box, Text } from "gloomberb/ui";
|
|
18
20
|
import { formatNumber } from "gloomberb/utils";
|
|
19
21
|
import { TICKER_RESEARCH_PANE_ID } from "gloomberb/types/config";
|
|
@@ -31,7 +33,8 @@ export default {
|
|
|
31
33
|
const element = <Probe />;
|
|
32
34
|
const tree = Probe();
|
|
33
35
|
return {
|
|
34
|
-
react: typeof React.createElement === "function"
|
|
36
|
+
react: typeof React.createElement === "function"
|
|
37
|
+
&& [memo, useCallback, useEffect, useState, useSyncExternalStore].every((value) => typeof value === "function"),
|
|
35
38
|
jsx: typeof element.type === "function" && tree != null && typeof tree === "object" && "type" in tree,
|
|
36
39
|
paneId: TICKER_RESEARCH_PANE_ID,
|
|
37
40
|
platform,
|
|
@@ -25,6 +25,25 @@ export function findNamedCollection<T extends { id: string; name: string }>(
|
|
|
25
25
|
)) ?? null;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
/**
|
|
29
|
+
* What a list argument that names a watchlist reads (`SIW HY3`): its symbols,
|
|
30
|
+
* at most a function's `maximum`, and a note saying the name was read as the
|
|
31
|
+
* watchlist, which matters when it is a ticker too (`AI`): `Read AI as
|
|
32
|
+
* watchlist AI (12 symbols).` or `Read HY3 as watchlist HY3 (70 symbols); the
|
|
33
|
+
* first 60 are read.` Every function's list argument, in `fn` and in the
|
|
34
|
+
* command bar, reads a watchlist's name here.
|
|
35
|
+
*/
|
|
36
|
+
export function readWatchlistArgument(
|
|
37
|
+
typed: string,
|
|
38
|
+
watchlist: { name: string },
|
|
39
|
+
members: readonly string[],
|
|
40
|
+
maximum: number | undefined,
|
|
41
|
+
): { symbols: string[]; note: string } {
|
|
42
|
+
const read = `Read ${typed.trim()} as watchlist ${watchlist.name} (${members.length} symbol${members.length === 1 ? "" : "s"})`;
|
|
43
|
+
if (maximum == null || members.length <= maximum) return { symbols: [...members], note: `${read}.` };
|
|
44
|
+
return { symbols: members.slice(0, maximum), note: `${read}; the first ${maximum} are read.` };
|
|
45
|
+
}
|
|
46
|
+
|
|
28
47
|
/**
|
|
29
48
|
* The command bar's row for a function typed with a portfolio or watchlist
|
|
30
49
|
* nothing has (`PF Nope`, `PORT Nope`), or null when one of `collections` has
|