@gloom-sh/terminal 0.20.21 → 0.20.22
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 +4 -3
- package/patches/electrobun-devkit@2.0.5.patch +169 -3
- package/src/api-client/buybacks.ts +108 -0
- package/src/api-client/data.ts +213 -1
- package/src/api-client/dilution.ts +183 -0
- package/src/api-client/earnings.ts +2 -2
- package/src/api-client/equity-screener.ts +7 -0
- package/src/api-client/exchange-announcements.ts +16 -5
- package/src/api-client/exchange-short-balances.ts +24 -0
- package/src/api-client/hk-cbbc.ts +134 -0
- package/src/api-client/hk-ccass.ts +233 -0
- package/src/api-client/index.ts +55 -3
- package/src/api-client/jpx-short-positions.ts +24 -0
- package/src/api-client/market-discovery.ts +34 -6
- package/src/api-client/members.ts +5 -0
- package/src/api-client/ownership-disclosures.ts +35 -0
- package/src/api-client/paths.ts +2 -2
- package/src/api-client/request.ts +39 -10
- package/src/api-client/revenue-breakdown.ts +6 -2
- package/src/api-client/sfc-short-positions.ts +19 -0
- package/src/api-client/supply-chain.ts +22 -0
- package/src/api-client/taiwan-revenue.ts +134 -0
- package/src/api-client/types/jobs.ts +1 -0
- package/src/api-client/types/world-venues.ts +1 -0
- package/src/app/language-observer.tsx +6 -1
- package/src/app/pane-runtime/plugin-bindings.ts +9 -4
- package/src/app/runtime/plugin-bindings.ts +20 -2
- package/src/architecture/core-builtin-allowlist.json +2 -2
- package/src/architecture/dom-text-cuts-allowlist.json +2 -2
- package/src/architecture/floating-promise-allowlist.json +2 -2
- package/src/architecture/pane-tabs-allowlist.json +3 -0
- package/src/brokers/account-cache.ts +2 -1
- package/src/brokers/account-choice.ts +121 -0
- package/src/brokers/broker-portfolio-sync.ts +30 -5
- package/src/brokers/profile-form.ts +3 -0
- package/src/brokers/signed-in/adapter.ts +16 -5
- package/src/brokers/sync-broker-instance.ts +27 -3
- package/src/capabilities/asset-data-inputs.ts +8 -0
- package/src/capabilities/factories.ts +4 -0
- package/src/cli/commands/market.ts +136 -73
- package/src/cli/commands/news-search.ts +12 -0
- package/src/cli/commands/options-chain.ts +9 -3
- package/src/cli/commands/options-leaps.ts +55 -30
- package/src/cli/commands/overview.ts +14 -15
- package/src/cli/commands/search.ts +2 -1
- package/src/cli/commands/ticker.ts +17 -18
- package/src/cli/csv-export.ts +9 -5
- package/src/cli/desktop-pane-shot-browser.ts +143 -53
- package/src/cli/desktop-pane-shot.ts +50 -64
- package/src/cli/export-source.ts +9 -4
- package/src/cli/history-demergers.ts +134 -11
- package/src/cli/history-rows.ts +47 -7
- package/src/cli/pane-functions/catalog-snapshot.json +26 -22
- package/src/cli/pane-functions/catalog.ts +6 -2
- package/src/cli/pane-functions/dom.ts +8 -5
- package/src/cli/pane-functions/function-help.ts +34 -2
- package/src/cli/pane-functions/headless.ts +79 -27
- package/src/cli/pane-functions/index.ts +2 -1
- package/src/cli/pane-functions/market-session.ts +1 -1
- package/src/cli/pane-functions/resolver.ts +4 -1
- package/src/cli/pane-functions/screenshot-assessment.ts +26 -10
- package/src/cli/pane-functions/screenshot-bridge.ts +4 -1
- package/src/cli/pane-functions/screenshot-data-evidence.ts +11 -5
- package/src/cli/pane-functions/screenshot-payload.ts +18 -2
- package/src/cli/pane-functions/screenshot-render.ts +2 -0
- package/src/cli/pane-functions/ticker-question.ts +52 -47
- package/src/cli/rendered-table-rows.ts +75 -0
- package/src/cli/report-tables.ts +7 -1
- package/src/cli/result.ts +9 -2
- package/src/cli/visible-key-values.ts +3 -2
- package/src/components/chart/composite/format.ts +14 -1
- package/src/components/chart/composite/panel-surface/panel-cursor.tsx +37 -14
- package/src/components/chart/composite/panel-surface.tsx +1 -0
- package/src/components/chart/composite/text-renderer.ts +104 -44
- package/src/components/chart/curve/model.ts +4 -1
- package/src/components/command-bar/routes/root/start-here.ts +1 -1
- package/src/components/command-bar/routes/ticker-search/results.ts +2 -1
- package/src/components/data-table/export.ts +3 -1
- package/src/components/data-table/sections.ts +12 -1
- package/src/components/data-table/view.tsx +50 -8
- package/src/components/feed-data-table/stack-view.tsx +3 -0
- package/src/components/index.ts +3 -3
- package/src/components/layout/floating-pane.tsx +5 -2
- package/src/components/layout/pane/header.tsx +21 -2
- package/src/components/layout/pane/index.tsx +6 -2
- package/src/components/layout/pane/link-note.ts +12 -0
- package/src/components/layout/pane/title.ts +1 -3
- package/src/components/market-board/index.tsx +8 -11
- package/src/components/reader/reader-text.tsx +25 -2
- package/src/components/ticker/list-table-view.tsx +4 -0
- package/src/components/ui/data-table/column-fit.ts +129 -0
- package/src/components/ui/data-table/display-columns.ts +28 -9
- package/src/components/ui/data-table/index.tsx +57 -15
- package/src/components/ui/data-table/opentui/index.tsx +5 -0
- package/src/components/ui/data-table/types.ts +96 -5
- package/src/components/ui/data-table/visible-range.ts +9 -1
- package/src/components/ui/day-cell.ts +30 -0
- package/src/components/ui/index.ts +3 -1
- package/src/components/ui/prose.tsx +3 -1
- package/src/components/ui/table-layout.ts +188 -6
- package/src/core/state/app/layout.ts +7 -2
- package/src/core/state/app/state.ts +6 -2
- package/src/data/config/store/legacy-tabs.ts +51 -0
- package/src/data/config/store/node.ts +2 -2
- package/src/data/config/store/normalize.ts +11 -5
- package/src/data/config/store/shared-file.ts +8 -7
- package/src/data/config/store/shared-layout.ts +146 -0
- package/src/data/sqlite/access.ts +76 -11
- package/src/data/sqlite/checkpointer.ts +73 -10
- package/src/data/sqlite/database.ts +14 -1
- package/src/data/sqlite/retry.ts +1 -1
- package/src/docs/load.ts +5 -2
- package/src/docs/snapshot.json +1648 -4396
- package/src/i18n/es.ts +108 -0
- package/src/i18n/index.ts +74 -4
- package/src/i18n/ja.ts +108 -0
- package/src/i18n/ko.ts +108 -0
- package/src/i18n/react.ts +10 -2
- package/src/i18n/zh-cn.ts +108 -0
- package/src/i18n/zh-tw.ts +108 -0
- package/src/layout/pane-manager/dock-normalization.ts +61 -0
- package/src/market-data/ah-pair.ts +7 -2
- package/src/market-data/fund-actions.ts +21 -0
- package/src/market-data/market/freshness.ts +37 -33
- package/src/market-data/market/split-price-basis.ts +55 -0
- package/src/market-data/market/status.ts +2 -4
- package/src/market-data/price-adjustments.ts +115 -0
- package/src/market-data/quotes/balance-sheet-rate.ts +6 -2
- package/src/market-data/quotes/day-range.ts +24 -9
- package/src/market-data/quotes/freshness.ts +4 -3
- package/src/market-data/quotes/regular-session-valuation.ts +6 -0
- package/src/market-data/quotes/resolution.ts +18 -29
- package/src/market-data/quotes/time.ts +138 -14
- package/src/news/query-presets.ts +6 -4
- package/src/plugins/builtin/alerts/cli-forms.ts +3 -0
- package/src/plugins/builtin/alerts/cli.ts +19 -7
- package/src/plugins/builtin/alerts/events-pane.tsx +1 -0
- package/src/plugins/builtin/alerts/format.ts +22 -10
- package/src/plugins/builtin/alerts/headless.ts +7 -4
- package/src/plugins/builtin/alerts/history-pane.tsx +74 -33
- package/src/plugins/builtin/alerts/history-rows.ts +24 -1
- package/src/plugins/builtin/alerts/index.tsx +8 -10
- package/src/plugins/builtin/alerts/metric-data.ts +24 -6
- package/src/plugins/builtin/alerts/pane.tsx +9 -0
- package/src/plugins/builtin/alerts/pro-rules.ts +1 -0
- package/src/plugins/builtin/alerts/research-builder.ts +6 -2
- package/src/plugins/builtin/alerts/research-rules.ts +12 -0
- package/src/plugins/builtin/alerts/types.ts +1 -0
- package/src/plugins/builtin/awards/detail.tsx +5 -4
- package/src/plugins/builtin/awards/headless.ts +13 -4
- package/src/plugins/builtin/awards/model.ts +36 -1
- package/src/plugins/builtin/awards/pane.tsx +29 -9
- package/src/plugins/builtin/backtest/pane.tsx +4 -2
- package/src/plugins/builtin/bond-calculator/pane.tsx +2 -1
- package/src/plugins/builtin/broker-manager/detail.tsx +67 -4
- package/src/plugins/builtin/broker-manager/index.tsx +35 -4
- package/src/plugins/builtin/broker-manager/keyboard.ts +10 -0
- package/src/plugins/builtin/broker-manager/pane-actions.tsx +35 -2
- package/src/plugins/builtin/broker-trading/orders.tsx +10 -3
- package/src/plugins/builtin/broker-trading/ticket.tsx +1 -0
- package/src/plugins/builtin/buildout/format.ts +3 -1
- package/src/plugins/builtin/buybacks/client.ts +48 -0
- package/src/plugins/builtin/buybacks/index.tsx +22 -0
- package/src/plugins/builtin/buybacks/model.ts +151 -0
- package/src/plugins/builtin/buybacks/pane.tsx +140 -0
- package/src/plugins/builtin/buybacks/series.ts +36 -0
- package/src/plugins/builtin/catalysts/detail.tsx +14 -8
- package/src/plugins/builtin/catalysts/evidence.ts +11 -3
- package/src/plugins/builtin/catalysts/headless.ts +51 -8
- package/src/plugins/builtin/catalysts/kinds.ts +413 -0
- package/src/plugins/builtin/catalysts/model.ts +61 -18
- package/src/plugins/builtin/catalysts/pane.tsx +85 -19
- package/src/plugins/builtin/cds/client.ts +9 -2
- package/src/plugins/builtin/cds/headless.ts +25 -10
- package/src/plugins/builtin/cds/model.ts +37 -12
- package/src/plugins/builtin/cds/pane.tsx +18 -10
- package/src/plugins/builtin/chart-composer/chart-spec-edit.ts +68 -7
- package/src/plugins/builtin/chart-composer/chart-title.ts +114 -0
- package/src/plugins/builtin/chart-composer/cli-options.ts +1 -1
- package/src/plugins/builtin/chart-composer/headless.ts +13 -1
- package/src/plugins/builtin/chart-composer/index.tsx +2 -68
- package/src/plugins/builtin/chart-composer/leverage-overlay.ts +2 -4
- package/src/plugins/builtin/chart-composer/pane.tsx +11 -3
- package/src/plugins/builtin/chart-composer/presets.ts +1 -1
- package/src/plugins/builtin/chat/controller/draft-sync.ts +13 -7
- package/src/plugins/builtin/chat/controller/state.ts +4 -0
- package/src/plugins/builtin/chat/pane-requests.ts +8 -4
- package/src/plugins/builtin/clinical-trials/model.ts +2 -2
- package/src/plugins/builtin/clinical-trials/pane.tsx +3 -3
- package/src/plugins/builtin/cloud/askg/pane.tsx +60 -50
- package/src/plugins/builtin/cloud/auth-actions.tsx +2 -1
- package/src/plugins/builtin/comment-letters/pane.tsx +4 -2
- package/src/plugins/builtin/commodity-balances/headless.ts +2 -1
- package/src/plugins/builtin/company-attention/building-model.ts +3 -4
- package/src/plugins/builtin/company-attention/building.tsx +2 -0
- package/src/plugins/builtin/company-attention/headless.ts +2 -2
- package/src/plugins/builtin/company-attention/model.ts +2 -0
- package/src/plugins/builtin/company-attention/moves-model.ts +2 -1
- package/src/plugins/builtin/company-attention/moves.tsx +2 -0
- package/src/plugins/builtin/company-attention/pane.tsx +17 -3
- package/src/plugins/builtin/company-attention/signals-model.ts +3 -4
- package/src/plugins/builtin/company-attention/signals.tsx +5 -0
- package/src/plugins/builtin/company-kpis/headless.ts +26 -10
- package/src/plugins/builtin/company-kpis/model.ts +47 -7
- package/src/plugins/builtin/company-kpis/pane.tsx +36 -19
- package/src/plugins/builtin/company-kpis/taiwan-monthly-model.ts +99 -0
- package/src/plugins/builtin/company-kpis/taiwan-monthly-view.tsx +327 -0
- package/src/plugins/builtin/composite/ownership-browser.ts +28 -0
- package/src/plugins/builtin/composite/ownership.ts +5 -1
- package/src/plugins/builtin/congress-trades/detail.tsx +44 -8
- package/src/plugins/builtin/congress-trades/headless.ts +15 -11
- package/src/plugins/builtin/congress-trades/model.ts +104 -11
- package/src/plugins/builtin/congress-trades/pane.tsx +11 -6
- package/src/plugins/builtin/congress-trades/table.tsx +17 -10
- package/src/plugins/builtin/congress-trades/use-feed.ts +13 -2
- package/src/plugins/builtin/correlation/headless.ts +2 -2
- package/src/plugins/builtin/correlation/relationship/pane.tsx +11 -8
- package/src/plugins/builtin/correlation/relationship/view-model.ts +1 -19
- package/src/plugins/builtin/cot/headless.ts +1 -1
- package/src/plugins/builtin/cot/pane.tsx +7 -2
- package/src/plugins/builtin/cpi/headless.ts +2 -1
- package/src/plugins/builtin/credit-conditions/headless.ts +2 -1
- package/src/plugins/builtin/credit-documents/detail.tsx +2 -1
- package/src/plugins/builtin/credit-documents/export.ts +18 -12
- package/src/plugins/builtin/credit-documents/model.ts +106 -25
- package/src/plugins/builtin/credit-documents/pane.tsx +9 -5
- package/src/plugins/builtin/crypto-board/defi-view.tsx +2 -1
- package/src/plugins/builtin/crypto-board/defi.ts +5 -4
- package/src/plugins/builtin/crypto-board/headless.ts +7 -2
- package/src/plugins/builtin/crypto-board/model.ts +6 -4
- package/src/plugins/builtin/crypto-board/pane.tsx +2 -1
- package/src/plugins/builtin/crypto-board/supply.ts +4 -3
- package/src/plugins/builtin/crypto-etf-flows/headless.ts +15 -8
- package/src/plugins/builtin/crypto-etf-flows/pane.tsx +6 -5
- package/src/plugins/builtin/debt-maturities/headless.ts +56 -38
- package/src/plugins/builtin/debt-maturities/model.ts +2 -1
- package/src/plugins/builtin/debt-maturities/pane.tsx +24 -22
- package/src/plugins/builtin/dilution/index.tsx +74 -0
- package/src/plugins/builtin/dilution/model.ts +159 -0
- package/src/plugins/builtin/dilution/pane.tsx +592 -0
- package/src/plugins/builtin/dividend-yield/headless.ts +24 -15
- package/src/plugins/builtin/dividend-yield/index.tsx +2 -1
- package/src/plugins/builtin/dividend-yield/model.ts +8 -5
- package/src/plugins/builtin/dividend-yield/pane.tsx +20 -11
- package/src/plugins/builtin/dividend-yield/ranking-view.tsx +6 -2
- package/src/plugins/builtin/dividend-yield/ranking.ts +7 -3
- package/src/plugins/builtin/dividend-yield/view.ts +36 -10
- package/src/plugins/builtin/docs/index.tsx +1 -1
- package/src/plugins/builtin/docs/pane.tsx +7 -3
- package/src/plugins/builtin/docs/use-docs.ts +2 -1
- package/src/plugins/builtin/earnings/board-model.ts +19 -6
- package/src/plugins/builtin/earnings/board-table.ts +64 -48
- package/src/plugins/builtin/earnings/board.tsx +93 -51
- package/src/plugins/builtin/earnings/headless.ts +71 -12
- package/src/plugins/builtin/earnings/history-model.ts +28 -15
- package/src/plugins/builtin/earnings/history.tsx +1 -1
- package/src/plugins/builtin/earnings-calls/calendar.tsx +23 -10
- package/src/plugins/builtin/earnings-calls/format.ts +34 -0
- package/src/plugins/builtin/earnings-calls/headless.ts +5 -4
- package/src/plugins/builtin/earnings-calls/pane.tsx +22 -17
- package/src/plugins/builtin/earnings-calls/transcript-view.tsx +14 -12
- package/src/plugins/builtin/earnings-ripple/pane.tsx +4 -3
- package/src/plugins/builtin/econ/calendar-model.ts +72 -3
- package/src/plugins/builtin/econ/index.tsx +9 -21
- package/src/plugins/builtin/econ-statistics/detail.tsx +2 -2
- package/src/plugins/builtin/econ-statistics/headless.ts +10 -5
- package/src/plugins/builtin/econ-statistics/pane.tsx +6 -3
- package/src/plugins/builtin/econ-statistics/view.ts +15 -4
- package/src/plugins/builtin/equity-screener/client.ts +1 -1
- package/src/plugins/builtin/equity-screener/model.ts +12 -3
- package/src/plugins/builtin/estimate-revisions/headless.ts +23 -2
- package/src/plugins/builtin/estimate-revisions/model.ts +63 -13
- package/src/plugins/builtin/estimate-revisions/pane.tsx +228 -225
- package/src/plugins/builtin/estimate-revisions/sorting.ts +8 -16
- package/src/plugins/builtin/exposure/drivers.ts +5 -2
- package/src/plugins/builtin/exposure/headless.ts +6 -3
- package/src/plugins/builtin/exposure/model.ts +2 -1
- package/src/plugins/builtin/exposure/pane.tsx +16 -7
- package/src/plugins/builtin/fear-greed/format.ts +7 -7
- package/src/plugins/builtin/fear-greed/pane.tsx +21 -7
- package/src/plugins/builtin/futures-curve/headless.ts +14 -9
- package/src/plugins/builtin/futures-curve/model.ts +12 -4
- package/src/plugins/builtin/futures-curve/pane.tsx +18 -15
- package/src/plugins/builtin/fx-matrix/headless.ts +3 -2
- package/src/plugins/builtin/gpu/headless.ts +10 -4
- package/src/plugins/builtin/holders/beneficial-model.ts +1 -1
- package/src/plugins/builtin/holders/beneficial-view.tsx +3 -2
- package/src/plugins/builtin/holders/ccass-market-pane.tsx +363 -0
- package/src/plugins/builtin/holders/ccass-view.tsx +323 -0
- package/src/plugins/builtin/holders/disclosures-view.tsx +63 -0
- package/src/plugins/builtin/holders/disclosures.ts +33 -0
- package/src/plugins/builtin/holders/headless.ts +9 -2
- package/src/plugins/builtin/holders/index.tsx +75 -1
- package/src/plugins/builtin/holders/pane.tsx +37 -10
- package/src/plugins/builtin/holders/report-rows.ts +2 -0
- package/src/plugins/builtin/holders/table-model.ts +14 -6
- package/src/plugins/builtin/holders/types.ts +2 -2
- package/src/plugins/builtin/insider/activity-chart.ts +141 -0
- package/src/plugins/builtin/insider/headless.ts +2 -1
- package/src/plugins/builtin/insider/index.tsx +74 -12
- package/src/plugins/builtin/insider/signals-cells.tsx +15 -8
- package/src/plugins/builtin/insider/signals.tsx +6 -5
- package/src/plugins/builtin/insider/table-model.ts +17 -17
- package/src/plugins/builtin/insider/table.tsx +18 -10
- package/src/plugins/builtin/ipo-calendar/headless.ts +55 -11
- package/src/plugins/builtin/ipo-calendar/listing-ipo.ts +31 -4
- package/src/plugins/builtin/ipo-calendar/model.ts +208 -47
- package/src/plugins/builtin/ipo-calendar/pane.tsx +87 -25
- package/src/plugins/builtin/iv-history/client.ts +17 -8
- package/src/plugins/builtin/iv-history/format.ts +23 -12
- package/src/plugins/builtin/iv-history/headless.ts +9 -5
- package/src/plugins/builtin/iv-history/model.ts +15 -13
- package/src/plugins/builtin/iv-history/pane.tsx +5 -2
- package/src/plugins/builtin/iv-history/screen-pane.tsx +46 -24
- package/src/plugins/builtin/jobs/headless.ts +4 -3
- package/src/plugins/builtin/jobs/pane.tsx +6 -5
- package/src/plugins/builtin/jodi/headless.ts +15 -2
- package/src/plugins/builtin/jodi/model.ts +46 -5
- package/src/plugins/builtin/jodi/pane.tsx +17 -13
- package/src/plugins/builtin/kelly-sizer/headless.ts +3 -1
- package/src/plugins/builtin/kelly-sizer/sections.tsx +2 -1
- package/src/plugins/builtin/macro-day/pane.tsx +12 -5
- package/src/plugins/builtin/market-halts/model.ts +10 -8
- package/src/plugins/builtin/market-halts/pane.tsx +1 -1
- package/src/plugins/builtin/market-heatmap/data.ts +17 -2
- package/src/plugins/builtin/market-heatmap/headless.ts +56 -6
- package/src/plugins/builtin/market-heatmap/index.tsx +55 -1
- package/src/plugins/builtin/market-heatmap/model.ts +27 -1
- package/src/plugins/builtin/market-movers/model.ts +7 -1
- package/src/plugins/builtin/market-movers/session-table.ts +1 -0
- package/src/plugins/builtin/market-movers/session.ts +1 -1
- package/src/plugins/builtin/market-movers/table.ts +1 -1
- package/src/plugins/builtin/members/headless.ts +13 -5
- package/src/plugins/builtin/members/model.ts +35 -1
- package/src/plugins/builtin/members/pane.tsx +16 -8
- package/src/plugins/builtin/mna/distress/detail.tsx +7 -6
- package/src/plugins/builtin/mna/distress/model.ts +7 -7
- package/src/plugins/builtin/mna/distress/pane.tsx +8 -7
- package/src/plugins/builtin/mna/headless.ts +40 -7
- package/src/plugins/builtin/mna/model.ts +66 -6
- package/src/plugins/builtin/mna/pane.tsx +118 -60
- package/src/plugins/builtin/news/wire/industry-pane.tsx +1 -0
- package/src/plugins/builtin/news/wire/news/table.tsx +15 -4
- package/src/plugins/builtin/notes/index.tsx +2 -1
- package/src/plugins/builtin/openfda/model.ts +1 -1
- package/src/plugins/builtin/openfda/pane.tsx +37 -9
- package/src/plugins/builtin/options/analytics.ts +30 -6
- package/src/plugins/builtin/options/calc-seed.ts +38 -3
- package/src/plugins/builtin/options/footer.ts +18 -1
- package/src/plugins/builtin/options/live-quotes.ts +21 -6
- package/src/plugins/builtin/options/open-interest-as-of.ts +5 -0
- package/src/plugins/builtin/options/quote-context.tsx +21 -8
- package/src/plugins/builtin/options/table.ts +17 -2
- package/src/plugins/builtin/options/view.tsx +97 -46
- package/src/plugins/builtin/options-calculator/model.ts +65 -3
- package/src/plugins/builtin/options-calculator/pane.tsx +11 -3
- package/src/plugins/builtin/options-calculator/valuation.ts +33 -0
- package/src/plugins/builtin/options-positioning/cbbc-model.ts +160 -0
- package/src/plugins/builtin/options-positioning/cbbc-view.tsx +453 -0
- package/src/plugins/builtin/options-positioning/index.tsx +22 -1
- package/src/plugins/builtin/options-positioning/pane.tsx +16 -1
- package/src/plugins/builtin/options-scenario/charts.tsx +2 -1
- package/src/plugins/builtin/options-scenario/csp-screen-headless.ts +5 -5
- package/src/plugins/builtin/options-scenario/csp-screen-pane.tsx +11 -14
- package/src/plugins/builtin/options-scenario/csp-screen.ts +9 -1
- package/src/plugins/builtin/options-scenario/headless.ts +3 -3
- package/src/plugins/builtin/options-scenario/index.tsx +1 -1
- package/src/plugins/builtin/options-scenario/model.ts +7 -0
- package/src/plugins/builtin/options-scenario/pane.tsx +24 -14
- package/src/plugins/builtin/pe-band/pane.tsx +2 -1
- package/src/plugins/builtin/perps/cascade-tabs.tsx +2 -1
- package/src/plugins/builtin/perps/cascade.ts +4 -3
- package/src/plugins/builtin/perps/headless.ts +19 -12
- package/src/plugins/builtin/perps/model.ts +4 -3
- package/src/plugins/builtin/portfolio-list/cached-account.ts +3 -1
- package/src/plugins/builtin/portfolio-list/settings.ts +4 -3
- package/src/plugins/builtin/portfolio-list/table.tsx +19 -2
- package/src/plugins/builtin/power/client.ts +2 -2
- package/src/plugins/builtin/power/detail.tsx +11 -8
- package/src/plugins/builtin/power/gas-model.ts +2 -1
- package/src/plugins/builtin/power/gas.tsx +3 -2
- package/src/plugins/builtin/power/headless.ts +4 -1
- package/src/plugins/builtin/power/model.ts +19 -0
- package/src/plugins/builtin/power/pane.tsx +5 -4
- package/src/plugins/builtin/power/prices-headless.ts +4 -3
- package/src/plugins/builtin/power/prices.tsx +7 -6
- package/src/plugins/builtin/primary-dealers/headless.ts +1 -1
- package/src/plugins/builtin/primary-dealers/model.ts +2 -1
- package/src/plugins/builtin/rate-path/headless.ts +5 -2
- package/src/plugins/builtin/rate-path/pane.tsx +13 -10
- package/src/plugins/builtin/realized-vol/fx-proxy.ts +7 -8
- package/src/plugins/builtin/realized-vol/headless.ts +3 -4
- package/src/plugins/builtin/realized-vol/pane.tsx +5 -4
- package/src/plugins/builtin/relative-rotation/headless.ts +2 -1
- package/src/plugins/builtin/research/analyst-model.ts +1 -1
- package/src/plugins/builtin/research/analyst-pane.tsx +2 -1
- package/src/plugins/builtin/research/earnings-estimates-pane.tsx +262 -0
- package/src/plugins/builtin/research/event-charts.ts +322 -0
- package/src/plugins/builtin/research/event-data.ts +138 -0
- package/src/plugins/builtin/research/event-detail.tsx +442 -0
- package/src/plugins/builtin/research/event-model.ts +328 -31
- package/src/plugins/builtin/research/event-sources.ts +58 -8
- package/src/plugins/builtin/research/event-views.tsx +397 -0
- package/src/plugins/builtin/research/events-headless.ts +60 -4
- package/src/plugins/builtin/research/headless-schema.ts +2 -2
- package/src/plugins/builtin/research/headless.ts +84 -7
- package/src/plugins/builtin/research/index.tsx +19 -17
- package/src/plugins/builtin/research/relative-valuation-columns.ts +20 -8
- package/src/plugins/builtin/research/relative-valuation-headless.ts +8 -4
- package/src/plugins/builtin/research/relative-valuation-model.ts +23 -8
- package/src/plugins/builtin/research/relative-valuation-pane.tsx +10 -0
- package/src/plugins/builtin/revenue-breakdown/client.ts +9 -4
- package/src/plugins/builtin/revenue-breakdown/headless.ts +1 -1
- package/src/plugins/builtin/revenue-breakdown/index.tsx +2 -1
- package/src/plugins/builtin/revenue-breakdown/model.ts +2 -0
- package/src/plugins/builtin/revenue-breakdown/pane.tsx +10 -0
- package/src/plugins/builtin/risk-factors/pane.tsx +14 -9
- package/src/plugins/builtin/scanner/headless.ts +2 -0
- package/src/plugins/builtin/scanner/lock-note.ts +5 -9
- package/src/plugins/builtin/sec/exchange-filings.ts +44 -0
- package/src/plugins/builtin/sec/fund-facts.ts +10 -8
- package/src/plugins/builtin/sec/headless.ts +60 -8
- package/src/plugins/builtin/sec/index.tsx +129 -61
- package/src/plugins/builtin/sec/model.ts +10 -4
- package/src/plugins/builtin/sec/row-summaries.ts +1 -0
- package/src/plugins/builtin/series-inventory.ts +4 -0
- package/src/plugins/builtin/shared/beat-miss-chart.ts +66 -0
- package/src/plugins/builtin/shared/day-entries.ts +41 -0
- package/src/plugins/builtin/shared/earnings-calendar.ts +80 -53
- package/src/plugins/builtin/shared/earnings-report.ts +53 -15
- package/src/plugins/builtin/shared/history-span.ts +2 -1
- package/src/plugins/builtin/shared/locked-rows.tsx +1 -1
- package/src/plugins/builtin/shared/pro-lock-note.ts +8 -12
- package/src/plugins/builtin/shared/ticker-request.ts +4 -2
- package/src/plugins/builtin/shared/volatility/live-session.ts +6 -7
- package/src/plugins/builtin/shared/volatility/option-snapshot.ts +30 -0
- package/src/plugins/builtin/shared/volatility/quote-session.ts +49 -0
- package/src/plugins/builtin/short-interest/exchange-balances.ts +76 -0
- package/src/plugins/builtin/short-interest/exchange-positions-pane.tsx +55 -0
- package/src/plugins/builtin/short-interest/headless.ts +15 -2
- package/src/plugins/builtin/short-interest/index.tsx +7 -3
- package/src/plugins/builtin/short-interest/jpx.ts +38 -0
- package/src/plugins/builtin/short-interest/model.ts +3 -2
- package/src/plugins/builtin/short-interest/pane.tsx +4 -3
- package/src/plugins/builtin/short-interest/publications-model.ts +73 -2
- package/src/plugins/builtin/short-interest/publications-pane.tsx +16 -4
- package/src/plugins/builtin/short-interest/sfc.ts +40 -0
- package/src/plugins/builtin/short-interest/surface.tsx +16 -2
- package/src/plugins/builtin/short-volume/headless.ts +18 -3
- package/src/plugins/builtin/short-volume/model.ts +6 -1
- package/src/plugins/builtin/short-volume/pane.tsx +8 -7
- package/src/plugins/builtin/short-volume/sgx.ts +23 -0
- package/src/plugins/builtin/social-mentions/outliers-model.ts +2 -1
- package/src/plugins/builtin/social-mentions/pane.tsx +10 -8
- package/src/plugins/builtin/supply-chain/client.ts +10 -2
- package/src/plugins/builtin/supply-chain/directories.ts +18 -0
- package/src/plugins/builtin/supply-chain/evidence.ts +12 -4
- package/src/plugins/builtin/supply-chain/headless.ts +20 -7
- package/src/plugins/builtin/supply-chain/pane.tsx +40 -11
- package/src/plugins/builtin/thirteenf/api.ts +299 -31
- package/src/plugins/builtin/thirteenf/data.ts +126 -32
- package/src/plugins/builtin/thirteenf/format.ts +4 -6
- package/src/plugins/builtin/thirteenf/headless.ts +68 -29
- package/src/plugins/builtin/thirteenf/model.ts +24 -11
- package/src/plugins/builtin/thirteenf/overlap-pane.tsx +16 -8
- package/src/plugins/builtin/thirteenf/pane.tsx +45 -22
- package/src/plugins/builtin/thirteenf/report-notes.ts +52 -2
- package/src/plugins/builtin/thirteenf/session-scope.ts +57 -0
- package/src/plugins/builtin/thirteenf/signals-pane.tsx +17 -4
- package/src/plugins/builtin/thirteenf/split-history.ts +119 -0
- package/src/plugins/builtin/thirteenf/table.ts +6 -6
- package/src/plugins/builtin/thirteenf/types.ts +17 -1
- package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +11 -0
- package/src/plugins/builtin/ticker-detail/data-panes/historical-prices.tsx +12 -8
- package/src/plugins/builtin/ticker-detail/data-panes/history-bars.ts +5 -4
- package/src/plugins/builtin/ticker-detail/data-panes/returns-model.ts +7 -0
- package/src/plugins/builtin/ticker-detail/data-panes/returns-pane.tsx +12 -5
- package/src/plugins/builtin/ticker-detail/financials/aggregation.ts +36 -5
- package/src/plugins/builtin/ticker-detail/financials/model.ts +172 -39
- package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +62 -8
- package/src/plugins/builtin/ticker-detail/financials/ratios.ts +64 -10
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +67 -32
- package/src/plugins/builtin/ticker-detail/headless.ts +33 -12
- package/src/plugins/builtin/ticker-detail/overview/components.tsx +75 -14
- package/src/plugins/builtin/ticker-detail/overview/model.ts +26 -20
- package/src/plugins/builtin/ticker-detail/overview/pane.tsx +14 -8
- package/src/plugins/builtin/ticker-detail/overview/types.ts +2 -0
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +45 -17
- package/src/plugins/builtin/ticker-detail/pane.tsx +5 -3
- package/src/plugins/builtin/ticker-detail/research-groups.ts +15 -2
- package/src/plugins/builtin/ticker-detail/research-tabs.ts +2 -1
- package/src/plugins/builtin/time-sales/headless.ts +3 -3
- package/src/plugins/builtin/trace-bonds/pane.tsx +3 -2
- package/src/plugins/builtin/treasury-auctions/cache.ts +44 -19
- package/src/plugins/builtin/treasury-auctions/client.ts +9 -4
- package/src/plugins/builtin/vol-surface/charts.tsx +3 -1
- package/src/plugins/builtin/vol-surface/events.ts +8 -5
- package/src/plugins/builtin/vol-surface/evidence.ts +2 -2
- package/src/plugins/builtin/vol-surface/headless.ts +46 -28
- package/src/plugins/builtin/vol-surface/heat-grid.tsx +2 -1
- package/src/plugins/builtin/vol-surface/model.ts +34 -9
- package/src/plugins/builtin/vol-surface/pane.tsx +35 -67
- package/src/plugins/builtin/vol-surface/quote-coverage.ts +68 -0
- package/src/plugins/builtin/vol-surface/tables.ts +57 -6
- package/src/plugins/builtin/volatility/charts.tsx +7 -3
- package/src/plugins/builtin/volatility/headless.ts +5 -5
- package/src/plugins/builtin/volatility/pane.tsx +8 -5
- package/src/plugins/builtin/world-indices/headless.ts +5 -3
- package/src/plugins/builtin/world-venue-map/headless.ts +15 -1
- package/src/plugins/builtin/world-venue-map/layered-pane.tsx +5 -3
- package/src/plugins/builtin/world-venue-map/pane.tsx +4 -3
- package/src/plugins/builtin/world-venue-map/venue-exceptions.ts +72 -0
- package/src/plugins/builtin/world-venue-map/venue-header.tsx +20 -11
- package/src/plugins/builtin/yield-curve/headless.ts +4 -2
- package/src/plugins/builtin/yield-curve/index.tsx +4 -3
- package/src/plugins/catalog-browser.ts +3 -34
- package/src/plugins/marketplace/feed.ts +3 -2
- package/src/plugins/registry/contributions.ts +37 -10
- package/src/plugins/registry/index.ts +2 -1
- package/src/portfolio/column-values.ts +8 -9
- package/src/public/__snapshots__/public-api.test.ts.snap +5 -0
- package/src/public/i18n.ts +3 -2
- package/src/renderers/dom/css.d.ts +1 -0
- package/src/renderers/dom/data-table/index.tsx +60 -8
- package/src/renderers/dom/data-table/row.tsx +1 -1
- package/src/renderers/electrobun/bun/desktop/backend.ts +12 -1
- package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +7 -1
- package/src/renderers/electrobun/view/remote/asset-data-client.ts +2 -0
- package/src/sources/gloomberb-cloud/batched-lookups.ts +12 -1
- package/src/sources/gloomberb-cloud/index.ts +36 -3
- package/src/sources/gloomberb-cloud/normalizers.ts +1 -0
- package/src/sources/provider-router/financials.ts +4 -4
- package/src/sources/provider-router/index.ts +9 -1
- package/src/state/app/context/index.tsx +12 -4
- package/src/sync/broker-instances.ts +63 -11
- package/src/sync/config-merge.ts +1 -1
- package/src/sync/sanitize.ts +2 -0
- package/src/test-support/cloud-api.ts +34 -0
- package/src/test-support/strict-table-capture.tsx +83 -0
- package/src/tickers/search/index.ts +23 -7
- package/src/time-series/alignment.ts +14 -4
- package/src/time-series/base-series.ts +5 -4
- package/src/time-series/chart-data.ts +2 -0
- package/src/time-series/chart-seed.ts +3 -1
- package/src/time-series/fundamentals/current-valuation.ts +22 -5
- package/src/time-series/fundamentals/history-link.ts +25 -0
- package/src/time-series/fundamentals/quarterly-ttm.ts +50 -5
- package/src/time-series/market.ts +30 -4
- package/src/time-series/price-comparison.ts +39 -60
- package/src/time-series/resolve.ts +18 -11
- package/src/time-series/spec.ts +2 -1
- package/src/time-series/studies/formula.ts +4 -2
- package/src/time-series/studies/indicators.ts +2 -0
- package/src/time-series/studies/pair.ts +4 -2
- package/src/time-series/studies/shared.ts +1 -0
- package/src/time-series/types.ts +2 -1
- package/src/time-series/use-chart-resolution.ts +32 -14
- package/src/types/config.ts +13 -61
- package/src/types/data-provider.ts +8 -0
- package/src/types/financials.ts +49 -6
- package/src/types/headless.ts +30 -0
- package/src/types/plugin-context.ts +8 -1
- package/src/utils/crypto-pair.ts +10 -0
- package/src/utils/day-format.ts +104 -0
- package/src/utils/exchange-announcements.ts +35 -12
- package/src/utils/financial-statements.ts +40 -46
- package/src/utils/format.ts +39 -12
- package/src/utils/forward-dividend.ts +2 -1
- package/src/utils/trailing-dividend.ts +47 -0
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +0 -771
|
@@ -8,6 +8,7 @@ import { zonedDateTimeParts } from "../utils/zoned-date-time";
|
|
|
8
8
|
import { isCurrencyCode } from "../utils/currency-pair";
|
|
9
9
|
import { priceComparisonCloseTimes } from "./coin-session-close";
|
|
10
10
|
import { barLastSession } from "../market-data/market/bar-period";
|
|
11
|
+
import { priceBasisBreaks, priceBasisFactor } from "../market-data/market/split-price-basis";
|
|
11
12
|
import {
|
|
12
13
|
barCloseDay, isIntradayDailyBar, isReturnPeriod, LATEST_INTRADAY_TEXT, periodBaseDay, periodBaseIndex, periodDayText,
|
|
13
14
|
} from "../market-data/market/period-return";
|
|
@@ -214,66 +215,24 @@ function splitTerms(split: SplitAction): string | null {
|
|
|
214
215
|
return `${to}-for-${from}${to! < from! ? " reverse" : ""}`;
|
|
215
216
|
}
|
|
216
217
|
|
|
217
|
-
/** A close more than this many times the one before it, or less than its fraction, is no day a split-adjusted series moves by. */
|
|
218
|
-
const UNEXPLAINED_JUMP = 5;
|
|
219
|
-
|
|
220
|
-
/** `18.4`, `20`, `5.23`: a jump's factor in three digits. */
|
|
221
|
-
function jumpFactorText(ratio: number): string {
|
|
222
|
-
return String(Number(Math.max(ratio, 1 / ratio).toPrecision(3)));
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* Each jump of a leg's closes inside its window: a close over UNEXPLAINED_JUMP
|
|
227
|
-
* times the one before it or under its fraction. "SOXS falls 18.4× on Tue 26
|
|
228
|
-
* May with no split recorded that day", or on a split's own day, "the day of
|
|
229
|
-
* its 1-for-20 reverse split, unadjusted".
|
|
230
|
-
*/
|
|
231
|
-
function legJumps(
|
|
232
|
-
label: string,
|
|
233
|
-
points: ReadonlyArray<{ date: Date; value: number | null }>,
|
|
234
|
-
window: { baseDay: string; endDay: string },
|
|
235
|
-
splits: readonly SplitAction[],
|
|
236
|
-
currentYear: number,
|
|
237
|
-
): string[] {
|
|
238
|
-
const jumps: string[] = [];
|
|
239
|
-
let previous: number | null = null;
|
|
240
|
-
for (const point of points) {
|
|
241
|
-
const value = point.value;
|
|
242
|
-
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) continue;
|
|
243
|
-
const day = point.date.toISOString().slice(0, 10);
|
|
244
|
-
const ratio = previous === null ? 1 : value / previous;
|
|
245
|
-
previous = value;
|
|
246
|
-
if (day <= window.baseDay || day > window.endDay || (ratio <= UNEXPLAINED_JUMP && ratio >= 1 / UNEXPLAINED_JUMP)) continue;
|
|
247
|
-
const split = splits.find((entry) => entry.date.slice(0, 10) === day);
|
|
248
|
-
const terms = split ? splitTerms(split) : null;
|
|
249
|
-
jumps.push(`${label} ${ratio < 1 ? "falls" : "rises"} ${jumpFactorText(ratio)}× on ${periodDayText(day, currentYear)}${
|
|
250
|
-
terms ? `, the day of its ${terms} split, unadjusted` : " with no split recorded that day"}`);
|
|
251
|
-
}
|
|
252
|
-
return jumps;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
218
|
/**
|
|
256
|
-
*
|
|
257
|
-
*
|
|
258
|
-
*
|
|
259
|
-
* reads its return, not its share price: "Splits in range: SOXS 1-for-20
|
|
260
|
-
* reverse on Thu 5 Mar and 1-for-10 reverse on Wed 15 Jul; returns are
|
|
261
|
-
* split-adjusted." That is said only when no leg's closes jump inside its
|
|
262
|
-
* window (legJumps): a jump is named instead, a split or not, and the returns
|
|
263
|
-
* across it called unreliable. Null when no leg has a split or a jump.
|
|
219
|
+
* Describe recorded splits separately from breaks in the served bars. A split record alone cannot tell
|
|
220
|
+
* which bars are on which basis. Withhold returns only for the legs whose windows cross a break.
|
|
221
|
+
* Null split history is unavailable or not yet read, not a successful empty result.
|
|
264
222
|
*/
|
|
265
|
-
export function
|
|
266
|
-
comparison: Pick<PriceComparison, "legs">,
|
|
267
|
-
legs: ReadonlyArray<{ id: string; label: string; splits: readonly SplitAction[]
|
|
223
|
+
export function comparisonSplitAssessment(
|
|
224
|
+
comparison: Pick<PriceComparison, "legs" | "sourceBounds">,
|
|
225
|
+
legs: ReadonlyArray<{ id: string; label: string; splits: readonly SplitAction[] | null; series?: ResolvedSeries }>,
|
|
268
226
|
now = Date.now(),
|
|
269
|
-
): string | null {
|
|
227
|
+
): { notice: string | null; dropped: NonNullable<PriceComparison["dropped"]> } {
|
|
270
228
|
const currentYear = new Date(now).getUTCFullYear();
|
|
271
229
|
const named: string[] = [];
|
|
272
|
-
const
|
|
273
|
-
for (const { id, label, splits,
|
|
230
|
+
const dropped: NonNullable<PriceComparison["dropped"]> = [];
|
|
231
|
+
for (const { id, label, splits, series } of legs) {
|
|
274
232
|
const window = comparison.legs?.[id];
|
|
275
233
|
if (!window) continue;
|
|
276
|
-
const
|
|
234
|
+
const recordedSplits = splits ?? [];
|
|
235
|
+
const inside = recordedSplits
|
|
277
236
|
.filter((split) => /^\d{4}-\d{2}-\d{2}/.test(split.date) && split.date.slice(0, 10) > window.baseDay && split.date.slice(0, 10) <= window.endDay)
|
|
278
237
|
.sort((left, right) => left.date.localeCompare(right.date))
|
|
279
238
|
.flatMap((split) => {
|
|
@@ -281,12 +240,30 @@ export function comparisonSplitNotice(
|
|
|
281
240
|
return terms ? [`${terms} on ${periodDayText(split.date, currentYear)}`] : [];
|
|
282
241
|
});
|
|
283
242
|
if (inside.length) named.push(`${label} ${listLabels(inside)}`);
|
|
284
|
-
|
|
243
|
+
const bounds = comparison.sourceBounds?.[id];
|
|
244
|
+
if (!series || !bounds) continue;
|
|
245
|
+
const bars = series.points.flatMap((point) => {
|
|
246
|
+
const time = point.date.getTime();
|
|
247
|
+
return time >= bounds.start && time <= bounds.end ? [{ date: observationDate(time, series),
|
|
248
|
+
close: point.close ?? point.value, high: point.high, low: point.low }] : [];
|
|
249
|
+
});
|
|
250
|
+
const breaks = priceBasisBreaks(bars, recordedSplits, { interval: series.historyResolution, venue: legVenue(series),
|
|
251
|
+
includeUnrecorded: true, includeUnrecordedRange: splits === null });
|
|
252
|
+
if (breaks.length) {
|
|
253
|
+
const period = series.historyResolution === "1mo" ? "monthly" : series.historyResolution === "1wk" ? "weekly" : null;
|
|
254
|
+
const descriptions = breaks.map(({ day, ratio, kind, split }) => {
|
|
255
|
+
const move = kind === "close" ? `close ${ratio < 1 ? "falls" : "rises"}` : "high/low range is";
|
|
256
|
+
const evidence = split ? `near the ${periodDayText(split.date.slice(0, 10), currentYear)} split`
|
|
257
|
+
: splits === null ? "with split history unavailable" : "with no split recorded nearby";
|
|
258
|
+
return `${move} ${priceBasisFactor(ratio)}× ${period ? `in the ${period} bar dated` : "on"} ${periodDayText(day, currentYear)} ${evidence}`;
|
|
259
|
+
});
|
|
260
|
+
dropped.push({ seriesId: id, label, reason: `${descriptions.join("; ")}. A consistent price basis cannot be verified` });
|
|
261
|
+
}
|
|
285
262
|
}
|
|
286
263
|
const splitsLine = named.length ? `Splits in range: ${named.join("; ")}` : null;
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
return
|
|
264
|
+
const notice = dropped.length ? [splitsLine && `${splitsLine}.`, ...dropped.map(({ label, reason }) => `${label}: ${reason}; returns withheld.`)]
|
|
265
|
+
.filter(Boolean).join(" ") : splitsLine && `${splitsLine}; returns are split-adjusted.`;
|
|
266
|
+
return { notice, dropped };
|
|
290
267
|
}
|
|
291
268
|
|
|
292
269
|
/**
|
|
@@ -389,7 +366,7 @@ export function resolvePriceComparison(
|
|
|
389
366
|
const sessionDay = (key: string) => (barPeriod ? barLastSession(key, barPeriod, venue, now) : null) ?? key;
|
|
390
367
|
const dayOf = (leg: ComparedLeg, key: string) => calendarBars ? key : observationDate(Number(key), leg.entry);
|
|
391
368
|
const preset = options.preset ?? null;
|
|
392
|
-
const period = !dateWindow && isReturnPeriod(preset) ? preset : null;
|
|
369
|
+
const period = dateWindow?.returnPeriod ?? (!dateWindow && isReturnPeriod(preset) ? preset : null);
|
|
393
370
|
const shared = (keys: (leg: ComparedLeg) => readonly string[]) => {
|
|
394
371
|
const sets = legs.map((leg) => new Set(keys(leg)));
|
|
395
372
|
return legs.length ? keys(legs[0]!).filter((key) => sets.every((set) => set.has(key))) : [];
|
|
@@ -402,7 +379,7 @@ export function resolvePriceComparison(
|
|
|
402
379
|
: sharedWindow.at(-1);
|
|
403
380
|
// Authored dates (`--from 2026-10-19`) measure from the close before the first date, as RETURN does: the last
|
|
404
381
|
// date the legs share before it. Weekly and monthly bars keep the bar the window starts in.
|
|
405
|
-
const authoredFrom = !preset && dateWindow && /^\d{4}-\d{2}-\d{2}$/.test(dateWindow.start) && (resolution === "1d" || !calendarBars)
|
|
382
|
+
const authoredFrom = !preset && !period && dateWindow && /^\d{4}-\d{2}-\d{2}$/.test(dateWindow.start) && (resolution === "1d" || !calendarBars)
|
|
406
383
|
? dateWindow.start : null;
|
|
407
384
|
const firstInWindow = authoredFrom ? legs.map((leg) => leg.window[0]!).sort(order)[0] : undefined;
|
|
408
385
|
const authoredBase = authoredFrom && firstInWindow !== undefined
|
|
@@ -410,7 +387,8 @@ export function resolvePriceComparison(
|
|
|
410
387
|
&& legs.every((leg) => nonzero(leg, key))).at(-1)
|
|
411
388
|
: undefined;
|
|
412
389
|
const sharedStart = authoredBase ?? sharedWindow.find((key) => legs.every((leg) => nonzero(leg, key)));
|
|
413
|
-
const anchor =
|
|
390
|
+
const anchor = dateWindow?.returnPeriod ? dateWindow.end
|
|
391
|
+
: period && sharedEnd !== undefined ? (calendarBars ? sessionDay(sharedEnd) : dayOf(legs[0]!, sharedEnd)) : null;
|
|
414
392
|
const baseDay = anchor && period ? periodBaseDay(anchor, period) : null;
|
|
415
393
|
const closeDay = (leg: ComparedLeg, key: string) => calendarBars && resolution !== "1d" ? barCloseDay(key, resolution, legVenue(leg.entry)) : key;
|
|
416
394
|
// Intraday bars share their times, so their base is the last bar the legs share on or before the base day.
|
|
@@ -516,6 +494,7 @@ export function bufferPriceComparison(
|
|
|
516
494
|
view: { start: number | null; end: number | null },
|
|
517
495
|
): ResolvedSeries {
|
|
518
496
|
if (!comparison?.seriesIds.includes(series.id)) return series;
|
|
497
|
+
if (comparison.dropped?.some((entry) => entry.seriesId === series.id)) return { ...series, points: [] };
|
|
519
498
|
return {
|
|
520
499
|
...series,
|
|
521
500
|
latestChangePercent: undefined,
|
|
@@ -57,7 +57,7 @@ import { currencySeries } from "./currency-conversion";
|
|
|
57
57
|
import {
|
|
58
58
|
bufferPriceComparison,
|
|
59
59
|
clipPriceComparison,
|
|
60
|
-
|
|
60
|
+
comparisonSplitAssessment,
|
|
61
61
|
observationDate,
|
|
62
62
|
priceComparisonBoundsForSeries,
|
|
63
63
|
priceComparisonSeriesIds,
|
|
@@ -301,17 +301,16 @@ async function resolveChartSpecWindow(
|
|
|
301
301
|
/**
|
|
302
302
|
* The splits a comparison's listings took inside their windows, read from
|
|
303
303
|
* each listing's corporate actions (once per chart, as total returns read
|
|
304
|
-
* them), and any
|
|
305
|
-
*
|
|
306
|
-
* split; its jumps are still named.
|
|
304
|
+
* them), and any price basis breaks in the listing's native bars. Unavailable
|
|
305
|
+
* split history cannot clear a suspicious high/low range.
|
|
307
306
|
*/
|
|
308
|
-
async function
|
|
307
|
+
async function assessComparedSplits(
|
|
309
308
|
spec: ChartSpec,
|
|
310
309
|
comparison: PriceComparison,
|
|
311
|
-
|
|
310
|
+
nativeSeries: ReadonlyMap<string, ResolvedSeries>,
|
|
312
311
|
loadActions: (source: Extract<ChartSeriesSpec["source"], { kind: "security" }>) => Promise<CorporateActionsData | null>,
|
|
313
312
|
now: number,
|
|
314
|
-
)
|
|
313
|
+
) {
|
|
315
314
|
const legs = await Promise.all(Object.keys(comparison.legs ?? {}).map(async (id) => {
|
|
316
315
|
const source = spec.series.find((entry) => entry.id === id)?.source;
|
|
317
316
|
if (source?.kind !== "security") return null;
|
|
@@ -319,9 +318,10 @@ async function comparedSplitNotice(
|
|
|
319
318
|
logFailure("time-series-resolve", "Loading splits for a comparison failed")(error);
|
|
320
319
|
return null;
|
|
321
320
|
});
|
|
322
|
-
|
|
321
|
+
const splits = actions?.coverage?.splits === "unavailable" ? null : actions?.splits ?? null;
|
|
322
|
+
return { id, label: source.instrument.symbol, splits, series: nativeSeries.get(id) };
|
|
323
323
|
}));
|
|
324
|
-
return
|
|
324
|
+
return comparisonSplitAssessment(comparison, legs.filter((leg) => leg !== null), now);
|
|
325
325
|
}
|
|
326
326
|
|
|
327
327
|
/** The price fields whose returns a distribution adds to. */
|
|
@@ -878,6 +878,7 @@ async function resolveChartSpecPass(
|
|
|
878
878
|
const realizedVolInputs = new Set(spec.studies.filter((study) => study.kind === "realized-vol" && study.visible !== false)
|
|
879
879
|
.flatMap((study) => study.inputSeriesIds));
|
|
880
880
|
const historicalPriceSeries = new Map<string, ResolvedSeries>();
|
|
881
|
+
const nativeComparisonSeries = new Map<string, ResolvedSeries>();
|
|
881
882
|
const loaded = await Promise.all(spec.series.map(async (seriesSpec, index) => {
|
|
882
883
|
if (!calculationSeriesIds.has(seriesSpec.id)) return null;
|
|
883
884
|
const { warnings, errors, priorityWarnings, coverageNotices } = quietSeriesIds.has(seriesSpec.id)
|
|
@@ -1073,11 +1074,12 @@ async function resolveChartSpecPass(
|
|
|
1073
1074
|
history?.resolution,
|
|
1074
1075
|
quoteMetadata,
|
|
1075
1076
|
contractUnit,
|
|
1076
|
-
{ extendedHours: history?.extendedHours === true, currencies },
|
|
1077
|
+
{ extendedHours: history?.extendedHours === true, currencies, barSize: builtBars ?? undefined },
|
|
1077
1078
|
);
|
|
1078
1079
|
if (!base) throw new Error(`Unknown field ${source.fieldId}.`);
|
|
1079
1080
|
if (returnHistory?.note) base.returnRollNote = returnHistory.note;
|
|
1080
1081
|
let result = builtBars ? withBuiltBarSize(base, builtBars) : base;
|
|
1082
|
+
if (comparedSeriesIds.has(seriesSpec.id)) nativeComparisonSeries.set(seriesSpec.id, result);
|
|
1081
1083
|
if (spec.viewport.totalReturn === true && totalReturnFieldId(source.fieldId)) {
|
|
1082
1084
|
const outcome = await totalReturnSeries(result, () => loadDistributions(resolvedSource),
|
|
1083
1085
|
merged.quote?.currency || quoteMetadata?.currency, referenceNow);
|
|
@@ -1235,7 +1237,12 @@ async function resolveChartSpecPass(
|
|
|
1235
1237
|
priceComparison = resolvePriceComparison(spec, rawSeries, bounds, comparisonResolution, requestBounds ? null : spec.viewport.dateWindow,
|
|
1236
1238
|
{ ...comparisonOptions, atSessionClose: timed.timing.atSessionClose, closedEnds: timed.timing.closedEnds });
|
|
1237
1239
|
}
|
|
1238
|
-
const
|
|
1240
|
+
const splitAssessment = priceComparison?.legs
|
|
1241
|
+
? await assessComparedSplits(spec, priceComparison, nativeComparisonSeries, loadDistributions, comparisonOptions.now) : null;
|
|
1242
|
+
const splitNotice = splitAssessment?.notice;
|
|
1243
|
+
if (priceComparison && splitAssessment?.dropped.length) {
|
|
1244
|
+
priceComparison = { ...priceComparison, dropped: [...priceComparison.dropped ?? [], ...splitAssessment.dropped] };
|
|
1245
|
+
}
|
|
1239
1246
|
const comparedBounds = comparisonDisplayBounds(bounds, priceComparison);
|
|
1240
1247
|
const displayBounds = spec.viewport.dateWindow?.endAtLatestObservation && !requestBounds
|
|
1241
1248
|
? endAtNewestObservation(comparedBounds, rawSeries) : comparedBounds;
|
package/src/time-series/spec.ts
CHANGED
|
@@ -199,7 +199,8 @@ function normalizedDateWindow(value: unknown): ChartSpec["viewport"]["dateWindow
|
|
|
199
199
|
const startTime = Date.parse(start);
|
|
200
200
|
const endTime = Date.parse(end);
|
|
201
201
|
if (!Number.isFinite(startTime) || !Number.isFinite(endTime) || startTime > endTime) return undefined;
|
|
202
|
-
return { start, end, ...(window?.endAtLatestObservation === true ? { endAtLatestObservation: true } : {})
|
|
202
|
+
return { start, end, ...(window?.endAtLatestObservation === true ? { endAtLatestObservation: true } : {}),
|
|
203
|
+
...(window?.returnPeriod === "YTD" ? { returnPeriod: "YTD" } : {}) };
|
|
203
204
|
}
|
|
204
205
|
|
|
205
206
|
function normalizePanel(value: unknown, index: number, seen: Set<string>): ChartPanelSpec | null {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { alignTimeSeries } from "../alignment";
|
|
1
|
+
import { alignTimeSeries, matchedFreshBarStart } from "../alignment";
|
|
2
2
|
import type { ChartStudySpec, ResolvedSeries, TimeSeriesPoint } from "../types";
|
|
3
3
|
import { isFiniteNumber } from "../../utils/guards";
|
|
4
4
|
import { continuousFuturesRoot, futuresContractCode, futuresContractMonth, futuresGenericListing } from "../../utils/futures-generic";
|
|
@@ -181,6 +181,7 @@ function alignedSamples(inputs: readonly (ResolvedSeries | undefined)[], summed:
|
|
|
181
181
|
const aligned = read.map((input) => row.values[input.id]);
|
|
182
182
|
if (aligned.some((entry) => !isFiniteNumber(entry?.value))) return [];
|
|
183
183
|
const availability = Math.max(...aligned.map((entry) => entry!.point.availableAt?.getTime() ?? entry!.point.date.getTime()));
|
|
184
|
+
const barStart = matchedFreshBarStart(aligned);
|
|
184
185
|
const values: number[] = [];
|
|
185
186
|
const points: TimeSeriesPoint[] = [];
|
|
186
187
|
summed.forEach((index, position) => {
|
|
@@ -191,9 +192,10 @@ function alignedSamples(inputs: readonly (ResolvedSeries | undefined)[], summed:
|
|
|
191
192
|
values,
|
|
192
193
|
points,
|
|
193
194
|
point: {
|
|
194
|
-
date: new Date(row.date),
|
|
195
|
+
date: new Date(barStart ?? row.date.getTime()),
|
|
195
196
|
observedAt: new Date(row.date),
|
|
196
197
|
availableAt: Number.isFinite(availability) ? new Date(availability) : undefined,
|
|
198
|
+
...(barStart !== undefined ? { barStart: new Date(barStart) } : {}),
|
|
197
199
|
value: null,
|
|
198
200
|
provenance: { quality: "derived" as const },
|
|
199
201
|
},
|
|
@@ -274,6 +274,8 @@ export function resolveVolume(spec: ChartStudySpec, input: ResolvedSeries, color
|
|
|
274
274
|
.flatMap((point) => isFiniteNumber(point.volume)
|
|
275
275
|
? [{
|
|
276
276
|
...derivedPoint({ point, value: point.volume }, point.volume),
|
|
277
|
+
// A bar still forming has the day's volume so far: its bar says so, and so does its volume.
|
|
278
|
+
...(point.partial ? { partial: true } : {}),
|
|
277
279
|
...(directional && isFiniteNumber(point.open) && isFiniteNumber(point.close) && point.close < point.open ? { fell: true } : {}),
|
|
278
280
|
}]
|
|
279
281
|
: []);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { alignTimeSeries } from "../alignment";
|
|
1
|
+
import { alignTimeSeries, matchedFreshBarStart } from "../alignment";
|
|
2
2
|
import type { ManualChartResolution } from "../resolution";
|
|
3
3
|
import type { ChartStudySpec, ResolvedSeries, SeriesPeriod, TimeSeriesPoint } from "../types";
|
|
4
4
|
import { isFiniteNumber } from "../../utils/guards";
|
|
@@ -27,13 +27,15 @@ function pairedSamples(left: ResolvedSeries, right: ResolvedSeries, carryForward
|
|
|
27
27
|
leftValue.point.availableAt?.getTime() ?? leftValue.point.date.getTime(),
|
|
28
28
|
rightValue.point.availableAt?.getTime() ?? rightValue.point.date.getTime(),
|
|
29
29
|
);
|
|
30
|
+
const barStart = matchedFreshBarStart([leftValue, rightValue]);
|
|
30
31
|
return [{
|
|
31
32
|
left: leftValue.value,
|
|
32
33
|
right: rightValue.value,
|
|
33
34
|
point: {
|
|
34
|
-
date: new Date(row.date),
|
|
35
|
+
date: new Date(barStart ?? row.date.getTime()),
|
|
35
36
|
observedAt: new Date(row.date),
|
|
36
37
|
availableAt: Number.isFinite(availability) ? new Date(availability) : undefined,
|
|
38
|
+
...(barStart !== undefined ? { barStart: new Date(barStart) } : {}),
|
|
37
39
|
value: null,
|
|
38
40
|
provenance: { quality: "derived" as const },
|
|
39
41
|
},
|
|
@@ -57,6 +57,7 @@ export function derivedPoint(sample: NumericSample, value: number | null): TimeS
|
|
|
57
57
|
date: new Date(sample.point.date),
|
|
58
58
|
observedAt: new Date(sample.point.observedAt),
|
|
59
59
|
availableAt: sample.point.availableAt ? new Date(sample.point.availableAt) : undefined,
|
|
60
|
+
...(sample.point.barStart ? { barStart: new Date(sample.point.barStart) } : {}),
|
|
60
61
|
value,
|
|
61
62
|
periodLabel: sample.point.periodLabel,
|
|
62
63
|
provenance: {
|
package/src/time-series/types.ts
CHANGED
|
@@ -105,7 +105,7 @@ export interface ChartPanelSpec {
|
|
|
105
105
|
export interface ChartViewportSpec {
|
|
106
106
|
range: TimeRange;
|
|
107
107
|
resolution: ChartResolution;
|
|
108
|
-
dateWindow?: { start: string; end: string; endAtLatestObservation?: boolean };
|
|
108
|
+
dateWindow?: { start: string; end: string; endAtLatestObservation?: boolean; returnPeriod?: "YTD" };
|
|
109
109
|
/** Optional latest-observation cap, useful for period-based financial views. */
|
|
110
110
|
maxPoints?: number;
|
|
111
111
|
/** Intraday market history includes pre-market and after-hours bars where the venue has them. */
|
|
@@ -137,6 +137,7 @@ export interface TimeSeriesPoint {
|
|
|
137
137
|
date: Date;
|
|
138
138
|
observedAt: Date;
|
|
139
139
|
availableAt?: Date;
|
|
140
|
+
barStart?: Date;
|
|
140
141
|
/**
|
|
141
142
|
* The day the figure was released (`2026-10-20`), when its source says so for
|
|
142
143
|
* this point alone: FRED's newest observation from Gloom Cloud. The report
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { logFailure } from "../utils/log-failure";
|
|
2
|
-
import { afterSavedCopyFrame, readSavedCopy, writeSavedCopy, type SavedCopyKey } from "../data/pane-saved-copies";
|
|
2
|
+
import { afterSavedCopyFrame, deleteSavedCopy, readSavedCopy, writeSavedCopy, type SavedCopyKey } from "../data/pane-saved-copies";
|
|
3
3
|
import { reuseSavedData } from "../data/reuse-saved-data";
|
|
4
4
|
import { useSavedCopyFooter } from "../components/layout/pane/footer/registration";
|
|
5
5
|
import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
type ChartResolveSources,
|
|
11
11
|
} from "./resolve-context";
|
|
12
12
|
import { chartSeedResolution, seedChartResolutionResult } from "./chart-seed";
|
|
13
|
+
import { priceComparisonSeriesIds } from "./price-comparison";
|
|
13
14
|
import { reconcileChartTail } from "./tail-reconcile";
|
|
14
15
|
import type { ChartResolutionResult, ChartSpec } from "./types";
|
|
15
16
|
import {
|
|
@@ -87,6 +88,15 @@ function hasRenderableData(result: ChartResolutionResult): boolean {
|
|
|
87
88
|
return (result.bufferedSeries ?? result.series).some((series) => series.points.length > 0);
|
|
88
89
|
}
|
|
89
90
|
|
|
91
|
+
function withheldReturns(result: ChartResolutionResult) {
|
|
92
|
+
const comparison = result.priceComparison;
|
|
93
|
+
return comparison?.dropped?.filter(({ seriesId }) => comparison.legs?.[seriesId] !== undefined) ?? [];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function hasChartData(result: ChartResolutionResult): boolean {
|
|
97
|
+
return hasRenderableData(result) || withheldReturns(result).length > 0;
|
|
98
|
+
}
|
|
99
|
+
|
|
90
100
|
function publicChartSpecKey(spec: ChartSpec, scope: string | null | undefined): string | null {
|
|
91
101
|
if (!scope || spec.series.length === 0) return null;
|
|
92
102
|
if (spec.series.some(({ source }) => source.kind === "capability" || (source.kind === "security"
|
|
@@ -100,11 +110,19 @@ function publicChartSpecKey(spec: ChartSpec, scope: string | null | undefined):
|
|
|
100
110
|
return JSON.stringify([scope, { ...spec, series }]);
|
|
101
111
|
}
|
|
102
112
|
|
|
103
|
-
function saveChartResolution(key: SavedCopyKey | null, result: ChartResolutionResult): void {
|
|
104
|
-
if (key
|
|
105
|
-
|
|
106
|
-
|
|
113
|
+
function saveChartResolution(key: SavedCopyKey | null, result: ChartResolutionResult, previous: ChartResolutionResult): void {
|
|
114
|
+
if (!key) return;
|
|
115
|
+
const withheld = withheldReturns(result);
|
|
116
|
+
if (result.savedAt != null || result.errors.length > 0) {
|
|
117
|
+
if (withheld.length) deleteSavedCopy(key);
|
|
118
|
+
return;
|
|
107
119
|
}
|
|
120
|
+
const { bufferedSeries: _buffer, ...visible } = result;
|
|
121
|
+
const hasPoints = hasRenderableData(visible);
|
|
122
|
+
if (!hasPoints && !withheld.length) return;
|
|
123
|
+
const previouslyWithheld = withheldReturns(previous);
|
|
124
|
+
const newlyWithheld = withheld.some(({ seriesId }) => !previouslyWithheld.some((entry) => entry.seriesId === seriesId));
|
|
125
|
+
writeSavedCopy(key, visible, Date.now(), !hasPoints || newlyWithheld ? 0 : TAIL_RECONCILE_MIN_SPACING_MS);
|
|
108
126
|
}
|
|
109
127
|
|
|
110
128
|
function seedWindowIsCurrent(spec: ChartSpec, now: number, options: ChartResolveOptions): boolean {
|
|
@@ -247,7 +265,7 @@ export function useChartResolution(
|
|
|
247
265
|
const scope = options.savedCopyScope;
|
|
248
266
|
const publicSpecKey = useMemo(() => publicChartSpecKey(spec, scope), [spec, scope]);
|
|
249
267
|
const specKey = publicSpecKey ?? JSON.stringify([scope, spec]);
|
|
250
|
-
const savedKey = !snapshot && publicSpecKey ? { version: 2, key: ["chart-resolution", publicSpecKey,
|
|
268
|
+
const savedKey = !snapshot && publicSpecKey ? { version: priceComparisonSeriesIds(spec) ? 4 : 2, key: ["chart-resolution", publicSpecKey,
|
|
251
269
|
options.requestViewport?.start, options.requestViewport?.end, options.autoViewport?.start, options.autoViewport?.end,
|
|
252
270
|
options.autoViewport ? options.targetPointCount : null] } : null;
|
|
253
271
|
const seedResult = () => {
|
|
@@ -272,7 +290,7 @@ export function useChartResolution(
|
|
|
272
290
|
useSavedCopyFooter(state.key === specKey && !snapshot ? state.savedAt : null, result.errors.length === 0);
|
|
273
291
|
// A seed bridges an in-flight request. Once that request settles, an empty
|
|
274
292
|
// or failed result must not be replaced with a fresh loading seed forever.
|
|
275
|
-
const needsSeed = !snapshot && !
|
|
293
|
+
const needsSeed = !snapshot && !hasChartData(result)
|
|
276
294
|
&& (state.key !== specKey || result.loading);
|
|
277
295
|
const subscribeSeed = useCallback((listener: () => void) => {
|
|
278
296
|
if (!needsSeed || !coordinator) return () => {};
|
|
@@ -286,7 +304,7 @@ export function useChartResolution(
|
|
|
286
304
|
const seeded = needsSeed
|
|
287
305
|
? seedResult()
|
|
288
306
|
: null;
|
|
289
|
-
const displayed =
|
|
307
|
+
const displayed = seeded ?? result;
|
|
290
308
|
const resultRef = useRef(displayed);
|
|
291
309
|
resultRef.current = displayed;
|
|
292
310
|
const stateKey = state.key;
|
|
@@ -415,7 +433,7 @@ export function useChartResolution(
|
|
|
415
433
|
request.options,
|
|
416
434
|
);
|
|
417
435
|
if (!current()) return;
|
|
418
|
-
saveChartResolution(request.savedKey, next);
|
|
436
|
+
saveChartResolution(request.savedKey, next, resultRef.current);
|
|
419
437
|
const requestKey = request.specKey;
|
|
420
438
|
// A pass that brought in no source data changed at most the newest points.
|
|
421
439
|
const settled = cache.revision === dataRevision;
|
|
@@ -425,8 +443,8 @@ export function useChartResolution(
|
|
|
425
443
|
if (state.key !== requestKey) return { key: requestKey, result: next };
|
|
426
444
|
if ((state.savedAt != null || request.options.autoViewport || request.options.requestViewport)
|
|
427
445
|
&& !state.result.loading
|
|
428
|
-
&&
|
|
429
|
-
&& !
|
|
446
|
+
&& hasChartData(state.result)
|
|
447
|
+
&& !hasChartData(next)) return state;
|
|
430
448
|
const shown = revisions.get(state.result);
|
|
431
449
|
const edge = settled && shown?.cache === cache && shown.revision === dataRevision ? LIVE_COMPARE_EDGE_POINTS : undefined;
|
|
432
450
|
if (state.savedAt != null || !sameChartResolution(state.result, next, edge)) return { key: requestKey, result: next };
|
|
@@ -561,7 +579,7 @@ export function useChartResolution(
|
|
|
561
579
|
const cache = resolveCacheRef.current;
|
|
562
580
|
const dataRevision = cache.revision;
|
|
563
581
|
const opening = resultRef.current;
|
|
564
|
-
const backgroundRefresh = stateKey === specKey &&
|
|
582
|
+
const backgroundRefresh = stateKey === specKey && hasChartData(opening) && !opening.loading && (!isExplicitReload || stateSavedAt != null);
|
|
565
583
|
if (!backgroundRefresh) {
|
|
566
584
|
setState({ key: specKey, result: { ...opening, loading: true, errors: [] } });
|
|
567
585
|
}
|
|
@@ -576,12 +594,12 @@ export function useChartResolution(
|
|
|
576
594
|
(frame ? frame.then(() => generationRef.current === generation ? resolve() : EMPTY_RESULT) : resolve())
|
|
577
595
|
.then((next) => {
|
|
578
596
|
if (generationRef.current !== generation) return;
|
|
579
|
-
if (backgroundRefresh && !
|
|
597
|
+
if (backgroundRefresh && !hasChartData(next)) {
|
|
580
598
|
setState((current) => current.key === specKey && current.savedAt != null
|
|
581
599
|
? { ...current, result: { ...current.result, errors: next.errors, warnings: next.warnings } } : current);
|
|
582
600
|
return;
|
|
583
601
|
}
|
|
584
|
-
saveChartResolution(savedKey, next);
|
|
602
|
+
saveChartResolution(savedKey, next, resultRef.current);
|
|
585
603
|
const series = stateSavedAt != null && !next.bufferedSeries ? reuseSavedData(resultRef.current.series, next.series) : next.series;
|
|
586
604
|
const result = series === next.series ? next : { ...next, series };
|
|
587
605
|
if (cache.revision === dataRevision) resultRevisionsRef.current.set(result, { cache, revision: dataRevision });
|
package/src/types/config.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Portfolio, Watchlist } from "./ticker";
|
|
2
2
|
import type { BrokerContractRef, TickerListingRef } from "./instrument";
|
|
3
3
|
import type { LanguagePreference } from "../i18n/languages";
|
|
4
|
-
import {
|
|
4
|
+
import { getDockedPaneIdsFromNode, normalizeDockNode } from "../layout/pane-manager/dock-normalization";
|
|
5
5
|
|
|
6
6
|
export const CURRENT_CONFIG_VERSION = 28;
|
|
7
7
|
|
|
@@ -25,6 +25,18 @@ export interface BrokerInstanceConfig {
|
|
|
25
25
|
* brief, position alerts, the mobile app and Ask Gloom's portfolio context then go without it.
|
|
26
26
|
*/
|
|
27
27
|
localOnly?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* The accounts the user left out of Gloom, each with the name it had then so Brokers can list it.
|
|
30
|
+
* Such an account has no portfolio, is offered nowhere an order is placed, and is not synced; a
|
|
31
|
+
* signed-in broker does not read it at all. Every other account is in, so one linked later shows
|
|
32
|
+
* up. Synced with the profile; an empty list says the user took every account back.
|
|
33
|
+
*/
|
|
34
|
+
excludedAccounts?: BrokerExcludedAccount[];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface BrokerExcludedAccount {
|
|
38
|
+
accountId: string;
|
|
39
|
+
name: string;
|
|
28
40
|
}
|
|
29
41
|
|
|
30
42
|
export interface ColumnConfig {
|
|
@@ -666,15 +678,6 @@ const BLANK_LAYOUT: LayoutConfig = {
|
|
|
666
678
|
|
|
667
679
|
let nextPaneInstanceSeq = 0;
|
|
668
680
|
|
|
669
|
-
function clampDockRatio(ratio: number | undefined): number {
|
|
670
|
-
if (typeof ratio !== "number" || !Number.isFinite(ratio)) return 0.5;
|
|
671
|
-
return Math.max(0.1, Math.min(0.9, ratio));
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
function isDockAxis(value: unknown): value is DockSplitNode["axis"] {
|
|
675
|
-
return value === "horizontal" || value === "vertical";
|
|
676
|
-
}
|
|
677
|
-
|
|
678
681
|
function cloneDockNode(node: DockLayoutNode): DockLayoutNode {
|
|
679
682
|
if (node.kind === "pane") {
|
|
680
683
|
return { kind: "pane", instanceId: node.instanceId };
|
|
@@ -689,57 +692,6 @@ function cloneDockNode(node: DockLayoutNode): DockLayoutNode {
|
|
|
689
692
|
};
|
|
690
693
|
}
|
|
691
694
|
|
|
692
|
-
function normalizeDockNode(
|
|
693
|
-
node: DockLayoutNode | null | undefined,
|
|
694
|
-
validInstanceIds: Set<string>,
|
|
695
|
-
seenPaneIds: Set<string>,
|
|
696
|
-
): DockLayoutNode | null {
|
|
697
|
-
if (!node || typeof node !== "object") return null;
|
|
698
|
-
|
|
699
|
-
if ((node as DockPaneNode).kind === "pane") {
|
|
700
|
-
const instanceId = (node as DockPaneNode).instanceId;
|
|
701
|
-
if (typeof instanceId !== "string" || !validInstanceIds.has(instanceId) || seenPaneIds.has(instanceId)) {
|
|
702
|
-
return null;
|
|
703
|
-
}
|
|
704
|
-
seenPaneIds.add(instanceId);
|
|
705
|
-
return { kind: "pane", instanceId };
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
if ((node as DockSplitNode).kind !== "split") return null;
|
|
709
|
-
const split = node as DockSplitNode;
|
|
710
|
-
if (split.tabs) {
|
|
711
|
-
// Whatever is under a stack is its tabs, nested or not: a pane put back
|
|
712
|
-
// at a place inside it (its remembered spot) joins it.
|
|
713
|
-
const plain: DockSplitNode = { kind: "split", axis: split.axis, ratio: split.ratio, first: split.first, second: split.second };
|
|
714
|
-
const flat = normalizeDockNode(plain, validInstanceIds, seenPaneIds);
|
|
715
|
-
const active = typeof split.tabs.active === "string" ? split.tabs.active : null;
|
|
716
|
-
return flat ? buildDockStack(getDockedPaneIdsFromNode(flat), active) : null;
|
|
717
|
-
}
|
|
718
|
-
const first = normalizeDockNode(split.first, validInstanceIds, seenPaneIds);
|
|
719
|
-
const second = normalizeDockNode(split.second, validInstanceIds, seenPaneIds);
|
|
720
|
-
if (!first && !second) return null;
|
|
721
|
-
if (!first) return second;
|
|
722
|
-
if (!second) return first;
|
|
723
|
-
return {
|
|
724
|
-
kind: "split",
|
|
725
|
-
axis: isDockAxis(split.axis) ? split.axis : "horizontal",
|
|
726
|
-
ratio: clampDockRatio(split.ratio),
|
|
727
|
-
first,
|
|
728
|
-
second,
|
|
729
|
-
};
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
function getDockedPaneIdsFromNode(node: DockLayoutNode | null, result: string[] = []): string[] {
|
|
733
|
-
if (!node) return result;
|
|
734
|
-
if (node.kind === "pane") {
|
|
735
|
-
result.push(node.instanceId);
|
|
736
|
-
return result;
|
|
737
|
-
}
|
|
738
|
-
getDockedPaneIdsFromNode(node.first, result);
|
|
739
|
-
getDockedPaneIdsFromNode(node.second, result);
|
|
740
|
-
return result;
|
|
741
|
-
}
|
|
742
|
-
|
|
743
695
|
export function getPlacedPaneInstanceIds(layout: LayoutConfig): string[] {
|
|
744
696
|
return [...new Set([
|
|
745
697
|
...getDockedPaneIdsFromNode(layout.dockRoot),
|
|
@@ -11,6 +11,7 @@ import type {
|
|
|
11
11
|
PricePoint,
|
|
12
12
|
OptionsChain,
|
|
13
13
|
HolderData,
|
|
14
|
+
SplitHistory,
|
|
14
15
|
} from "./financials";
|
|
15
16
|
import type { TimeRange } from "../time-series/range";
|
|
16
17
|
import type { ChartResolutionSupport, ManualChartResolution } from "../time-series/resolution";
|
|
@@ -385,6 +386,13 @@ export interface AssetDataProvider {
|
|
|
385
386
|
getHolders?(ticker: string, exchange?: string, context?: MarketDataRequestContext): Promise<HolderData>;
|
|
386
387
|
getAnalystResearch?(ticker: string, exchange?: string, context?: MarketDataRequestContext): Promise<AnalystResearchData>;
|
|
387
388
|
getCorporateActions?(ticker: string, exchange?: string, context?: MarketDataRequestContext): Promise<CorporateActionsData>;
|
|
389
|
+
/**
|
|
390
|
+
* The share splits of several bare symbols in a few requests, and nothing
|
|
391
|
+
* else of their corporate actions, by symbol as asked: null for one the
|
|
392
|
+
* source holds no split history for. A symbol the source could not answer
|
|
393
|
+
* for is left out; null when the source cannot answer a batch at all.
|
|
394
|
+
*/
|
|
395
|
+
getSplitHistoryBatch?(symbols: string[], options?: { signal?: AbortSignal }): Promise<Map<string, SplitHistory | null> | null>;
|
|
388
396
|
/**
|
|
389
397
|
* A US symbol's changes: where the issuer that held it trades now (FB is
|
|
390
398
|
* META), or what its holder was called before. Null when none is on record.
|