gloomberb 0.19.4 → 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 +3 -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/command-utils.ts +4 -0
- package/src/cli/commands/market.ts +264 -33
- package/src/cli/commands/search.ts +22 -4
- package/src/cli/commands/ticker.ts +84 -39
- package/src/cli/currency-name-hint.ts +60 -0
- package/src/cli/glossary.ts +3 -3
- package/src/cli/history-rows.ts +18 -1
- package/src/cli/known-gaps.ts +25 -2
- package/src/cli/listing-arg.ts +12 -0
- package/src/cli/not-a-ticker.ts +5 -3
- package/src/cli/pane-functions/capabilities.ts +2 -0
- package/src/cli/pane-functions/catalog.ts +31 -5
- package/src/cli/pane-functions/function-help.ts +8 -5
- package/src/cli/pane-functions/headless.ts +11 -6
- package/src/cli/pane-functions/market-session.ts +6 -7
- package/src/cli/pane-functions/resolver.ts +75 -2
- package/src/cli/quote-answer.ts +9 -0
- package/src/cli/series-search.ts +4 -5
- 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-bitmap.ts +28 -2
- 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 +30 -7
- 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/active-drag.ts +38 -7
- package/src/components/layout/shell/drag/magnets.ts +106 -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/layout/window-controls.tsx +96 -35
- package/src/components/layout/window-fullscreen.ts +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/quote-flash.ts +36 -32
- 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/coordinator/events.ts +17 -1
- package/src/market-data/frame-scheduler.ts +47 -10
- package/src/market-data/frame-wake.ts +74 -0
- package/src/market-data/futures-board.ts +7 -6
- package/src/market-data/futures-contract.ts +14 -3
- package/src/market-data/hooks.tsx +12 -3
- package/src/market-data/market/freshness.ts +18 -0
- package/src/market-data/market/status.ts +15 -2
- package/src/market-data/performance.ts +78 -9
- package/src/market-data/request-types.ts +6 -3
- package/src/plugins/builtin/alerts/cli.ts +2 -1
- package/src/plugins/builtin/analytics/risk-evidence.ts +1 -0
- package/src/plugins/builtin/attention/evidence.ts +1 -1
- package/src/plugins/builtin/awards/client.ts +1 -1
- package/src/plugins/builtin/awards/evidence.ts +1 -1
- package/src/plugins/builtin/awards/pane.tsx +2 -1
- 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/math.ts +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/broker-manager/footer.ts +3 -2
- package/src/plugins/builtin/broker-manager/index.tsx +2 -1
- package/src/plugins/builtin/broker-manager/keyboard.ts +2 -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/catalysts/evidence.ts +1 -1
- package/src/plugins/builtin/catalysts/pane.tsx +2 -1
- package/src/plugins/builtin/cds/headless.ts +1 -0
- package/src/plugins/builtin/cds/index.tsx +1 -1
- package/src/plugins/builtin/chart-composer/headless.ts +40 -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/cloud-tweets/table.tsx +3 -2
- package/src/plugins/builtin/comment-letters/client.ts +2 -1
- package/src/plugins/builtin/company-kpis/client.ts +1 -1
- package/src/plugins/builtin/company-kpis/pane.tsx +2 -1
- package/src/plugins/builtin/company-kpis/screenshot-evidence.ts +3 -2
- package/src/plugins/builtin/correlation/headless.ts +3 -2
- package/src/plugins/builtin/cot/headless.ts +9 -3
- package/src/plugins/builtin/cot/model.ts +44 -3
- package/src/plugins/builtin/credit-documents/client.ts +1 -1
- package/src/plugins/builtin/credit-documents/evidence.ts +1 -1
- package/src/plugins/builtin/credit-documents/pane.tsx +2 -1
- 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-calls/pane.tsx +1 -1
- package/src/plugins/builtin/earnings-ripple/index.tsx +6 -1
- package/src/plugins/builtin/earnings-ripple/pane.tsx +1 -1
- package/src/plugins/builtin/econ/calendar-model.ts +30 -6
- package/src/plugins/builtin/econ/fred-catalog.ts +5 -5
- package/src/plugins/builtin/econ/print-watch.ts +3 -1
- 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/series.ts +16 -1
- 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/fx-matrix/headless.ts +4 -2
- package/src/plugins/builtin/fx-matrix/index.tsx +37 -3
- package/src/plugins/builtin/fx-matrix/pairs.ts +15 -0
- package/src/plugins/builtin/gpu/headless.ts +2 -1
- package/src/plugins/builtin/help/function-card.tsx +2 -1
- package/src/plugins/builtin/help/index.tsx +2 -1
- package/src/plugins/builtin/insider/display.ts +45 -6
- package/src/plugins/builtin/ipo-calendar/model.ts +2 -0
- package/src/plugins/builtin/iv-history/client.ts +2 -1
- package/src/plugins/builtin/iv-history/headless.ts +2 -1
- package/src/plugins/builtin/jobs/pages.ts +4 -4
- package/src/plugins/builtin/kelly-sizer/headless.ts +2 -1
- 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-heatmap/index.tsx +2 -1
- package/src/plugins/builtin/market-movers/index.tsx +4 -3
- package/src/plugins/builtin/members/client.ts +1 -1
- package/src/plugins/builtin/mna/distress/client.ts +1 -0
- package/src/plugins/builtin/mna/distress/headless.ts +1 -0
- package/src/plugins/builtin/mna/pane.tsx +4 -1
- package/src/plugins/builtin/options/market-reference.ts +1 -1
- package/src/plugins/builtin/options/open-interest-as-of.ts +3 -1
- package/src/plugins/builtin/options/view.tsx +2 -1
- package/src/plugins/builtin/options-calculator/evidence.ts +1 -1
- package/src/plugins/builtin/options-scenario/csp-screen-pane.tsx +1 -1
- package/src/plugins/builtin/options-scenario/csp-screen.ts +8 -4
- package/src/plugins/builtin/options-scenario/csp.ts +28 -9
- package/src/plugins/builtin/options-scenario/evidence.ts +5 -4
- package/src/plugins/builtin/options-scenario/pane.tsx +2 -1
- package/src/plugins/builtin/perps/client.ts +1 -1
- 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 +4 -2
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +7 -3
- package/src/plugins/builtin/portfolio-list/use-throttled-memo.ts +10 -19
- package/src/plugins/builtin/rate-path/headless.ts +24 -10
- package/src/plugins/builtin/research/analyst-model.ts +1 -0
- package/src/plugins/builtin/research/equity-diagnostic-pane.tsx +2 -1
- package/src/plugins/builtin/research/event-model.ts +10 -3
- package/src/plugins/builtin/research/events-headless.ts +20 -2
- package/src/plugins/builtin/research/index.tsx +1 -0
- package/src/plugins/builtin/research/relative-valuation-currency.ts +1 -1
- package/src/plugins/builtin/research/relative-valuation-peers.ts +2 -1
- package/src/plugins/builtin/research-search/command-bar-search.ts +3 -1
- package/src/plugins/builtin/research-search/snippet.ts +1 -0
- package/src/plugins/builtin/revenue-breakdown/client.ts +3 -2
- package/src/plugins/builtin/seasonality/headless.ts +2 -1
- package/src/plugins/builtin/sec/command-bar-search.ts +3 -2
- package/src/plugins/builtin/sec/fund-facts.ts +17 -1
- package/src/plugins/builtin/sec/index.tsx +8 -5
- package/src/plugins/builtin/sec/row-summaries.ts +28 -12
- 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-client.ts +2 -1
- package/src/plugins/builtin/short-interest/watch-model.ts +1 -1
- package/src/plugins/builtin/social-mentions/client.ts +2 -1
- package/src/plugins/builtin/supply-chain/client.ts +1 -1
- package/src/plugins/builtin/supply-chain/evidence.ts +1 -1
- package/src/plugins/builtin/supply-chain/graph-pane.tsx +2 -1
- package/src/plugins/builtin/supply-chain/pane.tsx +2 -1
- package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +1 -1
- package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +24 -4
- package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +1 -1
- package/src/plugins/builtin/time-sales/client.ts +1 -0
- 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/vol-surface/client.ts +2 -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 +9 -2
- 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/portfolio/column-values.ts +76 -10
- 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/dom/host/box.tsx +204 -176
- package/src/renderers/dom/host/style.ts +49 -20
- package/src/renderers/dom/host/text.tsx +3 -2
- 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 +322 -19
- package/src/renderers/electrobun/bun/desktop/detached-windows.ts +83 -61
- package/src/renderers/electrobun/bun/desktop/host-requests.ts +29 -15
- package/src/renderers/electrobun/bun/desktop/initialization.ts +30 -11
- package/src/renderers/electrobun/bun/desktop/relaunch.ts +9 -1
- 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/windows-script.ts +9 -6
- 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/bun/window/windows-native.ts +26 -1
- package/src/renderers/electrobun/shared/protocol.ts +50 -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/renderers/electrobun/view/ui-host.tsx +7 -0
- package/src/renderers/electrobun/view/window-fullscreen.ts +10 -3
- package/src/series/fred-argument.ts +17 -0
- package/src/sources/provider-router/financial-routes.ts +7 -1
- package/src/sources/provider-router/index.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/price-units.ts +11 -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/host.tsx +2 -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/currency-names.ts +20 -0
- package/src/utils/currency-pair.ts +6 -0
- package/src/utils/exchange-rate-snapshot.ts +20 -2
- package/src/utils/format.ts +7 -2
- package/src/utils/futures-generic.ts +12 -0
- package/src/utils/fx-market-hours.ts +43 -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
|
@@ -46,10 +46,11 @@ function brokerContractForTicker(
|
|
|
46
46
|
const contracts = ticker?.metadata.broker_contracts ?? [];
|
|
47
47
|
const portfolioId = options.portfolioId;
|
|
48
48
|
if (portfolioId) {
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
// Rows ask on every render of a list: nothing is allocated for a portfolio's lots until one names a contract.
|
|
50
|
+
let selected: Map<string, BrokerContractRef> | null = null;
|
|
51
51
|
let hasPublicPosition = false;
|
|
52
|
-
for (const position of positions) {
|
|
52
|
+
for (const position of ticker?.metadata.positions ?? []) {
|
|
53
|
+
if (position.portfolio !== portfolioId || position.shares === 0) continue;
|
|
53
54
|
const hasExplicitId = position.brokerContractId != null;
|
|
54
55
|
const hasExplicitIdentity = position.brokerContractIdentity != null;
|
|
55
56
|
const hasLegacyScope = position.broker !== "manual" && !!position.broker && !!position.brokerInstanceId;
|
|
@@ -68,11 +69,13 @@ function brokerContractForTicker(
|
|
|
68
69
|
hasPublicPosition = true;
|
|
69
70
|
continue;
|
|
70
71
|
}
|
|
72
|
+
selected ??= new Map();
|
|
71
73
|
for (const contract of matches) {
|
|
72
74
|
const key = scopedBrokerContractIdentityKey(contract);
|
|
73
75
|
selected.set(key, contract);
|
|
74
76
|
}
|
|
75
77
|
}
|
|
78
|
+
if (!selected) return null;
|
|
76
79
|
// One ticker quote must identify every selected lot. Never choose by array order.
|
|
77
80
|
if (selected.size > 1 || (selected.size > 0 && hasPublicPosition)) return undefined;
|
|
78
81
|
return selected.values().next().value ?? null;
|
|
@@ -1110,7 +1110,8 @@ export const alertsCliCommand: CliCommandDef = {
|
|
|
1110
1110
|
});
|
|
1111
1111
|
return;
|
|
1112
1112
|
}
|
|
1113
|
-
|
|
1113
|
+
// `remove`, as the command's own description says it does, and `rm` delete as `delete` does.
|
|
1114
|
+
if (action === "delete" || action === "remove" || action === "rm") {
|
|
1114
1115
|
const id = requireArg(args[1], "Usage: gloom alerts delete <id>", ctx);
|
|
1115
1116
|
const level = alerts.find((alert) => alert.id === id) ?? null;
|
|
1116
1117
|
const rule = level ? null : events.rules.find((entry) => entry.id === id) ?? null;
|
|
@@ -480,6 +480,7 @@ export function brokerPerformanceEvidence(
|
|
|
480
480
|
performance: { flowTiming: "end-of-day", externalFlowsComplete: true, observations },
|
|
481
481
|
}), now);
|
|
482
482
|
} catch {
|
|
483
|
+
// Intentional ignore: account history that fails evidence validation does not qualify as evidence.
|
|
483
484
|
return null;
|
|
484
485
|
}
|
|
485
486
|
}
|
|
@@ -19,7 +19,7 @@ export const attentionScreenshotEvidence: PaneScreenshotEvidenceHook<AttentionEv
|
|
|
19
19
|
if (!isRecord(value) || value.kind !== "attention" || value.version !== 1 || value.complete !== true
|
|
20
20
|
|| !isRecord(value.payload) || attentionTab(value.tab) !== value.tab || typeof value.selectedSymbol !== "string"
|
|
21
21
|
|| !Number.isInteger(value.plottedValueCount) || Number(value.plottedValueCount) < 0) return null;
|
|
22
|
-
try { validateAttention(value.payload as unknown as AttentionPayload); return value as unknown as AttentionEvidence; } catch { return null; }
|
|
22
|
+
try { validateAttention(value.payload as unknown as AttentionPayload); return value as unknown as AttentionEvidence; } catch { /* Intentional ignore: invalid captured observations are rejected as evidence by returning null. */ return null; }
|
|
23
23
|
},
|
|
24
24
|
mismatches(evidence, { resolved }) {
|
|
25
25
|
return [evidence.payload.window !== attentionWindow(resolved.options.window) ? "Attention window does not match" : null,
|
|
@@ -14,7 +14,7 @@ const optionalText = (value: unknown) => value == null || text(value);
|
|
|
14
14
|
const amount = (value: unknown) => value == null || text(value) && /^-?\d+(?:\.\d+)?$/.test(value) && Number.isFinite(Number(value));
|
|
15
15
|
const date = (value: unknown) => text(value) && /^\d{4}-\d{2}-\d{2}$/.test(value) && Number.isFinite(Date.parse(value)) && new Date(value).toISOString().slice(0, 10) === value;
|
|
16
16
|
const instant = (value: unknown) => text(value) && Number.isFinite(Date.parse(value));
|
|
17
|
-
const url = (value: unknown) => { try { return text(value) && ["https:", "http:"].includes(new URL(value).protocol); } catch { return false; } };
|
|
17
|
+
const url = (value: unknown) => { try { return text(value) && ["https:", "http:"].includes(new URL(value).protocol); } catch { /* Intentional ignore: malformed URLs fail this web link field validator. */ return false; } };
|
|
18
18
|
const confidence = (value: unknown) => typeof value === "number" && Number.isFinite(value) && value >= 0 && value <= 1;
|
|
19
19
|
const count = (value: unknown) => Number.isSafeInteger(value) && Number(value) >= 0;
|
|
20
20
|
const currency = (value: unknown) => text(value) && /^[A-Z]{3}$/.test(value);
|
|
@@ -24,7 +24,7 @@ export const awardsScreenshotEvidence: PaneScreenshotEvidenceHook<AwardsEvidence
|
|
|
24
24
|
read(value) {
|
|
25
25
|
if (!isRecord(value) || value.kind !== "government-awards" || value.version !== 1 || value.complete !== true || !Number.isSafeInteger(value.plottedValueCount)
|
|
26
26
|
|| Number(value.plottedValueCount) < 0 || awardTab(value.tab) !== value.tab || !isRecord(value.payload)) return null;
|
|
27
|
-
try { validateAwards(value.payload as unknown as AwardsPayload); return value as unknown as AwardsEvidence; } catch { return null; }
|
|
27
|
+
try { validateAwards(value.payload as unknown as AwardsPayload); return value as unknown as AwardsEvidence; } catch { /* Intentional ignore: invalid captured observations are rejected as evidence by returning null. */ return null; }
|
|
28
28
|
},
|
|
29
29
|
mismatches(evidence, { resolved, payload }) {
|
|
30
30
|
const snapshot = payload.config.layout.instances.find((entry) => entry.instanceId === payload.paneId)?.settings?.awardsSnapshot;
|
|
@@ -26,6 +26,7 @@ import { AWARDS_UNAVAILABLE, fetchAwards, loadAward, loadAwards, validateAwards
|
|
|
26
26
|
import { useAwardsEvidence } from "./evidence";
|
|
27
27
|
import { AWARD_TABS, aggregateId, awardHistorySeries, awardPercent, awardPeriod, awardScope, awardsCoverageNotes, awardsPreviewNote, awardTab, awardTypeLabel, futureAwardDatesNote, money,
|
|
28
28
|
rankedAggregates } from "./model";
|
|
29
|
+
import { logFailure } from "../../../utils/log-failure";
|
|
29
30
|
|
|
30
31
|
type Item = { kind: "award"; row: AwardRow } | { kind: "aggregate"; row: AwardAggregate } | { kind: "leader"; row: AwardCompanyLeader } | { kind: "locked"; id: string }
|
|
31
32
|
| { kind: "section"; id: string; label: string; count: number } | { kind: "note"; id: string; text: string };
|
|
@@ -116,7 +117,7 @@ function AwardsView({ width, height, focused, symbol }: PaneProps & { symbol: st
|
|
|
116
117
|
const [selectedId, setSelected] = usePluginPaneState<string | null>(`awards:selection:${tab}`, null);
|
|
117
118
|
const search = useQueryBarSearch(), tickerSearch = useQueryBarSearch();
|
|
118
119
|
const [snapshotSetting] = usePaneSettingValue<AwardsPayload | null>("awardsSnapshot", null);
|
|
119
|
-
const snapshot = useMemo(() => { try { return snapshotSetting ? validateAwards(snapshotSetting) : null; } catch { return null; } }, [snapshotSetting]);
|
|
120
|
+
const snapshot = useMemo(() => { try { return snapshotSetting ? validateAwards(snapshotSetting) : null; } catch (error) { return logFailure("awards.pane", "Validate awards snapshot failed", null)(error); } }, [snapshotSetting]);
|
|
120
121
|
const filter = useMemo<AwardFilter>(() => ({ ticker: ticker.trim().toUpperCase() || undefined, query: query.trim() || undefined,
|
|
121
122
|
jurisdiction: jurisdiction || undefined, currency: currency || undefined, source: source || undefined, awardType, agency: agency || undefined, sector: sector || undefined, parentId: parentId || undefined,
|
|
122
123
|
from: parentId ? undefined : range === "all" ? from || undefined : new Date(Date.now() - Number(range) * 86_400_000).toISOString().slice(0, 10), to: parentId ? undefined : to || undefined, limit: 100,
|
|
@@ -45,7 +45,8 @@ export const bondCalculatorHeadless: HeadlessPaneDefinition<"bundle"> = {
|
|
|
45
45
|
{ label: "Macaulay duration", value: a.macaulayDuration, formatted: `${a.macaulayDuration.toFixed(4)} years` },
|
|
46
46
|
{ label: "Modified duration", value: a.modifiedDuration, formatted: `${a.modifiedDuration.toFixed(4)} years` },
|
|
47
47
|
{ label: "Convexity", value: a.convexity, formatted: a.convexity.toFixed(4) },
|
|
48
|
-
|
|
48
|
+
// The price change for a 1bp fall in yield, per 100 face as the prices are: 0.045493 is $45.49 on $100,000.
|
|
49
|
+
{ label: "DV01", value: a.dv01, formatted: `${a.dv01.toFixed(6)} per 100 face` },
|
|
49
50
|
{ label: "Treasury spread", value: result.spread?.spreadBps ?? null, formatted: result.spread ? `${result.spread.spreadBps.toFixed(1)} bp as of ${result.spread.asOf}` : "Unavailable" },
|
|
50
51
|
] },
|
|
51
52
|
{ title: "Cash flows per 100 face", columns: [{ key: "date", header: "Payment" }, { key: "amount", header: "Cash", format: (n) => Number(n).toFixed(4) }, { key: "presentValue", header: "Present value", format: (n) => Number(n).toFixed(4) }], rows: a.cashFlows.map((flow) => ({ ...flow })) },
|
|
@@ -5,6 +5,6 @@ import { fixedIncomeShortcut } from "../fixed-income/shortcut";
|
|
|
5
5
|
export const bondCalculatorModule: PluginModule = {
|
|
6
6
|
paneTemplates: [fixedIncomeShortcut({ id: "bond-calculator-pane", paneId: "bond-calculator", label: "Bond Calculator",
|
|
7
7
|
description: "Price, yield, accrued interest, duration, convexity and Treasury spread for a fixed coupon bond.",
|
|
8
|
-
keywords: ["yas", "bond", "calculator", "yield", "price", "duration", "dv01"], shortcut: { prefix: "YAS" },
|
|
8
|
+
keywords: ["yas", "bond", "calculator", "yield", "price", "duration", "dv01", "hedge ratio", "steepener", "flattener"], shortcut: { prefix: "YAS" },
|
|
9
9
|
headless: bondCalculatorHeadless, createInstance: () => ({}) }, "bonds", "calculator")],
|
|
10
10
|
};
|
|
@@ -157,7 +157,7 @@ export function treasurySpread(terms: BondTerms, yieldPercent: number, curve: re
|
|
|
157
157
|
const before = points.findLast((point) => point.maturityYears <= maturityYears);
|
|
158
158
|
const after = points.find((point) => point.maturityYears >= maturityYears);
|
|
159
159
|
if (!before || !after || !before.asOf || before.asOf !== after.asOf) return null;
|
|
160
|
-
try { parseDate(before.asOf); } catch { return null; }
|
|
160
|
+
try { parseDate(before.asOf); } catch { /* Intentional ignore: a benchmark curve with an unreadable date gives no spread. */ return null; }
|
|
161
161
|
const weight = before === after ? 0 : (maturityYears - before.maturityYears) / (after.maturityYears - before.maturityYears);
|
|
162
162
|
const benchmarkPercent = before.yieldPercent! + weight * (after.yieldPercent! - before.yieldPercent!);
|
|
163
163
|
return { benchmarkPercent, spreadBps: (yieldPercent - benchmarkPercent) * 100, asOf: before.asOf, maturityYears };
|
|
@@ -20,18 +20,27 @@ export function defaultBondDraft(now = new Date()): BondDraft {
|
|
|
20
20
|
frequency: "2", dayCount: "act-act-icma", endOfMonth: false };
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
/**
|
|
24
|
+
* A coupon or yield typed with a decimal comma (`3,875`, `-0,25`) reads as the
|
|
25
|
+
* decimal it is: a percent rate is never in the thousands, so `3,875` is
|
|
26
|
+
* 3.875%, not 3875. A clean price keeps the dot it is told to use.
|
|
27
|
+
*/
|
|
28
|
+
const DECIMAL_COMMA_RATE = /^([+-]?\d+),(\d+)$/;
|
|
29
|
+
|
|
30
|
+
function inputNumber(value: string, label: string, decimalComma = false): number {
|
|
31
|
+
const comma = decimalComma ? DECIMAL_COMMA_RATE.exec(value.trim()) : null;
|
|
32
|
+
const text = comma ? `${comma[1]}.${comma[2]}` : value.trim();
|
|
33
|
+
if (!text || !/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)$/.test(text)) throw new Error(numberErrorMessage(`${label} must be a number`, value));
|
|
34
|
+
const number = Number(text);
|
|
26
35
|
if (!Number.isFinite(number)) throw new Error(`${label} must be finite`);
|
|
27
36
|
return number;
|
|
28
37
|
}
|
|
29
38
|
|
|
30
39
|
export function calculateBond(draft: BondDraft, curve: readonly TreasuryBenchmarkPoint[] = []) {
|
|
31
40
|
if (!["yield", "price"].includes(draft.mode)) throw new Error("Select price or yield input");
|
|
32
|
-
const terms: BondTerms = { settlement: draft.settlement, maturity: draft.maturity, couponPercent: inputNumber(draft.coupon, "Coupon"),
|
|
41
|
+
const terms: BondTerms = { settlement: draft.settlement, maturity: draft.maturity, couponPercent: inputNumber(draft.coupon, "Coupon", true),
|
|
33
42
|
frequency: Number(draft.frequency) as BondTerms["frequency"], dayCount: draft.dayCount as BondTerms["dayCount"], endOfMonth: draft.endOfMonth };
|
|
34
|
-
const quote =
|
|
43
|
+
const quote = draft.mode === "yield" ? inputNumber(draft.quote, "Yield", true) : inputNumber(draft.quote, "Clean price");
|
|
35
44
|
const yieldPercent = draft.mode === "yield" ? quote : solveBondYield(terms, quote);
|
|
36
45
|
const analytics = priceBond(terms, yieldPercent);
|
|
37
46
|
const spread = treasurySpread(terms, yieldPercent, curve);
|
|
@@ -122,7 +122,7 @@ export function BondCalculatorPane({ focused, width, height }: PaneProps) {
|
|
|
122
122
|
[{ label: "Clean price", value: fixed(result.analytics.cleanPrice) }, { label: "Yield", value: `${fixed(result.analytics.yieldPercent)}%` }],
|
|
123
123
|
[{ label: "Dirty price", value: fixed(result.analytics.dirtyPrice) }, { label: "Accrued", value: fixed(result.analytics.accruedInterest) }],
|
|
124
124
|
[{ label: "Macaulay", value: `${fixed(result.analytics.macaulayDuration)} yr` }, { label: "Modified", value: `${fixed(result.analytics.modifiedDuration)} yr` }],
|
|
125
|
-
[{ label: "Convexity", value: `${fixed(result.analytics.convexity)} yr²` }, { label: "DV01
|
|
125
|
+
[{ label: "Convexity", value: `${fixed(result.analytics.convexity)} yr²` }, { label: "DV01", value: `${fixed(result.analytics.dv01, 6)} per 100 face` }],
|
|
126
126
|
] : [];
|
|
127
127
|
return <Box flexDirection="column" width={width} height={height}>
|
|
128
128
|
{tabStrip}
|
|
@@ -2,6 +2,7 @@ import { useMemo, useRef } from "react";
|
|
|
2
2
|
import { usePaneFooter, type PaneFooterSegment, type PaneHint } from "../../../components";
|
|
3
3
|
import { enableBrokerHint } from "../shared/broker-reconnect";
|
|
4
4
|
import type { BrokerManagerMessage } from "./pane-actions";
|
|
5
|
+
import { logFailure } from "../../../utils/log-failure";
|
|
5
6
|
|
|
6
7
|
interface BrokerManagerFooterActions {
|
|
7
8
|
connectSelected: () => Promise<void>;
|
|
@@ -58,8 +59,8 @@ export function useBrokerManagerFooter({
|
|
|
58
59
|
hints.push({ id: "edit", key: "e", label: "dit", onPress: () => actionsRef.current.startEdit() });
|
|
59
60
|
if (disabledSelected === null) {
|
|
60
61
|
hints.push(
|
|
61
|
-
{ id: "connect", key: "c", label: "onnect", onPress: () => actionsRef.current.connectSelected().catch((
|
|
62
|
-
{ id: "sync", key: "s", label: "ync", onPress: () => actionsRef.current.syncSelected().catch((
|
|
62
|
+
{ id: "connect", key: "c", label: "onnect", onPress: () => actionsRef.current.connectSelected().catch(logFailure("broker-manager.footer", "Connect selected broker profile failed")) },
|
|
63
|
+
{ id: "sync", key: "s", label: "ync", onPress: () => actionsRef.current.syncSelected().catch(logFailure("broker-manager.footer", "Sync selected broker profile failed")) },
|
|
63
64
|
);
|
|
64
65
|
}
|
|
65
66
|
}
|
|
@@ -43,6 +43,7 @@ import {
|
|
|
43
43
|
renderBrokerCell,
|
|
44
44
|
type BrokerColumn,
|
|
45
45
|
} from "./table";
|
|
46
|
+
import { logFailure } from "../../../utils/log-failure";
|
|
46
47
|
|
|
47
48
|
export function BrokersPane({ focused, width, height }: PaneProps) {
|
|
48
49
|
const language = useAppLanguage();
|
|
@@ -275,7 +276,7 @@ export function BrokersPane({ focused, width, height }: PaneProps) {
|
|
|
275
276
|
}, []);
|
|
276
277
|
|
|
277
278
|
const saveCurrentEdit = useCallback(() => {
|
|
278
|
-
saveEdit().catch((
|
|
279
|
+
saveEdit().catch(logFailure("broker-manager", "Save broker profile edit failed"));
|
|
279
280
|
}, [saveEdit]);
|
|
280
281
|
|
|
281
282
|
// The detail insets one cell each side like the table cells.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useShortcut, type KeyEventLike } from "../../../react/input";
|
|
2
2
|
import { isPlainKey } from "../../../utils/keyboard";
|
|
3
3
|
import type { BrokerEditKey } from "./detail";
|
|
4
|
+
import { logFailure } from "../../../utils/log-failure";
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* The edit form's keys beside its field ring (the detail's useFieldRing walks
|
|
@@ -48,7 +49,7 @@ export function useBrokerManagerKeyboard({
|
|
|
48
49
|
}
|
|
49
50
|
if (isPlainKey(event, "enter", "return")) {
|
|
50
51
|
consume(event);
|
|
51
|
-
saveEdit().catch((
|
|
52
|
+
saveEdit().catch(logFailure("broker-manager.keyboard", "Save broker form failed"));
|
|
52
53
|
return;
|
|
53
54
|
}
|
|
54
55
|
if (onSelectRow && isPlainKey(event, "left", "h", "right", "l", "space")) {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { TextAttributes } from "../../../ui";
|
|
2
|
-
import {
|
|
2
|
+
import type { DataTableCell } from "../../../components";
|
|
3
3
|
import { colors } from "../../../theme/colors";
|
|
4
4
|
import { formatRelativeTime } from "../../../utils/datetime-format";
|
|
5
5
|
import {
|
|
6
|
-
CompanyCell,
|
|
7
6
|
FavoriteCell,
|
|
7
|
+
ListingBadges,
|
|
8
8
|
} from "./detail";
|
|
9
|
+
import type { DatasetTicker } from "./detail/ui";
|
|
9
10
|
import type { BuildoutColumn, BuildoutRow } from "./model/types";
|
|
10
11
|
import {
|
|
11
12
|
activityColor,
|
|
@@ -26,6 +27,19 @@ function moneyCell(value: string | null | undefined, color: string): DataTableCe
|
|
|
26
27
|
return { text: moneyText(value), ...(amount == null ? {} : { value: amount }), color };
|
|
27
28
|
}
|
|
28
29
|
|
|
30
|
+
/**
|
|
31
|
+
* The dataset's tickers in one cell: a chip for each the app can open, bold
|
|
32
|
+
* plain text for one it cannot read, and the same for every row of the column.
|
|
33
|
+
*/
|
|
34
|
+
function tickerCell(tickers: readonly DatasetTicker[], width: number, selected: boolean): DataTableCell | null {
|
|
35
|
+
const symbols = tickers.flatMap((entry) => tickerSymbol(entry.ticker) ?? []);
|
|
36
|
+
if (symbols.length === 0) return null;
|
|
37
|
+
return {
|
|
38
|
+
text: symbols.join(" "),
|
|
39
|
+
content: <ListingBadges tickers={tickers} width={width} fallbackColor={selected ? colors.selectedText : colors.textBright} />,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
29
43
|
interface BuildoutCellContext {
|
|
30
44
|
favoriteBusyKey: string | null;
|
|
31
45
|
/** The row's last star did not take. */
|
|
@@ -78,17 +92,10 @@ export function renderBuildoutCell(
|
|
|
78
92
|
),
|
|
79
93
|
};
|
|
80
94
|
}
|
|
95
|
+
case "ticker":
|
|
96
|
+
return tickerCell([company], column.width, rowState.selected) ?? { text: "", value: null };
|
|
81
97
|
case "company":
|
|
82
|
-
return {
|
|
83
|
-
text: company.ticker ? `${company.ticker} ${company.name}` : company.name,
|
|
84
|
-
content: (
|
|
85
|
-
<CompanyCell
|
|
86
|
-
company={company}
|
|
87
|
-
width={column.width}
|
|
88
|
-
selected={rowState.selected}
|
|
89
|
-
/>
|
|
90
|
-
),
|
|
91
|
-
};
|
|
98
|
+
return { text: company.name, color: colors.text };
|
|
92
99
|
case "description":
|
|
93
100
|
return { text: text(company.description), color: colors.textDim };
|
|
94
101
|
case "sectorTech":
|
|
@@ -147,22 +154,9 @@ export function renderBuildoutCell(
|
|
|
147
154
|
return { text: site.name, color: colors.text };
|
|
148
155
|
case "type":
|
|
149
156
|
return { text: text(site.type), color: colors.textDim };
|
|
150
|
-
case "owner":
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
return {
|
|
154
|
-
text: ownerTicker,
|
|
155
|
-
content: (
|
|
156
|
-
<TickerBadgeList
|
|
157
|
-
symbols={[ownerTicker]}
|
|
158
|
-
width={column.width}
|
|
159
|
-
fallbackColor={rowState.selected ? colors.selectedText : colors.textBright}
|
|
160
|
-
/>
|
|
161
|
-
),
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
return { text: text(site.ownerName), color: colors.textDim };
|
|
165
|
-
}
|
|
157
|
+
case "owner":
|
|
158
|
+
return tickerCell([{ ticker: site.ownerTicker }], column.width, rowState.selected)
|
|
159
|
+
?? { text: text(site.ownerName), color: colors.textDim };
|
|
166
160
|
case "location":
|
|
167
161
|
return { text: text(location), color: colors.textDim };
|
|
168
162
|
case "park":
|
|
@@ -185,23 +179,9 @@ export function renderBuildoutCell(
|
|
|
185
179
|
switch (column.id) {
|
|
186
180
|
case "time":
|
|
187
181
|
return { text: formatRelativeTime(update.publishedAt), color: colors.textDim };
|
|
188
|
-
case "companies":
|
|
189
|
-
|
|
190
|
-
.map((company) =>
|
|
191
|
-
.filter((symbol): symbol is string => symbol != null);
|
|
192
|
-
return symbols.length > 0
|
|
193
|
-
? {
|
|
194
|
-
text: symbols.join(" "),
|
|
195
|
-
content: (
|
|
196
|
-
<TickerBadgeList
|
|
197
|
-
symbols={symbols}
|
|
198
|
-
width={column.width}
|
|
199
|
-
fallbackColor={rowState.selected ? colors.selectedText : colors.textBright}
|
|
200
|
-
/>
|
|
201
|
-
),
|
|
202
|
-
}
|
|
203
|
-
: { text: text(update.companies?.map((company) => company.name).filter(Boolean).join(", ")), color: colors.textDim };
|
|
204
|
-
}
|
|
182
|
+
case "companies":
|
|
183
|
+
return tickerCell(update.companies ?? [], column.width, rowState.selected)
|
|
184
|
+
?? { text: text(update.companies?.map((company) => company.name).filter(Boolean).join(", ")), color: colors.textDim };
|
|
205
185
|
case "headline":
|
|
206
186
|
return { text: update.headline, color: colors.text };
|
|
207
187
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Section
|
|
1
|
+
import { Section } from "../../../../components";
|
|
2
2
|
import { ClippedText } from "../../../../components/ui/display";
|
|
3
3
|
import { formatMarketPriceWithCurrency, liveQuoteFormatOptions } from "../../../../market-data/market/format";
|
|
4
4
|
import { useInlineTickerQuote } from "../../../../state/hooks/inline-tickers";
|
|
@@ -11,7 +11,7 @@ import { formatCompact } from "../../../../utils/format";
|
|
|
11
11
|
import { truncateWithEllipsis } from "../../../../utils/text-wrap";
|
|
12
12
|
import { activityLabel, criticalityColor, dateShort, metricColor, metricNumber, textOrNull, tickerSymbol } from "../format";
|
|
13
13
|
import type { BuildoutCompany } from "../model/types";
|
|
14
|
-
import { DetailListLine, DetailSpecGrid, MarkdownBlock, RelatedCompaniesLine, type DetailSpec, type InlineTickerCatalog } from "./ui";
|
|
14
|
+
import { DetailListLine, DetailSpecGrid, ListingBadges, MarkdownBlock, RelatedCompaniesLine, type DetailSpec, type InlineTickerCatalog } from "./ui";
|
|
15
15
|
import { dateCell, detailListValues, recommendationColor, valueWithOriginal } from "./values";
|
|
16
16
|
import { regularSessionValuationPrice } from "../../../../market-data/quotes/regular-session-valuation";
|
|
17
17
|
|
|
@@ -116,7 +116,7 @@ export function CompanyDetail({
|
|
|
116
116
|
<>
|
|
117
117
|
{company.ticker ? (
|
|
118
118
|
<Box flexDirection="row" height={1}>
|
|
119
|
-
<
|
|
119
|
+
<ListingBadges tickers={[company]} width={Math.min(bodyWidth, 16)} />
|
|
120
120
|
</Box>
|
|
121
121
|
) : null}
|
|
122
122
|
<CompanyOverviewGrid
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Badge
|
|
1
|
+
import { Badge } from "../../../../components";
|
|
2
2
|
import { RemoteImage } from "../../../../components/ui";
|
|
3
3
|
import { colors } from "../../../../theme/colors";
|
|
4
4
|
import { Box, Text } from "../../../../ui";
|
|
5
|
-
import { dateDetail, intelSourceDomains
|
|
5
|
+
import { dateDetail, intelSourceDomains } from "../format";
|
|
6
6
|
import type { BuildoutRow } from "../model/types";
|
|
7
|
-
import { InlineSources, MarkdownBlock, type InlineTickerCatalog } from "./ui";
|
|
7
|
+
import { InlineSources, ListingBadges, MarkdownBlock, type InlineTickerCatalog } from "./ui";
|
|
8
8
|
|
|
9
9
|
type BuildoutIntel = Extract<BuildoutRow, { kind: "intel" }>["item"];
|
|
10
10
|
|
|
@@ -29,10 +29,7 @@ export function IntelDetail({
|
|
|
29
29
|
</Box>
|
|
30
30
|
{(item.companies?.length ?? 0) > 0 && (
|
|
31
31
|
<Box marginTop={1} height={1}>
|
|
32
|
-
<
|
|
33
|
-
symbols={item.companies!.map((company) => tickerSymbol(company.ticker) ?? "")}
|
|
34
|
-
width={Math.min(bodyWidth, 56)}
|
|
35
|
-
/>
|
|
32
|
+
<ListingBadges tickers={item.companies!} width={Math.min(bodyWidth, 56)} />
|
|
36
33
|
</Box>
|
|
37
34
|
)}
|
|
38
35
|
{item.imageUrl ? (
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Section
|
|
1
|
+
import { Section } from "../../../../components";
|
|
2
2
|
import { colors } from "../../../../theme/colors";
|
|
3
3
|
import { Box, Text } from "../../../../ui";
|
|
4
4
|
import { truncateWithEllipsis } from "../../../../utils/text-wrap";
|
|
5
5
|
import { activityColor, activityLabel, dateShort, sourceDomains } from "../format";
|
|
6
6
|
import type { BuildoutSite } from "../model/types";
|
|
7
7
|
import { SiteSatelliteImages } from "./satellite-images";
|
|
8
|
-
import { DetailSpecGrid, InlineSources, MarkdownBlock, SourceDetailLines, type InlineTickerCatalog } from "./ui";
|
|
8
|
+
import { DetailSpecGrid, InlineSources, ListingBadges, MarkdownBlock, SourceDetailLines, type InlineTickerCatalog } from "./ui";
|
|
9
9
|
import { booleanText, dateCell, metadataSpecs, reportSectionText } from "./values";
|
|
10
10
|
|
|
11
11
|
export function SiteDetail({
|
|
@@ -28,7 +28,7 @@ export function SiteDetail({
|
|
|
28
28
|
<>
|
|
29
29
|
{site.ownerTicker ? (
|
|
30
30
|
<Box flexDirection="row" height={1}>
|
|
31
|
-
<
|
|
31
|
+
<ListingBadges tickers={[{ ticker: site.ownerTicker }]} width={Math.min(bodyWidth, 16)} />
|
|
32
32
|
</Box>
|
|
33
33
|
) : null}
|
|
34
34
|
<DetailSpecGrid
|
|
@@ -99,7 +99,7 @@ export function SiteDetail({
|
|
|
99
99
|
<Box key={`${builder.companyName}-${index}`} flexDirection="column" marginTop={index === 0 ? 0 : 1}>
|
|
100
100
|
<Box flexDirection="row" height={1}>
|
|
101
101
|
{builder.companyTicker
|
|
102
|
-
? <
|
|
102
|
+
? <ListingBadges tickers={[{ ticker: builder.companyTicker }]} width={Math.min(12, bodyWidth)} />
|
|
103
103
|
: null}
|
|
104
104
|
<Text fg={colors.textMuted}>
|
|
105
105
|
{truncateWithEllipsis(`${builder.companyName ?? "Company"}${builder.role ? ` - ${builder.role}` : ""}`, Math.max(0, bodyWidth - (builder.companyTicker ? 12 : 0)))}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
1
2
|
import { TickerBadgeList } from "../../../../components";
|
|
2
3
|
import { MarkdownText } from "../../../../components/markdown-text";
|
|
3
4
|
import { Button } from "../../../../components/ui/button";
|
|
@@ -7,8 +8,8 @@ import type { InlineTickerCatalogEntry } from "../../../../state/hooks/inline-ti
|
|
|
7
8
|
import { colors } from "../../../../theme/colors";
|
|
8
9
|
import { Box, Text, TextAttributes } from "../../../../ui";
|
|
9
10
|
import { truncateWithEllipsis } from "../../../../utils/text-wrap";
|
|
10
|
-
import { sourceDetailEntries, text, textOrNull, tickerSymbol } from "../format";
|
|
11
|
-
import type {
|
|
11
|
+
import { listingKey, sourceDetailEntries, text, textOrNull, tickerSymbol } from "../format";
|
|
12
|
+
import type { BuildoutRelatedCompany, BuildoutSource } from "../model/types";
|
|
12
13
|
|
|
13
14
|
export type InlineTickerCatalog = Record<string, InlineTickerCatalogEntry>;
|
|
14
15
|
|
|
@@ -80,6 +81,38 @@ export function DetailListLine({
|
|
|
80
81
|
);
|
|
81
82
|
}
|
|
82
83
|
|
|
84
|
+
/** A ticker as the dataset writes it, with the venue it names when it names one. */
|
|
85
|
+
export interface DatasetTicker {
|
|
86
|
+
ticker?: string | null;
|
|
87
|
+
exchange?: string | null;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* The dataset's tickers, drawn one way: a chip for each the app can look up,
|
|
92
|
+
* price and open, a number-only Asian listing through the venue the dataset
|
|
93
|
+
* names, and bold plain text for one it cannot read. Never a chip that skips
|
|
94
|
+
* the lookup and so looks different from the resolved ones.
|
|
95
|
+
*/
|
|
96
|
+
export function ListingBadges({ tickers, width, fallbackColor = colors.textBright }: {
|
|
97
|
+
tickers: readonly DatasetTicker[];
|
|
98
|
+
width: number;
|
|
99
|
+
fallbackColor?: string;
|
|
100
|
+
}) {
|
|
101
|
+
const { symbols, listings } = useMemo(() => {
|
|
102
|
+
const shown: string[] = [];
|
|
103
|
+
const known: Record<string, string | null> = {};
|
|
104
|
+
for (const entry of tickers) {
|
|
105
|
+
const symbol = tickerSymbol(entry.ticker);
|
|
106
|
+
if (!symbol) continue;
|
|
107
|
+
shown.push(symbol);
|
|
108
|
+
const key = listingKey(entry.ticker, entry.exchange);
|
|
109
|
+
if (key !== symbol) known[symbol] = key;
|
|
110
|
+
}
|
|
111
|
+
return { symbols: shown, listings: known };
|
|
112
|
+
}, [tickers]);
|
|
113
|
+
return <TickerBadgeList symbols={symbols} width={width} fallbackColor={fallbackColor} listings={listings} />;
|
|
114
|
+
}
|
|
115
|
+
|
|
83
116
|
export function RelatedCompaniesLine({
|
|
84
117
|
label,
|
|
85
118
|
companies,
|
|
@@ -93,25 +126,19 @@ export function RelatedCompaniesLine({
|
|
|
93
126
|
if (items.length === 0) return null;
|
|
94
127
|
|
|
95
128
|
const visible = items.slice(0, 8);
|
|
96
|
-
const
|
|
97
|
-
.map((company) => tickerSymbol(company.ticker))
|
|
98
|
-
.filter((symbol): symbol is string => symbol != null);
|
|
129
|
+
const withTicker = visible.filter((company) => tickerSymbol(company.ticker) != null);
|
|
99
130
|
const names = visible
|
|
100
131
|
.filter((company) => !tickerSymbol(company.ticker))
|
|
101
132
|
.map((company) => textOrNull(company.name))
|
|
102
133
|
.filter((name): name is string => name != null);
|
|
103
134
|
const overflow = items.length > visible.length ? ` +${items.length - visible.length}` : "";
|
|
104
135
|
const prefix = `${label}: `;
|
|
105
|
-
const badgeWidth = Math.min(Math.max(0, width - prefix.length - (names.length > 0 ? 1 : 0)), Math.max(0,
|
|
136
|
+
const badgeWidth = Math.min(Math.max(0, width - prefix.length - (names.length > 0 ? 1 : 0)), Math.max(0, withTicker.length * 9));
|
|
106
137
|
return (
|
|
107
138
|
<Box flexDirection="row" width={width} height={1} overflow="hidden">
|
|
108
139
|
<Text fg={colors.textMuted}>{prefix}</Text>
|
|
109
|
-
{
|
|
110
|
-
<
|
|
111
|
-
symbols={symbols}
|
|
112
|
-
width={badgeWidth}
|
|
113
|
-
fallbackColor={colors.textBright}
|
|
114
|
-
/>
|
|
140
|
+
{withTicker.length > 0 ? (
|
|
141
|
+
<ListingBadges tickers={withTicker} width={badgeWidth} />
|
|
115
142
|
) : null}
|
|
116
143
|
<ClippedText fg={colors.textDim} text={`${names.length > 0 ? names.join(", ") : ""}${overflow}`} width={Math.max(0, width - prefix.length - badgeWidth)} cut={truncateWithEllipsis} />
|
|
117
144
|
</Box>
|
|
@@ -207,29 +234,3 @@ export function FavoriteCell({
|
|
|
207
234
|
>{failed && !busy ? <Text fg={colors.negative} attributes={TextAttributes.BOLD}>!</Text> : undefined}</Button>
|
|
208
235
|
);
|
|
209
236
|
}
|
|
210
|
-
|
|
211
|
-
export function CompanyCell({
|
|
212
|
-
company,
|
|
213
|
-
width,
|
|
214
|
-
selected,
|
|
215
|
-
}: {
|
|
216
|
-
company: BuildoutCompany;
|
|
217
|
-
width: number;
|
|
218
|
-
selected: boolean;
|
|
219
|
-
}) {
|
|
220
|
-
const symbol = tickerSymbol(company.ticker);
|
|
221
|
-
if (!symbol) {
|
|
222
|
-
return <ClippedText fg={selected ? colors.selectedText : colors.text} text={company.name} width={width} cut={truncateWithEllipsis} />;
|
|
223
|
-
}
|
|
224
|
-
const badgeWidth = Math.min(11, width);
|
|
225
|
-
return (
|
|
226
|
-
<Box flexDirection="row" width={width} height={1} overflow="hidden">
|
|
227
|
-
<TickerBadgeList
|
|
228
|
-
symbols={[symbol]}
|
|
229
|
-
width={badgeWidth}
|
|
230
|
-
fallbackColor={selected ? colors.selectedText : colors.textBright}
|
|
231
|
-
/>
|
|
232
|
-
<ClippedText fg={selected ? colors.selectedText : colors.text} text={company.name} width={Math.max(0, width - badgeWidth)} cut={truncateWithEllipsis} />
|
|
233
|
-
</Box>
|
|
234
|
-
);
|
|
235
|
-
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { colors, priceColor } from "../../../theme/colors";
|
|
2
|
+
import { collectUniqueTickerSymbols } from "../../../tickers/tokenizer";
|
|
3
|
+
import { isKnownExchangeCode } from "../../../utils/exchanges";
|
|
2
4
|
import { formatDetailDate as sharedFormatDetailDate, parseDisplayDate } from "../../../utils/datetime-format";
|
|
3
5
|
import type { BuildoutSource, BuildoutUpdate } from "./model/types";
|
|
4
6
|
|
|
@@ -141,9 +143,29 @@ export function tickerSymbol(value: string | null | undefined): string | null {
|
|
|
141
143
|
return symbol ? symbol.toUpperCase() : null;
|
|
142
144
|
}
|
|
143
145
|
|
|
146
|
+
/**
|
|
147
|
+
* The key the app looks a dataset ticker up and opens it by. A name-led
|
|
148
|
+
* symbol (NVDA, BRK.B) is its own. The dataset writes some Asian listings by
|
|
149
|
+
* number alone (2330, 005930), which a cashtag reads as money, so one takes
|
|
150
|
+
* the venue the dataset names (2330:TWSE, 005930:KRX). Null when the dataset
|
|
151
|
+
* names no venue the app knows: such a ticker is plain text, never a chip
|
|
152
|
+
* that looks different from the resolved ones around it.
|
|
153
|
+
*/
|
|
154
|
+
export function listingKey(ticker: string | null | undefined, exchange?: string | null): string | null {
|
|
155
|
+
const symbol = tickerSymbol(ticker);
|
|
156
|
+
if (!symbol) return null;
|
|
157
|
+
let key: string | null = symbol;
|
|
158
|
+
if (!/^[A-Z]/.test(symbol)) {
|
|
159
|
+
const venue = tickerSymbol(exchange);
|
|
160
|
+
// `688795.SS` names its venue twice: the dataset's venue is the one kept.
|
|
161
|
+
key = venue && isKnownExchangeCode(venue) ? `${symbol.replace(/\.[A-Z]{1,4}$/, "")}:${venue}` : null;
|
|
162
|
+
}
|
|
163
|
+
return key && collectUniqueTickerSymbols([`$${key}`]).includes(key) ? key : null;
|
|
164
|
+
}
|
|
165
|
+
|
|
144
166
|
export function tickerSearchText(symbols: readonly string[]) {
|
|
145
167
|
return symbols
|
|
146
|
-
.filter((symbol) =>
|
|
168
|
+
.filter((symbol) => collectUniqueTickerSymbols([`$${symbol}`]).includes(symbol))
|
|
147
169
|
.map((symbol) => `$${symbol}`)
|
|
148
170
|
.join(" ");
|
|
149
171
|
}
|
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
tabs,
|
|
56
56
|
type BuildoutOpenTarget,
|
|
57
57
|
} from "../table-model";
|
|
58
|
-
import { tickerSearchText, tickerSymbol } from "../format";
|
|
58
|
+
import { listingKey, tickerSearchText, tickerSymbol } from "../format";
|
|
59
59
|
import {
|
|
60
60
|
activeBuildoutPage,
|
|
61
61
|
renderBuildoutPageStatus,
|
|
@@ -70,12 +70,6 @@ const BUILDOUT_UPGRADE_URL = "https://thebuildout.ai/pricing";
|
|
|
70
70
|
/** How long the cursor rests on a company before linked panes follow it. */
|
|
71
71
|
const CURSOR_PUBLISH_MS = 150;
|
|
72
72
|
|
|
73
|
-
/** A symbol the rest of the app can open: the dataset writes some Asian listings by number alone. */
|
|
74
|
-
function linkableTicker(value: string | null | undefined): string | null {
|
|
75
|
-
const symbol = tickerSymbol(value);
|
|
76
|
-
return symbol && /^[A-Z][A-Z0-9.-]*$/.test(symbol) ? symbol : null;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
73
|
function sameScope(left: GeoScope | null, right: GeoScope | null): boolean {
|
|
80
74
|
return left?.key === right?.key && left?.label === right?.label;
|
|
81
75
|
}
|
|
@@ -193,7 +187,7 @@ export function BuildoutPane({ focused, width, height }: PaneProps) {
|
|
|
193
187
|
// Panes linked to this one follow the company under the cursor, and a linked map can widen to the
|
|
194
188
|
// theme it belongs to. Off the company tabs both stay where they were.
|
|
195
189
|
const cursorCompany = detailRow?.kind === "company" ? detailRow.item : selectedRow?.kind === "company" ? selectedRow.item : null;
|
|
196
|
-
const cursorTicker =
|
|
190
|
+
const cursorTicker = cursorCompany ? listingKey(cursorCompany.ticker, cursorCompany.exchange) : null;
|
|
197
191
|
// Published once the cursor rests: arrowing down a theme would otherwise load every company it passes.
|
|
198
192
|
useEffect(() => {
|
|
199
193
|
if (!cursorTicker) return;
|