gloomberb 0.18.1 → 0.18.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/patches/electrobun@1.18.1.patch +106 -5
- package/src/api-client/commodity-balances.ts +6 -0
- package/src/api-client/company-kpis.ts +9 -0
- package/src/api-client/crypto-markets.ts +9 -0
- package/src/api-client/data.ts +21 -5
- package/src/api-client/equity-screener.ts +2 -0
- package/src/api-client/index.ts +2 -0
- package/src/api-client/request.ts +5 -3
- package/src/api-client/telemetry.ts +17 -0
- package/src/api-client/types.ts +5 -0
- package/src/app/global-shortcuts.ts +1 -16
- package/src/app/pane-runtime/plugin-bindings.ts +3 -1
- package/src/app/pane-runtime/ticker-open-runtime.ts +17 -5
- package/src/app/runtime/plugin-bindings.ts +6 -2
- package/src/app/runtime/update.ts +28 -8
- package/src/architecture/pane-tabs-allowlist.json +65 -0
- package/src/brokers/logos.ts +66 -0
- package/src/brokers/profile-form.ts +3 -0
- package/src/brokers/remote-broker-adapter.ts +13 -3
- package/src/capabilities/index.ts +1 -1
- package/src/capabilities/service-capabilities.ts +7 -1
- package/src/cli/base-converter.ts +60 -18
- package/src/cli/commands/market.ts +354 -187
- package/src/cli/commands/news-search.ts +35 -8
- package/src/cli/commands/system.ts +35 -1
- package/src/cli/commands/ticker.ts +167 -60
- package/src/cli/currency-hints.ts +27 -0
- package/src/cli/fx-pair.ts +41 -4
- package/src/cli/glossary.ts +57 -4
- package/src/cli/help.ts +1 -1
- package/src/cli/helpers.ts +36 -3
- package/src/cli/index.ts +12 -1
- package/src/cli/issuer-membership.ts +103 -0
- package/src/cli/known-gaps.ts +37 -1
- package/src/cli/listing-arg.ts +51 -3
- package/src/cli/name-entries.ts +51 -12
- package/src/cli/pane-functions/capabilities.ts +2 -0
- package/src/cli/pane-functions/catalog.ts +19 -1
- package/src/cli/pane-functions/discovery.ts +15 -1
- package/src/cli/pane-functions/dom.ts +11 -5
- package/src/cli/pane-functions/freshness.ts +4 -4
- package/src/cli/pane-functions/function-help.ts +27 -3
- package/src/cli/pane-functions/headless.ts +31 -11
- package/src/cli/pane-functions/index.ts +67 -7
- package/src/cli/pane-functions/lock-note.ts +7 -4
- package/src/cli/pane-functions/resolver.ts +21 -6
- package/src/cli/quote-answer.ts +179 -0
- package/src/cli/report-tables.ts +136 -18
- package/src/cli/result.ts +12 -4
- package/src/cli/series-search.ts +2 -1
- package/src/cli/symbol-list.ts +47 -11
- package/src/cli/types.ts +4 -0
- package/src/components/chart/composite/composite-chart.tsx +25 -7
- package/src/components/chart/composite/drawing-store.ts +26 -6
- package/src/components/chart/composite/format.ts +13 -1
- package/src/components/chart/composite/interactions.ts +2 -1
- package/src/components/chart/composite/level-labels.ts +30 -0
- package/src/components/chart/composite/levels.ts +17 -6
- package/src/components/chart/composite/panel-surface.tsx +69 -8
- package/src/components/chart/composite/types.ts +6 -0
- package/src/components/chart/composite/use-composite-chart-keyboard.ts +1 -1
- package/src/components/command-bar/routes/root/command-items.ts +32 -6
- package/src/components/command-bar/routes/ticker-search/actions.ts +6 -0
- package/src/components/data-table/view.tsx +23 -3
- package/src/components/index.ts +3 -0
- package/src/components/layout/detached-pane-shell.tsx +1 -0
- package/src/components/layout/floating-pane.tsx +1 -0
- package/src/components/layout/header.tsx +228 -55
- package/src/components/layout/pane/content.tsx +16 -14
- package/src/components/layout/pane/footer/index.tsx +22 -3
- package/src/components/layout/pane/footer/model.ts +99 -4
- package/src/components/layout/pane/header-tabs.tsx +15 -1
- package/src/components/layout/pane/header.tsx +10 -3
- package/src/components/layout/pane/index.tsx +1 -0
- package/src/components/layout/pane/pane-tabs.tsx +9 -1
- package/src/components/onboarding/onboarding-frame.tsx +9 -11
- package/src/components/onboarding/use-onboarding-broker-form.ts +5 -2
- package/src/components/onboarding/wizard-model.ts +10 -3
- package/src/components/ui/button.tsx +11 -4
- package/src/components/ui/choice-dialog.tsx +8 -5
- package/src/components/ui/display.tsx +11 -6
- package/src/components/ui/fields.tsx +100 -20
- package/src/components/ui/icon.tsx +6 -1
- package/src/components/ui/list-row-lines.tsx +87 -0
- package/src/components/ui/list-view.tsx +14 -0
- package/src/components/ui/logo-mark.tsx +64 -0
- package/src/components/ui/number-step.ts +54 -0
- package/src/components/ui/select-button.tsx +5 -4
- package/src/components/ui/select-field.tsx +3 -3
- package/src/components/ui/stat-grid.tsx +28 -3
- package/src/components/ui/status.tsx +20 -4
- package/src/components/ui/tabs.tsx +9 -1
- package/src/components/ui/toggle.tsx +17 -3
- package/src/core/app-services.ts +4 -0
- package/src/core/state/app/instrument.ts +8 -3
- package/src/data/config/store/normalize.ts +4 -1
- package/src/data/plugin-cache.ts +32 -6
- package/src/docs/snapshot.json +5 -5
- package/src/i18n/es.ts +31 -3
- package/src/i18n/ja.ts +31 -3
- package/src/i18n/ko.ts +31 -3
- package/src/i18n/zh-cn.ts +32 -4
- package/src/i18n/zh-tw.ts +32 -4
- package/src/market-data/commodity-names.ts +80 -0
- package/src/market-data/coordinator/auxiliary.ts +3 -1
- package/src/market-data/coordinator/chart.ts +3 -1
- package/src/market-data/futures-board.ts +38 -1
- package/src/market-data/futures-contract.ts +91 -0
- package/src/market-data/fx-closes.ts +78 -1
- package/src/market-data/market/change-basis.ts +219 -0
- package/src/market-data/market/format.ts +28 -12
- package/src/market-data/market/freshness.ts +38 -0
- package/src/market-data/market/status.ts +55 -9
- package/src/market-data/market/year-to-date.ts +46 -0
- package/src/market-data/quotes/contributions.ts +12 -0
- package/src/market-data/quotes/delisting.ts +34 -0
- package/src/market-data/quotes/live-valuation.ts +23 -0
- package/src/market-data/quotes/resolution.ts +8 -2
- package/src/market-data/tax-equivalent.ts +10 -2
- package/src/notifications/app-notifier.ts +2 -2
- package/src/notifications/notification-log.ts +8 -6
- package/src/plugins/builtin/alerts/alert-engine.ts +3 -1
- package/src/plugins/builtin/alerts/cli.ts +26 -18
- package/src/plugins/builtin/alerts/events.ts +1 -0
- package/src/plugins/builtin/alerts/headless.ts +1 -1
- package/src/plugins/builtin/alerts/index.tsx +13 -4
- package/src/plugins/builtin/alerts/research-rules.ts +1 -0
- package/src/plugins/builtin/analytics/risk-pane.tsx +10 -7
- package/src/plugins/builtin/attention/pane.tsx +16 -14
- package/src/plugins/builtin/attention/trending.tsx +8 -6
- package/src/plugins/builtin/awards/pane.tsx +6 -6
- package/src/plugins/builtin/backtest/client.ts +5 -2
- package/src/plugins/builtin/backtest/export.ts +1 -1
- package/src/plugins/builtin/backtest/window.ts +16 -3
- package/src/plugins/builtin/broker-manager/add-flow.tsx +40 -8
- package/src/plugins/builtin/broker-manager/detail.tsx +26 -1
- package/src/plugins/builtin/broker-manager/index.tsx +20 -9
- package/src/plugins/builtin/broker-manager/model.ts +5 -0
- package/src/plugins/builtin/broker-manager/pane-actions.tsx +8 -1
- package/src/plugins/builtin/broker-manager/table.ts +5 -1
- package/src/plugins/builtin/broker-trading/account-picker.tsx +91 -0
- package/src/plugins/builtin/broker-trading/chart-levels.ts +54 -0
- package/src/plugins/builtin/broker-trading/command.ts +103 -0
- package/src/plugins/builtin/broker-trading/controller.ts +688 -0
- package/src/plugins/builtin/broker-trading/dock.tsx +184 -0
- package/src/plugins/builtin/broker-trading/headless.ts +76 -0
- package/src/plugins/builtin/broker-trading/index.tsx +77 -0
- package/src/plugins/builtin/broker-trading/order-feed.ts +383 -0
- package/src/plugins/builtin/broker-trading/orders-data.ts +133 -0
- package/src/plugins/builtin/broker-trading/orders.tsx +437 -0
- package/src/plugins/builtin/broker-trading/overview-orders.tsx +121 -0
- package/src/plugins/builtin/broker-trading/pane-model.ts +207 -0
- package/src/plugins/builtin/broker-trading/pane.tsx +507 -0
- package/src/plugins/builtin/broker-trading/strategy.ts +153 -0
- package/src/plugins/builtin/broker-trading/ticket-parts.tsx +117 -0
- package/src/plugins/builtin/broker-trading/ticket.tsx +578 -0
- package/src/plugins/builtin/buildout/data-runtime.ts +1 -1
- package/src/plugins/builtin/buildout/format.ts +1 -0
- package/src/plugins/builtin/buildout/model/index.ts +16 -7
- package/src/plugins/builtin/buildout/pane/index.tsx +11 -7
- package/src/plugins/builtin/buildout/pane/status.tsx +3 -3
- package/src/plugins/builtin/catalysts/client.ts +2 -2
- package/src/plugins/builtin/catalysts/pane.tsx +3 -3
- package/src/plugins/builtin/chart-composer/cli-options.ts +19 -0
- package/src/plugins/builtin/chart-composer/data-catalog-pane.tsx +2 -1
- package/src/plugins/builtin/chart-composer/headless-schema.ts +3 -3
- package/src/plugins/builtin/chart-composer/headless.ts +2 -1
- package/src/plugins/builtin/chart-composer/option-range.ts +39 -0
- package/src/plugins/builtin/chart-composer/pane.tsx +32 -11
- package/src/plugins/builtin/chart-composer/presets.ts +2 -2
- package/src/plugins/builtin/chart-composer/series-catalog.ts +4 -2
- package/src/plugins/builtin/chart-composer/shortcuts.ts +3 -3
- package/src/plugins/builtin/chart-composer/viewport-labels.ts +5 -2
- package/src/plugins/builtin/chat/index.tsx +1 -1
- package/src/plugins/builtin/chat/status-widget.tsx +1 -1
- package/src/plugins/builtin/chat/unread-inbox-pane.tsx +6 -1
- package/src/plugins/builtin/chat/unread-inbox.ts +1 -1
- package/src/plugins/builtin/commodity-balances/client.ts +6 -4
- package/src/plugins/builtin/commodity-balances/headless.ts +41 -7
- package/src/plugins/builtin/commodity-balances/index.tsx +19 -4
- package/src/plugins/builtin/commodity-balances/model.ts +22 -0
- package/src/plugins/builtin/commodity-balances/pane.tsx +39 -9
- package/src/plugins/builtin/company-attention/app-rank.tsx +4 -5
- package/src/plugins/builtin/company-attention/pane.tsx +13 -11
- package/src/plugins/builtin/company-kpis/client.ts +3 -2
- package/src/plugins/builtin/company-kpis/headless.ts +5 -7
- package/src/plugins/builtin/company-kpis/model.ts +85 -2
- package/src/plugins/builtin/company-kpis/pane.tsx +30 -15
- package/src/plugins/builtin/composite-plugins.ts +3 -2
- package/src/plugins/builtin/correlation/headless.ts +2 -1
- package/src/plugins/builtin/correlation/relationship/model.ts +1 -0
- package/src/plugins/builtin/correlation/settings.ts +1 -0
- package/src/plugins/builtin/cot/headless.ts +1 -1
- package/src/plugins/builtin/cot/index.tsx +1 -1
- package/src/plugins/builtin/cot/model.ts +35 -12
- package/src/plugins/builtin/cot/pane.tsx +4 -3
- package/src/plugins/builtin/credit-boards/cdx-pane.tsx +2 -1
- package/src/plugins/builtin/credit-boards/sovr-pane.tsx +2 -1
- package/src/plugins/builtin/credit-conditions/index.tsx +2 -1
- package/src/plugins/builtin/credit-documents/pane.tsx +8 -7
- package/src/plugins/builtin/crypto-board/client.ts +33 -2
- package/src/plugins/builtin/crypto-board/headless.ts +5 -2
- package/src/plugins/builtin/crypto-board/model.ts +28 -8
- package/src/plugins/builtin/debt-maturities/pane.tsx +4 -3
- package/src/plugins/builtin/dividend-yield/headless.ts +30 -8
- package/src/plugins/builtin/dividend-yield/provider-client.ts +3 -1
- package/src/plugins/builtin/doe/pane.tsx +1 -1
- package/src/plugins/builtin/earnings-calls/headless.ts +4 -4
- package/src/plugins/builtin/earnings-calls/lock-note.ts +12 -3
- package/src/plugins/builtin/econ/calendar-model.ts +35 -0
- package/src/plugins/builtin/econ/index.tsx +31 -4
- package/src/plugins/builtin/econ/print-watch.ts +279 -0
- package/src/plugins/builtin/equity-screener/headless.ts +30 -5
- package/src/plugins/builtin/equity-screener/model.ts +68 -2
- package/src/plugins/builtin/equity-screener/pane.tsx +129 -119
- package/src/plugins/builtin/estimate-revisions/headless.ts +3 -2
- package/src/plugins/builtin/estimate-revisions/lock-note.ts +29 -7
- package/src/plugins/builtin/exposure/client.ts +4 -1
- package/src/plugins/builtin/exposure/editor.tsx +3 -3
- package/src/plugins/builtin/exposure/evidence.ts +4 -1
- package/src/plugins/builtin/exposure/holdings.ts +3 -1
- package/src/plugins/builtin/exposure/pane.tsx +43 -21
- package/src/plugins/builtin/filing-events/index.tsx +9 -3
- package/src/plugins/builtin/futures/table.tsx +6 -3
- package/src/plugins/builtin/futures-curve/pane.tsx +2 -2
- package/src/plugins/builtin/gpu/board.tsx +4 -1
- package/src/plugins/builtin/gpu/changes.tsx +10 -10
- package/src/plugins/builtin/gpu/equities.tsx +4 -1
- package/src/plugins/builtin/gpu/history.tsx +4 -2
- package/src/plugins/builtin/gpu/pane.tsx +5 -3
- package/src/plugins/builtin/holders/client.ts +2 -1
- package/src/plugins/builtin/holders/headless.ts +2 -1
- package/src/plugins/builtin/holders/thirteenf-match.ts +3 -1
- package/src/plugins/builtin/insider/base-values.ts +76 -0
- package/src/plugins/builtin/insider/client.ts +3 -0
- package/src/plugins/builtin/insider/headless.ts +48 -10
- package/src/plugins/builtin/insider/index.tsx +17 -8
- package/src/plugins/builtin/insider/issuer.ts +34 -4
- package/src/plugins/builtin/insider/signals-client.ts +2 -2
- package/src/plugins/builtin/insider/table-model.ts +35 -13
- package/src/plugins/builtin/insider/table.tsx +5 -2
- package/src/plugins/builtin/iv-history/events.ts +145 -0
- package/src/plugins/builtin/iv-history/format.ts +3 -0
- package/src/plugins/builtin/iv-history/headless.ts +91 -7
- package/src/plugins/builtin/jobs/headless.ts +2 -2
- package/src/plugins/builtin/jobs/lock-note.ts +14 -3
- package/src/plugins/builtin/jodi/pane.tsx +4 -4
- package/src/plugins/builtin/market-halts/model.ts +31 -6
- package/src/plugins/builtin/market-halts/pane.tsx +3 -0
- package/src/plugins/builtin/market-movers/client.ts +4 -3
- package/src/plugins/builtin/market-movers/screener.ts +4 -3
- package/src/plugins/builtin/market-valuation/pane.tsx +2 -1
- package/src/plugins/builtin/members/pane.tsx +8 -3
- package/src/plugins/builtin/news/wire/feed-config.ts +29 -12
- package/src/plugins/builtin/news/wire/index.tsx +7 -2
- package/src/plugins/builtin/news/wire/news/preset-pane.tsx +11 -3
- package/src/plugins/builtin/news/wire/rss/cli.ts +3 -2
- package/src/plugins/builtin/news/wire/rss/source.ts +13 -4
- package/src/plugins/builtin/notes/cli.ts +1 -1
- package/src/plugins/builtin/notes/export.ts +17 -6
- package/src/plugins/builtin/notes/files.ts +16 -5
- package/src/plugins/builtin/options/enrichment-model.ts +10 -9
- package/src/plugins/builtin/options/footer.ts +25 -20
- package/src/plugins/builtin/options/live-quotes.ts +33 -18
- package/src/plugins/builtin/options/model-spot.ts +70 -4
- package/src/plugins/builtin/options/view.tsx +118 -35
- package/src/plugins/builtin/options-calculator/pane.tsx +7 -4
- package/src/plugins/builtin/options-positioning/headless.ts +11 -3
- package/src/plugins/builtin/options-positioning/model.ts +24 -0
- package/src/plugins/builtin/options-positioning/pane.tsx +10 -12
- package/src/plugins/builtin/options-scenario/client.ts +19 -1
- package/src/plugins/builtin/options-scenario/headless.ts +13 -6
- package/src/plugins/builtin/options-scenario/pane.tsx +54 -11
- package/src/plugins/builtin/plugin-marketplace/pane.tsx +5 -4
- package/src/plugins/builtin/portfolio-list/account-metrics.ts +3 -0
- package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +8 -5
- package/src/plugins/builtin/portfolio-list/cli/render.ts +34 -10
- package/src/plugins/builtin/portfolio-list/headless.ts +1 -1
- package/src/plugins/builtin/portfolio-list/pane/data.ts +23 -1
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +33 -14
- package/src/plugins/builtin/portfolio-list/settings.ts +20 -2
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +12 -0
- package/src/plugins/builtin/portfolio-list/summary/totals.ts +24 -3
- package/src/plugins/builtin/power/client.ts +2 -2
- package/src/plugins/builtin/power/pane.tsx +36 -31
- package/src/plugins/builtin/primary-dealers/client.ts +137 -62
- package/src/plugins/builtin/primary-dealers/headless.ts +30 -5
- package/src/plugins/builtin/primary-dealers/index.tsx +3 -2
- package/src/plugins/builtin/primary-dealers/model.ts +179 -129
- package/src/plugins/builtin/primary-dealers/pane.tsx +135 -15
- package/src/plugins/builtin/research/analyst-model.ts +5 -1
- package/src/plugins/builtin/reverse-dcf/client.ts +2 -1
- package/src/plugins/builtin/reverse-dcf/model.ts +4 -3
- package/src/plugins/builtin/risk-factors/index.tsx +12 -3
- package/src/plugins/builtin/scanner/feed.ts +6 -1
- package/src/plugins/builtin/scanner/headless.ts +1 -1
- package/src/plugins/builtin/scanner/lock-note.ts +3 -2
- package/src/plugins/builtin/seasonality/client.ts +2 -1
- package/src/plugins/builtin/sectors/client.ts +4 -3
- package/src/plugins/builtin/series-inventory.ts +1 -0
- package/src/plugins/builtin/shared/cloud-denied.ts +7 -6
- package/src/plugins/builtin/shared/cloud-resource.ts +15 -2
- package/src/plugins/builtin/shared/cloud-upgrade.ts +10 -11
- package/src/plugins/builtin/shared/free-routes.ts +24 -0
- package/src/plugins/builtin/shared/headless-options.ts +11 -0
- package/src/plugins/builtin/shared/pro-lock-note.ts +89 -7
- package/src/plugins/builtin/shared/research-trading.tsx +64 -0
- package/src/plugins/builtin/shared/series-list-detail.tsx +3 -1
- package/src/plugins/builtin/shared/volatility/options.ts +2 -1
- package/src/plugins/builtin/social-mentions/client.ts +2 -1
- package/src/plugins/builtin/social-mentions/headless.ts +1 -1
- package/src/plugins/builtin/social-mentions/lock-note.ts +1 -1
- package/src/plugins/builtin/themes/headless.ts +8 -2
- package/src/plugins/builtin/themes/model.ts +43 -10
- package/src/plugins/builtin/themes/pane.tsx +8 -6
- package/src/plugins/builtin/ticker-detail/overview/model.ts +44 -10
- package/src/plugins/builtin/ticker-detail/overview/option-contract.ts +64 -0
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +82 -21
- package/src/plugins/builtin/ticker-detail/pane.tsx +21 -14
- package/src/plugins/builtin/ticker-detail/quote-footer.ts +5 -1
- package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +37 -8
- package/src/plugins/builtin/time-sales/pane.tsx +2 -2
- package/src/plugins/builtin/trace-bonds/client.ts +14 -3
- package/src/plugins/builtin/trace-bonds/headless.ts +1 -1
- package/src/plugins/builtin/vol-surface/client.ts +23 -3
- package/src/plugins/builtin/vol-surface/headless.ts +33 -14
- package/src/plugins/builtin/vol-surface/model.ts +30 -10
- package/src/plugins/builtin/vol-surface/pane.tsx +35 -15
- package/src/plugins/builtin/vol-surface/stored.ts +34 -3
- package/src/plugins/builtin/vol-surface/tables.ts +14 -0
- package/src/plugins/builtin-editorial.ts +1 -1
- package/src/plugins/compat.ts +3 -0
- package/src/plugins/external-runtime.ts +5 -0
- package/src/plugins/loader.ts +6 -0
- package/src/plugins/plugin-icon.ts +61 -0
- package/src/plugins/registry/host-actions.ts +2 -1
- package/src/plugins/registry/index.ts +9 -1
- package/src/plugins/runtime/context.tsx +5 -0
- package/src/plugins/runtime/index.tsx +3 -0
- package/src/portfolio/column-values.ts +13 -4
- package/src/portfolio/cost-fx.ts +5 -28
- package/src/public/__snapshots__/public-api.test.ts.snap +5 -0
- package/src/public/broker.ts +8 -0
- package/src/public/market-data.ts +5 -0
- package/src/renderers/dom/desktop/control-styles.ts +7 -1
- package/src/renderers/dom/desktop/controls.tsx +40 -8
- package/src/renderers/dom/desktop/icons.tsx +14 -0
- package/src/renderers/dom/desktop/list-view.tsx +51 -19
- package/src/renderers/dom/desktop/menu.tsx +10 -1
- package/src/renderers/dom/desktop/query-bar.tsx +2 -0
- package/src/renderers/dom/desktop/select-field.tsx +8 -6
- package/src/renderers/dom/host/style.ts +6 -1
- package/src/renderers/dom/host/tabs.tsx +22 -5
- package/src/renderers/dom/host/top-surface.ts +127 -0
- package/src/renderers/dom/styles.css +51 -5
- package/src/renderers/electrobun/bun/core-capabilities.ts +21 -1
- package/src/renderers/electrobun/bun/desktop/backend.ts +10 -0
- package/src/renderers/electrobun/bun/desktop/update.ts +210 -30
- package/src/renderers/electrobun/bun/external-plugins.ts +3 -0
- package/src/renderers/electrobun/shared/protocol.ts +2 -0
- package/src/renderers/electrobun/view/broker-remote-client.ts +16 -0
- package/src/renderers/electrobun/view/external-plugins.ts +1 -0
- package/src/renderers/electrobun/view/news-source.ts +4 -2
- package/src/renderers/electrobun/view/remote/asset-data-client.ts +8 -1
- package/src/renderers/opentui/start.tsx +7 -0
- package/src/series/validate.ts +2 -2
- package/src/sources/gloomberb-cloud/index.ts +57 -17
- package/src/sources/gloomberb-cloud/normalizers.ts +4 -0
- package/src/sources/history-result.ts +3 -0
- package/src/sources/provider-errors.ts +3 -1
- package/src/sources/provider-router/history.ts +49 -6
- package/src/sources/provider-router/index.ts +18 -1
- package/src/state/app/activity.ts +13 -0
- package/src/sync/controller.ts +4 -0
- package/src/sync/core-contributors.ts +62 -11
- package/src/sync/local-only.ts +121 -0
- package/src/sync/react.ts +6 -0
- package/src/sync/types.ts +3 -0
- package/src/telemetry/crash-reports.ts +4 -0
- package/src/telemetry/update-failures-node.ts +59 -0
- package/src/telemetry/update-failures.ts +307 -0
- package/src/tickers/company-name-listing.ts +9 -7
- package/src/tickers/company-name.ts +43 -0
- package/src/tickers/listing-fate.ts +57 -8
- package/src/tickers/search/index.ts +24 -3
- package/src/time-series/price-comparison.ts +35 -0
- package/src/time-series/resolve.ts +52 -11
- package/src/time-series/spec.ts +1 -1
- package/src/time-series/types.ts +5 -0
- package/src/types/broker.ts +56 -1
- package/src/types/config.ts +6 -0
- package/src/types/data-provider.ts +11 -1
- package/src/types/financials.ts +23 -0
- package/src/types/headless.ts +19 -2
- package/src/types/instrument.ts +4 -0
- package/src/types/issuer-listings.ts +28 -0
- package/src/types/plugin.ts +24 -6
- package/src/types/price-history.ts +6 -1
- package/src/types/trading.ts +67 -0
- package/src/ui/host.tsx +4 -0
- package/src/updater/failure.ts +163 -0
- package/src/updater/index.ts +87 -23
- package/src/utils/base-currency.ts +108 -0
- package/src/utils/currency-names.ts +128 -0
- package/src/utils/currency-pair.ts +28 -1
- package/src/utils/currency-units.ts +32 -1
- package/src/utils/dom-screenshot.ts +22 -9
- package/src/utils/exchange-notation.generated.ts +360 -0
- package/src/utils/exchanges.ts +15 -322
- package/src/utils/format.ts +31 -1
- package/src/utils/instrument-identity.ts +38 -1
- package/src/utils/options.ts +46 -1
- package/src/utils/price-history.ts +4 -0
- package/src/utils/reported-money.ts +8 -4
- package/src/utils/sec.ts +68 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { canonicalExchange, parsePublicTickerKey } from "../../../utils/exchanges";
|
|
2
|
+
import { parseOptionTicker } from "../../../utils/options";
|
|
3
|
+
import type { PaneTickerIdentity } from "../../../state/hooks/pane-ticker";
|
|
4
|
+
import type { BrokerAdapter, BrokerPosition } from "../../../types/broker";
|
|
5
|
+
import type { BrokerInstanceConfig } from "../../../types/config";
|
|
6
|
+
import type { BrokerContractRef } from "../../../types/instrument";
|
|
7
|
+
import type { Quote } from "../../../types/financials";
|
|
8
|
+
import type { BrokerAccount, BrokerOrderRequest, BrokerTradingCapabilities } from "../../../types/trading";
|
|
9
|
+
import type { BrokerAccountChoice } from "./account-picker";
|
|
10
|
+
import { reverseStrategy, strategyContract, strategyOrderLegs, type StrategyIntent } from "./strategy";
|
|
11
|
+
|
|
12
|
+
/** Successful broker reads may publish status heartbeats. They must not schedule another read. */
|
|
13
|
+
export function subscribeTradingStatus(broker: BrokerAdapter, profile: BrokerInstanceConfig, onChange: () => void): () => void {
|
|
14
|
+
const key = () => {
|
|
15
|
+
const status = broker.getStatus?.(profile);
|
|
16
|
+
return JSON.stringify([status?.state, status?.mode, status?.quoteData]);
|
|
17
|
+
};
|
|
18
|
+
let previous = key();
|
|
19
|
+
return broker.subscribeStatus?.(profile, () => {
|
|
20
|
+
const next = key();
|
|
21
|
+
if (next === previous) return;
|
|
22
|
+
previous = next;
|
|
23
|
+
onChange();
|
|
24
|
+
}) ?? (() => {});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface ProfileAccountChoice extends BrokerAccountChoice { profileId: string; accountId: string }
|
|
28
|
+
|
|
29
|
+
export function ticketAccountChoiceKey(profileId: string, accountId: string): string { return JSON.stringify([profileId, accountId]); }
|
|
30
|
+
|
|
31
|
+
export function buildTicketAccountChoices(profiles: { profile: BrokerInstanceConfig; accounts: BrokerAccount[] }[]): ProfileAccountChoice[] {
|
|
32
|
+
return profiles.flatMap(({ profile, accounts }) => accounts.map((account, index) => ({
|
|
33
|
+
value: ticketAccountChoiceKey(profile.id, account.accountId), label: account.name || `Account ${index + 1}`, profileLabel: profile.label,
|
|
34
|
+
tradingMode: account.tradingMode, profileId: profile.id, accountId: account.accountId,
|
|
35
|
+
})));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface TicketPositionSnapshot {
|
|
39
|
+
profile: BrokerInstanceConfig;
|
|
40
|
+
positions: BrokerPosition[];
|
|
41
|
+
fetchedAt: number;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** A missing or expired snapshot is unknown, while a successful empty snapshot means zero. */
|
|
45
|
+
export function ticketPositionContext(
|
|
46
|
+
snapshot: TicketPositionSnapshot | undefined, profile: BrokerInstanceConfig, accountId: string | undefined, contract: BrokerContractRef, now = Date.now(),
|
|
47
|
+
): { quantity: number; avgCost?: number; pnl?: number } | undefined {
|
|
48
|
+
if (!snapshot || !accountId || snapshot.profile.id !== profile.id || snapshot.profile.config !== profile.config || now - snapshot.fetchedAt > 60_000 || !contract.symbol) return undefined;
|
|
49
|
+
const normalize = (symbol: string) => symbol.replace(/^O:/, "").replace(/\s+/g, "").toUpperCase();
|
|
50
|
+
const stock = (type: string | undefined) => !type || type === "STK" || type === "ETF";
|
|
51
|
+
const matched = snapshot.positions.filter((position) => {
|
|
52
|
+
if (position.accountId !== accountId) return false;
|
|
53
|
+
const held = position.brokerContract;
|
|
54
|
+
if (!held) return stock(contract.secType) && stock(position.assetCategory) && normalize(position.ticker) === normalize(contract.symbol);
|
|
55
|
+
if (held.brokerId !== contract.brokerId || (held.brokerInstanceId && held.brokerInstanceId !== profile.id)) return false;
|
|
56
|
+
if (held.conId !== undefined && contract.conId !== undefined) return held.conId === contract.conId;
|
|
57
|
+
if (!(stock(held.secType) && stock(contract.secType)) && held.secType !== contract.secType) return false;
|
|
58
|
+
if (held.localSymbol && contract.localSymbol && normalize(held.localSymbol) === normalize(contract.localSymbol) && (stock(contract.secType) || normalize(contract.localSymbol) !== normalize(contract.symbol))) return true;
|
|
59
|
+
if (normalize(held.symbol) !== normalize(contract.symbol)) return false;
|
|
60
|
+
if (stock(contract.secType)) return true;
|
|
61
|
+
return !!contract.lastTradeDateOrContractMonth && held.lastTradeDateOrContractMonth === contract.lastTradeDateOrContractMonth && held.right === contract.right && held.strike === contract.strike && held.multiplier === contract.multiplier;
|
|
62
|
+
});
|
|
63
|
+
if (matched.some((position) => !Number.isFinite(position.shares))) return undefined;
|
|
64
|
+
const quantity = matched.reduce((total, position) => total + (position.side === "short" ? -Math.abs(position.shares) : position.shares), 0);
|
|
65
|
+
const weight = matched.reduce((total, position) => total + Math.abs(position.shares), 0);
|
|
66
|
+
const avgCost = weight > 0 && matched.every((position) => position.avgCost !== undefined && Number.isFinite(position.avgCost)) ? matched.reduce((total, position) => total + position.avgCost! * Math.abs(position.shares), 0) / weight : undefined;
|
|
67
|
+
const pnl = matched.length && matched.every((position) => position.unrealizedPnl !== undefined && Number.isFinite(position.unrealizedPnl)) ? matched.reduce((total, position) => total + position.unrealizedPnl!, 0) : undefined;
|
|
68
|
+
return { quantity, avgCost, pnl };
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function availableTicketPosition(snapshot: TicketPositionSnapshot | undefined, profile: BrokerInstanceConfig, accountId: string | undefined, contract: BrokerContractRef, now = Date.now()): number | undefined {
|
|
72
|
+
return ticketPositionContext(snapshot, profile, accountId, contract, now)?.quantity;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Quick sizing rounds down to the broker's allowed increment and never assumes margin. */
|
|
76
|
+
export function quickTicketQuantity(draft: BrokerOrderRequest, capabilities: BrokerTradingCapabilities, quote: Quote | undefined, account: BrokerAccount | undefined, held: number | undefined, fraction: number): number {
|
|
77
|
+
let maximum: number;
|
|
78
|
+
if (draft.action === "SELL") {
|
|
79
|
+
if (held === undefined || !Number.isFinite(held) || held <= 0) throw new Error("Refresh the held position before choosing a sell quantity.");
|
|
80
|
+
maximum = held;
|
|
81
|
+
} else {
|
|
82
|
+
const brokerPrice = quote?.ask ?? quote?.price;
|
|
83
|
+
const multiplier = Number(draft.contract.multiplier ?? 1);
|
|
84
|
+
const price = Math.max(brokerPrice ?? NaN, draft.limitPrice ?? 0, draft.stopPrice ?? 0);
|
|
85
|
+
if (!Number.isFinite(price) || price <= 0 || !Number.isFinite(multiplier) || multiplier <= 0
|
|
86
|
+
|| account?.buyingPower === undefined || !Number.isFinite(account.buyingPower) || account.buyingPower <= 0) {
|
|
87
|
+
throw new Error("Load the broker quote and buying power before choosing a buy quantity.");
|
|
88
|
+
}
|
|
89
|
+
maximum = account.buyingPower / (price * multiplier);
|
|
90
|
+
}
|
|
91
|
+
const step = capabilities.quantityStep ?? (capabilities.fractionalQuantity ? 0.000001 : 1);
|
|
92
|
+
if (!Number.isFinite(step) || step <= 0 || !Number.isFinite(fraction) || fraction <= 0 || fraction > 1) throw new Error("This broker cannot calculate a valid quick quantity.");
|
|
93
|
+
const target = maximum * fraction;
|
|
94
|
+
let quantity = Number((Math.floor(target / step + 1e-10) * step).toFixed(8));
|
|
95
|
+
if (!capabilities.fractionalQuantity && !Number.isInteger(quantity)) {
|
|
96
|
+
quantity = Math.floor(quantity);
|
|
97
|
+
for (let count = 0; count < 1000 && quantity > 0 && Math.abs(quantity / step - Math.round(quantity / step)) > 1e-8; count++) quantity--;
|
|
98
|
+
}
|
|
99
|
+
if (!Number.isFinite(quantity) || quantity <= 0 || quantity < (capabilities.minQuantity ?? 0) || quantity > maximum + 1e-8
|
|
100
|
+
|| Math.abs(quantity / step - Math.round(quantity / step)) > 1e-8) {
|
|
101
|
+
throw new Error("The available amount is below the broker's minimum order quantity.");
|
|
102
|
+
}
|
|
103
|
+
return quantity;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const LISTING_SEC_TYPES: Record<string, string> = {
|
|
107
|
+
stock: "STK", equity: "STK", etf: "ETF", option: "OPT", future: "FUT", futures: "FUT", bond: "BOND", crypto: "CRYPTO", currency: "CASH", forex: "CASH",
|
|
108
|
+
};
|
|
109
|
+
/** A ticker's category as a broker security type: a saved ticker carries one ("STK", "ETF"), a listing picked in search its type ("stock"). */
|
|
110
|
+
export function tickerSecType(category: string | undefined, fallback = "STK"): string {
|
|
111
|
+
return category ? LISTING_SEC_TYPES[category.toLowerCase()] ?? category.toUpperCase() : fallback;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Broker contract IDs are meaningful only inside their original broker
|
|
116
|
+
* profile. A pane on another broker's or profile's contract (a search result
|
|
117
|
+
* or position from it) trades here by its public listing, as a pane on a plain
|
|
118
|
+
* listing does: its symbol, type, currency and venue, and an option's series.
|
|
119
|
+
* The other broker's IDs never carry over.
|
|
120
|
+
*/
|
|
121
|
+
export function resolveTicketContract(identity: PaneTickerIdentity, broker: BrokerAdapter, instance: BrokerInstanceConfig): { contract?: BrokerContractRef; error?: string } {
|
|
122
|
+
if (identity.error) return { error: identity.error };
|
|
123
|
+
if (!identity.symbol) return { error: "Choose a ticker to trade." };
|
|
124
|
+
const held = identity.contract ?? undefined;
|
|
125
|
+
if (held && held.brokerId === broker.id && (!held.brokerInstanceId || held.brokerInstanceId === instance.id)) {
|
|
126
|
+
return { contract: { ...held, brokerInstanceId: instance.id } };
|
|
127
|
+
}
|
|
128
|
+
const listing = parsePublicTickerKey(identity.symbol);
|
|
129
|
+
const secType = held?.secType ? tickerSecType(held.secType) : tickerSecType(identity.ticker?.metadata.assetCategory);
|
|
130
|
+
// A combination is its legs' IDs at the broker that built it, which name nothing here.
|
|
131
|
+
if (secType === "BAG") return { error: `${broker.name} cannot trade ${listing.symbol}.` };
|
|
132
|
+
const venue = [listing.exchange, identity.ticker?.metadata.exchange, held?.primaryExchange, held?.exchange].find((value) => !!value && canonicalExchange(value) !== "SMART");
|
|
133
|
+
const series = secType === "OPT" && held ? Object.fromEntries(Object.entries({ lastTradeDateOrContractMonth: held.lastTradeDateOrContractMonth, right: held.right, strike: held.strike, multiplier: held.multiplier })
|
|
134
|
+
.filter(([, value]) => value !== undefined)) as Partial<BrokerContractRef> : {};
|
|
135
|
+
return { contract: { brokerId: broker.id, brokerInstanceId: instance.id, symbol: listing.symbol, localSymbol: listing.symbol,
|
|
136
|
+
secType, currency: identity.ticker?.metadata.currency || held?.currency || "USD", exchange: venue,
|
|
137
|
+
// A listed option's OCC symbol names a standard contract of 100 shares, which its costs count.
|
|
138
|
+
...(secType === "OPT" && parseOptionTicker(listing.symbol) ? { multiplier: "100" } : {}), ...series } };
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export function chooseTicketAccount(accounts: BrokerAccount[], previous?: string): string | undefined {
|
|
142
|
+
if (accounts.some((account) => account.accountId === previous)) return previous;
|
|
143
|
+
return accounts.length === 1 && accounts[0]?.tradingMode === "simulation" ? accounts[0].accountId : undefined;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function defaultQuantity(capabilities: BrokerTradingCapabilities | undefined): number {
|
|
147
|
+
const minimum = capabilities?.minQuantity;
|
|
148
|
+
const start = Math.max(1, minimum && Number.isFinite(minimum) ? minimum : 1);
|
|
149
|
+
const step = capabilities?.quantityStep;
|
|
150
|
+
if (!step || !Number.isFinite(step) || step <= 0) return capabilities?.fractionalQuantity ? start : Math.ceil(start);
|
|
151
|
+
const quantity = Number((Math.ceil(start / step - 1e-10) * step).toFixed(8));
|
|
152
|
+
if (capabilities?.fractionalQuantity || Number.isInteger(quantity)) return quantity;
|
|
153
|
+
// Some brokers combine a fractional increment with whole-quantity instruments.
|
|
154
|
+
// Never prefill an invalid amount if those constraints cannot be reconciled.
|
|
155
|
+
for (let integer = Math.ceil(start); integer <= Math.ceil(start) + 1000; integer++) {
|
|
156
|
+
if (Math.abs(integer / step - Math.round(integer / step)) < 1e-8) return integer;
|
|
157
|
+
}
|
|
158
|
+
return NaN;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export function newTicketDraft(broker: BrokerAdapter, instance: BrokerInstanceConfig, contract: BrokerContractRef, accountId?: string, action: "BUY" | "SELL" = "BUY"): BrokerOrderRequest {
|
|
162
|
+
const initial = broker.getTradingCapabilities?.(instance, contract);
|
|
163
|
+
const orderType = initial?.orderTypes.includes("LMT") ? "LMT" : initial?.orderTypes[0] ?? "LMT";
|
|
164
|
+
const capabilities = broker.getTradingCapabilities?.(instance, contract, orderType) ?? initial;
|
|
165
|
+
const tif = capabilities?.tif.includes("DAY") ? "DAY" : capabilities?.tif[0];
|
|
166
|
+
return { brokerInstanceId: instance.id, accountId, contract, action, orderType, quantity: defaultQuantity(capabilities), tif };
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* A spread on the underlying this ticket trades, on the ticket's profile.
|
|
171
|
+
* Throws when the broker takes no spread of this size or a leg is not a
|
|
172
|
+
* listed contract of the underlying.
|
|
173
|
+
*/
|
|
174
|
+
export function newStrategyDraft(broker: BrokerAdapter, instance: BrokerInstanceConfig, underlying: BrokerContractRef, intent: StrategyIntent, accountId?: string): BrokerOrderRequest {
|
|
175
|
+
if (underlying.secType && !["STK", "ETF"].includes(underlying.secType.toUpperCase())) throw new Error("Open the spread from its underlying stock or fund.");
|
|
176
|
+
const contract = strategyContract({ ...underlying, brokerInstanceId: instance.id });
|
|
177
|
+
const capabilities = broker.getTradingCapabilities?.(instance, contract);
|
|
178
|
+
// Trading switched off still opens the spread, with the ticket's Enable trading; a broker that rejects the contract does not.
|
|
179
|
+
if (capabilities && !capabilities.orderTypes.length && capabilities.disabledReason) throw new Error(capabilities.disabledReason);
|
|
180
|
+
if (!capabilities || (capabilities.maxLegs ?? 0) < Math.max(2, intent.legs.length)) {
|
|
181
|
+
throw new Error(capabilities?.maxLegs ? `${broker.name} takes spreads of 2 to ${capabilities.maxLegs} legs.` : `${broker.name} does not take multi-leg orders here.`);
|
|
182
|
+
}
|
|
183
|
+
const legs = strategyOrderLegs(intent.legs, contract, contract.currency);
|
|
184
|
+
if (!legs) throw new Error(`Every leg must be a listed ${contract.symbol} option.`);
|
|
185
|
+
const draft = newTicketDraft(broker, instance, contract, accountId, intent.action);
|
|
186
|
+
return { ...draft, legs, quantity: intent.quantity };
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export function editTicketDraft(broker: BrokerAdapter, instance: BrokerInstanceConfig, draft: BrokerOrderRequest, field: string, value: string | boolean): BrokerOrderRequest {
|
|
190
|
+
// Switching a spread's side is the opposite trade: every leg turns over.
|
|
191
|
+
// A debit is not a credit, so the price starts again from the quote.
|
|
192
|
+
if (field === "action" && draft.legs?.length) {
|
|
193
|
+
if (value === draft.action) return draft;
|
|
194
|
+
const { limitPrice: _debit, ...reversed } = reverseStrategy(draft);
|
|
195
|
+
return reversed;
|
|
196
|
+
}
|
|
197
|
+
const numeric = ["quantity", "limitPrice", "stopPrice"].includes(field);
|
|
198
|
+
const next = { ...draft, [field]: numeric ? value === "" ? field === "quantity" ? NaN : undefined : Number(value) : value };
|
|
199
|
+
if (field === "orderType") {
|
|
200
|
+
if (next.orderType !== "LMT" && next.orderType !== "STP LMT") delete next.limitPrice;
|
|
201
|
+
if (next.orderType !== "STP" && next.orderType !== "STP LMT") delete next.stopPrice;
|
|
202
|
+
}
|
|
203
|
+
const capabilities = broker.getTradingCapabilities?.(instance, next.contract, next.orderType);
|
|
204
|
+
if (capabilities && !capabilities.tif.includes(next.tif ?? "DAY")) next.tif = capabilities.tif[0];
|
|
205
|
+
if (!capabilities?.extendedHours || (capabilities.extendedHoursTif && !capabilities.extendedHoursTif.includes(next.tif ?? "DAY"))) next.outsideRth = false;
|
|
206
|
+
return next;
|
|
207
|
+
}
|