@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
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
import { useCallback, useMemo, useState } from "react";
|
|
2
|
+
import { apiClient } from "../../../api-client";
|
|
3
|
+
import type {
|
|
4
|
+
HkCbbcContractRow,
|
|
5
|
+
HkCbbcSummary,
|
|
6
|
+
HkCbbcZoneBucket,
|
|
7
|
+
} from "../../../api-client/hk-cbbc";
|
|
8
|
+
import {
|
|
9
|
+
CompositeChart,
|
|
10
|
+
DataTableView,
|
|
11
|
+
PaneStatusBody,
|
|
12
|
+
QueryBar,
|
|
13
|
+
StatGrid,
|
|
14
|
+
usePaneFooter,
|
|
15
|
+
usePaneTabs,
|
|
16
|
+
type DataTableCell,
|
|
17
|
+
type StatItem,
|
|
18
|
+
} from "../../../components";
|
|
19
|
+
import { dayCell } from "../../../components/ui/day-cell";
|
|
20
|
+
import { handleRefreshKey, loadingErrorFooterInfo } from "../../../components/data-table/table-pane";
|
|
21
|
+
import { useAsyncResource } from "../../../react/async-resource";
|
|
22
|
+
import { useThemeColors } from "../../../theme/theme-context";
|
|
23
|
+
import { Box, TextAttributes } from "../../../ui";
|
|
24
|
+
import { MISSING_VALUE, formatNumber } from "../../../utils/format";
|
|
25
|
+
import {
|
|
26
|
+
buildCbbcChartModel,
|
|
27
|
+
CBBC_QUICK_UNDERLYINGS,
|
|
28
|
+
CBBC_TABS,
|
|
29
|
+
cbbcContractColumns,
|
|
30
|
+
cbbcOverviewColumns,
|
|
31
|
+
cbbcZoneColumns,
|
|
32
|
+
fmtCbbcEquiv,
|
|
33
|
+
fmtCbbcLevel,
|
|
34
|
+
fmtDistPct,
|
|
35
|
+
fmtHkd,
|
|
36
|
+
type CbbcViewTab,
|
|
37
|
+
} from "./cbbc-model";
|
|
38
|
+
|
|
39
|
+
const CHART_PANELS = [{ id: "main" }];
|
|
40
|
+
|
|
41
|
+
export function CbbcPositioningView({
|
|
42
|
+
initialUnderlying,
|
|
43
|
+
width,
|
|
44
|
+
height,
|
|
45
|
+
focused,
|
|
46
|
+
}: {
|
|
47
|
+
initialUnderlying: string;
|
|
48
|
+
width: number;
|
|
49
|
+
height: number;
|
|
50
|
+
focused: boolean;
|
|
51
|
+
}) {
|
|
52
|
+
const colors = useThemeColors();
|
|
53
|
+
const [underlying, setUnderlying] = useState(initialUnderlying);
|
|
54
|
+
const [activeTab, setActiveTab] = useState<CbbcViewTab>("zones");
|
|
55
|
+
const [contractSide, setContractSide] = useState<"all" | "bull" | "bear">("all");
|
|
56
|
+
const [selectedId, setSelectedId] = useState<string | null>(null);
|
|
57
|
+
|
|
58
|
+
const loadUnderlying = useCallback(
|
|
59
|
+
() => apiClient.getHkCbbcUnderlying(underlying, 40),
|
|
60
|
+
[underlying],
|
|
61
|
+
);
|
|
62
|
+
const loadOverview = useCallback(() => apiClient.getHkCbbcOverview(40), []);
|
|
63
|
+
|
|
64
|
+
const underlyingRes = useAsyncResource(
|
|
65
|
+
activeTab !== "overview" ? loadUnderlying : null,
|
|
66
|
+
);
|
|
67
|
+
const overviewRes = useAsyncResource(
|
|
68
|
+
activeTab === "overview" ? loadOverview : null,
|
|
69
|
+
);
|
|
70
|
+
const activeRes = activeTab === "overview" ? overviewRes : underlyingRes;
|
|
71
|
+
const data = underlyingRes.data;
|
|
72
|
+
const summary = data?.summary ?? null;
|
|
73
|
+
|
|
74
|
+
const { strip: tabStrip, rows: tabRows } = usePaneTabs({
|
|
75
|
+
tabs: [...CBBC_TABS],
|
|
76
|
+
activeValue: activeTab,
|
|
77
|
+
onSelect: (value) => {
|
|
78
|
+
setActiveTab(value as CbbcViewTab);
|
|
79
|
+
setSelectedId(null);
|
|
80
|
+
},
|
|
81
|
+
focused,
|
|
82
|
+
dense: true,
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
usePaneFooter(
|
|
86
|
+
"options-positioning-cbbc",
|
|
87
|
+
() => ({
|
|
88
|
+
info: [
|
|
89
|
+
{
|
|
90
|
+
id: "cbbc-asof",
|
|
91
|
+
parts: [
|
|
92
|
+
{
|
|
93
|
+
text: summary
|
|
94
|
+
? `HKEX CBBC ${summary.displaySymbol} (${summary.underlyingName}) · ${summary.atDate}`
|
|
95
|
+
: "HKEX CBBC Street Inventory",
|
|
96
|
+
tone: "muted" as const,
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
...loadingErrorFooterInfo(activeRes.loading, activeRes.error),
|
|
101
|
+
],
|
|
102
|
+
hints: [
|
|
103
|
+
{ id: "refresh", key: "r", label: "efresh", onPress: () => activeRes.reload() },
|
|
104
|
+
],
|
|
105
|
+
}),
|
|
106
|
+
[summary, activeRes],
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
const stats = useMemo<StatItem[]>(() => {
|
|
110
|
+
if (!summary) return [];
|
|
111
|
+
const bullPct = summary.bullRatioPct;
|
|
112
|
+
return [
|
|
113
|
+
{ id: "spot", essential: true, label: "Ref Spot", value: fmtCbbcLevel(summary.spotLevel, summary.isIndex) },
|
|
114
|
+
{
|
|
115
|
+
id: "ratio",
|
|
116
|
+
essential: true,
|
|
117
|
+
label: "Bull / Bear",
|
|
118
|
+
value:
|
|
119
|
+
bullPct != null
|
|
120
|
+
? `${formatNumber(bullPct, 1)}% / ${formatNumber(100 - bullPct, 1)}%`
|
|
121
|
+
: MISSING_VALUE,
|
|
122
|
+
tone:
|
|
123
|
+
bullPct == null
|
|
124
|
+
? undefined
|
|
125
|
+
: bullPct >= 55
|
|
126
|
+
? "positive"
|
|
127
|
+
: bullPct <= 45
|
|
128
|
+
? "negative"
|
|
129
|
+
: undefined,
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
id: "heavy-bull",
|
|
133
|
+
essential: true,
|
|
134
|
+
label: "Heavy Bull",
|
|
135
|
+
value: fmtCbbcLevel(summary.heavyBullCallLow, summary.isIndex),
|
|
136
|
+
detail: fmtCbbcEquiv(summary.heavyBullEquiv, summary.isIndex),
|
|
137
|
+
tone: "positive",
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
id: "heavy-bear",
|
|
141
|
+
essential: true,
|
|
142
|
+
label: "Heavy Bear",
|
|
143
|
+
value: fmtCbbcLevel(summary.heavyBearCallLow, summary.isIndex),
|
|
144
|
+
detail: fmtCbbcEquiv(summary.heavyBearEquiv, summary.isIndex),
|
|
145
|
+
tone: "negative",
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
id: "turnover",
|
|
149
|
+
label: "Turnover",
|
|
150
|
+
value: fmtHkd(summary.totalTurnoverHkd),
|
|
151
|
+
detail: `${summary.contractsCount} cts · ${summary.mceCount} MCE`,
|
|
152
|
+
},
|
|
153
|
+
];
|
|
154
|
+
}, [summary]);
|
|
155
|
+
|
|
156
|
+
const chartModel = useMemo(
|
|
157
|
+
() =>
|
|
158
|
+
data && summary
|
|
159
|
+
? buildCbbcChartModel(summary, data.bullZones, data.bearZones, {
|
|
160
|
+
bull: colors.positive,
|
|
161
|
+
bear: colors.negative,
|
|
162
|
+
})
|
|
163
|
+
: { series: [], orderedZones: [], spotRatio: null },
|
|
164
|
+
[data, summary, colors.positive, colors.negative],
|
|
165
|
+
);
|
|
166
|
+
|
|
167
|
+
const zoneRows = useMemo<HkCbbcZoneBucket[]>(() => {
|
|
168
|
+
if (!data) return [];
|
|
169
|
+
// Show nearest Bear zones (highest down to spot) followed by nearest Bull zones (spot down)
|
|
170
|
+
const bears = [...data.bearZones].slice(0, 12).reverse();
|
|
171
|
+
const bulls = [...data.bullZones].slice(0, 12);
|
|
172
|
+
return [...bears, ...bulls];
|
|
173
|
+
}, [data]);
|
|
174
|
+
|
|
175
|
+
const contractRows = useMemo<HkCbbcContractRow[]>(() => {
|
|
176
|
+
if (!data) return [];
|
|
177
|
+
if (contractSide === "bull") return data.topBullContracts;
|
|
178
|
+
if (contractSide === "bear") return data.topBearContracts;
|
|
179
|
+
return [...data.topBullContracts, ...data.topBearContracts].sort(
|
|
180
|
+
(a, b) => b.equivUnits - a.equivUnits,
|
|
181
|
+
);
|
|
182
|
+
}, [data, contractSide]);
|
|
183
|
+
|
|
184
|
+
const zoneCols = useMemo(() => cbbcZoneColumns(width), [width]);
|
|
185
|
+
const contractCols = useMemo(() => cbbcContractColumns(width), [width]);
|
|
186
|
+
const overviewCols = useMemo(() => cbbcOverviewColumns(width), [width]);
|
|
187
|
+
|
|
188
|
+
const bodyHeight = Math.max(4, height - tabRows);
|
|
189
|
+
const showChart =
|
|
190
|
+
activeTab === "zones" && bodyHeight >= 20 && chartModel.series.length > 0;
|
|
191
|
+
const chartHeight = showChart
|
|
192
|
+
? Math.min(11, Math.max(7, Math.floor(bodyHeight * 0.36)))
|
|
193
|
+
: 0;
|
|
194
|
+
|
|
195
|
+
const xAxis = useMemo(() => {
|
|
196
|
+
if (!chartModel.orderedZones.length || !summary) return undefined;
|
|
197
|
+
const total = chartModel.orderedZones.length;
|
|
198
|
+
const step = Math.max(1, Math.floor(total / 5));
|
|
199
|
+
const ticks = chartModel.orderedZones
|
|
200
|
+
.map((z, idx) =>
|
|
201
|
+
idx === 0 || idx === total - 1 || idx % step === 0
|
|
202
|
+
? {
|
|
203
|
+
label: fmtCbbcLevel(z.zoneLow, summary.isIndex),
|
|
204
|
+
ratio: total > 1 ? idx / (total - 1) : 0,
|
|
205
|
+
}
|
|
206
|
+
: null,
|
|
207
|
+
)
|
|
208
|
+
.filter((t): t is { label: string; ratio: number } => t !== null);
|
|
209
|
+
const markers =
|
|
210
|
+
chartModel.spotRatio != null
|
|
211
|
+
? [
|
|
212
|
+
{
|
|
213
|
+
id: "spot",
|
|
214
|
+
xRatio: chartModel.spotRatio,
|
|
215
|
+
label: `Spot ${fmtCbbcLevel(summary.spotLevel, summary.isIndex)}`,
|
|
216
|
+
color: colors.warning,
|
|
217
|
+
},
|
|
218
|
+
]
|
|
219
|
+
: [];
|
|
220
|
+
return {
|
|
221
|
+
ticks,
|
|
222
|
+
markers,
|
|
223
|
+
formatCursor: (ratio: number) => {
|
|
224
|
+
const idx = Math.min(
|
|
225
|
+
total - 1,
|
|
226
|
+
Math.max(0, Math.round(ratio * (total - 1))),
|
|
227
|
+
);
|
|
228
|
+
return chartModel.orderedZones[idx]?.label ?? "";
|
|
229
|
+
},
|
|
230
|
+
};
|
|
231
|
+
}, [chartModel, summary, colors.warning]);
|
|
232
|
+
|
|
233
|
+
const underlyingOptions = useMemo(() => {
|
|
234
|
+
const exists = CBBC_QUICK_UNDERLYINGS.some((u) => u.value === underlying);
|
|
235
|
+
return exists
|
|
236
|
+
? [...CBBC_QUICK_UNDERLYINGS]
|
|
237
|
+
: [{ value: underlying, label: summary?.displaySymbol ?? underlying }, ...CBBC_QUICK_UNDERLYINGS];
|
|
238
|
+
}, [underlying, summary?.displaySymbol]);
|
|
239
|
+
|
|
240
|
+
return (
|
|
241
|
+
<Box width={width} height={height} flexDirection="column">
|
|
242
|
+
{tabStrip}
|
|
243
|
+
|
|
244
|
+
{activeTab !== "overview" ? (
|
|
245
|
+
<QueryBar
|
|
246
|
+
width={width}
|
|
247
|
+
filters={[
|
|
248
|
+
{
|
|
249
|
+
id: "underlying",
|
|
250
|
+
label: "Underlying",
|
|
251
|
+
value: underlying,
|
|
252
|
+
options: underlyingOptions,
|
|
253
|
+
onChange: (v: string) => {
|
|
254
|
+
setUnderlying(v);
|
|
255
|
+
setSelectedId(null);
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
...(activeTab === "contracts"
|
|
259
|
+
? [
|
|
260
|
+
{
|
|
261
|
+
id: "side",
|
|
262
|
+
label: "Side",
|
|
263
|
+
inline: true,
|
|
264
|
+
value: contractSide,
|
|
265
|
+
options: [
|
|
266
|
+
{ value: "all", label: "All" },
|
|
267
|
+
{ value: "bull", label: "Bull" },
|
|
268
|
+
{ value: "bear", label: "Bear" },
|
|
269
|
+
],
|
|
270
|
+
onChange: (v: string) =>
|
|
271
|
+
setContractSide(v as "all" | "bull" | "bear"),
|
|
272
|
+
},
|
|
273
|
+
]
|
|
274
|
+
: []),
|
|
275
|
+
]}
|
|
276
|
+
/>
|
|
277
|
+
) : null}
|
|
278
|
+
|
|
279
|
+
<PaneStatusBody
|
|
280
|
+
loading={!activeRes.data && activeRes.loading}
|
|
281
|
+
error={!activeRes.data ? activeRes.error : null}
|
|
282
|
+
empty={!activeRes.data && !activeRes.loading && !activeRes.error}
|
|
283
|
+
emptyTitle={`No HKEX CBBC street inventory found for ${underlying}.`}
|
|
284
|
+
subject="HKEX CBBC positioning"
|
|
285
|
+
>
|
|
286
|
+
{activeTab === "overview" && overviewRes.data ? (
|
|
287
|
+
<DataTableView<HkCbbcSummary>
|
|
288
|
+
focused={focused}
|
|
289
|
+
rootWidth={width}
|
|
290
|
+
columns={overviewCols}
|
|
291
|
+
items={overviewRes.data.topUnderlyings}
|
|
292
|
+
sortColumnId="turnover"
|
|
293
|
+
sortDirection="desc"
|
|
294
|
+
emptyStateTitle="No HKEX CBBC underlyings available."
|
|
295
|
+
getItemKey={(row) => row.underlyingCode}
|
|
296
|
+
selection={{
|
|
297
|
+
kind: "id",
|
|
298
|
+
selectedId,
|
|
299
|
+
getId: (r) => r.underlyingCode,
|
|
300
|
+
onChange: setSelectedId,
|
|
301
|
+
}}
|
|
302
|
+
onActivate={(row) => {
|
|
303
|
+
setUnderlying(row.underlyingCode);
|
|
304
|
+
setActiveTab("zones");
|
|
305
|
+
setSelectedId(null);
|
|
306
|
+
}}
|
|
307
|
+
onRootKeyDown={(key) => handleRefreshKey(key, activeRes.reload, { stopPropagation: true })}
|
|
308
|
+
renderCell={(row, col): DataTableCell => {
|
|
309
|
+
switch (col.id) {
|
|
310
|
+
case "symbol":
|
|
311
|
+
return { text: row.displaySymbol, color: colors.textBright, attributes: TextAttributes.BOLD };
|
|
312
|
+
case "name":
|
|
313
|
+
return { text: row.underlyingName, color: colors.text };
|
|
314
|
+
case "spot":
|
|
315
|
+
return { text: fmtCbbcLevel(row.spotLevel, row.isIndex), color: colors.text };
|
|
316
|
+
case "bullPct":
|
|
317
|
+
return {
|
|
318
|
+
text: row.bullRatioPct != null ? `${formatNumber(row.bullRatioPct, 1)}%` : MISSING_VALUE,
|
|
319
|
+
value: row.bullRatioPct ?? undefined,
|
|
320
|
+
color: (row.bullRatioPct ?? 50) >= 55 ? colors.positive : (row.bullRatioPct ?? 50) <= 45 ? colors.negative : colors.text,
|
|
321
|
+
};
|
|
322
|
+
case "heavyBull":
|
|
323
|
+
return { text: fmtCbbcLevel(row.heavyBullCallLow, row.isIndex), color: colors.positive };
|
|
324
|
+
case "heavyBear":
|
|
325
|
+
return { text: fmtCbbcLevel(row.heavyBearCallLow, row.isIndex), color: colors.negative };
|
|
326
|
+
default:
|
|
327
|
+
return { text: fmtHkd(row.totalTurnoverHkd), value: row.totalTurnoverHkd, color: colors.textDim };
|
|
328
|
+
}
|
|
329
|
+
}}
|
|
330
|
+
/>
|
|
331
|
+
) : data && summary ? (
|
|
332
|
+
<Box flexDirection="column" flexGrow={1} minHeight={0}>
|
|
333
|
+
<StatGrid items={stats} width={width} />
|
|
334
|
+
{showChart ? (
|
|
335
|
+
<CompositeChart
|
|
336
|
+
series={chartModel.series}
|
|
337
|
+
panels={CHART_PANELS}
|
|
338
|
+
width={width}
|
|
339
|
+
height={chartHeight}
|
|
340
|
+
focused={false}
|
|
341
|
+
navigable={false}
|
|
342
|
+
showLegend
|
|
343
|
+
showTimeAxis
|
|
344
|
+
xAxis={xAxis}
|
|
345
|
+
formatValue={(v) => fmtCbbcEquiv(v, summary.isIndex)}
|
|
346
|
+
formatAxisValue={(v) => fmtCbbcEquiv(v, summary.isIndex)}
|
|
347
|
+
remoteKind="hk-cbbc-zones"
|
|
348
|
+
/>
|
|
349
|
+
) : null}
|
|
350
|
+
|
|
351
|
+
{activeTab === "zones" ? (
|
|
352
|
+
<DataTableView<HkCbbcZoneBucket>
|
|
353
|
+
focused={focused}
|
|
354
|
+
rootWidth={width}
|
|
355
|
+
columns={zoneCols}
|
|
356
|
+
items={zoneRows}
|
|
357
|
+
sortColumnId="zone"
|
|
358
|
+
sortDirection="desc"
|
|
359
|
+
emptyStateTitle="No active CBBC knock-out zones."
|
|
360
|
+
getItemKey={(row) => `${row.direction}:${row.zoneLow}`}
|
|
361
|
+
selection={{
|
|
362
|
+
kind: "id",
|
|
363
|
+
selectedId,
|
|
364
|
+
getId: (r) => `${r.direction}:${r.zoneLow}`,
|
|
365
|
+
onChange: setSelectedId,
|
|
366
|
+
}}
|
|
367
|
+
onRootKeyDown={(key) => handleRefreshKey(key, activeRes.reload, { stopPropagation: true })}
|
|
368
|
+
renderCell={(row, col): DataTableCell => {
|
|
369
|
+
const isBull = row.direction === "bull";
|
|
370
|
+
const sideColor = isBull ? colors.positive : colors.negative;
|
|
371
|
+
switch (col.id) {
|
|
372
|
+
case "zone":
|
|
373
|
+
return {
|
|
374
|
+
text: row.label,
|
|
375
|
+
color: row.isHeavyZone ? colors.textBright : colors.text,
|
|
376
|
+
attributes: row.isHeavyZone ? TextAttributes.BOLD : undefined,
|
|
377
|
+
};
|
|
378
|
+
case "side":
|
|
379
|
+
return { text: isBull ? "BULL" : "BEAR", color: sideColor, attributes: TextAttributes.BOLD };
|
|
380
|
+
case "dist":
|
|
381
|
+
return { text: fmtDistPct(row.distancePct), value: row.distancePct ?? undefined, color: colors.textDim };
|
|
382
|
+
case "equiv":
|
|
383
|
+
return {
|
|
384
|
+
text: fmtCbbcEquiv(row.equivFutures ?? row.equivUnits, summary.isIndex),
|
|
385
|
+
value: row.equivFutures ?? row.equivUnits,
|
|
386
|
+
color: sideColor,
|
|
387
|
+
};
|
|
388
|
+
case "contracts":
|
|
389
|
+
return { text: String(row.contractsCount), value: row.contractsCount, color: colors.textDim };
|
|
390
|
+
case "turnover":
|
|
391
|
+
return { text: fmtHkd(row.turnoverHkd), value: row.turnoverHkd, color: colors.textDim };
|
|
392
|
+
case "issuer":
|
|
393
|
+
return { text: row.topIssuer ?? MISSING_VALUE, color: colors.textDim };
|
|
394
|
+
default:
|
|
395
|
+
return {
|
|
396
|
+
text: row.isHeavyZone ? (isBull ? "HEAVY BULL" : "HEAVY BEAR") : "",
|
|
397
|
+
color: sideColor,
|
|
398
|
+
attributes: row.isHeavyZone ? TextAttributes.BOLD : undefined,
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
}}
|
|
402
|
+
/>
|
|
403
|
+
) : (
|
|
404
|
+
<DataTableView<HkCbbcContractRow>
|
|
405
|
+
focused={focused}
|
|
406
|
+
rootWidth={width}
|
|
407
|
+
columns={contractCols}
|
|
408
|
+
items={contractRows}
|
|
409
|
+
sortColumnId="equiv"
|
|
410
|
+
sortDirection="desc"
|
|
411
|
+
emptyStateTitle="No active CBBC contracts."
|
|
412
|
+
getItemKey={(row) => row.cbbcCode}
|
|
413
|
+
selection={{
|
|
414
|
+
kind: "id",
|
|
415
|
+
selectedId,
|
|
416
|
+
getId: (r) => r.cbbcCode,
|
|
417
|
+
onChange: setSelectedId,
|
|
418
|
+
}}
|
|
419
|
+
onRootKeyDown={(key) => handleRefreshKey(key, activeRes.reload, { stopPropagation: true })}
|
|
420
|
+
renderCell={(row, col): DataTableCell => {
|
|
421
|
+
const isBull = row.direction === "bull";
|
|
422
|
+
const sideColor = isBull ? colors.positive : colors.negative;
|
|
423
|
+
switch (col.id) {
|
|
424
|
+
case "code":
|
|
425
|
+
return { text: row.cbbcCode, color: colors.textBright, attributes: TextAttributes.BOLD };
|
|
426
|
+
case "side":
|
|
427
|
+
return { text: isBull ? "BULL" : "BEAR", color: sideColor };
|
|
428
|
+
case "call":
|
|
429
|
+
return { text: fmtCbbcLevel(row.callLevel, summary.isIndex), value: row.callLevel, color: sideColor };
|
|
430
|
+
case "strike":
|
|
431
|
+
return { text: fmtCbbcLevel(row.strikeLevel, summary.isIndex), value: row.strikeLevel, color: colors.textDim };
|
|
432
|
+
case "outPct":
|
|
433
|
+
return { text: `${formatNumber(row.outInMarketPct, 1)}%`, value: row.outInMarketPct, color: colors.text };
|
|
434
|
+
case "equiv":
|
|
435
|
+
return {
|
|
436
|
+
text: fmtCbbcEquiv(row.equivFutures ?? row.equivUnits, summary.isIndex),
|
|
437
|
+
value: row.equivFutures ?? row.equivUnits,
|
|
438
|
+
color: colors.textBright,
|
|
439
|
+
};
|
|
440
|
+
case "issuer":
|
|
441
|
+
return { text: row.issuerName, color: colors.textDim };
|
|
442
|
+
default:
|
|
443
|
+
return dayCell(row.maturityDate);
|
|
444
|
+
}
|
|
445
|
+
}}
|
|
446
|
+
/>
|
|
447
|
+
)}
|
|
448
|
+
</Box>
|
|
449
|
+
) : null}
|
|
450
|
+
</PaneStatusBody>
|
|
451
|
+
</Box>
|
|
452
|
+
);
|
|
453
|
+
}
|
|
@@ -66,7 +66,7 @@ export const optionsPositioningModule: PluginModule = {
|
|
|
66
66
|
positioningTemplate({
|
|
67
67
|
id: "options-positioning-pane",
|
|
68
68
|
label: "Options Positioning",
|
|
69
|
-
description: "Open interest by strike and expiry, max pain, walls and dealer gamma (GEX); BTC-USD and ETH-USD
|
|
69
|
+
description: "Open interest by strike and expiry, max pain, walls and dealer gamma (GEX); BTC-USD and ETH-USD options as listed on Deribit.",
|
|
70
70
|
keywords: ["opx", "open interest", "max pain", "put call", "expiry", "options", "deribit", "bitcoin options", "ether options", "crypto options"],
|
|
71
71
|
shortcut: "OPX",
|
|
72
72
|
shortcutAliases: ["MAXPAIN"],
|
|
@@ -78,5 +78,26 @@ export const optionsPositioningModule: PluginModule = {
|
|
|
78
78
|
keywords: ["gex", "gamma", "dealer gamma", "gamma exposure", "gamma flip", "zero gamma", "gamma level", "call wall", "put wall", "0dte"],
|
|
79
79
|
shortcut: "GEX",
|
|
80
80
|
}, "gex"),
|
|
81
|
+
(() => {
|
|
82
|
+
const cbbcTemplate = createTickerSurfacePaneTemplate({
|
|
83
|
+
id: "options-positioning-cbbc",
|
|
84
|
+
paneId: "options-positioning",
|
|
85
|
+
viewKey: "CBBC",
|
|
86
|
+
publicShare: true,
|
|
87
|
+
label: "Hong Kong CBBC Map",
|
|
88
|
+
description: "HKEX Callable Bull/Bear Contract (CBBC) knock-out call-level street map, bull/bear ratios, equivalent HSI futures delta and heavy kill zones.",
|
|
89
|
+
keywords: ["cbbc", "bull bear", "knockout", "kill zone", "hsi", "hstech", "hkex", "street inventory"],
|
|
90
|
+
shortcut: "CBBC",
|
|
91
|
+
shortcutAliases: ["BULLBEAR"],
|
|
92
|
+
settings: () => ({ tab: "cbbc" }),
|
|
93
|
+
});
|
|
94
|
+
const withHsi = (context: PaneTemplateContext): PaneTemplateContext =>
|
|
95
|
+
context.activeTicker ? context : { ...context, activeTicker: "HSI" };
|
|
96
|
+
return {
|
|
97
|
+
...cbbcTemplate,
|
|
98
|
+
canCreate: (context, createOptions) => cbbcTemplate.canCreate?.(withHsi(context), createOptions) ?? true,
|
|
99
|
+
createInstance: (context, createOptions) => cbbcTemplate.createInstance?.(withHsi(context), createOptions) ?? null,
|
|
100
|
+
};
|
|
101
|
+
})(),
|
|
81
102
|
],
|
|
82
103
|
};
|
|
@@ -49,6 +49,8 @@ import { useCloudDisplayScope } from "../../../api-client/plan-access";
|
|
|
49
49
|
import {
|
|
50
50
|
COIN_OPTIONS_HINT, isCoinWithoutOptions, optionsUnavailableHint, optionsUnavailableTitle, unservedOptionsVenue,
|
|
51
51
|
} from "../../../market-data/options-alternatives";
|
|
52
|
+
import { hkCbbcUnderlying } from "../../../api-client/hk-cbbc";
|
|
53
|
+
import { CbbcPositioningView } from "./cbbc-view";
|
|
52
54
|
import {
|
|
53
55
|
loadGamma,
|
|
54
56
|
loadOpenInterest,
|
|
@@ -198,7 +200,20 @@ function PositioningChart(props: PositioningChartProps) {
|
|
|
198
200
|
const UNDERLYING_STATE_KEY = /^opx:(expiry|gammaExpiry|strike|expiryRow|gammaStrike)(:|$)/;
|
|
199
201
|
|
|
200
202
|
export function OptionsPositioningPane(props: PaneProps) {
|
|
201
|
-
const { symbol } = usePaneTickerIdentity();
|
|
203
|
+
const { symbol, ticker } = usePaneTickerIdentity();
|
|
204
|
+
const [openingMode] = usePaneSettingValue("tab", "strikes");
|
|
205
|
+
const cbbcCode = hkCbbcUnderlying(symbol, ticker?.metadata.exchange);
|
|
206
|
+
if (cbbcCode || openingMode === "cbbc") {
|
|
207
|
+
return (
|
|
208
|
+
<CbbcPositioningView
|
|
209
|
+
key={cbbcCode ?? "HSI"}
|
|
210
|
+
initialUnderlying={cbbcCode ?? "HSI"}
|
|
211
|
+
width={props.width}
|
|
212
|
+
height={props.height}
|
|
213
|
+
focused={props.focused}
|
|
214
|
+
/>
|
|
215
|
+
);
|
|
216
|
+
}
|
|
202
217
|
// A coin nothing lists options on (SOL-USD) says which coins have them, before any request.
|
|
203
218
|
if (symbol && isCoinWithoutOptions(symbol)) return <EmptyState title={optionsUnavailableTitle(parsePublicTickerKey(symbol).symbol)} hint={COIN_OPTIONS_HINT} />;
|
|
204
219
|
// So does a listing whose venue lists options Gloom does not serve (0700 on HKEX), never "no listed options".
|
|
@@ -4,6 +4,7 @@ import { Box, Text } from "../../../ui";
|
|
|
4
4
|
import { resolveChartPalette } from "../../../components/chart/core/palette";
|
|
5
5
|
import { useThemeColors } from "../../../theme/theme-context";
|
|
6
6
|
import { displayWidth } from "../../../utils/format";
|
|
7
|
+
import { formatDay } from "../../../utils/day-format";
|
|
7
8
|
import { ClippedText } from "../../../components/ui/display";
|
|
8
9
|
import { currencyLabel, scenarioLegsText, scenarioValueUnit, type buildScenario } from "./model";
|
|
9
10
|
|
|
@@ -26,7 +27,7 @@ export function ScenarioPayoffChart({ scenario, width, height, focused = false,
|
|
|
26
27
|
const ticks = [0, .25, .5, .75, 1].map((ratio) => ({ ratio, label: (first + ratio * span).toFixed(2) }));
|
|
27
28
|
return { points, overlays, ticks, first, span };
|
|
28
29
|
}, [scenario, colors]);
|
|
29
|
-
const date = (value: number) =>
|
|
30
|
+
const date = (value: number) => formatDay(value);
|
|
30
31
|
// The legs the curves value, and the session when it is not the regular one.
|
|
31
32
|
const valued = session ? `valued ${session}` : "";
|
|
32
33
|
const legsRoom = Math.max(0, width - 2 - (valued ? displayWidth(valued) + 3 : 0));
|
|
@@ -7,7 +7,7 @@ import { formatHedgePrice } from "./hedge";
|
|
|
7
7
|
import { exportPercent } from "./model";
|
|
8
8
|
import { scenarioQuoteTimesLabel, type ScenarioQuoteTimes } from "./freshness";
|
|
9
9
|
import {
|
|
10
|
-
CSP_SCREEN_DEFAULTS, CSP_SCREEN_LIMIT, cspEarningsText, cspScreenCriteriaText, loadCspScreen, readCspScreenCriteria,
|
|
10
|
+
CSP_SCREEN_DEFAULTS, CSP_SCREEN_LIMIT, cspEarningsCell, cspEarningsText, cspScreenCriteriaText, loadCspScreen, readCspScreenCriteria,
|
|
11
11
|
type CspScreen, type CspScreenRow,
|
|
12
12
|
} from "./csp-screen";
|
|
13
13
|
import {
|
|
@@ -66,7 +66,7 @@ const COLUMNS: HeadlessPaneColumn[] = [
|
|
|
66
66
|
{ key: "midYield", header: "Mid yield/yr", align: "right", format: percentCell(2) },
|
|
67
67
|
{ key: "bidYield", header: "Bid yield/yr", align: "right", format: percentCell(2) },
|
|
68
68
|
{ key: "ivRank", header: "IVR", align: "right", format: (value) => typeof value === "number" ? value.toFixed(0) : MISSING_VALUE },
|
|
69
|
-
{ key: "earnings", header: "Earnings" },
|
|
69
|
+
{ key: "earnings", header: "Earnings", textFormat: (_value, row) => cspEarningsCell(row) },
|
|
70
70
|
];
|
|
71
71
|
const NOTE: HeadlessPaneColumn = { key: "note", header: "Note", underRow: true };
|
|
72
72
|
const EXPORT_ONLY: HeadlessPaneColumn[] = [
|
|
@@ -84,8 +84,8 @@ const listText = (items: readonly string[]) => items.length <= 1 ? items.join(""
|
|
|
84
84
|
/**
|
|
85
85
|
* The ranking basis and the wide flag's limit, then the names IV history has no
|
|
86
86
|
* rank for: those with a reason say it (`No IV rank: BBB (fewer than 120
|
|
87
|
-
* sessions)
|
|
88
|
-
*
|
|
87
|
+
* sessions).`, `AAA (IV history not collected, coverage full)`), and a bare
|
|
88
|
+
* symbol, which has none to give, is listed (`No IV rank for DAL.`).
|
|
89
89
|
*/
|
|
90
90
|
export function cspScreenNotes(
|
|
91
91
|
screen: { criteria: Pick<CspScreen["criteria"], "maxSpreadPercent">; missingRanks: string[] }, rankedBy = "annualised yield at the bid",
|
|
@@ -95,7 +95,7 @@ export function cspScreenNotes(
|
|
|
95
95
|
return [
|
|
96
96
|
`Ranked by ${rankedBy}. Wide is a spread over ${screen.criteria.maxSpreadPercent}% of the mid (--max-spread).`,
|
|
97
97
|
...(reasoned.length ? [`No IV rank: ${reasoned.join(", ")}.`] : []),
|
|
98
|
-
...(bare.length ? [`No IV rank for ${listText(bare)}
|
|
98
|
+
...(bare.length ? [`No IV rank for ${listText(bare)}.`] : []),
|
|
99
99
|
];
|
|
100
100
|
}
|
|
101
101
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { MISSING_VALUE } from "../../../utils/format";
|
|
2
2
|
import { scenarioQuoteTimesLabel } from "./freshness";
|
|
3
|
-
import {
|
|
3
|
+
import { dayCell } from "../../../components/ui/day-cell";
|
|
4
|
+
import { formatDaysInText } from "../../../utils/day-format";
|
|
4
5
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
5
6
|
import {
|
|
6
7
|
DataTableView, PaneStatusBody, QueryBar, usePaneFooter, usePaneNoticeFooter, usePaneTabs, type DataTableCell, type DataTableColumn, type DataTableKeyEvent,
|
|
@@ -22,7 +23,7 @@ import {
|
|
|
22
23
|
cspScreenNotes, cspScreenReportRow, rewardRiskText, STRATEGY_MONEY_UNIT, strategyScreenReportRow, type CspScreenReportRow,
|
|
23
24
|
type StrategyScreenReportRow,
|
|
24
25
|
} from "./csp-screen-headless";
|
|
25
|
-
import { CSP_SCREEN_DEFAULTS, CSP_SCREEN_LIMIT, cspScreenCriteriaText, cspTargetDate, loadCspScreen, readCspScreenCriteria, type CspScreenRow } from "./csp-screen";
|
|
26
|
+
import { CSP_SCREEN_DEFAULTS, CSP_SCREEN_LIMIT, cspEarningsCell, cspScreenCriteriaText, cspTargetDate, loadCspScreen, readCspScreenCriteria, type CspScreenRow } from "./csp-screen";
|
|
26
27
|
import { formatHedgePrice } from "./hedge";
|
|
27
28
|
import {
|
|
28
29
|
loadStrategyScreen, readStrategyFamily, readStrategyScreenCriteria, STRATEGY_TABS, strategyFamilyDef, strategyRankedBy,
|
|
@@ -35,7 +36,7 @@ type TradeRow = StrategyScreenReportRow & { source: StrategyScreenRow };
|
|
|
35
36
|
const COLUMNS: DataTableColumn[] = [
|
|
36
37
|
{ id: "rank", label: "#", width: 3, align: "right" },
|
|
37
38
|
{ id: "symbol", label: "Symbol", width: 7, align: "left" },
|
|
38
|
-
{ id: "expiry", label: "Expiry", width:
|
|
39
|
+
{ id: "expiry", label: "Expiry", width: 11, align: "right" },
|
|
39
40
|
{ id: "days", label: "DTE", width: 4, align: "right" },
|
|
40
41
|
{ id: "strike", label: "Strike", width: 8, align: "right" },
|
|
41
42
|
{ id: "bid", label: "Bid", width: 7, align: "right" },
|
|
@@ -46,7 +47,7 @@ const COLUMNS: DataTableColumn[] = [
|
|
|
46
47
|
{ id: "midYield", label: "Mid yield/yr", width: 12, align: "right" },
|
|
47
48
|
{ id: "bidYield", label: "Bid yield/yr", width: 12, align: "right" },
|
|
48
49
|
{ id: "ivRank", label: "IVR", width: 4, align: "right" },
|
|
49
|
-
{ id: "earnings", label: "Earnings", width:
|
|
50
|
+
{ id: "earnings", label: "Earnings", width: 13, align: "left" },
|
|
50
51
|
];
|
|
51
52
|
|
|
52
53
|
/** At a narrow width the put screen keeps the put, its yield and its risks; its expiry and the mid's yield give way first. */
|
|
@@ -106,12 +107,6 @@ const percentText = (value: unknown, digits: number) => typeof value === "number
|
|
|
106
107
|
const priceText = (value: unknown) => typeof value === "number" ? formatHedgePrice(value) : MISSING_VALUE;
|
|
107
108
|
const moneyText = (value: number) => value.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 });
|
|
108
109
|
const riskText = (value: number | null, unlimited: boolean) => value != null ? moneyText(value) : unlimited ? "unlimited" : MISSING_VALUE;
|
|
109
|
-
/** `before Oct 28`: the flag and the date without its year, which the next report never needs. */
|
|
110
|
-
const earningsCell = (row: { earningsDate: string | null; earningsBeforeExpiry: boolean | null; earnings: string }) => {
|
|
111
|
-
const date = row.earningsDate;
|
|
112
|
-
if (!date || row.earningsBeforeExpiry == null) return row.earnings;
|
|
113
|
-
return `${row.earningsBeforeExpiry ? "before" : "after"} ${formatShortDate(`${date}T00:00:00Z`, { year: false, utc: true })}`;
|
|
114
|
-
};
|
|
115
110
|
/** A column's value to sort on: earnings by date, a flag as a number, an unlimited gain or loss above every limit. */
|
|
116
111
|
function sortValue(row: Record<string, unknown>, columnId: string): string | number | null {
|
|
117
112
|
if (columnId === "earnings") return typeof row.earningsDate === "string" ? row.earningsDate : null;
|
|
@@ -208,7 +203,8 @@ export function CspScreenPane({ width, height, focused }: PaneProps) {
|
|
|
208
203
|
...(resource.loading ? [{ id: "loading", parts: [{ text: "loading", tone: "muted" as const }] }] : []),
|
|
209
204
|
] }), [resource.loading]);
|
|
210
205
|
const now = Date.now();
|
|
211
|
-
|
|
206
|
+
// The expiry reads day first in the pane; the report's heading keeps the ISO day `--expiration` takes.
|
|
207
|
+
const criteriaText = formatDaysInText(criteria.value ? cspScreenCriteriaText(criteria.value, now) : criteria.trade ? strategyScreenCriteriaText(criteria.trade, now) : "");
|
|
212
208
|
// Enter opens the name's trade in OSA: the put at the strike and expiry the screen read, any other trade as its legs.
|
|
213
209
|
const openScenario = (row: ScreenRow | TradeRow) => {
|
|
214
210
|
if ("csp" in row.source) {
|
|
@@ -236,7 +232,7 @@ export function CspScreenPane({ width, height, focused }: PaneProps) {
|
|
|
236
232
|
switch (id) {
|
|
237
233
|
case "rank": return { text: row.rank == null ? "" : String(row.rank), color: colors.textDim };
|
|
238
234
|
case "symbol": return { text: row.symbol, color: colors.textBright };
|
|
239
|
-
case "expiry": return {
|
|
235
|
+
case "expiry": return { ...dayCell(row.expiry), color: colors.textDim };
|
|
240
236
|
case "days": return { text: row.days == null ? MISSING_VALUE : String(row.days) };
|
|
241
237
|
case "strike": return { text: row.strike == null ? MISSING_VALUE : String(row.strike) };
|
|
242
238
|
case "bid": return { text: priceText(row.bid) };
|
|
@@ -247,7 +243,8 @@ export function CspScreenPane({ width, height, focused }: PaneProps) {
|
|
|
247
243
|
case "midYield": return { text: percentText(row.midYield, 2), color: colors.textDim };
|
|
248
244
|
case "bidYield": return { text: percentText(row.bidYield, 2), color: colors.positive };
|
|
249
245
|
case "ivRank": return { text: typeof row.ivRank === "number" ? row.ivRank.toFixed(0) : MISSING_VALUE };
|
|
250
|
-
|
|
246
|
+
// The export keeps the flag with the ISO day (`before 2026-11-04`), or the word for none.
|
|
247
|
+
case "earnings": return { text: cspEarningsCell(row), value: String(row.earnings), color: row.earningsBeforeExpiry === true ? colors.warning : colors.textDim };
|
|
251
248
|
default: return { text: "" };
|
|
252
249
|
}
|
|
253
250
|
};
|
|
@@ -269,7 +266,7 @@ export function CspScreenPane({ width, height, focused }: PaneProps) {
|
|
|
269
266
|
case "rewardRisk": return { text: rewardRiskText(row.rewardRisk, row.unlimited), value: row.rewardRisk };
|
|
270
267
|
case "ivRank": return { text: typeof row.ivRank === "number" ? row.ivRank.toFixed(0) : MISSING_VALUE };
|
|
271
268
|
case "spread": return { text: `${percentText(row.spread, 1)}${row.wide ? " wide" : ""}`, color: row.wide ? colors.warning : undefined };
|
|
272
|
-
case "earnings": return { text:
|
|
269
|
+
case "earnings": return { text: cspEarningsCell(row), value: row.earningsDate,
|
|
273
270
|
color: row.earningsBeforeExpiry === true ? colors.warning : colors.textDim };
|
|
274
271
|
default: return { text: "" };
|
|
275
272
|
}
|