gloomberb 0.20.4 → 0.20.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/README.md +3 -1
- package/README.zh-CN.md +1 -1
- package/bin/gloom +9 -0
- package/bin/without-bun.cjs +98 -0
- package/package.json +4 -1
- package/src/api-client/data.ts +148 -37
- package/src/api-client/hk-tenders.ts +59 -0
- package/src/api-client/index.ts +1 -0
- package/src/api-client/types/econ.ts +30 -0
- package/src/api-client/yield-curves.ts +1 -1
- package/src/app/global-shortcuts.ts +4 -1
- package/src/app/keybindings/actions.ts +6 -0
- package/src/app/keybindings/config.ts +2 -1
- package/src/app/keybindings/index.ts +1 -0
- package/src/app/keybindings/labels.ts +6 -1
- package/src/app/keybindings/resolve.ts +23 -4
- package/src/app/keybindings/terminal-keys.ts +35 -0
- package/src/app/pane-runtime/index.tsx +2 -2
- package/src/app/pane-runtime/ticker-open-runtime.ts +68 -40
- package/src/app.tsx +18 -13
- package/src/architecture/floating-promise-allowlist.json +313 -0
- package/src/architecture/ui-literals-allowlist.json +1 -1
- package/src/capabilities/chart-series.ts +27 -1
- package/src/cli/commands/keybindings.ts +5 -5
- package/src/cli/commands/market.ts +238 -57
- package/src/cli/commands/news-search.ts +81 -14
- package/src/cli/commands/overview.ts +27 -6
- package/src/cli/commands/remote.ts +16 -17
- package/src/cli/commands/system.ts +1 -1
- package/src/cli/commands/ticker.ts +3 -1
- package/src/cli/early-command.ts +2 -0
- package/src/cli/errors.ts +10 -1
- package/src/cli/fx-forward.ts +89 -7
- package/src/cli/fx-pair.ts +1 -1
- package/src/cli/fx-quote-rate.ts +23 -0
- package/src/cli/glossary.ts +19 -5
- package/src/cli/help.ts +1 -0
- package/src/cli/history-rows.ts +5 -3
- package/src/cli/index-roots.ts +5 -4
- package/src/cli/index.ts +40 -3
- package/src/cli/known-gaps.ts +38 -9
- package/src/cli/listing-arg.ts +17 -5
- package/src/cli/name-entries.ts +5 -1
- package/src/cli/not-a-ticker.ts +4 -0
- package/src/cli/options.ts +52 -3
- package/src/cli/output-file.ts +5 -3
- package/src/cli/pane-functions/catalog.ts +15 -0
- package/src/cli/pane-functions/function-help.ts +4 -4
- package/src/cli/pane-functions/headless.ts +9 -4
- package/src/cli/pane-functions/index.ts +6 -4
- package/src/cli/pane-functions/resolver.ts +2 -2
- package/src/cli/result.ts +21 -2
- package/src/cli/spreadsheet-hint.ts +7 -3
- package/src/cli/treasury-yields.ts +5 -3
- package/src/components/chart/composite/legend.tsx +40 -2
- package/src/components/command-bar/pane-settings.ts +2 -2
- package/src/components/command-bar/routes/root/results.ts +6 -2
- package/src/components/command-bar/workflow/tickers.ts +2 -2
- package/src/components/data-table/view.tsx +9 -2
- package/src/components/input-search-bar.tsx +9 -2
- package/src/components/layout/pane/header.tsx +2 -0
- package/src/components/layout/shell/pane/capture.ts +4 -1
- package/src/components/layout/status-bar.tsx +6 -1
- package/src/components/onboarding/first-run-workspace.ts +44 -2
- package/src/components/onboarding/onboarding-frame.tsx +11 -2
- package/src/components/onboarding/onboarding-keyboard.ts +16 -0
- package/src/components/onboarding/onboarding-wizard.tsx +8 -8
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +62 -1
- package/src/components/onboarding/use-onboarding-progress.ts +12 -4
- package/src/components/pane-settings-dialog/desktop.tsx +2 -2
- package/src/components/pane-settings-dialog/tui.tsx +2 -2
- package/src/components/pane-settings-dialog/value.ts +6 -0
- package/src/components/pane-settings-dialog.tsx +3 -3
- package/src/components/reader/detail-reader.tsx +4 -0
- package/src/components/ui/data-table/opentui/index.tsx +11 -4
- package/src/components/ui/data-table/opentui/model.ts +8 -6
- package/src/components/ui/data-table/types.ts +6 -1
- package/src/components/ui/index.ts +1 -1
- package/src/components/ui/page-stack-view.tsx +3 -0
- package/src/components/ui/pane-link-chip.tsx +269 -54
- package/src/components/ui/query-bar.tsx +2 -1
- package/src/components/ui/table-layout.ts +38 -1
- package/src/components/ui/tabs.tsx +97 -19
- package/src/core/state/app/layout-reducer.ts +7 -0
- package/src/core/state/app/layout.ts +44 -7
- package/src/core/state/app/state.ts +1 -1
- package/src/core/state/app/types.ts +22 -2
- package/src/docs/snapshot.json +30 -13
- package/src/market-data/depositary-pair.ts +5 -3
- package/src/market-data/market/change-basis.ts +9 -5
- package/src/market-data/market/dated-previous-close.ts +147 -17
- package/src/market-data/market/status.ts +17 -1
- package/src/market-data/quotes/contributions.ts +2 -0
- package/src/market-data/quotes/listing-enterprise-value.ts +50 -0
- package/src/plugins/builtin/alerts/metric-data.ts +15 -2
- package/src/plugins/builtin/analytics/risk-client.ts +10 -4
- package/src/plugins/builtin/analytics/risk-episodes.ts +5 -4
- package/src/plugins/builtin/analytics/risk-headless.ts +4 -2
- package/src/plugins/builtin/analytics/risk-sectors.ts +91 -0
- package/src/plugins/builtin/awards/index.tsx +1 -1
- package/src/plugins/builtin/backtest/headless.ts +1 -1
- package/src/plugins/builtin/buildout/index.tsx +1 -0
- package/src/plugins/builtin/catalysts/index.tsx +2 -2
- package/src/plugins/builtin/cds/headless.ts +4 -0
- package/src/plugins/builtin/cds/model.ts +0 -6
- package/src/plugins/builtin/chart-composer/formula.ts +16 -3
- package/src/plugins/builtin/chart-composer/headless-schema.ts +2 -0
- package/src/plugins/builtin/chart-composer/headless.ts +4 -2
- package/src/plugins/builtin/chart-composer/index.tsx +1 -0
- package/src/plugins/builtin/chart-composer/presets.ts +1 -0
- package/src/plugins/builtin/chat/content/composer.tsx +5 -4
- package/src/plugins/builtin/chat/content/index.tsx +12 -2
- package/src/plugins/builtin/chat/content/layout-metrics.ts +3 -3
- package/src/plugins/builtin/chat/content/open-targets.ts +3 -3
- package/src/plugins/builtin/chat/layout.ts +5 -2
- package/src/plugins/builtin/chat/message/pane-chip.tsx +61 -40
- package/src/plugins/builtin/chat/message/terminal.tsx +13 -15
- package/src/plugins/builtin/chat/pane-links/previews.ts +51 -5
- package/src/plugins/builtin/chat/pane-links/share-card.ts +36 -0
- package/src/plugins/builtin/cloud/askg/pane.tsx +55 -13
- package/src/plugins/builtin/cloud/askg/tool-display.ts +1 -0
- package/src/plugins/builtin/cloud/terminal-relay/redact.ts +5 -3
- package/src/plugins/builtin/commodity-balances/index.tsx +1 -0
- package/src/plugins/builtin/company-attention/index.tsx +1 -1
- package/src/plugins/builtin/company-kpis/headless.ts +3 -1
- package/src/plugins/builtin/company-kpis/index.tsx +2 -2
- package/src/plugins/builtin/cot/index.tsx +1 -1
- package/src/plugins/builtin/cpi/index.tsx +1 -1
- package/src/plugins/builtin/credit-boards/cdx-pane.tsx +20 -7
- package/src/plugins/builtin/credit-boards/client.ts +8 -0
- package/src/plugins/builtin/credit-boards/headless.ts +4 -1
- package/src/plugins/builtin/credit-boards/model.ts +58 -4
- package/src/plugins/builtin/credit-boards/series.ts +63 -6
- package/src/plugins/builtin/credit-boards/sovr-pane.tsx +3 -2
- package/src/plugins/builtin/credit-conditions/headless.ts +24 -6
- package/src/plugins/builtin/credit-conditions/index.tsx +1 -1
- package/src/plugins/builtin/credit-conditions/model.ts +12 -6
- package/src/plugins/builtin/credit-conditions/series.ts +2 -1
- package/src/plugins/builtin/crypto-board/index.tsx +1 -0
- package/src/plugins/builtin/dividend-yield/index.tsx +1 -0
- package/src/plugins/builtin/doe/index.tsx +1 -1
- package/src/plugins/builtin/earnings-calls/headless.ts +5 -1
- package/src/plugins/builtin/earnings-calls/index.tsx +1 -0
- package/src/plugins/builtin/econ/calendar-model.ts +115 -8
- package/src/plugins/builtin/econ/calendar-source.ts +7 -1
- package/src/plugins/builtin/econ/fred-catalog.ts +3 -1
- package/src/plugins/builtin/econ/index.tsx +42 -8
- package/src/plugins/builtin/econ/types.ts +3 -0
- package/src/plugins/builtin/econ-statistics/index.tsx +1 -0
- package/src/plugins/builtin/econ-statistics/pane.tsx +6 -0
- package/src/plugins/builtin/estimate-revisions/index.tsx +1 -0
- package/src/plugins/builtin/executives/index.tsx +1 -0
- package/src/plugins/builtin/filing-events/index.tsx +1 -0
- package/src/plugins/builtin/fixed-income/index.tsx +3 -0
- package/src/plugins/builtin/futures-curve/headless.ts +3 -3
- package/src/plugins/builtin/futures-curve/index.tsx +1 -1
- package/src/plugins/builtin/futures-curve/model.ts +18 -0
- package/src/plugins/builtin/fx-matrix/index.tsx +44 -14
- package/src/plugins/builtin/gpu/index.tsx +1 -1
- package/src/plugins/builtin/help/functions-table.tsx +1 -1
- package/src/plugins/builtin/help/index.tsx +11 -1
- package/src/plugins/builtin/help/keybindings-editor.tsx +7 -3
- package/src/plugins/builtin/holders/index.tsx +1 -0
- package/src/plugins/builtin/holders/report-header.ts +2 -2
- package/src/plugins/builtin/insider/index.tsx +1 -0
- package/src/plugins/builtin/iv-history/index.tsx +1 -1
- package/src/plugins/builtin/jobs/index.tsx +1 -0
- package/src/plugins/builtin/macro-day/headless.ts +27 -8
- package/src/plugins/builtin/macro-day/index.tsx +1 -1
- package/src/plugins/builtin/macro-day/model.ts +19 -3
- package/src/plugins/builtin/macro-day/pane.tsx +14 -9
- package/src/plugins/builtin/macro-day/releases.ts +25 -7
- package/src/plugins/builtin/market-valuation/index.tsx +1 -0
- package/src/plugins/builtin/market-valuation/pane.tsx +8 -0
- package/src/plugins/builtin/members/index.tsx +1 -1
- package/src/plugins/builtin/mna/index.tsx +1 -0
- package/src/plugins/builtin/news/index.tsx +1 -0
- package/src/plugins/builtin/news/wire/index.tsx +5 -1
- package/src/plugins/builtin/news/wire/news/detail-view.tsx +4 -0
- package/src/plugins/builtin/news/wire/news/list-search.ts +5 -2
- package/src/plugins/builtin/options/index.tsx +1 -0
- package/src/plugins/builtin/options-positioning/index.tsx +1 -0
- package/src/plugins/builtin/pe-band/index.tsx +1 -1
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +25 -0
- package/src/plugins/builtin/portfolio-list/cli/render.ts +20 -3
- package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +5 -1
- package/src/plugins/builtin/portfolio-list/headless.ts +15 -6
- package/src/plugins/builtin/power/index.tsx +1 -1
- package/src/plugins/builtin/realized-vol/index.tsx +1 -1
- package/src/plugins/builtin/research/headless-schema.ts +4 -3
- package/src/plugins/builtin/research/headless.ts +10 -4
- package/src/plugins/builtin/research/index.tsx +4 -0
- package/src/plugins/builtin/research/relative-valuation-columns.ts +145 -47
- package/src/plugins/builtin/research/relative-valuation-currency.ts +31 -0
- package/src/plugins/builtin/research/relative-valuation-headless.ts +25 -8
- package/src/plugins/builtin/research/relative-valuation-model.ts +40 -9
- package/src/plugins/builtin/research/relative-valuation-pane.tsx +3 -2
- package/src/plugins/builtin/research/relative-valuation-peers.ts +2 -2
- package/src/plugins/builtin/research-search/index.tsx +1 -0
- package/src/plugins/builtin/research-search/pane.tsx +8 -0
- package/src/plugins/builtin/revenue-breakdown/index.tsx +1 -0
- package/src/plugins/builtin/reverse-dcf/index.tsx +1 -1
- package/src/plugins/builtin/risk-factors/index.tsx +1 -0
- package/src/plugins/builtin/scanner/headless.ts +52 -13
- package/src/plugins/builtin/seasonality/index.tsx +1 -1
- package/src/plugins/builtin/sec/index.tsx +1 -0
- package/src/plugins/builtin/series-inventory.ts +1 -1
- package/src/plugins/builtin/shared/scanner-capture.ts +11 -3
- package/src/plugins/builtin/shared/series-list-detail.tsx +5 -0
- package/src/plugins/builtin/short-interest/index.tsx +1 -0
- package/src/plugins/builtin/social-mentions/index.tsx +1 -1
- package/src/plugins/builtin/supply-chain/index.tsx +1 -0
- package/src/plugins/builtin/thirteenf/api.ts +47 -4
- package/src/plugins/builtin/thirteenf/data.ts +43 -10
- package/src/plugins/builtin/thirteenf/headless.ts +55 -11
- package/src/plugins/builtin/thirteenf/model.ts +25 -9
- package/src/plugins/builtin/thirteenf/report-notes.ts +27 -6
- package/src/plugins/builtin/thirteenf/types.ts +2 -0
- package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +1 -1
- package/src/plugins/builtin/ticker-detail/data-panes/historical-prices.tsx +8 -7
- package/src/plugins/builtin/ticker-detail/data-panes/history-bars.ts +8 -5
- package/src/plugins/builtin/ticker-detail/financials/model.ts +18 -2
- package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +3 -3
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +6 -6
- package/src/plugins/builtin/ticker-detail/headless.ts +24 -17
- package/src/plugins/builtin/ticker-detail/index.tsx +4 -0
- package/src/plugins/builtin/ticker-detail/overview/model.ts +6 -4
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +6 -4
- package/src/plugins/builtin/time-sales/client.ts +9 -11
- package/src/plugins/builtin/time-sales/index.tsx +1 -1
- package/src/plugins/builtin/treasury-auctions/after.ts +267 -0
- package/src/plugins/builtin/treasury-auctions/cache.ts +54 -5
- package/src/plugins/builtin/treasury-auctions/client.ts +33 -2
- package/src/plugins/builtin/treasury-auctions/headless.ts +150 -22
- package/src/plugins/builtin/treasury-auctions/hk-headless.ts +126 -0
- package/src/plugins/builtin/treasury-auctions/hk-view.tsx +347 -0
- package/src/plugins/builtin/treasury-auctions/hk.ts +363 -0
- package/src/plugins/builtin/treasury-auctions/index.tsx +27 -4
- package/src/plugins/builtin/treasury-auctions/model.ts +264 -28
- package/src/plugins/builtin/treasury-auctions/pane.tsx +176 -41
- package/src/plugins/builtin/treasury-auctions/treasury-direct.ts +5 -2
- package/src/plugins/builtin/treasury-auctions/types.ts +7 -1
- package/src/plugins/builtin/vol-surface/index.tsx +1 -1
- package/src/plugins/builtin/world-venue-map/index.ts +1 -0
- package/src/plugins/builtin/yield-curve/curves.ts +10 -4
- package/src/plugins/builtin/yield-curve/headless.ts +6 -2
- package/src/plugins/builtin/yield-curve/index.tsx +3 -3
- package/src/plugins/builtin/yield-curve/series.ts +10 -0
- package/src/plugins/builtin/yield-curve/world.ts +3 -1
- package/src/portfolio/collection-name.ts +22 -0
- package/src/portfolio/column-values.ts +2 -1
- package/src/public/__snapshots__/public-api.test.ts.snap +4 -0
- package/src/public/remote.ts +7 -1
- package/src/remote/client.ts +191 -11
- package/src/remote/controller-utils.ts +13 -1
- package/src/remote/controller.ts +88 -26
- package/src/remote/endpoint.ts +24 -0
- package/src/remote/form.ts +59 -4
- package/src/remote/resources.ts +44 -18
- package/src/remote/schema.ts +21 -9
- package/src/remote/secrets.ts +12 -0
- package/src/remote/semantic-tree.tsx +14 -2
- package/src/remote/server.ts +2 -1
- package/src/remote/surface.tsx +192 -0
- package/src/remote/types.ts +5 -0
- package/src/renderers/dom/data-table/frozen-column.ts +3 -1
- package/src/renderers/dom/data-table/index.tsx +27 -9
- package/src/renderers/dom/data-table/row.tsx +2 -0
- package/src/renderers/electrobun/bun/desktop/backend.ts +27 -24
- package/src/renderers/electrobun/bun/desktop/detached-windows.ts +3 -3
- package/src/renderers/electrobun/bun/desktop/snapshot-commit.ts +77 -0
- package/src/renderers/electrobun/shared/protocol.ts +4 -0
- package/src/renderers/electrobun/view/backend-rpc.ts +3 -0
- package/src/renderers/electrobun/view/desktop/window/bridge.ts +3 -0
- package/src/renderers/opentui/host.tsx +6 -0
- package/src/series/standalone.ts +2 -2
- package/src/shares/api.ts +21 -4
- package/src/shares/item.ts +73 -0
- package/src/shares/pane-item.ts +205 -0
- package/src/shares/pane.ts +4 -0
- package/src/shares/payload.ts +9 -5
- package/src/sources/gloomberb-cloud/news.ts +2 -0
- package/src/sources/gloomberb-cloud/normalizers.ts +9 -5
- package/src/sources/provider-router/cache.ts +3 -1
- package/src/sync/controller.ts +17 -2
- package/src/sync/other-window-tabs.ts +32 -1
- package/src/sync/react.ts +4 -4
- package/src/tickers/renamed-listings.ts +105 -0
- package/src/tickers/search/index.ts +103 -16
- package/src/time-series/bar-spacing.ts +33 -0
- package/src/time-series/base-series.ts +21 -3
- package/src/time-series/chart-bounds.ts +31 -0
- package/src/time-series/field-catalog.ts +17 -0
- package/src/time-series/fundamentals.ts +143 -11
- package/src/time-series/ice-credit.ts +32 -6
- package/src/time-series/resolve.ts +11 -7
- package/src/time-series/session-bar.ts +78 -9
- package/src/time-series/studies/formula.ts +53 -10
- package/src/time-series/studies/pair.ts +18 -7
- package/src/time-series/studies/units.ts +49 -2
- package/src/time-series/types.ts +12 -0
- package/src/types/desktop-window.ts +2 -0
- package/src/types/financials.ts +7 -0
- package/src/types/headless.ts +8 -0
- package/src/types/plugin-pane-settings.ts +2 -0
- package/src/types/plugin-panes.ts +22 -0
- package/src/utils/central-banks.ts +86 -1
- package/src/utils/cli-output.ts +6 -3
- package/src/utils/datetime-format.ts +12 -3
- package/src/utils/depositary-receipt.ts +28 -3
- package/src/utils/ebitda.ts +128 -0
- package/src/utils/format.ts +1 -1
- package/src/utils/fundamentals.ts +14 -0
- package/src/utils/max-drawdown.ts +97 -16
- package/src/utils/shell-word.ts +13 -0
- package/src/utils/untrusted-text.ts +29 -0
package/README.md
CHANGED
|
@@ -47,6 +47,8 @@ Or with [Bun](https://bun.sh), on any of them:
|
|
|
47
47
|
bun install -g @gloom-sh/terminal
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
+
`npm install -g @gloom-sh/terminal` works too, but the command runs on Bun, so install [Bun](https://bun.sh) first.
|
|
51
|
+
|
|
50
52
|
Then run `gloom` (`gloomberb`, its old name, still works). On Apple Silicon the script also installs the desktop app, Gloom.app. Homebrew, the Windows desktop installer and manual downloads are in the [installation guide](docs/installation.md).
|
|
51
53
|
|
|
52
54
|
Charts draw as images in Kitty-compatible terminals such as Ghostty, Kitty and WezTerm, and as text elsewhere.
|
|
@@ -65,6 +67,6 @@ Crash reports and usage counts can be turned off: [what is sent](docs/telemetry.
|
|
|
65
67
|
|
|
66
68
|
## Plugins and contributing
|
|
67
69
|
|
|
68
|
-
Plugins add panes, data sources, brokers and commands. Install one from GitHub with `gloom install gloom-sh/gloom-tv`, or build your own with the [plugin guide](PLUGINS.md#your-first-pane). To work on Gloom itself, read [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
70
|
+
Plugins add panes, data sources, brokers and commands. Install one from GitHub with `gloom install gloom-sh/gloom-tv`, or build your own with the [plugin guide](PLUGINS.md#your-first-pane). To work on Gloom itself, clone it with `git clone --filter=blob:none https://github.com/gloom-sh/gloomberb.git` and read [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
69
71
|
|
|
70
72
|
[MIT licensed](LICENSE). Built with [OpenTUI](https://opentui.com/). [Sponsor Gloom](https://gloom.sh/sponsor).
|
package/README.zh-CN.md
CHANGED
|
@@ -67,6 +67,6 @@ bun install -g @gloom-sh/terminal
|
|
|
67
67
|
|
|
68
68
|
## 插件与贡献
|
|
69
69
|
|
|
70
|
-
插件可添加面板、数据源、券商连接与命令。用 `gloom install gloom-sh/gloom-tv` 从 GitHub 安装插件,或参考[插件开发指南(英文)](PLUGINS.md#your-first-pane)自己编写。参与 Gloom
|
|
70
|
+
插件可添加面板、数据源、券商连接与命令。用 `gloom install gloom-sh/gloom-tv` 从 GitHub 安装插件,或参考[插件开发指南(英文)](PLUGINS.md#your-first-pane)自己编写。参与 Gloom 开发,请用 `git clone --filter=blob:none https://github.com/gloom-sh/gloomberb.git` 克隆源码,并阅读[贡献指南(英文)](CONTRIBUTING.md)。
|
|
71
71
|
|
|
72
72
|
采用 [MIT 许可证](LICENSE)。基于 [OpenTUI](https://opentui.com/) 构建。[赞助 Gloom](https://gloom.sh/sponsor)。
|
package/bin/gloom
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
// The package installs this as both `gloom` and `gloomberb`.
|
|
4
4
|
//
|
|
5
|
+
// npm on a machine without Bun points this file at Node instead
|
|
6
|
+
// (without-bun.cjs, its preinstall): Node hands over to Bun once there is
|
|
7
|
+
// one, or says in one line how to get it.
|
|
8
|
+
if (!process.versions.bun) {
|
|
9
|
+
const { runWithoutBun } = await import("./without-bun.cjs");
|
|
10
|
+
const { fileURLToPath } = await import("node:url");
|
|
11
|
+
process.exit(await runWithoutBun(fileURLToPath(import.meta.url), process.argv.slice(2)));
|
|
12
|
+
}
|
|
13
|
+
|
|
5
14
|
// Bun applies patchedDependencies only to the root project, so a global
|
|
6
15
|
// `bun install -g` runs react-reconciler without
|
|
7
16
|
// patches/react-reconciler@0.33.0.patch. Its dev build then records a
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// Gloom runs on Bun, and `bin/gloom` starts with `#!/usr/bin/env bun`. npm and
|
|
4
|
+
// npx install it on machines without Bun too, where that line failed with
|
|
5
|
+
// "env: bun: No such file or directory" before any of Gloom ran.
|
|
6
|
+
//
|
|
7
|
+
// Run as npm's preinstall (before npm links the command, so Windows' shims
|
|
8
|
+
// follow it too), this points the command at Node when no Bun is found.
|
|
9
|
+
// Under Node, `bin/gloom` then hands over to Bun once one is installed, or
|
|
10
|
+
// says in one line how to get it (runWithoutBun). A machine with Bun, and
|
|
11
|
+
// every Bun install, keeps the Bun line untouched. Never fails an install.
|
|
12
|
+
|
|
13
|
+
const { existsSync, readFileSync, writeFileSync } = require("node:fs");
|
|
14
|
+
const { homedir } = require("node:os");
|
|
15
|
+
const { delimiter, join } = require("node:path");
|
|
16
|
+
|
|
17
|
+
const BUN_LINE = "#!/usr/bin/env bun";
|
|
18
|
+
const NODE_LINE = "#!/usr/bin/env node";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* A Bun on PATH, or where Bun's installer puts it; null when there is none.
|
|
22
|
+
* On Windows only bun.exe counts, as Node cannot start a .cmd shim without a
|
|
23
|
+
* shell: an npm-installed Bun is found by the bun.exe beside its shims.
|
|
24
|
+
*/
|
|
25
|
+
function findBun(env = process.env, platform = process.platform) {
|
|
26
|
+
const dirs = [
|
|
27
|
+
...(env.PATH ?? env.Path ?? "").split(platform === "win32" ? ";" : delimiter),
|
|
28
|
+
join(env.BUN_INSTALL || join(homedir(), ".bun"), "bin"),
|
|
29
|
+
].filter(Boolean);
|
|
30
|
+
for (const dir of dirs) {
|
|
31
|
+
const candidates = platform === "win32"
|
|
32
|
+
? [join(dir, "bun.exe"), join(dir, "node_modules", "bun", "bin", "bun.exe")]
|
|
33
|
+
: [join(dir, "bun")];
|
|
34
|
+
const found = candidates.find((candidate) => existsSync(candidate));
|
|
35
|
+
if (found) return found;
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** The one line a machine without Bun gets, naming both ways out. */
|
|
41
|
+
function missingBunMessage(platform = process.platform) {
|
|
42
|
+
return platform === "win32"
|
|
43
|
+
? "gloom runs on Bun, which is not installed. Install Bun (powershell -c \"irm bun.sh/install.ps1 | iex\") and run gloom again, or install Gloom with: irm https://gloom.sh/install.ps1 | iex"
|
|
44
|
+
: "gloom runs on Bun, which is not installed. Install Bun (curl -fsSL https://bun.sh/install | bash) and run gloom again, or install Gloom with: curl -fsSL https://gloom.sh/install | bash";
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Points `launcher` at Node when npm installs it on a machine with no Bun.
|
|
49
|
+
* True when it changed it. A Bun install, and a source checkout (not under
|
|
50
|
+
* node_modules), keep the Bun line.
|
|
51
|
+
*/
|
|
52
|
+
function useNodeWithoutBun(launcher, env = process.env, platform = process.platform) {
|
|
53
|
+
if ((env.npm_config_user_agent ?? "").startsWith("bun/")) return false;
|
|
54
|
+
if (!launcher.split(/[\\/]/).includes("node_modules")) return false;
|
|
55
|
+
if (findBun(env, platform)) return false;
|
|
56
|
+
const text = readFileSync(launcher, "utf8");
|
|
57
|
+
if (!text.startsWith(`${BUN_LINE}\n`)) return false;
|
|
58
|
+
writeFileSync(launcher, `${NODE_LINE}\n${text.slice(BUN_LINE.length + 1)}`);
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* `bin/gloom` under Node: runs `script` with the Bun found now, passing the
|
|
64
|
+
* arguments, stdio and exit status through, or prints missingBunMessage.
|
|
65
|
+
* Resolves to the exit code.
|
|
66
|
+
*/
|
|
67
|
+
function runWithoutBun(script, args) {
|
|
68
|
+
const bun = findBun();
|
|
69
|
+
if (!bun) {
|
|
70
|
+
process.stderr.write(`${missingBunMessage()}\n`);
|
|
71
|
+
return Promise.resolve(1);
|
|
72
|
+
}
|
|
73
|
+
const { spawn } = require("node:child_process");
|
|
74
|
+
const { constants } = require("node:os");
|
|
75
|
+
return new Promise((resolve) => {
|
|
76
|
+
const child = spawn(bun, [script, ...args], { stdio: "inherit" });
|
|
77
|
+
// The terminal sends Ctrl+C to Bun as well; Node waits for it to finish.
|
|
78
|
+
const ignore = () => {};
|
|
79
|
+
for (const signal of ["SIGINT", "SIGTERM", "SIGHUP"]) process.on(signal, ignore);
|
|
80
|
+
child.on("error", (error) => {
|
|
81
|
+
process.stderr.write(`gloom: could not start Bun at ${bun}: ${error.message}\n`);
|
|
82
|
+
resolve(1);
|
|
83
|
+
});
|
|
84
|
+
child.on("exit", (code, signal) => {
|
|
85
|
+
resolve(code ?? 128 + (signal ? constants.signals[signal] ?? 0 : 0));
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
module.exports = { findBun, missingBunMessage, runWithoutBun, useNodeWithoutBun };
|
|
91
|
+
|
|
92
|
+
if (require.main === module && !process.versions.bun) {
|
|
93
|
+
try {
|
|
94
|
+
useNodeWithoutBun(join(__dirname, "gloom"));
|
|
95
|
+
} catch {
|
|
96
|
+
// Intentional ignore: a launcher that cannot be rewritten keeps the Bun line, as before.
|
|
97
|
+
}
|
|
98
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gloomberb",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.6",
|
|
4
4
|
"packageManager": "bun@1.3.14",
|
|
5
5
|
"description": "Market research and portfolio tracker for the terminal",
|
|
6
6
|
"module": "src/public/index.ts",
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"patches"
|
|
52
52
|
],
|
|
53
53
|
"scripts": {
|
|
54
|
+
"preinstall": "node bin/without-bun.cjs || exit 0",
|
|
54
55
|
"dev": "bun run --watch src/cli/entry.ts",
|
|
55
56
|
"start": "bun src/cli/entry.ts",
|
|
56
57
|
"build": "bun run scripts/build.ts",
|
|
@@ -87,6 +88,7 @@
|
|
|
87
88
|
"benchmark:tui:compare": "bun run scripts/benchmark-tui-compare.ts",
|
|
88
89
|
"benchmark:tui:memory": "bun run scripts/benchmark-tui-memory.ts",
|
|
89
90
|
"benchmark:startup": "bun run scripts/benchmark-startup.ts",
|
|
91
|
+
"check:floating-promises": "bun run scripts/update-floating-promise-allowlist.ts --check",
|
|
90
92
|
"check:pane-chrome": "bun run scripts/pane-chrome/checks.ts",
|
|
91
93
|
"check:chat-mentions": "bun scripts/pane-chrome/chat-mentions.ts",
|
|
92
94
|
"check:pane-screenshot": "bun run scripts/pane-chrome/screenshot.ts",
|
|
@@ -94,6 +96,7 @@
|
|
|
94
96
|
"check:pane-layout": "bun run scripts/pane-chrome/layout-sweep.ts",
|
|
95
97
|
"check:ui-tokens": "bun run scripts/pane-chrome/ui-tokens.ts",
|
|
96
98
|
"ui:benchmark": "bun run scripts/pane-chrome/ui-benchmark.ts",
|
|
99
|
+
"askg:tool-sweep": "bun run scripts/askg-tool-sweep.ts",
|
|
97
100
|
"ui:badge-ink": "bun run scripts/pane-chrome/badge-ink.ts",
|
|
98
101
|
"audit:ui": "bun run scripts/pane-chrome/ui-audit.ts",
|
|
99
102
|
"check:call-player": "bun run scripts/pane-chrome/call-player.ts",
|
package/src/api-client/data.ts
CHANGED
|
@@ -36,6 +36,7 @@ import type { BitcoinNetworkPayload, CryptoMarketsPayload, DefiTvlPayload, Stabl
|
|
|
36
36
|
import type { CryptoEtfFlowAsset, CryptoEtfFlowsPayload } from "./crypto-etf-flows";
|
|
37
37
|
import type { CentralBankRatesPayload } from "./central-bank-rates";
|
|
38
38
|
import type { FxInterventionsPayload } from "./fx-interventions";
|
|
39
|
+
import type { HkTendersPayload } from "./hk-tenders";
|
|
39
40
|
import type { EstimateRevisionsPayload } from "./estimate-revisions";
|
|
40
41
|
import type { MoneyMarketsPayload } from "./money-markets";
|
|
41
42
|
import type { CloudCurveHistory, CloudCurveId, CloudCurveView, CloudWorldCurves } from "./yield-curves";
|
|
@@ -55,7 +56,7 @@ import type { GpuBoardPayload, GpuEventsPayload, GpuHistoryPayload, GpuHistoryQu
|
|
|
55
56
|
import type { CpiBoardPayload } from "./cpi";
|
|
56
57
|
import type { TapeRange, TapeSnapshot } from "./tape";
|
|
57
58
|
import { LIVE_SCAN_PATH, type LiveScanPayload, type LiveScanWireDefinition } from "./live-scan";
|
|
58
|
-
import { signalWithTimeout } from "../utils/async-deadline";
|
|
59
|
+
import { abortable, signalWithTimeout } from "../utils/async-deadline";
|
|
59
60
|
import { ApiRequestError, isRetryableApiError, markAskedTwice } from "./errors";
|
|
60
61
|
import type { ExchangeRateSnapshot } from "../types/exchange-rate";
|
|
61
62
|
import type { RatePathPayload } from "./rates";
|
|
@@ -149,6 +150,7 @@ import type {
|
|
|
149
150
|
CloudRiskReportPayload,
|
|
150
151
|
CloudCorporateActionsPayload,
|
|
151
152
|
CloudEconEventPayload,
|
|
153
|
+
CloudEconCalendarFromPayload,
|
|
152
154
|
CloudShortRatesPayload,
|
|
153
155
|
CloudMacroReleaseDaysPayload,
|
|
154
156
|
CloudEquityDiagnosticMode,
|
|
@@ -235,6 +237,33 @@ export interface BatchableRead {
|
|
|
235
237
|
batch?: boolean;
|
|
236
238
|
}
|
|
237
239
|
|
|
240
|
+
const DAY_MS = 86_400_000;
|
|
241
|
+
|
|
242
|
+
/** A YYYY-MM-DD date `days` away as a UTC time, or null for any other form, which bounds nothing. */
|
|
243
|
+
function dayTime(date: string | undefined, days: number): number | null {
|
|
244
|
+
if (!date || !/^\d{4}-\d{2}-\d{2}$/.test(date)) return null;
|
|
245
|
+
const time = Date.parse(`${date}T00:00:00Z`);
|
|
246
|
+
return Number.isFinite(time) ? time + days * DAY_MS : null;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Whether every bar falls in the window asked, give or take the day a daily
|
|
251
|
+
* bar's UTC time may stand from its session's date. A server from before
|
|
252
|
+
* windowed batches answers its latest bars instead, which this tells apart.
|
|
253
|
+
*/
|
|
254
|
+
function withinWindow(points: readonly CloudPricePointPayload[] | null | undefined, startDate?: string, endDate?: string): boolean {
|
|
255
|
+
if (!Array.isArray(points)) return true;
|
|
256
|
+
const from = dayTime(startDate, -2);
|
|
257
|
+
const before = dayTime(endDate, 2);
|
|
258
|
+
return points.every((point) => {
|
|
259
|
+
const time = Date.parse(point.date);
|
|
260
|
+
return !Number.isFinite(time) || ((from == null || time >= from) && (before == null || time < before));
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/** What a service without windowed batches is taken to have answered: the route missing, so the reads go out alone until it is asked again. */
|
|
265
|
+
const WINDOWLESS_BATCH = "The history batch route does not read a window of dates";
|
|
266
|
+
|
|
238
267
|
export class CloudDataApi {
|
|
239
268
|
constructor(
|
|
240
269
|
private readonly request: CloudApiRequest,
|
|
@@ -250,36 +279,97 @@ export class CloudDataApi {
|
|
|
250
279
|
* board's seventy-two rows are five requests, and the first rows land as
|
|
251
280
|
* soon as sixteen reads have.
|
|
252
281
|
*/
|
|
253
|
-
private readonly histories =
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
}
|
|
282
|
-
}
|
|
282
|
+
private readonly histories = this.historyCoalescer(false);
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* The same over one window of dates (a portfolio's holdings over the risk
|
|
286
|
+
* model's months or the stress episodes' years). A service from before
|
|
287
|
+
* windowed batches answers its latest bars instead, or refuses the window:
|
|
288
|
+
* that reads as the route missing, so the reads are asked on their own,
|
|
289
|
+
* four at a time, until it is asked again. Until a windowed batch has been
|
|
290
|
+
* answered, one read is asked as a batch of its own first (`windowProbe`),
|
|
291
|
+
* so finding that out costs one listing's bars, not every batch's.
|
|
292
|
+
*/
|
|
293
|
+
private readonly datedHistories = this.historyCoalescer(true);
|
|
294
|
+
/** The first windowed batch, of one read, that the others wait on; null until asked, and again after it found no windows. */
|
|
295
|
+
private windowProbe: Promise<CloudMarketResponse<CloudPricePointPayload[]> | undefined> | null = null;
|
|
296
|
+
/** Whether a windowed batch has come back over its window: the probe is not asked again. */
|
|
297
|
+
private windowsAnswered = false;
|
|
298
|
+
|
|
299
|
+
private historyCoalescer(dated: boolean) {
|
|
300
|
+
return createReadCoalescer<
|
|
301
|
+
{ symbol: string; exchange: string; params: Pick<CloudHistoryParams, "interval" | "outputsize" | "rangeKey" | "startDate" | "endDate"> },
|
|
302
|
+
CloudMarketResponse<CloudPricePointPayload[]>
|
|
303
|
+
>({
|
|
304
|
+
max: 16,
|
|
305
|
+
// Reads asked alone after a refused batch stay within what the panes kept in flight before: SOVR four, the board twelve with its terms.
|
|
306
|
+
fallbackConcurrency: 4,
|
|
307
|
+
group: ({ params }) => [params.interval, params.outputsize, params.rangeKey, params.startDate, params.endDate].map((value) => value ?? "").join("|"),
|
|
308
|
+
single: ({ symbol, exchange, params }) => this.request(cloudHistoryPath(symbol, exchange, params)),
|
|
309
|
+
batch: (keys) => (dated ? this.windowedBatch(keys) : this.historyBatch(keys, false)),
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
private async historyBatch(
|
|
314
|
+
keys: Array<{ symbol: string; exchange: string; params: Pick<CloudHistoryParams, "interval" | "outputsize" | "rangeKey" | "startDate" | "endDate"> }>,
|
|
315
|
+
dated: boolean,
|
|
316
|
+
): Promise<Array<CloudMarketResponse<CloudPricePointPayload[]> | undefined>> {
|
|
317
|
+
const { interval, outputsize, rangeKey, startDate, endDate } = keys[0]!.params;
|
|
318
|
+
// The server answers each target in the order asked, so a listing asked twice is asked once.
|
|
319
|
+
const targetKey = ({ symbol, exchange }: { symbol: string; exchange: string }) => `${symbol}\u001f${exchange}`;
|
|
320
|
+
const targets = [...new Map(keys.map((key) => [targetKey(key), { symbol: key.symbol, exchange: key.exchange }])).values()];
|
|
321
|
+
const response = await this.request<CloudMarketResponse<{ items: Array<CloudMarketResponse<CloudPricePointPayload[]>> }>>("/market/history/batch", {
|
|
322
|
+
method: "POST",
|
|
323
|
+
body: JSON.stringify({
|
|
324
|
+
targets,
|
|
325
|
+
interval: interval ?? "1day",
|
|
326
|
+
...(outputsize != null ? { outputsize: String(outputsize) } : {}),
|
|
327
|
+
...(rangeKey ? { rangeKey } : {}),
|
|
328
|
+
...(dated && startDate ? { startDate } : {}),
|
|
329
|
+
...(dated && endDate ? { endDate } : {}),
|
|
330
|
+
}),
|
|
331
|
+
}).catch((error: unknown) => {
|
|
332
|
+
// A service that does not take a window in a batch may refuse it as asked rather than answer its latest bars.
|
|
333
|
+
if (dated && error instanceof ApiRequestError && (error.status === 400 || error.status === 422)) throw new ApiRequestError(WINDOWLESS_BATCH, 404);
|
|
334
|
+
throw error;
|
|
335
|
+
});
|
|
336
|
+
const items = response.data?.items;
|
|
337
|
+
// An answer that does not line up with the targets asked is not matched by place: each read is asked on its own.
|
|
338
|
+
if (!Array.isArray(items) || items.length !== targets.length) return keys.map(() => undefined);
|
|
339
|
+
if (dated && items.some((item) => !withinWindow(item.data, startDate, endDate))) throw new ApiRequestError(WINDOWLESS_BATCH, 404);
|
|
340
|
+
const byTarget = new Map(targets.map((target, index) => [targetKey(target), items[index]]));
|
|
341
|
+
return keys.map((key) => byTarget.get(targetKey(key)));
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* A batch over a window, once a windowed batch has been answered; before
|
|
346
|
+
* that, the first batch's first read goes out alone as the probe and every
|
|
347
|
+
* batch waits on it. A probe answered with bars outside its window, or
|
|
348
|
+
* refused, fails them all as the missing route; one answered with bars in it
|
|
349
|
+
* lets them go, and its own read is not asked again.
|
|
350
|
+
*/
|
|
351
|
+
private async windowedBatch(
|
|
352
|
+
keys: Array<{ symbol: string; exchange: string; params: Pick<CloudHistoryParams, "interval" | "outputsize" | "rangeKey" | "startDate" | "endDate"> }>,
|
|
353
|
+
): Promise<Array<CloudMarketResponse<CloudPricePointPayload[]> | undefined>> {
|
|
354
|
+
if (this.windowsAnswered) return this.historyBatch(keys, true);
|
|
355
|
+
const probing = !this.windowProbe;
|
|
356
|
+
const probe = this.windowProbe ??= this.historyBatch(keys.slice(0, 1), true).then(([item]) => {
|
|
357
|
+
// An empty answer shows no window either way: the batches that follow are checked as they come.
|
|
358
|
+
if (Array.isArray(item?.data) && item.data.length > 0) this.windowsAnswered = true;
|
|
359
|
+
return item;
|
|
360
|
+
});
|
|
361
|
+
let probed: CloudMarketResponse<CloudPricePointPayload[]> | undefined;
|
|
362
|
+
try {
|
|
363
|
+
probed = await probe;
|
|
364
|
+
} catch (error) {
|
|
365
|
+
// Asked again once the route is, after the missing route's wait.
|
|
366
|
+
if (this.windowProbe === probe) this.windowProbe = null;
|
|
367
|
+
throw error;
|
|
368
|
+
}
|
|
369
|
+
if (!probing) return this.historyBatch(keys, true);
|
|
370
|
+
const rest = keys.length > 1 ? await this.historyBatch(keys.slice(1), true) : [];
|
|
371
|
+
return [probed, ...rest];
|
|
372
|
+
}
|
|
283
373
|
|
|
284
374
|
/**
|
|
285
375
|
* Futures terms asked with others in the same moment (a futures board's rows) go out as
|
|
@@ -677,12 +767,27 @@ export class CloudDataApi {
|
|
|
677
767
|
symbol: string,
|
|
678
768
|
exchange: string,
|
|
679
769
|
params: CloudHistoryParams = {},
|
|
680
|
-
options: {
|
|
770
|
+
options: {
|
|
771
|
+
signal?: AbortSignal;
|
|
772
|
+
/**
|
|
773
|
+
* With `batch`, the dates are the window every read asked with this one
|
|
774
|
+
* shares (a portfolio's holdings over the risk model's months), so they
|
|
775
|
+
* go out together over it.
|
|
776
|
+
*/
|
|
777
|
+
sharedWindow?: boolean;
|
|
778
|
+
} & BatchableRead = {},
|
|
681
779
|
): Promise<CloudMarketResponse<CloudPricePointPayload[]>> {
|
|
682
|
-
|
|
683
|
-
|
|
780
|
+
const dated = Boolean(params.startDate || params.endDate);
|
|
781
|
+
// Trailing bars asked with others, or bars over a window shared with them, not a session or recovery of their own,
|
|
782
|
+
// may go out with the others asked in the same moment. A read over a shared window keeps its signal: the batch it
|
|
783
|
+
// went out in is others' too and runs on, but the read stops waiting for it.
|
|
784
|
+
const shared = options.batch && !params.historyRecovery && !params.session && (dated ? options.sharedWindow : !options.signal);
|
|
684
785
|
return this.readListing(() => shared
|
|
685
|
-
?
|
|
786
|
+
? abortable((dated ? this.datedHistories : this.histories).read({
|
|
787
|
+
symbol,
|
|
788
|
+
exchange,
|
|
789
|
+
params: { interval: params.interval, outputsize: params.outputsize, rangeKey: params.rangeKey, startDate: params.startDate, endDate: params.endDate },
|
|
790
|
+
}), options.signal, "History read aborted")
|
|
686
791
|
: this.request<CloudMarketResponse<CloudPricePointPayload[]>>(
|
|
687
792
|
cloudHistoryPath(symbol, exchange, params),
|
|
688
793
|
options.signal ? { signal: options.signal } : undefined,
|
|
@@ -725,8 +830,8 @@ export class CloudDataApi {
|
|
|
725
830
|
}
|
|
726
831
|
|
|
727
832
|
/** The calendar from a UTC day, past events included, and the first day the stored calendar holds. */
|
|
728
|
-
async getCloudEconomicCalendarFrom(from: string): Promise<
|
|
729
|
-
return this.request<
|
|
833
|
+
async getCloudEconomicCalendarFrom(from: string): Promise<CloudEconCalendarFromPayload> {
|
|
834
|
+
return this.request<CloudEconCalendarFromPayload>(`/cloud/econ/calendar/history?from=${encodeURIComponent(from)}`);
|
|
730
835
|
}
|
|
731
836
|
|
|
732
837
|
/** Each currency's short rate and its day, for forwards implied by covered interest parity. */
|
|
@@ -1095,6 +1200,12 @@ export class CloudDataApi {
|
|
|
1095
1200
|
return this.request<FxInterventionsPayload>("/cloud/econ/fx-interventions", { signal: signalWithTimeout(signal, 20_000) });
|
|
1096
1201
|
}
|
|
1097
1202
|
|
|
1203
|
+
/** Hong Kong government paper tender results from HKMA's Open API, issued on or after `from` (YYYY-MM-DD), at most `limit`. */
|
|
1204
|
+
async getCloudHkTenders(from: string, limit: number, signal?: AbortSignal): Promise<HkTendersPayload> {
|
|
1205
|
+
const query = new URLSearchParams({ from, limit: String(limit) });
|
|
1206
|
+
return this.request<HkTendersPayload>(`/cloud/econ/hk-tenders?${query}`, { signal: signalWithTimeout(signal, 20_000) });
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1098
1209
|
/** A live scan's matches against Gloom Cloud's newest market-wide snapshot for this account's tier. */
|
|
1099
1210
|
getLiveScan(definition: LiveScanWireDefinition, signal?: AbortSignal) {
|
|
1100
1211
|
return this.request<LiveScanPayload>(LIVE_SCAN_PATH, {
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/** EF Bills, EF Notes, an HKSAR institutional Government Bond, or its HONIA-indexed floating rate note. */
|
|
2
|
+
type HkTenderPaper = "efb" | "efn" | "hkgb" | "hkgb-frn";
|
|
3
|
+
|
|
4
|
+
/** One tender's result, as the Hong Kong Monetary Authority's Open API states it. */
|
|
5
|
+
export interface HkTender {
|
|
6
|
+
/** The issue day (YYYY-MM-DD), the business day after the tender; Government Bonds give only the month (YYYY-MM). */
|
|
7
|
+
date: string;
|
|
8
|
+
paper: HkTenderPaper;
|
|
9
|
+
/** A Government Bond's issue number (10GB3507001); HKMA's EF figures name none. */
|
|
10
|
+
issue: string | null;
|
|
11
|
+
/** A re-opening of an issue already outstanding; null for EF paper. */
|
|
12
|
+
reopening: boolean | null;
|
|
13
|
+
/** HKD, or CNH for an RMB Government Bond. */
|
|
14
|
+
currency: "HKD" | "CNH";
|
|
15
|
+
/** A Government Bond's expected maturity (YYYY-MM). */
|
|
16
|
+
maturity: string | null;
|
|
17
|
+
/** "3-Month" for a bill, "2-Year" for a note, a bond's original tenor by its issue number. */
|
|
18
|
+
term: string;
|
|
19
|
+
/** Annual coupon in percent; null for a bill or a floating rate note. */
|
|
20
|
+
coupon: number | null;
|
|
21
|
+
/** The average accepted yield in percent (an RMB bond's annualised one); null for a floating rate note. */
|
|
22
|
+
averageYield: number | null;
|
|
23
|
+
/** An RMB bond's average accepted yield, semi-annualised. */
|
|
24
|
+
averageYieldSemiAnnual: number | null;
|
|
25
|
+
/** A floating rate note's spread over HONIA, in percent. */
|
|
26
|
+
spread: number | null;
|
|
27
|
+
/** Applications, in units of `currency`. */
|
|
28
|
+
applied: number;
|
|
29
|
+
/** The amount allotted: stated for Government Bonds only. */
|
|
30
|
+
allotted: number | null;
|
|
31
|
+
/** EF paper: applications over the amount offered, less one. */
|
|
32
|
+
overSubscription: number | null;
|
|
33
|
+
/** Applications over the amount allotted (bonds) or offered (EF paper). */
|
|
34
|
+
bidToCover: number;
|
|
35
|
+
/** EF paper's amount offered, worked out from the amount applied and the over-subscription, to three figures. */
|
|
36
|
+
offered: number | null;
|
|
37
|
+
/** The HKMA dataset it came from: `efb-91day`, `hkgb-rmb`. */
|
|
38
|
+
dataset: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** `GET /cloud/econ/hk-tenders`: Hong Kong government paper tender results from HKMA's Open API. */
|
|
42
|
+
export interface HkTendersPayload {
|
|
43
|
+
authority: string;
|
|
44
|
+
/** The attribution HKMA's terms ask for: "Source: HKMA". */
|
|
45
|
+
credit: string;
|
|
46
|
+
status: "available" | "unavailable";
|
|
47
|
+
/** Newest first, issued on or after `from`, at most `limit`. */
|
|
48
|
+
tenders: HkTender[];
|
|
49
|
+
from: string;
|
|
50
|
+
limit: number;
|
|
51
|
+
truncated: boolean;
|
|
52
|
+
/** The first and last issue the record holds. */
|
|
53
|
+
firstTender: string | null;
|
|
54
|
+
latestTender: string | null;
|
|
55
|
+
/** The newest issue HKMA's figures hold, per paper: HKMA publishes them monthly. */
|
|
56
|
+
runsTo: { efb: string | null; efn: string | null; hkgb: string | null };
|
|
57
|
+
fetchedAt: string | null;
|
|
58
|
+
stale: boolean;
|
|
59
|
+
}
|
package/src/api-client/index.ts
CHANGED
|
@@ -977,6 +977,7 @@ class GloomApiClient {
|
|
|
977
977
|
getCloudBitcoinNetwork = this.data.getCloudBitcoinNetwork.bind(this.data);
|
|
978
978
|
getCloudCentralBankRates = this.data.getCloudCentralBankRates.bind(this.data);
|
|
979
979
|
getCloudFxInterventions = this.data.getCloudFxInterventions.bind(this.data);
|
|
980
|
+
getCloudHkTenders = this.data.getCloudHkTenders.bind(this.data);
|
|
980
981
|
getMobileAlertHistory = this.data.getMobileAlertHistory.bind(this.data);
|
|
981
982
|
getScannerFlowHistory = this.data.getScannerFlowHistory.bind(this.data);
|
|
982
983
|
getScannerFlowSession = this.data.getScannerFlowSession.bind(this.data);
|
|
@@ -35,6 +35,22 @@ export interface CloudEconEventPayload {
|
|
|
35
35
|
* forecast and on one kept before the read was recorded.
|
|
36
36
|
*/
|
|
37
37
|
consensus?: { source: string; readAt: string } | null;
|
|
38
|
+
/**
|
|
39
|
+
* A central bank's next decision listed past the end of the calendar's
|
|
40
|
+
* listing: no release is listed after `listedThrough`, the listing's last
|
|
41
|
+
* UTC day. Absent from an older server.
|
|
42
|
+
*/
|
|
43
|
+
pastListing?: boolean;
|
|
44
|
+
listedThrough?: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** The calendar from a day, as GET /cloud/econ/calendar/history serves it. */
|
|
48
|
+
export interface CloudEconCalendarFromPayload {
|
|
49
|
+
events: CloudEconEventPayload[];
|
|
50
|
+
/** The first UTC day the stored calendar holds; null when it holds nothing. */
|
|
51
|
+
storedFrom: string | null;
|
|
52
|
+
/** The last UTC day the calendar lists releases for; absent from an older server. */
|
|
53
|
+
listedThrough?: string;
|
|
38
54
|
}
|
|
39
55
|
|
|
40
56
|
/** One currency's short-term rate, as GET /cloud/econ/short-rates serves it. */
|
|
@@ -47,6 +63,14 @@ export interface CloudShortRate {
|
|
|
47
63
|
tenorDays: number;
|
|
48
64
|
/** Days in the year the rate is quoted over. */
|
|
49
65
|
dayCountBasis: 360 | 365;
|
|
66
|
+
/**
|
|
67
|
+
* "business-252": compounded over 252 business days a year (Brazil's CDI),
|
|
68
|
+
* grown as (1 + r)^(days / 365), business days taken as 252/365 of the
|
|
69
|
+
* calendar days. "daily-365": compounded each calendar day on ACT/365
|
|
70
|
+
* (ZARONIA), grown as (1 + r / 365)^days. Absent: simple interest on
|
|
71
|
+
* `dayCountBasis`.
|
|
72
|
+
*/
|
|
73
|
+
compounding?: "business-252" | "daily-365" | null;
|
|
50
74
|
publisher: string;
|
|
51
75
|
sourceUrl: string;
|
|
52
76
|
/** Percent a year; null when it could not be read. */
|
|
@@ -82,7 +106,13 @@ export interface CloudMacroReleaseDaysPayload {
|
|
|
82
106
|
prior: string | null;
|
|
83
107
|
/** Above the consensus (hot), below it (cool), at it (in-line); null without both. */
|
|
84
108
|
surprise: "hot" | "cool" | "in-line" | null;
|
|
109
|
+
/** An FOMC day's move in the target range: "held", "cut 25bp", "raised 50bp". */
|
|
110
|
+
decision?: string;
|
|
85
111
|
}>>>;
|
|
112
|
+
/** The first New York day the kept economic calendar covers: US days before it have no figures. */
|
|
113
|
+
figuresFrom?: string;
|
|
114
|
+
/** Why a US release day from `figuresFrom` on has no figures, by kind and day. */
|
|
115
|
+
figureGaps?: Partial<Record<"cpi" | "jobs" | "fomc", Record<string, string>>>;
|
|
86
116
|
}
|
|
87
117
|
|
|
88
118
|
export interface CloudFredObservationPayload {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Government bond curves stored from their official publishers, in percent. */
|
|
2
|
-
export type CloudCurveId = "us" | "us-real" | "us-breakeven" | "eu-aaa" | "de" | "gb" | "jp" | "ca";
|
|
2
|
+
export type CloudCurveId = "us" | "us-real" | "us-breakeven" | "eu-aaa" | "de" | "gb" | "jp" | "ca" | "mx" | "br";
|
|
3
3
|
|
|
4
4
|
export interface CloudCurvePoint {
|
|
5
5
|
tenor: string;
|
|
@@ -284,7 +284,10 @@ export function useAppGlobalShortcuts({
|
|
|
284
284
|
if (ranAlready(action)) return;
|
|
285
285
|
event.preventDefault();
|
|
286
286
|
event.stopPropagation();
|
|
287
|
-
|
|
287
|
+
// The key that opened Help closes it again while it has focus.
|
|
288
|
+
const focused = state.focusedPaneId ? findPaneInstance(state.config.layout, state.focusedPaneId) : undefined;
|
|
289
|
+
if (focused?.paneId === "help") pluginRegistry.hidePane("help");
|
|
290
|
+
else pluginRegistry.showPane("help");
|
|
288
291
|
return;
|
|
289
292
|
}
|
|
290
293
|
|
|
@@ -44,6 +44,8 @@ export interface KeybindingActionDef {
|
|
|
44
44
|
/** Help text. Kept in English here; the help pane translates it. */
|
|
45
45
|
description: string;
|
|
46
46
|
defaults: readonly string[];
|
|
47
|
+
/** Default chords the terminal adds after `defaults`, for keys only a terminal needs. */
|
|
48
|
+
terminalDefaults?: readonly string[];
|
|
47
49
|
/** Only the desktop app has this action; the terminal hides the row. */
|
|
48
50
|
desktopOnly?: boolean;
|
|
49
51
|
/** Only the terminal has this action; the desktop app hides the row. */
|
|
@@ -109,6 +111,10 @@ export const KEYBINDING_ACTIONS: readonly KeybindingActionDef[] = [
|
|
|
109
111
|
category: "Global Keys",
|
|
110
112
|
description: "Switch saved layouts by number.",
|
|
111
113
|
defaults: ["CmdOrCtrl+Digit"],
|
|
114
|
+
// A terminal without the kitty protocol never sends Control with a digit
|
|
115
|
+
// (Ctrl+1 arrives as 1, Ctrl+3 as Esc), but it sends Alt+1. A browser
|
|
116
|
+
// keeps Alt+1 for its own tabs, and a Mac types ¡ with it.
|
|
117
|
+
terminalDefaults: ["Alt+Digit"],
|
|
112
118
|
},
|
|
113
119
|
{
|
|
114
120
|
id: "focus-next-pane",
|
|
@@ -19,7 +19,8 @@ export function updateKeybindingsConfig(config: AppConfig, keybindings: Keybindi
|
|
|
19
19
|
function defaultChordsFor(actionId: string, defaults?: readonly KeyChord[]): readonly KeyChord[] {
|
|
20
20
|
if (defaults) return defaults;
|
|
21
21
|
const def = getKeybindingAction(actionId);
|
|
22
|
-
|
|
22
|
+
// Every host's defaults, as the table with no host has them.
|
|
23
|
+
return def ? [...def.defaults, ...def.terminalDefaults ?? []].map((text) => parseKeyChord(text)!).filter(Boolean) : [];
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
function sameChords(left: readonly KeyChord[], right: readonly KeyChord[]): boolean {
|
|
@@ -37,6 +37,7 @@ export {
|
|
|
37
37
|
takenChordMessage,
|
|
38
38
|
} from "./labels";
|
|
39
39
|
export { KeybindingsProvider, getDefaultKeybindings, useKeybindings, useResolvedKeybindings } from "./react";
|
|
40
|
+
export { useTerminalReportsControlKeys } from "./terminal-keys";
|
|
40
41
|
export {
|
|
41
42
|
applyActionBinding,
|
|
42
43
|
removeCommandBinding,
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
type PrimaryModifier,
|
|
15
15
|
} from "./chord";
|
|
16
16
|
import type { ResolvedKeybindingAction, ResolvedKeybindings } from "./resolve";
|
|
17
|
+
import { legacyTerminalSends } from "./terminal-keys";
|
|
17
18
|
|
|
18
19
|
/** What `CmdOrCtrl` is on this host: Control in a terminal, Command on a Mac desktop. */
|
|
19
20
|
export function primaryModifierFor(
|
|
@@ -103,10 +104,14 @@ export function advertisedChord(
|
|
|
103
104
|
resolved: ResolvedKeybindings,
|
|
104
105
|
actionId: string,
|
|
105
106
|
mode: ShortcutDisplayMode,
|
|
107
|
+
{ legacyTerminal = false }: {
|
|
108
|
+
/** The terminal answered without the kitty protocol: a chord it can send goes first (Alt+1 over Ctrl+1). */
|
|
109
|
+
legacyTerminal?: boolean;
|
|
110
|
+
} = {},
|
|
106
111
|
): KeyChord | null {
|
|
107
112
|
const chords = chordsForHost(resolved.actionsById.get(actionId)?.chords ?? [], mode);
|
|
108
113
|
if (chords.length === 0) return null;
|
|
109
|
-
if (mode === "terminal") return chords[0]!;
|
|
114
|
+
if (mode === "terminal") return (legacyTerminal ? chords.find(legacyTerminalSends) : undefined) ?? chords[0]!;
|
|
110
115
|
return chords.find((chord) => chord.primary || chord.cmd) ?? chords[0]!;
|
|
111
116
|
}
|
|
112
117
|
|