@gloom-sh/terminal 0.20.21 → 0.20.23
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/account/heard-from-question.tsx +6 -4
- package/src/account/heard-from.ts +3 -4
- 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/heard-from.ts +5 -7
- 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 +68 -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/ticker-data.ts +3 -1
- 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-cell-metrics-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 +141 -76
- 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 +20 -23
- 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/listing-arg.ts +45 -18
- package/src/cli/pane-functions/catalog-snapshot.json +26 -22
- package/src/cli/pane-functions/catalog.ts +6 -2
- package/src/cli/pane-functions/data.ts +3 -1
- package/src/cli/pane-functions/dom.ts +8 -5
- package/src/cli/pane-functions/freshness.ts +6 -1
- package/src/cli/pane-functions/function-help.ts +32 -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 +13 -3
- 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 +21 -3
- 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/symbol-list.ts +52 -14
- package/src/cli/ticker-resolution.ts +133 -38
- package/src/cli/visible-key-values.ts +3 -2
- package/src/components/chart/composite/composite-chart.tsx +12 -0
- 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/composite/types.ts +18 -0
- package/src/components/chart/composite/use-composite-chart-keyboard.ts +38 -15
- package/src/components/chart/curve/model.ts +4 -1
- package/src/components/chart-table/header.tsx +11 -5
- package/src/components/chart-table/selection.ts +20 -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 +52 -8
- package/src/components/feed-data-table/stack-view.tsx +88 -5
- package/src/components/index.ts +3 -3
- package/src/components/layout/floating-pane.tsx +5 -2
- package/src/components/layout/pane/header.tsx +33 -32
- 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/badge/index.tsx +9 -4
- package/src/components/ticker/badge/list.tsx +3 -1
- 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 +64 -16
- package/src/components/ui/data-table/muted-row.tsx +47 -0
- package/src/components/ui/data-table/opentui/index.tsx +47 -11
- package/src/components/ui/data-table/spill.ts +36 -0
- package/src/components/ui/data-table/types.ts +113 -6
- package/src/components/ui/data-table/use-column-order.ts +11 -0
- package/src/components/ui/data-table/visible-range.ts +9 -1
- package/src/components/ui/day-cell.ts +30 -0
- package/src/components/ui/icon.tsx +50 -3
- package/src/components/ui/index.ts +3 -1
- package/src/components/ui/list-view.tsx +2 -2
- package/src/components/ui/prose.tsx +3 -1
- package/src/components/ui/table-layout.ts +220 -6
- package/src/components/ui/terminal-hover-label.tsx +49 -0
- package/src/components/use-pinned-moment.ts +222 -13
- package/src/core/state/app/layout.ts +7 -2
- package/src/core/state/app/state.ts +17 -4
- package/src/core/state/app/types.ts +2 -1
- 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 +90 -12
- package/src/data/sqlite/checkpointer.ts +75 -12
- package/src/data/sqlite/database.ts +18 -1
- package/src/data/sqlite/retry.ts +1 -1
- package/src/docs/load.ts +5 -2
- package/src/docs/snapshot.json +1862 -4456
- package/src/i18n/es.ts +109 -0
- package/src/i18n/index.ts +74 -4
- package/src/i18n/ja.ts +109 -0
- package/src/i18n/ko.ts +109 -0
- package/src/i18n/react.ts +10 -2
- package/src/i18n/zh-cn.ts +109 -0
- package/src/i18n/zh-tw.ts +109 -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 +39 -35
- package/src/market-data/market/globex-day.ts +14 -0
- 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/published-us-sessions.ts +3 -2
- 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/live-valuation.ts +4 -2
- package/src/market-data/quotes/metadata.ts +48 -5
- package/src/market-data/quotes/regular-session-valuation.ts +18 -1
- 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 +93 -36
- 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 +14 -5
- 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/attachments/desktop.tsx +46 -12
- package/src/plugins/builtin/chat/channels.ts +5 -2
- package/src/plugins/builtin/chat/content/composer-runtime.ts +64 -65
- package/src/plugins/builtin/chat/content/footer.tsx +17 -7
- package/src/plugins/builtin/chat/content/index.tsx +108 -36
- package/src/plugins/builtin/chat/content/new-dm-dialog.tsx +21 -8
- package/src/plugins/builtin/chat/content/selection-runtime.ts +16 -0
- package/src/plugins/builtin/chat/content/shortcuts.ts +3 -0
- package/src/plugins/builtin/chat/content/snapshot.ts +37 -13
- package/src/plugins/builtin/chat/content/transcript.tsx +12 -0
- package/src/plugins/builtin/chat/content/types.ts +2 -0
- package/src/plugins/builtin/chat/controller/channels.ts +15 -15
- package/src/plugins/builtin/chat/controller/draft-sync.ts +13 -7
- package/src/plugins/builtin/chat/controller/index.ts +140 -34
- package/src/plugins/builtin/chat/controller/lifecycle.ts +8 -12
- package/src/plugins/builtin/chat/controller/persistence.ts +32 -4
- package/src/plugins/builtin/chat/controller/send.ts +41 -17
- package/src/plugins/builtin/chat/controller/session-runtime.ts +28 -27
- package/src/plugins/builtin/chat/controller/state.ts +21 -8
- package/src/plugins/builtin/chat/controller/storage.ts +41 -4
- package/src/plugins/builtin/chat/controller/view.ts +6 -3
- package/src/plugins/builtin/chat/index.tsx +1 -1
- package/src/plugins/builtin/chat/layout.ts +8 -1
- package/src/plugins/builtin/chat/message/desktop.tsx +15 -11
- package/src/plugins/builtin/chat/message/header.tsx +112 -30
- package/src/plugins/builtin/chat/message/reactions.tsx +10 -11
- package/src/plugins/builtin/chat/message/render-state.ts +4 -2
- package/src/plugins/builtin/chat/message/terminal.tsx +13 -15
- package/src/plugins/builtin/chat/message/types.ts +5 -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/cloud-tweets/table.tsx +25 -2
- 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 +58 -10
- 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/compute.ts +6 -1
- 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/custom-view/loader.ts +95 -34
- package/src/plugins/builtin/custom-view/pane.tsx +31 -41
- package/src/plugins/builtin/custom-view/table.ts +201 -0
- 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/client.ts +14 -17
- package/src/plugins/builtin/dividend-yield/headless.ts +24 -16
- package/src/plugins/builtin/dividend-yield/index.tsx +2 -1
- package/src/plugins/builtin/dividend-yield/model.ts +52 -10
- package/src/plugins/builtin/dividend-yield/pane.tsx +89 -17
- 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/types.ts +2 -3
- package/src/plugins/builtin/dividend-yield/view.ts +58 -12
- 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 +207 -3
- package/src/plugins/builtin/econ/columns.ts +132 -0
- package/src/plugins/builtin/econ/index.tsx +27 -79
- 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 +66 -0
- package/src/plugins/builtin/holders/disclosures.ts +47 -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 +238 -48
- package/src/plugins/builtin/ipo-calendar/pane.tsx +91 -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 +11 -4
- package/src/plugins/builtin/kelly-sizer/pane.tsx +19 -9
- package/src/plugins/builtin/kelly-sizer/sections.tsx +2 -1
- package/src/plugins/builtin/kelly-sizer/units.ts +26 -0
- 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 +15 -3
- 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/row.ts +5 -12
- package/src/plugins/builtin/news/wire/news/table.tsx +46 -44
- 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/headless.ts +1 -1
- package/src/plugins/builtin/pe-band/model.ts +41 -18
- package/src/plugins/builtin/pe-band/pane.tsx +8 -6
- package/src/plugins/builtin/perps/cascade-tabs.tsx +2 -1
- package/src/plugins/builtin/perps/cascade.ts +4 -3
- package/src/plugins/builtin/perps/equity-row.tsx +4 -6
- package/src/plugins/builtin/perps/headless.ts +19 -12
- package/src/plugins/builtin/perps/markets-section.tsx +19 -15
- package/src/plugins/builtin/perps/model.ts +14 -5
- package/src/plugins/builtin/portfolio-list/cached-account.ts +3 -1
- package/src/plugins/builtin/portfolio-list/cli/import-positions.ts +6 -18
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +1 -1
- package/src/plugins/builtin/portfolio-list/pane/purchase-date-fx.ts +1 -1
- package/src/plugins/builtin/portfolio-list/positions-import/index.tsx +1 -1
- package/src/plugins/builtin/portfolio-list/positions-import/lookup.ts +28 -57
- 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 +140 -0
- package/src/plugins/builtin/research/event-detail.tsx +442 -0
- package/src/plugins/builtin/research/event-model.ts +338 -39
- 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 +39 -14
- package/src/plugins/builtin/research/relative-valuation-headless.ts +9 -5
- 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/flow-pane.tsx +10 -0
- 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 +69 -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 +169 -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/report-freshness.ts +4 -1
- 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 +35 -5
- package/src/plugins/builtin/ticker-detail/financials/exchange-table.tsx +61 -0
- package/src/plugins/builtin/ticker-detail/financials/model.ts +210 -43
- package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +69 -8
- package/src/plugins/builtin/ticker-detail/financials/ratios.ts +64 -10
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +132 -68
- package/src/plugins/builtin/ticker-detail/headless.ts +37 -13
- package/src/plugins/builtin/ticker-detail/overview/components.tsx +75 -14
- package/src/plugins/builtin/ticker-detail/overview/model.ts +87 -35
- 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 +50 -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/time-sales/model.ts +16 -9
- package/src/plugins/builtin/time-sales/pane.tsx +27 -24
- 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/treasury-daily/client.ts +43 -9
- package/src/plugins/builtin/treasury-daily/pane.tsx +48 -27
- package/src/plugins/builtin/treasury-daily/resource.ts +33 -0
- 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/portfolio/positions-import/parse.ts +14 -6
- package/src/portfolio/positions-import/plan.ts +3 -2
- package/src/public/__snapshots__/public-api.test.ts.snap +5 -0
- package/src/public/i18n.ts +3 -2
- package/src/react/async-resource.ts +3 -1
- package/src/renderers/dom/css.d.ts +1 -0
- package/src/renderers/dom/data-table/index.tsx +100 -8
- package/src/renderers/dom/data-table/row.tsx +40 -4
- package/src/renderers/dom/desktop/icons.tsx +147 -3
- package/src/renderers/dom/desktop/popover.tsx +2 -2
- package/src/renderers/dom/host/media-surface.tsx +204 -45
- package/src/renderers/dom/host/tabs.tsx +1 -0
- package/src/renderers/dom/styles.css +14 -2
- package/src/renderers/electrobun/bun/desktop/backend.ts +14 -1
- package/src/renderers/electrobun/bun/desktop/rpc-timing.ts +9 -3
- package/src/renderers/electrobun/shared/protocol.ts +2 -0
- package/src/renderers/electrobun/view/backend-rpc.ts +5 -2
- 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/renderers/electrobun/view/rpc-timeout.ts +44 -3
- package/src/sources/gloomberb-cloud/batched-lookups.ts +12 -1
- package/src/sources/gloomberb-cloud/index.ts +44 -10
- package/src/sources/gloomberb-cloud/normalizers.ts +8 -2
- package/src/sources/listing-symbols.ts +7 -1
- package/src/sources/provider-router/cache.ts +5 -4
- package/src/sources/provider-router/financials.ts +44 -22
- package/src/sources/provider-router/index.ts +9 -1
- package/src/state/app/context/index.tsx +12 -4
- package/src/state/app/tab-cursor.ts +47 -6
- 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/telemetry/stall-clocks.ts +3 -0
- package/src/telemetry/stall-reports.ts +12 -3
- package/src/telemetry/windows-process-activity.ts +41 -0
- package/src/telemetry/windows-time.ts +32 -0
- package/src/test-support/cloud-api.ts +34 -0
- package/src/test-support/scoped-earnings.ts +24 -0
- package/src/test-support/strict-table-capture.tsx +83 -0
- package/src/tickers/search/index.ts +23 -7
- package/src/tickers/terminal-codes.ts +1 -6
- 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/daily-valuation.ts +13 -6
- package/src/time-series/filed-trailing-eps.ts +16 -3
- package/src/time-series/fundamentals/current-valuation.ts +30 -5
- package/src/time-series/fundamentals/historical-valuation.ts +20 -0
- package/src/time-series/fundamentals/history-link.ts +25 -0
- package/src/time-series/fundamentals/quarterly-ttm.ts +50 -5
- package/src/time-series/fundamentals/series.ts +13 -1
- 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/time-series/valuation-currency.ts +2 -0
- package/src/types/config.ts +13 -61
- package/src/types/data-provider.ts +8 -0
- package/src/types/financials.ts +94 -15
- package/src/types/headless.ts +30 -0
- package/src/types/plugin-context.ts +8 -1
- package/src/ui/dialog-context.ts +8 -0
- package/src/utils/crypto-pair.ts +10 -0
- package/src/utils/datetime-format.ts +23 -1
- package/src/utils/day-format.ts +104 -0
- package/src/utils/declared-dividends.ts +12 -2
- package/src/utils/exchange-announcements.ts +38 -12
- package/src/utils/exchange-notation.generated.ts +3 -1
- package/src/utils/exchanges.ts +2 -1
- 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/fundamentals.ts +1 -0
- package/src/utils/main-thread-stall.ts +9 -1
- package/src/utils/rpc-timeout-error.ts +36 -11
- package/src/utils/sec.ts +3 -1
- package/src/utils/share-multiples.ts +1 -1
- package/src/utils/stall-process-activity.ts +70 -0
- package/src/utils/statement-scope.ts +103 -0
- package/src/utils/trailing-dividend.ts +47 -0
- package/src/utils/trailing-eps.ts +1 -1
- package/src/utils/zoned-date-time.ts +1 -0
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +0 -771
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { sourceDidNotAnswer } from "../../../api-client/errors";
|
|
1
2
|
import { createPluginCache, savedCopyForTransientFailure, type PluginCacheResult } from "../../../data/plugin-cache";
|
|
2
3
|
import { servedFromSavedCopy } from "../../../data/saved-copies";
|
|
3
4
|
import type { ConnectionHealthRegistry } from "../../../core/connection-health";
|
|
4
5
|
import type { PluginPersistence } from "../../../types/plugin";
|
|
5
6
|
import {
|
|
6
7
|
AUCTION_ARCHIVE_PAGE_SIZE, AUCTION_HISTORY_ALL, AUCTION_HISTORY_DAYS, AUCTION_HISTORY_START, auctionArchiveBoundary,
|
|
7
|
-
auctionWindowQuery, fetchTreasuryAuctions, type AuctionHistoryWindow, type AuctionQuery,
|
|
8
|
+
auctionWindowQuery, EMPTY_AUCTION_HISTORY, fetchTreasuryAuctions, type AuctionHistory, type AuctionHistoryWindow, type AuctionQuery,
|
|
8
9
|
} from "./client";
|
|
9
10
|
import { isPendingAuction, mergeAuctionSources } from "./model";
|
|
10
11
|
import { DIRECT_LOOKBACK_DAYS, fetchDirectAuctions } from "./treasury-direct";
|
|
@@ -80,16 +81,21 @@ export function resetTreasuryAuctionsPersistence(): void {
|
|
|
80
81
|
connectionHealth = null;
|
|
81
82
|
}
|
|
82
83
|
|
|
83
|
-
type AuctionLoader = (query: AuctionQuery) => Promise<
|
|
84
|
+
type AuctionLoader = (query: AuctionQuery) => Promise<AuctionHistory>;
|
|
84
85
|
/** The auctions of the last `days` days and the announced ones, from TreasuryDirect. */
|
|
85
86
|
type DirectLoader = (days: number) => Promise<TreasuryAuction[]>;
|
|
87
|
+
type DirectLookup = { days: number; load: DirectLoader; coversWindow: boolean };
|
|
86
88
|
|
|
87
|
-
/** One walk, reported through Connections
|
|
88
|
-
function walk(source: { id: string; name: string }, load: () => Promise<
|
|
89
|
+
/** One walk, reported through Connections. Only a covered zero-page history can be cached as empty. */
|
|
90
|
+
function walk(source: { id: string; name: string }, load: () => Promise<AuctionHistory>, coversEmpty?: () => Promise<boolean>) {
|
|
89
91
|
return async () => {
|
|
90
92
|
const auctions = await (connectionHealth?.hasSource(source.id)
|
|
91
93
|
? connectionHealth.track(source.id, "fetchAuctions", load)
|
|
92
94
|
: load());
|
|
95
|
+
if (auctions === EMPTY_AUCTION_HISTORY) {
|
|
96
|
+
if (await coversEmpty?.()) return [];
|
|
97
|
+
throw NO_FISCAL_HISTORY;
|
|
98
|
+
}
|
|
93
99
|
if (auctions.length === 0) throw new Error(`${source.name} returned no auctions`);
|
|
94
100
|
return auctions;
|
|
95
101
|
};
|
|
@@ -97,6 +103,7 @@ function walk(source: { id: string; name: string }, load: () => Promise<Treasury
|
|
|
97
103
|
|
|
98
104
|
const FISCAL_DATA = { id: TREASURY_FISCAL_DATA_CONNECTION_ID, name: "Treasury Fiscal Data" };
|
|
99
105
|
const TREASURY_DIRECT = { id: TREASURY_DIRECT_CONNECTION_ID, name: "TreasuryDirect" };
|
|
106
|
+
const NO_FISCAL_HISTORY = sourceDidNotAnswer("Treasury Fiscal Data returned no auctions");
|
|
100
107
|
|
|
101
108
|
/** One source's answer, or why it gave none: the other source's board stands in for it. */
|
|
102
109
|
type Answer = { read: PluginCacheResult<TreasuryAuction[]> } | { failed: unknown };
|
|
@@ -111,6 +118,12 @@ async function answer(read: Promise<PluginCacheResult<TreasuryAuction[]>>): Prom
|
|
|
111
118
|
|
|
112
119
|
const failureMessage = (failed: unknown) => failed instanceof Error ? failed.message : String(failed);
|
|
113
120
|
|
|
121
|
+
function directCoversHistory(direct: PluginCacheResult<TreasuryAuction[]> | null, lookup: DirectLookup | null, from: string): boolean {
|
|
122
|
+
if (!direct || !lookup?.coversWindow || direct.stale || auctionWindowQuery(lookup.days, direct.fetchedAt).from > from) return false;
|
|
123
|
+
const today = auctionWindowQuery(0).from;
|
|
124
|
+
return direct.data.some((auction) => auction.auctionDate >= from && auction.auctionDate <= today && !isPendingAuction(auction));
|
|
125
|
+
}
|
|
126
|
+
|
|
114
127
|
/**
|
|
115
128
|
* The recent auctions from both sources: Fiscal Data's walk of `fiscalKey`
|
|
116
129
|
* and TreasuryDirect's last weeks and announcements, each cached and refreshed
|
|
@@ -123,25 +136,35 @@ const failureMessage = (failed: unknown) => failed instanceof Error ? failed.mes
|
|
|
123
136
|
async function loadRecentBoard(
|
|
124
137
|
force: boolean,
|
|
125
138
|
fiscalKey: string,
|
|
126
|
-
fiscal: () => Promise<
|
|
127
|
-
direct:
|
|
128
|
-
from:
|
|
139
|
+
fiscal: () => Promise<AuctionHistory>,
|
|
140
|
+
direct: DirectLookup | null,
|
|
141
|
+
from: string,
|
|
129
142
|
): Promise<TreasuryAuctionsResult> {
|
|
130
143
|
const directKey = direct && `direct:${direct.days}`;
|
|
131
|
-
const unchanged = force ? null : savedRecentBoard(fiscalKey, directKey, from
|
|
144
|
+
const unchanged = force ? null : savedRecentBoard(fiscalKey, directKey, direct, from);
|
|
132
145
|
if (unchanged) return unchanged;
|
|
133
|
-
const
|
|
134
|
-
answer(
|
|
135
|
-
|
|
146
|
+
const recent = direct && directKey
|
|
147
|
+
? answer(directCache.load(directKey, walk(TREASURY_DIRECT, () => direct.load(direct.days)), { force })) : null;
|
|
148
|
+
const covered = (supplement: Answer | null) => !!supplement && "read" in supplement && directCoversHistory(supplement.read, direct, from);
|
|
149
|
+
const [history, supplement] = await Promise.all([
|
|
150
|
+
answer(cache.load(fiscalKey, walk(FISCAL_DATA, fiscal, async () => covered(await recent)), { force })),
|
|
151
|
+
recent,
|
|
136
152
|
]);
|
|
137
|
-
|
|
153
|
+
const primary = "read" in history && !history.read.data.length && (history.read.stale || !covered(supplement))
|
|
154
|
+
? { failed: history.read.error ?? NO_FISCAL_HISTORY } : history;
|
|
155
|
+
if ("failed" in primary && (!supplement || "failed" in supplement)) {
|
|
156
|
+
throw primary.failed === NO_FISCAL_HISTORY && supplement ? supplement.failed : primary.failed;
|
|
157
|
+
}
|
|
138
158
|
|
|
139
159
|
const answers = [primary, supplement].filter((entry): entry is { read: PluginCacheResult<TreasuryAuction[]> } => !!entry && "read" in entry);
|
|
140
160
|
const failed = [primary, supplement].find((entry): entry is { failed: unknown } => !!entry && "failed" in entry);
|
|
141
161
|
const saved = answers.filter(({ read }) => read.source === "stale-fallback");
|
|
142
|
-
const
|
|
162
|
+
const noHistory = ("read" in primary ? primary.read.error : primary.failed) === NO_FISCAL_HISTORY;
|
|
163
|
+
const recentError = noHistory && supplement
|
|
164
|
+
? "read" in supplement ? supplement.read.refreshError : failureMessage(supplement.failed) : undefined;
|
|
165
|
+
const refreshError = recentError ?? answers.find(({ read }) => read.refreshError)?.read.refreshError ?? (failed ? failureMessage(failed.failed) : undefined);
|
|
143
166
|
return {
|
|
144
|
-
auctions: mergeAuctionSources("read" in primary ? primary.read.data : [], supplement && "read" in supplement ? supplement.read.data : [], from
|
|
167
|
+
auctions: mergeAuctionSources("read" in primary ? primary.read.data : [], supplement && "read" in supplement ? supplement.read.data : [], from),
|
|
145
168
|
// The oldest part: how old what is shown can be.
|
|
146
169
|
fetchedAt: Math.min(...answers.map(({ read }) => read.fetchedAt)),
|
|
147
170
|
stale: !!failed || answers.some(({ read }) => read.stale),
|
|
@@ -186,11 +209,12 @@ function comeDue(auction: TreasuryAuction, today: string, weekAgo: string): bool
|
|
|
186
209
|
* cache already answers from a fresh copy, and keeps the failure of a refresh,
|
|
187
210
|
* so only a run that has read nothing yet (a command) looks here.
|
|
188
211
|
*/
|
|
189
|
-
function savedRecentBoard(fiscalKey: string, directKey: string | null, from: string, now = Date.now()): TreasuryAuctionsResult | null {
|
|
212
|
+
function savedRecentBoard(fiscalKey: string, directKey: string | null, lookup: DirectLookup | null, from: string, now = Date.now()): TreasuryAuctionsResult | null {
|
|
190
213
|
if (cache.get(fiscalKey)) return null;
|
|
191
214
|
const fiscal = cache.get(fiscalKey, { allowExpired: true });
|
|
192
215
|
const direct = directKey ? directCache.get(directKey, { allowExpired: true }) : null;
|
|
193
216
|
if (!fiscal || fiscal.stale || (directKey && (!direct || direct.stale))) return null;
|
|
217
|
+
if (!fiscal.data.length && !directCoversHistory(direct, lookup, from)) return null;
|
|
194
218
|
const auctions = mergeAuctionSources(fiscal.data, direct?.data ?? [], from);
|
|
195
219
|
const fetchedAt = Math.min(fiscal.fetchedAt, direct?.fetchedAt ?? Infinity);
|
|
196
220
|
const today = newYorkDay.format(now);
|
|
@@ -207,13 +231,14 @@ export async function loadTreasuryAuctions(
|
|
|
207
231
|
direct: DirectLoader | null = loader === fetchTreasuryAuctions ? fetchDirectAuctions : null,
|
|
208
232
|
): Promise<TreasuryAuctionsResult> {
|
|
209
233
|
if (window === AUCTION_HISTORY_ALL) return loadAllTreasuryAuctions(force, loader, direct);
|
|
234
|
+
const query = auctionWindowQuery(window);
|
|
210
235
|
// A saved board answers only for a failure asking again may get past; a refusal or an invalid page is the error.
|
|
211
236
|
return answered(await loadRecentBoard(
|
|
212
237
|
force,
|
|
213
238
|
`recent:${window}`,
|
|
214
|
-
() => loader(
|
|
215
|
-
direct && { days: Math.min(window, DIRECT_LOOKBACK_DAYS), load: direct },
|
|
216
|
-
|
|
239
|
+
() => loader(query),
|
|
240
|
+
direct && { days: Math.min(window, DIRECT_LOOKBACK_DAYS), load: direct, coversWindow: window <= DIRECT_LOOKBACK_DAYS },
|
|
241
|
+
query.from,
|
|
217
242
|
));
|
|
218
243
|
}
|
|
219
244
|
|
|
@@ -243,7 +268,7 @@ async function loadAllTreasuryAuctions(force: boolean, loader: AuctionLoader, di
|
|
|
243
268
|
const boundary = auctionArchiveBoundary();
|
|
244
269
|
const key = `archive:${boundary}`;
|
|
245
270
|
const [recent, archive] = await Promise.all([
|
|
246
|
-
loadRecentBoard(force, `since:${boundary}`, () => loader({ from: boundary }), direct && { days: DIRECT_LOOKBACK_DAYS, load: direct },
|
|
271
|
+
loadRecentBoard(force, `since:${boundary}`, () => loader({ from: boundary }), direct && { days: DIRECT_LOOKBACK_DAYS, load: direct, coversWindow: false }, boundary),
|
|
247
272
|
savedArchive(key) ?? archiveCache.load(key, walk(FISCAL_DATA, () => loader({
|
|
248
273
|
from: AUCTION_HISTORY_START, before: boundary, pageSize: AUCTION_ARCHIVE_PAGE_SIZE,
|
|
249
274
|
}))).then(savedCopyForTransientFailure),
|
|
@@ -58,6 +58,8 @@ export const AUCTION_ARCHIVE_PAGE_SIZE = 5000;
|
|
|
58
58
|
const FISCAL_DATA_MAX_PAGE_SIZE = 10_000;
|
|
59
59
|
/** Three times the longest walk's pages; the bound only exists so bad metadata cannot loop. */
|
|
60
60
|
export const AUCTION_MAX_PAGES = 12;
|
|
61
|
+
export const EMPTY_AUCTION_HISTORY = Symbol("empty auction history");
|
|
62
|
+
export type AuctionHistory = TreasuryAuction[] | typeof EMPTY_AUCTION_HISTORY;
|
|
61
63
|
|
|
62
64
|
/** One walk: auctions on or after `from` and, when set, before `before`. */
|
|
63
65
|
export interface AuctionQuery {
|
|
@@ -113,8 +115,10 @@ export function buildAuctionsUrl(query: AuctionQuery, page = 1): string {
|
|
|
113
115
|
|
|
114
116
|
/** Fiscal Data reports the page count as `meta["total-pages"]`. */
|
|
115
117
|
export function totalPages(body: unknown, page = 1): number {
|
|
116
|
-
const meta = (body as { meta?: Record<string, unknown> } | null)
|
|
118
|
+
const { data, meta } = (body as { data?: unknown; meta?: Record<string, unknown> } | null) ?? {};
|
|
117
119
|
const value = meta?.["total-pages"];
|
|
120
|
+
if (page === 1 && value === 0 && meta?.count === 0 && meta["total-count"] === 0
|
|
121
|
+
&& Array.isArray(data) && data.length === 0) return 0;
|
|
118
122
|
const pages = typeof value === "number" || (typeof value === "string" && value.trim())
|
|
119
123
|
? Number(value) : NaN;
|
|
120
124
|
if (!Number.isSafeInteger(pages) || pages < 1) {
|
|
@@ -218,7 +222,7 @@ export function parseTreasuryAuctionsPayload(body: unknown): TreasuryAuction[] {
|
|
|
218
222
|
*/
|
|
219
223
|
export async function fetchAuctionPages(
|
|
220
224
|
loadPage: (page: number) => Promise<unknown>,
|
|
221
|
-
): Promise<
|
|
225
|
+
): Promise<AuctionHistory> {
|
|
222
226
|
const auctions: TreasuryAuction[] = [];
|
|
223
227
|
const seen = new Set<string>();
|
|
224
228
|
let pages = 1;
|
|
@@ -226,6 +230,7 @@ export async function fetchAuctionPages(
|
|
|
226
230
|
for (let page = 1; page <= Math.min(pages, AUCTION_MAX_PAGES); page += 1) {
|
|
227
231
|
const body = await loadPage(page);
|
|
228
232
|
const declaredPages = totalPages(body, page);
|
|
233
|
+
if (declaredPages === 0) return EMPTY_AUCTION_HISTORY;
|
|
229
234
|
if (page === 1) pages = declaredPages;
|
|
230
235
|
else if (declaredPages !== pages) {
|
|
231
236
|
throw new Error(`Treasury auction page count changed on page ${page}`);
|
|
@@ -237,7 +242,7 @@ export async function fetchAuctionPages(
|
|
|
237
242
|
if (!Array.isArray(data)) {
|
|
238
243
|
throw new Error(`Treasury auction page ${page} has invalid data`);
|
|
239
244
|
}
|
|
240
|
-
if (
|
|
245
|
+
if (data.length === 0) {
|
|
241
246
|
throw new Error(`Treasury auction page ${page} is missing`);
|
|
242
247
|
}
|
|
243
248
|
// A declared page must be usable in full before any of the walk can be
|
|
@@ -256,7 +261,7 @@ export async function fetchAuctionPages(
|
|
|
256
261
|
|
|
257
262
|
export async function fetchTreasuryAuctions(
|
|
258
263
|
query: AuctionQuery = auctionWindowQuery(AUCTION_HISTORY_DAYS),
|
|
259
|
-
): Promise<
|
|
264
|
+
): Promise<AuctionHistory> {
|
|
260
265
|
return fetchAuctionPages(async (page) => {
|
|
261
266
|
const response = await TREASURY_FETCH.fetch(buildAuctionsUrl(query, page));
|
|
262
267
|
// The status stays: an overloaded server is a failure a saved board may answer for, a refusal is not.
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ApiRequestError, sourceDidNotAnswer } from "../../../api-client/errors";
|
|
2
|
+
import { OperationTimeoutError, signalWithTimeout } from "../../../utils/async-deadline";
|
|
3
|
+
import { readCalendarDate } from "../../../utils/calendar-date";
|
|
2
4
|
import { httpFetch } from "../../../utils/http-transport";
|
|
3
5
|
import { numericOrNull, scalarTextOrNull } from "../../../utils/guards";
|
|
4
6
|
import { cashLineLabel, type CashAccount, type DebtDay, type OperatingCash, type TgaClose } from "./model";
|
|
@@ -26,7 +28,7 @@ export interface TreasuryDaily {
|
|
|
26
28
|
|
|
27
29
|
function recordDate(value: unknown): string | null {
|
|
28
30
|
const date = scalarTextOrNull(value);
|
|
29
|
-
return date &&
|
|
31
|
+
return date && readCalendarDate(date) === date ? date : null;
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
function isBusinessDay(iso: string): boolean {
|
|
@@ -109,15 +111,42 @@ function parseDebtToPenny(payload: unknown): DebtDay[] {
|
|
|
109
111
|
async function readJson(url: string, label: string, signal: AbortSignal | undefined, timeoutMs: number): Promise<unknown> {
|
|
110
112
|
const deadline = signalWithTimeout(signal, timeoutMs);
|
|
111
113
|
try {
|
|
114
|
+
deadline.throwIfAborted();
|
|
112
115
|
const response = await httpFetch(url, { headers: { Accept: "application/json" }, signal: deadline });
|
|
113
|
-
if (!response.ok) throw new
|
|
114
|
-
|
|
116
|
+
if (!response.ok) throw new ApiRequestError(`${label} request failed (${response.status})`, response.status);
|
|
117
|
+
const payload = await response.json() as unknown;
|
|
118
|
+
deadline.throwIfAborted();
|
|
119
|
+
return payload;
|
|
115
120
|
} catch (error) {
|
|
116
|
-
|
|
121
|
+
signal?.throwIfAborted();
|
|
122
|
+
if (deadline.aborted) throw new OperationTimeoutError(`${label} request timed out after ${Math.round(timeoutMs / 1000)} s`);
|
|
117
123
|
throw error;
|
|
118
124
|
}
|
|
119
125
|
}
|
|
120
126
|
|
|
127
|
+
const readCash = (signal?: AbortSignal, timeoutMs = FETCH_TIMEOUT_MS) => readJson(CASH_URL, "Treasury cash", signal, timeoutMs);
|
|
128
|
+
const readDebt = (signal?: AbortSignal, timeoutMs = FETCH_TIMEOUT_MS) => readJson(DEBT_URL, "Treasury debt", signal, timeoutMs);
|
|
129
|
+
const readTga = (signal?: AbortSignal, timeoutMs = FETCH_TIMEOUT_MS) => readJson(TGA_HISTORY_URL, "Treasury account history", signal, timeoutMs).then(parseTgaHistory);
|
|
130
|
+
|
|
131
|
+
export async function fetchTreasuryCash(signal: AbortSignal, timeoutMs?: number): Promise<OperatingCash> {
|
|
132
|
+
const cash = parseOperatingCash(await readCash(signal, timeoutMs));
|
|
133
|
+
if (!cash.rows.some(({ today, month }) => today !== null || month !== null)) throw sourceDidNotAnswer("No published cash figures received");
|
|
134
|
+
return cash;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export async function fetchTreasuryDebt(signal: AbortSignal, timeoutMs?: number): Promise<DebtDay[]> {
|
|
138
|
+
const debt = parseDebtToPenny(await readDebt(signal, timeoutMs));
|
|
139
|
+
const published = debt.filter(({ heldByPublic, intragovernmental, total }) => heldByPublic !== null || intragovernmental !== null || total !== null);
|
|
140
|
+
if (!published.length) throw sourceDidNotAnswer("No published debt figures received");
|
|
141
|
+
return published;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export async function fetchTreasuryHistory(signal: AbortSignal, timeoutMs?: number): Promise<TgaClose[]> {
|
|
145
|
+
const history = await readTga(signal, timeoutMs);
|
|
146
|
+
if (!history.length) throw sourceDidNotAnswer("No closing balance history received");
|
|
147
|
+
return history;
|
|
148
|
+
}
|
|
149
|
+
|
|
121
150
|
/**
|
|
122
151
|
* The latest day's cash lines and the last 20 days of debt, with the account's
|
|
123
152
|
* closing balance history unless `history` is off (a report that does not draw it).
|
|
@@ -128,13 +157,18 @@ export async function fetchTreasuryDaily(
|
|
|
128
157
|
{ history = true, timeoutMs = FETCH_TIMEOUT_MS }: { history?: boolean; timeoutMs?: number } = {},
|
|
129
158
|
): Promise<TreasuryDaily> {
|
|
130
159
|
const [cash, debt, tga] = await Promise.all([
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
history ?
|
|
160
|
+
readCash(signal, timeoutMs),
|
|
161
|
+
readDebt(signal, timeoutMs),
|
|
162
|
+
history ? readTga(signal, timeoutMs).then(
|
|
134
163
|
(closes) => ({ closes }),
|
|
135
164
|
(error: unknown) => ({ closes: [] as TgaClose[], error: error instanceof Error ? error.message : String(error) }),
|
|
136
165
|
) : { closes: [] as TgaClose[] },
|
|
137
|
-
])
|
|
166
|
+
]).catch((error: unknown) => {
|
|
167
|
+
if (error === signal?.reason && signal?.aborted) throw error;
|
|
168
|
+
if (error instanceof ApiRequestError || error instanceof OperationTimeoutError) throw new Error(error.message);
|
|
169
|
+
throw error;
|
|
170
|
+
});
|
|
171
|
+
signal?.throwIfAborted();
|
|
138
172
|
return {
|
|
139
173
|
cash: parseOperatingCash(cash),
|
|
140
174
|
debt: parseDebtToPenny(debt),
|
|
@@ -15,13 +15,14 @@ import { spanAxisFormatter } from "../../../components/chart-table";
|
|
|
15
15
|
import { useChartViewReset } from "../../../components/chart/core/view-reset";
|
|
16
16
|
import { scalarPoint, staticSeries } from "../../../components/chart/static/series";
|
|
17
17
|
import { handleRefreshKey, usePaneRefreshKey } from "../../../components/data-table/table-pane";
|
|
18
|
-
import {
|
|
18
|
+
import { STALE_SEGMENT } from "../../../components/layout/pane/status-footer";
|
|
19
|
+
import { useAutoRefresh, usePluginPaneState } from "../../../public/react";
|
|
19
20
|
import { useThemeColors } from "../../../theme/theme-context";
|
|
20
21
|
import type { PaneProps } from "../../../types/plugin";
|
|
21
22
|
import { Box } from "../../../ui";
|
|
22
23
|
import { formatNumber } from "../../../utils/format";
|
|
23
24
|
import { isPlainKeyboardEvent } from "../../../utils/keyboard";
|
|
24
|
-
import {
|
|
25
|
+
import { useTreasuryDailyResources } from "./resource";
|
|
25
26
|
import {
|
|
26
27
|
CASH_COLUMNS,
|
|
27
28
|
DEBT_COLUMNS,
|
|
@@ -54,24 +55,19 @@ function scaledCell(value: number | null, text: string, muted: string): DataTabl
|
|
|
54
55
|
|
|
55
56
|
export function TreasuryDailyPane({ width, height, focused }: PaneProps) {
|
|
56
57
|
const colors = useThemeColors();
|
|
57
|
-
const
|
|
58
|
-
const resource = useAsyncResource(request);
|
|
58
|
+
const { cash, debt, history } = useTreasuryDailyResources();
|
|
59
59
|
const [storedTab, setTab] = usePluginPaneState<string>("tab", "cash");
|
|
60
60
|
const tab: TreasuryTab = storedTab === "debt" ? "debt" : "cash";
|
|
61
|
-
const
|
|
62
|
-
const cashRows = data?.
|
|
63
|
-
const debtRows = data
|
|
61
|
+
const active = tab === "cash" ? cash : debt;
|
|
62
|
+
const cashRows = cash.data?.rows ?? EMPTY_CASH;
|
|
63
|
+
const debtRows = debt.data ?? EMPTY_DEBT;
|
|
64
64
|
const activeRows = tab === "cash" ? cashRows : debtRows;
|
|
65
|
-
const recordDate = tab === "cash" ? data?.
|
|
65
|
+
const recordDate = tab === "cash" ? cash.data?.recordDate ?? null : debtRows[0]?.date ?? null;
|
|
66
66
|
const [storedRange, setStoredRange] = usePluginPaneState<string>("range", "1Y");
|
|
67
67
|
const range = tgaRange(storedRange);
|
|
68
68
|
const resetChartView = useChartViewReset();
|
|
69
69
|
const [selectedId, setSelectedId] = useState<string | null>(null);
|
|
70
70
|
const resolvedId = activeRows.some((row) => row.id === selectedId) ? selectedId : activeRows[0]?.id ?? null;
|
|
71
|
-
const info = useMemo(
|
|
72
|
-
() => (recordDate ? [{ id: "record-date", parts: [{ text: recordDate, tone: "muted" as const }] }] : []),
|
|
73
|
-
[recordDate],
|
|
74
|
-
);
|
|
75
71
|
const { strip, rows: tabRows } = usePaneTabs({
|
|
76
72
|
tabs: TREASURY_TABS,
|
|
77
73
|
activeValue: tab,
|
|
@@ -79,30 +75,55 @@ export function TreasuryDailyPane({ width, height, focused }: PaneProps) {
|
|
|
79
75
|
focused,
|
|
80
76
|
dense: true,
|
|
81
77
|
});
|
|
82
|
-
|
|
83
|
-
const
|
|
78
|
+
const resources = [cash, debt, history];
|
|
79
|
+
const lastUpdated = resources.every((section) => section.updatedAt !== null && section.savedAt === null && !section.error)
|
|
80
|
+
? Math.min(...resources.map((section) => section.updatedAt!)) : null;
|
|
81
|
+
const refresh = useCallback(() => {
|
|
82
|
+
cash.reload();
|
|
83
|
+
debt.reload();
|
|
84
|
+
history.reload();
|
|
85
|
+
}, [cash.reload, debt.reload, history.reload]);
|
|
86
|
+
useAutoRefresh(lastUpdated, refresh);
|
|
84
87
|
usePaneRefreshKey(refresh, { focused });
|
|
88
|
+
const subject = tab === "cash" ? "Treasury cash" : "Treasury debt";
|
|
89
|
+
const activeError = active.data ? null : active.error;
|
|
90
|
+
const activeLoading = !active.data && active.loading;
|
|
91
|
+
const historyDate = tab === "cash" && history.savedAt !== null ? history.data?.at(-1)?.date : undefined;
|
|
92
|
+
const partial = resources.some((section) => section.error) && resources.some((section) => section.data);
|
|
93
|
+
const stale = active.savedAt !== null;
|
|
94
|
+
const info = useMemo(() => [
|
|
95
|
+
...(recordDate ? [{ id: "record-date", capture: partial || stale, parts: [{ text: recordDate, tone: "muted" as const }] }] : []),
|
|
96
|
+
...(stale ? [{ ...STALE_SEGMENT, capture: true }] : []),
|
|
97
|
+
...(historyDate ? [{ id: "history-date", capture: true, parts: [{ text: `History stale · ${historyDate}`, tone: "warning" as const }] }] : []),
|
|
98
|
+
...(partial ? [{ id: "partial", capture: true, parts: [{ text: "partial", tone: "warning" as const }] }] : []),
|
|
99
|
+
], [historyDate, partial, recordDate, stale]);
|
|
85
100
|
usePaneStatusFooter({
|
|
86
101
|
registrationId: TREASURY_DAILY_PANE_ID,
|
|
87
|
-
loading:
|
|
88
|
-
error:
|
|
102
|
+
loading: active.loading,
|
|
103
|
+
error: activeError,
|
|
89
104
|
info,
|
|
90
105
|
});
|
|
91
106
|
usePaneNoticeFooter({
|
|
92
|
-
registrationId: `${TREASURY_DAILY_PANE_ID}:
|
|
93
|
-
focused
|
|
94
|
-
notices:
|
|
107
|
+
registrationId: `${TREASURY_DAILY_PANE_ID}:warnings`,
|
|
108
|
+
focused,
|
|
109
|
+
notices: [
|
|
110
|
+
{ label: "Cash", section: cash, bodyError: tab === "cash" && activeError },
|
|
111
|
+
{ label: "Debt", section: debt, bodyError: tab === "debt" && activeError },
|
|
112
|
+
{ label: "Closing balance history", section: history, bodyError: false },
|
|
113
|
+
].flatMap(({ label, section, bodyError }) => section.error && !bodyError
|
|
114
|
+
? [`${label} ${section.data ? "refresh failed; showing saved data" : "unavailable"}: ${section.error}`]
|
|
115
|
+
: []),
|
|
95
116
|
});
|
|
96
117
|
|
|
97
118
|
// The closing balance the table's last line states for the day, drawn over the range chosen.
|
|
98
119
|
const series = useMemo(() => {
|
|
99
|
-
const closes = tgaClosesInRange(data
|
|
120
|
+
const closes = tgaClosesInRange(history.data ?? [], range);
|
|
100
121
|
return closes.length < 2 ? [] : [staticSeries(
|
|
101
122
|
closes.map((close) => scalarPoint(new Date(`${close.date}T00:00:00Z`), close.millions / 1_000)),
|
|
102
123
|
{ id: "tga-closing-balance", label: TGA_SERIES_LABEL, color: colors.positive, calendarSpaced: true },
|
|
103
124
|
)];
|
|
104
|
-
}, [colors.positive, data
|
|
105
|
-
const chart: ChartTableChart | null = data
|
|
125
|
+
}, [colors.positive, history.data, range]);
|
|
126
|
+
const chart: ChartTableChart | null = !history.data ? null : {
|
|
106
127
|
series,
|
|
107
128
|
formatValue: formatBillionsLevel,
|
|
108
129
|
formatAxisValue: formatBillionsAxis,
|
|
@@ -136,16 +157,15 @@ export function TreasuryDailyPane({ width, height, focused }: PaneProps) {
|
|
|
136
157
|
}, [colors.textMuted]);
|
|
137
158
|
|
|
138
159
|
let body = null;
|
|
139
|
-
if (
|
|
160
|
+
if (activeLoading && (tab === "debt" || !chart)) {
|
|
140
161
|
body = <PaneStatusBody loading align="center" />;
|
|
141
|
-
} else if (
|
|
142
|
-
body = <PaneStatusBody error={resource.error} subject="Treasury cash and debt" />;
|
|
143
|
-
} else if (data && tab === "cash") {
|
|
162
|
+
} else if (tab === "cash") {
|
|
144
163
|
body = (
|
|
145
164
|
<DataTableView<CashAccount, CashColumn>
|
|
146
165
|
focused={focused}
|
|
147
166
|
rootWidth={width}
|
|
148
167
|
rootHeight={bodyHeight}
|
|
168
|
+
status={{ loading: activeLoading, error: activeError, subject }}
|
|
149
169
|
rootBefore={chart ? (
|
|
150
170
|
<ChartTableHeader
|
|
151
171
|
width={width}
|
|
@@ -186,12 +206,13 @@ export function TreasuryDailyPane({ width, height, focused }: PaneProps) {
|
|
|
186
206
|
emptyStateTitle="No cash balance for this day."
|
|
187
207
|
/>
|
|
188
208
|
);
|
|
189
|
-
} else
|
|
209
|
+
} else {
|
|
190
210
|
body = (
|
|
191
211
|
<DataTableView<DebtDay, DebtColumn>
|
|
192
212
|
focused={focused}
|
|
193
213
|
rootWidth={width}
|
|
194
214
|
rootHeight={bodyHeight}
|
|
215
|
+
status={{ error: activeError, subject }}
|
|
195
216
|
columns={DEBT_COLUMNS}
|
|
196
217
|
items={debtRows}
|
|
197
218
|
sortColumnId={null}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef } from "react";
|
|
2
|
+
import { isTransientFailure } from "../../../api-client/errors";
|
|
3
|
+
import { useAsyncResource } from "../../../public/react";
|
|
4
|
+
import { fetchTreasuryCash, fetchTreasuryDebt, fetchTreasuryHistory } from "./client";
|
|
5
|
+
import { TREASURY_DAILY_PANE_ID } from "./model";
|
|
6
|
+
|
|
7
|
+
function useStatementSection<T>(section: string, read: (signal: AbortSignal, timeoutMs?: number) => Promise<T>, timeoutMs?: number) {
|
|
8
|
+
const pending = useRef<AbortController | null>(null);
|
|
9
|
+
useEffect(() => () => pending.current?.abort(), []);
|
|
10
|
+
const load = useCallback(async () => {
|
|
11
|
+
pending.current?.abort();
|
|
12
|
+
const controller = new AbortController();
|
|
13
|
+
pending.current = controller;
|
|
14
|
+
try {
|
|
15
|
+
return await read(controller.signal, timeoutMs);
|
|
16
|
+
} finally {
|
|
17
|
+
if (pending.current === controller) pending.current = null;
|
|
18
|
+
}
|
|
19
|
+
}, [read, timeoutMs]);
|
|
20
|
+
return useAsyncResource(load, {
|
|
21
|
+
savedCopy: { key: [TREASURY_DAILY_PANE_ID, section] },
|
|
22
|
+
clearOnError: (error) => !isTransientFailure(error),
|
|
23
|
+
showSavedCopyFooter: false,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function useTreasuryDailyResources(timeoutMs?: number) {
|
|
28
|
+
return {
|
|
29
|
+
cash: useStatementSection("cash", fetchTreasuryCash, timeoutMs),
|
|
30
|
+
debt: useStatementSection("debt", fetchTreasuryDebt, timeoutMs),
|
|
31
|
+
history: useStatementSection("history", fetchTreasuryHistory, timeoutMs),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -69,7 +69,9 @@ export function SmileChart({ snapshot, expiry, overlay, axis, width, height, foc
|
|
|
69
69
|
ticks: Array.from({ length: 5 }, (_, i) => ({ ratio: i / 4, label: tickLabel(left + (right - left) * i / 4, axis) })),
|
|
70
70
|
left, right };
|
|
71
71
|
}, [axis, colors, expiry, overlay, snapshot]);
|
|
72
|
-
|
|
72
|
+
// An expiry left unfitted says why, as the Table's expiry list does.
|
|
73
|
+
const reason = expiry?.state === "empty" || expiry?.state === "error" ? expiry.error ?? expiry.warnings.at(-1) : null;
|
|
74
|
+
if (!model) return <EmptyState title="Smile unavailable." hint={reason ? `${reason}.` : "No clean quoted smile for this expiry."} />;
|
|
73
75
|
const axisLabel = axis === "strike" ? "Strike" : axis === "delta" ? "100 x (1 - call delta)" : `${axis === "forward" ? "Forward" : "Spot"} %`;
|
|
74
76
|
return <Box flexDirection="column" width={width} height={height}>
|
|
75
77
|
<Box height={1} flexDirection="row" gap={3} paddingX={1}>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MISSING_VALUE } from "../../../utils/format";
|
|
2
|
+
import { formatDay } from "../../../utils/day-format";
|
|
2
3
|
import type { apiClient as cloudApiClient } from "../../../api-client";
|
|
3
4
|
import type { InstrumentRef } from "../../../market-data/request-types";
|
|
4
5
|
import type { DataProvider } from "../../../types/data-provider";
|
|
@@ -157,11 +158,13 @@ export function surfaceEventSummary(reading: SurfaceEventReading, { historyFaile
|
|
|
157
158
|
return `fwd ${percent(reading.forwardVol, 1)} · move ${approximatePercent(reading.impliedMove)} · MDAY ${historyFailed ? "did not load" : surfaceEventHistory(reading.events)}`;
|
|
158
159
|
}
|
|
159
160
|
|
|
160
|
-
/** "FOMC 12-09". */
|
|
161
|
-
const surfaceEventLabel = (event: Pick<SurfaceEvent, "kind" | "date"
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
161
|
+
/** "FOMC 09 Dec", its day first as tables write it; `exported`, as a report's JSON and CSV have always named it ("FOMC 12-09"). */
|
|
162
|
+
const surfaceEventLabel = (event: Pick<SurfaceEvent, "kind" | "date">, exported = false) =>
|
|
163
|
+
`${MACRO_EVENT_LABELS[event.kind]} ${exported ? event.date.slice(5) : formatDay(event.date, "no-year")}`;
|
|
164
|
+
/** "FOMC 09 Dec + CPI 10 Dec". */
|
|
165
|
+
export const surfaceReadingLabel = (reading: Pick<SurfaceEventReading, "events">, exported = false) =>
|
|
166
|
+
reading.events.map((event) => surfaceEventLabel(event, exported)).join(" + ");
|
|
167
|
+
/** For a narrow row: "FOMC 09 Dec", or "FOMC+CPI" for releases read together, which the chart dates. */
|
|
165
168
|
export const surfaceReadingShortLabel = (reading: Pick<SurfaceEventReading, "events">) => reading.events.length === 1
|
|
166
169
|
? surfaceEventLabel(reading.events[0]!) : reading.events.map((event) => MACRO_EVENT_LABELS[event.kind]).join("+");
|
|
167
170
|
|
|
@@ -4,7 +4,7 @@ import { sameListingKey } from "../../../utils/exchanges";
|
|
|
4
4
|
import type { SurfaceExpiry, SurfaceGrid, SurfaceSnapshot } from "./model";
|
|
5
5
|
import { isFiniteNumber, isRecord } from "../../../utils/guards";
|
|
6
6
|
import { expiryIsoDate } from "../../../utils/option-expiry";
|
|
7
|
-
import {
|
|
7
|
+
import { expiryStamp, surfaceExpiryGaps, surfaceSkewRow } from "./tables";
|
|
8
8
|
|
|
9
9
|
export interface VolSurfaceEvidenceInput {
|
|
10
10
|
snapshot: SurfaceSnapshot | null | undefined;
|
|
@@ -220,7 +220,7 @@ export const volSurfaceScreenshotEvidence: PaneScreenshotEvidenceHook<VolSurface
|
|
|
220
220
|
// A failure an expiry's own error already names is not said twice.
|
|
221
221
|
const named = new Set(evidence.expiries.filter((expiry) => expiry.state === "error").map((expiry) => expiry.expiration));
|
|
222
222
|
const failed = evidence.failures.filter((failure) => failure.expiration == null || !named.has(failure.expiration))
|
|
223
|
-
.map((failure) => `failed: ${failure.expiration == null ? "" : `${
|
|
223
|
+
.map((failure) => `failed: ${failure.expiration == null ? "" : `${expiryStamp(failure.expiration)}, `}${failure.message}`);
|
|
224
224
|
// Never null for a surface that is not whole, so its capture stays partial.
|
|
225
225
|
const ready = evidence.expiries.filter((expiry) => expiry.state === "ready" && !expiry.stale).length;
|
|
226
226
|
return [surfaceExpiryGaps(evidence.expiries, evidence.requestedExpiries)
|